From fa928d16c31c37599c15f50f276822323c4e896a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 4 Apr 2021 22:36:46 -0500 Subject: [PATCH] ntoskrnl/tests: Use a hard-coded file path in test_obj_reference(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/ntoskrnl.exe/tests/driver.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index d9d712418ee..ec2d8d33900 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -1166,7 +1166,7 @@ static void WINAPI thread_proc(void *arg) PsTerminateSystemThread(STATUS_SUCCESS); } -static void test_ob_reference(const WCHAR *test_path) +static void test_ob_reference(void) { POBJECT_TYPE (WINAPI *pObGetObjectType)(void*); OBJECT_ATTRIBUTES attr = { sizeof(attr) }; @@ -1177,8 +1177,6 @@ static void test_ob_reference(const WCHAR *test_path) POBJECT_TYPE obj1_type; UNICODE_STRING pathU; IO_STATUS_BLOCK io; - WCHAR *tmp_path; - SIZE_T len; NTSTATUS status; pObGetObjectType = get_proc_address("ObGetObjectType"); @@ -1189,18 +1187,12 @@ static void test_ob_reference(const WCHAR *test_path) status = ZwCreateEvent(&event_handle, SYNCHRONIZE, &attr, NotificationEvent, TRUE); ok(!status, "ZwCreateEvent failed: %#x\n", status); - len = wcslen(test_path); - tmp_path = ExAllocatePool(PagedPool, len * sizeof(WCHAR) + sizeof(L".tmp")); - memcpy(tmp_path, test_path, len * sizeof(WCHAR)); - memcpy(tmp_path + len, L".tmp", sizeof(L".tmp")); - - RtlInitUnicodeString(&pathU, tmp_path); + RtlInitUnicodeString(&pathU, L"\\??\\C:\\windows\\winetest_ntoskrnl_file.tmp"); attr.ObjectName = &pathU; - attr.Attributes = OBJ_KERNEL_HANDLE; + attr.Attributes = OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE; status = ZwCreateFile(&file_handle, DELETE | FILE_WRITE_DATA | SYNCHRONIZE, &attr, &io, NULL, 0, 0, FILE_CREATE, FILE_DELETE_ON_CLOSE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0); ok(!status, "ZwCreateFile failed: %#x\n", status); - ExFreePool(tmp_path); status = ZwDuplicateObject(NtCurrentProcess(), file_handle, NtCurrentProcess(), &file_handle2, 0, OBJ_KERNEL_HANDLE, DUPLICATE_SAME_ACCESS); @@ -2164,7 +2156,7 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st test_version(); test_stack_callout(); test_lookaside_list(); - test_ob_reference(test_input->path); + test_ob_reference(); test_resource(); test_lookup_thread(); test_IoAttachDeviceToDeviceStack();