DWORD
-ScmGetServiceNameFromTag(PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams, PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *OutParams)
+ScmGetServiceNameFromTag(IN PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams,
+ OUT PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *OutParams)
{
PLIST_ENTRY ServiceEntry;
PSERVICE CurrentService;
{
CurrentImage = CurrentService->lpImage;
/* And matching the PID */
- if (CurrentImage->hProcess == (HANDLE)InParams->dwPid)
+ if (CurrentImage->dwProcessId == InParams->dwPid)
{
break;
}
/* If failure, free allocated memory */
if (dwError != ERROR_SUCCESS)
{
- MIDL_user_free(OutBuffer);
+ if (OutBuffer != NULL)
+ {
+ MIDL_user_free(OutBuffer);
+ }
}
/* Return error/success */
? SERVICE_CONTROL_START_OWN
: SERVICE_CONTROL_START_SHARE;
ControlPacket->hServiceStatus = (SERVICE_STATUS_HANDLE)Service;
+ ControlPacket->dwServiceTag = Service->dwTag;
/* Copy the start command line */
ControlPacket->dwServiceNameOffset = sizeof(SCM_CONTROL_PACKET);
StartupInfo.lpDesktop = L"WinSta0\\Default";
}
- Result = CreateProcessW(NULL,
- Service->lpImage->pszImagePath,
- NULL,
- NULL,
- FALSE,
- CREATE_UNICODE_ENVIRONMENT | DETACHED_PROCESS | CREATE_SUSPENDED,
- lpEnvironment,
- NULL,
- &StartupInfo,
- &ProcessInformation);
- if (!Result)
- dwError = GetLastError();
+ if (wcsstr(Service->lpImage->pszImagePath, L"\\system32\\lsass.exe") == NULL)
+ {
+ Result = CreateProcessW(NULL,
+ Service->lpImage->pszImagePath,
+ NULL,
+ NULL,
+ FALSE,
+ CREATE_UNICODE_ENVIRONMENT | DETACHED_PROCESS | CREATE_SUSPENDED,
+ lpEnvironment,
+ NULL,
+ &StartupInfo,
+ &ProcessInformation);
+ if (!Result)
+ dwError = GetLastError();
+ }
+ else
+ {
+ Result = TRUE;
+ dwError = ERROR_SUCCESS;
+ }
}
if (lpEnvironment)