Something went wrong. Try again.
Reactos
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556/****************************************************************************** * Executive Functions * ******************************************************************************/
$if (_WDMDDK_)#define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)#define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)#define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql))#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql))#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock)#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock)
#define ExInitializeSListHead InitializeSListHead
#if defined(_NTHAL_) && defined(_X86_)
NTKERNELAPIVOIDFASTCALLExiAcquireFastMutex( IN OUT PFAST_MUTEX FastMutex);
NTKERNELAPIVOIDFASTCALLExiReleaseFastMutex( IN OUT PFAST_MUTEX FastMutex);
NTKERNELAPIBOOLEANFASTCALLExiTryToAcquireFastMutex( IN OUT PFAST_MUTEX FastMutex);
#define ExAcquireFastMutex ExiAcquireFastMutex#define ExReleaseFastMutex ExiReleaseFastMutex#define ExTryToAcquireFastMutex ExiTryToAcquireFastMutex
#else
#if (NTDDI_VERSION >= NTDDI_WIN2K)
_IRQL_raises_(APC_LEVEL)_IRQL_saves_global_(OldIrql, FastMutex)NTKERNELAPIVOIDFASTCALLExAcquireFastMutex( _Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_lock_(*_Curr_) PFAST_MUTEX FastMutex);
_IRQL_requires_(APC_LEVEL)_IRQL_restores_global_(OldIrql, FastMutex)NTKERNELAPIVOIDFASTCALLExReleaseFastMutex( _Inout_ _Requires_lock_held_(*_Curr_) _Releases_lock_(*_Curr_) PFAST_MUTEX FastMutex);
_Must_inspect_result__Success_(return!=FALSE)_IRQL_raises_(APC_LEVEL)_IRQL_saves_global_(OldIrql, FastMutex)NTKERNELAPIBOOLEANFASTCALLExTryToAcquireFastMutex( _Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_lock_(*_Curr_) PFAST_MUTEX FastMutex);
#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
#endif /* defined(_NTHAL_) && defined(_X86_) */
#if defined(_X86_)#define ExInterlockedAddUlong ExfInterlockedAddUlong#define ExInterlockedInsertHeadList ExfInterlockedInsertHeadList#define ExInterlockedInsertTailList ExfInterlockedInsertTailList#define ExInterlockedRemoveHeadList ExfInterlockedRemoveHeadList#define ExInterlockedPopEntryList ExfInterlockedPopEntryList#define ExInterlockedPushEntryList ExfInterlockedPushEntryList#endif /* defined(_X86_) */
#ifdef _X86_
#ifdef _WIN2K_COMPAT_SLIST_USAGE
NTKERNELAPIPSLIST_ENTRYFASTCALLExInterlockedPushEntrySList( _Inout_ PSLIST_HEADER SListHead, _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry, _Inout_opt_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
NTKERNELAPIPSLIST_ENTRYFASTCALLExInterlockedPopEntrySList( _Inout_ PSLIST_HEADER SListHead, _Inout_opt_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
#else /* !_WIN2K_COMPAT_SLIST_USAGE */
#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ InterlockedPushEntrySList(SListHead, SListEntry)
#define ExInterlockedPopEntrySList(SListHead, Lock) \ InterlockedPopEntrySList(SListHead)
#endif /* _WIN2K_COMPAT_SLIST_USAGE */
NTKERNELAPIPSLIST_ENTRYFASTCALLExInterlockedFlushSList( _Inout_ PSLIST_HEADER SListHead);
#ifdef NONAMELESSUNION#define ExQueryDepthSList(SListHead) (SListHead)->s.Depth#else#define ExQueryDepthSList(SListHead) (SListHead)->Depth#endif
#else /* !_X86_ */
NTKERNELAPIPSLIST_ENTRYExpInterlockedPushEntrySList( _Inout_ PSLIST_HEADER SListHead, _Inout_ __drv_aliasesMem PSLIST_ENTRY SListEntry);
NTKERNELAPIPSLIST_ENTRYExpInterlockedPopEntrySList( _Inout_ PSLIST_HEADER SListHead);
NTKERNELAPIPSLIST_ENTRYExpInterlockedFlushSList( _Inout_ PSLIST_HEADER SListHead);
#if !defined(_NTSYSTEM_) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_))NTKERNELAPIUSHORTExQueryDepthSList(_In_ PSLIST_HEADER SListHead);#elseFORCEINLINEUSHORTExQueryDepthSList(_In_ PSLIST_HEADER SListHead){#ifdef _WIN64 return (USHORT)(SListHead->Alignment & 0xffff);#else /* !_WIN64 */ return (USHORT)SListHead->Depth;#endif /* _WIN64 */}#endif
#define ExInterlockedPushEntrySList(SListHead, SListEntry, Lock) \ ExpInterlockedPushEntrySList(SListHead, SListEntry)
#define ExInterlockedPopEntrySList(SListHead, Lock) \ ExpInterlockedPopEntrySList(SListHead)
#define ExInterlockedFlushSList(SListHead) \ ExpInterlockedFlushSList(SListHead)
#endif /* _X86_ */
#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_)
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIPVOIDNTAPIExAllocateFromPagedLookasideList( _Inout_ PPAGED_LOOKASIDE_LIST Lookaside);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIVOIDNTAPIExFreeToPagedLookasideList( _Inout_ PPAGED_LOOKASIDE_LIST Lookaside, _In_ PVOID Entry);
#else /* !_WIN2K_COMPAT_SLIST_USAGE */
_IRQL_requires_max_(APC_LEVEL)static __inlinePVOIDExAllocateFromPagedLookasideList( _Inout_ PPAGED_LOOKASIDE_LIST Lookaside){ PVOID Entry;
Lookaside->L.TotalAllocates++;#ifdef NONAMELESSUNION Entry = InterlockedPopEntrySList(&Lookaside->L.u.ListHead); if (Entry == NULL) { Lookaside->L.u2.AllocateMisses++; Entry = (Lookaside->L.u4.Allocate)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag); }#else /* NONAMELESSUNION */ Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); if (Entry == NULL) { Lookaside->L.AllocateMisses++; Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag); }#endif /* NONAMELESSUNION */ return Entry;}
_IRQL_requires_max_(APC_LEVEL)static __inlineVOIDExFreeToPagedLookasideList( _Inout_ PPAGED_LOOKASIDE_LIST Lookaside, _In_ PVOID Entry){ Lookaside->L.TotalFrees++;#ifdef NONAMELESSUNION if (ExQueryDepthSList(&Lookaside->L.u.ListHead) >= Lookaside->L.Depth) { Lookaside->L.u3.FreeMisses++; (Lookaside->L.u5.Free)(Entry); } else { InterlockedPushEntrySList(&Lookaside->L.u.ListHead, (PSLIST_ENTRY)Entry); }#else /* NONAMELESSUNION */ if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { Lookaside->L.FreeMisses++; (Lookaside->L.Free)(Entry); } else { InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry); }#endif /* NONAMELESSUNION */}
#endif /* _WIN2K_COMPAT_SLIST_USAGE */
/* ERESOURCE_THREAD * ExGetCurrentResourceThread( * VOID); */#define ExGetCurrentResourceThread() ((ULONG_PTR)PsGetCurrentThread())
#define ExReleaseResource(R) (ExReleaseResourceLite(R))
/* VOID * ExInitializeWorkItem( * IN PWORK_QUEUE_ITEM Item, * IN PWORKER_THREAD_ROUTINE Routine, * IN PVOID Context) */#define ExInitializeWorkItem(Item, Routine, Context) \{ \ (Item)->WorkerRoutine = Routine; \ (Item)->Parameter = Context; \ (Item)->List.Flink = NULL; \}
FORCEINLINEVOIDExInitializeFastMutex( _Out_ PFAST_MUTEX FastMutex){ FastMutex->Count = FM_LOCK_BIT; FastMutex->Owner = NULL; FastMutex->Contention = 0; KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE); return;}
$endif (_WDMDDK_)$if (_NTDDK_)static __inline PVOIDExAllocateFromZone( IN PZONE_HEADER Zone){ PVOID Result = (PVOID)Zone->FreeList.Next; if (Zone->FreeList.Next) Zone->FreeList.Next = Zone->FreeList.Next->Next; return Result;}
static __inline PVOIDExFreeToZone( IN PZONE_HEADER Zone, IN PVOID Block){ ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next; Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block); return ((PSINGLE_LIST_ENTRY) Block)->Next;}
/* * PVOID * ExInterlockedAllocateFromZone( * IN PZONE_HEADER Zone, * IN PKSPIN_LOCK Lock) */#define ExInterlockedAllocateFromZone(Zone, Lock) \ ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
/* PVOID * ExInterlockedFreeToZone( * IN PZONE_HEADER Zone, * IN PVOID Block, * IN PKSPIN_LOCK Lock); */#define ExInterlockedFreeToZone(Zone, Block, Lock) \ ExInterlockedPushEntryList(&(Zone)->FreeList, (PSINGLE_LIST_ENTRY)(Block), Lock)
/* * BOOLEAN * ExIsFullZone( * IN PZONE_HEADER Zone) */#define ExIsFullZone(Zone) \ ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
/* BOOLEAN * ExIsObjectInFirstZoneSegment( * IN PZONE_HEADER Zone, * IN PVOID Object); */#define ExIsObjectInFirstZoneSegment(Zone,Object) \ ((BOOLEAN)( ((PUCHAR)(Object) >= (PUCHAR)(Zone)->SegmentList.Next) && \ ((PUCHAR)(Object) < (PUCHAR)(Zone)->SegmentList.Next + \ (Zone)->TotalSegmentSize)) )
#define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite#define ExAcquireResourceShared ExAcquireResourceSharedLite#define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite#define ExDeleteResource ExDeleteResourceLite#define ExInitializeResource ExInitializeResourceLite#define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite#define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite#define ExIsResourceAcquired ExIsResourceAcquiredSharedLite#define ExReleaseResourceForThread ExReleaseResourceForThreadLite
#ifndef _M_IX86#define RESULT_ZERO 0#define RESULT_NEGATIVE 1#define RESULT_POSITIVE 2#endif
typedef enum _INTERLOCKED_RESULT { ResultNegative = RESULT_NEGATIVE, ResultZero = RESULT_ZERO, ResultPositive = RESULT_POSITIVE} INTERLOCKED_RESULT;
#ifdef _X86_
NTKERNELAPIINTERLOCKED_RESULTFASTCALLExfi386InterlockedIncrementLong( _Inout_ _Interlocked_operand_ LONG volatile *Addend);
NTKERNELAPIINTERLOCKED_RESULTFASTCALLExfi386InterlockedDecrementLong( _Inout_ _Interlocked_operand_ PLONG Addend);
NTKERNELAPIULONGFASTCALLExfi386InterlockedExchangeUlong( _Inout_ _Interlocked_operand_ PULONG Target, _In_ ULONG Value);
#endif
$endif (_NTDDK_)$if (_NTIFS_)
#define ExDisableResourceBoost ExDisableResourceBoostLite
VOIDNTAPIExInitializePushLock( _Out_ PEX_PUSH_LOCK PushLock);$endif (_NTIFS_)
#if (NTDDI_VERSION >= NTDDI_WIN2K)$if (_WDMDDK_)_IRQL_requires_max_(APC_LEVEL)_Requires_lock_held_(_Global_critical_region_)NTKERNELAPIVOIDFASTCALLExAcquireFastMutexUnsafe( _Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_lock_(*_Curr_) PFAST_MUTEX FastMutex);
_IRQL_requires_max_(APC_LEVEL)_Requires_lock_held_(_Global_critical_region_)NTKERNELAPIVOIDFASTCALLExReleaseFastMutexUnsafe( _Inout_ _Requires_lock_held_(*_Curr_) _Releases_lock_(*_Curr_) PFAST_MUTEX FastMutex);
_Requires_lock_held_(_Global_critical_region_)_Requires_lock_not_held_(*Resource)_When_(Wait!=0, _Acquires_exclusive_lock_(*Resource))_IRQL_requires_max_(APC_LEVEL)_When_(Wait!=0, _Post_satisfies_(return == 1))_When_(Wait==0, _Post_satisfies_(return == 0 || return == 1) _Must_inspect_result_)NTKERNELAPIBOOLEANNTAPIExAcquireResourceExclusiveLite( _Inout_ PERESOURCE Resource, _In_ _Literal_ BOOLEAN Wait);
_IRQL_requires_max_(APC_LEVEL)_Requires_lock_held_(_Global_critical_region_)_When_(Wait!=0, _Post_satisfies_(return == 1))_When_(Wait==0, _Post_satisfies_(return == 0 || return == 1) _Must_inspect_result_)NTKERNELAPIBOOLEANNTAPIExAcquireResourceSharedLite( _Inout_ _Requires_lock_not_held_(*_Curr_) _When_(return!=0, _Acquires_shared_lock_(*_Curr_)) PERESOURCE Resource, _In_ BOOLEAN Wait);
_IRQL_requires_max_(APC_LEVEL)_Requires_lock_held_(_Global_critical_region_)_When_(Wait!=0, _Post_satisfies_(return == 1))_When_(Wait==0, _Post_satisfies_(return == 0 || return == 1) _Must_inspect_result_)NTKERNELAPIBOOLEANNTAPIExAcquireSharedStarveExclusive( _Inout_ _Requires_lock_not_held_(*_Curr_) _When_(return!=0, _Acquires_shared_lock_(*_Curr_)) PERESOURCE Resource, _In_ BOOLEAN Wait);
_IRQL_requires_max_(APC_LEVEL)_Requires_lock_held_(_Global_critical_region_)_When_(Wait!=0, _Post_satisfies_(return == 1))_When_(Wait==0, _Post_satisfies_(return == 0 || return == 1) _Must_inspect_result_)NTKERNELAPIBOOLEANNTAPIExAcquireSharedWaitForExclusive( _Inout_ _Requires_lock_not_held_(*_Curr_) _When_(return!=0, _Acquires_lock_(*_Curr_)) PERESOURCE Resource, _In_ BOOLEAN Wait);
__drv_preferredFunction("ExAllocatePoolWithTag", "No tag interferes with debugging.")__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)NTKERNELAPIPVOIDNTAPIExAllocatePool( __drv_strictTypeMatch(__drv_typeExpr) _In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes);
__drv_preferredFunction("ExAllocatePoolWithQuotaTag", "No tag interferes with debugging.")__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & POOL_QUOTA_FAIL_INSTEAD_OF_RAISE) != 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & POOL_QUOTA_FAIL_INSTEAD_OF_RAISE) == 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)NTKERNELAPIPVOIDNTAPIExAllocatePoolWithQuota( __drv_strictTypeMatch(__drv_typeExpr) _In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes);
__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & POOL_QUOTA_FAIL_INSTEAD_OF_RAISE) != 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & POOL_QUOTA_FAIL_INSTEAD_OF_RAISE) == 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)NTKERNELAPIPVOIDNTAPIExAllocatePoolWithQuotaTag( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag);
#ifndef POOL_TAGGING#define ExAllocatePoolWithQuotaTag(a,b,c) ExAllocatePoolWithQuota(a,b)#endif
__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)_Function_class_(ALLOCATE_FUNCTION)NTKERNELAPIPVOIDNTAPIExAllocatePoolWithTag( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag);
#ifndef POOL_TAGGING#define ExAllocatePoolWithTag(a,b,c) ExAllocatePool(a,b)#endif
__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)NTKERNELAPIPVOIDNTAPIExAllocatePoolWithTagPriority( _In_ __drv_strictTypeMatch(__drv_typeCond) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag, _In_ __drv_strictTypeMatch(__drv_typeExpr) EX_POOL_PRIORITY Priority);
FORCEINLINE__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)PVOIDNTAPIExAllocatePoolZero( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag){ PVOID Allocation;
Allocation = ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
if (Allocation != NULL) { RtlZeroMemory(Allocation, NumberOfBytes); }
return Allocation;}
FORCEINLINE__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)PVOIDNTAPIExAllocatePoolUninitialized( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag){ return ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);}
FORCEINLINE__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)PVOIDNTAPIExAllocatePoolQuotaZero ( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag){ PVOID Allocation;
Allocation = ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, Tag);
if (Allocation != NULL) { RtlZeroMemory(Allocation, NumberOfBytes); }
return Allocation;}
FORCEINLINE__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)PVOIDNTAPIExAllocatePoolQuotaUninitialized( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag){ return ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, Tag);}
FORCEINLINE__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)PVOIDNTAPIExAllocatePoolPriorityZero( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag, _In_ EX_POOL_PRIORITY Priority){ PVOID Allocation;
Allocation = ExAllocatePoolWithTagPriority(PoolType, NumberOfBytes, Tag, Priority);
if (Allocation != NULL) { RtlZeroMemory(Allocation, NumberOfBytes); }
return Allocation;}
FORCEINLINE__drv_allocatesMem(Mem)_When_((PoolType & PagedPool) != 0, _IRQL_requires_max_(APC_LEVEL))_When_((PoolType & PagedPool) == 0, _IRQL_requires_max_(DISPATCH_LEVEL))_When_((PoolType & NonPagedPoolMustSucceed) != 0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash"))_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) == 0, _Post_maybenull_ _Must_inspect_result_)_When_((PoolType & (NonPagedPoolMustSucceed | POOL_RAISE_IF_ALLOCATION_FAILURE)) != 0, _Post_notnull_)_Post_writable_byte_size_(NumberOfBytes)PVOIDNTAPIExAllocatePoolPriorityUninitialized( _In_ __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag, _In_ EX_POOL_PRIORITY Priority){ return ExAllocatePoolWithTagPriority(PoolType, NumberOfBytes, Tag, Priority);}
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExConvertExclusiveToSharedLite( _Inout_ _Requires_lock_held_(*_Curr_) PERESOURCE Resource);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPINTSTATUSNTAPIExCreateCallback( _Outptr_ PCALLBACK_OBJECT *CallbackObject, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _In_ BOOLEAN Create, _In_ BOOLEAN AllowMultipleCallbacks);
NTKERNELAPIVOIDNTAPIExDeleteNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIVOIDNTAPIExDeletePagedLookasideList( _Inout_ PPAGED_LOOKASIDE_LIST Lookaside);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPINTSTATUSNTAPIExDeleteResourceLite( _Inout_ PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)_Function_class_(FREE_FUNCTION)NTKERNELAPIVOIDNTAPIExFreePool( _Pre_notnull_ __drv_freesMem(Mem) PVOID P);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExFreePoolWithTag( _Pre_notnull_ __drv_freesMem(Mem) PVOID P, _In_ ULONG Tag);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIULONGNTAPIExGetExclusiveWaiterCount( _In_ PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIKPROCESSOR_MODENTAPIExGetPreviousMode(VOID);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIULONGNTAPIExGetSharedWaiterCount( _In_ PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExInitializeNPagedLookasideList( _Out_ PNPAGED_LOOKASIDE_LIST Lookaside, _In_opt_ PALLOCATE_FUNCTION Allocate, _In_opt_ PFREE_FUNCTION Free, _In_ ULONG Flags, _In_ SIZE_T Size, _In_ ULONG Tag, _In_ USHORT Depth);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIVOIDNTAPIExInitializePagedLookasideList( _Out_ PPAGED_LOOKASIDE_LIST Lookaside, _In_opt_ PALLOCATE_FUNCTION Allocate, _In_opt_ PFREE_FUNCTION Free, _In_ ULONG Flags, _In_ SIZE_T Size, _In_ ULONG Tag, _In_ USHORT Depth);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPINTSTATUSNTAPIExInitializeResourceLite( _Out_ PERESOURCE Resource);
NTKERNELAPILARGE_INTEGERNTAPIExInterlockedAddLargeInteger( _Inout_ PLARGE_INTEGER Addend, _In_ LARGE_INTEGER Increment, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
#if !defined(_M_IX86)#define ExInterlockedAddLargeStatistic(Addend, Increment) \ (VOID)InterlockedAdd64(&(Addend)->QuadPart, Increment)#else#define ExInterlockedAddLargeStatistic(Addend, Increment) \ (VOID)_InterlockedAddLargeStatistic((PLONGLONG)&(Addend)->QuadPart, Increment)#endif
NTKERNELAPIULONGFASTCALLExInterlockedAddUlong( _Inout_ PULONG Addend, _In_ ULONG Increment, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
#if defined(_M_IX86)
NTKERNELAPILONGLONGFASTCALLExfInterlockedCompareExchange64( _Inout_ _Interlocked_operand_ LONGLONG volatile *Destination, _In_ PLONGLONG Exchange, _In_ PLONGLONG Comperand);
#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ ExfInterlockedCompareExchange64(Destination, Exchange, Comperand)
#else
#define ExInterlockedCompareExchange64(Destination, Exchange, Comperand, Lock) \ InterlockedCompareExchange64(Destination, *(Exchange), *(Comperand))
#endif /* defined(_M_IX86) */
NTKERNELAPIPLIST_ENTRYFASTCALLExInterlockedInsertHeadList( _Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY ListEntry, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
NTKERNELAPIPLIST_ENTRYFASTCALLExInterlockedInsertTailList( _Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY ListEntry, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
NTKERNELAPIPSINGLE_LIST_ENTRYFASTCALLExInterlockedPopEntryList( _Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
NTKERNELAPIPSINGLE_LIST_ENTRYFASTCALLExInterlockedPushEntryList( _Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY ListEntry, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
NTKERNELAPIPLIST_ENTRYFASTCALLExInterlockedRemoveHeadList( _Inout_ PLIST_ENTRY ListHead, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
_IRQL_requires_max_(PASSIVE_LEVEL)NTKERNELAPIBOOLEANNTAPIExIsProcessorFeaturePresent( _In_ ULONG ProcessorFeature);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIBOOLEANNTAPIExIsResourceAcquiredExclusiveLite( _In_ PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIULONGNTAPIExIsResourceAcquiredSharedLite( _In_ PERESOURCE Resource);
#define ExIsResourceAcquiredLite ExIsResourceAcquiredSharedLite
NTKERNELAPIVOIDNTAPIExLocalTimeToSystemTime( _In_ PLARGE_INTEGER LocalTime, _Out_ PLARGE_INTEGER SystemTime);
#if (NTDDI_VERSION >= NTDDI_WINBLUE)
#define EX_TIMER_HIGH_RESOLUTION 0x4#define EX_TIMER_NO_WAKE 0x8#define EX_TIMER_UNLIMITED_TOLERANCE ((LONGLONG)-1)#define EX_TIMER_NOTIFICATION (1UL << 31)
NTKERNELAPIPEX_TIMERNTAPIExAllocateTimer( _In_opt_ PEXT_CALLBACK Callback, _In_opt_ PVOID CallbackContext, _In_ ULONG Attributes);
NTKERNELAPIBOOLEANNTAPIExSetTimer( _In_ PEX_TIMER Timer, _In_ LONGLONG DueTime, _In_ LONGLONG Period, _In_opt_ PEXT_SET_PARAMETERS Parameters);
NTKERNELAPIBOOLEANNTAPIExCancelTimer( _Inout_ PEX_TIMER Timer, _In_opt_ PEXT_CANCEL_PARAMETERS Parameters);
NTKERNELAPIBOOLEANNTAPIExDeleteTimer( _In_ PEX_TIMER Timer, _In_ BOOLEAN Cancel, _In_ BOOLEAN Wait, _In_opt_ PEXT_DELETE_PARAMETERS Parameters);
FORCEINLINEVOIDExInitializeSetTimerParameters( _Out_ PEXT_SET_PARAMETERS Parameters){ ASSERT(FALSE);}
#endif // NTDDI_WINBLUE
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExNotifyCallback( _In_ PCALLBACK_OBJECT CallbackObject, _In_opt_ PVOID Argument1, _In_opt_ PVOID Argument2);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExQueueWorkItem( _Inout_ __drv_aliasesMem PWORK_QUEUE_ITEM WorkItem, __drv_strictTypeMatch(__drv_typeExpr) _In_ WORK_QUEUE_TYPE QueueType);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIDECLSPEC_NORETURNVOIDNTAPIExRaiseStatus( _In_ NTSTATUS Status);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIPVOIDNTAPIExRegisterCallback( _Inout_ PCALLBACK_OBJECT CallbackObject, _In_ PCALLBACK_FUNCTION CallbackFunction, _In_opt_ PVOID CallbackContext);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPINTSTATUSNTAPIExReinitializeResourceLite( _Inout_ PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)_Requires_lock_held_(_Global_critical_region_)NTKERNELAPIVOIDNTAPIExReleaseResourceForThreadLite( _Inout_ _Requires_lock_held_(*_Curr_) _Releases_lock_(*_Curr_) PERESOURCE Resource, _In_ ERESOURCE_THREAD ResourceThreadId);
_Requires_lock_held_(_Global_critical_region_)_Requires_lock_held_(*Resource)_Releases_lock_(*Resource)_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDFASTCALLExReleaseResourceLite( _Inout_ PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExSetResourceOwnerPointer( _Inout_ PERESOURCE Resource, _In_ PVOID OwnerPointer);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIULONGNTAPIExSetTimerResolution( _In_ ULONG DesiredTime, _In_ BOOLEAN SetResolution);
NTKERNELAPIVOIDNTAPIExSystemTimeToLocalTime( _In_ PLARGE_INTEGER SystemTime, _Out_ PLARGE_INTEGER LocalTime);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIVOIDNTAPIExUnregisterCallback( _Inout_ PVOID CbRegistration);
$endif (_WDMDDK_)$if (_NTDDK_)NTKERNELAPINTSTATUSNTAPIExExtendZone( _Inout_ PZONE_HEADER Zone, _Inout_ PVOID Segment, _In_ ULONG SegmentSize);
NTKERNELAPINTSTATUSNTAPIExInitializeZone( _Out_ PZONE_HEADER Zone, _In_ ULONG BlockSize, _Inout_ PVOID InitialSegment, _In_ ULONG InitialSegmentSize);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPINTSTATUSNTAPIExInterlockedExtendZone( _Inout_ PZONE_HEADER Zone, _Inout_ PVOID Segment, _In_ ULONG SegmentSize, _Inout_ _Requires_lock_not_held_(*_Curr_) PKSPIN_LOCK Lock);
_IRQL_requires_max_(PASSIVE_LEVEL)NTKERNELAPINTSTATUSNTAPIExUuidCreate( _Out_ UUID *Uuid);
_IRQL_requires_max_(PASSIVE_LEVEL)NTKERNELAPIDECLSPEC_NORETURNVOIDNTAPIExRaiseAccessViolation(VOID);
_IRQL_requires_max_(PASSIVE_LEVEL)NTKERNELAPIDECLSPEC_NORETURNVOIDNTAPIExRaiseDatatypeMisalignment(VOID);
$endif (_NTDDK_)$if (_NTIFS_)
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPISIZE_TNTAPIExQueryPoolBlockSize( _In_ PVOID PoolBlock, _Out_ PBOOLEAN QuotaCharged);
_IRQL_requires_max_(DISPATCH_LEVEL)VOIDExAdjustLookasideDepth(VOID);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExDisableResourceBoostLite( _In_ PERESOURCE Resource);$endif (_NTIFS_)#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
$if (_WDMDDK_ || _NTIFS_)#if (NTDDI_VERSION >= NTDDI_WINXP)$endif (_WDMDDK_ || _NTIFS_)$if (_WDMDDK_)
_Must_inspect_result__Post_satisfies_(return == 0 || return == 1)NTKERNELAPIBOOLEANFASTCALLExAcquireRundownProtection( _Inout_ PEX_RUNDOWN_REF RunRef);
NTKERNELAPIVOIDFASTCALLExInitializeRundownProtection( _Out_ PEX_RUNDOWN_REF RunRef);
NTKERNELAPIVOIDFASTCALLExReInitializeRundownProtection( _Inout_ PEX_RUNDOWN_REF RunRef);
NTKERNELAPIVOIDFASTCALLExReleaseRundownProtection( _Inout_ PEX_RUNDOWN_REF RunRef);
NTKERNELAPIVOIDFASTCALLExRundownCompleted( _Out_ PEX_RUNDOWN_REF RunRef);
NTKERNELAPIBOOLEANNTAPIExVerifySuite( __drv_strictTypeMatch(__drv_typeExpr) _In_ SUITE_TYPE SuiteType);
NTKERNELAPIVOIDFASTCALLExWaitForRundownProtectionRelease( _Inout_ PEX_RUNDOWN_REF RunRef);$endif (_WDMDDK_)$if (_NTIFS_)
PSLIST_ENTRYFASTCALLInterlockedPushListSList( _Inout_ PSLIST_HEADER ListHead, _Inout_ __drv_aliasesMem PSLIST_ENTRY List, _Inout_ PSLIST_ENTRY ListEnd, _In_ ULONG Count);$endif (_NTIFS_)$if (_WDMDDK_ || _NTIFS_)#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */$endif (_WDMDDK_ || _NTIFS_)
$if (_WDMDDK_)#if (NTDDI_VERSION >= NTDDI_WINXPSP2)
_Must_inspect_result__Post_satisfies_(return == 0 || return == 1)NTKERNELAPIBOOLEANFASTCALLExAcquireRundownProtectionEx( _Inout_ PEX_RUNDOWN_REF RunRef, _In_ ULONG Count);
NTKERNELAPIVOIDFASTCALLExReleaseRundownProtectionEx( _Inout_ PEX_RUNDOWN_REF RunRef, _In_ ULONG Count);
#endif /* (NTDDI_VERSION >= NTDDI_WINXPSP2) */
#if (NTDDI_VERSION >= NTDDI_WS03SP1)
_Must_inspect_result__IRQL_requires_max_(APC_LEVEL)NTKERNELAPIPEX_RUNDOWN_REF_CACHE_AWARENTAPIExAllocateCacheAwareRundownProtection( __drv_strictTypeMatch(__drv_typeExpr) _In_ POOL_TYPE PoolType, _In_ ULONG PoolTag);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPISIZE_TNTAPIExSizeOfRundownProtectionCacheAware(VOID);
_IRQL_requires_max_(APC_LEVEL)_Acquires_lock_(_Global_critical_region_)NTKERNELAPIPVOIDNTAPIExEnterCriticalRegionAndAcquireResourceShared( _Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_shared_lock_(*_Curr_) PERESOURCE Resource);
_IRQL_requires_max_(APC_LEVEL)_Acquires_lock_(_Global_critical_region_)NTKERNELAPIPVOIDNTAPIExEnterCriticalRegionAndAcquireResourceExclusive( _Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_exclusive_lock_(*_Curr_) PERESOURCE Resource);
_IRQL_requires_max_(APC_LEVEL)_Acquires_lock_(_Global_critical_region_)NTKERNELAPIPVOIDNTAPIExEnterCriticalRegionAndAcquireSharedWaitForExclusive( _Inout_ _Requires_lock_not_held_(*_Curr_) _Acquires_lock_(*_Curr_) PERESOURCE Resource);
_IRQL_requires_max_(DISPATCH_LEVEL)_Releases_lock_(_Global_critical_region_)NTKERNELAPIVOIDFASTCALLExReleaseResourceAndLeaveCriticalRegion( _Inout_ _Requires_lock_held_(*_Curr_) _Releases_lock_(*_Curr_) PERESOURCE Resource);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIVOIDNTAPIExInitializeRundownProtectionCacheAware( _Out_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware, _In_ SIZE_T RunRefSize);
_IRQL_requires_max_(APC_LEVEL)NTKERNELAPIVOIDNTAPIExFreeCacheAwareRundownProtection( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware);
_Must_inspect_result__Post_satisfies_(return == 0 || return == 1)NTKERNELAPIBOOLEANFASTCALLExAcquireRundownProtectionCacheAware( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware);
NTKERNELAPIVOIDFASTCALLExReleaseRundownProtectionCacheAware( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware);
_Must_inspect_result__Post_satisfies_(return == 0 || return == 1)NTKERNELAPIBOOLEANFASTCALLExAcquireRundownProtectionCacheAwareEx( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware, _In_ ULONG Count);
NTKERNELAPIVOIDFASTCALLExReleaseRundownProtectionCacheAwareEx( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRef, _In_ ULONG Count);
NTKERNELAPIVOIDFASTCALLExWaitForRundownProtectionReleaseCacheAware( IN OUT PEX_RUNDOWN_REF_CACHE_AWARE RunRef);
NTKERNELAPIVOIDFASTCALLExReInitializeRundownProtectionCacheAware( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware);
NTKERNELAPIVOIDFASTCALLExRundownCompletedCacheAware( _Inout_ PEX_RUNDOWN_REF_CACHE_AWARE RunRefCacheAware);
#endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */
#if (NTDDI_VERSION >= NTDDI_VISTA)
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPINTSTATUSNTAPIExInitializeLookasideListEx( _Out_ PLOOKASIDE_LIST_EX Lookaside, _In_opt_ PALLOCATE_FUNCTION_EX Allocate, _In_opt_ PFREE_FUNCTION_EX Free, _In_ POOL_TYPE PoolType, _In_ ULONG Flags, _In_ SIZE_T Size, _In_ ULONG Tag, _In_ USHORT Depth);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExDeleteLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside);
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExFlushLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside);
#ifdef _MSC_VER#pragma warning(push)#pragma warning(disable:__WARNING_MEMORY_NOT_ACQUIRED)#endif
__drv_allocatesMem(Mem)_Must_inspect_result__IRQL_requires_max_(DISPATCH_LEVEL)FORCEINLINEPVOIDExAllocateFromLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside){ PVOID Entry;
Lookaside->L.TotalAllocates += 1;#ifdef NONAMELESSUNION Entry = InterlockedPopEntrySList(&Lookaside->L.u.ListHead); if (Entry == NULL) { Lookaside->L.u2.AllocateMisses += 1; Entry = (Lookaside->L.u4.AllocateEx)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag, Lookaside); }#else /* NONAMELESSUNION */ Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead); if (Entry == NULL) { Lookaside->L.AllocateMisses += 1; Entry = (Lookaside->L.AllocateEx)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag, Lookaside); }#endif /* NONAMELESSUNION */ return Entry;}
#ifdef _MSC_VER#pragma warning(pop)#endif
_IRQL_requires_max_(DISPATCH_LEVEL)FORCEINLINEVOIDExFreeToLookasideListEx( _Inout_ PLOOKASIDE_LIST_EX Lookaside, _In_ __drv_freesMem(Entry) PVOID Entry){ Lookaside->L.TotalFrees += 1; if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { Lookaside->L.FreeMisses += 1; (Lookaside->L.FreeEx)(Entry, Lookaside); } else { InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry); } return;}
#endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
#if (NTDDI_VERSION >= NTDDI_WIN7)
_IRQL_requires_max_(DISPATCH_LEVEL)NTKERNELAPIVOIDNTAPIExSetResourceOwnerPointerEx( _Inout_ PERESOURCE Resource, _In_ PVOID OwnerPointer, _In_ ULONG Flags);
#define FLAG_OWNER_POINTER_IS_THREAD 0x1
#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
__drv_allocatesMem(Mem)_IRQL_requires_max_(DISPATCH_LEVEL)_Ret_maybenull__Post_writable_byte_size_(Lookaside->L.Size)static __inlinePVOIDExAllocateFromNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside){ PVOID Entry;
Lookaside->L.TotalAllocates++;#ifdef NONAMELESSUNION#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) Entry = ExInterlockedPopEntrySList(&Lookaside->L.u.ListHead, &Lookaside->Lock__ObsoleteButDoNotDelete);#else Entry = InterlockedPopEntrySList(&Lookaside->L.u.ListHead);#endif if (Entry == NULL) { Lookaside->L.u2.AllocateMisses++; Entry = (Lookaside->L.u4.Allocate)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag); }#else /* NONAMELESSUNION */#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) Entry = ExInterlockedPopEntrySList(&Lookaside->L.ListHead, &Lookaside->Lock__ObsoleteButDoNotDelete);#else Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);#endif if (Entry == NULL) { Lookaside->L.AllocateMisses++; Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag); }#endif /* NONAMELESSUNION */ return Entry;}
_IRQL_requires_max_(DISPATCH_LEVEL)static __inlineVOIDExFreeToNPagedLookasideList( _Inout_ PNPAGED_LOOKASIDE_LIST Lookaside, _In_ __drv_freesMem(Mem) PVOID Entry){ Lookaside->L.TotalFrees++;#ifdef NONAMELESSUNION if (ExQueryDepthSList(&Lookaside->L.u.ListHead) >= Lookaside->L.Depth) { Lookaside->L.u3.FreeMisses++; (Lookaside->L.u5.Free)(Entry); } else {#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) ExInterlockedPushEntrySList(&Lookaside->L.u.ListHead, (PSLIST_ENTRY)Entry, &Lookaside->Lock__ObsoleteButDoNotDelete);#else InterlockedPushEntrySList(&Lookaside->L.u.ListHead, (PSLIST_ENTRY)Entry);#endif }#else /* NONAMELESSUNION */ if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) { Lookaside->L.FreeMisses++; (Lookaside->L.Free)(Entry); } else {#if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) ExInterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry, &Lookaside->Lock__ObsoleteButDoNotDelete);#else InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry);#endif }#endif /* NONAMELESSUNION */}
$endif (_WDMDDK_)