merge ROS Shell without integrated explorer part into trunk
[reactos.git] / reactos / apps / utils / driver / load / load.c
1 /*
2 * Load a device driver
3 */
4 #include <windows.h>
5 #include <ntos/zw.h>
6
7 int
8 main(int argc, char *argv[])
9 {
10 NTSTATUS Status;
11 UNICODE_STRING ServiceName;
12
13 if (argc != 2)
14 {
15 printf("Usage: load <ServiceName>\n");
16 return 0;
17 }
18 ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
19 ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
20 wsprintf(ServiceName.Buffer,
21 L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
22 argv[1]);
23 wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
24 Status = NtLoadDriver(&ServiceName);
25 free(ServiceName.Buffer);
26 if (!NT_SUCCESS(Status))
27 {
28 printf("Failed: %X\n", Status);
29 return 1;
30 }
31 return 0;
32 }