WheapInitErrorReportDeviceDriver
INT64 __stdcall WheapInitErrorReportDeviceDriver(UINT64 ErrorSourceId, PVOID *a2){
unsigned int v3;
char v4;
unsigned int v5;
char *PreallocatedPacketBuffer;
INT64 *ErrorSource;
unsigned __int64 v8;
__int64 v9;
__int64 v10;
signed __int32 v11;
unsigned int v12;
signed __int32 v13;
unsigned int v14;
PVOID PoolWithTag;
char v17;
unsigned int ErrorSourceIda;
int Src[5];
int v20;
int v21;
int v22;
CHAR pszDest[32];
ErrorSourceIda = ErrorSourceId;
v3 = ErrorSourceId;
memset((INT64)Src, 0i64);
v4 = 0;
*a2 = 0i64;
v5 = 0;
v17 = 0;
PreallocatedPacketBuffer = 0i64;
ErrorSource = WheapGetErrorSource((INT64)&WheapErrorSourceTable, v3);
v8 = (unsigned __int64)(ErrorSource + 12);
v9 = -(__int64)ErrorSource;
v10 = v8 & -(__int64)(v9 != 0);
if( !v10 || (v11 = *(_DWORD *)((v8 & -(__int64)(v9 != 0)) + 0x98), v11 == -1) )
{
v20 = -2147483605;
LABEL_21:
Src[0] = 1733060695;
v22 = 32;
Src[1] = 1;
Src[2] = 64;
Src[3] = 1;
Src[4] = 1280201291;
v21 = 2;
RtlStringCchCopyA(pszDest, 0x20ui64, (PSTR)"InitErrorReportDeviceDriver");
WheaLogInternalEvent(Src);
v5 = -1073741811;
LABEL_22:
if( v17 )
_InterlockedDecrement((volatile signed __int32 *)(v10 + 152));
if( PreallocatedPacketBuffer )
ExFreePoolWithTag(PreallocatedPacketBuffer, 0x41454857u);
LABEL_26:
if( *a2 )
ExFreePoolWithTag(*a2, 0x41454857u);
}
else
{
v12 = 0;
while( 1 )
{
v13 = v11;
if( v11 == -1 )
{
v5 = -1073741811;
goto LABEL_26;
}
v11 = _InterlockedCompareExchange((volatile signed __int32 *)(v10 + 152), v11 + 1, v11);
if( v13 == v11 )
break;
if( ++v12 >= 0xA )
goto LABEL_9;
}
v17 = 1;
LABEL_9:
if( v12 >= 0xA )
{
v20 = -2147483604;
goto LABEL_21;
}
v14 = *(_DWORD *)(v10 + 16);
if( KeGetCurrentIrql() >= 2u )
{
PreallocatedPacketBuffer = (char *)WheapGetPreallocatedPacketBuffer(ErrorSourceIda);
if( !PreallocatedPacketBuffer )
{
LABEL_13:
v5 = -1073741670;
goto LABEL_22;
}
PoolWithTag = *a2;
v4 = 1;
}
else
{
PreallocatedPacketBuffer = (char *)ExAllocatePoolWithTag(NonPagedPoolNx, v14, 0x41454857ui64);
if( !PreallocatedPacketBuffer )
goto LABEL_13;
PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x68ui64, 0x41454857ui64);
*a2 = PoolWithTag;
if( !PoolWithTag )
goto LABEL_13;
}
memset((INT64)PoolWithTag, 0i64);
*(_DWORD *)*a2 = 1095059543;
*((_DWORD *)*a2 + 3) = ErrorSourceIda;
*((_DWORD *)*a2 + 13) = 2;
*((_BYTE *)*a2 + 48) = v4;
*((_QWORD *)*a2 + 5) = PreallocatedPacketBuffer + 8;
*((_QWORD *)*a2 + 4) = PreallocatedPacketBuffer;
memset((INT64)(PreallocatedPacketBuffer + 8), 0i64);
*((_DWORD *)PreallocatedPacketBuffer + 2) = 1095059543;
*((_DWORD *)PreallocatedPacketBuffer + 3) = 3;
*((_DWORD *)PreallocatedPacketBuffer + 4) = v14 - 112;
*((_DWORD *)PreallocatedPacketBuffer + 19) = v14 - 192;
*((_DWORD *)PreallocatedPacketBuffer + 6) = 6;
*((_DWORD *)PreallocatedPacketBuffer + 7) = -2147483646;
*((_DWORD *)PreallocatedPacketBuffer + 8) = ErrorSourceIda;
*((_DWORD *)PreallocatedPacketBuffer + 9) = 12;
*(_OWORD *)(PreallocatedPacketBuffer + 40) = DEVICE_DRIVER_NOTIFY_TYPE_GUID;
*((_DWORD *)PreallocatedPacketBuffer + 16) = 7;
*((_DWORD *)PreallocatedPacketBuffer + 18) = 80;
*((_QWORD *)*a2 + 2) = PreallocatedPacketBuffer + 88;
*((_DWORD *)PreallocatedPacketBuffer + 22) &= 0xFFFFC00F;
*((_DWORD *)PreallocatedPacketBuffer + 26) = 2;
*((_DWORD *)PreallocatedPacketBuffer + 25) = *((_DWORD *)PreallocatedPacketBuffer + 4) - 100;
*((_QWORD *)*a2 + 3) = PreallocatedPacketBuffer + 108;
*((_DWORD *)*a2 + 2) += 100;
}
return v5;
}Referenced by:
WheaCreateHwErrorReportDeviceDriver