mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 14:32:56 +00:00
[LOAD][UNLOAD] Fix w*printf() format strings (#3319)
Also: - Set ServiceName.MaximumLength. - Fix MSVC warnings: '...\load\load.c(19): warning C4267: '=': conversion from 'size_t' to 'USHORT', possible loss of data '...\unload\unload.c(19): warning C4267: '=': conversion from 'size_t' to 'USHORT', possible loss of data' '...\unload\unload.c(24): warning C4476: 'wprintf' : unknown type field character 'U' in format specifier' '...\unload\unload.c(24): warning C4474: 'wprintf' : too many arguments passed for format string'
This commit is contained in:
parent
682f85ad9f
commit
2b93352907
2 changed files with 18 additions and 10 deletions
|
@ -16,18 +16,22 @@ int wmain(int argc, WCHAR * argv[])
|
||||||
wprintf(L"Usage: load <ServiceName>\n");
|
wprintf(L"Usage: load <ServiceName>\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ServiceName.Length = (wcslen(argv[1]) + 52) * sizeof(WCHAR);
|
|
||||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
ServiceName.Length = (USHORT)((52 + wcslen(argv[1])) * sizeof(WCHAR));
|
||||||
|
ServiceName.MaximumLength = ServiceName.Length + sizeof(UNICODE_NULL);
|
||||||
|
ServiceName.Buffer = malloc(ServiceName.MaximumLength);
|
||||||
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 %u %Id\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
wprintf(L"Loading %wZ\n", &ServiceName);
|
||||||
|
|
||||||
Status = NtLoadDriver(&ServiceName);
|
Status = NtLoadDriver(&ServiceName);
|
||||||
free(ServiceName.Buffer);
|
free(ServiceName.Buffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
wprintf(L"Failed: %x\n", Status);
|
wprintf(L"Failed: 0x%08lx\n", Status);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,18 +16,22 @@ int wmain(int argc, WCHAR * argv[])
|
||||||
wprintf(L"Usage: unload <ServiceName>\n");
|
wprintf(L"Usage: unload <ServiceName>\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ServiceName.Length = (wcslen(argv[1]) + 52) * sizeof(WCHAR);
|
|
||||||
ServiceName.Buffer = (LPWSTR)malloc(ServiceName.Length + sizeof(UNICODE_NULL));
|
ServiceName.Length = (USHORT)((52 + wcslen(argv[1])) * sizeof(WCHAR));
|
||||||
|
ServiceName.MaximumLength = ServiceName.Length + sizeof(UNICODE_NULL);
|
||||||
|
ServiceName.Buffer = malloc(ServiceName.MaximumLength);
|
||||||
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 %Ud\n", ServiceName.Buffer, ServiceName.Length, wcslen(ServiceName.Buffer));
|
wprintf(L"Unloading %wZ\n", &ServiceName);
|
||||||
|
|
||||||
Status = NtUnloadDriver(&ServiceName);
|
Status = NtUnloadDriver(&ServiceName);
|
||||||
free(ServiceName.Buffer);
|
free(ServiceName.Buffer);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
wprintf(L"Failed: %X\n", Status);
|
wprintf(L"Failed: 0x%08lx\n", Status);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue