Advapi32.dll missing function

  • Thread starter Thread starter Bilal
  • Start date Start date
B

Bilal

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.
 
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/default.asp?url=/library/en-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/default.asp?url=/library/en-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.
 
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...
 
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?
 
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.
 
Back
Top