Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 4ab8b49724..7aed1d0483 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1205,7 +1205,7 @@ void WINAPI IoInitializeRemoveLockEx( IO_REMOVE_LOCK *lock, ULONG tag, 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 ); + KeInitializeEvent( &lock->Common.RemoveEvent, NotificationEvent, FALSE ); lock->Common.Removed = FALSE; lock->Common.IoCount = 0; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 7aed1d0483..365ddc069f 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -1234,7 +1234,7 @@ void WINAPI IoReleaseRemoveLockEx( IO_REMOVE_LOCK *lock, void *tag, ULONG size )
TRACE("lock %p, tag %p, size %u.\n", lock, tag, size);
- if (!(count = InterlockedDecrement( &lock->Common.IoCount ))) + if (!(count = InterlockedDecrement( &lock->Common.IoCount )) && lock->Common.Removed) KeSetEvent( &lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE ); else if (count < 0) ERR("Lock %p is not acquired!\n", lock); @@ -1251,10 +1251,10 @@ void WINAPI IoReleaseRemoveLockAndWaitEx( IO_REMOVE_LOCK *lock, void *tag, ULONG
lock->Common.Removed = TRUE;
- if (!(count = InterlockedDecrement( &lock->Common.IoCount ))) + if (!(count = InterlockedDecrement( &lock->Common.IoCount )) && lock->Common.Removed) KeSetEvent( &lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE ); else if (count < 0) ERR("Lock %p is not acquired!\n", lock); - else + else if (count > 0) KeWaitForSingleObject( &lock->Common.RemoveEvent, Executive, KernelMode, FALSE, NULL ); }
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=55677
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/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=55678
Your paranoid android.
=== w8 (32 bit report) ===
Report errors: The report seems to have been truncated
=== w8 (task log) ===
Task errors: An error occurred while waiting for the test to complete: the 2776 process does not exist or is not a child process The test VM has crashed, rebooted or lost connectivity (or the TestAgent server died) The previous 2 run(s) terminated abnormally
=== debian10 (32 bit report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit French report) ===
Report errors: ntoskrnl.exe:ntoskrnl contains a misplaced todo message for driver
=== debian10 (32 bit Japanese:Japan 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
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=55676
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