Rebase against 0652a2ccc967c6d1ca04c67f58112ff491ab9a62

This commit is contained in:
Alistair Leslie-Hughes 2019-04-11 08:48:06 +10:00
parent a8556b9c25
commit 72a13348de
10 changed files with 8 additions and 806 deletions

View File

@ -1,4 +1,4 @@
From fbf186429a62b1bd076322ce394cc6a6322ca825 Mon Sep 17 00:00:00 2001
From da5af62afac8508b3323098bb004b87ffde77701 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 19 Aug 2014 22:10:49 -0600
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
@ -14,11 +14,11 @@ Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
create mode 100644 libs/port/xattr.c
diff --git a/configure.ac b/configure.ac
index 55d3dd0..552a94d 100644
index c80d9b1..745bf2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,6 +84,7 @@ AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug an
AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)]))
AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)]))
AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan]))
+AC_ARG_WITH(xattr, AS_HELP_STRING([--without-xattr],[do not use xattr (security attributes support)]))
@ -44,7 +44,7 @@ index 55d3dd0..552a94d 100644
AC_SUBST(DLLFLAGS,"-D_REENTRANT")
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index d0aaadf..27d2ce0 100644
index 4960e91..5957c44 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -122,6 +122,22 @@ mode_t FILE_umask = 0;
@ -108,10 +108,10 @@ index 2f6e9eb..b21d045 100644
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index ef3b23f..1c09fb5 100644
index a2e96d1..b975418 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -106,4 +106,6 @@ C_SRCS = \
@@ -108,4 +108,6 @@ C_SRCS = \
usleep.c \
utf8.c \
wctomb.c \

View File

@ -1,67 +0,0 @@
From 15fd135cd7bc46416235eee58ebac0d35d8e0d9e Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:48:49 -0600
Subject: [PATCH 09/13] ntoskrnl.exe: Implement ExGetExclusiveWaiterCount().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
dlls/ntoskrnl.exe/sync.c | 19 +++++++++++++++++++
include/ddk/wdm.h | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 79db7ee8..3d6ed649 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -146,7 +146,7 @@
@ stub ExFreeToPagedLookasideList
@ stub ExGetCurrentProcessorCounts
@ stub ExGetCurrentProcessorCpuUsage
-@ stub ExGetExclusiveWaiterCount
+@ stdcall ExGetExclusiveWaiterCount(ptr)
@ stub ExGetPreviousMode
@ stub ExGetSharedWaiterCount
@ stdcall ExInitializeNPagedLookasideList(ptr ptr ptr long long long long)
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index 705ea2c7..d024ee9f 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -1031,3 +1031,22 @@ void WINAPI ExReleaseResourceLite( ERESOURCE *resource )
{
ExReleaseResourceForThreadLite( resource, (ERESOURCE_THREAD)KeGetCurrentThread() );
}
+
+/***********************************************************************
+ * ExGetExclusiveWaiterCount (NTOSKRNL.EXE.@)
+ */
+ULONG WINAPI ExGetExclusiveWaiterCount( ERESOURCE *resource )
+{
+ ULONG count;
+ KIRQL irql;
+
+ TRACE("resource %p.\n", resource);
+
+ KeAcquireSpinLock( &resource->SpinLock, &irql );
+
+ count = resource->NumberOfExclusiveWaiters;
+
+ KeReleaseSpinLock( &resource->SpinLock, irql );
+
+ return count;
+}
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 69efdb7a..f7ced72a 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1524,6 +1524,7 @@ void WINAPI ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST);
NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*);
void WINAPI ExFreePool(PVOID);
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
+ULONG WINAPI ExGetExclusiveWaiterCount(ERESOURCE*);
void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST,PALLOCATE_FUNCTION,PFREE_FUNCTION,ULONG,SIZE_T,ULONG,USHORT);
NTSTATUS WINAPI ExInitializeResourceLite(ERESOURCE*);
PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
--
2.20.1

View File

@ -1,67 +0,0 @@
From c497239999dfae6e989f27118c5289e2d0bf5c0d Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:49:26 -0600
Subject: [PATCH 10/13] ntoskrnl.exe: Implement ExGetSharedWaiterCount().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
dlls/ntoskrnl.exe/sync.c | 19 +++++++++++++++++++
include/ddk/wdm.h | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 3d6ed649..45553e06 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -148,7 +148,7 @@
@ stub ExGetCurrentProcessorCpuUsage
@ stdcall ExGetExclusiveWaiterCount(ptr)
@ stub ExGetPreviousMode
-@ stub ExGetSharedWaiterCount
+@ stdcall ExGetSharedWaiterCount(ptr)
@ stdcall ExInitializeNPagedLookasideList(ptr ptr ptr long long long long)
@ stdcall ExInitializePagedLookasideList(ptr ptr ptr long long long long)
@ stdcall ExInitializeResourceLite(ptr)
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index d024ee9f..ad68e7ea 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -1050,3 +1050,22 @@ ULONG WINAPI ExGetExclusiveWaiterCount( ERESOURCE *resource )
return count;
}
+
+/***********************************************************************
+ * ExGetSharedWaiterCount (NTOSKRNL.EXE.@)
+ */
+ULONG WINAPI ExGetSharedWaiterCount( ERESOURCE *resource )
+{
+ ULONG count;
+ KIRQL irql;
+
+ TRACE("resource %p.\n", resource);
+
+ KeAcquireSpinLock( &resource->SpinLock, &irql );
+
+ count = resource->NumberOfSharedWaiters;
+
+ KeReleaseSpinLock( &resource->SpinLock, irql );
+
+ return count;
+}
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index f7ced72a..7a4be723 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1525,6 +1525,7 @@ NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*);
void WINAPI ExFreePool(PVOID);
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
ULONG WINAPI ExGetExclusiveWaiterCount(ERESOURCE*);
+ULONG WINAPI ExGetSharedWaiterCount(ERESOURCE*);
void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST,PALLOCATE_FUNCTION,PFREE_FUNCTION,ULONG,SIZE_T,ULONG,USHORT);
NTSTATUS WINAPI ExInitializeResourceLite(ERESOURCE*);
PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
--
2.20.1

View File

@ -1,67 +0,0 @@
From 29d57097b8a1915d1fdbd8822117c096bb9e8dae Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:50:37 -0600
Subject: [PATCH] ntoskrnl.exe: Implement ExIsResourceAcquiredExclusiveLite().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
dlls/ntoskrnl.exe/sync.c | 19 +++++++++++++++++++
include/ddk/wdm.h | 1 +
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 51ba575..8892b7c 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -165,7 +165,7 @@
@ stub ExInterlockedPushEntryList
@ stdcall ExInterlockedRemoveHeadList(ptr ptr)
@ stub ExIsProcessorFeaturePresent
-@ stub ExIsResourceAcquiredExclusiveLite
+@ stdcall ExIsResourceAcquiredExclusiveLite(ptr)
@ stub ExIsResourceAcquiredSharedLite
@ stdcall ExLocalTimeToSystemTime(ptr ptr) RtlLocalTimeToSystemTime
@ stub ExNotifyCallback
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index c63d739..0f71902 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -1045,3 +1045,22 @@ ULONG WINAPI ExGetSharedWaiterCount( ERESOURCE *resource )
return count;
}
+
+/***********************************************************************
+ * ExIsResourceAcquiredExclusiveLite (NTOSKRNL.EXE.@)
+ */
+BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite( ERESOURCE *resource )
+{
+ BOOLEAN ret;
+ KIRQL irql;
+
+ TRACE("resource %p.\n", resource);
+
+ KeAcquireSpinLock( &resource->SpinLock, &irql );
+
+ ret = (resource->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)KeGetCurrentThread());
+
+ KeReleaseSpinLock( &resource->SpinLock, irql );
+
+ return ret;
+}
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 1c58ab9..80a82b0 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1531,6 +1531,7 @@ NTSTATUS WINAPI ExInitializeResourceLite(ERESOURCE*);
PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPIN_LOCK);
LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList(LIST_ENTRY*,KSPIN_LOCK*);
+BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite(ERESOURCE*);
void WINAPI ExReleaseFastMutexUnsafe(PFAST_MUTEX);
void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD);
ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
--
1.9.1

