Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47623 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 11 ----------- dlls/ntoskrnl.exe/sync.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 210f42b6b9..09fb6605bc 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3178,17 +3178,6 @@ BOOLEAN WINAPI IoSetThreadHardErrorMode(BOOLEAN EnableHardErrors) return FALSE; }
- -/***************************************************** - * IoInitializeRemoveLockEx (NTOSKRNL.EXE.@) - */ -VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK lock, ULONG tag, - ULONG maxmin, ULONG high, ULONG size) -{ - FIXME("(%p %u %u %u %u) stub\n", lock, tag, maxmin, high, size); -} - - /***************************************************** * IoAcquireRemoveLockEx (NTOSKRNL.EXE.@) */ diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index ea4165cda6..0b2ca6f6b7 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1195,3 +1195,17 @@ ULONG WINAPI ExIsResourceAcquiredSharedLite( ERESOURCE *resource )
return ret; } + +/*********************************************************************** + * IoInitializeRemoveLockEx (NTOSKRNL.EXE.@) + */ +void WINAPI IoInitializeRemoveLockEx( IO_REMOVE_LOCK *lock, ULONG tag, + ULONG max_minutes, ULONG max_count, ULONG size ) +{ + TRACE("lock %p, tag %#x, max_minutes %u, max_count %u, size %u.\n", + lock, tag, max_minutes, max_count, size); + + KeInitializeEvent( &lock->Common.RemoveEvent, SynchronizationEvent, FALSE ); + lock->Common.Removed = FALSE; + lock->Common.IoCount = 0; +}
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 13 ------------- dlls/ntoskrnl.exe/sync.c | 15 +++++++++++++++ include/ddk/wdm.h | 1 + 3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 09fb6605bc..6ce262c96c 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3178,19 +3178,6 @@ BOOLEAN WINAPI IoSetThreadHardErrorMode(BOOLEAN EnableHardErrors) return FALSE; }
-/***************************************************** - * IoAcquireRemoveLockEx (NTOSKRNL.EXE.@) - */ - -NTSTATUS WINAPI IoAcquireRemoveLockEx(PIO_REMOVE_LOCK lock, PVOID tag, - LPCSTR file, ULONG line, ULONG lock_size) -{ - FIXME("(%p, %p, %s, %u, %u): stub\n", lock, tag, debugstr_a(file), line, lock_size); - - return STATUS_NOT_IMPLEMENTED; -} - - /***************************************************** * DllMain */ diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 0b2ca6f6b7..f54fe2a663 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1209,3 +1209,18 @@ void WINAPI IoInitializeRemoveLockEx( IO_REMOVE_LOCK *lock, ULONG tag, lock->Common.Removed = FALSE; lock->Common.IoCount = 0; } + +/*********************************************************************** + * IoAcquireRemoveLockEx (NTOSKRNL.EXE.@) + */ +NTSTATUS WINAPI IoAcquireRemoveLockEx( IO_REMOVE_LOCK *lock, void *tag, + const char *file, ULONG line, ULONG size ) +{ + TRACE("lock %p, tag %p, file %s, line %u, size %u.\n", lock, tag, debugstr_a(file), line, size); + + if (lock->Common.Removed) + return STATUS_DELETE_PENDING; + + InterlockedIncrement( &lock->Common.IoCount ); + return STATUS_SUCCESS; +} diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index b7a05034b8..73ead8adc6 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1565,6 +1565,7 @@ void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD); ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
void WINAPI IoAcquireCancelSpinLock(KIRQL*); +NTSTATUS WINAPI IoAcquireRemoveLockEx(IO_REMOVE_LOCK*,void*,const char*,ULONG, ULONG); NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOID*); PVOID WINAPI IoAllocateErrorLogEntry(PVOID,UCHAR); PIRP WINAPI IoAllocateIrp(CCHAR,BOOLEAN);
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=55638
Your paranoid android.
=== debian10 (32 bit report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/sync.c | 15 +++++++++++++++ include/ddk/wdm.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 841fb6dfcd..a70a74ecc5 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -448,7 +448,7 @@ @ stdcall IoRegisterShutdownNotification(ptr) @ stdcall IoReleaseCancelSpinLock(long) @ stdcall IoReleaseRemoveLockAndWaitEx(ptr ptr long) -@ stub IoReleaseRemoveLockEx +@ stdcall IoReleaseRemoveLockEx(ptr ptr long) @ stub IoReleaseVpbSpinLock @ stub IoRemoveShareAccess @ stub IoReportDetectedDevice diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index f54fe2a663..7f4d26335f 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1224,3 +1224,18 @@ NTSTATUS WINAPI IoAcquireRemoveLockEx( IO_REMOVE_LOCK *lock, void *tag, InterlockedIncrement( &lock->Common.IoCount ); return STATUS_SUCCESS; } + +/*********************************************************************** + * IoReleaseRemoveLockEx (NTOSKRNL.EXE.@) + */ +void WINAPI IoReleaseRemoveLockEx( IO_REMOVE_LOCK *lock, void *tag, ULONG size ) +{ + LONG count; + + TRACE("lock %p, tag %p, size %u.\n", lock, tag, size); + + if (!(count = InterlockedDecrement( &lock->Common.IoCount ))) + KeSetEvent( &lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE ); + else if (count < 0) + ERR("Lock %p is not acquired!\n", lock); +} diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 73ead8adc6..f949433307 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1604,6 +1604,7 @@ NTSTATUS WINAPI IoOpenDeviceRegistryKey(DEVICE_OBJECT*,ULONG,ACCESS_MASK,HANDLE void WINAPI IoQueueWorkItem(PIO_WORKITEM,PIO_WORKITEM_ROUTINE,WORK_QUEUE_TYPE,void*); NTSTATUS WINAPI IoRegisterDeviceInterface(PDEVICE_OBJECT,const GUID*,PUNICODE_STRING,PUNICODE_STRING); void WINAPI IoReleaseCancelSpinLock(KIRQL); +void WINAPI IoReleaseRemoveLockEx(IO_REMOVE_LOCK*,void*,ULONG); NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN); NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
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=55641
Your paranoid android.
=== debian10 (32 bit report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 8 -------- dlls/ntoskrnl.exe/sync.c | 19 +++++++++++++++++++ include/ddk/wdm.h | 1 + 3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 6ce262c96c..b04e49eea7 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3796,14 +3796,6 @@ void WINAPI KeFlushQueuedDpcs(void) FIXME("stub!\n"); }
-/********************************************************************* - * IoReleaseRemoveLockAndWaitEx (NTOSKRNL.@) - */ -void WINAPI IoReleaseRemoveLockAndWaitEx(PIO_REMOVE_LOCK lock, PVOID tag, ULONG size) -{ - FIXME("stub: %p %p %u\n", lock, tag, size); -} - /********************************************************************* * DbgQueryDebugFilterState (NTOSKRNL.@) */ diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 7f4d26335f..4ab8b49724 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1239,3 +1239,22 @@ void WINAPI IoReleaseRemoveLockEx( IO_REMOVE_LOCK *lock, void *tag, ULONG size ) else if (count < 0) ERR("Lock %p is not acquired!\n", lock); } + +/*********************************************************************** + * IoReleaseRemoveLockAndWaitEx (NTOSKRNL.EXE.@) + */ +void WINAPI IoReleaseRemoveLockAndWaitEx( IO_REMOVE_LOCK *lock, void *tag, ULONG size ) +{ + LONG count; + + TRACE("lock %p, tag %p, size %u.\n", lock, tag, size); + + lock->Common.Removed = TRUE; + + if (!(count = InterlockedDecrement( &lock->Common.IoCount ))) + KeSetEvent( &lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE ); + else if (count < 0) + ERR("Lock %p is not acquired!\n", lock); + else + KeWaitForSingleObject( &lock->Common.RemoveEvent, Executive, KernelMode, FALSE, NULL ); +} diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index f949433307..80eca5406e 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1604,6 +1604,7 @@ NTSTATUS WINAPI IoOpenDeviceRegistryKey(DEVICE_OBJECT*,ULONG,ACCESS_MASK,HANDLE void WINAPI IoQueueWorkItem(PIO_WORKITEM,PIO_WORKITEM_ROUTINE,WORK_QUEUE_TYPE,void*); NTSTATUS WINAPI IoRegisterDeviceInterface(PDEVICE_OBJECT,const GUID*,PUNICODE_STRING,PUNICODE_STRING); void WINAPI IoReleaseCancelSpinLock(KIRQL); +void WINAPI IoReleaseRemoveLockAndWaitEx(IO_REMOVE_LOCK*,void*,ULONG); void WINAPI IoReleaseRemoveLockEx(IO_REMOVE_LOCK*,void*,ULONG); NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN); NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
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=55642
Your paranoid android.
=== debian10 (32 bit report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: increase some timeouts to avoid test failures
dlls/ntoskrnl.exe/tests/driver.c | 55 +++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index c275e67ae5..2b3a32b17c 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -427,16 +427,33 @@ static void WINAPI mutex_thread(void *arg) PsTerminateSystemThread(STATUS_SUCCESS); }
+static KEVENT remove_lock_ready; + +static void WINAPI remove_lock_thread(void *arg) +{ + IO_REMOVE_LOCK *lock = arg; + NTSTATUS ret; + + ret = IoAcquireRemoveLockEx(lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ok(ret == STATUS_SUCCESS, "got %#x\n", ret); + KeSetEvent(&remove_lock_ready, 0, FALSE); + + IoReleaseRemoveLockAndWaitEx(lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + PsTerminateSystemThread(STATUS_SUCCESS); +} + static void test_sync(void) { + static const ULONG wine_tag = 0x454e4957; /* WINE */ KSEMAPHORE semaphore, semaphore2; KEVENT manual_event, auto_event, *event; KTIMER timer; + IO_REMOVE_LOCK remove_lock; LARGE_INTEGER timeout; OBJECT_ATTRIBUTES attr; + HANDLE handle, thread; void *objs[2]; NTSTATUS ret; - HANDLE handle; int i;
KeInitializeEvent(&manual_event, NotificationEvent, FALSE); @@ -719,6 +736,42 @@ static void test_sync(void) ok(ret == 0, "got %#x\n", ret);
KeCancelTimer(&timer); + + /* remove locks */ + + IoInitializeRemoveLockEx(&remove_lock, wine_tag, 0, 0, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + + ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ok(ret == STATUS_SUCCESS, "got %#x\n", ret); + + IoReleaseRemoveLockEx(&remove_lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + + ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ok(ret == STATUS_SUCCESS, "got %#x\n", ret); + + ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ok(ret == STATUS_SUCCESS, "got %#x\n", ret); + + KeInitializeEvent(&remove_lock_ready, SynchronizationEvent, FALSE); + thread = create_thread(remove_lock_thread, &remove_lock); + ret = wait_single(&remove_lock_ready, -1000 * 10000); + ok(!ret, "got %#x\n", ret); + ret = wait_single_handle(thread, -50 * 10000); + ok(ret == STATUS_TIMEOUT, "got %#x\n", ret); + + ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ok(ret == STATUS_DELETE_PENDING, "got %#x\n", ret); + + IoReleaseRemoveLockEx(&remove_lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ret = wait_single_handle(thread, 0); + ok(ret == STATUS_TIMEOUT, "got %#x\n", ret); + + IoReleaseRemoveLockEx(&remove_lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ret = wait_single_handle(thread, -10000 * 10000); + ok(ret == STATUS_SUCCESS, "got %#x\n", ret); + + ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)); + ok(ret == STATUS_DELETE_PENDING, "got %#x\n", ret); }
static void test_call_driver(DEVICE_OBJECT *device)
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=55643
Your paranoid android.
=== w8 (task log) ===
Task errors: The previous 1 run(s) terminated abnormally
=== debian10 (32 bit report) ===
ntoskrnl.exe: driver.c:760: Test failed: got 0 driver.c:767: Test failed: got 0
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit French report) ===
ntoskrnl.exe: driver.c:760: Test failed: got 0 driver.c:767: Test failed: got 0
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Japanese:Japan report) ===
ntoskrnl.exe: driver.c:760: Test failed: got 0 driver.c:767: Test failed: got 0
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
ntoskrnl.exe: driver.c:760: Test failed: got 0 driver.c:767: Test failed: got 0
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
ntoskrnl.exe: driver.c:760: Test failed: got 0 driver.c:767: Test failed: got 0
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
ntoskrnl.exe: driver.c:760: Test failed: got 0 driver.c:767: Test failed: got 0
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
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=55637
Your paranoid android.
=== debian10 (32 bit report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Chinese:China report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (64 bit WoW report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver