Dear all,
As i start a service.
It will start in system as a user account .
but i need it will start as a current login as a user.
what i have done
DWORD dwDesiredAccess = SC_MANAGER_CONNECT |
SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_QUERY_LOCK_STATUS |
STANDARD_RIGHTS_READ ;
if ((schSCManager = OpenSCManager(NULL, NULL, dwDesiredAccess)) ==
NULL)
{
nReturnCode = GetLastError();
}
else
{
SC_HANDLE schService;
if ((schService = OpenService(schSCManager, pszServiceName,
dwDesiredAccess)) == NULL)
{
nReturnCode = GetLastError();
}
if (!StartService(schService, 0, NULL))
{
nReturnCode = GetLastError();
if (nReturnCode == ERROR_SERVICE_ALREADY_RUNNING)
nReturnCode = ERROR_SUCCESS; // not an error
}
}
but it will start this service (pszServiceName) with SYSTEM as user
name
but i need it should start with current login user
thanks in advance.
Edit/Delete Message