MmCallDllInitialize
NTSTATUS __stdcall MmCallDllInitialize(_KLDR_DATA_TABLE_ENTRY *DataTableEntry, _LIST_ENTRY *ModuleListHead){
INT8 v2;
void *v5;
__int64(__fastcall *v6)(struct _UNICODE_STRING *);
__int64(__fastcall *v7)(struct _UNICODE_STRING *);
unsigned __int16 v8;
wchar_t *v9;
WCHAR *v10;
unsigned int Length;
UINT8 *v12;
unsigned __int16 v13;
wchar_t *v14;
WCHAR *v15;
unsigned int inited;
int v17;
struct _UNICODE_STRING Destination;
UNICODE_STRING Source;
v5 = (void *)*((_QWORD *)DataTableEntry + 6);
Destination = 0i64;
Source = 0i64;
LODWORD(v6) = RtlFindExportedRoutineByName(v5, (PSTR)"DllInitialize", v2);
v7 = v6;
if( v6 )
{
v8 = *((_WORD *)DataTableEntry + 44);
if( (unsigned __int16)(v8 + 2) > v8 )
{
Source.MaximumLength = v8 + 2;
LODWORD(v9) = MiAllocatePool((struct _SLIST_ENTRY *)0x100);
Source.Buffer = v9;
v10 = v9;
if( !v9 )
{
LODWORD(v6) = -1073741670;
return(int)v6;
}
v12 = (UINT8 *)*((_QWORD *)DataTableEntry + 12);
Source.Length = *((_WORD *)DataTableEntry + 44);
Length = Source.Length;
memmove((UINT8 *)v9, v12, Source.Length);
v13 = *(_WORD *)CmRegistryMachineSystemCurrentControlSetServices + Source.Length;
if( (unsigned __int16)(*(_WORD *)CmRegistryMachineSystemCurrentControlSetServices + Source.Length) > *(_WORD *)CmRegistryMachineSystemCurrentControlSetServices )
{
if( (unsigned __int16)(v13 + 4) <= v13 )
{
v17 = -1073741562;
}
else
{
Destination.MaximumLength = v13 + 4;
LODWORD(v14) = MiAllocatePool((struct _SLIST_ENTRY *)0x40);
Destination.Buffer = v14;
if( v14 )
{
Destination.Length = *(_WORD *)CmRegistryMachineSystemCurrentControlSetServices;
memmove(
(UINT8 *)v14,
(UINT8 *)*(&CmRegistryMachineSystemCurrentControlSetServices + 1),
*(unsigned __int16 *)CmRegistryMachineSystemCurrentControlSetServices);
RtlAppendUnicodeToString(&Destination, (PWCHAR)L"\\");
v10[(unsigned __int64)Length >> 1] = 0;
v15 = wcschr(v10, 0x2Eu);
if( v15 )
{
Source.Length = 2 * (v15 - v10);
LOWORD(Length) = Source.Length;
}
v10[(unsigned __int64)(unsigned __int16)Length >> 1] = 0;
RtlAppendUnicodeStringToString(&Destination, &Source);
ExFreePoolWithTag(v10, 0);
inited = VfDriverInitStarting();
v17 = v7(&Destination);
ExFreePoolWithTag(Destination.Buffer, 0);
if( v17 >= 0 && !byte_140C4CA28 )
VfDriverInitSuccess(inited, ModuleListHead);
goto LABEL_12;
}
v17 = -1073741670;
}
ExFreePoolWithTag(v10, 0);
LABEL_12:
LODWORD(v6) = v17;
return(int)v6;
}
ExFreePoolWithTag(v10, 0);
}
LODWORD(v6) = -1073741562;
}
return(int)v6;
}Referenced by:
MiLoadImportDll
PipInitializeDriverDependentDLLs