Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 49 ++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index c9f680f01e8..73f96789f06 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -34,6 +34,8 @@ #include "mssip.h" #include "setupapi.h" #include "newdev.h" +#include "initguid.h" +#include "devguid.h" #include "wine/test.h" #include "wine/heap.h" #include "wine/mssign.h" @@ -990,6 +992,49 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file) } }
+static void test_pnp_devices(void) +{ + static const GUID control_class = {0xdeadbeef, 0x29ef, 0x4538, {0xa5, 0xfd, 0xb6, 0x95, 0x73, 0xa3, 0x62, 0xc0}}; + + char buffer[200]; + SP_DEVICE_INTERFACE_DETAIL_DATA_A *iface_detail = (void *)buffer; + SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)}; + SP_DEVINFO_DATA device = {sizeof(device)}; + HDEVINFO set; + HANDLE bus; + BOOL ret; + + set = SetupDiGetClassDevsA(&control_class, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); + ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError()); + + ret = SetupDiEnumDeviceInfo(set, 0, &device); + ok(ret, "failed to get device, error %#x\n", GetLastError()); + ok(IsEqualGUID(&device.ClassGuid, &GUID_DEVCLASS_SYSTEM), "wrong class %s\n", debugstr_guid(&device.ClassGuid)); + + ret = SetupDiGetDeviceInstanceIdA(set, &device, buffer, sizeof(buffer), NULL); + ok(ret, "failed to get device ID, error %#x\n", GetLastError()); + ok(!strcasecmp(buffer, "root\winetest\0"), "got ID %s\n", debugstr_a(buffer)); + + ret = SetupDiEnumDeviceInterfaces(set, NULL, &control_class, 0, &iface); + ok(ret, "failed to get interface, error %#x\n", GetLastError()); + ok(IsEqualGUID(&iface.InterfaceClassGuid, &control_class), + "wrong class %s\n", debugstr_guid(&iface.InterfaceClassGuid)); + ok(iface.Flags == SPINT_ACTIVE, "got flags %#x\n", iface.Flags); + + iface_detail->cbSize = sizeof(*iface_detail); + ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, iface_detail, sizeof(buffer), NULL, NULL); + ok(ret, "failed to get interface path, error %#x\n", GetLastError()); + ok(!strcasecmp(iface_detail->DevicePath, "\\?\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}"), + "wrong path %s\n", debugstr_a(iface_detail->DevicePath)); + + SetupDiDestroyDeviceInfoList(set); + + bus = CreateFileA(iface_detail->DevicePath, 0, 0, NULL, OPEN_EXISTING, 0, NULL); + ok(bus != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError()); + + CloseHandle(bus); +} + static void test_pnp_driver(struct testsign_context *ctx) { static const char hardware_id[] = "test_hardware_id\0"; @@ -1116,9 +1161,7 @@ static void test_pnp_driver(struct testsign_context *ctx)
/* Tests. */
- file = CreateFileA("\\?\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, NULL, OPEN_EXISTING, 0, NULL); - ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError()); - CloseHandle(file); + test_pnp_devices();
/* Clean up. */
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- 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();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/tests/driver.c | 7 ++++--- dlls/ntoskrnl.exe/tests/driver.h | 1 - dlls/ntoskrnl.exe/tests/driver4.c | 7 ++++--- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 24 ++++++++---------------- 4 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index ec2d8d33900..179d2d5e02d 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -2126,13 +2126,14 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st return STATUS_BUFFER_TOO_SMALL;
attr.Length = sizeof(attr); - RtlInitUnicodeString(&pathU, test_input->path); + RtlInitUnicodeString(&pathU, L"\??\C:\windows\winetest_ntoskrnl_okfile"); running_under_wine = test_input->running_under_wine; winetest_debug = test_input->winetest_debug; winetest_report_success = test_input->winetest_report_success; attr.ObjectName = &pathU; - attr.Attributes = OBJ_KERNEL_HANDLE; /* needed to be accessible from system threads */ - ZwOpenFile(&okfile, FILE_APPEND_DATA | SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT); + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE; /* needed to be accessible from system threads */ + ZwOpenFile(&okfile, FILE_APPEND_DATA | SYNCHRONIZE, &attr, &io, + FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT);
pExEventObjectType = get_proc_address("ExEventObjectType"); ok(!!pExEventObjectType, "ExEventObjectType not found\n"); diff --git a/dlls/ntoskrnl.exe/tests/driver.h b/dlls/ntoskrnl.exe/tests/driver.h index 58a92d4838e..d55dd95cf20 100644 --- a/dlls/ntoskrnl.exe/tests/driver.h +++ b/dlls/ntoskrnl.exe/tests/driver.h @@ -46,7 +46,6 @@ struct test_input DWORD process_id; SIZE_T teststr_offset; ULONG64 *modified_value; - WCHAR path[1]; };
static inline char *drv_strrchr( const char *str, char ch ) diff --git a/dlls/ntoskrnl.exe/tests/driver4.c b/dlls/ntoskrnl.exe/tests/driver4.c index 45ea90260a8..a29ba3b55ab 100644 --- a/dlls/ntoskrnl.exe/tests/driver4.c +++ b/dlls/ntoskrnl.exe/tests/driver4.c @@ -487,13 +487,14 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st return STATUS_BUFFER_TOO_SMALL;
attr.Length = sizeof(attr); - RtlInitUnicodeString(&pathU, test_input->path); + RtlInitUnicodeString(&pathU, L"\??\C:\winetest_ntoskrnl_okfile"); running_under_wine = test_input->running_under_wine; winetest_debug = test_input->winetest_debug; winetest_report_success = test_input->winetest_report_success; attr.ObjectName = &pathU; - attr.Attributes = OBJ_KERNEL_HANDLE; /* needed to be accessible from system threads */ - ZwOpenFile(&okfile, FILE_APPEND_DATA | SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT); + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE; /* needed to be accessible from system threads */ + ZwOpenFile(&okfile, FILE_APPEND_DATA | SYNCHRONIZE, &attr, &io, + FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT);
netio_init(); test_wsk_get_address_info(); diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 73f96789f06..1987019a6c5 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -367,22 +367,20 @@ static ULONG64 modified_value;
static void main_test(void) { - WCHAR temppathW[MAX_PATH], pathW[MAX_PATH]; struct test_input *test_input; - DWORD len, written, read; - UNICODE_STRING pathU; + DWORD written, read; LONG new_failures; char buffer[512]; HANDLE okfile; BOOL res;
/* Create a temporary file that the driver will write ok/trace output to. */ - GetTempPathW(MAX_PATH, temppathW); - GetTempFileNameW(temppathW, L"dok", 0, pathW); - pRtlDosPathNameToNtPathName_U( pathW, &pathU, NULL, NULL );
- len = pathU.Length + sizeof(WCHAR); - test_input = heap_alloc( offsetof( struct test_input, path[len / sizeof(WCHAR)]) ); + okfile = CreateFileA("C:\windows\winetest_ntoskrnl_okfile", GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL); + ok(okfile != INVALID_HANDLE_VALUE, "failed to create file, error %u\n", GetLastError()); + + test_input = heap_alloc( sizeof(*test_input) ); test_input->running_under_wine = !strcmp(winetest_platform, "wine"); test_input->winetest_report_success = winetest_report_success; test_input->winetest_debug = winetest_debug; @@ -391,16 +389,11 @@ static void main_test(void) test_input->modified_value = &modified_value; modified_value = 0;
- memcpy(test_input->path, pathU.Buffer, len); - res = DeviceIoControl(device, IOCTL_WINETEST_MAIN_TEST, test_input, - offsetof( struct test_input, path[len / sizeof(WCHAR)]), + res = DeviceIoControl(device, IOCTL_WINETEST_MAIN_TEST, test_input, sizeof(*test_input), &new_failures, sizeof(new_failures), &written, NULL); ok(res, "DeviceIoControl failed: %u\n", GetLastError()); ok(written == sizeof(new_failures), "got size %x\n", written);
- okfile = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); - ok(okfile != INVALID_HANDLE_VALUE, "failed to create %s: %u\n", wine_dbgstr_w(pathW), GetLastError()); - /* Print the ok/trace output and then add to our failure count. */ do { ReadFile(okfile, buffer, sizeof(buffer), &read, NULL); @@ -408,10 +401,9 @@ static void main_test(void) } while (read == sizeof(buffer)); winetest_add_failures(new_failures);
- pRtlFreeUnicodeString(&pathU); heap_free(test_input); CloseHandle(okfile); - DeleteFileW(pathW); + DeleteFileA("C:\windows\winetest_ntoskrnl_okfile"); }
static void test_basic_ioctl(void)
These are already tested in the main driver; there's no need to test them again.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/tests/driver4.c | 68 ++---------------------------- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 4 -- 2 files changed, 4 insertions(+), 68 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver4.c b/dlls/ntoskrnl.exe/tests/driver4.c index a29ba3b55ab..d2a053e6b7a 100644 --- a/dlls/ntoskrnl.exe/tests/driver4.c +++ b/dlls/ntoskrnl.exe/tests/driver4.c @@ -37,19 +37,10 @@ #include "utils.h"
static DRIVER_OBJECT *driver_obj; -static DEVICE_OBJECT *lower_device, *upper_device; - -static unsigned int create_count, close_count; +static DEVICE_OBJECT *device_obj;
static const WCHAR driver_link[] = L"\DosDevices\WineTestDriver4"; static const WCHAR device_name[] = L"\Device\WineTestDriver4"; -static const WCHAR upper_name[] = L"\Device\WineTestUpper4"; - -static FILE_OBJECT *last_created_file; -static void *create_caller_thread; -static PETHREAD create_irp_thread; - -static POBJECT_TYPE *pIoDriverObjectType;
static WSK_CLIENT_NPI client_npi; static WSK_REGISTRATION registration; @@ -525,10 +516,6 @@ static NTSTATUS WINAPI driver_iocontrol(DEVICE_OBJECT *device, IRP *irp) case IOCTL_WINETEST_MAIN_TEST: status = main_test(device, irp, stack); break; - case IOCTL_WINETEST_DETACH: - IoDetachDevice(lower_device); - status = STATUS_SUCCESS; - break; default: break; } @@ -543,17 +530,6 @@ static NTSTATUS WINAPI driver_iocontrol(DEVICE_OBJECT *device, IRP *irp)
static NTSTATUS WINAPI driver_create(DEVICE_OBJECT *device, IRP *irp) { - IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation( irp ); - DWORD *context = ExAllocatePool(PagedPool, sizeof(*context)); - - last_created_file = irpsp->FileObject; - ++create_count; - if (context) - *context = create_count; - irpsp->FileObject->FsContext = context; - create_caller_thread = KeGetCurrentThread(); - create_irp_thread = irp->Tail.Overlay.Thread; - irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(irp, IO_NO_INCREMENT); return STATUS_SUCCESS; @@ -561,13 +537,8 @@ static NTSTATUS WINAPI driver_create(DEVICE_OBJECT *device, IRP *irp)
static NTSTATUS WINAPI driver_close(DEVICE_OBJECT *device, IRP *irp) { - IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); - netio_uninit();
- ++close_count; - if (stack->FileObject->FsContext) - ExFreePool(stack->FileObject->FsContext); irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(irp, IO_NO_INCREMENT); return STATUS_SUCCESS; @@ -582,17 +553,13 @@ static VOID WINAPI driver_unload(DRIVER_OBJECT *driver) RtlInitUnicodeString(&linkW, driver_link); IoDeleteSymbolicLink(&linkW);
- IoDeleteDevice(upper_device); - IoDeleteDevice(lower_device); + IoDeleteDevice(device_obj); }
NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry) { - static const WCHAR IoDriverObjectTypeW[] = L"IoDriverObjectType"; - static const WCHAR driver_nameW[] = L"\Driver\WineTestDriver4"; UNICODE_STRING nameW, linkW; NTSTATUS status; - void *obj;
DbgPrint("Loading driver.\n");
@@ -603,41 +570,14 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry) driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = driver_iocontrol; driver->MajorFunction[IRP_MJ_CLOSE] = driver_close;
- RtlInitUnicodeString(&nameW, IoDriverObjectTypeW); - pIoDriverObjectType = MmGetSystemRoutineAddress(&nameW); - - RtlInitUnicodeString(&nameW, driver_nameW); - if ((status = ObReferenceObjectByName(&nameW, 0, NULL, 0, *pIoDriverObjectType, KernelMode, NULL, &obj))) - return status; - if (obj != driver) - { - ObDereferenceObject(obj); - return STATUS_UNSUCCESSFUL; - } - ObDereferenceObject(obj); - RtlInitUnicodeString(&nameW, device_name); RtlInitUnicodeString(&linkW, driver_link);
if (!(status = IoCreateDevice(driver, 0, &nameW, FILE_DEVICE_UNKNOWN, - FILE_DEVICE_SECURE_OPEN, FALSE, &lower_device))) + FILE_DEVICE_SECURE_OPEN, FALSE, &device_obj))) { status = IoCreateSymbolicLink(&linkW, &nameW); - lower_device->Flags &= ~DO_DEVICE_INITIALIZING; - } - - if (!status) - { - RtlInitUnicodeString(&nameW, upper_name); - - status = IoCreateDevice(driver, 0, &nameW, FILE_DEVICE_UNKNOWN, - FILE_DEVICE_SECURE_OPEN, FALSE, &upper_device); - } - - if (!status) - { - IoAttachDeviceToDeviceStack(upper_device, lower_device); - upper_device->Flags &= ~DO_DEVICE_INITIALIZING; + device_obj->Flags &= ~DO_DEVICE_INITIALIZING; }
return status; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 1987019a6c5..18f5189e382 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -904,7 +904,6 @@ static void test_driver4(struct testsign_context *ctx) WCHAR filename[MAX_PATH]; SC_HANDLE service; HANDLE hthread; - DWORD written; BOOL ret;
if (!(service = load_driver(ctx, filename, L"driver4.dll", L"WineTestDriver4"))) @@ -923,9 +922,6 @@ static void test_driver4(struct testsign_context *ctx) main_test(); WaitForSingleObject(hthread, INFINITE);
- ret = DeviceIoControl(device, IOCTL_WINETEST_DETACH, NULL, 0, NULL, 0, &written, NULL); - ok(ret, "DeviceIoControl failed: %u\n", GetLastError()); - CloseHandle(device);
unload_driver(service);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/tests/Makefile.in | 8 ++++---- dlls/ntoskrnl.exe/tests/{driver4.c => driver_netio.c} | 6 +++--- .../tests/{driver4.spec => driver_netio.spec} | 0 dlls/ntoskrnl.exe/tests/ntoskrnl.c | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) rename dlls/ntoskrnl.exe/tests/{driver4.c => driver_netio.c} (99%) rename dlls/ntoskrnl.exe/tests/{driver4.spec => driver_netio.spec} (100%)
diff --git a/dlls/ntoskrnl.exe/tests/Makefile.in b/dlls/ntoskrnl.exe/tests/Makefile.in index c799dfcaf77..d911879ff99 100644 --- a/dlls/ntoskrnl.exe/tests/Makefile.in +++ b/dlls/ntoskrnl.exe/tests/Makefile.in @@ -7,8 +7,8 @@ driver2_IMPORTS = winecrt0 ntoskrnl driver2_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native driver3_IMPORTS = winecrt0 ntoskrnl driver3_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native -driver4_IMPORTS = winecrt0 ntoskrnl netio -driver4_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native +driver_netio_IMPORTS = winecrt0 ntoskrnl netio +driver_netio_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native driver_pnp_IMPORTS = winecrt0 ntoskrnl driver_pnp_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
@@ -19,8 +19,8 @@ SOURCES = \ driver2.spec \ driver3.c \ driver3.spec \ - driver4.c \ - driver4.spec \ + driver_netio.c \ + driver_netio.spec \ driver_pnp.c \ driver_pnp.spec \ ntoskrnl.c diff --git a/dlls/ntoskrnl.exe/tests/driver4.c b/dlls/ntoskrnl.exe/tests/driver_netio.c similarity index 99% rename from dlls/ntoskrnl.exe/tests/driver4.c rename to dlls/ntoskrnl.exe/tests/driver_netio.c index d2a053e6b7a..3d783dbef0d 100644 --- a/dlls/ntoskrnl.exe/tests/driver4.c +++ b/dlls/ntoskrnl.exe/tests/driver_netio.c @@ -1,5 +1,5 @@ /* - * ntoskrnl.exe testing framework + * Unit tests for netio.sys (kernel sockets) * * Copyright 2020 Paul Gofman for CodeWeavers * @@ -39,8 +39,8 @@ static DRIVER_OBJECT *driver_obj; static DEVICE_OBJECT *device_obj;
-static const WCHAR driver_link[] = L"\DosDevices\WineTestDriver4"; -static const WCHAR device_name[] = L"\Device\WineTestDriver4"; +static const WCHAR driver_link[] = L"\DosDevices\winetest_netio"; +static const WCHAR device_name[] = L"\Device\winetest_netio";
static WSK_CLIENT_NPI client_npi; static WSK_REGISTRATION registration; diff --git a/dlls/ntoskrnl.exe/tests/driver4.spec b/dlls/ntoskrnl.exe/tests/driver_netio.spec similarity index 100% rename from dlls/ntoskrnl.exe/tests/driver4.spec rename to dlls/ntoskrnl.exe/tests/driver_netio.spec diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 18f5189e382..4667915f621 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -899,14 +899,14 @@ static DWORD WINAPI wsk_test_thread(void *parameter) return TRUE; }
-static void test_driver4(struct testsign_context *ctx) +static void test_driver_netio(struct testsign_context *ctx) { WCHAR filename[MAX_PATH]; SC_HANDLE service; HANDLE hthread; BOOL ret;
- if (!(service = load_driver(ctx, filename, L"driver4.dll", L"WineTestDriver4"))) + if (!(service = load_driver(ctx, filename, L"driver_netio.dll", L"winetest_netio"))) return;
if (!start_driver(service, TRUE)) @@ -915,7 +915,7 @@ static void test_driver4(struct testsign_context *ctx) return; }
- device = CreateFileA("\\.\WineTestDriver4", 0, 0, NULL, OPEN_EXISTING, 0, NULL); + device = CreateFileA("\\.\winetest_netio", 0, 0, NULL, OPEN_EXISTING, 0, NULL); ok(device != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
hthread = CreateThread(NULL, 0, wsk_test_thread, NULL, 0, NULL); @@ -1260,8 +1260,8 @@ START_TEST(ntoskrnl) ok(ret, "DeleteFile failed: %u\n", GetLastError());
test_driver3(&ctx); - subtest("driver4"); - test_driver4(&ctx); + subtest("driver_netio"); + test_driver_netio(&ctx);
test_pnp_driver(&ctx);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88234
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/ntoskrnl.exe/tests/driver4.c:39 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/ntoskrnl.exe/tests/driver4.c:39 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/ntoskrnl.exe/tests/driver4.c:39 Task: Patch failed to apply
On 4/4/21 10:56 PM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88234
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/ntoskrnl.exe/tests/driver4.c:39 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/ntoskrnl.exe/tests/driver4.c:39 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/ntoskrnl.exe/tests/driver4.c:39 Task: Patch failed to apply
Bug 50720 again :-(
FWIW the idea was not to have this test driver specific to netio but rather for the tests which require Windows 7+ to load (or test the functionality present on newer Windows only to avoid extra checks for keeping compatibility with earlier versions).
On 4/5/21 06:36, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/ntoskrnl.exe/tests/Makefile.in | 8 ++++---- dlls/ntoskrnl.exe/tests/{driver4.c => driver_netio.c} | 6 +++--- .../tests/{driver4.spec => driver_netio.spec} | 0 dlls/ntoskrnl.exe/tests/ntoskrnl.c | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) rename dlls/ntoskrnl.exe/tests/{driver4.c => driver_netio.c} (99%) rename dlls/ntoskrnl.exe/tests/{driver4.spec => driver_netio.spec} (100%)
diff --git a/dlls/ntoskrnl.exe/tests/Makefile.in b/dlls/ntoskrnl.exe/tests/Makefile.in index c799dfcaf77..d911879ff99 100644 --- a/dlls/ntoskrnl.exe/tests/Makefile.in +++ b/dlls/ntoskrnl.exe/tests/Makefile.in @@ -7,8 +7,8 @@ driver2_IMPORTS = winecrt0 ntoskrnl driver2_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native driver3_IMPORTS = winecrt0 ntoskrnl driver3_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native -driver4_IMPORTS = winecrt0 ntoskrnl netio -driver4_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native +driver_netio_IMPORTS = winecrt0 ntoskrnl netio +driver_netio_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native driver_pnp_IMPORTS = winecrt0 ntoskrnl driver_pnp_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
@@ -19,8 +19,8 @@ SOURCES = \ driver2.spec \ driver3.c \ driver3.spec \
- driver4.c \
- driver4.spec \
- driver_netio.c \
- driver_netio.spec \ driver_pnp.c \ driver_pnp.spec \ ntoskrnl.c
diff --git a/dlls/ntoskrnl.exe/tests/driver4.c b/dlls/ntoskrnl.exe/tests/driver_netio.c similarity index 99% rename from dlls/ntoskrnl.exe/tests/driver4.c rename to dlls/ntoskrnl.exe/tests/driver_netio.c index d2a053e6b7a..3d783dbef0d 100644 --- a/dlls/ntoskrnl.exe/tests/driver4.c +++ b/dlls/ntoskrnl.exe/tests/driver_netio.c @@ -1,5 +1,5 @@ /*
- ntoskrnl.exe testing framework
- Unit tests for netio.sys (kernel sockets)
- Copyright 2020 Paul Gofman for CodeWeavers
@@ -39,8 +39,8 @@ static DRIVER_OBJECT *driver_obj; static DEVICE_OBJECT *device_obj;
-static const WCHAR driver_link[] = L"\DosDevices\WineTestDriver4"; -static const WCHAR device_name[] = L"\Device\WineTestDriver4"; +static const WCHAR driver_link[] = L"\DosDevices\winetest_netio"; +static const WCHAR device_name[] = L"\Device\winetest_netio";
static WSK_CLIENT_NPI client_npi; static WSK_REGISTRATION registration; diff --git a/dlls/ntoskrnl.exe/tests/driver4.spec b/dlls/ntoskrnl.exe/tests/driver_netio.spec similarity index 100% rename from dlls/ntoskrnl.exe/tests/driver4.spec rename to dlls/ntoskrnl.exe/tests/driver_netio.spec diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 18f5189e382..4667915f621 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -899,14 +899,14 @@ static DWORD WINAPI wsk_test_thread(void *parameter) return TRUE; }
-static void test_driver4(struct testsign_context *ctx) +static void test_driver_netio(struct testsign_context *ctx) { WCHAR filename[MAX_PATH]; SC_HANDLE service; HANDLE hthread; BOOL ret;
- if (!(service = load_driver(ctx, filename, L"driver4.dll", L"WineTestDriver4")))
if (!(service = load_driver(ctx, filename, L"driver_netio.dll", L"winetest_netio"))) return;
if (!start_driver(service, TRUE))
@@ -915,7 +915,7 @@ static void test_driver4(struct testsign_context *ctx) return; }
- device = CreateFileA("\\.\WineTestDriver4", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
device = CreateFileA("\\.\winetest_netio", 0, 0, NULL, OPEN_EXISTING, 0, NULL); ok(device != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
hthread = CreateThread(NULL, 0, wsk_test_thread, NULL, 0, NULL);
@@ -1260,8 +1260,8 @@ START_TEST(ntoskrnl) ok(ret, "DeleteFile failed: %u\n", GetLastError());
test_driver3(&ctx);
- subtest("driver4");
- test_driver4(&ctx);
subtest("driver_netio");
test_driver_netio(&ctx);
test_pnp_driver(&ctx);
On 4/5/21 4:10 AM, Paul Gofman wrote:
FWIW the idea was not to have this test driver specific to netio but rather for the tests which require Windows 7+ to load (or test the functionality present on newer Windows only to avoid extra checks for keeping compatibility with earlier versions).
I guess the patch has already been committed, but I'd offer as a weak counterpoint that it probably makes sense to separate netio tests semantically from others. Or, if not, that this test unit can be renamed again ("driver_win7"?) if it ever becomes useful to add other tests here. I don't feel particularly strongly though.
On 4/7/21 06:41, Zebediah Figura (she/her) wrote:
On 4/5/21 4:10 AM, Paul Gofman wrote:
FWIW the idea was not to have this test driver specific to netio but rather for the tests which require Windows 7+ to load (or test the functionality present on newer Windows only to avoid extra checks for keeping compatibility with earlier versions).
I guess the patch has already been committed, but I'd offer as a weak counterpoint that it probably makes sense to separate netio tests semantically from others. Or, if not, that this test unit can be renamed again ("driver_win7"?) if it ever becomes useful to add other tests here. I don't feel particularly strongly though.
Do you see any reason why netio deserves a separate driver module? E. g., if we come to adding WdfLdr, why not to link it and put the tests to the same test driver? Anyway, now there are netio tests only, that can probably be thought of once anyone decides to add some new Win7+ specific tests.
Paul Gofman pgofman@codeweavers.com writes:
On 4/7/21 06:41, Zebediah Figura (she/her) wrote:
On 4/5/21 4:10 AM, Paul Gofman wrote:
FWIW the idea was not to have this test driver specific to netio but rather for the tests which require Windows 7+ to load (or test the functionality present on newer Windows only to avoid extra checks for keeping compatibility with earlier versions).
I guess the patch has already been committed, but I'd offer as a weak counterpoint that it probably makes sense to separate netio tests semantically from others. Or, if not, that this test unit can be renamed again ("driver_win7"?) if it ever becomes useful to add other tests here. I don't feel particularly strongly though.
Do you see any reason why netio deserves a separate driver module? E. g., if we come to adding WdfLdr, why not to link it and put the tests to the same test driver? Anyway, now there are netio tests only, that can probably be thought of once anyone decides to add some new Win7+ specific tests.
In general, grouping things based on the Windows version is not a good idea. They should be put together when they are semantically related.
The version that some API requires is not an important detail, and not something that will help make sense of the code structure. That's particularly true since pre-win7 will soon be irrelevant, so every new test would then go into the driver_win7 file. That wouldn't be very helpful.
That doesn't mean we can't put other related things in driver_netio, and rename it if necessary. But two tests shouldn't be considered related just because they both happen to require win7.