ntoskrnl.exe/tests: Avoid standard C functions in kernel drivers.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46993 Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7b83b6b9de
commit
c4433a06b7
|
@ -59,9 +59,8 @@ static void kvprintf(const char *format, __ms_va_list ap)
|
|||
{
|
||||
static char buffer[512];
|
||||
IO_STATUS_BLOCK io;
|
||||
|
||||
_vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
ZwWriteFile(okfile, NULL, NULL, NULL, &io, buffer, strlen(buffer), NULL, NULL);
|
||||
int len = _vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
ZwWriteFile(okfile, NULL, NULL, NULL, &io, buffer, len, NULL, NULL);
|
||||
}
|
||||
|
||||
static void WINAPIV kprintf(const char *format, ...)
|
||||
|
@ -193,6 +192,13 @@ static void *kmemcpy(void *dest, const void *src, SIZE_T n)
|
|||
return dest;
|
||||
}
|
||||
|
||||
static void *kmemset(void *dest, int c, SIZE_T n)
|
||||
{
|
||||
unsigned char *d = dest;
|
||||
while (n--) *d++ = (unsigned char)c;
|
||||
return dest;
|
||||
}
|
||||
|
||||
static void *get_proc_address(const char *name)
|
||||
{
|
||||
UNICODE_STRING name_u;
|
||||
|
@ -943,7 +949,7 @@ static void test_resource(void)
|
|||
BOOLEAN ret;
|
||||
HANDLE thread, thread2;
|
||||
|
||||
memset(&resource, 0xcc, sizeof(resource));
|
||||
kmemset(&resource, 0xcc, sizeof(resource));
|
||||
|
||||
status = ExInitializeResourceLite(&resource);
|
||||
ok(status == STATUS_SUCCESS, "got status %#x\n", status);
|
||||
|
@ -1230,7 +1236,7 @@ static NTSTATUS test_basic_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG_PTR *
|
|||
if (length < sizeof(teststr))
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
strcpy(buffer, teststr);
|
||||
kmemcpy(buffer, teststr, sizeof(teststr));
|
||||
*info = sizeof(teststr);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue