Zebediah Figura : ntoskrnl.exe/tests: Add tests for remove locks.
Alexandre Julliard
julliard at winehq.org
Wed Aug 21 14:39:32 CDT 2019
Module: wine
Branch: master
Commit: 2b6cf134c7aff14b33f2e704b392c2b09797fa44
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2b6cf134c7aff14b33f2e704b392c2b09797fa44
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Tue Aug 20 22:05:55 2019 -0500
ntoskrnl.exe/tests: Add tests for remove locks.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 c275e67..2b3a32b 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)
More information about the wine-cvs
mailing list