Windows Server 2003 - Running a service as a Local System account.
From: Mike M. (nospam_at_someplace.com)
Date: 09/08/04
- Next message: David F.: "Repost: ExAllocatePool for NonPagedPool fails under XP Pro"
- Previous message: William DePalo [MVP VC++]: "Re: How to retrieve serial number of OS or CPU for copy protection?"
- Next in thread: Mike: "RE: Windows Server 2003 - Running a service as a Local System account."
- Reply: Mike: "RE: Windows Server 2003 - Running a service as a Local System account."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Sep 2004 13:35:48 -0400
I have a service that was written in VC 6.0 under Windows Server 2003. It
has a GUI and an icon that I place in the task tray. Double clicking the
icon displays the GUI. The service is set to start automatically and run
24x7. I had to add a feature to the service to periodically copy files from
another machine for failover purposes. Unfortunately it cannot access the
other machine while running as a Local System account and will not "allow
interact with desktop" if running as a specific user account. I know a
service with a GUI is not ideal but before I spend the time (which I don't
have) to decouple those parts, is there a method I could run a batch file or
process as a specified User and achieve my goals?
I have tried the following but can't get the CreateProcessWithLogonW to
succeed with correct values:
// load the administrator profile
DWORD dwLogonFlags = LOGON_WITH_PROFILE;
PROCESS_INFORMATION ProcessInfo;
STARTUPINFOW StartupInfo = {0};
StartupInfo.cb = sizeof(STARTUPINFOW);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWNORMAL;
// go do it!
if (!CreateProcessWithLogonW((LPCWSTR)wszAdminName,
(LPCWSTR)wszDomain, (LPCWSTR)wszPassword, dwLogonFlags,
(LPCWSTR)wszApplicationName, (LPWSTR)wszCommandline, 0, NULL, NULL,
&StartupInfo, &ProcessInfo))
TIA.
- Next message: David F.: "Repost: ExAllocatePool for NonPagedPool fails under XP Pro"
- Previous message: William DePalo [MVP VC++]: "Re: How to retrieve serial number of OS or CPU for copy protection?"
- Next in thread: Mike: "RE: Windows Server 2003 - Running a service as a Local System account."
- Reply: Mike: "RE: Windows Server 2003 - Running a service as a Local System account."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|