From: Amine Khaldi Date: Wed, 3 Mar 2010 16:03:14 +0000 (+0000) Subject: - Move ntdef.h from ddk to psdk X-Git-Tag: backups/header-work@57446~271 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=d944603372bcab9e8b37a16c657c72b51755f583 - Move ntdef.h from ddk to psdk - Move EVENT_TYPE to ntdef.h - Introduce pragma once to wdm.h - Fix FAST_MUTEX - FastMutex->Gate => FastMutex->Event - Improve KeInitializeEvent - Improve InitializeSListHead svn path=/branches/header-work/; revision=45789 --- diff --git a/hal/halppc/generic/fmutex.c b/hal/halppc/generic/fmutex.c index 8ec41f4ce11..134ca7a464a 100644 --- a/hal/halppc/generic/fmutex.c +++ b/hal/halppc/generic/fmutex.c @@ -39,7 +39,7 @@ ExAcquireFastMutex(PFAST_MUTEX FastMutex) { /* Someone is still holding it, use slow path */ FastMutex->Contention++; - KeWaitForSingleObject(&FastMutex->Gate, + KeWaitForSingleObject(&FastMutex->Event, WrExecutive, KernelMode, FALSE, @@ -65,7 +65,7 @@ ExReleaseFastMutex(PFAST_MUTEX FastMutex) if (InterlockedIncrement(&FastMutex->Count) <= 0) { /* Someone was waiting for it, signal the waiter */ - KeSetEventBoostPriority(&FastMutex->Gate, IO_NO_INCREMENT); + KeSetEventBoostPriority(&FastMutex->Event, IO_NO_INCREMENT); } /* Lower IRQL back */ diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 403e18ab82d..fe58694645c 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1,5 +1,4 @@ -#ifndef _WDMDDK_ -#define _WDMDDK_ +#pragma once /* Helper macro to enable gcc's extension. */ #ifndef __GNU_EXTENSION @@ -1476,11 +1475,14 @@ KeTestSpinLock( ); #endif -#if (NTDDI_VERSION >= NTDDI_WS03SP1) +/* FIXME : #if (NTDDI_VERSION >= NTDDI_WS03SP1) */ NTKERNELAPI BOOLEAN KeAreAllApcsDisabled( VOID); +/* #endif (NTDDI_VERSION >= NTDDI_WS03SP1) */ + +#if (NTDDI_VERSION >= NTDDI_WS03SP1) /* Guarded Mutex routines */ @@ -1550,18 +1552,6 @@ KeInitializeEvent( IN EVENT_TYPE Type, IN BOOLEAN State); -FORCEINLINE -VOID -ExInitializeFastMutex( - OUT PFAST_MUTEX FastMutex) -{ - FastMutex->Count = FM_LOCK_BIT; - FastMutex->Owner = NULL; - FastMutex->Contention = 0; - KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE); - return; -} - #if DBG #if (NTDDI_VERSION >= NTDDI_VISTA) @@ -3853,13 +3843,12 @@ typedef struct _FILE_FULL_EA_INFORMATION { CHAR EaName[1]; } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION; -typedef struct _FAST_MUTEX -{ - LONG Count; - PKTHREAD Owner; - ULONG Contention; - KEVENT Gate; - ULONG OldIrql; +typedef struct _FAST_MUTEX { + volatile LONG Count; + PKTHREAD Owner; + ULONG Contention; + KEVENT Event; + ULONG OldIrql; } FAST_MUTEX, *PFAST_MUTEX; typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD; @@ -7320,6 +7309,18 @@ ExInterlockedPushEntrySList( (Item)->List.Flink = NULL; \ } +FORCEINLINE +VOID +ExInitializeFastMutex( + OUT PFAST_MUTEX FastMutex) +{ + FastMutex->Count = FM_LOCK_BIT; + FastMutex->Owner = NULL; + FastMutex->Contention = 0; + KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE); + return; +} + #if (NTDDI_VERSION >= NTDDI_WIN2K) NTKERNELAPI @@ -7924,5 +7925,3 @@ typedef VOID #ifdef __cplusplus } #endif - -#endif // _WDMDDK_ diff --git a/include/ddk/winddk.h b/include/ddk/winddk.h index df6665b1a28..57fc7ce99b6 100644 --- a/include/ddk/winddk.h +++ b/include/ddk/winddk.h @@ -1224,11 +1224,6 @@ typedef BOOLEAN struct _RTL_RANGE *Range ); -typedef enum _EVENT_TYPE { - NotificationEvent, - SynchronizationEvent -} EVENT_TYPE; - typedef struct _CONFIGURATION_INFORMATION { ULONG DiskCount; ULONG FloppyCount; diff --git a/include/ddk/ntdef.h b/include/psdk/ntdef.h similarity index 99% rename from include/ddk/ntdef.h rename to include/psdk/ntdef.h index 72343acfbc6..3ca39254597 100644 --- a/include/ddk/ntdef.h +++ b/include/psdk/ntdef.h @@ -87,6 +87,10 @@ typedef unsigned long POINTER_64; // FIXME! HACK!!! #endif #endif // NULL +typedef enum _EVENT_TYPE { + NotificationEvent, + SynchronizationEvent +} EVENT_TYPE; // // FIXME diff --git a/include/psdk/winbase.h b/include/psdk/winbase.h index ca1549f5d20..b7a5fd2776d 100644 --- a/include/psdk/winbase.h +++ b/include/psdk/winbase.h @@ -1807,9 +1807,7 @@ BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD); DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD); BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD); BOOL WINAPI InitializeSid (PSID,PSID_IDENTIFIER_AUTHORITY,BYTE); -#if !defined(__WINDDK_H) && _WIN32_WINNT >= 0x0501 -VOID WINAPI InitializeSListHead(PSLIST_HEADER); -#endif + #if (_WIN32_WINNT >= 0x0600) VOID WINAPI InitializeSRWLock(PSRWLOCK); #endif @@ -1881,7 +1879,15 @@ PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY); #endif // !(defined (_M_AMD64) || defined (_M_IA64)) -VOID WINAPI InitializeSListHead(PSLIST_HEADER); +#if defined(_SLIST_HEADER_) && !defined(_NTOSP_) + +WINBASEAPI +VOID +WINAPI +InitializeSListHead ( + IN OUT PSLIST_HEADER ListHead); +#endif + USHORT WINAPI QueryDepthSList(PSLIST_HEADER); #ifdef _MSC_VER diff --git a/ntoskrnl/include/internal/ex.h b/ntoskrnl/include/internal/ex.h index a8bf90d70fa..d981389a279 100644 --- a/ntoskrnl/include/internal/ex.h +++ b/ntoskrnl/include/internal/ex.h @@ -1251,7 +1251,7 @@ _ExReleaseFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex) if (InterlockedIncrement(&FastMutex->Count) <= 0) { /* Someone was waiting for it, signal the waiter */ - KeSetEventBoostPriority(&FastMutex->Gate, NULL); + KeSetEventBoostPriority(&FastMutex->Event, NULL); } } @@ -1292,7 +1292,7 @@ _ExReleaseFastMutex(IN OUT PFAST_MUTEX FastMutex) if (InterlockedIncrement(&FastMutex->Count) <= 0) { /* Someone was waiting for it, signal the waiter */ - KeSetEventBoostPriority(&FastMutex->Gate, NULL); + KeSetEventBoostPriority(&FastMutex->Event, NULL); } /* Lower IRQL back */ diff --git a/ntoskrnl/ke/eventobj.c b/ntoskrnl/ke/eventobj.c index 2f798a1b05c..b6457ce9507 100644 --- a/ntoskrnl/ke/eventobj.c +++ b/ntoskrnl/ke/eventobj.c @@ -32,7 +32,7 @@ KeClearEvent(IN PKEVENT Event) */ VOID NTAPI -KeInitializeEvent(IN PKEVENT Event, +KeInitializeEvent(OUT PKEVENT Event, IN EVENT_TYPE Type, IN BOOLEAN State) { diff --git a/ntoskrnl/ke/wait.c b/ntoskrnl/ke/wait.c index 74c960cf019..a4737b0b7fa 100644 --- a/ntoskrnl/ke/wait.c +++ b/ntoskrnl/ke/wait.c @@ -110,7 +110,7 @@ KiAcquireFastMutex(IN PFAST_MUTEX FastMutex) FastMutex->Contention++; /* Wait for the event */ - KeWaitForSingleObject(&FastMutex->Gate, + KeWaitForSingleObject(&FastMutex->Event, WrMutex, KernelMode, FALSE,