View File

@ -1,73 +0,0 @@
From d121e866eaf9e480749b7a1faf863e77e67595a4 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:51:08 -0600
Subject: [PATCH] ntoskrnl.exe: Implement ExIsResourceAcquiredSharedLite().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
dlls/ntoskrnl.exe/sync.c | 25 +++++++++++++++++++++++++
include/ddk/wdm.h | 1 +
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 8892b7c..f0d6da6 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -166,7 +166,7 @@
@ stdcall ExInterlockedRemoveHeadList(ptr ptr)
@ stub ExIsProcessorFeaturePresent
@ stdcall ExIsResourceAcquiredExclusiveLite(ptr)
-@ stub ExIsResourceAcquiredSharedLite
+@ stdcall ExIsResourceAcquiredSharedLite(ptr)
@ stdcall ExLocalTimeToSystemTime(ptr ptr) RtlLocalTimeToSystemTime
@ stub ExNotifyCallback
@ stub ExQueryPoolBlockSize
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index 0f71902..cfdc6d1 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -1064,3 +1064,28 @@ BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite( ERESOURCE *resource )
return ret;
}
+
+/***********************************************************************
+ * ExIsResourceAcquiredSharedLite (NTOSKRNL.EXE.@)
+ */
+ULONG WINAPI ExIsResourceAcquiredSharedLite( ERESOURCE *resource )
+{
+ ULONG ret;
+ KIRQL irql;
+
+ TRACE("resource %p.\n", resource);
+
+ KeAcquireSpinLock( &resource->SpinLock, &irql );
+
+ if (resource->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)KeGetCurrentThread())
+ ret = resource->ActiveEntries;
+ else
+ {
+ OWNER_ENTRY *entry = resource_get_shared_entry( resource, (ERESOURCE_THREAD)KeGetCurrentThread() );
+ ret = entry->OwnerCount;
+ }
+
+ KeReleaseSpinLock( &resource->SpinLock, irql );
+
+ return ret;
+}
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 80a82b0..3600bcd 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1532,6 +1532,7 @@ PSLIST_ENTRY WINAPI ExInterlockedPopEntrySList(PSLIST_HEADER,PKSPIN_LOCK);
PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPIN_LOCK);
LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList(LIST_ENTRY*,KSPIN_LOCK*);
BOOLEAN WINAPI ExIsResourceAcquiredExclusiveLite(ERESOURCE*);
+ULONG WINAPI ExIsResourceAcquiredSharedLite(ERESOURCE*);
void WINAPI ExReleaseFastMutexUnsafe(PFAST_MUTEX);
void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD);
ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
--
1.9.1

View File

