2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/advapi32/service/scm.c
5 * PURPOSE: Service control manager functions
6 * PROGRAMMER: Emanuele Aliberti
13 /* INCLUDES ******************************************************************/
21 /* FUNCTIONS *****************************************************************/
23 handle_t BindingHandle
= NULL
;
28 LPWSTR pszStringBinding
;
31 if (BindingHandle
!= NULL
)
34 status
= RpcStringBindingComposeW(NULL
,
42 DPRINT1("RpcStringBindingCompose returned 0x%x\n", status
);
46 /* Set the binding handle that will be used to bind to the server. */
47 status
= RpcBindingFromStringBindingW(pszStringBinding
,
51 DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", status
);
54 status
= RpcStringFreeW(&pszStringBinding
);
57 DPRINT1("RpcStringFree returned 0x%x\n", status
);
68 if (BindingHandle
== NULL
)
71 status
= RpcBindingFree(&BindingHandle
);
74 DPRINT1("RpcBindingFree returned 0x%x\n", status
);
80 /**********************************************************************
81 * ChangeServiceConfigA
92 LPCSTR lpBinaryPathName
,
93 LPCSTR lpLoadOrderGroup
,
95 LPCSTR lpDependencies
,
96 LPCSTR lpServiceStartName
,
100 DPRINT1("ChangeServiceConfigA is unimplemented\n");
101 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
106 /**********************************************************************
107 * ChangeServiceConfigW
112 ChangeServiceConfigW(SC_HANDLE hService
,
115 DWORD dwErrorControl
,
116 LPCWSTR lpBinaryPathName
,
117 LPCWSTR lpLoadOrderGroup
,
119 LPCWSTR lpDependencies
,
120 LPCWSTR lpServiceStartName
,
122 LPCWSTR lpDisplayName
)
125 DWORD dwDependenciesLength
= 0;
129 DPRINT("ChangeServiceConfigW() called\n");
131 /* Calculate the Dependencies length*/
132 if (lpDependencies
!= NULL
)
134 lpStr
= (LPWSTR
)lpDependencies
;
137 dwLength
= wcslen(lpStr
) + 1;
138 dwDependenciesLength
+= dwLength
;
139 lpStr
= lpStr
+ dwLength
;
141 dwDependenciesLength
++;
144 /* FIXME: Encrypt the password */
148 /* Call to services.exe using RPC */
149 dwError
= ScmrChangeServiceConfigW(BindingHandle
,
150 (unsigned int)hService
,
154 (LPWSTR
)lpBinaryPathName
,
155 (LPWSTR
)lpLoadOrderGroup
,
157 (LPWSTR
)lpDependencies
,
158 dwDependenciesLength
,
159 (LPWSTR
)lpServiceStartName
,
160 NULL
, /* FIXME: lpPassword */
161 0, /* FIXME: dwPasswordLength */
162 (LPWSTR
)lpDisplayName
);
163 if (dwError
!= ERROR_SUCCESS
)
165 DPRINT1("ScmrChangeServiceConfigW() failed (Error %lu)\n", dwError
);
166 SetLastError(dwError
);
174 /**********************************************************************
180 CloseServiceHandle(SC_HANDLE hSCObject
)
184 DPRINT("CloseServiceHandle() called\n");
188 /* Call to services.exe using RPC */
189 dwError
= ScmrCloseServiceHandle(BindingHandle
,
190 (unsigned int)hSCObject
);
193 DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError
);
194 SetLastError(dwError
);
198 DPRINT("CloseServiceHandle() done\n");
204 /**********************************************************************
210 ControlService(SC_HANDLE hService
,
212 LPSERVICE_STATUS lpServiceStatus
)
216 DPRINT("ControlService(%x, %x, %p)\n",
217 hService
, dwControl
, lpServiceStatus
);
221 /* Call to services.exe using RPC */
222 dwError
= ScmrControlService(BindingHandle
,
223 (unsigned int)hService
,
226 if (dwError
!= ERROR_SUCCESS
)
228 DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError
);
229 SetLastError(dwError
);
233 DPRINT("ControlService() done\n");
239 /**********************************************************************
245 ControlServiceEx(IN SC_HANDLE hService
,
247 IN DWORD dwInfoLevel
,
248 IN OUT PVOID pControlParams
)
250 DPRINT1("ControlServiceEx(0x%p, 0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n",
251 hService
, dwControl
, dwInfoLevel
, pControlParams
);
252 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
258 /**********************************************************************
266 SC_HANDLE hSCManager
,
267 LPCSTR lpServiceName
,
268 LPCSTR lpDisplayName
,
269 DWORD dwDesiredAccess
,
272 DWORD dwErrorControl
,
273 LPCSTR lpBinaryPathName
,
274 LPCSTR lpLoadOrderGroup
,
276 LPCSTR lpDependencies
,
277 LPCSTR lpServiceStartName
,
280 SC_HANDLE RetVal
= NULL
;
281 LPWSTR lpServiceNameW
= NULL
;
282 LPWSTR lpDisplayNameW
= NULL
;
283 LPWSTR lpBinaryPathNameW
= NULL
;
284 LPWSTR lpLoadOrderGroupW
= NULL
;
285 LPWSTR lpDependenciesW
= NULL
;
286 LPWSTR lpServiceStartNameW
= NULL
;
287 LPWSTR lpPasswordW
= NULL
;
288 DWORD dwDependenciesLength
= 0;
292 int len
= MultiByteToWideChar(CP_ACP
, 0, lpServiceName
, -1, NULL
, 0);
293 lpServiceNameW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
296 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
299 MultiByteToWideChar(CP_ACP
, 0, lpServiceName
, -1, lpServiceNameW
, len
);
301 len
= MultiByteToWideChar(CP_ACP
, 0, lpDisplayName
, -1, NULL
, 0);
302 lpDisplayNameW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
305 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
308 MultiByteToWideChar(CP_ACP
, 0, lpDisplayName
, -1, lpDisplayNameW
, len
);
310 len
= MultiByteToWideChar(CP_ACP
, 0, lpBinaryPathName
, -1, NULL
, 0);
311 lpBinaryPathNameW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
312 if (!lpBinaryPathNameW
)
314 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
317 MultiByteToWideChar(CP_ACP
, 0, lpDisplayName
, -1, lpBinaryPathNameW
, len
);
319 len
= MultiByteToWideChar(CP_ACP
, 0, lpLoadOrderGroup
, -1, NULL
, 0);
320 lpLoadOrderGroupW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
321 if (!lpLoadOrderGroupW
)
323 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
326 MultiByteToWideChar(CP_ACP
, 0, lpLoadOrderGroup
, -1, lpLoadOrderGroupW
, len
);
328 if (lpDependencies
!= NULL
)
330 lpStr
= (LPSTR
)lpDependencies
;
333 dwLength
= strlen(lpStr
) + 1;
334 dwDependenciesLength
+= dwLength
;
335 lpStr
= lpStr
+ dwLength
;
337 dwDependenciesLength
++;
340 lpDependenciesW
= HeapAlloc(GetProcessHeap(), 0, dwDependenciesLength
* sizeof(WCHAR
));
341 if (!lpDependenciesW
)
343 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
346 MultiByteToWideChar(CP_ACP
, 0, lpDependencies
, -1, lpDependenciesW
, dwDependenciesLength
);
348 len
= MultiByteToWideChar(CP_ACP
, 0, lpServiceStartName
, -1, NULL
, 0);
349 lpServiceStartName
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
350 if (!lpServiceStartNameW
)
352 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
355 MultiByteToWideChar(CP_ACP
, 0, lpServiceStartName
, -1, lpServiceStartNameW
, len
);
357 len
= MultiByteToWideChar(CP_ACP
, 0, lpPassword
, -1, NULL
, 0);
358 lpPasswordW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
361 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
364 MultiByteToWideChar(CP_ACP
, 0, lpPassword
, -1, lpPasswordW
, len
);
366 RetVal
= CreateServiceW(hSCManager
,
382 HeapFree(GetProcessHeap(), 0, lpServiceNameW
);
383 HeapFree(GetProcessHeap(), 0, lpDisplayNameW
);
384 HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW
);
385 HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW
);
386 HeapFree(GetProcessHeap(), 0, lpDependenciesW
);
387 HeapFree(GetProcessHeap(), 0, lpServiceStartNameW
);
388 HeapFree(GetProcessHeap(), 0, lpPasswordW
);
394 /**********************************************************************
400 CreateServiceW(SC_HANDLE hSCManager
,
401 LPCWSTR lpServiceName
,
402 LPCWSTR lpDisplayName
,
403 DWORD dwDesiredAccess
,
406 DWORD dwErrorControl
,
407 LPCWSTR lpBinaryPathName
,
408 LPCWSTR lpLoadOrderGroup
,
410 LPCWSTR lpDependencies
,
411 LPCWSTR lpServiceStartName
,
414 SC_HANDLE hService
= NULL
;
416 DWORD dwDependenciesLength
= 0;
420 DPRINT1("CreateServiceW() called\n");
422 /* Calculate the Dependencies length*/
423 if (lpDependencies
!= NULL
)
425 lpStr
= (LPWSTR
)lpDependencies
;
428 dwLength
= wcslen(lpStr
) + 1;
429 dwDependenciesLength
+= dwLength
;
430 lpStr
= lpStr
+ dwLength
;
432 dwDependenciesLength
++;
435 /* FIXME: Encrypt the password */
439 /* Call to services.exe using RPC */
440 dwError
= ScmrCreateServiceW(BindingHandle
,
441 (unsigned int)hSCManager
,
442 (LPWSTR
)lpServiceName
,
443 (LPWSTR
)lpDisplayName
,
448 (LPWSTR
)lpBinaryPathName
,
449 (LPWSTR
)lpLoadOrderGroup
,
451 (LPWSTR
)lpDependencies
,
452 dwDependenciesLength
,
453 (LPWSTR
)lpServiceStartName
,
454 NULL
, /* FIXME: lpPassword */
455 0, /* FIXME: dwPasswordLength */
456 (unsigned int *)&hService
);
457 if (dwError
!= ERROR_SUCCESS
)
459 DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError
);
460 SetLastError(dwError
);
468 /**********************************************************************
474 DeleteService(SC_HANDLE hService
)
478 DPRINT("DeleteService(%x)\n", hService
);
482 /* Call to services.exe using RPC */
483 dwError
= ScmrDeleteService(BindingHandle
,
484 (unsigned int)hService
);
485 if (dwError
!= ERROR_SUCCESS
)
487 DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError
);
488 SetLastError(dwError
);
496 /**********************************************************************
497 * EnumDependentServicesA
503 EnumDependentServicesA(
505 DWORD dwServiceState
,
506 LPENUM_SERVICE_STATUSA lpServices
,
508 LPDWORD pcbBytesNeeded
,
509 LPDWORD lpServicesReturned
)
511 DPRINT1("EnumDependentServicesA is unimplemented\n");
512 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
517 /**********************************************************************
518 * EnumDependentServicesW
524 EnumDependentServicesW(
526 DWORD dwServiceState
,
527 LPENUM_SERVICE_STATUSW lpServices
,
529 LPDWORD pcbBytesNeeded
,
530 LPDWORD lpServicesReturned
)
532 DPRINT1("EnumDependentServicesW is unimplemented\n");
533 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
538 /**********************************************************************
556 DPRINT1("EnumServiceGroupW is unimplemented\n");
557 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
562 /**********************************************************************
563 * EnumServicesStatusA
569 EnumServicesStatusA (
570 SC_HANDLE hSCManager
,
572 DWORD dwServiceState
,
573 LPENUM_SERVICE_STATUSA lpServices
,
575 LPDWORD pcbBytesNeeded
,
576 LPDWORD lpServicesReturned
,
577 LPDWORD lpResumeHandle
)
579 DPRINT1("EnumServicesStatusA is unimplemented\n");
580 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
585 /**********************************************************************
586 * EnumServicesStatusExA
592 EnumServicesStatusExA(SC_HANDLE hSCManager
,
593 SC_ENUM_TYPE InfoLevel
,
595 DWORD dwServiceState
,
598 LPDWORD pcbBytesNeeded
,
599 LPDWORD lpServicesReturned
,
600 LPDWORD lpResumeHandle
,
603 DPRINT1("EnumServicesStatusExA is unimplemented\n");
604 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
609 /**********************************************************************
610 * EnumServicesStatusExW
616 EnumServicesStatusExW(SC_HANDLE hSCManager
,
617 SC_ENUM_TYPE InfoLevel
,
619 DWORD dwServiceState
,
622 LPDWORD pcbBytesNeeded
,
623 LPDWORD lpServicesReturned
,
624 LPDWORD lpResumeHandle
,
625 LPCWSTR pszGroupName
)
627 DPRINT1("EnumServicesStatusExW is unimplemented\n");
628 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
633 /**********************************************************************
634 * EnumServicesStatusW
641 SC_HANDLE hSCManager
,
643 DWORD dwServiceState
,
644 LPENUM_SERVICE_STATUSW lpServices
,
646 LPDWORD pcbBytesNeeded
,
647 LPDWORD lpServicesReturned
,
648 LPDWORD lpResumeHandle
)
650 DPRINT1("EnumServicesStatusW is unimplemented\n");
651 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
656 /**********************************************************************
657 * GetServiceDisplayNameA
663 GetServiceDisplayNameA(
664 SC_HANDLE hSCManager
,
665 LPCSTR lpServiceName
,
669 DPRINT1("GetServiceDisplayNameA is unimplemented\n");
670 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
675 /**********************************************************************
676 * GetServiceDisplayNameW
681 GetServiceDisplayNameW(SC_HANDLE hSCManager
,
682 LPCWSTR lpServiceName
,
683 LPWSTR lpDisplayName
,
688 DPRINT("GetServiceDisplayNameW() called\n");
692 dwError
= ScmrGetServiceDisplayNameW(BindingHandle
,
693 (unsigned int)hSCManager
,
694 (LPWSTR
)lpServiceName
,
697 if (dwError
!= ERROR_SUCCESS
)
699 DPRINT1("ScmrGetServiceDisplayNameW() failed (Error %lu)\n", dwError
);
700 SetLastError(dwError
);
710 /**********************************************************************
718 SC_HANDLE hSCManager
,
719 LPCSTR lpDisplayName
,
723 DPRINT1("GetServiceKeyNameA is unimplemented\n");
724 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
729 /**********************************************************************
735 GetServiceKeyNameW(SC_HANDLE hSCManager
,
736 LPCWSTR lpDisplayName
,
737 LPWSTR lpServiceName
,
742 DPRINT("GetServiceKeyNameW() called\n");
746 dwError
= ScmrGetServiceKeyNameW(BindingHandle
,
747 (unsigned int)hSCManager
,
748 (LPWSTR
)lpDisplayName
,
751 if (dwError
!= ERROR_SUCCESS
)
753 DPRINT1("ScmrGetServiceKeyNameW() failed (Error %lu)\n", dwError
);
754 SetLastError(dwError
);
764 /**********************************************************************
765 * LockServiceDatabase
770 LockServiceDatabase(SC_HANDLE hSCManager
)
775 DPRINT("LockServiceDatabase(%x)\n", hSCManager
);
779 /* Call to services.exe using RPC */
780 dwError
= ScmrLockServiceDatabase(BindingHandle
,
781 (unsigned int)hSCManager
,
782 (unsigned int *)&hLock
);
783 if (dwError
!= ERROR_SUCCESS
)
785 DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError
);
786 SetLastError(dwError
);
790 DPRINT("hLock = %p\n", hLock
);
797 WaitForSCManager(VOID
)
801 DPRINT("WaitForSCManager() called\n");
803 /* Try to open the existing event */
804 hEvent
= OpenEventW(SYNCHRONIZE
,
806 L
"SvcctrlStartEvent_A3725DX");
809 if (GetLastError() != ERROR_FILE_NOT_FOUND
)
812 /* Try to create a new event */
813 hEvent
= CreateEventW(NULL
,
816 L
"SvcctrlStartEvent_A3725DX");
819 /* Try to open the existing event again */
820 hEvent
= OpenEventW(SYNCHRONIZE
,
822 L
"SvcctrlStartEvent_A3725DX");
828 /* Wait for 3 minutes */
829 WaitForSingleObject(hEvent
, 180000);
832 DPRINT("ScmWaitForSCManager() done\n");
836 /**********************************************************************
842 OpenSCManagerA(LPCSTR lpMachineName
,
843 LPCSTR lpDatabaseName
,
844 DWORD dwDesiredAccess
)
846 SC_HANDLE hScm
= NULL
;
849 DPRINT("OpenSCManagerA(%s, %s, %lx)\n",
850 lpMachineName
, lpDatabaseName
, dwDesiredAccess
);
856 /* Call to services.exe using RPC */
857 dwError
= ScmrOpenSCManagerA(BindingHandle
,
858 (LPSTR
)lpMachineName
,
859 (LPSTR
)lpDatabaseName
,
861 (unsigned int*)&hScm
);
862 if (dwError
!= ERROR_SUCCESS
)
864 DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError
);
865 SetLastError(dwError
);
869 DPRINT("hScm = %p\n", hScm
);
875 /**********************************************************************
881 OpenSCManagerW(LPCWSTR lpMachineName
,
882 LPCWSTR lpDatabaseName
,
883 DWORD dwDesiredAccess
)
885 SC_HANDLE hScm
= NULL
;
888 DPRINT("OpenSCManagerW(%S, %S, %lx)\n",
889 lpMachineName
, lpDatabaseName
, dwDesiredAccess
);
895 /* Call to services.exe using RPC */
896 dwError
= ScmrOpenSCManagerW(BindingHandle
,
897 (LPWSTR
)lpMachineName
,
898 (LPWSTR
)lpDatabaseName
,
900 (unsigned int*)&hScm
);
901 if (dwError
!= ERROR_SUCCESS
)
903 DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError
);
904 SetLastError(dwError
);
908 DPRINT("hScm = %p\n", hScm
);
914 /**********************************************************************
920 OpenServiceA(SC_HANDLE hSCManager
,
921 LPCSTR lpServiceName
,
922 DWORD dwDesiredAccess
)
924 SC_HANDLE hService
= NULL
;
927 DPRINT("OpenServiceA(%p, %s, %lx)\n",
928 hSCManager
, lpServiceName
, dwDesiredAccess
);
932 /* Call to services.exe using RPC */
933 dwError
= ScmrOpenServiceA(BindingHandle
,
934 (unsigned int)hSCManager
,
935 (LPSTR
)lpServiceName
,
937 (unsigned int*)&hService
);
938 if (dwError
!= ERROR_SUCCESS
)
940 DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError
);
941 SetLastError(dwError
);
945 DPRINT("hService = %p\n", hService
);
951 /**********************************************************************
957 OpenServiceW(SC_HANDLE hSCManager
,
958 LPCWSTR lpServiceName
,
959 DWORD dwDesiredAccess
)
961 SC_HANDLE hService
= NULL
;
964 DPRINT("OpenServiceW(%p, %S, %lx)\n",
965 hSCManager
, lpServiceName
, dwDesiredAccess
);
969 /* Call to services.exe using RPC */
970 dwError
= ScmrOpenServiceW(BindingHandle
,
971 (unsigned int)hSCManager
,
972 (LPWSTR
)lpServiceName
,
974 (unsigned int*)&hService
);
975 if (dwError
!= ERROR_SUCCESS
)
977 DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError
);
978 SetLastError(dwError
);
982 DPRINT("hService = %p\n", hService
);
988 /**********************************************************************
989 * QueryServiceConfigA
997 LPQUERY_SERVICE_CONFIGA lpServiceConfig
,
999 LPDWORD pcbBytesNeeded
)
1001 DPRINT1("QueryServiceConfigA is unimplemented\n");
1002 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1007 /**********************************************************************
1008 * QueryServiceConfigW
1014 QueryServiceConfigW(
1016 LPQUERY_SERVICE_CONFIGW lpServiceConfig
,
1018 LPDWORD pcbBytesNeeded
)
1020 DPRINT1("QueryServiceConfigW is unimplemented\n");
1021 if (lpServiceConfig
&& cbBufSize
>= sizeof(QUERY_SERVICE_CONFIGW
))
1023 memset(lpServiceConfig
, 0, *pcbBytesNeeded
);
1028 *pcbBytesNeeded
= sizeof(QUERY_SERVICE_CONFIGW
);
1029 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
1034 /**********************************************************************
1035 * QueryServiceConfig2W
1041 QueryServiceConfig2W
1047 LPDWORD pcbBytesNeeded
)
1049 DPRINT1("QueryServiceConfigW2 is unimplemented\n");
1054 /**********************************************************************
1055 * QueryServiceLockStatusA
1061 QueryServiceLockStatusA(
1062 SC_HANDLE hSCManager
,
1063 LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus
,
1065 LPDWORD pcbBytesNeeded
)
1067 DPRINT1("QueryServiceLockStatusA is unimplemented\n");
1068 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1073 /**********************************************************************
1074 * QueryServiceLockStatusW
1080 QueryServiceLockStatusW(
1081 SC_HANDLE hSCManager
,
1082 LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus
,
1084 LPDWORD pcbBytesNeeded
)
1086 DPRINT1("QueryServiceLockStatusW is unimplemented\n");
1087 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1092 /**********************************************************************
1093 * QueryServiceObjectSecurity
1099 QueryServiceObjectSecurity(
1101 SECURITY_INFORMATION dwSecurityInformation
,
1102 PSECURITY_DESCRIPTOR lpSecurityDescriptor
,
1104 LPDWORD pcbBytesNeeded
)
1106 DPRINT1("QueryServiceObjectSecurity is unimplemented\n");
1107 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1112 /**********************************************************************
1113 * QueryServiceStatus
1118 QueryServiceStatus(SC_HANDLE hService
,
1119 LPSERVICE_STATUS lpServiceStatus
)
1123 DPRINT("QueryServiceStatus(%p, %p)\n",
1124 hService
, lpServiceStatus
);
1128 /* Call to services.exe using RPC */
1129 dwError
= ScmrQueryServiceStatus(BindingHandle
,
1130 (unsigned int)hService
,
1132 if (dwError
!= ERROR_SUCCESS
)
1134 DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError
);
1135 SetLastError(dwError
);
1143 /**********************************************************************
1144 * QueryServiceStatusEx
1150 QueryServiceStatusEx(SC_HANDLE hService
,
1151 SC_STATUS_TYPE InfoLevel
,
1154 LPDWORD pcbBytesNeeded
)
1156 DPRINT1("QueryServiceStatusEx is unimplemented\n");
1157 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1162 /**********************************************************************
1171 DWORD dwNumServiceArgs
,
1172 LPCSTR
*lpServiceArgVectors
)
1174 DPRINT1("StartServiceA is unimplemented\n");
1175 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1180 /**********************************************************************
1189 DWORD dwNumServiceArgs
,
1190 LPCWSTR
*lpServiceArgVectors
)
1192 DPRINT1("StartServiceW is unimplemented, but returns success...\n");
1193 //SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1199 /**********************************************************************
1200 * UnlockServiceDatabase
1205 UnlockServiceDatabase(SC_LOCK ScLock
)
1209 DPRINT("UnlockServiceDatabase(%x)\n", ScLock
);
1213 /* Call to services.exe using RPC */
1214 dwError
= ScmrUnlockServiceDatabase(BindingHandle
,
1215 (unsigned int)ScLock
);
1216 if (dwError
!= ERROR_SUCCESS
)
1218 DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError
);
1219 SetLastError(dwError
);
1227 /**********************************************************************
1228 * NotifyBootConfigStatus
1233 NotifyBootConfigStatus(BOOL BootAcceptable
)
1237 DPRINT1("NotifyBootConfigStatus()\n");
1241 /* Call to services.exe using RPC */
1242 dwError
= ScmrNotifyBootConfigStatus(BindingHandle
,
1244 if (dwError
!= ERROR_SUCCESS
)
1246 DPRINT1("NotifyBootConfigStatus() failed (Error %lu)\n", dwError
);
1247 SetLastError(dwError
);
1255 void __RPC_FAR
* __RPC_USER
midl_user_allocate(size_t len
)
1257 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
1261 void __RPC_USER
midl_user_free(void __RPC_FAR
* ptr
)
1263 HeapFree(GetProcessHeap(), 0, ptr
);