RegRtlDeleteTreeInternal
NTSTATUS __stdcall RegRtlDeleteTreeInternal(VOID *hKey, WCHAR *SubKey, VOID *hTransaction, UINT8 ProtectedCall){
unsigned int v4;
VOID **PoolWithTag;
unsigned int v8;
int v10;
unsigned int v11;
unsigned __int64 v12;
NTSTATUS v13;
int v14;
VOID **phkResult;
VOID *hTransactiona;
UINT64 KeyNameLength;
VOID *hKeya;
UINT64 HighLimit;
UINT64 LowLimit;
v4 = 0;
hKeya = 0i64;
LODWORD(KeyNameLength) = 0;
HighLimit = 0i64;
PoolWithTag = 0i64;
LowLimit = 0i64;
v8 = 0;
IoGetStackLimits(&LowLimit, &HighLimit);
if( (unsigned __int64)&HighLimit - LowLimit < 0x400 )
{
v10 = -1073741670;
goto LABEL_12;
}
v10 = RegRtlOpenKeyTransacted(hKey, SubKey, 0i64, 0x3001Fui64, &hKeya, hTransaction);
if( v10 < 0 )
goto LABEL_12;
if( (unsigned int)RegRtlQueryInfoKey(hKeya, 0i64, (unsigned int *)&KeyNameLength, 0i64, 0i64, 0i64) )
{
LODWORD(v12) = 0;
}
else
{
v11 = KeyNameLength;
if( (_DWORD)KeyNameLength )
{
if( (int)KeyNameLength + 1 < (unsigned int)KeyNameLength )
{
v10 = -1073741675;
v11 = -1;
}
else
{
v10 = 0;
v11 = KeyNameLength + 1;
}
if( v10 < 0 )
goto LABEL_12;
}
v12 = 2i64 * v11;
if( v12 > 0xFFFFFFFF )
{
v10 = -1073741675;
goto LABEL_12;
}
v10 = 0;
}
if( (_DWORD)v12 )
{
PoolWithTag = ExAllocatePoolWithTag(1ui64, (unsigned int)v12, 1279739218i64);
if( !PoolWithTag )
{
v10 = -1073741801;
goto LABEL_12;
}
}
while( 1 )
{
while( 1 )
{
LODWORD(KeyNameLength) = (unsigned int)v12 >> 1;
v13 = RegRtlEnumKey(
hKeya,
v4,
(WCHAR *)PoolWithTag,
&KeyNameLength,
(INT64)phkResult,
(INT64)hTransactiona,
KeyNameLength,
(INT64)hKeya);
if( v13 == -2147483622 || v13 == -1073741444 )
break;
if( v13 == -1073741789 )
{
v12 = 2i64 * (unsigned int)KeyNameLength;
if( v12 > 0xFFFFFFFF )
{
v10 = -1073741675;
goto LABEL_12;
}
v10 = 0;
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
PoolWithTag = ExAllocatePoolWithTag(1ui64, (unsigned int)v12, 1279739218i64);
if( !PoolWithTag )
{
v10 = -1073741801;
break;
}
}
else
{
if( v13 )
break;
*((_WORD *)PoolWithTag + ((unsigned __int64)(unsigned int)v12 >> 1) - 1) = 0;
if( RegRtlDeleteTreeInternal(hKeya, (WCHAR *)PoolWithTag, hTransaction, ProtectedCall) )
++v4;
else
v4 = 0;
}
}
if( v10 < 0 )
goto LABEL_12;
v14 = RegRtlDeleteKeyTransacted(hKey, SubKey, hTransaction);
if( v14 != -1073741535 )
break;
if( v4 || v8 >= 0xA )
goto LABEL_42;
++v8;
v4 = 0;
}
if( v14 >= 0 )
goto LABEL_12;
LABEL_42:
v10 = v14;
LABEL_12:
if( hKeya )
ZwClose((_HANDLE)hKeya);
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
return v10;
}Referenced by:
CmDeleteCommonClassRegKeyWorker
CmDeleteDeviceContainerRegKeyWorker
CmDeleteDeviceInterfaceRegKeyWorker
CmDeleteDevicePanelRegKeyWorker
CmDeleteDeviceRegKeyWorker
CmRemoveDeviceFromContainerWorker
CmRemovePanelDeviceWorker
DrvDbDeleteObjectSubKey
PiDevCfgConfigureDevice
PiDevCfgConfigureSoftwareDevices
PiDevCfgCopyDeviceKey
PiDevCfgFreeResolveContext
PiDevCfgInitResolveContext
PiDevCfgResetDeviceDriverSettings
PiDqDeleteUserObject
PipHardwareConfigActivateService
PnpCtxRegDeleteTree
PnpSetPropertyWorker
PpDevCfgProcessDeviceOperations
PpDevCfgProcessDeviceReset
RegRtlDeletePathInternal
RegRtlDeleteTreeInternal