On 04/09/2019 02:29 PM, Derek Lesho wrote:
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 399258cdfd..f4e6d8f710 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -1,4 +1,5 @@ @ stdcall -fastcall ExAcquireFastMutexUnsafe(ptr) +@ stdcall ExAcquireFastMutex(ptr) @ stub ExAcquireRundownProtection @ stub ExAcquireRundownProtectionEx @ stub ExInitializeRundownProtection @@ -9,6 +10,7 @@ @ stdcall -fastcall -arch=i386 ExInterlockedPushEntrySList (ptr ptr ptr) NTOSKRNL_ExInterlockedPushEntrySList @ stub ExReInitializeRundownProtection @ stdcall -fastcall ExReleaseFastMutexUnsafe(ptr) +@ stdcall ExReleaseFastMutex(ptr) @ stdcall ExReleaseResourceLite(ptr) @ stub ExReleaseRundownProtection @ stub ExReleaseRundownProtectionEx
I don't remember offhand, but I think these functions shouldn't be exported on i386 (they're exported from hal instead).
diff --git a/dlls/ntoskrnl.exe/ntoskrnl_private.h b/dlls/ntoskrnl.exe/ntoskrnl_private.h index 940ff526f9..84f8387262 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -38,6 +38,7 @@ struct _KTHREAD CLIENT_ID id; PEPROCESS process; BOOLEAN critical_region;
- UCHAR irql;
};
void *alloc_kernel_object( POBJECT_TYPE type, HANDLE handle, SIZE_T size, LONG ref ) DECLSPEC_HIDDEN; diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index bb2d318e56..15a602d3f4 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -689,3 +689,37 @@ void WINAPI ExReleaseFastMutexUnsafe( FAST_MUTEX *mutex ) if (InterlockedIncrement(&mutex->Count) < 1) KeSetEvent( &mutex->Event, IO_NO_INCREMENT, FALSE ); }
+/*********************************************************************
ExAcquireFastMutex (NTOSKRNL.@)
- */
+DEFINE_FASTCALL1_WRAPPER(ExAcquireFastMutex) +void WINAPI ExAcquireFastMutex(PFAST_MUTEX mutex) +{
- KIRQL old_irql;
- PKTHREAD thread = KeGetCurrentThread();
- /* The safe variant raises thread to APC_LEVEL */
This comment seems superfluous.
- old_irql = thread->irql;
- thread->irql = APC_LEVEL;
This should probably be KeRaiseIrql() instead (and similarly KeLowerIrql() below), assuming that we ever will need to emulate proper IRQL handling. That said, is it really necessary right now? You don't use it in this patch.
- ExAcquireFastMutexUnsafe( mutex );
- mutex->OldIrql = old_irql;
+}
- /*********************************************************************
ExReleaseFastMutex (NTOSKRNL.@)
- */
+DEFINE_FASTCALL1_WRAPPER(ExReleaseFastMutex) +void WINAPI ExReleaseFastMutex(PFAST_MUTEX mutex) +{
- KIRQL old_irql = mutex->OldIrql;
- PKTHREAD thread = mutex->Owner;
- ExReleaseFastMutexUnsafe( mutex );
- thread->irql = old_irql;
+}