Incorporate rosapps. 0.3.15 was branched somewhat incorrectly so rosapps is not synce...
[reactos.git] / modules / rosapps / applications / sysutils / utils / driver / load / load.c
1 /*
2 * Load 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 {
11 NTSTATUS Status;
12 UNICODE_STRING ServiceName;
13
14 if (argc != 2)
15 {
16 wprintf(L"Usage: load <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 %u %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
25 Status = NtLoadDriver(&ServiceName);
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 }