@ -1,383 +0,0 @@
From 552c4e1da2a7464b64cef1c962c7d5a0de6c1a42 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:54:39 -0600
Subject: [PATCH] ntoskrnl.exe/tests: Add tests for ERESOURCE functions.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/tests/driver.c | 311 ++++++++++++++++++++++++++++++-
include/ddk/wdm.h | 2 +
2 files changed, 312 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c
index 81baffa7c..0dec481be 100644
--- a/dlls/ntoskrnl.exe/tests/driver.c
+++ b/dlls/ntoskrnl.exe/tests/driver.c
@@ -322,7 +322,14 @@ todo_wine
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
}
-static void run_thread(PKSTART_ROUTINE proc, void *arg)
+static void sleep(void)
+{
+ LARGE_INTEGER timeout;
+ timeout.QuadPart = -2000;
+ KeDelayExecutionThread( KernelMode, FALSE, &timeout );
+}
+
+static HANDLE create_thread(PKSTART_ROUTINE proc, void *arg)
{
OBJECT_ATTRIBUTES attr = {0};
HANDLE thread;
@@ -333,12 +340,25 @@ static void run_thread(PKSTART_ROUTINE proc, void *arg)
ret = PsCreateSystemThread(&thread, THREAD_ALL_ACCESS, &attr, NULL, NULL, proc, arg);
ok(!ret, "got %#x\n", ret);
+ return thread;
+}
+
+static void join_thread(HANDLE thread)
+{
+ NTSTATUS ret;
+
ret = ZwWaitForSingleObject(thread, FALSE, NULL);
ok(!ret, "got %#x\n", ret);
ret = ZwClose(thread);
ok(!ret, "got %#x\n", ret);
}
+static void run_thread(PKSTART_ROUTINE proc, void *arg)
+{
+ HANDLE thread = create_thread(proc, arg);
+ join_thread(thread);
+}
+
static KMUTEX test_mutex;
static void WINAPI mutex_thread(void *arg)
@@ -853,6 +873,294 @@ static void test_ob_reference(const WCHAR *test_path)
ok(!status, "ZwClose failed: %#x\n", status);
}
+static void check_resource_(int line, ERESOURCE *resource, ULONG exclusive_waiters,
+ ULONG shared_waiters, BOOLEAN exclusive, ULONG shared_count)
+{
+ BOOLEAN ret;
+ ULONG count;
+
+ count = ExGetExclusiveWaiterCount(resource);
+ ok_(__FILE__, line, count == exclusive_waiters,
+ "expected %u exclusive waiters, got %u\n", exclusive_waiters, count);
+ count = ExGetSharedWaiterCount(resource);
+ ok_(__FILE__, line, count == shared_waiters,
+ "expected %u shared waiters, got %u\n", shared_waiters, count);
+ ret = ExIsResourceAcquiredExclusiveLite(resource);
+ ok_(__FILE__, line, ret == exclusive,
+ "expected exclusive %u, got %u\n", exclusive, ret);
+ count = ExIsResourceAcquiredSharedLite(resource);
+ ok_(__FILE__, line, count == shared_count,
+ "expected shared %u, got %u\n", shared_count, count);
+}
+#define check_resource(a,b,c,d,e) check_resource_(__LINE__,a,b,c,d,e)
+
+static KEVENT resource_shared_ready, resource_shared_done, resource_exclusive_ready, resource_exclusive_done;
+
+static void WINAPI resource_shared_thread(void *arg)
+{
+ ERESOURCE *resource = arg;
+ BOOLEAN ret;
+
+ check_resource(resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireResourceSharedLite(resource, TRUE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+
+ check_resource(resource, 0, 0, FALSE, 1);
+
+ KeSetEvent(&resource_shared_ready, IO_NO_INCREMENT, FALSE);
+ KeWaitForSingleObject(&resource_shared_done, Executive, KernelMode, FALSE, NULL);
+
+ ExReleaseResourceForThreadLite(resource, (ULONG_PTR)PsGetCurrentThread());
+
+ PsTerminateSystemThread(STATUS_SUCCESS);
+}
+
+static void WINAPI resource_exclusive_thread(void *arg)
+{
+ ERESOURCE *resource = arg;
+ BOOLEAN ret;
+
+ check_resource(resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireResourceExclusiveLite(resource, TRUE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+
+ check_resource(resource, 0, 0, TRUE, 1);
+
+ KeSetEvent(&resource_exclusive_ready, IO_NO_INCREMENT, FALSE);
+ KeWaitForSingleObject(&resource_exclusive_done, Executive, KernelMode, FALSE, NULL);
+
+ ExReleaseResourceForThreadLite(resource, (ULONG_PTR)PsGetCurrentThread());
+
+ PsTerminateSystemThread(STATUS_SUCCESS);
+}
+
+static void test_resource(void)
+{
+ ERESOURCE resource;
+ NTSTATUS status;
+ BOOLEAN ret;
+ HANDLE thread, thread2;
+
+ memset(&resource, 0xcc, sizeof(resource));
+
+ status = ExInitializeResourceLite(&resource);
+ ok(status == STATUS_SUCCESS, "got status %#x\n", status);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ KeEnterCriticalRegion();
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, TRUE, 1);
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, TRUE, 2);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, TRUE, 3);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, TRUE, 2);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, TRUE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 2);
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 2);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireSharedStarveExclusive(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireSharedWaitForExclusive(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ /* Do not acquire the resource ourselves, but spawn a shared thread holding it. */
+
+ KeInitializeEvent(&resource_shared_ready, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&resource_shared_done, SynchronizationEvent, FALSE);
+ thread = create_thread(resource_shared_thread, &resource);
+ KeWaitForSingleObject(&resource_shared_ready, Executive, KernelMode, FALSE, NULL);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireSharedStarveExclusive(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireSharedWaitForExclusive(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ KeSetEvent(&resource_shared_done, IO_NO_INCREMENT, FALSE);
+ join_thread(thread);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ /* Acquire the resource as exclusive, and then spawn a shared thread. */
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, TRUE, 1);
+
+ thread = create_thread(resource_shared_thread, &resource);
+ sleep();
+ check_resource(&resource, 0, 1, TRUE, 1);
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 1, TRUE, 2);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ KeWaitForSingleObject(&resource_shared_ready, Executive, KernelMode, FALSE, NULL);
+ KeSetEvent(&resource_shared_done, IO_NO_INCREMENT, FALSE);
+ join_thread(thread);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ /* Do not acquire the resource ourselves, but spawn an exclusive thread holding it. */
+
+ KeInitializeEvent(&resource_exclusive_ready, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&resource_exclusive_done, SynchronizationEvent, FALSE);
+ thread = create_thread(resource_exclusive_thread, &resource);
+ KeWaitForSingleObject(&resource_exclusive_ready, Executive, KernelMode, FALSE, NULL);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireSharedStarveExclusive(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ ret = ExAcquireSharedWaitForExclusive(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ KeSetEvent(&resource_exclusive_done, IO_NO_INCREMENT, FALSE);
+ join_thread(thread);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ /* Acquire the resource as shared, and then spawn an exclusive waiter. */
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 0, 0, FALSE, 1);
+
+ thread = create_thread(resource_exclusive_thread, &resource);
+ sleep();
+ check_resource(&resource, 1, 0, FALSE, 1);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 2);
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+
+ ret = ExAcquireSharedStarveExclusive(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 2);
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+
+ ret = ExAcquireSharedWaitForExclusive(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 1);
+
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+ KeWaitForSingleObject(&resource_exclusive_ready, Executive, KernelMode, FALSE, NULL);
+ KeSetEvent(&resource_exclusive_done, IO_NO_INCREMENT, FALSE);
+ join_thread(thread);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ /* Spawn a shared and then exclusive waiter. */
+
+ KeInitializeEvent(&resource_shared_ready, SynchronizationEvent, FALSE);
+ KeInitializeEvent(&resource_shared_done, SynchronizationEvent, FALSE);
+ thread = create_thread(resource_shared_thread, &resource);
+ KeWaitForSingleObject(&resource_shared_ready, Executive, KernelMode, FALSE, NULL);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ thread2 = create_thread(resource_exclusive_thread, &resource);
+ sleep();
+ check_resource(&resource, 1, 0, FALSE, 0);
+
+ ret = ExAcquireResourceExclusiveLite(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 0);
+
+ ret = ExAcquireResourceSharedLite(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 0);
+
+ ret = ExAcquireSharedStarveExclusive(&resource, FALSE);
+ ok(ret == TRUE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 1);
+ ExReleaseResourceForThreadLite(&resource, (ULONG_PTR)PsGetCurrentThread());
+
+ ret = ExAcquireSharedWaitForExclusive(&resource, FALSE);
+ ok(ret == FALSE, "got ret %u\n", ret);
+ check_resource(&resource, 1, 0, FALSE, 0);
+
+ KeSetEvent(&resource_shared_done, IO_NO_INCREMENT, FALSE);
+ join_thread(thread);
+ KeWaitForSingleObject(&resource_exclusive_ready, Executive, KernelMode, FALSE, NULL);
+ KeSetEvent(&resource_exclusive_done, IO_NO_INCREMENT, FALSE);
+ join_thread(thread2);
+ check_resource(&resource, 0, 0, FALSE, 0);
+
+ KeLeaveCriticalRegion();
+
+ status = ExDeleteResourceLite(&resource);
+ ok(status == STATUS_SUCCESS, "got status %#x\n", status);
+}
+
static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *stack, ULONG_PTR *info)
{
ULONG length = stack->Parameters.DeviceIoControl.OutputBufferLength;
@@ -895,6 +1203,7 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
test_stack_callout();
test_lookaside_list();
test_ob_reference(test_input->path);
+ test_resource();
/* print process report */
if (winetest_debug)
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index dae83afb2..0faf5ecd4 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1580,6 +1580,7 @@ void WINAPI KeAcquireSpinLockAtDpcLevel(KSPIN_LOCK*);
BOOLEAN WINAPI KeCancelTimer(KTIMER*);
void WINAPI KeClearEvent(PRKEVENT);
NTSTATUS WINAPI KeDelayExecutionThread(KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*);
+void WINAPI KeEnterCriticalRegion(void);
PKTHREAD WINAPI KeGetCurrentThread(void);
void WINAPI KeInitializeEvent(PRKEVENT,EVENT_TYPE,BOOLEAN);
void WINAPI KeInitializeMutex(PRKMUTEX,ULONG);
@@ -1587,6 +1588,7 @@ void WINAPI KeInitializeSemaphore(PRKSEMAPHORE,LONG,LONG);
void WINAPI KeInitializeSpinLock(KSPIN_LOCK*);
void WINAPI KeInitializeTimerEx(PKTIMER,TIMER_TYPE);
void WINAPI KeInitializeTimer(KTIMER*);
+void WINAPI KeLeaveCriticalRegion(void);
void WINAPI KeQuerySystemTime(LARGE_INTEGER*);
void WINAPI KeQueryTickCount(LARGE_INTEGER*);
ULONG WINAPI KeQueryTimeIncrement(void);
--
2.21.0

View File

@ -1,4 +0,0 @@
Fixes: [45819] Symantec Eraser Control Driver 'eeCtrl64.sys' (Norton 360) fails in driver entry point due to 'ntoskrnl.exe.ExInitializeResourceLite' stub (needs STATUS_SUCCESS)
# This patch is fit for submission as far as I'm concerned, but it can't really
# be submitted yet, since it depends on a working implementation of
# KeGetCurrentThread() [at least, one that distinguishes different threads].

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "5ed7a61de7e72ecf4cf6ef76d4044f32640b93cb"
echo "0652a2ccc967c6d1ca04c67f58112ff491ab9a62"
}
# Show version information
@ -231,7 +231,6 @@ patch_enable_all ()
enable_ntdll_set_full_cpu_context="$1"
enable_ntoskrnl_Stubs="$1"
enable_ntoskrnl_exe_Fix_Relocation="$1"
enable_ntoskrnl_exe_Resources="$1"
enable_nvapi_Stub_DLL="$1"
enable_nvcuda_CUDA_Support="$1"
enable_nvcuvid_CUDA_Video_Support="$1"
@ -834,9 +833,6 @@ patch_enable ()
ntoskrnl.exe-Fix_Relocation)
enable_ntoskrnl_exe_Fix_Relocation="$2"
;;
ntoskrnl.exe-Resources)
enable_ntoskrnl_exe_Resources="$2"
;;
nvapi-Stub_DLL)
enable_nvapi_Stub_DLL="$2"
;;
@ -1690,12 +1686,8 @@ if test "$enable_winedevice_Default_Drivers" -eq 1; then
if test "$enable_ntoskrnl_Stubs" -gt 1; then
abort "Patchset ntoskrnl-Stubs disabled, but winedevice-Default_Drivers depends on that."
fi
if test "$enable_ntoskrnl_exe_Resources" -gt 1; then
abort "Patchset ntoskrnl.exe-Resources disabled, but winedevice-Default_Drivers depends on that."
fi
enable_dxva2_Video_Decoder=1
enable_ntoskrnl_Stubs=1
enable_ntoskrnl_exe_Resources=1
fi
if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then
@ -5251,30 +5243,6 @@ if test "$enable_ntoskrnl_exe_Fix_Relocation" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntoskrnl.exe-Resources
# |
# | This patchset fixes the following Wine bugs:
# | * [#45819] Symantec Eraser Control Driver 'eeCtrl64.sys' (Norton 360) fails in driver entry point due to
# | 'ntoskrnl.exe.ExInitializeResourceLite' stub (needs STATUS_SUCCESS)
# |
# | Modified files:
# | * dlls/ntoskrnl.exe/ntoskrnl.exe.spec, dlls/ntoskrnl.exe/sync.c, dlls/ntoskrnl.exe/tests/driver.c, include/ddk/wdm.h
# |
if test "$enable_ntoskrnl_exe_Resources" -eq 1; then
patch_apply ntoskrnl.exe-Resources/0009-ntoskrnl.exe-Implement-ExGetExclusiveWaiterCount.patch
patch_apply ntoskrnl.exe-Resources/0010-ntoskrnl.exe-Implement-ExGetSharedWaiterCount.patch
patch_apply ntoskrnl.exe-Resources/0011-ntoskrnl.exe-Implement-ExIsResourceAcquiredExclusive.patch
patch_apply ntoskrnl.exe-Resources/0012-ntoskrnl.exe-Implement-ExIsResourceAcquiredSharedLit.patch
patch_apply ntoskrnl.exe-Resources/0013-ntoskrnl.exe-tests-Add-tests-for-ERESOURCE-functions.patch
(
printf '%s\n' '+ { "Zebediah Figura", "ntoskrnl.exe: Implement ExGetExclusiveWaiterCount().", 1 },';
printf '%s\n' '+ { "Zebediah Figura", "ntoskrnl.exe: Implement ExGetSharedWaiterCount().", 1 },';
printf '%s\n' '+ { "Zebediah Figura", "ntoskrnl.exe: Implement ExIsResourceAcquiredExclusiveLite().", 1 },';
printf '%s\n' '+ { "Zebediah Figura", "ntoskrnl.exe: Implement ExIsResourceAcquiredSharedLite().", 1 },';
printf '%s\n' '+ { "Zebediah Figura", "ntoskrnl.exe/tests: Add tests for ERESOURCE functions.", 1 },';
) >> "$patchlist"
fi
# Patchset nvcuvid-CUDA_Video_Support
# |
# | This patchset has the following (direct or indirect) dependencies:
@ -7014,7 +6982,7 @@ fi
# Patchset winedevice-Default_Drivers
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * dxva2-Video_Decoder, ntoskrnl-Stubs, ntoskrnl.exe-Resources
# | * dxva2-Video_Decoder, ntoskrnl-Stubs
# |
# | Modified files:
# | * configure.ac, dlls/dxgkrnl.sys/Makefile.in, dlls/dxgkrnl.sys/dxgkrnl.sys.spec, dlls/dxgkrnl.sys/main.c,
@ -7406,7 +7374,6 @@ fi
# | * dlls/winex11.drv/wintab.c, dlls/wintab32/context.c, dlls/wintab32/tests/Makefile.in, dlls/wintab32/tests/context.c
# |
if test "$enable_wintab32_improvements" -eq 1; then
patch_apply wintab32-improvements/0001-winex11-Implement-PK_CHANGE-for-wintab.patch
patch_apply wintab32-improvements/0002-wintab32-Set-lcSysExtX-Y-for-the-first-index-of-WTI_.patch
patch_apply wintab32-improvements/0003-winex11-Handle-negative-orAltitude-values.patch
patch_apply wintab32-improvements/0004-winex11.drv-Support-multiplex-categories-WTI_DSCTXS-.patch
@ -7414,7 +7381,6 @@ if test "$enable_wintab32_improvements" -eq 1; then
patch_apply wintab32-improvements/0006-wintab32-Scale-NormalPressure-before-sending-to-the-.patch
patch_apply wintab32-improvements/0007-wintab32-tests-Initial-interactive-test.patch
(
printf '%s\n' '+ { "Eriks Dobelis", "winex11: Implement PK_CHANGE for wintab.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "wintab32: Set lcSysExtX/Y for the first index of WTI_DDCTXS.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "winex11: Handle negative orAltitude values.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "winex11.drv: Support multiplex categories WTI_DSCTXS and WTI_DDCTXS.", 1 },';

View File

@ -1,4 +1,3 @@
Fixes: Simulate a more realistic kernel environment in ntoskrnl/winedevice
Depends: dxva2-Video_Decoder
Depends: ntoskrnl-Stubs
Depends: ntoskrnl.exe-Resources

View File

@ -1,102 +0,0 @@
From 257f0d7fb176f317b8c47e02bf9c4b7fb89f8dfe Mon Sep 17 00:00:00 2001
From: Eriks Dobelis <eriks00@moon.lv>
Date: Thu, 31 May 2018 11:38:54 +1000
Subject: [PATCH] winex11: Implement PK_CHANGE for wintab
---
dlls/winex11.drv/wintab.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index e4259bf..a9ac78a 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -267,6 +267,13 @@ static int proximity_out_type;
static HWND hwndTabletDefault;
static WTPACKET gMsgPacket;
static DWORD gSerial;
+static DWORD lastX = 0xffff;
+static DWORD lastY = 0xffff;
+static UINT lastNormalPressure = 0xffff, lastTangentPressure = 0xffff;
+static DWORD lastButtons = 0xffff;
+static UINT lastCursor = 0xffff;
+static ORIENTATION lastOrientation = {.orAzimuth = 0xffff, .orAltitude = 0xffff, .orTwist = 0xffff };
+static ROTATION lastRotation = {.roPitch = 0xffff, .roRoll = 0xffff, .roYaw = 0xffff };
/* Reference: http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html
*
@@ -839,6 +846,55 @@ static int cursor_from_device(DWORD deviceid, LPWTI_CURSORS_INFO *cursorp)
return -1;
}
+static DWORD get_changed_state( WTPACKET *pkt)
+{
+ DWORD change = 0;
+ if (pkt->pkX != lastX)
+ {
+ change |= PK_X;
+ lastX = pkt->pkX;
+ }
+ if (pkt->pkY != lastY)
+ {
+ change |= PK_Y;
+ lastY = pkt->pkY;
+ }
+ if (pkt->pkNormalPressure != lastNormalPressure)
+ {
+ change |= PK_NORMAL_PRESSURE;
+ lastNormalPressure = pkt->pkNormalPressure;
+ }
+ if (pkt->pkTangentPressure != lastTangentPressure)
+ {
+ change |= PK_TANGENT_PRESSURE;
+ lastTangentPressure = pkt->pkTangentPressure;
+ }
+ if (pkt->pkCursor != lastCursor)
+ {
+ change |= PK_CURSOR;
+ lastCursor = pkt->pkCursor;
+ }
+ if (pkt->pkButtons != lastButtons)
+ {
+ change |= PK_BUTTONS;
+ lastButtons = pkt->pkButtons;
+ }
+ if (pkt->pkOrientation.orAzimuth != lastOrientation.orAzimuth || pkt->pkOrientation.orAltitude != lastOrientation.orAltitude ||
+ pkt->pkOrientation.orTwist != lastOrientation.orTwist)
+ {
+ change |= PK_ORIENTATION;
+ lastOrientation = pkt->pkOrientation;
+ }
+ if (pkt->pkRotation.roPitch != lastRotation.roPitch || pkt->pkRotation.roRoll != lastRotation.roRoll ||
+ pkt->pkRotation.roYaw != lastRotation.roYaw)
+ {
+ change |= PK_ROTATION;
+ lastRotation = pkt->pkRotation;
+ }
+
+ return change;
+}
+
static BOOL motion_event( HWND hwnd, XEvent *event )
{
XDeviceMotionEvent *motion = (XDeviceMotionEvent *)event;
@@ -865,6 +921,7 @@ static BOOL motion_event( HWND hwnd, XEvent *event )
* (gMsgPacket.pkStatus & TPS_INVERT?-1:1));
gMsgPacket.pkNormalPressure = motion->axis_data[2];
gMsgPacket.pkButtons = get_button_state(curnum);
+ gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
return TRUE;
}
@@ -895,6 +952,7 @@ static BOOL button_event( HWND hwnd, XEvent *event )
* (gMsgPacket.pkStatus & TPS_INVERT?-1:1));
gMsgPacket.pkNormalPressure = button->axis_data[2];
gMsgPacket.pkButtons = get_button_state(curnum);
+ gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
return TRUE;
}
--
1.9.1