PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 2.33 average.

Advapi32.dll missing function

 
 
Bilal
Guest
Posts: n/a
 
      13th Jan 2004
Hi, I was trying to import the CreateProcessWithTokenW
function from advapi32.dll into .Net (from other source
code I found on the internet), but for some reason, I keep
getting "Unable to find entry point for function
CreateProcessWithTokenW" like it doesnt exist in the dll.
I opened the dll with extends, which lists the functions
in a given dll and surely CreateProcessWithLogonW is there
but no sign of CreateProcessWithTokenW. So i dont
understand how every sample code I found imports this
function from this dll but my version of it doesnt contain
it. Any help on versioning issues, or a dll with the
function in it would be very useful, thanks in advance.

Note: I am running Windows XP with .Net Framework 1.1 and
Visual Studio .Net 2003.
 
Reply With Quote
 
 
 
 
Willy Denoyette [MVP]
Guest
Posts: n/a
 
      13th Jan 2004
This function is new for W2K3.

Willy.

"Bilal" <(E-Mail Removed)> wrote in message
news:07fb01c3d9fd$d4d2bd80$(E-Mail Removed)...
> Hi, I was trying to import the CreateProcessWithTokenW
> function from advapi32.dll into .Net (from other source
> code I found on the internet), but for some reason, I keep
> getting "Unable to find entry point for function
> CreateProcessWithTokenW" like it doesnt exist in the dll.
> I opened the dll with extends, which lists the functions
> in a given dll and surely CreateProcessWithLogonW is there
> but no sign of CreateProcessWithTokenW. So i dont
> understand how every sample code I found imports this
> function from this dll but my version of it doesnt contain
> it. Any help on versioning issues, or a dll with the
> function in it would be very useful, thanks in advance.
>
> Note: I am running Windows XP with .Net Framework 1.1 and
> Visual Studio .Net 2003.



 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      14th Jan 2004
Hello,

Willy is correct that the function CreateProcessWithTokenW() is introduced
in Windows Server 2003, and an early version of Advapi32.dll say, the one
shipped with Windows XP, does not have this function. You will need to call
CreateProcessWithLogonW() instead.

CreateProcessWithLogonW
http://msdn.microsoft.com/library/de...us/dllproc/bas
e/createprocesswithlogonw.asp

In the MSDN documentation on CreateProcessWithTokenW, its Requirments reads:
"Requirements
Server: Requires Windows Server 2003.
Unicode: Implemented only as Unicode
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib."

CreateProcessWithTokenW
http://msdn.microsoft.com/library/de...us/dllproc/bas
e/createprocesswithtokenw.asp

Please feel free to let me know if you have any problems or concerns.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Bilal Dinc
Guest
Posts: n/a
 
      14th Jan 2004
Thanks for your reply. Would it be possible to obtain the advapi32.dll
from a 2003 Server and use it in XP to get access to that function? The
reason I dont want to use CreateProcessWithLogonW is because it requires
a username and password be passed in as parameters to the function,
which is not very deployable to other machines where the hardcoded
username/password might not have the same rights (i'm trying to avoid
having to create a domain username just for this purpose). I figured if
I could use the CreateProcessWithTokenW function, with the token of the
user accessing the aspx page (from WindowsIdentity.GetCurrent().Token,
then use DuplicateTokenEx, also from advapi32.dll), then I could run my
process without having to know the actual username/password of the user
accessing the page (granted they had access to do whatever the external
process is trying to run). Any thoughts would be appreciated, thank
you...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Willy Denoyette [MVP]
Guest
Posts: n/a
 
      14th Jan 2004
You can't use this dll on anything other than w2k3.

Willy.

"Bilal Dinc" <(E-Mail Removed)> wrote in message
news:O%(E-Mail Removed)...
> Thanks for your reply. Would it be possible to obtain the advapi32.dll
> from a 2003 Server and use it in XP to get access to that function? The
> reason I dont want to use CreateProcessWithLogonW is because it requires
> a username and password be passed in as parameters to the function,
> which is not very deployable to other machines where the hardcoded
> username/password might not have the same rights (i'm trying to avoid
> having to create a domain username just for this purpose). I figured if
> I could use the CreateProcessWithTokenW function, with the token of the
> user accessing the aspx page (from WindowsIdentity.GetCurrent().Token,
> then use DuplicateTokenEx, also from advapi32.dll), then I could run my
> process without having to know the actual username/password of the user
> accessing the page (granted they had access to do whatever the external
> process is trying to run). Any thoughts would be appreciated, thank
> you...
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Bilal Dinc
Guest
Posts: n/a
 
      14th Jan 2004
Then is there anyway we can find out how CreateProcessWithLogonW's
underlying code works? Maybe then I can duplicate it to how I need it to
work. I dont think the source code is available anywhere, does anyone
have any idea what functions it calls?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      15th Jan 2004
Hello Bilal,

Thanks for your feedback.

CreateProcessWithLogonW is supported in Windows XP/2000/2003. Please refer
to MSDN documentation on CreateProcessWithLogonW, which says:

"Requirements
Client: Requires Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2003 or Windows 2000 Server.
Unicode: Implemented only as Unicode.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib."

I look forward to your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EFS AddUsersToEncryptedFile Function (advapi32.dll) Silke Anita Mühlemann Microsoft C# .NET 0 17th Oct 2008 07:44 AM
Excel coredumps with each call to a dll - for function RegQueryValueExA in advapi32.dll Tom Med Microsoft Excel Programming 4 19th Sep 2007 03:37 PM
Hashing function CryptAcquireContext Lib "advapi32" not working in new computer. Stephen Rasey Microsoft Excel Programming 5 25th Dec 2006 04:05 AM
Function of dynamic link library ADVAPI32.dll Microsoft Windows 2000 Advanced Server 1 29th Apr 2004 06:52 PM
advapi32.dll does not contain safercloselevel function Frank Liptak Microsoft Windows 2000 Windows Updates 0 29th Dec 2003 09:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 AM.