36 if (pszDriverPath ==
NULL)
40 L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
47 DPRINT(
" Path: %wZ\n", &DriverPath);
53 &WasPrivilegeEnabled);
57 DPRINT1(
"SERVICES: Cannot acquire driver-loading privilege, Status = 0x%08lx\n",
Status);
67 &WasPrivilegeEnabled);
90 if (pszDriverPath ==
NULL)
94 L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
101 DPRINT(
" Path: %wZ\n", &DriverPath);
107 &WasPrivilegeEnabled);
111 DPRINT1(
"SERVICES: Cannot acquire driver-unloading privilege, Status = 0x%08lx\n",
Status);
126 &WasPrivilegeEnabled);
149 DWORD dwPreviousState;
151 DPRINT1(
"ScmGetDriverStatus() called\n");
154 if (lpServiceStatus !=
NULL)
182 DPRINT1(
"NtOpenDirectoryObject() failed\n");
207 DPRINT(
"No more services\n");
300 if (lpServiceStatus !=
NULL)
307 DPRINT1(
"ScmGetDriverStatus() done (Error: %lu)\n", dwError);
318 DPRINT(
"ScmStartDriver(%p)\n", pService);
328 DPRINT(
"ScmStartDriver returns %lu\n", dwError);
341 DPRINT(
"ScmControlDriver() called\n");
386 DPRINT(
"ScmControlDriver() done (Erorr: %lu)\n", dwError);
NTSTATUS NtUnloadDriver(IN PUNICODE_STRING DriverServiceName)
static DWORD ScmGetDriverStatus(PSERVICE lpService, LPSERVICE_STATUS lpServiceStatus)
DWORD ScmStartDriver(PSERVICE pService)
static DWORD ScmUnloadDriver(PSERVICE lpService)
static DWORD ScmLoadDriver(PSERVICE lpService)
DWORD ScmControlDriver(PSERVICE lpService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
_In_ PFCB _In_ PCD_NAME DirName
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
#define HeapFree(x, y, z)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define SE_LOAD_DRIVER_PRIVILEGE
#define InitializeObjectAttributes(p, n, a, r, s)
struct _OBJECT_DIRECTORY_INFORMATION OBJECT_DIRECTORY_INFORMATION
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
#define DIRECTORY_TRAVERSE
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSTATUS NTAPI NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
#define STATUS_NO_MORE_ENTRIES
NTSTATUS NTAPI NtOpenDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
NTSTATUS NTAPI NtQueryDirectoryObject(IN HANDLE DirectoryHandle, OUT PVOID Buffer, IN ULONG BufferLength, IN BOOLEAN ReturnSingleEntry, IN BOOLEAN RestartScan, IN OUT PULONG Context, OUT PULONG ReturnLength OPTIONAL)
_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 wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD dwServiceSpecificExitCode
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_INVALID_DEVICE_REQUEST
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
#define ERROR_SERVICE_NEVER_STARTED
#define ERROR_GEN_FAILURE
#define ERROR_INVALID_SERVICE_CONTROL
#define SERVICE_ACCEPT_STOP
#define SERVICE_STOP_PENDING
#define SERVICE_CONTROL_STOP
#define SERVICE_CONTROL_INTERROGATE
#define SERVICE_KERNEL_DRIVER
#define SERVICE_FILE_SYSTEM_DRIVER