Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / March 2005

Tip: Looking for answers? Try searching our database.

CreateProcessWithLogonW problem with XP SP2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jerry - 24 Mar 2005 04:23 GMT
I'm trying to run an application under another user within a winform
app writen in C#.  I have tried a number of different things, but it
seems that the CreateProcessWithLogonW function should work to do what
I need to do.  This appears to work just fine in Windows 2000 and XP
with service pack 1, but it doesn't work with XP service pack 2
installed.

I'm sure it's one of the "Enhanced security features" of service pack
2, but I can't seem to get this to work.  The function returns a 1
indicating that it worked fine, but the applcation that I'm trying
launch does not launch.

To give a little background on what I'm doing:

I have written a small app that is basically just an interface for the
netsh command to change network setting for the user.  The users do not

have admin rights on their machines, but a select few need to be able
to change their IP addresses for buisness reasons.  Because of this, I
basically just call the CreateProcessWithLogonW function to start run
the netsh command under an admin account on the machine to change the
IP address to whatever the user specifies in the interface that I
provided.

As a test, I have created two very simple windows apps.  The first one
calls the CreateProcessWithLogonW function to login as another account
on the machine.  It then calls another simple application that uses the

WindowsIdentity to show the current user.  This works fine on Win2K and

XP sp1, but not with service pack 2.

If anyone know how to get around this, that would be great.

Thanks,
Jerry
MICHAEL CARR - 24 Mar 2005 08:17 GMT
Does this answer your question?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/cr
eateprocesswithlogonw.asp


Windows XP SP2 and Windows Server 2003:  You cannot call
CreateProcessWithLogonW from a process that is running under the LocalSystem
account, because the function uses the logon SID in the caller token, and
the token for the LocalSystem account does not contain this SID. As an
alternative, use the CreateProcessAsUser and LogonUser functions.

Signature

MICHAEL CARR
mcarr67@_gmail.com

> I'm trying to run an application under another user within a winform
> app writen in C#.  I have tried a number of different things, but it
[quoted text clipped - 32 lines]
> Thanks,
> Jerry

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.