WheapInitializeErrorSource
NTSTATUS __stdcall WheapInitializeErrorSource(_WHEAP_ERROR_SOURCE *Source){
NTSTATUS v2;
unsigned int v3;
unsigned int NumRecordsToPreallocate;
unsigned int v5;
UINT64 v6;
VOID **PoolWithTag;
_WHEAP_ERROR_RECORD_WRAPPER *v8;
_WHEAP_ERROR_RECORD_WRAPPER *v9;
unsigned int i;
__int64 v11;
if( Source->Descriptor.Type > (unsigned int)WheaErrSrcTypeDeviceDriver )
return -1073741811;
Source->PoolTag = 1634035799;
Source->Type = Source->Descriptor.Type;
Source->SectionCount = Source->Descriptor.MaxSectionsPerRecord;
v2 = 0;
if( WheapCallErrorSourceCorrect((INT64)Source) >= 0 )
{
v3 = Source->SectionLength + 72;
Source->PlatformErrorSourceId = Source->Descriptor.PlatformErrorSourceId;
NumRecordsToPreallocate = Source->Descriptor.NumRecordsToPreallocate;
Source->RecordCount = NumRecordsToPreallocate;
v5 = (Source->Descriptor.MaxSectionsPerRecord * v3 + 175) & 0xFFFFFFF8;
Source->RecordLength = v5;
if( NumRecordsToPreallocate )
{
v6 = v5 * NumRecordsToPreallocate;
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, v6, 1634035799i64);
v8 = (_WHEAP_ERROR_RECORD_WRAPPER *)PoolWithTag;
if( PoolWithTag )
{
memset(PoolWithTag, 0i64, v6);
v9 = v8;
for( i = 0; i < Source->RecordCount; ++i )
{
WheapInitializeErrorRecordWrapper(v9, v5, Source);
v9 = (_WHEAP_ERROR_RECORD_WRAPPER *)(v5 + v11);
}
Source->Records = v8;
}
else
{
return -1073741670;
}
}
return v2;
}
return 0;
}Referenced by:
WheaAddErrorSource
WheapInitializeDeferredErrorSources
WheapInitializeErrorSourceTable