First shot at CreateServiceW. It crashes due to a bug (aka missing feature) in widl...
[reactos.git] / reactos / lib / advapi32 / service / scm.c
1 /*
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
7 * Eric Kohl
8 * UPDATE HISTORY:
9 * 19990413 EA created
10 * 19990515 EA
11 */
12
13 /* INCLUDES ******************************************************************/
14
15 #include <advapi32.h>
16 #include "svcctl_c.h"
17
18 #define NDEBUG
19 #include <debug.h>
20
21 /* FUNCTIONS *****************************************************************/
22
23 handle_t BindingHandle = NULL;
24
25 static VOID
26 HandleBind(VOID)
27 {
28 LPWSTR pszStringBinding;
29 RPC_STATUS status;
30
31 if (BindingHandle != NULL)
32 return;
33
34 status = RpcStringBindingComposeW(NULL,
35 L"ncacn_np",
36 NULL,
37 L"\\pipe\\ntsvcs",
38 NULL,
39 &pszStringBinding);
40 if (status)
41 {
42 DPRINT1("RpcStringBindingCompose returned 0x%x\n", status);
43 return;
44 }
45
46 /* Set the binding handle that will be used to bind to the server. */
47 status = RpcBindingFromStringBindingW(pszStringBinding,
48 &BindingHandle);
49 if (status)
50 {
51 DPRINT1("RpcBindingFromStringBinding returned 0x%x\n", status);
52 }
53
54 status = RpcStringFreeW(&pszStringBinding);
55 if (status)
56 {
57 DPRINT1("RpcStringFree returned 0x%x\n", status);
58 }
59 }
60
61
62 #if 0
63 static VOID
64 HandleUnbind(VOID)
65 {
66 RPC_STATUS status;
67
68 if (BindingHandle == NULL)
69 return;
70
71 status = RpcBindingFree(&BindingHandle);
72 if (status)
73 {
74 DPRINT1("RpcBindingFree returned 0x%x\n", status);
75 }
76 }
77 #endif
78
79
80 /**********************************************************************
81 * ChangeServiceConfigA
82 *
83 * @unimplemented
84 */
85 BOOL
86 STDCALL
87 ChangeServiceConfigA(
88 SC_HANDLE hService,
89 DWORD dwServiceType,
90 DWORD dwStartType,
91 DWORD dwErrorControl,
92 LPCSTR lpBinaryPathName,
93 LPCSTR lpLoadOrderGroup,
94 LPDWORD lpdwTagId,
95 LPCSTR lpDependencies,
96 LPCSTR lpServiceStartName,
97 LPCSTR lpPassword,
98 LPCSTR lpDisplayName)
99 {
100 DPRINT1("ChangeServiceConfigA is unimplemented\n");
101 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
102 return FALSE;
103 }
104
105
106 /**********************************************************************
107 * ChangeServiceConfigW
108 *
109 * @unimplemented
110 */
111 BOOL
112 STDCALL
113 ChangeServiceConfigW(
114 SC_HANDLE hService,
115 DWORD dwServiceType,
116 DWORD dwStartType,
117 DWORD dwErrorControl,
118 LPCWSTR lpBinaryPathName,
119 LPCWSTR lpLoadOrderGroup,
120 LPDWORD lpdwTagId,
121 LPCWSTR lpDependencies,
122 LPCWSTR lpServiceStartName,
123 LPCWSTR lpPassword,
124 LPCWSTR lpDisplayName)
125 {
126 DPRINT1("ChangeServiceConfigW is unimplemented\n");
127 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
128 return FALSE;
129 }
130
131
132 /**********************************************************************
133 * CloseServiceHandle
134 *
135 * @implemented
136 */
137 BOOL STDCALL
138 CloseServiceHandle(SC_HANDLE hSCObject)
139 {
140 DWORD dwError;
141
142 DPRINT("CloseServiceHandle() called\n");
143
144 HandleBind();
145
146 /* Call to services.exe using RPC */
147 dwError = ScmrCloseServiceHandle(BindingHandle,
148 (unsigned int)hSCObject);
149 if (dwError)
150 {
151 DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError);
152 SetLastError(dwError);
153 return FALSE;
154 }
155
156 DPRINT("CloseServiceHandle() done\n");
157
158 return TRUE;
159 }
160
161
162 /**********************************************************************
163 * ControlService
164 *
165 * @unimplemented
166 */
167 BOOL STDCALL
168 ControlService(SC_HANDLE hService,
169 DWORD dwControl,
170 LPSERVICE_STATUS lpServiceStatus)
171 {
172 DWORD dwError;
173
174 DPRINT("ControlService(%x, %x, %p)\n",
175 hService, dwControl, lpServiceStatus);
176
177 HandleBind();
178
179 /* Call to services.exe using RPC */
180 dwError = ScmrControlService(BindingHandle,
181 (unsigned int)hService,
182 dwControl,
183 lpServiceStatus);
184 if (dwError != ERROR_SUCCESS)
185 {
186 DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError);
187 SetLastError(dwError);
188 return FALSE;
189 }
190
191 DPRINT("ControlService() done\n");
192
193 return TRUE;
194 }
195
196
197 /**********************************************************************
198 * ControlServiceEx
199 *
200 * @unimplemented
201 */
202 BOOL STDCALL
203 ControlServiceEx(IN SC_HANDLE hService,
204 IN DWORD dwControl,
205 IN DWORD dwInfoLevel,
206 IN OUT PVOID pControlParams)
207 {
208 DPRINT1("ControlServiceEx(0x%p, 0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n",
209 hService, dwControl, dwInfoLevel, pControlParams);
210 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
211 return FALSE;
212 }
213
214
215
216 /**********************************************************************
217 * CreateServiceA
218 *
219 * @unimplemented
220 */
221 SC_HANDLE
222 STDCALL
223 CreateServiceA(
224 SC_HANDLE hSCManager,
225 LPCSTR lpServiceName,
226 LPCSTR lpDisplayName,
227 DWORD dwDesiredAccess,
228 DWORD dwServiceType,
229 DWORD dwStartType,
230 DWORD dwErrorControl,
231 LPCSTR lpBinaryPathName,
232 LPCSTR lpLoadOrderGroup,
233 LPDWORD lpdwTagId,
234 LPCSTR lpDependencies,
235 LPCSTR lpServiceStartName,
236 LPCSTR lpPassword)
237 {
238 DPRINT1("CreateServiceA is unimplemented, but returning INVALID_HANDLE_VALUE instead of NULL\n");
239 return INVALID_HANDLE_VALUE;
240 }
241
242
243 /**********************************************************************
244 * CreateServiceW
245 *
246 * @unimplemented
247 */
248 SC_HANDLE STDCALL
249 CreateServiceW(SC_HANDLE hSCManager,
250 LPCWSTR lpServiceName,
251 LPCWSTR lpDisplayName,
252 DWORD dwDesiredAccess,
253 DWORD dwServiceType,
254 DWORD dwStartType,
255 DWORD dwErrorControl,
256 LPCWSTR lpBinaryPathName,
257 LPCWSTR lpLoadOrderGroup,
258 LPDWORD lpdwTagId,
259 LPCWSTR lpDependencies,
260 LPCWSTR lpServiceStartName,
261 LPCWSTR lpPassword)
262 {
263 SC_HANDLE hService = NULL;
264 DWORD dwError;
265
266 DPRINT1("CreateServiceW() called\n");
267
268 HandleBind();
269
270 /* Call to services.exe using RPC */
271 dwError = ScmrCreateServiceW(BindingHandle,
272 (unsigned int)hSCManager,
273 (LPWSTR)lpServiceName,
274 (LPWSTR)lpDisplayName,
275 dwDesiredAccess,
276 dwServiceType,
277 dwStartType,
278 dwErrorControl,
279 (LPWSTR)lpBinaryPathName,
280 (LPWSTR)lpLoadOrderGroup,
281 lpdwTagId,
282 NULL, /* FIXME: lpDependencies */
283 0, /* FIXME: dwDependenciesLength */
284 (LPWSTR)lpServiceStartName,
285 NULL, /* FIXME: lpPassword */
286 0, /* FIXME: dwPasswordLength */
287 (unsigned int *)&hService);
288 if (dwError != ERROR_SUCCESS)
289 {
290 DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError);
291 SetLastError(dwError);
292 return INVALID_HANDLE_VALUE;
293 }
294
295 return hService;
296 }
297
298
299 /**********************************************************************
300 * DeleteService
301 *
302 * @implemented
303 */
304 BOOL STDCALL
305 DeleteService(SC_HANDLE hService)
306 {
307 DWORD dwError;
308
309 DPRINT("DeleteService(%x)\n", hService);
310
311 HandleBind();
312
313 /* Call to services.exe using RPC */
314 dwError = ScmrDeleteService(BindingHandle,
315 (unsigned int)hService);
316 if (dwError != ERROR_SUCCESS)
317 {
318 DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError);
319 SetLastError(dwError);
320 return FALSE;
321 }
322
323 return TRUE;
324 }
325
326
327 /**********************************************************************
328 * EnumDependentServicesA
329 *
330 * @unimplemented
331 */
332 BOOL
333 STDCALL
334 EnumDependentServicesA(
335 SC_HANDLE hService,
336 DWORD dwServiceState,
337 LPENUM_SERVICE_STATUSA lpServices,
338 DWORD cbBufSize,
339 LPDWORD pcbBytesNeeded,
340 LPDWORD lpServicesReturned)
341 {
342 DPRINT1("EnumDependentServicesA is unimplemented\n");
343 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
344 return FALSE;
345 }
346
347
348 /**********************************************************************
349 * EnumDependentServicesW
350 *
351 * @unimplemented
352 */
353 BOOL
354 STDCALL
355 EnumDependentServicesW(
356 SC_HANDLE hService,
357 DWORD dwServiceState,
358 LPENUM_SERVICE_STATUSW lpServices,
359 DWORD cbBufSize,
360 LPDWORD pcbBytesNeeded,
361 LPDWORD lpServicesReturned)
362 {
363 DPRINT1("EnumDependentServicesW is unimplemented\n");
364 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
365 return FALSE;
366 }
367
368
369 /**********************************************************************
370 * EnumServiceGroupW
371 *
372 * @unimplemented
373 */
374 BOOL
375 STDCALL
376 EnumServiceGroupW (
377 DWORD Unknown0,
378 DWORD Unknown1,
379 DWORD Unknown2,
380 DWORD Unknown3,
381 DWORD Unknown4,
382 DWORD Unknown5,
383 DWORD Unknown6,
384 DWORD Unknown7,
385 DWORD Unknown8)
386 {
387 DPRINT1("EnumServiceGroupW is unimplemented\n");
388 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
389 return FALSE;
390 }
391
392
393 /**********************************************************************
394 * EnumServicesStatusA
395 *
396 * @unimplemented
397 */
398 BOOL
399 STDCALL
400 EnumServicesStatusA (
401 SC_HANDLE hSCManager,
402 DWORD dwServiceType,
403 DWORD dwServiceState,
404 LPENUM_SERVICE_STATUSA lpServices,
405 DWORD cbBufSize,
406 LPDWORD pcbBytesNeeded,
407 LPDWORD lpServicesReturned,
408 LPDWORD lpResumeHandle)
409 {
410 DPRINT1("EnumServicesStatusA is unimplemented\n");
411 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
412 return FALSE;
413 }
414
415
416 /**********************************************************************
417 * EnumServicesStatusExA
418 *
419 * @unimplemented
420 */
421 BOOL
422 STDCALL
423 EnumServicesStatusExA(SC_HANDLE hSCManager,
424 SC_ENUM_TYPE InfoLevel,
425 DWORD dwServiceType,
426 DWORD dwServiceState,
427 LPBYTE lpServices,
428 DWORD cbBufSize,
429 LPDWORD pcbBytesNeeded,
430 LPDWORD lpServicesReturned,
431 LPDWORD lpResumeHandle,
432 LPCSTR pszGroupName)
433 {
434 DPRINT1("EnumServicesStatusExA is unimplemented\n");
435 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
436 return FALSE;
437 }
438
439
440 /**********************************************************************
441 * EnumServicesStatusExW
442 *
443 * @unimplemented
444 */
445 BOOL
446 STDCALL
447 EnumServicesStatusExW(SC_HANDLE hSCManager,
448 SC_ENUM_TYPE InfoLevel,
449 DWORD dwServiceType,
450 DWORD dwServiceState,
451 LPBYTE lpServices,
452 DWORD cbBufSize,
453 LPDWORD pcbBytesNeeded,
454 LPDWORD lpServicesReturned,
455 LPDWORD lpResumeHandle,
456 LPCWSTR pszGroupName)
457 {
458 DPRINT1("EnumServicesStatusExW is unimplemented\n");
459 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
460 return FALSE;
461 }
462
463
464 /**********************************************************************
465 * EnumServicesStatusW
466 *
467 * @unimplemented
468 */
469 BOOL
470 STDCALL
471 EnumServicesStatusW(
472 SC_HANDLE hSCManager,
473 DWORD dwServiceType,
474 DWORD dwServiceState,
475 LPENUM_SERVICE_STATUSW lpServices,
476 DWORD cbBufSize,
477 LPDWORD pcbBytesNeeded,
478 LPDWORD lpServicesReturned,
479 LPDWORD lpResumeHandle)
480 {
481 DPRINT1("EnumServicesStatusW is unimplemented\n");
482 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
483 return FALSE;
484 }
485
486
487 /**********************************************************************
488 * GetServiceDisplayNameA
489 *
490 * @unimplemented
491 */
492 BOOL
493 STDCALL
494 GetServiceDisplayNameA(
495 SC_HANDLE hSCManager,
496 LPCSTR lpServiceName,
497 LPSTR lpDisplayName,
498 LPDWORD lpcchBuffer)
499 {
500 DPRINT1("GetServiceDisplayNameA is unimplemented\n");
501 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
502 return FALSE;
503 }
504
505
506 /**********************************************************************
507 * GetServiceDisplayNameW
508 *
509 * @unimplemented
510 */
511 BOOL
512 STDCALL
513 GetServiceDisplayNameW(
514 SC_HANDLE hSCManager,
515 LPCWSTR lpServiceName,
516 LPWSTR lpDisplayName,
517 LPDWORD lpcchBuffer)
518 {
519 DPRINT1("GetServiceDisplayNameW is unimplemented\n");
520 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
521 return FALSE;
522 }
523
524
525 /**********************************************************************
526 * GetServiceKeyNameA
527 *
528 * @unimplemented
529 */
530 BOOL
531 STDCALL
532 GetServiceKeyNameA(
533 SC_HANDLE hSCManager,
534 LPCSTR lpDisplayName,
535 LPSTR lpServiceName,
536 LPDWORD lpcchBuffer)
537 {
538 DPRINT1("GetServiceKeyNameA is unimplemented\n");
539 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
540 return FALSE;
541 }
542
543
544 /**********************************************************************
545 * GetServiceKeyNameW
546 *
547 * @unimplemented
548 */
549 BOOL
550 STDCALL
551 GetServiceKeyNameW(
552 SC_HANDLE hSCManager,
553 LPCWSTR lpDisplayName,
554 LPWSTR lpServiceName,
555 LPDWORD lpcchBuffer)
556 {
557 DPRINT1("GetServiceKeyNameW is unimplemented\n");
558 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
559 return FALSE;
560 }
561
562
563 /**********************************************************************
564 * LockServiceDatabase
565 *
566 * @implemented
567 */
568 SC_LOCK STDCALL
569 LockServiceDatabase(SC_HANDLE hSCManager)
570 {
571 SC_LOCK hLock;
572 DWORD dwError;
573
574 DPRINT("LockServiceDatabase(%x)\n", hSCManager);
575
576 HandleBind();
577
578 /* Call to services.exe using RPC */
579 dwError = ScmrLockServiceDatabase(BindingHandle,
580 (unsigned int)hSCManager,
581 (unsigned int *)&hLock);
582 if (dwError != ERROR_SUCCESS)
583 {
584 DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
585 SetLastError(dwError);
586 return NULL;
587 }
588
589 DPRINT("hLock = %p\n", hLock);
590
591 return hLock;
592 }
593
594
595 static VOID
596 WaitForSCManager(VOID)
597 {
598 HANDLE hEvent;
599
600 DPRINT("WaitForSCManager() called\n");
601
602 /* Try to open the existing event */
603 hEvent = OpenEventW(SYNCHRONIZE,
604 FALSE,
605 L"SvcctrlStartEvent_A3725DX");
606 if (hEvent == NULL)
607 {
608 if (GetLastError() != ERROR_FILE_NOT_FOUND)
609 return;
610
611 /* Try to create a new event */
612 hEvent = CreateEventW(NULL,
613 TRUE,
614 FALSE,
615 L"SvcctrlStartEvent_A3725DX");
616 if (hEvent == NULL)
617 {
618 /* Try to open the existing event again */
619 hEvent = OpenEventW(SYNCHRONIZE,
620 FALSE,
621 L"SvcctrlStartEvent_A3725DX");
622 if (hEvent == NULL)
623 return;
624 }
625 }
626
627 /* Wait for 3 minutes */
628 WaitForSingleObject(hEvent, 180000);
629 CloseHandle(hEvent);
630
631 DPRINT("ScmWaitForSCManager() done\n");
632 }
633
634
635 /**********************************************************************
636 * OpenSCManagerA
637 *
638 * @implemented
639 */
640 SC_HANDLE STDCALL
641 OpenSCManagerA(LPCSTR lpMachineName,
642 LPCSTR lpDatabaseName,
643 DWORD dwDesiredAccess)
644 {
645 SC_HANDLE hScm = NULL;
646 DWORD dwError;
647
648 DPRINT("OpenSCManagerA(%s, %s, %lx)\n",
649 lpMachineName, lpDatabaseName, dwDesiredAccess);
650
651 WaitForSCManager();
652
653 HandleBind();
654
655 /* Call to services.exe using RPC */
656 dwError = ScmrOpenSCManagerA(BindingHandle,
657 (LPSTR)lpMachineName,
658 (LPSTR)lpDatabaseName,
659 dwDesiredAccess,
660 (unsigned int*)&hScm);
661 if (dwError != ERROR_SUCCESS)
662 {
663 DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
664 SetLastError(dwError);
665 return NULL;
666 }
667
668 DPRINT("hScm = %p\n", hScm);
669
670 return hScm;
671 }
672
673
674 /**********************************************************************
675 * OpenSCManagerW
676 *
677 * @implemented
678 */
679 SC_HANDLE STDCALL
680 OpenSCManagerW(LPCWSTR lpMachineName,
681 LPCWSTR lpDatabaseName,
682 DWORD dwDesiredAccess)
683 {
684 SC_HANDLE hScm = NULL;
685 DWORD dwError;
686
687 DPRINT("OpenSCManagerW(%S, %S, %lx)\n",
688 lpMachineName, lpDatabaseName, dwDesiredAccess);
689
690 WaitForSCManager();
691
692 HandleBind();
693
694 /* Call to services.exe using RPC */
695 dwError = ScmrOpenSCManagerW(BindingHandle,
696 (LPWSTR)lpMachineName,
697 (LPWSTR)lpDatabaseName,
698 dwDesiredAccess,
699 (unsigned int*)&hScm);
700 if (dwError != ERROR_SUCCESS)
701 {
702 DPRINT1("ScmrOpenSCManagerW() failed (Error %lu)\n", dwError);
703 SetLastError(dwError);
704 return NULL;
705 }
706
707 DPRINT("hScm = %p\n", hScm);
708
709 return hScm;
710 }
711
712
713 /**********************************************************************
714 * OpenServiceA
715 *
716 * @implemented
717 */
718 SC_HANDLE STDCALL
719 OpenServiceA(SC_HANDLE hSCManager,
720 LPCSTR lpServiceName,
721 DWORD dwDesiredAccess)
722 {
723 SC_HANDLE hService = NULL;
724 DWORD dwError;
725
726 DPRINT("OpenServiceA(%p, %s, %lx)\n",
727 hSCManager, lpServiceName, dwDesiredAccess);
728
729 HandleBind();
730
731 /* Call to services.exe using RPC */
732 dwError = ScmrOpenServiceA(BindingHandle,
733 (unsigned int)hSCManager,
734 (LPSTR)lpServiceName,
735 dwDesiredAccess,
736 (unsigned int*)&hService);
737 if (dwError != ERROR_SUCCESS)
738 {
739 DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError);
740 SetLastError(dwError);
741 return NULL;
742 }
743
744 DPRINT("hService = %p\n", hService);
745
746 return hService;
747 }
748
749
750 /**********************************************************************
751 * OpenServiceW
752 *
753 * @implemented
754 */
755 SC_HANDLE STDCALL
756 OpenServiceW(SC_HANDLE hSCManager,
757 LPCWSTR lpServiceName,
758 DWORD dwDesiredAccess)
759 {
760 SC_HANDLE hService = NULL;
761 DWORD dwError;
762
763 DPRINT("OpenServiceW(%p, %S, %lx)\n",
764 hSCManager, lpServiceName, dwDesiredAccess);
765
766 HandleBind();
767
768 /* Call to services.exe using RPC */
769 dwError = ScmrOpenServiceW(BindingHandle,
770 (unsigned int)hSCManager,
771 (LPWSTR)lpServiceName,
772 dwDesiredAccess,
773 (unsigned int*)&hService);
774 if (dwError != ERROR_SUCCESS)
775 {
776 DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError);
777 SetLastError(dwError);
778 return NULL;
779 }
780
781 DPRINT("hService = %p\n", hService);
782
783 return hService;
784 }
785
786
787 /**********************************************************************
788 * QueryServiceConfigA
789 *
790 * @unimplemented
791 */
792 BOOL
793 STDCALL
794 QueryServiceConfigA(
795 SC_HANDLE hService,
796 LPQUERY_SERVICE_CONFIGA lpServiceConfig,
797 DWORD cbBufSize,
798 LPDWORD pcbBytesNeeded)
799 {
800 DPRINT1("QueryServiceConfigA is unimplemented\n");
801 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
802 return FALSE;
803 }
804
805
806 /**********************************************************************
807 * QueryServiceConfigW
808 *
809 * @unimplemented
810 */
811 BOOL
812 STDCALL
813 QueryServiceConfigW(
814 SC_HANDLE hService,
815 LPQUERY_SERVICE_CONFIGW lpServiceConfig,
816 DWORD cbBufSize,
817 LPDWORD pcbBytesNeeded)
818 {
819 DPRINT1("QueryServiceConfigW is unimplemented\n");
820 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
821 return FALSE;
822 }
823
824
825 /**********************************************************************
826 * QueryServiceLockStatusA
827 *
828 * @unimplemented
829 */
830 BOOL
831 STDCALL
832 QueryServiceLockStatusA(
833 SC_HANDLE hSCManager,
834 LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,
835 DWORD cbBufSize,
836 LPDWORD pcbBytesNeeded)
837 {
838 DPRINT1("QueryServiceLockStatusA is unimplemented\n");
839 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
840 return FALSE;
841 }
842
843
844 /**********************************************************************
845 * QueryServiceLockStatusW
846 *
847 * @unimplemented
848 */
849 BOOL
850 STDCALL
851 QueryServiceLockStatusW(
852 SC_HANDLE hSCManager,
853 LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus,
854 DWORD cbBufSize,
855 LPDWORD pcbBytesNeeded)
856 {
857 DPRINT1("QueryServiceLockStatusW is unimplemented\n");
858 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
859 return FALSE;
860 }
861
862
863 /**********************************************************************
864 * QueryServiceObjectSecurity
865 *
866 * @unimplemented
867 */
868 BOOL
869 STDCALL
870 QueryServiceObjectSecurity(
871 SC_HANDLE hService,
872 SECURITY_INFORMATION dwSecurityInformation,
873 PSECURITY_DESCRIPTOR lpSecurityDescriptor,
874 DWORD cbBufSize,
875 LPDWORD pcbBytesNeeded)
876 {
877 DPRINT1("QueryServiceObjectSecurity is unimplemented\n");
878 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
879 return FALSE;
880 }
881
882
883 /**********************************************************************
884 * QueryServiceStatus
885 *
886 * @implemented
887 */
888 BOOL STDCALL
889 QueryServiceStatus(SC_HANDLE hService,
890 LPSERVICE_STATUS lpServiceStatus)
891 {
892 DWORD dwError;
893
894 DPRINT("QueryServiceStatus(%p, %p)\n",
895 hService, lpServiceStatus);
896
897 HandleBind();
898
899 /* Call to services.exe using RPC */
900 dwError = ScmrQueryServiceStatus(BindingHandle,
901 (unsigned int)hService,
902 lpServiceStatus);
903 if (dwError != ERROR_SUCCESS)
904 {
905 DPRINT1("ScmrQueryServiceStatus() failed (Error %lu)\n", dwError);
906 SetLastError(dwError);
907 return FALSE;
908 }
909
910 return TRUE;
911 }
912
913
914 /**********************************************************************
915 * QueryServiceStatusEx
916 *
917 * @unimplemented
918 */
919 BOOL
920 STDCALL
921 QueryServiceStatusEx(SC_HANDLE hService,
922 SC_STATUS_TYPE InfoLevel,
923 LPBYTE lpBuffer,
924 DWORD cbBufSize,
925 LPDWORD pcbBytesNeeded)
926 {
927 DPRINT1("QueryServiceStatusEx is unimplemented\n");
928 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
929 return FALSE;
930 }
931
932
933 /**********************************************************************
934 * StartServiceA
935 *
936 * @unimplemented
937 */
938 BOOL
939 STDCALL
940 StartServiceA(
941 SC_HANDLE hService,
942 DWORD dwNumServiceArgs,
943 LPCSTR *lpServiceArgVectors)
944 {
945 DPRINT1("StartServiceA is unimplemented\n");
946 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
947 return FALSE;
948 }
949
950
951 /**********************************************************************
952 * StartServiceW
953 *
954 * @unimplemented
955 */
956 BOOL
957 STDCALL
958 StartServiceW(
959 SC_HANDLE hService,
960 DWORD dwNumServiceArgs,
961 LPCWSTR *lpServiceArgVectors)
962 {
963 DPRINT1("StartServiceW is unimplemented\n");
964 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
965 return FALSE;
966 }
967
968
969 /**********************************************************************
970 * UnlockServiceDatabase
971 *
972 * @implemented
973 */
974 BOOL STDCALL
975 UnlockServiceDatabase(SC_LOCK ScLock)
976 {
977 DWORD dwError;
978
979 #if 0
980 DPRINT("UnlockServiceDatabase(%x)\n", hSCManager);
981 #endif
982
983 HandleBind();
984
985 /* Call to services.exe using RPC */
986 dwError = ScmrUnlockServiceDatabase(BindingHandle,
987 (unsigned int)ScLock);
988 if (dwError != ERROR_SUCCESS)
989 {
990 DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n", dwError);
991 SetLastError(dwError);
992 return FALSE;
993 }
994
995 return TRUE;
996 }
997
998
999 void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
1000 {
1001 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
1002 }
1003
1004 void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
1005 {
1006 HeapFree(GetProcessHeap(), 0, ptr);
1007 }
1008
1009 /* EOF */