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.
This commit is contained in:
Danny Smith 2004-10-15 01:18:11 +00:00
parent 902edd4512
commit 12a638f990
5 changed files with 153 additions and 96 deletions

View File

@ -1,3 +1,29 @@
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> 2004-10-11 Robert Wruck <wruck@tweerlei.de>
* include/ddk/winddk.h (IoReleaseRemoveLockAndWait): Fix * include/ddk/winddk.h (IoReleaseRemoveLockAndWait): Fix

View File

@ -19,9 +19,10 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* DEFINES: * DEFINES:
* DBG - Debugging enabled/disabled (0/1) * DBG - Debugging enabled/disabled (0/1)
* POOL_TAGGING - Enable pool tagging * POOL_TAGGING - Enable pool tagging
* _X86_ - X86 environment * _X86_ - X86 environment
* __USE_NTOSKRNL__ - Use ntoskrnl.exe exports instead of kernel32.dll
*/ */
#ifndef __NTDDK_H #ifndef __NTDDK_H
@ -31,6 +32,10 @@
#pragma GCC system_header #pragma GCC system_header
#endif #endif
#ifndef __USE_NTOSKRNL__
#define __USE_NTOSKRNL__ 1
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -3809,6 +3809,11 @@ KeGetCurrentIrql(
#define KeGetCurrentProcessorNumber() \ #define KeGetCurrentProcessorNumber() \
((ULONG)KeGetCurrentKPCR()->ProcessorNumber) ((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) #if !defined(__INTERLOCKED_DECLARED)
#define __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED
@ -3865,7 +3870,22 @@ InterlockedExchangeAdd(
#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \ #define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) 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 /* !__INTERLOCKED_DECLARED */
#endif /* __USE_NTOSKRNL__ */
NTOSAPI NTOSAPI
VOID VOID
@ -4150,23 +4170,6 @@ RemoveTailList(
return Entry; 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 * USHORT
* QueryDepthSList( * QueryDepthSList(
@ -5063,18 +5066,52 @@ ExAcquireSharedWaitForExclusive(
IN PERESOURCE Resource, IN PERESOURCE Resource,
IN BOOLEAN Wait); 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 static __inline PVOID
ExAllocateFromNPagedLookasideList( ExAllocateFromNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside) IN PNPAGED_LOOKASIDE_LIST Lookaside)
{ {
PVOID Entry; PVOID Entry;
Lookaside->TotalAllocates++; Lookaside->TotalAllocates++;
Entry = InterlockedPopEntrySList(&Lookaside->ListHead); Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
if (Entry == NULL) { &Lookaside->Obsoleted);
Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++; if (Entry == NULL) {
Entry = (Lookaside->Allocate)(Lookaside->Type, Lookaside->Size, Lookaside->Tag); Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
} Entry = (Lookaside->Allocate)(Lookaside->Type,
Lookaside->Size,
Lookaside->Tag);
}
return Entry; return Entry;
} }
@ -5085,15 +5122,49 @@ ExAllocateFromPagedLookasideList(
PVOID Entry; PVOID Entry;
Lookaside->TotalAllocates++; Lookaside->TotalAllocates++;
Entry = InterlockedPopEntrySList(&Lookaside->ListHead); Entry = ExInterlockedPopEntrySList(&Lookaside->ListHead,
&Lookaside->Obsoleted);
if (Entry == NULL) { if (Entry == NULL) {
Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++; Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
Entry = (Lookaside->Allocate)(Lookaside->Type, Entry = (Lookaside->Allocate)(Lookaside->Type,
Lookaside->Size, Lookaside->Tag); Lookaside->Size,
Lookaside->Tag);
} }
return Entry; 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 NTOSAPI
PVOID PVOID
DDKAPI DDKAPI
@ -5194,37 +5265,6 @@ ExFreePoolWithTag(
IN PVOID P, IN PVOID P,
IN ULONG Tag); 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 * ERESOURCE_THREAD
* ExGetCurrentResourceThread( * ExGetCurrentResourceThread(
@ -5404,15 +5444,6 @@ ExfInterlockedPopEntryList(
IN PSINGLE_LIST_ENTRY ListHead, IN PSINGLE_LIST_ENTRY ListHead,
IN PKSPIN_LOCK Lock); IN PKSPIN_LOCK Lock);
/*
* PSINGLE_LIST_ENTRY
* ExInterlockedPopEntrySList(
* IN PSLIST_HEADER ListHead,
* IN PKSPIN_LOCK Lock)
*/
#define ExInterlockedPopEntrySList(_ListHead, \
_Lock) \
InterlockedPopEntrySList(_ListHead)
NTOSAPI NTOSAPI
PSINGLE_LIST_ENTRY PSINGLE_LIST_ENTRY
@ -5430,17 +5461,6 @@ ExfInterlockedPushEntryList(
IN PSINGLE_LIST_ENTRY ListEntry, IN PSINGLE_LIST_ENTRY ListEntry,
IN PKSPIN_LOCK Lock); 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 NTOSAPI
PLIST_ENTRY PLIST_ENTRY

View File

@ -1574,7 +1574,11 @@ WINBASEAPI BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,
WINBASEAPI DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD); WINBASEAPI DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD);
WINBASEAPI BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD); WINBASEAPI BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
WINBASEAPI BOOL WINAPI InitializeSid (PSID,PSID_IDENTIFIER_AUTHORITY,BYTE); WINBASEAPI BOOL WINAPI InitializeSid (PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
#if !defined(__WINDDK_H) && _WIN32_WINNT >= 0x0501
#if !(__USE_NTOSKRNL__)
/* CAREFUL: These are exported from ntoskrnl.exe and declared in winddk.h
as __fastcall functions, but are exported from kernel32.dll as __stdcall */
#if (_WIN32_WINNT >= 0x0501)
WINBASEAPI VOID WINAPI InitializeSListHead(PSLIST_HEADER); WINBASEAPI VOID WINAPI InitializeSListHead(PSLIST_HEADER);
#endif #endif
#ifndef __INTERLOCKED_DECLARED #ifndef __INTERLOCKED_DECLARED
@ -1598,6 +1602,8 @@ PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER);
PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY); PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY);
#endif #endif
#endif /* __INTERLOCKED_DECLARED */ #endif /* __INTERLOCKED_DECLARED */
#endif /* __USE_NTOSKRNL__ */
WINBASEAPI BOOL WINAPI IsBadCodePtr(FARPROC); WINBASEAPI BOOL WINAPI IsBadCodePtr(FARPROC);
WINBASEAPI BOOL WINAPI IsBadHugeReadPtr(PCVOID,UINT); WINBASEAPI BOOL WINAPI IsBadHugeReadPtr(PCVOID,UINT);
WINBASEAPI BOOL WINAPI IsBadHugeWritePtr(PVOID,UINT); WINBASEAPI BOOL WINAPI IsBadHugeWritePtr(PVOID,UINT);

