mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Fixed line endings.
svn path=/trunk/; revision=8897
This commit is contained in:
parent
c734759964
commit
6d1dae4a75
2 changed files with 64 additions and 64 deletions
|
@ -1,32 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* Load a device driver
|
* Load a device driver
|
||||||
*/
|
*/
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ntos/zw.h>
|
#include <ntos/zw.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING ServiceName;
|
UNICODE_STRING ServiceName;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
printf("Usage: load <ServiceName>\n");
|
printf("Usage: load <ServiceName>\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
||||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
||||||
wsprintf(ServiceName.Buffer,
|
wsprintf(ServiceName.Buffer,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
||||||
argv[1]);
|
argv[1]);
|
||||||
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
||||||
Status = NtLoadDriver(&ServiceName);
|
Status = NtLoadDriver(&ServiceName);
|
||||||
free(ServiceName.Buffer);
|
free(ServiceName.Buffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
printf("Failed: %X\n", Status);
|
printf("Failed: %X\n", Status);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* Unload a device driver
|
* Unload a device driver
|
||||||
*/
|
*/
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ntos/zw.h>
|
#include <ntos/zw.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING ServiceName;
|
UNICODE_STRING ServiceName;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
printf("Usage: unload <ServiceName>\n");
|
printf("Usage: unload <ServiceName>\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
ServiceName.Length = (strlen(argv[1]) + 52) * sizeof(WCHAR);
|
||||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
||||||
wsprintf(ServiceName.Buffer,
|
wsprintf(ServiceName.Buffer,
|
||||||
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%S",
|
||||||
argv[1]);
|
argv[1]);
|
||||||
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
wprintf(L"%s %d %d\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
||||||
Status = NtUnloadDriver(&ServiceName);
|
Status = NtUnloadDriver(&ServiceName);
|
||||||
free(ServiceName.Buffer);
|
free(ServiceName.Buffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
printf("Failed: %X\n", Status);
|
printf("Failed: %X\n", Status);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue