Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/tests/driver.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 16ef861299d..29fc838a012 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -846,6 +846,8 @@ static void test_call_driver(DEVICE_OBJECT *device) KEVENT event; NTSTATUS status;
+ iosb.Status = 0xdeadbeef; + iosb.Information = 0xdeadbeef; irp = IoBuildAsynchronousFsdRequest(IRP_MJ_FLUSH_BUFFERS, device, NULL, 0, NULL, &iosb); ok(irp->UserIosb == &iosb, "unexpected UserIosb\n"); ok(!irp->Cancel, "Cancel = %x\n", irp->Cancel); @@ -854,6 +856,10 @@ static void test_call_driver(DEVICE_OBJECT *device) ok(irp->CurrentLocation == 2, "CurrentLocation = %u\n", irp->CurrentLocation); ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(), "IRP thread is not the current thread\n"); + ok(!irp->IoStatus.Status, "got status %#x\n", irp->IoStatus.Status); + ok(!irp->IoStatus.Information, "got information %#x\n", irp->IoStatus.Information); + ok(iosb.Status == 0xdeadbeef, "got status %#x\n", iosb.Status); + ok(iosb.Information == 0xdeadbeef, "got information %#x\n", iosb.Information);
irpsp = IoGetNextIrpStackLocation(irp); ok(irpsp->MajorFunction == IRP_MJ_FLUSH_BUFFERS, "MajorFunction = %u\n", irpsp->MajorFunction); @@ -863,10 +869,16 @@ static void test_call_driver(DEVICE_OBJECT *device)
status = IoCallDriver(device, irp); ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status); + ok(!irp->IoStatus.Status, "got status %#x\n", irp->IoStatus.Status); + ok(!irp->IoStatus.Information, "got information %#x\n", irp->IoStatus.Information); + ok(iosb.Status == 0xdeadbeef, "got status %#x\n", iosb.Status); + ok(iosb.Information == 0xdeadbeef, "got information %#x\n", iosb.Information);
irp->IoStatus.Status = STATUS_SUCCESS; - irp->IoStatus.Information = 0; + irp->IoStatus.Information = 123; IoCompleteRequest(irp, IO_NO_INCREMENT); + todo_wine ok(iosb.Status == STATUS_SUCCESS, "got status %#x\n", iosb.Status); + todo_wine ok(iosb.Information == 123, "got information %#x\n", iosb.Information);
KeInitializeEvent(&event, NotificationEvent, FALSE);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 1 + dlls/ntoskrnl.exe/tests/driver.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index e003de33c2d..ee95155f301 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2023,6 +2023,7 @@ VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
if (irp->Flags & IRP_DEALLOCATE_BUFFER) HeapFree( GetProcessHeap(), 0, irp->AssociatedIrp.SystemBuffer ); + if (irp->UserIosb) *irp->UserIosb = irp->IoStatus; if (irp->UserEvent) KeSetEvent( irp->UserEvent, IO_NO_INCREMENT, FALSE );
IoFreeIrp( irp ); diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 29fc838a012..d84d519ea95 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -877,8 +877,8 @@ static void test_call_driver(DEVICE_OBJECT *device) irp->IoStatus.Status = STATUS_SUCCESS; irp->IoStatus.Information = 123; IoCompleteRequest(irp, IO_NO_INCREMENT); - todo_wine ok(iosb.Status == STATUS_SUCCESS, "got status %#x\n", iosb.Status); - todo_wine ok(iosb.Information == 123, "got information %#x\n", iosb.Information); + ok(iosb.Status == STATUS_SUCCESS, "got status %#x\n", iosb.Status); + ok(iosb.Information == 123, "got information %#x\n", iosb.Information);
KeInitializeEvent(&event, NotificationEvent, FALSE);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/pnp.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 79c0ee72a50..6b56edb3336 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -80,28 +80,20 @@ static NTSTATUS WINAPI internal_complete( DEVICE_OBJECT *device, IRP *irp, void return STATUS_MORE_PROCESSING_REQUIRED; }
-static NTSTATUS send_device_irp( DEVICE_OBJECT *device, IRP *irp, ULONG_PTR *info ) +static void send_device_irp( DEVICE_OBJECT *device, IRP *irp ) { HANDLE event = CreateEventA( NULL, FALSE, FALSE, NULL ); DEVICE_OBJECT *toplevel_device; - NTSTATUS status;
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; IoSetCompletionRoutine( irp, internal_complete, event, TRUE, TRUE, TRUE );
toplevel_device = IoGetAttachedDeviceReference( device ); - status = IoCallDriver( toplevel_device, irp ); - - if (status == STATUS_PENDING) + if (IoCallDriver( toplevel_device, irp ) == STATUS_PENDING) WaitForSingleObject( event, INFINITE ); - - status = irp->IoStatus.u.Status; - if (info) - *info = irp->IoStatus.Information; IoCompleteRequest( irp, IO_NO_INCREMENT ); ObDereferenceObject( toplevel_device ); CloseHandle( event ); - return status; }
static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCHAR **id ) @@ -119,7 +111,9 @@ static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WC irpsp->MinorFunction = IRP_MN_QUERY_ID; irpsp->Parameters.QueryId.IdType = type;
- return send_device_irp( device, irp, (ULONG_PTR *)id ); + send_device_irp( device, irp ); + *id = (WCHAR *)irp_status.Information; + return irp_status.u.Status; }
static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor ) @@ -139,7 +133,8 @@ static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor ) irpsp->Parameters.StartDevice.AllocatedResources = NULL; irpsp->Parameters.StartDevice.AllocatedResourcesTranslated = NULL;
- return send_device_irp( device, irp, NULL ); + send_device_irp( device, irp ); + return irp_status.u.Status; }
static NTSTATUS get_device_instance_id( DEVICE_OBJECT *device, WCHAR *buffer ) @@ -369,7 +364,6 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) DEVICE_RELATIONS *relations; IO_STATUS_BLOCK irp_status; IO_STACK_LOCATION *irpsp; - NTSTATUS status; HDEVINFO set; IRP *irp; ULONG i; @@ -389,9 +383,11 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) irpsp = IoGetNextIrpStackLocation( irp ); irpsp->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS; irpsp->Parameters.QueryDeviceRelations.Type = BusRelations; - if ((status = send_device_irp( parent, irp, (ULONG_PTR *)&relations ))) + send_device_irp( parent, irp ); + relations = (DEVICE_RELATIONS *)irp_status.Information; + if (irp_status.u.Status) { - ERR("Failed to enumerate child devices, status %#x.\n", status); + ERR("Failed to enumerate child devices, status %#x.\n", irp_status.u.Status); SetupDiDestroyDeviceInfoList( set ); return; }
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=85429
Your paranoid android.
=== debiant2 (build log) ===
../wine/dlls/ntoskrnl.exe/pnp.c:187:12: error: too many arguments to function ‘send_device_irp’ ../wine/dlls/ntoskrnl.exe/pnp.c:187:12: error: void value not ignored as it ought to be Task: The win32 Wine build failed
=== debiant2 (build log) ===
../wine/dlls/ntoskrnl.exe/pnp.c:187:12: error: too many arguments to function ‘send_device_irp’ ../wine/dlls/ntoskrnl.exe/pnp.c:187:12: error: void value not ignored as it ought to be Task: The wow64 Wine build failed
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/pnp.c | 49 ++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 6b56edb3336..c16970a8d02 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -73,45 +73,27 @@ static int interface_rb_compare( const void *key, const struct wine_rb_entry *en
static struct wine_rb_tree device_interfaces = { interface_rb_compare };
-static NTSTATUS WINAPI internal_complete( DEVICE_OBJECT *device, IRP *irp, void *context ) -{ - HANDLE event = context; - SetEvent( event ); - return STATUS_MORE_PROCESSING_REQUIRED; -} - -static void send_device_irp( DEVICE_OBJECT *device, IRP *irp ) -{ - HANDLE event = CreateEventA( NULL, FALSE, FALSE, NULL ); - DEVICE_OBJECT *toplevel_device; - - irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; - IoSetCompletionRoutine( irp, internal_complete, event, TRUE, TRUE, TRUE ); - - toplevel_device = IoGetAttachedDeviceReference( device ); - if (IoCallDriver( toplevel_device, irp ) == STATUS_PENDING) - WaitForSingleObject( event, INFINITE ); - IoCompleteRequest( irp, IO_NO_INCREMENT ); - ObDereferenceObject( toplevel_device ); - CloseHandle( event ); -} - static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCHAR **id ) { IO_STACK_LOCATION *irpsp; IO_STATUS_BLOCK irp_status; + KEVENT event; IRP *irp;
device = IoGetAttachedDevice( device );
- if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status ))) + KeInitializeEvent( &event, NotificationEvent, FALSE ); + if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, device, NULL, 0, NULL, &event, &irp_status ))) return STATUS_NO_MEMORY;
irpsp = IoGetNextIrpStackLocation( irp ); irpsp->MinorFunction = IRP_MN_QUERY_ID; irpsp->Parameters.QueryId.IdType = type;
- send_device_irp( device, irp ); + irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; + if (IoCallDriver( device, irp ) == STATUS_PENDING) + KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL ); + *id = (WCHAR *)irp_status.Information; return irp_status.u.Status; } @@ -120,10 +102,12 @@ static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor ) { IO_STACK_LOCATION *irpsp; IO_STATUS_BLOCK irp_status; + KEVENT event; IRP *irp;
device = IoGetAttachedDevice( device );
+ KeInitializeEvent( &event, NotificationEvent, FALSE ); if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status ))) return STATUS_NO_MEMORY;
@@ -133,7 +117,10 @@ static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor ) irpsp->Parameters.StartDevice.AllocatedResources = NULL; irpsp->Parameters.StartDevice.AllocatedResourcesTranslated = NULL;
- send_device_irp( device, irp ); + irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; + if (IoCallDriver( device, irp ) == STATUS_PENDING) + KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL ); + return irp_status.u.Status; }
@@ -365,6 +352,7 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) IO_STATUS_BLOCK irp_status; IO_STACK_LOCATION *irpsp; HDEVINFO set; + KEVENT event; IRP *irp; ULONG i;
@@ -374,7 +362,8 @@ static void handle_bus_relations( DEVICE_OBJECT *parent )
parent = IoGetAttachedDevice( parent );
- if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, parent, NULL, 0, NULL, NULL, &irp_status ))) + KeInitializeEvent( &event, NotificationEvent, FALSE ); + if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, parent, NULL, 0, NULL, &event, &irp_status ))) { SetupDiDestroyDeviceInfoList( set ); return; @@ -383,7 +372,11 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) irpsp = IoGetNextIrpStackLocation( irp ); irpsp->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS; irpsp->Parameters.QueryDeviceRelations.Type = BusRelations; - send_device_irp( parent, irp ); + + irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; + if (IoCallDriver( parent, irp ) == STATUS_PENDING) + KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL ); + relations = (DEVICE_RELATIONS *)irp_status.Information; if (irp_status.u.Status) {
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=85430
Your paranoid android.
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/dlls/ntoskrnl.exe/pnp.c:174: undefined reference to `send_device_irp' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/dlls/ntoskrnl.exe/pnp.c:174: undefined reference to `send_device_irp' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/hidclass.sys/main.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/dlls/hidclass.sys/main.c b/dlls/hidclass.sys/main.c index 1c7a3ca82af..e169c429efb 100644 --- a/dlls/hidclass.sys/main.c +++ b/dlls/hidclass.sys/main.c @@ -92,34 +92,19 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration) return STATUS_SUCCESS; }
-static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp, - void *context) -{ - HANDLE event = context; - SetEvent(event); - return STATUS_MORE_PROCESSING_REQUIRED; -} - NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) { IRP *irp; - IO_STATUS_BLOCK irp_status; - NTSTATUS status; - HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL); + IO_STATUS_BLOCK io; + KEVENT event;
- irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size, - out_buff, out_size, TRUE, NULL, &irp_status); + KeInitializeEvent(&event, NotificationEvent, FALSE);
- IoSetCompletionRoutine(irp, internalComplete, event, TRUE, TRUE, TRUE); - status = IoCallDriver(device, irp); - - if (status == STATUS_PENDING) - WaitForSingleObject(event, INFINITE); - - status = irp->IoStatus.u.Status; + irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size, + out_buff, out_size, TRUE, &event, &io);
- IoCompleteRequest(irp, IO_NO_INCREMENT ); - CloseHandle(event); + if (IoCallDriver(device, irp) == STATUS_PENDING) + KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
- return status; + return io.u.Status; }
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=85431
Your paranoid android.
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-win32/../wine/dlls/ntoskrnl.exe/pnp.c:174: undefined reference to `send_device_irp' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant2 (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/../wine/dlls/ntoskrnl.exe/pnp.c:174: undefined reference to `send_device_irp' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed