NTSTATUS __fastcall PnpDispatchInstallerClass(HPNPCTX *hPnpCtx, WCHAR *ClassGuid, __int64 a3, int a4, __int64 a5){
NTSTATUS(__fastcall *v5)(INT64, INT64, INT64);
UINT64 **v6;
int v7;
int v8;
int v9;
int v10;
int v11;
int v12;
int v13;
int v14;
unsigned int InstallerClassMappedProperty;
VOID **PropertyKey;
UINT64 *PropertyType;
UINT8 *PropertyBuffer;
VOID *BufferSize;
UINT64 *PropertySize;
INT64 v22;
UINT64 *RequiredLength[2];
v5 = 0i64;
v6 = 0i64;
*(_OWORD *)RequiredLength = 0i64;
v7 = a4 - 1;
if( v7 )
{
v8 = v7 - 1;
if( v8 )
{
v9 = v8 - 1;
if( v9 )
{
v10 = v9 - 1;
if( v10 )
{
v11 = v10 - 1;
if( v11 )
{
v12 = v11 - 1;
if( v12 )
{
v13 = v12 - 1;
if( v13 )
{
v14 = v13 - 1;
if( v14 )
{
if( v14 == 1 )
{
LODWORD(BufferSize) = *(_DWORD *)(a5 + 40);
LODWORD(PropertyType) = *(_DWORD *)(a5 + 24);
InstallerClassMappedProperty = CmSetInstallerClassMappedProperty(
hPnpCtx,
ClassGuid,
*(VOID **)a5,
*(const WCHAR **)(a5 + 8),
*(const _DEVPROPKEY **)(a5 + 16),
(UINT8 *)PropertyType,
*(UINT8 **)(a5 + 32),
(UINT64)BufferSize);
}
else
{
InstallerClassMappedProperty = -1073741811;
}
}
else
{
LODWORD(BufferSize) = *(_DWORD *)(a5 + 40);
InstallerClassMappedProperty = CmGetInstallerClassMappedProperty(
hPnpCtx,
ClassGuid,
*(VOID **)a5,
*(const WCHAR **)(a5 + 8),
*(const _DEVPROPKEY **)(a5 + 16),
*(UINT64 **)(a5 + 24),
*(UINT8 **)(a5 + 32),
(UINT64)BufferSize,
*(UINT64 **)(a5 + 48));
}
}
else
{
InstallerClassMappedProperty = CmGetInstallerClassMappedPropertyLocales(
(_DEVPROPKEY *)hPnpCtx,
ClassGuid,
0i64,
*(UINT64 **)(a5 + 8));
}
}
else
{
LODWORD(PropertyType) = *(_DWORD *)(a5 + 32);
InstallerClassMappedProperty = CmGetInstallerClassMappedPropertyKeys(
hPnpCtx,
ClassGuid,
*(VOID **)a5,
0i64,
*(_DEVPROPKEY **)(a5 + 24),
(UINT64)PropertyType,
*(UINT64 **)(a5 + 40));
}
}
else
{
if( *(_QWORD *)a5 )
{
RequiredLength[0] = *(UINT64 **)a5;
v5 = PnpCmMatchCallbackRoutine;
v6 = RequiredLength;
RequiredLength[1] = *(UINT64 **)(a5 + 8);
}
LODWORD(BufferSize) = *(_DWORD *)(a5 + 40) & 0xFFFF0000;
InstallerClassMappedProperty = CmGetMatchingCommonClassList(
hPnpCtx,
CM_OBJECT_TYPE_DEVICE_INSTALLER_CLASS,
(UINT8 *)v5,
(HPNPCTX *)v6,
*(const WCHAR **)(a5 + 16),
*(_CM_OBJECT_TYPE *)(a5 + 24),
*(VOID **)(a5 + 32),
BufferSize,
(WCHAR *)PropertySize,
v22,
RequiredLength[0],
(UINT64)RequiredLength[1]);
}
}
else
{
InstallerClassMappedProperty = CmDeleteInstallerClass(hPnpCtx, ClassGuid, *(_DWORD *)a5 & 0xFFFF0000);
}
}
else
{
LODWORD(PropertyType) = *(_DWORD *)(a5 + 20) & 0xFFFF0000;
InstallerClassMappedProperty = CmCreateInstallerClass(
hPnpCtx,
ClassGuid,
(WCHAR *)*(unsigned int *)a5,
a5 + 8,
(VOID **)(a5 + 16),
(UINT8 *)PropertyType,
(INT64)PropertyBuffer,
(INT64)BufferSize,
(INT64)PropertySize);
}
}
else
{
LOBYTE(PropertyType) = *(_BYTE *)(a5 + 4);
LODWORD(PropertyKey) = *(_DWORD *)a5;
InstallerClassMappedProperty = CmOpenInstallerClassRegKey(hPnpCtx, ClassGuid, 0i64, 0, PropertyKey, PropertyType);
}
}
else
{
InstallerClassMappedProperty = CmValidateInstallerClassName((WCHAR *)hPnpCtx);
}
return PnpMapCmStatusToDispatchStatus(InstallerClassMappedProperty);
}