wine-staging/patches/ntoskrnl.exe-Resources/0001-ntoskrnl.exe-Implement-ExInitializeResourceLite.patch

133 lines
4.3 KiB
Diff
Raw Normal View History

2019-02-19 16:59:41 -08:00
From 635759b4f374469956488aaf6fa4c6307a542ee9 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 29 Jan 2019 21:33:08 -0600
Subject: [PATCH 01/13] ntoskrnl.exe: Implement ExInitializeResourceLite().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
dlls/ntoskrnl.exe/ntoskrnl.c | 11 --------
dlls/ntoskrnl.exe/sync.c | 10 +++++++
include/ddk/wdm.h | 54 +++++++++++++++++++++++++++++++++++-
3 files changed, 63 insertions(+), 12 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 4b626607..93ba89be 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -2081,17 +2081,6 @@ void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag )
HeapFree( GetProcessHeap(), 0, ptr );
}
-
-/***********************************************************************
- * ExInitializeResourceLite (NTOSKRNL.EXE.@)
- */
-NTSTATUS WINAPI ExInitializeResourceLite(PERESOURCE Resource)
-{
- FIXME( "stub: %p\n", Resource );
- return STATUS_NOT_IMPLEMENTED;
-}
-
-
/***********************************************************************
* ExInitializeNPagedLookasideList (NTOSKRNL.EXE.@)
*/
diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c
index 98b3f9d9..56d46a86 100644
--- a/dlls/ntoskrnl.exe/sync.c
+++ b/dlls/ntoskrnl.exe/sync.c
@@ -663,3 +663,13 @@ void WINAPI ExReleaseFastMutexUnsafe( FAST_MUTEX *mutex )
if (count < 1)
KeSetEvent( &mutex->Event, IO_NO_INCREMENT, FALSE );
}
+
+/***********************************************************************
+ * ExInitializeResourceLite (NTOSKRNL.EXE.@)
+ */
+NTSTATUS WINAPI ExInitializeResourceLite( ERESOURCE *resource )
+{
+ TRACE("resource %p.\n", resource);
+ memset(resource, 0, sizeof(*resource));
+ return STATUS_SUCCESS;
+}
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 293da50c..f76444f1 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -153,12 +153,63 @@ typedef struct _KWAIT_BLOCK {
USHORT WaitType;
} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
+typedef struct _OWNER_ENTRY
+{
+ ERESOURCE_THREAD OwnerThread;
+ union
+ {
+ struct
+ {
+ ULONG IoPriorityBoosted : 1;
+ ULONG OwnerReferenced : 1;
+ ULONG IoQoSPriorityBoosted : 1;
+ ULONG OwnerCount : 29;
+ };
+ ULONG TableSize;
+ };
+} OWNER_ENTRY, *POWNER_ENTRY;
+
+#define ResourceNeverExclusive 0x0010
+#define ResourceReleaseByOtherThread 0x0020
+#define ResourceOwnedExclusive 0x0080
+
+typedef struct _ERESOURCE
+{
+ LIST_ENTRY SystemResourcesList;
+ OWNER_ENTRY *OwnerTable;
+ SHORT ActiveCount;
+ union
+ {
+ USHORT Flag;
+ struct
+ {
+ UCHAR ReservedLowFlags;
+ UCHAR WaiterPriority;
+ };
+ };
+ KSEMAPHORE *SharedWaiters;
+ KEVENT *ExclusiveWaiters;
+ OWNER_ENTRY OwnerEntry;
+ ULONG ActiveEntries;
+ ULONG ContentionCount;
+ ULONG NumberOfSharedWaiters;
+ ULONG NumberOfExclusiveWaiters;
+#ifdef _WIN64
+ void *Reserved2;
+#endif
+ union
+ {
+ void *Address;
+ ULONG_PTR CreatorBackTraceIndex;
+ };
+ KSPIN_LOCK SpinLock;
+} ERESOURCE, *PERESOURCE;
+
typedef struct _IO_TIMER *PIO_TIMER;
typedef struct _IO_TIMER_ROUTINE *PIO_TIMER_ROUTINE;
typedef struct _ETHREAD *PETHREAD;
typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
typedef struct _EPROCESS *PEPROCESS;
-typedef struct _ERESOURCE *PERESOURCE;
typedef struct _IO_WORKITEM *PIO_WORKITEM;
typedef struct _PAGED_LOOKASIDE_LIST *PPAGED_LOOKASIDE_LIST;
typedef struct _OBJECT_TYPE *POBJECT_TYPE;
@@ -1469,6 +1520,7 @@ void WINAPI ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST);
void WINAPI ExFreePool(PVOID);
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
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);
PSLIST_ENTRY WINAPI ExInterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY,PKSPIN_LOCK);
LIST_ENTRY * WINAPI ExInterlockedRemoveHeadList(LIST_ENTRY*,KSPIN_LOCK*);
--
2.20.1