25#define MANAGER_TAG 0x72674D68
26#define SERVICE_TAG 0x63765368
27#define INVALID_TAG 0xAABBCCDD
50#define SC_MANAGER_READ \
51 (STANDARD_RIGHTS_READ | \
52 SC_MANAGER_QUERY_LOCK_STATUS | \
53 SC_MANAGER_ENUMERATE_SERVICE)
55#define SC_MANAGER_WRITE \
56 (STANDARD_RIGHTS_WRITE | \
57 SC_MANAGER_MODIFY_BOOT_CONFIG | \
58 SC_MANAGER_CREATE_SERVICE)
60#define SC_MANAGER_EXECUTE \
61 (STANDARD_RIGHTS_EXECUTE | \
63 SC_MANAGER_ENUMERATE_SERVICE | \
64 SC_MANAGER_CONNECT | \
65 SC_MANAGER_CREATE_SERVICE)
69 (STANDARD_RIGHTS_READ | \
70 SERVICE_INTERROGATE | \
71 SERVICE_ENUMERATE_DEPENDENTS | \
72 SERVICE_QUERY_STATUS | \
75#define SERVICE_WRITE \
76 (STANDARD_RIGHTS_WRITE | \
77 SERVICE_CHANGE_CONFIG)
79#define SERVICE_EXECUTE \
80 (STANDARD_RIGHTS_EXECUTE | \
81 SERVICE_USER_DEFINED_CONTROL | \
82 SERVICE_PAUSE_CONTINUE | \
86#define TAG_ARRAY_SIZE 32
111 DPRINT(
"ScmStartRpcServer() called\n");
119 DPRINT1(
"RpcServerUseProtseqEpW() failed (Status %lx)\n",
Status);
128 DPRINT1(
"RpcServerRegisterIf() failed (Status %lx)\n",
Status);
139 DPRINT(
"ScmStartRpcServer() done\n");
149 if (lpDatabaseName ==
NULL)
154 DPRINT(
"Database %S, does not exist\n", lpDatabaseName);
159 DPRINT(
"Invalid Database name %S\n", lpDatabaseName);
171 wcscpy(
Ptr->DatabaseName, lpDatabaseName);
193 Ptr->ServiceEntry = lpServiceEntry;
213 DPRINT1(
"Exception: Invalid Service Manager handle\n");
233 DPRINT1(
"Exception: Invalid Service handle\n");
243 DWORD dwDesiredAccess)
276 DWORD dwGroupTagCount = 0;
279 DWORD dwTagUsedBase = 1;
291 L"System\\CurrentControlSet\\Control\\GroupOrderList",
328 if (cbDataSize <
sizeof(pdwGroupTags[0]))
331 dwGroupTagCount =
min(pdwGroupTags[0], cbDataSize /
sizeof(pdwGroupTags[0]) - 1);
341 for (
i = 1;
i <= dwGroupTagCount;
i++)
343 nTagOffset = pdwGroupTags[
i] - dwTagUsedBase;
345 TagUsed[nTagOffset] =
TRUE;
356 nTagOffset = CurrentService->
dwTag - dwTagUsedBase;
358 TagUsed[nTagOffset] =
TRUE;
361 ServiceEntry = ServiceEntry->
Flink;
369 dwFreeTag = dwTagUsedBase +
i;
375 }
while (!dwFreeTag);
386 lpService->
dwTag = dwFreeTag;
387 DPRINT(
"Assigning new tag %lu to service %S in group %S\n",
393 DPRINT1(
"Failed to assign new tag to service %S, error=%lu\n",
405 SIZE_T ServiceNameLen, ExpandedLen;
412 HANDLE SymbolicLinkHandle;
419 *RelativeName =
NULL;
424 if (ServiceNameLen > 12 &&
429 (ServiceNameLen + 1) *
sizeof(
WCHAR));
430 if (*RelativeName ==
NULL)
432 DPRINT(
"Error allocating memory for boot driver name\n");
439 DPRINT(
"Bootdriver name %S\n", *RelativeName);
444 if (ServiceNameLen > 13 &&
450 ServiceNameLen *
sizeof(
WCHAR));
452 if (*RelativeName ==
NULL)
454 DPRINT(
"Error allocating memory for boot driver name\n");
459 wcscpy(*RelativeName,
L"\\SystemRoot\\");
462 DPRINT(
"Bootdriver name %S\n", *RelativeName);
470 DPRINT(
"Error during a call to ExpandEnvironmentStringsW()\n");
480 DPRINT(
"Error allocating memory for boot driver name\n");
488 DPRINT(
"Error during a call to ExpandEnvironmentStringsW()\n");
496 DPRINT(
"Error during a call to RtlDosPathNameToNtPathName_U()\n");
500 DPRINT(
"Converted to NT-style %wZ\n", &NtPathName);
511 DPRINT(
"Error allocating memory for boot driver name\n");
521 if (ServiceNameLen > ExpandedLen &&
529 (ServiceNameLen - ExpandedLen) *
sizeof(
WCHAR) + 13*
sizeof(
WCHAR));
530 if (*RelativeName ==
NULL)
532 DPRINT(
"Error allocating memory for boot driver name\n");
536 wcscpy(*RelativeName,
L"\\SystemRoot\\");
557 DPRINT(
"Opened symbolic link object\n");
566 DPRINT(
"Too large buffer required\n");
580 DPRINT(
"Unable to alloc buffer\n");
593 if ((ServiceNameLen > ExpandedLen) &&
598 (ServiceNameLen - ExpandedLen) *
sizeof(
WCHAR) + 13*
sizeof(
WCHAR));
600 if (*RelativeName ==
NULL)
602 DPRINT(
"Unable to alloc buffer\n");
608 wcscpy(*RelativeName,
L"\\SystemRoot\\");
643 const wchar_t *lpServiceName,
644 wchar_t **lpCanonName)
653 ServiceNameLen =
wcslen(lpServiceName);
656 if (ServiceNameLen > 12 &&
657 !
_wcsnicmp(
L"\\SystemRoot\\", lpServiceName, 12))
662 (ServiceNameLen + 1) *
sizeof(
WCHAR));
664 if (*lpCanonName ==
NULL)
666 DPRINT(
"Error allocating memory for canonized service name\n");
677 DPRINT(
"Canonicalized name %S\n", *lpCanonName);
682 if (ServiceNameLen > 13 &&
683 !
_wcsnicmp(
L"%SystemRoot%\\", lpServiceName, 13))
688 (ServiceNameLen + 1) *
sizeof(
WCHAR));
690 if (*lpCanonName ==
NULL)
692 DPRINT(
"Error allocating memory for canonized service name\n");
698 wcscpy(*lpCanonName,
L"\\SystemRoot\\");
700 wcscat(*lpCanonName, lpServiceName + 13);
702 DPRINT(
"Canonicalized name %S\n", *lpCanonName);
707 if (lpServiceName[0] !=
L'\\' && lpServiceName[1] !=
L':')
711 (ServiceNameLen + 1) *
sizeof(
WCHAR));
713 if (*lpCanonName ==
NULL)
715 DPRINT(
"Error allocating memory for canonized service name\n");
720 wcscpy(*lpCanonName, lpServiceName);
728 DPRINT(
"RtlDosPathNameToNtPathName_U() failed\n");
736 if (*lpCanonName ==
NULL)
738 DPRINT(
"Error allocating memory for canonized service name\n");
751 DPRINT(
"Canonicalized name %S\n", *lpCanonName);
761 DPRINT(
"Error converting named\n");
768 wcscpy(*lpCanonName, RelativeName + 12);
773 DPRINT(
"Canonicalized name %S\n", *lpCanonName);
784 DWORD dwServiceState,
792 WCHAR *lpszNameBuf = szNameBuf;
793 WCHAR *lpszValueBuf = szValueBuf;
798 HKEY hServiceEnumKey;
800 DWORD dwDependServiceStrPtr = 0;
801 DWORD dwRequiredSize = 0;
818 DPRINT(
"ERROR! Unable to get number of services keys\n");
823 for (dwIteration = 0; dwIteration < dwNumSubKeys; dwIteration++)
861 dwDependServiceStrPtr = 0;
864 while (
wcslen(lpszValueBuf + dwDependServiceStrPtr) > 0)
872 if (!lpCurrentService)
875 DPRINT(
"This should not happen at this point, report to Developer\n");
884 if ((dwCurrentServiceState == dwServiceState) ||
893 dwRequiredSize += (2 *
sizeof(
PVOID));
911 lpServices[*lpServicesReturned] = lpCurrentService;
913 *lpServicesReturned = *lpServicesReturned + 1;
917 dwDependServiceStrPtr += (
DWORD)(
wcslen(lpszValueBuf + dwDependServiceStrPtr) + 1);
942 DPRINT(
"RCloseServiceHandle() called\n");
944 DPRINT(
"hSCObject = %p\n", *hSCObject);
952 if (hManager !=
NULL)
954 DPRINT(
"Found manager handle\n");
964 DPRINT(
"RCloseServiceHandle() done\n");
967 else if (hService !=
NULL)
969 DPRINT(
"Found service handle\n");
992 DPRINT(
"RCloseServiceHandle() done\n");
1015 DWORD dwServicesReturned = 0;
1016 DWORD dwControlsAccepted;
1017 DWORD dwCurrentState;
1020 WCHAR szLogBuffer[80];
1023 DPRINT(
"RControlService() called\n");
1032 DPRINT1(
"Invalid service handle\n");
1038 if (lpService ==
NULL)
1040 DPRINT1(
"lpService == NULL\n");
1066 if (dwControl >= 128 && dwControl <= 255)
1089 L"System\\CurrentControlSet\\Services",
1095 DPRINT(
"Failed to open services key\n");
1105 &dwServicesReturned);
1113 DPRINT(
"Service has running dependencies. Failed to stop service\n");
1135 switch (dwCurrentState)
1224 lpLogStrings[1] = szLogBuffer;
1247 DPRINT(
"RDeleteService() called\n");
1255 DPRINT1(
"Invalid service handle\n");
1264 if (lpService ==
NULL)
1266 DPRINT(
"lpService == NULL\n");
1275 DPRINT(
"Service has already been marked for delete\n");
1289 DPRINT(
"RDeleteService() done\n");
1304 DPRINT(
"RLockServiceDatabase() called\n");
1311 DPRINT1(
"Invalid service manager handle\n");
1329 LPBYTE lpSecurityDescriptor,
1337 DWORD dwBytesNeeded;
1340 DPRINT(
"RQueryServiceObjectSecurity() called\n");
1345 DPRINT1(
"Invalid service handle\n");
1365 if (lpService ==
NULL)
1367 DPRINT(
"lpService == NULL\n");
1376 dwSecurityInformation,
1412 DWORD dwSecurityInformation,
1413 LPBYTE lpSecurityDescriptor,
1414 DWORD dwSecurityDescriptorSize)
1425 DPRINT(
"RSetServiceObjectSecurity() called\n");
1430 DPRINT1(
"Invalid service handle\n");
1434 if (dwSecurityInformation == 0 ||
1473 if (lpService ==
NULL)
1475 DPRINT1(
"lpService == NULL\n");
1509 bDatabaseLocked =
TRUE;
1525 if (hServiceKey !=
NULL)
1529 if (bDatabaseLocked ==
TRUE)
1535 DPRINT(
"RSetServiceObjectSecurity() done (Error %lu)\n", dwError);
1551 DPRINT(
"RQueryServiceStatus() called\n");
1559 DPRINT1(
"Invalid service handle\n");
1571 if (lpService ==
NULL)
1573 DPRINT(
"lpService == NULL\n");
1595 switch (dwCurrentState)
1617 WCHAR szLogBuffer[80];
1657 lpLogStrings[1] = szLogBuffer;
1669 lpLogStrings[1] = szLogBuffer;
1695 DWORD dwPreviousState;
1696 DWORD dwPreviousType;
1698 WCHAR szLogBuffer[80];
1701 DPRINT(
"RSetServiceStatus() called\n");
1713 DPRINT(
"hServiceStatus == NULL\n");
1722 DPRINT(
"Invalid service state\n");
1730 DPRINT(
"Invalid service type\n");
1737 DPRINT(
"Invalid controls accepted\n");
1783 DWORD dwStopThreadId;
1798 if (hStopThread ==
NULL)
1800 DPRINT1(
"Failed to create thread to complete service stop\n");
1804 DPRINT1(
"Service %S has %d references after stop\n", lpService->lpServiceName, lpService->RefCount);
1835 lpLogStrings[1] = szLogBuffer;
1844 DPRINT(
"RSetServiceStatus() done\n");
1856 DPRINT(
"RUnlockServiceDatabase(%p)\n",
Lock);
1866 DWORD BootAcceptable)
1868 DPRINT(
"RNotifyBootConfigStatus(%p %lu)\n",
1869 lpMachineName, BootAcceptable);
1885 int bUpdateImmediately,
1890 DPRINT(
"RI_ScSetServiceBitsW(%p %lx %d %d %S)\n",
1892 bUpdateImmediately, lpString);
1897 if (lpString !=
NULL)
1902 DPRINT(
"hServiceStatus == NULL\n");
1937 DWORD dwServiceType,
1939 DWORD dwErrorControl,
1945 LPWSTR lpServiceStartName,
1958 DPRINT(
"RChangeServiceConfigW() called\n");
1959 DPRINT(
"dwServiceType = 0x%lx\n", dwServiceType);
1960 DPRINT(
"dwStartType = %lu\n", dwStartType);
1961 DPRINT(
"dwErrorControl = %lu\n", dwErrorControl);
1962 DPRINT(
"lpBinaryPathName = %S\n", lpBinaryPathName);
1963 DPRINT(
"lpLoadOrderGroup = %S\n", lpLoadOrderGroup);
1964 DPRINT(
"lpServiceStartName = %S\n", lpServiceStartName);
1965 DPRINT(
"lpPassword = %p\n", lpPassword);
1966 DPRINT(
"dwPwSite = %lu\n", dwPwSize);
1975 DPRINT1(
"Invalid service handle\n");
2026 if (lpdwTagId && (!lpLoadOrderGroup || !*lpLoadOrderGroup))
2032 if (lpService ==
NULL)
2034 DPRINT(
"lpService == NULL\n");
2043 DPRINT(
"Service has already been marked for delete\n");
2071 if (lpDisplayNameW ==
NULL)
2129 if (lpBinaryPathName !=
NULL && *lpBinaryPathName != 0)
2132 lpImagePathW = lpBinaryPathName;
2151 if (lpImagePathW != lpBinaryPathName)
2159 if (lpLoadOrderGroup !=
NULL && *lpLoadOrderGroup != 0)
2165 (
LPBYTE)lpLoadOrderGroup,
2177 if (lpdwTagId !=
NULL)
2192 *lpdwTagId = lpService->
dwTag;
2196 if (lpDependencies !=
NULL && *lpDependencies != 0)
2209 if (lpServiceStartName !=
NULL && *lpServiceStartName != 0)
2215 (
LPBYTE)lpServiceStartName,
2221 if (lpPassword !=
NULL)
2223 if (*(
LPWSTR)lpPassword != 0)
2229 &lpClearTextPassword);
2232 DPRINT1(
"ScmDecryptPassword failed (Error %lu)\n", dwError);
2235 DPRINT(
"Clear text password: %S\n", lpClearTextPassword);
2239 lpClearTextPassword);
2242 DPRINT1(
"ScmSetServicePassword failed (Error %lu)\n", dwError);
2256 DPRINT1(
"ScmSetServicePassword failed (Error %lu)\n", dwError);
2264 if (lpClearTextPassword !=
NULL)
2268 (
wcslen(lpClearTextPassword) + 1) *
sizeof(
WCHAR));
2272 if (hServiceKey !=
NULL)
2278 DPRINT(
"RChangeServiceConfigW() done (Error %lu)\n", dwError);
2291 DWORD dwDesiredAccess,
2292 DWORD dwServiceType,
2294 DWORD dwErrorControl,
2308 SC_HANDLE hServiceHandle =
NULL;
2314 DPRINT(
"RCreateServiceW() called\n");
2315 DPRINT(
"lpServiceName = %S\n", lpServiceName);
2317 DPRINT(
"dwDesiredAccess = %lx\n", dwDesiredAccess);
2318 DPRINT(
"dwServiceType = 0x%lx\n", dwServiceType);
2319 DPRINT(
"dwStartType = %lu\n", dwStartType);
2320 DPRINT(
"dwErrorControl = %lu\n", dwErrorControl);
2321 DPRINT(
"lpBinaryPathName = %S\n", lpBinaryPathName);
2322 DPRINT(
"lpLoadOrderGroup = %S\n", lpLoadOrderGroup);
2323 DPRINT(
"lpdwTagId = %p\n", lpdwTagId);
2329 if (hManager ==
NULL)
2331 DPRINT1(
"Invalid service manager handle\n");
2339 DPRINT(
"Insufficient access rights! 0x%lx\n",
2344 if (*lpServiceName == 0)
2347 if (*lpBinaryPathName == 0)
2390 (lpServiceStartName))
2393 if (
_wcsicmp(lpServiceStartName,
L"LocalSystem"))
2399 if (lpdwTagId && (!lpLoadOrderGroup || !*lpLoadOrderGroup))
2478 if (lpLoadOrderGroup !=
NULL && *lpLoadOrderGroup != 0)
2487 if (lpdwTagId !=
NULL)
2558 (
LPBYTE)lpBinaryPathName,
2576 if (lpLoadOrderGroup !=
NULL && *lpLoadOrderGroup != 0)
2582 (
LPBYTE)lpLoadOrderGroup,
2589 if (lpdwTagId !=
NULL)
2602 if (lpDependencies !=
NULL && *lpDependencies != 0)
2615 lpObjectName = (lpServiceStartName !=
NULL) ? (
LPWSTR)lpServiceStartName :
L"LocalSystem";
2625 if (lpPassword !=
NULL && *(
LPWSTR)lpPassword != 0)
2631 &lpClearTextPassword);
2637 lpClearTextPassword);
2664 DPRINT(
"CreateService - lpService->RefCount %u\n", lpService->
RefCount);
2670 if (hServiceKey !=
NULL)
2673 if (lpClearTextPassword !=
NULL)
2677 (
wcslen(lpClearTextPassword) + 1) *
sizeof(
WCHAR));
2683 DPRINT(
"hService %p\n", hServiceHandle);
2686 if (lpdwTagId !=
NULL)
2687 *lpdwTagId = lpService->
dwTag;
2691 if (lpService !=
NULL &&
2704 if (lpService !=
NULL)
2710 if (lpImagePath !=
NULL)
2713 DPRINT(
"RCreateServiceW() done (Error %lu)\n", dwError);
2724 DWORD dwServiceState,
2731 DWORD dwServicesReturned = 0;
2732 DWORD dwServiceCount;
2741 *lpServicesReturned = 0;
2743 DPRINT(
"REnumDependentServicesW() called\n");
2748 DPRINT1(
"Invalid service handle\n");
2758 DPRINT(
"Insufficient access rights! 0x%lx\n",
2765 L"System\\CurrentControlSet\\Services",
2778 &dwServicesReturned);
2792 (dwServicesReturned + 1) *
sizeof(
PSERVICE));
2793 if (!lpServicesArray)
2795 DPRINT1(
"Could not allocate buffer\n");
2800 dwServicesReturned = 0;
2808 &dwServicesReturned);
2818 for (dwServiceCount = 0; dwServiceCount < dwServicesReturned; dwServiceCount++)
2820 lpService = lpServicesArray[dwServiceCount];
2840 *lpServicesReturned = dwServicesReturned;
2843 if (lpServicesArray !=
NULL)
2848 DPRINT(
"REnumDependentServicesW() done (Error %lu)\n", dwError);
2859 DWORD dwServiceType,
2860 DWORD dwServiceState,
2886 DWORD dwDesiredAccess,
2892 DPRINT(
"ROpenSCManagerW() called\n");
2893 DPRINT(
"lpMachineName = %p\n", lpMachineName);
2894 DPRINT(
"lpMachineName: %S\n", lpMachineName);
2895 DPRINT(
"lpDataBaseName = %p\n", lpDatabaseName);
2896 DPRINT(
"lpDataBaseName: %S\n", lpDatabaseName);
2897 DPRINT(
"dwDesiredAccess = %x\n", dwDesiredAccess);
2909 DPRINT(
"ScmCreateManagerHandle() failed (Error %lu)\n", dwError);
2918 DPRINT(
"ScmCheckAccess() failed (Error %lu)\n", dwError);
2924 DPRINT(
"*hScm = %p\n", *lpScHandle);
2926 DPRINT(
"ROpenSCManagerW() done\n");
2938 DWORD dwDesiredAccess,
2946 DPRINT(
"ROpenServiceW() called\n");
2948 DPRINT(
"lpServiceName = %p\n", lpServiceName);
2949 DPRINT(
"lpServiceName: %S\n", lpServiceName);
2950 DPRINT(
"dwDesiredAccess = %x\n", dwDesiredAccess);
2956 if (hManager ==
NULL)
2958 DPRINT1(
"Invalid service manager handle\n");
2962 if (!lpServiceHandle)
2973 if (lpService ==
NULL)
2975 DPRINT(
"Could not find service\n");
2985 DPRINT(
"ScmCreateServiceHandle() failed (Error %lu)\n", dwError);
2994 DPRINT(
"ScmCheckAccess() failed (Error %lu)\n", dwError);
3003 DPRINT(
"*hService = %p\n", *lpServiceHandle);
3009 DPRINT(
"ROpenServiceW() done\n");
3032 DWORD dwDependenciesLength = 0;
3033 DWORD dwRequiredSize;
3036 DPRINT(
"RQueryServiceConfigW() called\n");
3044 DPRINT1(
"Invalid service handle\n");
3056 if (lpService ==
NULL)
3058 DPRINT(
"lpService == NULL\n");
3081 &lpServiceStartName);
3086 &dwDependenciesLength);
3090 if (lpImagePath !=
NULL)
3093 dwRequiredSize += 2 *
sizeof(
WCHAR);
3098 dwRequiredSize += 2 *
sizeof(
WCHAR);
3100 if (lpDependencies !=
NULL)
3101 dwRequiredSize += dwDependenciesLength *
sizeof(
WCHAR);
3103 dwRequiredSize += 2 *
sizeof(
WCHAR);
3105 if (lpServiceStartName !=
NULL)
3106 dwRequiredSize += (
DWORD)((
wcslen(lpServiceStartName) + 1) *
sizeof(
WCHAR));
3108 dwRequiredSize += 2 *
sizeof(
WCHAR);
3113 dwRequiredSize += 2 *
sizeof(
WCHAR);
3126 lpStr = (
LPWSTR)(lpServiceConfig + 1);
3129 if (lpImagePath !=
NULL)
3131 wcscpy(lpStr, lpImagePath);
3139 lpStr += (
wcslen(lpStr) + 1);
3152 lpStr += (
wcslen(lpStr) + 1);
3155 if (lpDependencies !=
NULL)
3159 dwDependenciesLength *
sizeof(
WCHAR));
3167 if (lpDependencies !=
NULL)
3168 lpStr += dwDependenciesLength;
3170 lpStr += (
wcslen(lpStr) + 1);
3173 if (lpServiceStartName !=
NULL)
3175 wcscpy(lpStr, lpServiceStartName);
3183 lpStr += (
wcslen(lpStr) + 1);
3205 if (lpImagePath !=
NULL)
3208 if (lpServiceStartName !=
NULL)
3211 if (lpDependencies !=
NULL)
3214 if (hServiceKey !=
NULL)
3217 DPRINT(
"RQueryServiceConfigW() done\n");
3234 DWORD dwRequiredSize;
3242 DPRINT1(
"Invalid service manager handle\n");
3281 DPRINT(
"RStartServiceW(%p %lu %p) called\n", hService,
argc,
argv);
3298 DPRINT1(
"Invalid service handle\n");
3310 if (lpService ==
NULL)
3312 DPRINT(
"lpService == NULL\n");
3344 DPRINT(
"RGetServiceDisplayNameW() called\n");
3346 DPRINT(
"lpServiceName: %S\n", lpServiceName);
3348 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
3354 DPRINT(
"Invalid manager handle\n");
3361 if (lpService ==
NULL)
3363 DPRINT(
"Could not find service\n");
3406 DPRINT(
"RGetServiceKeyNameW() called\n");
3409 DPRINT(
"lpServiceName: %p\n", lpServiceName);
3410 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
3416 DPRINT(
"Invalid manager handle\n");
3423 if (lpService ==
NULL)
3425 DPRINT(
"Could not find service\n");
3433 if (lpServiceName !=
NULL)
3456 int bUpdateImmediately,
3462 if (lpString !=
NULL)
3478 DWORD dwServiceType,
3480 DWORD dwErrorControl,
3481 LPSTR lpBinaryPathName,
3482 LPSTR lpLoadOrderGroup,
3486 LPSTR lpServiceStartName,
3497 DWORD dwDependenciesLength = 0;
3502 if (lpBinaryPathName)
3506 if (!lpBinaryPathNameW)
3514 if (lpLoadOrderGroup)
3518 if (!lpLoadOrderGroupW)
3528 lpStr = (
LPCSTR)lpDependencies;
3531 cchLength =
strlen(lpStr) + 1;
3532 dwDependenciesLength += (
DWORD)cchLength;
3533 lpStr = lpStr + cchLength;
3535 dwDependenciesLength++;
3538 if (!lpDependenciesW)
3546 if (lpServiceStartName)
3550 if (!lpServiceStartNameW)
3562 if (!lpDisplayNameW)
3578 dwDependenciesLength,
3579 lpServiceStartNameW,
3585 if (lpBinaryPathNameW !=
NULL)
3588 if (lpLoadOrderGroupW !=
NULL)
3591 if (lpDependenciesW !=
NULL)
3594 if (lpServiceStartNameW !=
NULL)
3597 if (lpDisplayNameW !=
NULL)
3609 LPSTR lpServiceName,
3611 DWORD dwDesiredAccess,
3612 DWORD dwServiceType,
3614 DWORD dwErrorControl,
3615 LPSTR lpBinaryPathName,
3616 LPSTR lpLoadOrderGroup,
3620 LPSTR lpServiceStartName,
3632 DWORD dwDependenciesLength = 0;
3641 if (!lpServiceNameW)
3653 if (!lpDisplayNameW)
3661 if (lpBinaryPathName)
3665 if (!lpBinaryPathNameW)
3673 if (lpLoadOrderGroup)
3677 if (!lpLoadOrderGroupW)
3687 lpStr = (
LPCSTR)lpDependencies;
3690 cchLength =
strlen(lpStr) + 1;
3691 dwDependenciesLength += (
DWORD)cchLength;
3692 lpStr = lpStr + cchLength;
3694 dwDependenciesLength++;
3697 if (!lpDependenciesW)
3705 if (lpServiceStartName)
3709 if (!lpServiceStartNameW)
3728 dwDependenciesLength,
3729 lpServiceStartNameW,
3735 if (lpServiceNameW !=
NULL)
3738 if (lpDisplayNameW !=
NULL)
3741 if (lpBinaryPathNameW !=
NULL)
3744 if (lpLoadOrderGroupW !=
NULL)
3747 if (lpDependenciesW !=
NULL)
3750 if (lpServiceStartNameW !=
NULL)
3762 DWORD dwServiceState,
3769 DWORD dwServicesReturned = 0;
3770 DWORD dwServiceCount;
3779 *lpServicesReturned = 0;
3781 DPRINT(
"REnumDependentServicesA() called\n");
3786 DPRINT1(
"Invalid service handle\n");
3796 DPRINT(
"Insufficient access rights! 0x%lx\n",
3803 L"System\\CurrentControlSet\\Services",
3821 &dwServicesReturned);
3835 (dwServicesReturned + 1) *
sizeof(
PSERVICE));
3836 if (!lpServicesArray)
3838 DPRINT(
"Could not allocate buffer\n");
3843 dwServicesReturned = 0;
3851 &dwServicesReturned);
3861 for (dwServiceCount = 0; dwServiceCount < dwServicesReturned; dwServiceCount++)
3863 lpService = lpServicesArray[dwServiceCount];
3880 lpStr +=
strlen(lpStr) + 1;
3892 lpStr +=
strlen(lpStr) + 1;
3897 *lpServicesReturned = dwServicesReturned;
3900 if (lpServicesArray)
3905 DPRINT(
"REnumDependentServicesA() done (Error %lu)\n", dwError);
3916 DWORD dwServiceType,
3917 DWORD dwServiceState,
3930 DWORD dwServiceCount;
3932 DPRINT(
"REnumServicesStatusA() called\n");
3944 DPRINT(
"Failed to allocate buffer\n");
3959 if (*lpServicesReturned == 0)
3962 lpStatusPtrIncrW = lpStatusPtrW;
3969 for (dwServiceCount = 0; dwServiceCount < *lpServicesReturned; dwServiceCount++)
3977 (
int)
wcslen(lpStringPtrW),
3982 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
3983 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
3991 (
int)
wcslen(lpStringPtrW),
3996 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
3997 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
4012 DPRINT(
"REnumServicesStatusA() done (Error %lu)\n", dwError);
4022 LPSTR lpMachineName,
4023 LPSTR lpDatabaseName,
4024 DWORD dwDesiredAccess,
4031 DPRINT(
"ROpenSCManagerA() called\n");
4061 LPSTR lpServiceName,
4062 DWORD dwDesiredAccess,
4068 DPRINT(
"ROpenServiceA() called\n");
4103 DWORD dwDependenciesLength = 0;
4104 DWORD dwRequiredSize;
4107 DPRINT(
"RQueryServiceConfigA() called\n");
4115 DPRINT1(
"Invalid service handle\n");
4127 if (lpService ==
NULL)
4129 DPRINT(
"lpService == NULL\n");
4152 &lpServiceStartName);
4157 &dwDependenciesLength);
4161 if (lpImagePath !=
NULL)
4162 dwRequiredSize += (
DWORD)(
wcslen(lpImagePath) + 1);
4164 dwRequiredSize += 2 *
sizeof(
CHAR);
4169 dwRequiredSize += 2 *
sizeof(
CHAR);
4172 if (lpDependencies !=
NULL)
4173 dwRequiredSize += dwDependenciesLength;
4175 dwRequiredSize += 2 *
sizeof(
CHAR);
4177 if (lpServiceStartName !=
NULL)
4178 dwRequiredSize += (
DWORD)(
wcslen(lpServiceStartName) + 1);
4180 dwRequiredSize += 2 *
sizeof(
CHAR);
4185 dwRequiredSize += 2 *
sizeof(
CHAR);
4198 lpStr = (
LPSTR)(lpServiceConfig + 1);
4210 (
int)(
wcslen(lpImagePath) + 1),
4239 lpStr += (
strlen(lpStr) + 1);
4247 dwDependenciesLength,
4249 dwDependenciesLength,
4260 lpStr += dwDependenciesLength;
4262 lpStr += (
strlen(lpStr) + 1);
4264 if (lpServiceStartName)
4271 (
int)(
wcslen(lpServiceStartName) + 1),
4281 lpStr += (
strlen(lpStr) + 1);
4309 if (lpImagePath !=
NULL)
4312 if (lpServiceStartName !=
NULL)
4315 if (lpDependencies !=
NULL)
4318 if (hServiceKey !=
NULL)
4321 DPRINT(
"RQueryServiceConfigA() done\n");
4338 DWORD dwRequiredSize;
4346 DPRINT1(
"Invalid service manager handle\n");
4385 DPRINT(
"RStartServiceA() called\n");
4393 DPRINT1(
"Invalid service handle\n");
4405 if (lpService ==
NULL)
4407 DPRINT(
"lpService == NULL\n");
4487 DPRINT(
"RGetServiceDisplayNameA() called\n");
4489 DPRINT(
"lpServiceName: %s\n", lpServiceName);
4491 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
4497 DPRINT(
"Invalid manager handle\n");
4503 if (lpServiceName !=
NULL)
4509 if (!lpServiceNameW)
4524 if (lpService ==
NULL)
4526 DPRINT(
"Could not find service\n");
4600 LPSTR lpServiceName,
4608 DPRINT(
"RGetServiceKeyNameA() called\n");
4611 DPRINT(
"lpServiceName: %p\n", lpServiceName);
4612 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
4618 DPRINT(
"Invalid manager handle\n");
4629 if (!lpDisplayNameW)
4643 if (lpService ==
NULL)
4645 DPRINT(
"Could not find service\n");
4658 if (lpServiceName !=
NULL &&
4720 DPRINT(
"RI_ScGetCurrentGroupStateW() called\n");
4726 if (hManager ==
NULL)
4728 DPRINT1(
"Invalid service manager handle\n");
4736 DPRINT(
"Insufficient access rights! 0x%lx\n",
4746 if (pServiceGroup ==
NULL)
4759 DPRINT(
"RI_ScGetCurrentGroupStateW() done (Error %lu)\n", dwError);
4770 DWORD dwServiceType,
4771 DWORD dwServiceState,
4785 DWORD dwRequiredSize;
4786 DWORD dwServiceCount;
4788 DWORD dwLastResumeCount = 0;
4792 DPRINT(
"REnumServiceGroupW() called\n");
4798 if (hManager ==
NULL)
4800 DPRINT1(
"Invalid service manager handle\n");
4810 *lpServicesReturned = 0;
4812 if ((dwServiceType == 0) ||
4815 DPRINT(
"Invalid Service Type\n");
4819 if ((dwServiceState == 0) ||
4822 DPRINT(
"Invalid Service State\n");
4830 DPRINT(
"Insufficient access rights! 0x%lx\n",
4836 dwLastResumeCount = *lpResumeIndex;
4842 if (lpService ==
NULL)
4853 ServiceEntry = ServiceEntry->
Flink)
4866 if ((dwState & dwServiceState) == 0)
4871 if (*pszGroupName == 0)
4895 dwRequiredSize +=
dwSize;
4900 DPRINT(
"dwRequiredSize: %lu\n", dwRequiredSize);
4901 DPRINT(
"dwServiceCount: %lu\n", dwServiceCount);
4905 ServiceEntry = ServiceEntry->
Flink)
4918 if ((dwState & dwServiceState) == 0)
4923 if (*pszGroupName == 0)
4943 DPRINT(
"*pcbBytesNeeded: %lu\n", dwRequiredSize);
4946 *lpResumeIndex = dwLastResumeCount;
4948 *lpServicesReturned = dwServiceCount;
4958 ServiceEntry = ServiceEntry->
Flink)
4971 if ((dwState & dwServiceState) == 0)
4976 if (*pszGroupName == 0)
5012 dwRequiredSize +=
dwSize;
5018 if (lpResumeIndex) *lpResumeIndex = 0;
5025 DPRINT(
"REnumServiceGroupW() done (Error %lu)\n", dwError);
5042 DPRINT(
"RChangeServiceConfig2A() called\n");
5043 DPRINT(
"dwInfoLevel = %lu\n",
Info.dwInfoLevel);
5058 lpServiceDescriptionA =
Info.psd;
5060 if (lpServiceDescriptionA &&
5068 if (!lpServiceDescriptionW)
5082 ptr = lpServiceDescriptionW;
5083 InfoW.
psd = lpServiceDescriptionW;
5090 DWORD dwRebootLen = 0;
5091 DWORD dwCommandLen = 0;
5092 DWORD dwActionArrayLen = 0;
5095 lpServiceFailureActionsA =
Info.psfa;
5097 if (lpServiceFailureActionsA)
5110 if (lpServiceFailureActionsA->
lpCommand)
5127 dwActionArrayLen + dwRebootLen + dwCommandLen;
5133 if (!lpServiceFailureActionsW)
5143 if (dwActionArrayLen > 0)
5159 lpStr = (
LPWSTR)((
ULONG_PTR)(lpServiceFailureActionsW + 1) + dwActionArrayLen);
5180 lpStr += dwRebootLen /
sizeof(
WCHAR);
5186 lpServiceFailureActionsW->
lpCommand = lpStr;
5197 ptr = lpServiceFailureActionsW;
5198 InfoW.
psfa = lpServiceFailureActionsW;
5216 DWORD dwRequiredSize = 0;
5221 if (lpFailureActions ==
NULL)
5249 if (lpReadBuffer ==
NULL)
5320 if (lpWriteBuffer ==
NULL)
5350 if (lpFailureActions->
cActions > 0)
5384 DPRINT(
"Delete Reboot Message value\n");
5405 DPRINT(
"Delete Failure Command value\n");
5410 DPRINT(
"Setting Failure Command value %S\n", lpFailureActions->
lpCommand);
5422 if (lpWriteBuffer !=
NULL)
5425 if (lpReadBuffer !=
NULL)
5445 DPRINT(
"RChangeServiceConfig2W() called\n");
5446 DPRINT(
"dwInfoLevel = %lu\n",
Info.dwInfoLevel);
5460 DPRINT(
"Invalid service handle\n");
5482 if (lpService ==
NULL)
5484 DPRINT(
"lpService == NULL\n");
5500 DPRINT(
"Service has already been marked for delete\n");
5517 if (lpServiceDescription !=
NULL &&
5523 DPRINT(
"Delete service description\n");
5552 if (hServiceKey !=
NULL)
5558 DPRINT(
"RChangeServiceConfig2W() done (Error %lu)\n", dwError);
5578 DWORD dwRequiredSize = 0;
5584 DPRINT(
"RQueryServiceConfig2A() called hService %p dwInfoLevel %u, lpBuffer %p cbBufSize %u pcbBytesNeeded %p\n",
5602 DPRINT1(
"Invalid service handle\n");
5614 if (lpService ==
NULL)
5616 DPRINT(
"lpService == NULL\n");
5652 lpStr = (
LPSTR)(lpServiceDescription + 1);
5659 (
int)
wcslen(lpDescriptionW),
5695 &lpFailureCommandW);
5701 if (lpRebootMessageW)
5704 if (lpFailureCommandW)
5705 dwRequiredSize += (
DWORD)((
wcslen(lpFailureCommandW) + 1) *
sizeof(
WCHAR));
5721 (
LPBYTE)lpFailureActions,
5752 lpStr = (
LPSTR)(lpFailureActions + 1);
5758 if (lpRebootMessageW)
5765 (
int)
wcslen(lpRebootMessageW),
5769 lpStr +=
strlen(lpStr) + 1;
5772 if (lpFailureCommandW)
5779 (
int)
wcslen(lpFailureCommandW),
5793 if (lpDescriptionW !=
NULL)
5796 if (lpRebootMessageW !=
NULL)
5799 if (lpFailureCommandW !=
NULL)
5802 if (hServiceKey !=
NULL)
5805 DPRINT(
"RQueryServiceConfig2A() done (Error %lu)\n", dwError);
5825 DWORD dwRequiredSize = 0;
5831 DPRINT(
"RQueryServiceConfig2W() called\n");
5848 DPRINT1(
"Invalid service handle\n");
5860 if (lpService ==
NULL)
5862 DPRINT(
"lpService == NULL\n");
5898 lpStr = (
LPWSTR)(lpServiceDescription + 1);
5899 wcscpy(lpStr, lpDescription);
5939 if (lpRebootMessage)
5942 if (lpFailureCommand)
5959 (
LPBYTE)lpFailureActions,
5990 lpStr = (
LPWSTR)(lpFailureActions + 1);
5996 if (lpRebootMessage)
5998 wcscpy(lpStr, lpRebootMessage);
6000 lpStr +=
wcslen(lpStr) + 1;
6003 if (lpFailureCommand)
6005 wcscpy(lpStr, lpFailureCommand);
6017 if (lpDescription !=
NULL)
6020 if (lpRebootMessage !=
NULL)
6023 if (lpFailureCommand !=
NULL)
6026 if (hServiceKey !=
NULL)
6029 DPRINT(
"RQueryServiceConfig2W() done (Error %lu)\n", dwError);
6049 DPRINT(
"RQueryServiceStatusEx() called\n");
6065 DPRINT1(
"Invalid service handle\n");
6077 if (lpService ==
NULL)
6079 DPRINT(
"lpService == NULL\n");
6114 DWORD dwServiceType,
6115 DWORD dwServiceState,
6130 DWORD dwServiceCount;
6132 DPRINT(
"REnumServicesStatusExA() called\n");
6144 DPRINT(
"Failed to allocate buffer\n");
6154 (
int)(
strlen(pszGroupName) + 1));
6162 DPRINT(
"Failed to allocate buffer\n");
6180 if (*lpServicesReturned == 0)
6183 lpStatusPtrIncrW = lpStatusPtrW;
6190 for (dwServiceCount = 0; dwServiceCount < *lpServicesReturned; dwServiceCount++)
6198 (
int)
wcslen(lpStringPtrW),
6203 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
6204 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
6212 (
int)
wcslen(lpStringPtrW),
6217 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
6218 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
6241 DPRINT(
"REnumServicesStatusExA() done (Error %lu)\n", dwError);
6253 DWORD dwServiceType,
6254 DWORD dwServiceState,
6268 DWORD dwRequiredSize;
6269 DWORD dwServiceCount;
6271 DWORD dwLastResumeCount = 0;
6275 DPRINT(
"REnumServicesStatusExW() called\n");
6284 if (hManager ==
NULL)
6286 DPRINT1(
"Invalid service manager handle\n");
6296 *lpServicesReturned = 0;
6298 if ((dwServiceType == 0) ||
6301 DPRINT(
"Invalid Service Type\n");
6305 if ((dwServiceState == 0) ||
6308 DPRINT(
"Invalid Service State\n");
6316 DPRINT(
"Insufficient access rights 0x%lx\n",
6322 dwLastResumeCount = *lpResumeIndex;
6328 if (lpService ==
NULL)
6339 ServiceEntry = ServiceEntry->
Flink)
6352 if ((dwState & dwServiceState) == 0)
6357 if (*pszGroupName == 0)
6377 dwRequiredSize +=
dwSize;
6389 DPRINT(
"dwRequiredSize: %lu\n", dwRequiredSize);
6390 DPRINT(
"dwServiceCount: %lu\n", dwServiceCount);
6394 ServiceEntry = ServiceEntry->
Flink)
6407 if ((dwState & dwServiceState) == 0)
6412 if (*pszGroupName == 0)
6432 DPRINT(
"*pcbBytesNeeded: %lu\n", dwRequiredSize);
6435 *lpResumeIndex = dwLastResumeCount;
6437 *lpServicesReturned = dwServiceCount;
6454 ServiceEntry = ServiceEntry->
Flink)
6467 if ((dwState & dwServiceState) == 0)
6472 if (*pszGroupName == 0)
6517 dwRequiredSize +=
dwSize;
6536 DPRINT(
"REnumServicesStatusExW() done (Error %lu)\n", dwError);
6558 LPSTR lpServiceName,
6560 DWORD dwDesiredAccess,
6561 DWORD dwServiceType,
6563 DWORD dwErrorControl,
6564 LPSTR lpBinaryPathName,
6565 LPSTR lpLoadOrderGroup,
6569 LPSTR lpServiceStartName,
6586 DWORD dwDesiredAccess,
6587 DWORD dwServiceType,
6589 DWORD dwErrorControl,
6595 LPWSTR lpServiceStartName,
6618 if (hManager ==
NULL)
6633 if (lpInParams ==
NULL || lpOutParams ==
NULL)
6655 GUID *pClientProcessGuid,
6656 GUID *pSCMProcessGuid,
6657 PBOOL pfCreateRemoteQueue,
6737 DPRINT(
"RI_ScValidatePnPService(%p %S %p)\n",
hSCManager, pszServiceName, phServiceStatus);
6741 if (hManager ==
NULL)
6753 DPRINT1(
"No SC_MANAGER_CONNECT access\n");
6758 DPRINT(
"pService: %p\n", pService);
6759 if (pService ==
NULL)
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
ACPI_SIZE strlen(const char *String)
static WCHAR ServiceName[]
static HANDLE hServicesKey
DWORD ScmReadString(HKEY hServiceKey, LPCWSTR lpValueName, LPWSTR *lpValue)
DWORD ScmDecryptPassword(_In_ PVOID ContextHandle, _In_ PBYTE pPassword, _In_ DWORD dwPasswordSize, _Out_ PWSTR *pClearTextPassword)
DWORD ScmOpenServiceKey(LPWSTR lpServiceName, REGSAM samDesired, PHKEY phKey)
DWORD ScmWriteSecurityDescriptor(_In_ HKEY hServiceKey, _In_ PSECURITY_DESCRIPTOR pSecurityDescriptor)
DWORD ScmSetServicePassword(IN PCWSTR pszServiceName, IN PCWSTR pszPassword)
DWORD ScmWriteDependencies(HKEY hServiceKey, LPCWSTR lpDependencies, DWORD dwDependenciesLength)
DWORD ScmReadDependencies(HKEY hServiceKey, LPWSTR *lpDependencies, DWORD *lpdwDependenciesLength)
DWORD ScmMarkServiceForDelete(PSERVICE pService)
DWORD ScmCreateServiceKey(LPCWSTR lpServiceName, REGSAM samDesired, PHKEY phKey)
DWORD ScmControlService(_In_ HANDLE hControlPipe, _In_ PCWSTR pServiceName, _In_ DWORD dwControl, _In_ SERVICE_STATUS_HANDLE hServiceStatus)
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount)
VOID ScmRemoveServiceImage(PSERVICE_IMAGE pServiceImage)
VOID ScmUnlockDatabase(VOID)
DWORD ScmGenerateServiceTag(PSERVICE lpServiceRecord)
DWORD ScmGetServiceNameFromTag(IN PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams, OUT PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *OutParams)
DWORD ScmReferenceService(PSERVICE lpService)
DWORD ScmStartService(PSERVICE Service, DWORD argc, const PCWSTR *argv)
BOOL ScmLockDatabaseExclusive(VOID)
DWORD ScmDereferenceService(PSERVICE lpService)
DWORD ScmCreateNewServiceRecord(LPCWSTR lpServiceName, PSERVICE *lpServiceRecord, DWORD dwServiceType, DWORD dwStartType)
PSERVICE ScmGetServiceEntryByName(LPCWSTR lpServiceName)
BOOL ScmLockDatabaseShared(VOID)
LIST_ENTRY ServiceListHead
PSERVICE ScmGetServiceEntryByDisplayName(LPCWSTR lpDisplayName)
DWORD ScmControlDriver(PSERVICE lpService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
VOID ScmQueryServiceLockStatusW(OUT LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus)
VOID ScmQueryServiceLockStatusA(OUT LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus)
DWORD ScmAcquireServiceStartLock(IN BOOL IsServiceController, OUT LPSC_RPC_LOCK lpLock)
DWORD ScmReleaseServiceStartLock(IN OUT LPSC_RPC_LOCK lpLock)
#define IDS_SERVICE_PAUSE
#define IDS_SERVICE_PAUSED
#define IDS_SERVICE_RUNNING
#define IDS_SERVICE_STOPPED
#define IDS_SERVICE_RESUME
DWORD WINAPI RCloseServiceHandle(LPSC_RPC_HANDLE hSCObject)
DWORD WINAPI RChangeServiceConfig2W(SC_RPC_HANDLE hService, SC_RPC_CONFIG_INFOW Info)
DWORD WINAPI RDeleteService(SC_RPC_HANDLE hService)
static PSERVICE_HANDLE ScmGetServiceFromHandle(SC_RPC_HANDLE Handle)
DWORD WINAPI RQueryServiceLockStatusW(SC_RPC_HANDLE hSCManager, LPBYTE lpBuf, DWORD cbBufSize, LPBOUNDED_DWORD_4K pcbBytesNeeded)
DWORD ScmCanonDriverImagePath(DWORD dwStartType, const wchar_t *lpServiceName, wchar_t **lpCanonName)
DWORD WINAPI RQueryServiceObjectSecurity(SC_RPC_HANDLE hService, SECURITY_INFORMATION dwSecurityInformation, LPBYTE lpSecurityDescriptor, DWORD cbBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded)
static DWORD ScmCreateServiceHandle(PSERVICE lpServiceEntry, SC_HANDLE *Handle)
DWORD WINAPI RChangeServiceConfig2A(SC_RPC_HANDLE hService, SC_RPC_CONFIG_INFOA Info)
struct _MANAGER_HANDLE * PMANAGER_HANDLE
DWORD WINAPI ROpenSCManagerW(LPWSTR lpMachineName, LPWSTR lpDatabaseName, DWORD dwDesiredAccess, LPSC_RPC_HANDLE lpScHandle)
DWORD WINAPI RNotifyBootConfigStatus(SVCCTL_HANDLEW lpMachineName, DWORD BootAcceptable)
struct _SCMGR_HANDLE SCMGR_HANDLE
#define SC_MANAGER_EXECUTE
struct _SERVICE_HANDLE SERVICE_HANDLE
DWORD WINAPI RStartServiceW(SC_RPC_HANDLE hService, DWORD argc, LPSTRING_PTRSW argv)
struct _SERVICE_HANDLE * PSERVICE_HANDLE
DWORD WINAPI RGetServiceKeyNameA(SC_RPC_HANDLE hSCManager, LPCSTR lpDisplayName, LPSTR lpServiceName, LPBOUNDED_DWORD_4K lpcchBuffer)
DWORD WINAPI RCreateServiceW(SC_RPC_HANDLE hSCManager, LPCWSTR lpServiceName, LPCWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPBYTE lpDependencies, DWORD dwDependSize, LPCWSTR lpServiceStartName, LPBYTE lpPassword, DWORD dwPwSize, LPSC_RPC_HANDLE lpServiceHandle)
DWORD WINAPI RUnlockServiceDatabase(LPSC_RPC_LOCK Lock)
static BOOL ScmIsValidServiceState(DWORD dwCurrentState)
DWORD WINAPI ROpenServiceW(SC_RPC_HANDLE hSCManager, LPWSTR lpServiceName, DWORD dwDesiredAccess, LPSC_RPC_HANDLE lpServiceHandle)
static DWORD ScmCheckAccess(SC_HANDLE Handle, DWORD dwDesiredAccess)
DWORD WINAPI RChangeServiceConfigW(SC_RPC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPWSTR lpBinaryPathName, LPWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPBYTE lpDependencies, DWORD dwDependSize, LPWSTR lpServiceStartName, LPBYTE lpPassword, DWORD dwPwSize, LPWSTR lpDisplayName)
DWORD WINAPI RControlServiceExA(SC_RPC_HANDLE hService, DWORD dwControl, DWORD dwInfoLevel)
DWORD WINAPI REnumServicesStatusA(SC_RPC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpBuffer, DWORD dwBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned, LPBOUNDED_DWORD_256K lpResumeHandle)
DWORD WINAPI RLockServiceDatabase(SC_RPC_HANDLE hSCManager, LPSC_RPC_LOCK lpLock)
DWORD WINAPI RQueryServiceConfig2A(SC_RPC_HANDLE hService, DWORD dwInfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPBOUNDED_DWORD_8K pcbBytesNeeded)
DWORD WINAPI RQueryServiceStatus(SC_RPC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus)
DWORD WINAPI RNotifyServiceStatusChange(SC_RPC_HANDLE hService, SC_RPC_NOTIFY_PARAMS NotifyParams, GUID *pClientProcessGuid, GUID *pSCMProcessGuid, PBOOL pfCreateRemoteQueue, LPSC_NOTIFY_RPC_HANDLE phNotify)
DWORD WINAPI ROpenServiceA(SC_RPC_HANDLE hSCManager, LPSTR lpServiceName, DWORD dwDesiredAccess, LPSC_RPC_HANDLE lpServiceHandle)
DWORD WINAPI RStartServiceA(SC_RPC_HANDLE hService, DWORD argc, LPSTRING_PTRSA argv)
DWORD WINAPI RSendPnPMessage(handle_t BindingHandle)
DWORD WINAPI RGetServiceDisplayNameW(SC_RPC_HANDLE hSCManager, LPCWSTR lpServiceName, LPWSTR lpDisplayName, DWORD *lpcchBuffer)
DWORD WINAPI RQueryServiceLockStatusA(SC_RPC_HANDLE hSCManager, LPBYTE lpBuf, DWORD cbBufSize, LPBOUNDED_DWORD_4K pcbBytesNeeded)
DWORD WINAPI RControlServiceExW(SC_RPC_HANDLE hService, DWORD dwControl, DWORD dwInfoLevel)
DWORD WINAPI RGetServiceKeyNameW(SC_RPC_HANDLE hSCManager, LPCWSTR lpDisplayName, LPWSTR lpServiceName, DWORD *lpcchBuffer)
void __RPC_USER SC_RPC_HANDLE_rundown(SC_RPC_HANDLE hSCObject)
void __RPC_USER SC_NOTIFY_RPC_HANDLE_rundown(SC_NOTIFY_RPC_HANDLE hNotify)
DWORD WINAPI RGetNotifyResults(SC_NOTIFY_RPC_HANDLE hNotify, PSC_RPC_NOTIFY_PARAMS_LIST *ppNotifyParams)
DWORD WINAPI RControlService(SC_RPC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
static GENERIC_MAPPING ScmServiceMapping
static DWORD ScmSetFailureActions(HKEY hServiceKey, LPSERVICE_FAILURE_ACTIONSW lpFailureActions)
DWORD WINAPI RCreateServiceA(SC_RPC_HANDLE hSCManager, LPSTR lpServiceName, LPSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPSTR lpBinaryPathName, LPSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPBYTE lpDependencies, DWORD dwDependSize, LPSTR lpServiceStartName, LPBYTE lpPassword, DWORD dwPwSize, LPSC_RPC_HANDLE lpServiceHandle)
DWORD WINAPI REnumServiceGroupW(SC_RPC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpBuffer, DWORD cbBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned, LPBOUNDED_DWORD_256K lpResumeIndex, LPCWSTR pszGroupName)
DWORD WINAPI RQueryServiceStatusEx(SC_RPC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPBOUNDED_DWORD_8K pcbBytesNeeded)
DWORD ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
DWORD WINAPI RI_ScQueryServiceTagInfo(SC_RPC_HANDLE hSCManager, TAG_INFO_LEVEL dwInfoLevel, PTAG_INFO_NAME_FROM_TAG_IN_PARAMS *lpInParams, PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *lpOutParams)
static GENERIC_MAPPING ScmManagerMapping
DWORD ScmAssignNewTag(PSERVICE lpService)
DWORD WINAPI RQueryServiceConfigW(SC_RPC_HANDLE hService, LPBYTE lpBuf, DWORD cbBufSize, LPBOUNDED_DWORD_8K pcbBytesNeeded)
VOID ScmStartRpcServer(VOID)
DWORD WINAPI RQueryServiceConfig2W(SC_RPC_HANDLE hService, DWORD dwInfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPBOUNDED_DWORD_8K pcbBytesNeeded)
DWORD WINAPI RSendTSMessage(handle_t BindingHandle)
static DWORD WINAPI ScmStopThread(PVOID pParam)
DWORD WINAPI RCloseNotifyHandle(LPSC_NOTIFY_RPC_HANDLE phNotify, PBOOL pfApcFired)
DWORD Int_EnumDependentServicesW(HKEY hServicesKey, PSERVICE lpService, DWORD dwServiceState, PSERVICE *lpServices, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned)
DWORD WINAPI RI_ScValidatePnPService(_In_ SC_RPC_HANDLE hSCManager, _In_ LPWSTR pszServiceName, _Out_ RPC_SERVICE_STATUS_HANDLE *phServiceStatus)
DWORD WINAPI RI_ScSetServiceBitsA(RPC_SERVICE_STATUS_HANDLE hServiceStatus, DWORD dwServiceBits, int bSetBitsOn, int bUpdateImmediately, char *lpString)
DWORD WINAPI REnumServicesStatusExA(SC_RPC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpBuffer, DWORD cbBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned, LPBOUNDED_DWORD_256K lpResumeIndex, LPCSTR pszGroupName)
DWORD WINAPI REnumDependentServicesW(SC_RPC_HANDLE hService, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned)
DWORD WINAPI RGetServiceDisplayNameA(SC_RPC_HANDLE hSCManager, LPCSTR lpServiceName, LPSTR lpDisplayName, LPBOUNDED_DWORD_4K lpcchBuffer)
DWORD WINAPI RCreateServiceWOW64W(handle_t BindingHandle, LPWSTR lpServiceName, LPWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPWSTR lpBinaryPathName, LPWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPBYTE lpDependencies, DWORD dwDependSize, LPWSTR lpServiceStartName, LPBYTE lpPassword, DWORD dwPwSize, LPSC_RPC_HANDLE lpServiceHandle)
static DWORD ScmCreateManagerHandle(LPWSTR lpDatabaseName, SC_HANDLE *Handle)
DWORD WINAPI RFunction55(handle_t BindingHandle)
DWORD WINAPI RI_ScGetCurrentGroupStateW(SC_RPC_HANDLE hSCManager, LPWSTR lpLoadOrderGroup, LPDWORD lpState)
DWORD WINAPI ROpenSCManagerA(LPSTR lpMachineName, LPSTR lpDatabaseName, DWORD dwDesiredAccess, LPSC_RPC_HANDLE lpScHandle)
DWORD WINAPI RSetServiceObjectSecurity(SC_RPC_HANDLE hService, DWORD dwSecurityInformation, LPBYTE lpSecurityDescriptor, DWORD dwSecurityDescriptorSize)
DWORD WINAPI RChangeServiceConfigA(SC_RPC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPSTR lpBinaryPathName, LPSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPBYTE lpDependencies, DWORD dwDependSize, LPSTR lpServiceStartName, LPBYTE lpPassword, DWORD dwPwSize, LPSTR lpDisplayName)
DWORD WINAPI RQueryServiceConfigA(SC_RPC_HANDLE hService, LPBYTE lpBuf, DWORD cbBufSize, LPBOUNDED_DWORD_8K pcbBytesNeeded)
void __RPC_USER SC_RPC_LOCK_rundown(SC_RPC_LOCK Lock)
DWORD WINAPI REnumDependentServicesA(SC_RPC_HANDLE hService, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned)
struct _MANAGER_HANDLE MANAGER_HANDLE
DWORD WINAPI REnumServicesStatusExW(SC_RPC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpBuffer, DWORD cbBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned, LPBOUNDED_DWORD_256K lpResumeIndex, LPCWSTR pszGroupName)
DWORD WINAPI RI_ScSetServiceBitsW(RPC_SERVICE_STATUS_HANDLE hServiceStatus, DWORD dwServiceBits, int bSetBitsOn, int bUpdateImmediately, wchar_t *lpString)
DWORD WINAPI ROpenServiceStatusHandle(handle_t BindingHandle)
static PMANAGER_HANDLE ScmGetServiceManagerFromHandle(SC_RPC_HANDLE Handle)
DWORD WINAPI RSetServiceStatus(RPC_SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
DWORD WINAPI REnumServicesStatusW(SC_RPC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpBuffer, DWORD dwBufSize, LPBOUNDED_DWORD_256K pcbBytesNeeded, LPBOUNDED_DWORD_256K lpServicesReturned, LPBOUNDED_DWORD_256K lpResumeHandle)
DWORD WINAPI RCreateServiceWOW64A(handle_t BindingHandle, LPSTR lpServiceName, LPSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPSTR lpBinaryPathName, LPSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPBYTE lpDependencies, DWORD dwDependSize, LPSTR lpServiceStartName, LPBYTE lpPassword, DWORD dwPwSize, LPSC_RPC_HANDLE lpServiceHandle)
DWORD ScmCreateDefaultServiceSD(PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
VOID ScmLogEvent(DWORD dwEventId, WORD wType, WORD wStrings, LPCWSTR *lpStrings)
struct _SERVICE * PSERVICE
#define RegCloseKey(hKey)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
DWORD ScmRunLastKnownGood(VOID)
DWORD ScmAcceptBoot(VOID)
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
#define ERROR_NOT_ENOUGH_MEMORY
#define ERROR_INSUFFICIENT_BUFFER
#define NT_SUCCESS(StatCode)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegFlushKey(HKEY hKey)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
static const WCHAR SystemRoot[]
#define ERROR_INVALID_ADDRESS
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
#define WideCharToMultiByte
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
#define ERROR_INVALID_NAME
static DWORD DWORD * dwLength
static void cleanup(void)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
PSERVICE_GROUP ScmGetServiceGroupByName(_In_ LPCWSTR lpGroupName)
DWORD ScmSetServiceGroup(PSERVICE lpService, LPCWSTR lpGroupName)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define EXCEPTION_EXECUTE_HANDLER
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define InitializeObjectAttributes(p, n, a, r, s)
DWORD SECURITY_INFORMATION
NTSYSAPI NTSTATUS NTAPI RtlSetSecurityObject(_In_ SECURITY_INFORMATION SecurityInformation, _In_ PSECURITY_DESCRIPTOR ModificationDescriptor, _Out_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, _In_ PGENERIC_MAPPING GenericMapping, _In_ HANDLE Token)
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
NTSYSAPI NTSTATUS NTAPI RtlQuerySecurityObject(_In_ PSECURITY_DESCRIPTOR ObjectDescriptor, _In_ SECURITY_INFORMATION SecurityInformation, _Out_ PSECURITY_DESCRIPTOR ResultantDescriptor, _In_ ULONG DescriptorLength, _Out_ PULONG ReturnLength)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlMapGenericMask(PACCESS_MASK AccessMask, PGENERIC_MAPPING GenericMapping)
NTSYSAPI BOOLEAN NTAPI RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor)
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSYSAPI BOOLEAN NTAPI RtlAreAllAccessesGranted(ACCESS_MASK GrantedAccess, ACCESS_MASK DesiredAccess)
#define EVENT_SERVICE_CONTROL_SUCCESS
#define EVENT_SERVICE_EXIT_FAILED
#define EVENT_SERVICE_STATUS_SUCCESS
#define SYMBOLIC_LINK_QUERY
#define ACCESS_SYSTEM_SECURITY
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_CREATE_SUB_KEY
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define UNICODE_STRING_MAX_BYTES
NTSTATUS NTAPI NtOpenThreadToken(_In_ HANDLE ThreadHandle, _In_ ACCESS_MASK DesiredAccess, _In_ BOOLEAN OpenAsSelf, _Out_ PHANDLE TokenHandle)
Opens a token that is tied to a thread handle.
#define STATUS_BAD_DESCRIPTOR_FORMAT
NTSTATUS NTAPI NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, OUT PUNICODE_STRING LinkTarget, OUT PULONG ResultLength OPTIONAL)
NTSTATUS NTAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
static WCHAR CanonName[NI_MAXHOST]
#define _SEH2_EXCEPT(...)
RPC_STATUS WINAPI RpcRevertToSelf(void)
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define midl_user_allocate
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
#define STATUS_BUFFER_TOO_SMALL
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
SERVICE_STATUS ServiceStatus
SERVICE_STATUS ServiceStatus
SERVICE_STATUS_PROCESS ServiceStatusProcess
SERVICE_STATUS_PROCESS ServiceStatusProcess
struct _LIST_ENTRY * Flink
LPSERVICE_DESCRIPTIONW psd
LPSERVICE_FAILURE_ACTIONSW psfa
DWORD dwServiceSpecificExitCode
PSECURITY_DESCRIPTOR pSecurityDescriptor
LIST_ENTRY ServiceListEntry
BOUNDED_DWORD_256K * LPBOUNDED_DWORD_256K
BOUNDED_DWORD_8K * LPBOUNDED_DWORD_8K
BOUNDED_DWORD_4K * LPBOUNDED_DWORD_4K
ULONG_PTR RPC_SERVICE_STATUS_HANDLE
enum _TAG_INFO_LEVEL TAG_INFO_LEVEL
@ TagInfoLevelNameFromTag
_In_ ULONG _Out_ HANDLE * BindingHandle
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
SERVICE_STATUS_HANDLE hServiceStatus
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
#define ERROR_INVALID_LEVEL
#define ERROR_SERVICE_MARKED_FOR_DELETE
#define ERROR_SERVICE_NOT_ACTIVE
#define ERROR_INVALID_ENVIRONMENT
#define ERROR_GEN_FAILURE
#define ERROR_SERVICE_DOES_NOT_EXIST
#define ERROR_DUPLICATE_SERVICE_NAME
#define ERROR_SERVICE_EXISTS
#define ERROR_DEPENDENT_SERVICES_RUNNING
#define ERROR_SERVICE_DISABLED
#define ERROR_CANNOT_DETECT_DRIVER_FAILURE
#define ERROR_INVALID_SERVICE_CONTROL
#define ERROR_SHUTDOWN_IN_PROGRESS
#define ERROR_DATABASE_DOES_NOT_EXIST
#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL
#define ERROR_INVALID_DATA
#define EVENTLOG_ERROR_TYPE
#define EVENTLOG_INFORMATION_TYPE
#define HKEY_LOCAL_MACHINE
#define SERVICE_ACCEPT_PARAMCHANGE
#define SERVICE_CONTROL_PARAMCHANGE
struct _QUERY_SERVICE_CONFIGW * LPQUERY_SERVICE_CONFIGW
#define SERVICE_STATE_ALL
struct _QUERY_SERVICE_LOCK_STATUSW QUERY_SERVICE_LOCK_STATUSW
struct _SERVICE_DESCRIPTIONA SERVICE_DESCRIPTIONA
#define SERVICE_ACCEPT_STOP
struct _ENUM_SERVICE_STATUS_PROCESSA ENUM_SERVICE_STATUS_PROCESSA
_In_ DWORD _In_ DWORD _Out_ LPDWORD pcbBytesNeeded
struct _SERVICE_FAILURE_ACTIONSW SERVICE_FAILURE_ACTIONSW
#define SERVICE_CONTROL_NETBINDREMOVE
#define SERVICE_QUERY_STATUS
struct _QUERY_SERVICE_LOCK_STATUSA * LPQUERY_SERVICE_LOCK_STATUSA
struct _QUERY_SERVICE_LOCK_STATUSA QUERY_SERVICE_LOCK_STATUSA
#define SERVICE_CONTROL_NETBINDADD
#define SERVICE_USER_DEFINED_CONTROL
#define SC_MANAGER_QUERY_LOCK_STATUS
_In_ DWORD _In_ DWORD cbBufSize
struct _ENUM_SERVICE_STATUS_PROCESSW * LPENUM_SERVICE_STATUS_PROCESSW
#define SERVICE_CONFIG_DESCRIPTION
#define SERVICE_ALL_ACCESS
struct _SERVICE_DESCRIPTIONW SERVICE_DESCRIPTIONW
#define SC_MANAGER_ENUMERATE_SERVICE
struct _SC_ACTION SC_ACTION
struct _ENUM_SERVICE_STATUS_PROCESSA * LPENUM_SERVICE_STATUS_PROCESSA
#define SC_MANAGER_CREATE_SERVICE
#define SC_MANAGER_CONNECT
struct _QUERY_SERVICE_CONFIGW QUERY_SERVICE_CONFIGW
#define SERVICE_NO_CHANGE
#define SERVICE_STOP_PENDING
#define SERVICE_CHANGE_CONFIG
#define SERVICES_FAILED_DATABASEW
struct _SERVICE_DESCRIPTIONW * LPSERVICE_DESCRIPTIONW
struct _ENUM_SERVICE_STATUSW ENUM_SERVICE_STATUSW
struct _ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESSW
struct _SERVICE_STATUS SERVICE_STATUS
struct _SERVICE_FAILURE_ACTIONSA * LPSERVICE_FAILURE_ACTIONSA
#define SERVICE_CONTROL_NETBINDDISABLE
struct _SC_ACTION * LPSC_ACTION
#define SERVICE_PAUSE_CONTINUE
enum _SC_STATUS_TYPE SC_STATUS_TYPE
struct _QUERY_SERVICE_CONFIGA * LPQUERY_SERVICE_CONFIGA
#define SERVICE_CONTROL_NETBINDENABLE
#define SERVICE_INTERROGATE
struct _SERVICE_DESCRIPTIONA * LPSERVICE_DESCRIPTIONA
#define SERVICE_START_PENDING
#define SERVICE_CONTROL_CONTINUE
struct _QUERY_SERVICE_LOCK_STATUSW * LPQUERY_SERVICE_LOCK_STATUSW
struct _ENUM_SERVICE_STATUSW * LPENUM_SERVICE_STATUSW
#define SERVICE_ACCEPT_PAUSE_CONTINUE
#define SERVICE_CONTROL_STOP
struct _SERVICE_STATUS_PROCESS * LPSERVICE_STATUS_PROCESS
struct _SERVICE_FAILURE_ACTIONSA SERVICE_FAILURE_ACTIONSA
#define SERVICES_ACTIVE_DATABASEW
#define SERVICE_PAUSE_PENDING
#define SERVICE_CONFIG_FAILURE_ACTIONS
#define SERVICE_ACCEPT_NETBINDCHANGE
#define SERVICE_CONTROL_PAUSE
struct _SERVICE_FAILURE_ACTIONSW * LPSERVICE_FAILURE_ACTIONSW
struct _SERVICE_STATUS_PROCESS SERVICE_STATUS_PROCESS
#define SERVICE_CONTROL_INTERROGATE
struct _ENUM_SERVICE_STATUSA ENUM_SERVICE_STATUSA
#define SC_MANAGER_ALL_ACCESS
struct _ENUM_SERVICE_STATUSA * LPENUM_SERVICE_STATUSA
#define SERVICE_QUERY_CONFIG
enum _SC_ENUM_TYPE SC_ENUM_TYPE
struct _QUERY_SERVICE_CONFIGA QUERY_SERVICE_CONFIGA
#define SERVICE_CONTINUE_PENDING
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
#define SERVICE_DEMAND_START
#define SERVICE_KERNEL_DRIVER
#define SERVICE_WIN32_SHARE_PROCESS
#define SERVICE_ERROR_SEVERE
#define SERVICE_INTERACTIVE_PROCESS
#define SERVICE_AUTO_START
#define SERVICE_BOOT_START
#define SERVICE_ERROR_CRITICAL
#define SERVICE_WIN32_OWN_PROCESS
#define SERVICE_SYSTEM_START
#define SERVICE_FILE_SYSTEM_DRIVER
#define SERVICE_ERROR_IGNORE
#define SERVICE_ERROR_NORMAL
_In_ ULONG RequiredAccess
#define DACL_SECURITY_INFORMATION
#define OWNER_SECURITY_INFORMATION
#define GROUP_SECURITY_INFORMATION
#define SACL_SECURITY_INFORMATION
_Inout_ PUNICODE_STRING LinkTarget
#define NtCurrentThread()