ReactOS  0.4.14-dev-1252-g782ff23
unload.c
Go to the documentation of this file.
1 /*
2  * Unload a device driver
3  */
4 #define WIN32_NO_STATUS
5 #include <windows.h>
6 #include <stdlib.h>
7 #include <ntndk.h>
8 
9 int wmain(int argc, WCHAR * argv[])
10 {
13 
14  if (argc != 2)
15  {
16  wprintf(L"Usage: unload <ServiceName>\n");
17  return 0;
18  }
19  ServiceName.Length = (wcslen(argv[1]) + 52) * sizeof(WCHAR);
20  ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
21  wsprintf(ServiceName.Buffer,
22  L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
23  argv[1]);
24  wprintf(L"%s %d %Ud\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
26  free(ServiceName.Buffer);
27  if (!NT_SUCCESS(Status))
28  {
29  wprintf(L"Failed: %X\n", Status);
30  return 1;
31  }
32  return 0;
33 }
static int argc
Definition: ServiceArgs.c:12
int wmain(int argc, WCHAR *argv[])
Definition: unload.c:9
#define free
Definition: debug_ros.c:5
LONG NTSTATUS
Definition: precomp.h:26
#define wprintf(...)
Definition: whoami.c:18
#define argv
Definition: mplay32.c:18
#define UNICODE_NULL
LPTSTR ServiceName
Definition: ServiceMain.c:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
NTSTATUS NtUnloadDriver(IN PUNICODE_STRING DriverServiceName)
Definition: driver.c:2162
#define malloc
Definition: debug_ros.c:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define wsprintf
Definition: winuser.h:5840
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)