Logon failure with Win32 Service using Domain Account
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
Code:
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);
Re: Logon failure with Win32 Service using Domain Account
[ Redirected thread ]
Is this the real password: L"**********" ?
Re: Logon failure with Win32 Service using Domain Account
No, I changed it to that for the sake of the post.
Re: Logon failure with Win32 Service using Domain Account
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
Re: Logon failure with Win32 Service using Domain Account