467,169 Members | 985 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,169 developers. It's quick & easy.

Launching unmanaged code as another user

I need to launch an app from inside my VB.NET app as a
specific user.

I do (VB.NET pseudo code)
Dim moImpersonationContext As WindowsImpersonationContext
= WindowsIdentityIwant.impersonate()
Shell('cmd /C TheCommandToLaunchTheUnmanagedCode')

I can verify that the Shell command runs under the new
Windows Identity, but the unmanaged code still launched
under the logged on user.

What am I doing wrong?
Jul 19 '05 #1
  • viewed: 1808
Share:
1 Reply
Hello Greg,

Thanks for your post. I suggest that you can use P/Invoke to call
CreateProcessAsUser directly to launch an app as a specific user. Please
refer to the following MSDN articles:

Consuming Unmanaged DLL Functions
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconconsumingunmanageddllfunctions.asp?frame=true

CreateProcessAsUser
http://msdn.microsoft.com/library/de...us/dllproc/bas
e/createprocessasuser.asp

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by JKJ | last post: by
4 posts views Thread by Rachel Suddeth | last post: by
6 posts views Thread by marek | last post: by
1 post views Thread by Greg Wilson | last post: by
1 post views Thread by Water Cooler v2 | last post: by
2 posts views Thread by tempnode@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.