Click to See Complete Forum and Search --> : Logon failure with Win32 Service using Domain Account


firec++
November 15th, 2008, 03:16 PM
I am trying to install a local service under the context of a trusted domain account.

I installed the service correctly and it starts fine running under the LocalSystem context, however the service fails to start under the domain account because of a logon failure.

The domain account I am using meets all of the following requirements. Please tell me if I am missing anything:

1). Account is enabled/unlocked
2). Account password I am using is valid (logged into a few machines with it)
3). Account has local admin rights on the machine I am installing the service on

Attached is the CreateService() function I am using to install the service.

Thank you

TCHAR szPath[MAX_PATH] = (L"\"C:\\Program Files\\Temp.exe\"");
TCHAR szStartName[50] = (L"Domain\\User");
TCHAR szStartNamePassword[50] = (L"**********");

schService = CreateService(
schSCManager,
SVCNAME,
SVCNAME,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL,
szPath,
NULL,
NULL,
NULL,
szStartName,
szStartNamePassword);

ovidiucucu
November 16th, 2008, 02:16 AM
[ Redirected thread ]

Is this the real password: L"**********" ?

firec++
November 16th, 2008, 11:39 AM
No, I changed it to that for the sake of the post.

firec++
November 16th, 2008, 12:45 PM
Update:

I solved the problem partly.

Apparently the Domain user account needs "Log in as a service" rights on the local machine. However while this solved the problem I dont know how to do this programatically.

Any help is appreciated.

Thanks

Igor Vartanov
November 17th, 2008, 03:35 PM
See this (http://www.codeguru.com/forum/showthread.php?p=1516460#post1516460) my post.