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
;
289 int len
= MultiByteToWideChar(CP_ACP
, 0, lpServiceName
, -1, NULL
, 0);
290 lpServiceNameW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
293 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
296 MultiByteToWideChar(CP_ACP
, 0, lpServiceName
, -1, lpServiceNameW
, len
);
298 len
= MultiByteToWideChar(CP_ACP
, 0, lpDisplayName
, -1, NULL
, 0);
299 lpDisplayNameW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
302 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
305 MultiByteToWideChar(CP_ACP
, 0, lpDisplayName
, -1, lpDisplayNameW
, len
);
307 len
= MultiByteToWideChar(CP_ACP
, 0, lpBinaryPathName
, -1, NULL
, 0);
308 lpBinaryPathNameW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
309 if (!lpBinaryPathNameW
)
311 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
314 MultiByteToWideChar(CP_ACP
, 0, lpDisplayName
, -1, lpBinaryPathNameW
, len
);
316 len
= MultiByteToWideChar(CP_ACP
, 0, lpLoadOrderGroup
, -1, NULL
, 0);
317 lpLoadOrderGroupW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
318 if (!lpLoadOrderGroupW
)
320 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
323 MultiByteToWideChar(CP_ACP
, 0, lpLoadOrderGroup
, -1, lpLoadOrderGroupW
, len
);
325 len
= MultiByteToWideChar(CP_ACP
, 0, lpDependencies
, -1, NULL
, 0);
326 lpDependenciesW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
327 if (!lpDependenciesW
)
329 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
332 MultiByteToWideChar(CP_ACP
, 0, lpDependencies
, -1, lpDependenciesW
, len
);
334 len
= MultiByteToWideChar(CP_ACP
, 0, lpServiceStartName
, -1, NULL
, 0);
335 lpServiceStartName
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
336 if (!lpServiceStartNameW
)
338 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
341 MultiByteToWideChar(CP_ACP
, 0, lpServiceStartName
, -1, lpServiceStartNameW
, len
);
343 len
= MultiByteToWideChar(CP_ACP
, 0, lpPassword
, -1, NULL
, 0);
344 lpPasswordW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
347 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
350 MultiByteToWideChar(CP_ACP
, 0, lpPassword
, -1, lpPasswordW
, len
);
352 RetVal
= CreateServiceW(hSCManager
,
368 if (!lpServiceNameW
) HeapFree(GetProcessHeap(), 0, lpServiceNameW
);
369 if (!lpDisplayNameW
) HeapFree(GetProcessHeap(), 0, lpDisplayNameW
);
370 if (!lpBinaryPathNameW
) HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW
);
371 if (!lpLoadOrderGroupW
) HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW
);
372 if (!lpDependenciesW
) HeapFree(GetProcessHeap(), 0, lpDependenciesW
);
373 if (!lpServiceStartNameW
) HeapFree(GetProcessHeap(), 0, lpServiceStartNameW
);
374 if (!lpPasswordW
) HeapFree(GetProcessHeap(), 0, lpPasswordW
);
380 /**********************************************************************
386 CreateServiceW(SC_HANDLE hSCManager
,
387 LPCWSTR lpServiceName
,
388 LPCWSTR lpDisplayName
,
389 DWORD dwDesiredAccess
,
392 DWORD dwErrorControl
,
393 LPCWSTR lpBinaryPathName
,
394 LPCWSTR lpLoadOrderGroup
,
396 LPCWSTR lpDependencies
,
397 LPCWSTR lpServiceStartName
,
400 SC_HANDLE hService
= NULL
;
402 DWORD dwDependenciesLength
= 0;
406 DPRINT1("CreateServiceW() called\n");
408 /* Calculate the Dependencies length*/
409 if (lpDependencies
!= NULL
)
411 lpStr
= (LPWSTR
)lpDependencies
;
414 dwLength
= wcslen(lpStr
) + 1;
415 dwDependenciesLength
+= dwLength
;
416 lpStr
= lpStr
+ dwLength
;
418 dwDependenciesLength
++;
421 /* FIXME: Encrypt the password */
425 /* Call to services.exe using RPC */
426 dwError
= ScmrCreateServiceW(BindingHandle
,
427 (unsigned int)hSCManager
,
428 (LPWSTR
)lpServiceName
,
429 (LPWSTR
)lpDisplayName
,
434 (LPWSTR
)lpBinaryPathName
,
435 (LPWSTR
)lpLoadOrderGroup
,
437 (LPWSTR
)lpDependencies
,
438 dwDependenciesLength
,
439 (LPWSTR
)lpServiceStartName
,
440 NULL
, /* FIXME: lpPassword */
441 0, /* FIXME: dwPasswordLength */
442 (unsigned int *)&hService
);
443 if (dwError
!= ERROR_SUCCESS
)
445 DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError
);
446 SetLastError(dwError
);
447 return INVALID_HANDLE_VALUE
;
454 /**********************************************************************
460 DeleteService(SC_HANDLE hService
)
464 DPRINT("DeleteService(%x)\n", hService
);
468 /* Call to services.exe using RPC */
469 dwError
= ScmrDeleteService(BindingHandle
,
470 (unsigned int)hService
);
471 if (dwError
!= ERROR_SUCCESS
)
473 DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError
);
474 SetLastError(dwError
);
482 /**********************************************************************
483 * EnumDependentServicesA
489 EnumDependentServicesA(
491 DWORD dwServiceState
,
492 LPENUM_SERVICE_STATUSA lpServices
,
494 LPDWORD pcbBytesNeeded
,
495 LPDWORD lpServicesReturned
)
497 DPRINT1("EnumDependentServicesA is unimplemented\n");
498 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
503 /**********************************************************************
504 * EnumDependentServicesW
510 EnumDependentServicesW(
512 DWORD dwServiceState
,
513 LPENUM_SERVICE_STATUSW lpServices
,
515 LPDWORD pcbBytesNeeded
,
516 LPDWORD lpServicesReturned
)
518 DPRINT1("EnumDependentServicesW is unimplemented\n");
519 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
524 /**********************************************************************
542 DPRINT1("EnumServiceGroupW is unimplemented\n");
543 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
548 /**********************************************************************
549 * EnumServicesStatusA
555 EnumServicesStatusA (
556 SC_HANDLE hSCManager
,
558 DWORD dwServiceState
,
559 LPENUM_SERVICE_STATUSA lpServices
,
561 LPDWORD pcbBytesNeeded
,
562 LPDWORD lpServicesReturned
,
563 LPDWORD lpResumeHandle
)
565 DPRINT1("EnumServicesStatusA is unimplemented\n");
566 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
571 /**********************************************************************
572 * EnumServicesStatusExA
578 EnumServicesStatusExA(SC_HANDLE hSCManager
,
579 SC_ENUM_TYPE InfoLevel
,
581 DWORD dwServiceState
,
584 LPDWORD pcbBytesNeeded
,
585 LPDWORD lpServicesReturned
,
586 LPDWORD lpResumeHandle
,
589 DPRINT1("EnumServicesStatusExA is unimplemented\n");
590 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
595 /**********************************************************************
596 * EnumServicesStatusExW
602 EnumServicesStatusExW(SC_HANDLE hSCManager
,
603 SC_ENUM_TYPE InfoLevel
,
605 DWORD dwServiceState
,
608 LPDWORD pcbBytesNeeded
,
609 LPDWORD lpServicesReturned
,
610 LPDWORD lpResumeHandle
,
611 LPCWSTR pszGroupName
)
613 DPRINT1("EnumServicesStatusExW is unimplemented\n");
614 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
619 /**********************************************************************
620 * EnumServicesStatusW
627 SC_HANDLE hSCManager
,
629 DWORD dwServiceState
,
630 LPENUM_SERVICE_STATUSW lpServices
,
632 LPDWORD pcbBytesNeeded
,
633 LPDWORD lpServicesReturned
,
634 LPDWORD lpResumeHandle
)
636 DPRINT1("EnumServicesStatusW is unimplemented\n");
637 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
642 /**********************************************************************
643 * GetServiceDisplayNameA
649 GetServiceDisplayNameA(
650 SC_HANDLE hSCManager
,
651 LPCSTR lpServiceName
,
655 DPRINT1("GetServiceDisplayNameA is unimplemented\n");
656 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
661 /**********************************************************************
662 * GetServiceDisplayNameW
667 GetServiceDisplayNameW(SC_HANDLE hSCManager
,
668 LPCWSTR lpServiceName
,
669 LPWSTR lpDisplayName
,
674 DPRINT("GetServiceDisplayNameW() called\n");
678 dwError
= ScmrGetServiceDisplayNameW(BindingHandle
,
679 (unsigned int)hSCManager
,
680 (LPWSTR
)lpServiceName
,
683 if (dwError
!= ERROR_SUCCESS
)
685 DPRINT1("ScmrGetServiceDisplayNameW() failed (Error %lu)\n", dwError
);
686 SetLastError(dwError
);
696 /**********************************************************************
704 SC_HANDLE hSCManager
,
705 LPCSTR lpDisplayName
,
709 DPRINT1("GetServiceKeyNameA is unimplemented\n");
710 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
715 /**********************************************************************
721 GetServiceKeyNameW(SC_HANDLE hSCManager
,
722 LPCWSTR lpDisplayName
,
723 LPWSTR lpServiceName
,
728 DPRINT("GetServiceKeyNameW() called\n");
732 dwError
= ScmrGetServiceKeyNameW(BindingHandle
,
733 (unsigned int)hSCManager
,
734 (LPWSTR
)lpDisplayName
,
737 if (dwError
!= ERROR_SUCCESS
)
739 DPRINT1("ScmrGetServiceKeyNameW() failed (Error %lu)\n", dwError
);
740 SetLastError(dwError
);
750 /**********************************************************************
751 * LockServiceDatabase
756 LockServiceDatabase(SC_HANDLE hSCManager
)
761 DPRINT("LockServiceDatabase(%x)\n", hSCManager
);
765 /* Call to services.exe using RPC */
766 dwError
= ScmrLockServiceDatabase(BindingHandle
,
767 (unsigned int)hSCManager
,
768 (unsigned int *)&hLock
);
769 if (dwError
!= ERROR_SUCCESS
)
771 DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError
);
772 SetLastError(dwError
);
776 DPRINT("hLock = %p\n", hLock
);
783 WaitForSCManager(VOID
)
787 DPRINT("WaitForSCManager() called\n");
789 /* Try to open the existing event */
790 hEvent
= OpenEventW(SYNCHRONIZE
,
792 L
"SvcctrlStartEvent_A3725DX");
795 if (GetLastError() != ERROR_FILE_NOT_FOUND
)
798 /* Try to create a new event */
799 hEvent
= CreateEventW(NULL
,
802 L
"SvcctrlStartEvent_A3725DX");
805 /* Try to open the existing event again */
806 hEvent
= OpenEventW(SYNCHRONIZE
,
808 L
"SvcctrlStartEvent_A3725DX");
814 /* Wait for 3 minutes */
815 WaitForSingleObject(hEvent
, 180000);
818 DPRINT("ScmWaitForSCManager() done\n");
822 /**********************************************************************
828 OpenSCManagerA(LPCSTR lpMachineName
,
829 LPCSTR lpDatabaseName
,
830 DWORD dwDesiredAccess
)
832 SC_HANDLE hScm
= NULL
;
835 DPRINT("OpenSCManagerA(%s, %s, %lx)\n",
836 lpMachineName
, lpDatabaseName
, dwDesiredAccess
);
842 /* Call to services.exe using RPC */
843 dwError
= ScmrOpenSCManagerA(BindingHandle
,
844 (LPSTR
)lpMachineName
,
845 (LPSTR
)lpDatabaseName
,
847 (unsigned int*)&hScm
);
848 if (dwError
!= ERROR_SUCCESS
)
850 DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError
);
851 SetLastError(dwError
);
855 DPRINT("hScm = %p\n", hScm
);
861 /**********************************************************************
867 OpenSCManagerW(LPCWSTR lpMachineName
,
868 LPCWSTR lpDatabaseName
,
869 DWORD dwDesiredAccess
)
871 SC_HANDLE hScm
= NULL
;
874 DPRINT("OpenSCManagerW(%S, %S, %lx)\n",
875 lpMachineName
, lpDatabaseName
, dwDesiredAccess
);
881 /* Call to services.exe using RPC */
882 dwError
= ScmrOpenSCManagerW(BindingHandle
,
883 (LPWSTR
)lpMachineName
,
884 (LPWSTR
)lpDatabaseName
,
886 (unsigned int*)&hScm
);
887 if (dwError
!= ERROR_SUCCESS
)
889 DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError
);
890 SetLastError(dwError
);
894 DPRINT("hScm = %p\n", hScm
);
900 /**********************************************************************
906 OpenServiceA(SC_HANDLE hSCManager
,
907 LPCSTR lpServiceName
,
908 DWORD dwDesiredAccess
)
910 SC_HANDLE hService
= NULL
;
913 DPRINT("OpenServiceA(%p, %s, %lx)\n",
914 hSCManager
, lpServiceName
, dwDesiredAccess
);
918 /* Call to services.exe using RPC */
919 dwError
= ScmrOpenServiceA(BindingHandle
,
920 (unsigned int)hSCManager
,
921 (LPSTR
)lpServiceName
,
923 (unsigned int*)&hService
);
924 if (dwError
!= ERROR_SUCCESS
)
926 DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError
);
927 SetLastError(dwError
);
931 DPRINT("hService = %p\n", hService
);
937 /**********************************************************************
943 OpenServiceW(SC_HANDLE hSCManager
,
944 LPCWSTR lpServiceName
,
945 DWORD dwDesiredAccess
)
947 SC_HANDLE hService
= NULL
;
950 DPRINT("OpenServiceW(%p, %S, %lx)\n",
951 hSCManager
, lpServiceName
, dwDesiredAccess
);
955 /* Call to services.exe using RPC */
956 dwError
= ScmrOpenServiceW(BindingHandle
,
957 (unsigned int)hSCManager
,
958 (LPWSTR
)lpServiceName
,
960 (unsigned int*)&hService
);
961 if (dwError
!= ERROR_SUCCESS
)
963 DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError
);
964 SetLastError(dwError
);
968 DPRINT("hService = %p\n", hService
);
974 /**********************************************************************
975 * QueryServiceConfigA
983 LPQUERY_SERVICE_CONFIGA lpServiceConfig
,
985 LPDWORD pcbBytesNeeded
)
987 DPRINT1("QueryServiceConfigA is unimplemented\n");
988 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
993 /**********************************************************************
994 * QueryServiceConfigW
1000 QueryServiceConfigW(
1002 LPQUERY_SERVICE_CONFIGW lpServiceConfig
,
1004 LPDWORD pcbBytesNeeded
)
1006 DPRINT1("QueryServiceConfigW is unimplemented\n");
1007 if (lpServiceConfig
&& cbBufSize
>= sizeof(QUERY_SERVICE_CONFIGW
))
1009 memset(lpServiceConfig
, 0, *pcbBytesNeeded
);
1014 *pcbBytesNeeded
= sizeof(QUERY_SERVICE_CONFIGW
);
1015 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
1021 /**********************************************************************
1022 * QueryServiceLockStatusA
1028 QueryServiceLockStatusA(
1029 SC_HANDLE hSCManager
,
1030 LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus
,
1032 LPDWORD pcbBytesNeeded
)
1034 DPRINT1("QueryServiceLockStatusA is unimplemented\n");
1035 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1040 /**********************************************************************
1041 * QueryServiceLockStatusW
1047 QueryServiceLockStatusW(
1048 SC_HANDLE hSCManager
,
1049 LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus
,
1051 LPDWORD pcbBytesNeeded
)
1053 DPRINT1("QueryServiceLockStatusW is unimplemented\n");
1054 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1059 /**********************************************************************
1060 * QueryServiceObjectSecurity
1066 QueryServiceObjectSecurity(
1068 SECURITY_INFORMATION dwSecurityInformation
,
1069 PSECURITY_DESCRIPTOR lpSecurityDescriptor
,
1071 LPDWORD pcbBytesNeeded
)
1073 DPRINT1("QueryServiceObjectSecurity is unimplemented\n");
1074 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1079 /**********************************************************************
1080 * QueryServiceStatus
1085 QueryServiceStatus(SC_HANDLE hService
,
1086 LPSERVICE_STATUS lpServiceStatus
)
1090 DPRINT("QueryServiceStatus(%p, %p)\n",
1091 hService
, lpServiceStatus
);
1095 /* Call to services.exe using RPC */
1096 dwError
= ScmrQueryServiceStatus(BindingHandle
,
1097 (unsigned int)hService
,
1099 if (dwError
!= ERROR_SUCCESS
)
1101 DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError
);
1102 SetLastError(dwError
);
1110 /**********************************************************************
1111 * QueryServiceStatusEx
1117 QueryServiceStatusEx(SC_HANDLE hService
,
1118 SC_STATUS_TYPE InfoLevel
,
1121 LPDWORD pcbBytesNeeded
)
1123 DPRINT1("QueryServiceStatusEx is unimplemented\n");
1124 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1129 /**********************************************************************
1138 DWORD dwNumServiceArgs
,
1139 LPCSTR
*lpServiceArgVectors
)
1141 DPRINT1("StartServiceA is unimplemented\n");
1142 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1147 /**********************************************************************
1156 DWORD dwNumServiceArgs
,
1157 LPCWSTR
*lpServiceArgVectors
)
1159 DPRINT1("StartServiceW is unimplemented, but returns success...\n");
1160 //SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1166 /**********************************************************************
1167 * UnlockServiceDatabase
1172 UnlockServiceDatabase(SC_LOCK ScLock
)
1176 DPRINT("UnlockServiceDatabase(%x)\n", ScLock
);
1180 /* Call to services.exe using RPC */
1181 dwError
= ScmrUnlockServiceDatabase(BindingHandle
,
1182 (unsigned int)ScLock
);
1183 if (dwError
!= ERROR_SUCCESS
)
1185 DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError
);
1186 SetLastError(dwError
);
1194 /**********************************************************************
1195 * NotifyBootConfigStatus
1200 NotifyBootConfigStatus(BOOL BootAcceptable
)
1204 DPRINT1("NotifyBootConfigStatus()\n");
1208 /* Call to services.exe using RPC */
1209 dwError
= ScmrNotifyBootConfigStatus(BindingHandle
,
1211 if (dwError
!= ERROR_SUCCESS
)
1213 DPRINT1("NotifyBootConfigStatus() failed (Error %lu)\n", dwError
);
1214 SetLastError(dwError
);
1222 void __RPC_FAR
* __RPC_USER
midl_user_allocate(size_t len
)
1224 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
1228 void __RPC_USER
midl_user_free(void __RPC_FAR
* ptr
)
1230 HeapFree(GetProcessHeap(), 0, ptr
);