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);
785 DWORD dwServiceState,
793 WCHAR *lpszNameBuf = szNameBuf;
794 WCHAR *lpszValueBuf = szValueBuf;
799 HKEY hServiceEnumKey;
801 DWORD dwDependServiceStrPtr = 0;
802 DWORD dwRequiredSize = 0;
819 DPRINT(
"ERROR! Unable to get number of services keys\n");
824 for (dwIteration = 0; dwIteration < dwNumSubKeys; dwIteration++)
862 dwDependServiceStrPtr = 0;
865 while (
wcslen(lpszValueBuf + dwDependServiceStrPtr) > 0)
873 if (!lpCurrentService)
876 DPRINT(
"This should not happen at this point, report to Developer\n");
885 if ((dwCurrentServiceState == dwServiceState) ||
894 dwRequiredSize += (2 *
sizeof(
PVOID));
912 lpServices[*lpServicesReturned] = lpCurrentService;
914 *lpServicesReturned = *lpServicesReturned + 1;
918 dwDependServiceStrPtr += (
DWORD)(
wcslen(lpszValueBuf + dwDependServiceStrPtr) + 1);
945 DWORD dwServicesReturned = 0;
947 DPRINT(
"RCloseServiceHandle() called\n");
949 DPRINT(
"hSCObject = %p\n", *hSCObject);
957 if (hManager !=
NULL)
959 DPRINT(
"Found manager handle\n");
969 DPRINT(
"RCloseServiceHandle() done\n");
972 else if (hService !=
NULL)
974 DPRINT(
"Found service handle\n");
992 DPRINT(
"CloseServiceHandle - lpService->dwRefCount %u\n",
1003 L"System\\CurrentControlSet\\Services",
1009 DPRINT(
"Failed to open services key\n");
1020 &dwServicesReturned);
1025 DPRINT(
"Deletion failed due to running dependencies\n");
1042 DPRINT(
"Failed to Delete the Service Registry key\n");
1056 DPRINT(
"RCloseServiceHandle() done\n");
1079 DWORD dwServicesReturned = 0;
1080 DWORD dwControlsAccepted;
1081 DWORD dwCurrentState;
1084 WCHAR szLogBuffer[80];
1087 DPRINT(
"RControlService() called\n");
1096 DPRINT1(
"Invalid service handle\n");
1102 if (lpService ==
NULL)
1104 DPRINT1(
"lpService == NULL\n");
1130 if (dwControl >= 128 && dwControl <= 255)
1153 L"System\\CurrentControlSet\\Services",
1159 DPRINT(
"Failed to open services key\n");
1169 &dwServicesReturned);
1177 DPRINT(
"Service has running dependencies. Failed to stop service\n");
1199 switch (dwCurrentState)
1288 lpLogStrings[1] = szLogBuffer;
1311 DPRINT(
"RDeleteService() called\n");
1319 DPRINT1(
"Invalid service handle\n");
1328 if (lpService ==
NULL)
1330 DPRINT(
"lpService == NULL\n");
1339 DPRINT(
"Service has already been marked for delete\n");
1353 DPRINT(
"RDeleteService() done\n");
1368 DPRINT(
"RLockServiceDatabase() called\n");
1375 DPRINT1(
"Invalid service manager handle\n");
1393 LPBYTE lpSecurityDescriptor,
1401 DWORD dwBytesNeeded;
1404 DPRINT(
"RQueryServiceObjectSecurity() called\n");
1409 DPRINT1(
"Invalid service handle\n");
1429 if (lpService ==
NULL)
1431 DPRINT(
"lpService == NULL\n");
1440 dwSecurityInformation,
1476 DWORD dwSecurityInformation,
1477 LPBYTE lpSecurityDescriptor,
1478 DWORD dwSecurityDescriptorSize)
1489 DPRINT(
"RSetServiceObjectSecurity() called\n");
1494 DPRINT1(
"Invalid service handle\n");
1498 if (dwSecurityInformation == 0 ||
1537 if (lpService ==
NULL)
1539 DPRINT1(
"lpService == NULL\n");
1573 bDatabaseLocked =
TRUE;
1589 if (hServiceKey !=
NULL)
1593 if (bDatabaseLocked ==
TRUE)
1599 DPRINT(
"RSetServiceObjectSecurity() done (Error %lu)\n", dwError);
1615 DPRINT(
"RQueryServiceStatus() called\n");
1623 DPRINT1(
"Invalid service handle\n");
1635 if (lpService ==
NULL)
1637 DPRINT(
"lpService == NULL\n");
1659 switch (dwCurrentState)
1684 DWORD dwPreviousState;
1685 DWORD dwPreviousType;
1687 WCHAR szLogBuffer[80];
1690 DPRINT(
"RSetServiceStatus() called\n");
1702 DPRINT(
"hServiceStatus == NULL\n");
1711 DPRINT(
"Invalid service state\n");
1719 DPRINT(
"Invalid service type\n");
1726 DPRINT(
"Invalid controls accepted\n");
1775 lpService->lpImage =
NULL;
1790 lpLogStrings[1] = szLogBuffer;
1820 lpLogStrings[1] = szLogBuffer;
1829 DPRINT(
"RSetServiceStatus() done\n");
1841 DPRINT(
"RUnlockServiceDatabase(%p)\n",
Lock);
1851 DWORD BootAcceptable)
1853 DPRINT(
"RNotifyBootConfigStatus(%p %lu)\n",
1854 lpMachineName, BootAcceptable);
1870 int bUpdateImmediately,
1875 DPRINT(
"RI_ScSetServiceBitsW(%p %lx %d %d %S)\n",
1877 bUpdateImmediately, lpString);
1882 if (lpString !=
NULL)
1887 DPRINT(
"hServiceStatus == NULL\n");
1922 DWORD dwServiceType,
1924 DWORD dwErrorControl,
1930 LPWSTR lpServiceStartName,
1943 DPRINT(
"RChangeServiceConfigW() called\n");
1944 DPRINT(
"dwServiceType = 0x%lx\n", dwServiceType);
1945 DPRINT(
"dwStartType = %lu\n", dwStartType);
1946 DPRINT(
"dwErrorControl = %lu\n", dwErrorControl);
1947 DPRINT(
"lpBinaryPathName = %S\n", lpBinaryPathName);
1948 DPRINT(
"lpLoadOrderGroup = %S\n", lpLoadOrderGroup);
1949 DPRINT(
"lpServiceStartName = %S\n", lpServiceStartName);
1950 DPRINT(
"lpPassword = %p\n", lpPassword);
1951 DPRINT(
"dwPwSite = %lu\n", dwPwSize);
1960 DPRINT1(
"Invalid service handle\n");
2011 if (lpdwTagId && (!lpLoadOrderGroup || !*lpLoadOrderGroup))
2017 if (lpService ==
NULL)
2019 DPRINT(
"lpService == NULL\n");
2028 DPRINT(
"Service has already been marked for delete\n");
2056 if (lpDisplayNameW ==
NULL)
2114 if (lpBinaryPathName !=
NULL && *lpBinaryPathName != 0)
2117 lpImagePathW = lpBinaryPathName;
2136 if (lpImagePathW != lpBinaryPathName)
2144 if (lpLoadOrderGroup !=
NULL && *lpLoadOrderGroup != 0)
2150 (
LPBYTE)lpLoadOrderGroup,
2162 if (lpdwTagId !=
NULL)
2177 *lpdwTagId = lpService->
dwTag;
2181 if (lpDependencies !=
NULL && *lpDependencies != 0)
2194 if (lpServiceStartName !=
NULL && *lpServiceStartName != 0)
2200 (
LPBYTE)lpServiceStartName,
2206 if (lpPassword !=
NULL)
2208 if (*(
LPWSTR)lpPassword != 0)
2214 &lpClearTextPassword);
2217 DPRINT1(
"ScmDecryptPassword failed (Error %lu)\n", dwError);
2220 DPRINT1(
"Clear text password: %S\n", lpClearTextPassword);
2224 lpClearTextPassword);
2227 DPRINT1(
"ScmSetServicePassword failed (Error %lu)\n", dwError);
2241 DPRINT1(
"ScmSetServicePassword failed (Error %lu)\n", dwError);
2249 if (lpClearTextPassword !=
NULL)
2253 (
wcslen(lpClearTextPassword) + 1) *
sizeof(
WCHAR));
2257 if (hServiceKey !=
NULL)
2263 DPRINT(
"RChangeServiceConfigW() done (Error %lu)\n", dwError);
2276 DWORD dwDesiredAccess,
2277 DWORD dwServiceType,
2279 DWORD dwErrorControl,
2293 SC_HANDLE hServiceHandle =
NULL;
2299 DPRINT(
"RCreateServiceW() called\n");
2300 DPRINT(
"lpServiceName = %S\n", lpServiceName);
2302 DPRINT(
"dwDesiredAccess = %lx\n", dwDesiredAccess);
2303 DPRINT(
"dwServiceType = 0x%lx\n", dwServiceType);
2304 DPRINT(
"dwStartType = %lu\n", dwStartType);
2305 DPRINT(
"dwErrorControl = %lu\n", dwErrorControl);
2306 DPRINT(
"lpBinaryPathName = %S\n", lpBinaryPathName);
2307 DPRINT(
"lpLoadOrderGroup = %S\n", lpLoadOrderGroup);
2308 DPRINT(
"lpdwTagId = %p\n", lpdwTagId);
2314 if (hManager ==
NULL)
2316 DPRINT1(
"Invalid service manager handle\n");
2324 DPRINT(
"Insufficient access rights! 0x%lx\n",
2329 if (*lpServiceName == 0)
2332 if (*lpBinaryPathName == 0)
2375 (lpServiceStartName))
2378 if (
wcsicmp(lpServiceStartName,
L"LocalSystem"))
2384 if (lpdwTagId && (!lpLoadOrderGroup || !*lpLoadOrderGroup))
2463 if (lpLoadOrderGroup !=
NULL && *lpLoadOrderGroup != 0)
2472 if (lpdwTagId !=
NULL)
2543 (
LPBYTE)lpBinaryPathName,
2561 if (lpLoadOrderGroup !=
NULL && *lpLoadOrderGroup != 0)
2567 (
LPBYTE)lpLoadOrderGroup,
2574 if (lpdwTagId !=
NULL)
2587 if (lpDependencies !=
NULL && *lpDependencies != 0)
2600 lpObjectName = (lpServiceStartName !=
NULL) ? (
LPWSTR)lpServiceStartName :
L"LocalSystem";
2610 if (lpPassword !=
NULL && *(
LPWSTR)lpPassword != 0)
2616 &lpClearTextPassword);
2622 lpClearTextPassword);
2649 DPRINT(
"CreateService - lpService->dwRefCount %u\n", lpService->
dwRefCount);
2655 if (hServiceKey !=
NULL)
2658 if (lpClearTextPassword !=
NULL)
2662 (
wcslen(lpClearTextPassword) + 1) *
sizeof(
WCHAR));
2668 DPRINT(
"hService %p\n", hServiceHandle);
2671 if (lpdwTagId !=
NULL)
2672 *lpdwTagId = lpService->
dwTag;
2676 if (lpService !=
NULL &&
2689 if (lpService !=
NULL)
2695 if (lpImagePath !=
NULL)
2698 DPRINT(
"RCreateServiceW() done (Error %lu)\n", dwError);
2709 DWORD dwServiceState,
2716 DWORD dwServicesReturned = 0;
2717 DWORD dwServiceCount;
2726 *lpServicesReturned = 0;
2728 DPRINT(
"REnumDependentServicesW() called\n");
2733 DPRINT1(
"Invalid service handle\n");
2743 DPRINT(
"Insufficient access rights! 0x%lx\n",
2750 L"System\\CurrentControlSet\\Services",
2763 &dwServicesReturned);
2777 (dwServicesReturned + 1) *
sizeof(
PSERVICE));
2778 if (!lpServicesArray)
2780 DPRINT1(
"Could not allocate buffer\n");
2785 dwServicesReturned = 0;
2793 &dwServicesReturned);
2803 for (dwServiceCount = 0; dwServiceCount < dwServicesReturned; dwServiceCount++)
2805 lpService = lpServicesArray[dwServiceCount];
2825 *lpServicesReturned = dwServicesReturned;
2828 if (lpServicesArray !=
NULL)
2833 DPRINT(
"REnumDependentServicesW() done (Error %lu)\n", dwError);
2844 DWORD dwServiceType,
2845 DWORD dwServiceState,
2871 DWORD dwDesiredAccess,
2877 DPRINT(
"ROpenSCManagerW() called\n");
2878 DPRINT(
"lpMachineName = %p\n", lpMachineName);
2879 DPRINT(
"lpMachineName: %S\n", lpMachineName);
2880 DPRINT(
"lpDataBaseName = %p\n", lpDatabaseName);
2881 DPRINT(
"lpDataBaseName: %S\n", lpDatabaseName);
2882 DPRINT(
"dwDesiredAccess = %x\n", dwDesiredAccess);
2894 DPRINT(
"ScmCreateManagerHandle() failed (Error %lu)\n", dwError);
2903 DPRINT(
"ScmCheckAccess() failed (Error %lu)\n", dwError);
2909 DPRINT(
"*hScm = %p\n", *lpScHandle);
2911 DPRINT(
"ROpenSCManagerW() done\n");
2923 DWORD dwDesiredAccess,
2931 DPRINT(
"ROpenServiceW() called\n");
2933 DPRINT(
"lpServiceName = %p\n", lpServiceName);
2934 DPRINT(
"lpServiceName: %S\n", lpServiceName);
2935 DPRINT(
"dwDesiredAccess = %x\n", dwDesiredAccess);
2941 if (hManager ==
NULL)
2943 DPRINT1(
"Invalid service manager handle\n");
2947 if (!lpServiceHandle)
2958 if (lpService ==
NULL)
2960 DPRINT(
"Could not find service\n");
2970 DPRINT(
"ScmCreateServiceHandle() failed (Error %lu)\n", dwError);
2979 DPRINT(
"ScmCheckAccess() failed (Error %lu)\n", dwError);
2988 DPRINT(
"*hService = %p\n", *lpServiceHandle);
2994 DPRINT(
"ROpenServiceW() done\n");
3017 DWORD dwDependenciesLength = 0;
3018 DWORD dwRequiredSize;
3021 DPRINT(
"RQueryServiceConfigW() called\n");
3029 DPRINT1(
"Invalid service handle\n");
3041 if (lpService ==
NULL)
3043 DPRINT(
"lpService == NULL\n");
3066 &lpServiceStartName);
3071 &dwDependenciesLength);
3075 if (lpImagePath !=
NULL)
3078 dwRequiredSize += 2 *
sizeof(
WCHAR);
3083 dwRequiredSize += 2 *
sizeof(
WCHAR);
3085 if (lpDependencies !=
NULL)
3086 dwRequiredSize += dwDependenciesLength *
sizeof(
WCHAR);
3088 dwRequiredSize += 2 *
sizeof(
WCHAR);
3090 if (lpServiceStartName !=
NULL)
3091 dwRequiredSize += (
DWORD)((
wcslen(lpServiceStartName) + 1) *
sizeof(
WCHAR));
3093 dwRequiredSize += 2 *
sizeof(
WCHAR);
3098 dwRequiredSize += 2 *
sizeof(
WCHAR);
3111 lpStr = (
LPWSTR)(lpServiceConfig + 1);
3114 if (lpImagePath !=
NULL)
3116 wcscpy(lpStr, lpImagePath);
3124 lpStr += (
wcslen(lpStr) + 1);
3137 lpStr += (
wcslen(lpStr) + 1);
3140 if (lpDependencies !=
NULL)
3144 dwDependenciesLength *
sizeof(
WCHAR));
3152 if (lpDependencies !=
NULL)
3153 lpStr += dwDependenciesLength;
3155 lpStr += (
wcslen(lpStr) + 1);
3158 if (lpServiceStartName !=
NULL)
3160 wcscpy(lpStr, lpServiceStartName);
3168 lpStr += (
wcslen(lpStr) + 1);
3190 if (lpImagePath !=
NULL)
3193 if (lpServiceStartName !=
NULL)
3196 if (lpDependencies !=
NULL)
3199 if (hServiceKey !=
NULL)
3202 DPRINT(
"RQueryServiceConfigW() done\n");
3219 DWORD dwRequiredSize;
3227 DPRINT1(
"Invalid service manager handle\n");
3266 DPRINT(
"RStartServiceW(%p %lu %p) called\n", hService,
argc,
argv);
3283 DPRINT1(
"Invalid service handle\n");
3295 if (lpService ==
NULL)
3297 DPRINT(
"lpService == NULL\n");
3329 DPRINT(
"RGetServiceDisplayNameW() called\n");
3331 DPRINT(
"lpServiceName: %S\n", lpServiceName);
3333 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
3339 DPRINT(
"Invalid manager handle\n");
3346 if (lpService ==
NULL)
3348 DPRINT(
"Could not find service\n");
3391 DPRINT(
"RGetServiceKeyNameW() called\n");
3394 DPRINT(
"lpServiceName: %p\n", lpServiceName);
3395 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
3401 DPRINT(
"Invalid manager handle\n");
3408 if (lpService ==
NULL)
3410 DPRINT(
"Could not find service\n");
3418 if (lpServiceName !=
NULL)
3441 int bUpdateImmediately,
3447 if (lpString !=
NULL)
3463 DWORD dwServiceType,
3465 DWORD dwErrorControl,
3466 LPSTR lpBinaryPathName,
3467 LPSTR lpLoadOrderGroup,
3471 LPSTR lpServiceStartName,
3482 DWORD dwDependenciesLength = 0;
3487 if (lpBinaryPathName)
3491 if (!lpBinaryPathNameW)
3499 if (lpLoadOrderGroup)
3503 if (!lpLoadOrderGroupW)
3513 lpStr = (
LPCSTR)lpDependencies;
3516 cchLength =
strlen(lpStr) + 1;
3517 dwDependenciesLength += (
DWORD)cchLength;
3518 lpStr = lpStr + cchLength;
3520 dwDependenciesLength++;
3523 if (!lpDependenciesW)
3531 if (lpServiceStartName)
3535 if (!lpServiceStartNameW)
3547 if (!lpDisplayNameW)
3563 dwDependenciesLength,
3564 lpServiceStartNameW,
3570 if (lpBinaryPathNameW !=
NULL)
3573 if (lpLoadOrderGroupW !=
NULL)
3576 if (lpDependenciesW !=
NULL)
3579 if (lpServiceStartNameW !=
NULL)
3582 if (lpDisplayNameW !=
NULL)
3594 LPSTR lpServiceName,
3596 DWORD dwDesiredAccess,
3597 DWORD dwServiceType,
3599 DWORD dwErrorControl,
3600 LPSTR lpBinaryPathName,
3601 LPSTR lpLoadOrderGroup,
3605 LPSTR lpServiceStartName,
3617 DWORD dwDependenciesLength = 0;
3626 if (!lpServiceNameW)
3638 if (!lpDisplayNameW)
3646 if (lpBinaryPathName)
3650 if (!lpBinaryPathNameW)
3658 if (lpLoadOrderGroup)
3662 if (!lpLoadOrderGroupW)
3672 lpStr = (
LPCSTR)lpDependencies;
3675 cchLength =
strlen(lpStr) + 1;
3676 dwDependenciesLength += (
DWORD)cchLength;
3677 lpStr = lpStr + cchLength;
3679 dwDependenciesLength++;
3682 if (!lpDependenciesW)
3690 if (lpServiceStartName)
3694 if (!lpServiceStartNameW)
3713 dwDependenciesLength,
3714 lpServiceStartNameW,
3720 if (lpServiceNameW !=
NULL)
3723 if (lpDisplayNameW !=
NULL)
3726 if (lpBinaryPathNameW !=
NULL)
3729 if (lpLoadOrderGroupW !=
NULL)
3732 if (lpDependenciesW !=
NULL)
3735 if (lpServiceStartNameW !=
NULL)
3747 DWORD dwServiceState,
3754 DWORD dwServicesReturned = 0;
3755 DWORD dwServiceCount;
3764 *lpServicesReturned = 0;
3766 DPRINT(
"REnumDependentServicesA() called\n");
3771 DPRINT1(
"Invalid service handle\n");
3781 DPRINT(
"Insufficient access rights! 0x%lx\n",
3788 L"System\\CurrentControlSet\\Services",
3806 &dwServicesReturned);
3820 (dwServicesReturned + 1) *
sizeof(
PSERVICE));
3821 if (!lpServicesArray)
3823 DPRINT(
"Could not allocate buffer\n");
3828 dwServicesReturned = 0;
3836 &dwServicesReturned);
3846 for (dwServiceCount = 0; dwServiceCount < dwServicesReturned; dwServiceCount++)
3848 lpService = lpServicesArray[dwServiceCount];
3865 lpStr +=
strlen(lpStr) + 1;
3877 lpStr +=
strlen(lpStr) + 1;
3882 *lpServicesReturned = dwServicesReturned;
3885 if (lpServicesArray)
3890 DPRINT(
"REnumDependentServicesA() done (Error %lu)\n", dwError);
3901 DWORD dwServiceType,
3902 DWORD dwServiceState,
3915 DWORD dwServiceCount;
3917 DPRINT(
"REnumServicesStatusA() called\n");
3929 DPRINT(
"Failed to allocate buffer\n");
3944 if (*lpServicesReturned == 0)
3947 lpStatusPtrIncrW = lpStatusPtrW;
3954 for (dwServiceCount = 0; dwServiceCount < *lpServicesReturned; dwServiceCount++)
3962 (
int)
wcslen(lpStringPtrW),
3967 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
3968 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
3976 (
int)
wcslen(lpStringPtrW),
3981 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
3982 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
3997 DPRINT(
"REnumServicesStatusA() done (Error %lu)\n", dwError);
4007 LPSTR lpMachineName,
4008 LPSTR lpDatabaseName,
4009 DWORD dwDesiredAccess,
4016 DPRINT(
"ROpenSCManagerA() called\n");
4046 LPSTR lpServiceName,
4047 DWORD dwDesiredAccess,
4053 DPRINT(
"ROpenServiceA() called\n");
4088 DWORD dwDependenciesLength = 0;
4089 DWORD dwRequiredSize;
4092 DPRINT(
"RQueryServiceConfigA() called\n");
4100 DPRINT1(
"Invalid service handle\n");
4112 if (lpService ==
NULL)
4114 DPRINT(
"lpService == NULL\n");
4137 &lpServiceStartName);
4142 &dwDependenciesLength);
4146 if (lpImagePath !=
NULL)
4147 dwRequiredSize += (
DWORD)(
wcslen(lpImagePath) + 1);
4149 dwRequiredSize += 2 *
sizeof(
CHAR);
4154 dwRequiredSize += 2 *
sizeof(
CHAR);
4157 if (lpDependencies !=
NULL)
4158 dwRequiredSize += dwDependenciesLength;
4160 dwRequiredSize += 2 *
sizeof(
CHAR);
4162 if (lpServiceStartName !=
NULL)
4163 dwRequiredSize += (
DWORD)(
wcslen(lpServiceStartName) + 1);
4165 dwRequiredSize += 2 *
sizeof(
CHAR);
4170 dwRequiredSize += 2 *
sizeof(
CHAR);
4183 lpStr = (
LPSTR)(lpServiceConfig + 1);
4195 (
int)(
wcslen(lpImagePath) + 1),
4224 lpStr += (
strlen(lpStr) + 1);
4232 dwDependenciesLength,
4234 dwDependenciesLength,
4245 lpStr += dwDependenciesLength;
4247 lpStr += (
strlen(lpStr) + 1);
4249 if (lpServiceStartName)
4256 (
int)(
wcslen(lpServiceStartName) + 1),
4266 lpStr += (
strlen(lpStr) + 1);
4294 if (lpImagePath !=
NULL)
4297 if (lpServiceStartName !=
NULL)
4300 if (lpDependencies !=
NULL)
4303 if (hServiceKey !=
NULL)
4306 DPRINT(
"RQueryServiceConfigA() done\n");
4323 DWORD dwRequiredSize;
4331 DPRINT1(
"Invalid service manager handle\n");
4370 DPRINT(
"RStartServiceA() called\n");
4378 DPRINT1(
"Invalid service handle\n");
4390 if (lpService ==
NULL)
4392 DPRINT(
"lpService == NULL\n");
4408 if (lpVector ==
NULL)
4423 if (lpVector[
i] ==
NULL)
4443 if (lpVector !=
NULL)
4447 if (lpVector[
i] !=
NULL)
4472 DPRINT(
"RGetServiceDisplayNameA() called\n");
4474 DPRINT(
"lpServiceName: %s\n", lpServiceName);
4476 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
4482 DPRINT(
"Invalid manager handle\n");
4488 if (lpServiceName !=
NULL)
4494 if (!lpServiceNameW)
4509 if (lpService ==
NULL)
4511 DPRINT(
"Could not find service\n");
4585 LPSTR lpServiceName,
4593 DPRINT(
"RGetServiceKeyNameA() called\n");
4596 DPRINT(
"lpServiceName: %p\n", lpServiceName);
4597 DPRINT(
"*lpcchBuffer: %lu\n", *lpcchBuffer);
4603 DPRINT(
"Invalid manager handle\n");
4614 if (!lpDisplayNameW)
4628 if (lpService ==
NULL)
4630 DPRINT(
"Could not find service\n");
4643 if (lpServiceName !=
NULL &&
4705 DPRINT(
"RI_ScGetCurrentGroupStateW() called\n");
4711 if (hManager ==
NULL)
4713 DPRINT1(
"Invalid service manager handle\n");
4721 DPRINT(
"Insufficient access rights! 0x%lx\n",
4731 if (pServiceGroup ==
NULL)
4744 DPRINT(
"RI_ScGetCurrentGroupStateW() done (Error %lu)\n", dwError);
4755 DWORD dwServiceType,
4756 DWORD dwServiceState,
4770 DWORD dwRequiredSize;
4771 DWORD dwServiceCount;
4773 DWORD dwLastResumeCount = 0;
4777 DPRINT(
"REnumServiceGroupW() called\n");
4783 if (hManager ==
NULL)
4785 DPRINT1(
"Invalid service manager handle\n");
4795 *lpServicesReturned = 0;
4797 if ((dwServiceType == 0) ||
4800 DPRINT(
"Invalid Service Type\n");
4804 if ((dwServiceState == 0) ||
4807 DPRINT(
"Invalid Service State\n");
4815 DPRINT(
"Insufficient access rights! 0x%lx\n",
4821 dwLastResumeCount = *lpResumeIndex;
4827 if (lpService ==
NULL)
4838 ServiceEntry = ServiceEntry->
Flink)
4851 if ((dwState & dwServiceState) == 0)
4856 if (*pszGroupName == 0)
4880 dwRequiredSize +=
dwSize;
4885 DPRINT(
"dwRequiredSize: %lu\n", dwRequiredSize);
4886 DPRINT(
"dwServiceCount: %lu\n", dwServiceCount);
4890 ServiceEntry = ServiceEntry->
Flink)
4903 if ((dwState & dwServiceState) == 0)
4908 if (*pszGroupName == 0)
4928 DPRINT(
"*pcbBytesNeeded: %lu\n", dwRequiredSize);
4931 *lpResumeIndex = dwLastResumeCount;
4933 *lpServicesReturned = dwServiceCount;
4943 ServiceEntry = ServiceEntry->
Flink)
4956 if ((dwState & dwServiceState) == 0)
4961 if (*pszGroupName == 0)
4997 dwRequiredSize +=
dwSize;
5003 if (lpResumeIndex) *lpResumeIndex = 0;
5010 DPRINT(
"REnumServiceGroupW() done (Error %lu)\n", dwError);
5027 DPRINT(
"RChangeServiceConfig2A() called\n");
5028 DPRINT(
"dwInfoLevel = %lu\n",
Info.dwInfoLevel);
5043 lpServiceDescriptionA =
Info.psd;
5045 if (lpServiceDescriptionA &&
5053 if (!lpServiceDescriptionW)
5067 ptr = lpServiceDescriptionW;
5068 InfoW.
psd = lpServiceDescriptionW;
5075 DWORD dwRebootLen = 0;
5076 DWORD dwCommandLen = 0;
5077 DWORD dwActionArrayLen = 0;
5080 lpServiceFailureActionsA =
Info.psfa;
5082 if (lpServiceFailureActionsA)
5095 if (lpServiceFailureActionsA->
lpCommand)
5112 dwActionArrayLen + dwRebootLen + dwCommandLen;
5118 if (!lpServiceFailureActionsW)
5128 if (dwActionArrayLen > 0)
5144 lpStr = (
LPWSTR)((
ULONG_PTR)(lpServiceFailureActionsW + 1) + dwActionArrayLen);
5165 lpStr += dwRebootLen /
sizeof(
WCHAR);
5171 lpServiceFailureActionsW->
lpCommand = lpStr;
5182 ptr = lpServiceFailureActionsW;
5183 InfoW.
psfa = lpServiceFailureActionsW;
5201 DWORD dwRequiredSize = 0;
5206 if (lpFailureActions ==
NULL)
5234 if (lpReadBuffer ==
NULL)
5305 if (lpWriteBuffer ==
NULL)
5335 if (lpFailureActions->
cActions > 0)
5369 DPRINT(
"Delete Reboot Message value\n");
5390 DPRINT(
"Delete Failure Command value\n");
5395 DPRINT(
"Setting Failure Command value %S\n", lpFailureActions->
lpCommand);
5407 if (lpWriteBuffer !=
NULL)
5410 if (lpReadBuffer !=
NULL)
5430 DPRINT(
"RChangeServiceConfig2W() called\n");
5431 DPRINT(
"dwInfoLevel = %lu\n",
Info.dwInfoLevel);
5445 DPRINT(
"Invalid service handle\n");
5467 if (lpService ==
NULL)
5469 DPRINT(
"lpService == NULL\n");
5485 DPRINT(
"Service has already been marked for delete\n");
5502 if (lpServiceDescription !=
NULL &&
5508 DPRINT(
"Delete service description\n");
5537 if (hServiceKey !=
NULL)
5543 DPRINT(
"RChangeServiceConfig2W() done (Error %lu)\n", dwError);
5563 DWORD dwRequiredSize = 0;
5569 DPRINT(
"RQueryServiceConfig2A() called hService %p dwInfoLevel %u, lpBuffer %p cbBufSize %u pcbBytesNeeded %p\n",
5587 DPRINT1(
"Invalid service handle\n");
5599 if (lpService ==
NULL)
5601 DPRINT(
"lpService == NULL\n");
5637 lpStr = (
LPSTR)(lpServiceDescription + 1);
5644 (
int)
wcslen(lpDescriptionW),
5680 &lpFailureCommandW);
5686 if (lpRebootMessageW)
5689 if (lpFailureCommandW)
5690 dwRequiredSize += (
DWORD)((
wcslen(lpFailureCommandW) + 1) *
sizeof(
WCHAR));
5706 (
LPBYTE)lpFailureActions,
5737 lpStr = (
LPSTR)(lpFailureActions + 1);
5743 if (lpRebootMessageW)
5750 (
int)
wcslen(lpRebootMessageW),
5754 lpStr +=
strlen(lpStr) + 1;
5757 if (lpFailureCommandW)
5764 (
int)
wcslen(lpFailureCommandW),
5778 if (lpDescriptionW !=
NULL)
5781 if (lpRebootMessageW !=
NULL)
5784 if (lpFailureCommandW !=
NULL)
5787 if (hServiceKey !=
NULL)
5790 DPRINT(
"RQueryServiceConfig2A() done (Error %lu)\n", dwError);
5810 DWORD dwRequiredSize = 0;
5816 DPRINT(
"RQueryServiceConfig2W() called\n");
5833 DPRINT1(
"Invalid service handle\n");
5845 if (lpService ==
NULL)
5847 DPRINT(
"lpService == NULL\n");
5883 lpStr = (
LPWSTR)(lpServiceDescription + 1);
5884 wcscpy(lpStr, lpDescription);
5924 if (lpRebootMessage)
5927 if (lpFailureCommand)
5944 (
LPBYTE)lpFailureActions,
5975 lpStr = (
LPWSTR)(lpFailureActions + 1);
5981 if (lpRebootMessage)
5983 wcscpy(lpStr, lpRebootMessage);
5985 lpStr +=
wcslen(lpStr) + 1;
5988 if (lpFailureCommand)
5990 wcscpy(lpStr, lpFailureCommand);
6002 if (lpDescription !=
NULL)
6005 if (lpRebootMessage !=
NULL)
6008 if (lpFailureCommand !=
NULL)
6011 if (hServiceKey !=
NULL)
6014 DPRINT(
"RQueryServiceConfig2W() done (Error %lu)\n", dwError);
6034 DPRINT(
"RQueryServiceStatusEx() called\n");
6050 DPRINT1(
"Invalid service handle\n");
6062 if (lpService ==
NULL)
6064 DPRINT(
"lpService == NULL\n");
6099 DWORD dwServiceType,
6100 DWORD dwServiceState,
6115 DWORD dwServiceCount;
6117 DPRINT(
"REnumServicesStatusExA() called\n");
6129 DPRINT(
"Failed to allocate buffer\n");
6139 (
int)(
strlen(pszGroupName) + 1));
6147 DPRINT(
"Failed to allocate buffer\n");
6165 if (*lpServicesReturned == 0)
6168 lpStatusPtrIncrW = lpStatusPtrW;
6175 for (dwServiceCount = 0; dwServiceCount < *lpServicesReturned; dwServiceCount++)
6183 (
int)
wcslen(lpStringPtrW),
6188 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
6189 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
6197 (
int)
wcslen(lpStringPtrW),
6202 lpStringPtrA +=
wcslen(lpStringPtrW) + 1;
6203 lpStringPtrW +=
wcslen(lpStringPtrW) + 1;
6226 DPRINT(
"REnumServicesStatusExA() done (Error %lu)\n", dwError);
6238 DWORD dwServiceType,
6239 DWORD dwServiceState,
6253 DWORD dwRequiredSize;
6254 DWORD dwServiceCount;
6256 DWORD dwLastResumeCount = 0;
6260 DPRINT(
"REnumServicesStatusExW() called\n");
6269 if (hManager ==
NULL)
6271 DPRINT1(
"Invalid service manager handle\n");
6281 *lpServicesReturned = 0;
6283 if ((dwServiceType == 0) ||
6286 DPRINT(
"Invalid Service Type\n");
6290 if ((dwServiceState == 0) ||
6293 DPRINT(
"Invalid Service State\n");
6301 DPRINT(
"Insufficient access rights 0x%lx\n",
6307 dwLastResumeCount = *lpResumeIndex;
6313 if (lpService ==
NULL)
6324 ServiceEntry = ServiceEntry->
Flink)
6337 if ((dwState & dwServiceState) == 0)
6342 if (*pszGroupName == 0)
6362 dwRequiredSize +=
dwSize;
6374 DPRINT(
"dwRequiredSize: %lu\n", dwRequiredSize);
6375 DPRINT(
"dwServiceCount: %lu\n", dwServiceCount);
6379 ServiceEntry = ServiceEntry->
Flink)
6392 if ((dwState & dwServiceState) == 0)
6397 if (*pszGroupName == 0)
6417 DPRINT(
"*pcbBytesNeeded: %lu\n", dwRequiredSize);
6420 *lpResumeIndex = dwLastResumeCount;
6422 *lpServicesReturned = dwServiceCount;
6439 ServiceEntry = ServiceEntry->
Flink)
6452 if ((dwState & dwServiceState) == 0)
6457 if (*pszGroupName == 0)
6502 dwRequiredSize +=
dwSize;
6521 DPRINT(
"REnumServicesStatusExW() done (Error %lu)\n", dwError);
6543 LPSTR lpServiceName,
6545 DWORD dwDesiredAccess,
6546 DWORD dwServiceType,
6548 DWORD dwErrorControl,
6549 LPSTR lpBinaryPathName,
6550 LPSTR lpLoadOrderGroup,
6554 LPSTR lpServiceStartName,
6571 DWORD dwDesiredAccess,
6572 DWORD dwServiceType,
6574 DWORD dwErrorControl,
6580 LPWSTR lpServiceStartName,
6603 if (hManager ==
NULL)
6618 if (lpInParams ==
NULL || lpOutParams ==
NULL)
6640 GUID *pClientProcessGuid,
6641 GUID *pSCMProcessGuid,
6642 PBOOL pfCreateRemoteQueue,
6722 DPRINT(
"RI_ScValidatePnPService(%p %S %p)\n",
hSCManager, pszServiceName, phServiceStatus);
6726 if (hManager ==
NULL)
6738 DPRINT1(
"No SC_MANAGER_CONNECT access!\n");
6743 DPRINT(
"pService: %p\n", pService);
6744 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 ScmDeleteRegKey(_In_ HKEY hKey, _In_ PCWSTR pszSubKey)
DWORD ScmCreateServiceKey(LPCWSTR lpServiceName, REGSAM samDesired, PHKEY phKey)
PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount)
VOID ScmRemoveServiceImage(PSERVICE_IMAGE pServiceImage)
VOID ScmUnlockDatabase(VOID)
DWORD ScmControlService(HANDLE hControlPipe, PWSTR pServiceName, SERVICE_STATUS_HANDLE hServiceStatus, DWORD dwControl)
DWORD ScmGenerateServiceTag(PSERVICE lpServiceRecord)
DWORD ScmGetServiceNameFromTag(IN PTAG_INFO_NAME_FROM_TAG_IN_PARAMS InParams, OUT PTAG_INFO_NAME_FROM_TAG_OUT_PARAMS *OutParams)
VOID ScmDeleteServiceRecord(PSERVICE lpService)
BOOL ScmLockDatabaseExclusive(VOID)
DWORD ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv)
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)
static DWORD Int_EnumDependentServicesW(HKEY hServicesKey, PSERVICE lpService, DWORD dwServiceState, PSERVICE *lpServices, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned)
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)
DWORD WINAPI RCloseNotifyHandle(LPSC_NOTIFY_RPC_HANDLE phNotify, PBOOL pfApcFired)
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)
_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)
#define EXCEPTION_EXECUTE_HANDLER
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#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)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_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()