5 /* INCLUDES *****************************************************************/
12 /* FUNCTIONS ****************************************************************/
15 ScmLoadDriver(PSERVICE lpService
)
17 WCHAR szDriverPath
[MAX_PATH
];
18 UNICODE_STRING DriverPath
;
21 /* Build the driver path */
23 L
"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
25 lpService
->lpServiceName
);
27 RtlInitUnicodeString(&DriverPath
,
30 /* FIXME: Acquire privilege */
32 DPRINT(" Path: %wZ\n", &DriverPath
);
33 Status
= NtLoadDriver(&DriverPath
);
35 /* FIXME: Release privilege */
42 ScmUnloadDriver(PSERVICE lpService
)
44 WCHAR szDriverPath
[MAX_PATH
];
45 UNICODE_STRING DriverPath
;
47 DWORD dwError
= ERROR_SUCCESS
;
49 /* Build the driver path */
51 L
"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
53 lpService
->lpServiceName
);
55 RtlInitUnicodeString(&DriverPath
,
58 /* FIXME: Acquire privilege */
60 Status
= NtUnloadDriver(&DriverPath
);
62 /* FIXME: Release privilege */
64 if (!NT_SUCCESS(Status
))
66 dwError
= RtlNtStatusToDosError(Status
);
74 ScmControlDriver(PSERVICE lpService
,
76 LPSERVICE_STATUS lpServiceStatus
)
80 DPRINT("ScmControlDriver() called\n");
84 case SERVICE_CONTROL_STOP
:
85 if (lpService
->Status
.dwCurrentState
!= SERVICE_RUNNING
)
87 dwError
= ERROR_INVALID_SERVICE_CONTROL
;
91 dwError
= ScmUnloadDriver(lpService
);
92 if (dwError
== ERROR_SUCCESS
)
94 lpService
->Status
.dwControlsAccepted
= 0;
95 lpService
->Status
.dwCurrentState
= SERVICE_STOPPED
;
99 case SERVICE_CONTROL_INTERROGATE
:
100 dwError
= ERROR_INVALID_SERVICE_CONTROL
;
104 dwError
= ERROR_INVALID_SERVICE_CONTROL
;
108 DPRINT("ScmControlDriver() done (Erorr: %lu)\n", dwError
);