ExpWnfFreeScopeInstance
VOID __stdcall ExpWnfFreeScopeInstance(_WNF_SCOPE_INSTANCE *Scope, UINT8 WaitForRundown){
_RTL_BALANCED_NODE *Root;
_RTL_BALANCED_NODE *v4;
_RTL_BALANCED_NODE *v5;
unsigned __int64 ParentValue;
unsigned __int64 v7;
void *PermanentDataStore;
void *VolatilePermanentDataStore;
if( WaitForRundown )
{
ExWaitForRundownProtectionRelease(&Scope->RunRef);
Root = Scope->NameSet.Root;
if( Root )
{
while( 1 )
{
while( 1 )
{
while( Root->Children[0] )
{
v4 = Root;
Root = Root->Children[0];
v4->Children[0] = 0i64;
}
if( !Root->Children[1] )
break;
v5 = Root;
Root = Root->Children[1];
v5->Children[1] = 0i64;
}
ParentValue = Root->ParentValue;
ExpWnfDeleteNameInstanceCallback(Root, Scope);
v7 = ParentValue & 0xFFFFFFFFFFFFFFFCui64;
if( !v7 )
break;
Root = (_RTL_BALANCED_NODE *)v7;
}
}
Scope->NameSet.Root = 0i64;
}
PermanentDataStore = Scope->PermanentDataStore;
if( PermanentDataStore )
ZwClose((_HANDLE)PermanentDataStore);
VolatilePermanentDataStore = Scope->VolatilePermanentDataStore;
if( VolatilePermanentDataStore )
ZwClose((_HANDLE)VolatilePermanentDataStore);
ExFreePoolWithTag(Scope, 0x20666E57u);
}Referenced by:
ExpWnfDeleteScopeById
ExpWnfDeleteScopeInstances
ExpWnfResolveScopeInstance