Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45819 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 ac577819b1..013be47040 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2373,17 +2373,6 @@ void WINAPI ExFreePoolWithTag( void *ptr, ULONG tag ) HeapFree( ntoskrnl_heap, 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 12dacae408..168c6d1642 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -717,3 +717,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 e5804c0270..a6536212b6 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*);