View File

@ -71,10 +71,10 @@ ExCreateCallback@16
ExDeleteNPagedLookasideList@4 ExDeleteNPagedLookasideList@4
ExDeletePagedLookasideList@4 ExDeletePagedLookasideList@4
ExDeleteResourceLite@4 ExDeleteResourceLite@4
;ExDesktopObjectType DATA ExDesktopObjectType DATA
;ExDisableResourceBoostLite ;ExDisableResourceBoostLite
;ExEnumHandleTable ;ExEnumHandleTable
;ExEventObjectType DATA ExEventObjectType DATA
ExExtendZone@12 ExExtendZone@12
@Exfi386InterlockedDecrementLong@4 @Exfi386InterlockedDecrementLong@4
@Exfi386InterlockedExchangeUlong@8 @Exfi386InterlockedExchangeUlong@8
@ -113,9 +113,9 @@ ExInterlockedExtendZone@16
ExInterlockedInsertHeadList@12 ExInterlockedInsertHeadList@12
ExInterlockedInsertTailList@12 ExInterlockedInsertTailList@12
ExInterlockedPopEntryList@8 ExInterlockedPopEntryList@8
;ExInterlockedPopEntrySList @ExInterlockedPopEntrySList@8
ExInterlockedPushEntryList@12 ExInterlockedPushEntryList@12
;ExInterlockedPushEntrySList @ExInterlockedPushEntrySList@12
ExInterlockedRemoveHeadList@8 ExInterlockedRemoveHeadList@8
ExIsProcessorFeaturePresent@4 ExIsProcessorFeaturePresent@4
ExIsResourceAcquiredExclusiveLite@4 ExIsResourceAcquiredExclusiveLite@4
@ -137,7 +137,7 @@ ExReleaseResourceForThreadLite@8
@ExReleaseResourceLite@4 @ExReleaseResourceLite@4
;ExReleaseRundownProtection ;ExReleaseRundownProtection
;ExRundownCompleted ;ExRundownCompleted
;ExSemaphoreObjectType DATA ExSemaphoreObjectType DATA
ExSetResourceOwnerPointer@8 ExSetResourceOwnerPointer@8
ExSetTimerResolution@8 ExSetTimerResolution@8
;ExSystemExceptionFilter ;ExSystemExceptionFilter
@ -146,7 +146,7 @@ ExUnregisterCallback@4
ExUuidCreate@4 ExUuidCreate@4
ExVerifySuite@4 ExVerifySuite@4
;ExWaitForRundownProtectionRelease ;ExWaitForRundownProtectionRelease
;ExWindowStationObjectType DATA ExWindowStationObjectType DATA
;FsRtlAcquireFileExclusive ;FsRtlAcquireFileExclusive
;FsRtlAddLargeMcbEntry ;FsRtlAddLargeMcbEntry
;FsRtlAddMcbEntry ;FsRtlAddMcbEntry
@ -280,7 +280,7 @@ FsRtlIsTotalDeviceFailure@4
IoAcquireCancelSpinLock@4 IoAcquireCancelSpinLock@4
IoAcquireRemoveLockEx@20 IoAcquireRemoveLockEx@20
;IoAcquireVpbSpinLock ;IoAcquireVpbSpinLock
;IoAdapterObjectType DATA IoAdapterObjectType DATA
IoAllocateAdapterChannel@20 IoAllocateAdapterChannel@20
IoAllocateController@16 IoAllocateController@16
IoAllocateDriverObjectExtension@16 IoAllocateDriverObjectExtension@16
@ -332,15 +332,15 @@ IoDeleteDevice@4
;IoDeleteDriver ;IoDeleteDriver
IoDeleteSymbolicLink@4 IoDeleteSymbolicLink@4
IoDetachDevice@4 IoDetachDevice@4
;IoDeviceHandlerObjectSize DATA IoDeviceHandlerObjectSize DATA
;IoDeviceHandlerObjectType DATA IoDeviceHandlerObjectType DATA
;IoDeviceObjectType DATA IoDeviceObjectType DATA
IoDisconnectInterrupt@4 IoDisconnectInterrupt@4
;IoDriverObjectType DATA IoDriverObjectType DATA
;IoEnqueueIrp ;IoEnqueueIrp
;IoEnumerateDeviceObjectList ;IoEnumerateDeviceObjectList
;IoFastQueryNetworkAttributes ;IoFastQueryNetworkAttributes
;IoFileObjectType DATA IoFileObjectType DATA
;IoForwardAndCatchIrp ;IoForwardAndCatchIrp
IoForwardIrpSynchronously@8 IoForwardIrpSynchronously@8
IoFreeController@4 IoFreeController@4
@ -625,7 +625,7 @@ KeWaitForSingleObject@20
;LdrEnumResources ;LdrEnumResources
;LdrFindResourceDirectory_U ;LdrFindResourceDirectory_U
;LdrFindResource_U ;LdrFindResource_U
;LpcPortObjectType DATA LpcPortObjectType DATA
;LpcRequestPort ;LpcRequestPort
;LpcRequestWaitReplyPort ;LpcRequestWaitReplyPort
;LsaCallAuthenticationPackage ;LsaCallAuthenticationPackage
@ -692,7 +692,7 @@ MmProtectMdlSystemAddress@8
MmQuerySystemSize@0 MmQuerySystemSize@0
MmRemovePhysicalMemory@8 MmRemovePhysicalMemory@8
MmResetDriverPaging@4 MmResetDriverPaging@4
;MmSectionObjectType DATA MmSectionObjectType DATA
MmSecureVirtualMemory@12 MmSecureVirtualMemory@12
;MmSetAddressRangeModified ;MmSetAddressRangeModified
;MmSetBankedSection ;MmSetBankedSection
@ -1226,7 +1226,7 @@ SeSinglePrivilegeCheck@8
;SeTokenImpersonationLevel ;SeTokenImpersonationLevel
;SeTokenIsAdmin ;SeTokenIsAdmin
;SeTokenIsRestricted ;SeTokenIsRestricted
;SeTokenObjectType DATA SeTokenObjectType DATA
;SeTokenType ;SeTokenType
;SeUnlockSubjectContext ;SeUnlockSubjectContext
;SeUnregisterLogonSessionTerminatedRoutine ;SeUnregisterLogonSessionTerminatedRoutine