CmDeleteInstallerClassWorker
NTSTATUS __stdcall CmDeleteInstallerClassWorker(HPNPCTX *hPnpCtx, WCHAR *ClassGuid, UINT64 Flags){
NTSTATUS v3;
NTSTATUS MatchingFilteredDeviceList;
UINT64 v7;
__int64 *v8;
unsigned int v9;
_CM_KEY_TYPE v10;
NTSTATUS v11;
_DEVPROPKEY *PoolWithTag;
NTSTATUS InstallerClassMappedPropertyKeys;
UINT64 v14;
unsigned int v15;
unsigned __int64 v16;
__int64 v17;
NTSTATUS v18;
_CM_OBJECT_TYPE v19;
UINT8 PropertyKeys;
UINT8 PropertyKeysa;
UINT64 BufferLength;
UINT8 *BufferLengtha;
UINT64 PropertySize;
VOID *v26;
WCHAR *v27;
UINT64 PropertyCount;
__int64 v29;
UINT64 v30;
v3 = 0;
HIDWORD(PropertyCount) = 0;
if( (_WORD)Flags )
return -1073741811;
MatchingFilteredDeviceList = CmGetMatchingFilteredDeviceList(
hPnpCtx,
ClassGuid,
CM_DEVICE_LIST_FILTER_CLASS,
0i64,
0i64,
0i64,
CM_OBJECT_TYPE_NONE,
(char *)&PropertyCount + 4,
v26,
v27,
PropertyCount,
(UINT64 *)v29,
v30);
if( MatchingFilteredDeviceList == -1073741789 )
return -1073741535;
if( MatchingFilteredDeviceList )
return MatchingFilteredDeviceList;
v29 = 0x22000000320i64;
v8 = &v29;
v9 = 0;
LODWORD(v30) = 288;
while( 1 )
{
v10 = *(_DWORD *)v8;
if( !*(_DWORD *)v8 || (v10 & 0xFFFFFCDF) != 0 )
v11 = -1073741811;
else
v11 = CmDeleteCommonClassRegKey(hPnpCtx, ClassGuid, v10, v7, PropertyKeys);
if( v11 && v11 != -1073741772 && v11 != -1073741811 && v11 != -1073741637 )
break;
++v9;
v8 = (__int64 *)((char *)v8 + 4);
if( v9 >= 3 )
goto LABEL_19;
}
v3 = v11;
if( v11 < 0 )
return v3;
LABEL_19:
PoolWithTag = 0i64;
LODWORD(PropertyCount) = 0;
LOBYTE(v7) = 1;
LODWORD(BufferLength) = 0;
InstallerClassMappedPropertyKeys = CmGetInstallerClassMappedPropertyKeys(
hPnpCtx,
ClassGuid,
0i64,
v7,
0i64,
BufferLength,
&PropertyCount);
if( InstallerClassMappedPropertyKeys == -1073741789 )
{
while( 1 )
{
v15 = PropertyCount;
v16 = 20i64 * (unsigned int)PropertyCount;
if( v16 > 0xFFFFFFFF )
break;
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
PoolWithTag = (_DEVPROPKEY *)ExAllocatePoolWithTag(1ui64, (unsigned int)v16, 1380994640i64);
if( !PoolWithTag )
{
InstallerClassMappedPropertyKeys = -1073741801;
goto LABEL_26;
}
LOBYTE(v14) = 1;
LODWORD(BufferLengtha) = v15;
InstallerClassMappedPropertyKeys = CmGetInstallerClassMappedPropertyKeys(
hPnpCtx,
ClassGuid,
0i64,
v14,
PoolWithTag,
(UINT64)BufferLengtha,
&PropertyCount);
if( InstallerClassMappedPropertyKeys != -1073741789 )
goto LABEL_25;
}
InstallerClassMappedPropertyKeys = -1073741811;
LABEL_28:
v3 = InstallerClassMappedPropertyKeys;
goto LABEL_45;
}
LABEL_25:
v15 = PropertyCount;
LABEL_26:
if( InstallerClassMappedPropertyKeys && InstallerClassMappedPropertyKeys != -1073741275 )
goto LABEL_28;
v17 = 0i64;
if( v15 )
{
while( 1 )
{
LODWORD(PropertySize) = 0;
LODWORD(BufferLengtha) = 0;
v18 = CmSetInstallerClassMappedProperty(
hPnpCtx,
ClassGuid,
0i64,
0i64,
&PoolWithTag[v17],
BufferLengtha,
0i64,
PropertySize);
if( v18 )
{
if( v18 != -1073741275 && v18 != -1073741790 && v18 != -1073741802 && v18 != -1073741637 )
break;
}
v17 = (unsigned int)(v17 + 1);
if( (unsigned int)v17 >= v15 )
goto LABEL_40;
}
v3 = v18;
}
LABEL_40:
if( v3 < 0 )
goto LABEL_45;
InstallerClassMappedPropertyKeys = CmDeleteCommonClassRegKey(
hPnpCtx,
ClassGuid,
CM_KEY_TYPE_DEVICE_INSTALLER_CLASS,
v14,
PropertyKeysa);
if( InstallerClassMappedPropertyKeys )
{
if( InstallerClassMappedPropertyKeys != -1073741772 && InstallerClassMappedPropertyKeys != -1073741811 )
goto LABEL_28;
}
CmRaiseDeleteEvent(hPnpCtx, ClassGuid, CM_OBJECT_TYPE_DEVICE_INSTALLER_CLASS, v19);
LABEL_45:
if( PoolWithTag )
ExFreePoolWithTag(PoolWithTag, 0);
return v3;
}Referenced by:
CmDeleteInstallerClass