+2004-10-15 Robert Wruck <wruck@tweerlei.de>
+ Danny Smith <dannysmith@users.sourceforge.net>
+
+ = include/winbase.h (InitializeSListHead, Interlocked*):
+ Guard with !__USE_NTOSKRNL__.
+
+ * include/ddk/ntddk.h (__USE_NTOSKRNL__): Define.
+ * include/ddk/winddk.h (InitializeSListHead, Interlocked*):
+ Guard with __USE_NTOSKRNL__.
+ (ExInterlockedPopEntrySList, ExInterlockedPushEntrySList):
+ Add prototypes. Guard macro definition with __USE_NTOSKRNL__
+ && _WIN32_WINNT >= 0x0501
+ (ExAllocateFromNPagedLookasideList, ExAllocateFromPagedLookasideList,
+ ExFreeToNPagedLookasideList, ExFreeToPagedLookasideList):
+ Replace calts to InterlockedPopEntrySList, InterlockedPushEntrySList
+ with ExInterlockedPopEntrySList, ExInterlockedPushEntrySList.
+
+ * lib/ddk/ntosknl.def (ExInterlockedPopEntrySList,
+ ExInterlockedPushEntrySList) Add stubs with fastcall decoration.
+ (ExDesktopObjectType, ExEventObjectType, ExSemaphoreObjectType,
+ ExWindowStationObjectType, IoAdapterObjectType,
+ IoDeviceHandlerObjectSize, IoDeviceHandlerObjectType,
+ IoDeviceObjectType, IoDriverObjectType, IoFileObjectType,
+ LpcPortObjectType, MmSectionObjectType, SeTokenObjectType):
+ Uncomment stubs.
+
2004-10-11 Robert Wruck <wruck@tweerlei.de>
* include/ddk/winddk.h (IoReleaseRemoveLockAndWait): Fix
#define KeGetCurrentProcessorNumber() \
((ULONG)KeGetCurrentKPCR()->ProcessorNumber)
+
+#if __USE_NTOSKRNL__
+/* CAREFUL: These are exported from ntoskrnl.exe as __fastcall functions,
+ but are also exported from kernel32.dll and declared in winbase.h as
+ __stdcall */
#if !defined(__INTERLOCKED_DECLARED)
#define __INTERLOCKED_DECLARED
#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
+#if (_WIN32_WINNT >= 0x0501)
+PSLIST_ENTRY
+DDKFASTAPI
+InterlockedPopEntrySList(
+ IN PSLIST_HEADER ListHead);
+
+NTOSAPI
+PSLIST_ENTRY
+DDKFASTAPI
+InterlockedPushEntrySList(
+ IN PSLIST_HEADER ListHead,
+ IN PSLIST_ENTRY ListEntry);
+#endif /* _WIN32_WINNT >= 0x0501 */
+
#endif /* !__INTERLOCKED_DECLARED */
+#endif /* __USE_NTOSKRNL__ */
NTOSAPI
VOID
return Entry;
}
-#if !defined(_WINBASE_H) || _WIN32_WINNT < 0x0501
-
-NTOSAPI
-PSLIST_ENTRY
-DDKFASTAPI
-InterlockedPopEntrySList(
- IN PSLIST_HEADER ListHead);
-
-NTOSAPI
-PSLIST_ENTRY
-DDKFASTAPI
-InterlockedPushEntrySList(
- IN PSLIST_HEADER ListHead,
- IN PSLIST_ENTRY ListEntry);
-
-#endif
-
/*
* USHORT
* QueryDepthSList(
IN PERESOURCE Resource,
IN BOOLEAN Wait);
+
+NTOSAPI
+PSINGLE_LIST_ENTRY
+DDKFASTAPI
+ExInterlockedPopEntrySList(
+ IN PSLIST_HEADER ListHead,
+ IN PKSPIN_LOCK Lock);
+
+
+NTOSAPI
+PSINGLE_LIST_ENTRY
+DDKFASTAPI
+ExInterlockedPushEntrySList(
+ IN PSLIST_HEADER ListHead,
+ IN PSINGLE_LIST_ENTRY ListEntry,
+ IN PKSPIN_LOCK Lock);
+
+
+#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= 0x0501)
+#define ExInterlockedPopEntrySList(_ListHead, \
+ _Lock) \
+ InterlockedPopEntrySList(_ListHead)
+
+#define ExInterlockedPushEntrySList(_ListHead, \
+ _ListEntry, \
+ _Lock) \
+ InterlockedPushEntrySList(_ListHead, _ListEntry)
+#endif /* __USE_NTOSKRNL__ */
+
+#define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
+
static __inline PVOID
ExAllocateFromNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside)
{
- PVOID Entry;
+ PVOID Entry;
- Lookaside->TotalAllocates++;
- Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
- if (Entry == NULL) {
- Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
- Entry = (Lookaside->Allocate)(Lookaside->Type, Lookaside->Size, Lookaside->Tag);
- }
+ Lookaside->TotalAllocates++;
+ Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
+ &Lookaside->Obsoleted);
+ if (Entry == NULL) {
+ Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
+ Entry = (Lookaside->Allocate)(Lookaside->Type,
+ Lookaside->Size,
+ Lookaside->Tag);
+ }
return Entry;
}
PVOID Entry;
Lookaside->TotalAllocates++;
- Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
+ Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
+ &Lookaside->Obsoleted);
if (Entry == NULL) {
Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
Entry = (Lookaside->Allocate)(Lookaside->Type,
- Lookaside->Size, Lookaside->Tag);
+ Lookaside->Size,
+ Lookaside->Tag);
}
return Entry;
}
+static __inline VOID
+ExFreeToNPagedLookasideList(
+ IN PNPAGED_LOOKASIDE_LIST Lookaside,
+ IN PVOID Entry)
+{
+ Lookaside->TotalFrees++;
+ if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
+ Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
+ (Lookaside->Free)(Entry);
+ } else {
+ ExInterlockedPushEntrySList(&Lookaside->ListHead,
+ (PSLIST_ENTRY)Entry,
+ &Lookaside->Obsoleted);
+ }
+}
+
+static __inline VOID
+ExFreeToPagedLookasideList(
+ IN PPAGED_LOOKASIDE_LIST Lookaside,
+ IN PVOID Entry)
+{
+ Lookaside->TotalFrees++;
+ if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
+ Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
+ (Lookaside->Free)(Entry);
+ } else {
+ ExInterlockedPushEntrySList(&Lookaside->ListHead,
+ (PSLIST_ENTRY)Entry,
+ &Lookaside->Obsoleted);
+ }
+}
+
NTOSAPI
PVOID
DDKAPI
IN PVOID P,
IN ULONG Tag);
-#define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
-
-static __inline VOID
-ExFreeToNPagedLookasideList(
- IN PNPAGED_LOOKASIDE_LIST Lookaside,
- IN PVOID Entry)
-{
- Lookaside->TotalFrees++;
- if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
- Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
- (Lookaside->Free)(Entry);
- } else {
- InterlockedPushEntrySList(&Lookaside->ListHead,
- (PSLIST_ENTRY)Entry);
- }
-}
-
-static __inline VOID
-ExFreeToPagedLookasideList(
- IN PPAGED_LOOKASIDE_LIST Lookaside,
- IN PVOID Entry)
-{
- Lookaside->TotalFrees++;
- if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
- Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
- (Lookaside->Free)(Entry);
- } else {
- InterlockedPushEntrySList(&Lookaside->ListHead, (PSLIST_ENTRY)Entry);
- }
-}
-
/*
* ERESOURCE_THREAD
* ExGetCurrentResourceThread(
IN PSINGLE_LIST_ENTRY ListHead,
IN PKSPIN_LOCK Lock);
-/*
- * PSINGLE_LIST_ENTRY
- * ExInterlockedPopEntrySList(
- * IN PSLIST_HEADER ListHead,
- * IN PKSPIN_LOCK Lock)
- */
-#define ExInterlockedPopEntrySList(_ListHead, \
- _Lock) \
- InterlockedPopEntrySList(_ListHead)
NTOSAPI
PSINGLE_LIST_ENTRY
IN PSINGLE_LIST_ENTRY ListEntry,
IN PKSPIN_LOCK Lock);
-/*
- * PSINGLE_LIST_ENTRY FASTCALL
- * ExInterlockedPushEntrySList(
- * IN PSLIST_HEADER ListHead,
- * IN PSINGLE_LIST_ENTRY ListEntry,
- * IN PKSPIN_LOCK Lock)
- */
-#define ExInterlockedPushEntrySList(_ListHead, \
- _ListEntry, \
- _Lock) \
- InterlockedPushEntrySList(_ListHead, _ListEntry)
NTOSAPI
PLIST_ENTRY
ExDeleteNPagedLookasideList@4
ExDeletePagedLookasideList@4
ExDeleteResourceLite@4
-;ExDesktopObjectType DATA
+ExDesktopObjectType DATA
;ExDisableResourceBoostLite
;ExEnumHandleTable
-;ExEventObjectType DATA
+ExEventObjectType DATA
ExExtendZone@12
@Exfi386InterlockedDecrementLong@4
@Exfi386InterlockedExchangeUlong@8
ExInterlockedInsertHeadList@12
ExInterlockedInsertTailList@12
ExInterlockedPopEntryList@8
-;ExInterlockedPopEntrySList
+@ExInterlockedPopEntrySList@8
ExInterlockedPushEntryList@12
-;ExInterlockedPushEntrySList
+@ExInterlockedPushEntrySList@12
ExInterlockedRemoveHeadList@8
ExIsProcessorFeaturePresent@4
ExIsResourceAcquiredExclusiveLite@4
@ExReleaseResourceLite@4
;ExReleaseRundownProtection
;ExRundownCompleted
-;ExSemaphoreObjectType DATA
+ExSemaphoreObjectType DATA
ExSetResourceOwnerPointer@8
ExSetTimerResolution@8
;ExSystemExceptionFilter
ExUuidCreate@4
ExVerifySuite@4
;ExWaitForRundownProtectionRelease
-;ExWindowStationObjectType DATA
+ExWindowStationObjectType DATA
;FsRtlAcquireFileExclusive
;FsRtlAddLargeMcbEntry
;FsRtlAddMcbEntry
IoAcquireCancelSpinLock@4
IoAcquireRemoveLockEx@20
;IoAcquireVpbSpinLock
-;IoAdapterObjectType DATA
+IoAdapterObjectType DATA
IoAllocateAdapterChannel@20
IoAllocateController@16
IoAllocateDriverObjectExtension@16
;IoDeleteDriver
IoDeleteSymbolicLink@4
IoDetachDevice@4
-;IoDeviceHandlerObjectSize DATA
-;IoDeviceHandlerObjectType DATA
-;IoDeviceObjectType DATA
+IoDeviceHandlerObjectSize DATA
+IoDeviceHandlerObjectType DATA
+IoDeviceObjectType DATA
IoDisconnectInterrupt@4
-;IoDriverObjectType DATA
+IoDriverObjectType DATA
;IoEnqueueIrp
;IoEnumerateDeviceObjectList
;IoFastQueryNetworkAttributes
-;IoFileObjectType DATA
+IoFileObjectType DATA
;IoForwardAndCatchIrp
IoForwardIrpSynchronously@8
IoFreeController@4
;LdrEnumResources
;LdrFindResourceDirectory_U
;LdrFindResource_U
-;LpcPortObjectType DATA
+LpcPortObjectType DATA
;LpcRequestPort
;LpcRequestWaitReplyPort
;LsaCallAuthenticationPackage
MmQuerySystemSize@0
MmRemovePhysicalMemory@8
MmResetDriverPaging@4
-;MmSectionObjectType DATA
+MmSectionObjectType DATA
MmSecureVirtualMemory@12
;MmSetAddressRangeModified
;MmSetBankedSection
;SeTokenImpersonationLevel
;SeTokenIsAdmin
;SeTokenIsRestricted
-;SeTokenObjectType DATA
+SeTokenObjectType DATA
;SeTokenType
;SeUnlockSubjectContext
;SeUnregisterLogonSessionTerminatedRoutine