RtlFindExportedRoutineByName
VOID *__stdcall RtlFindExportedRoutineByName(VOID *DllBase, INT8 *AnsiImageRoutineName){
char *v4;
char *v5;
char *v6;
int v7;
char *v8;
char *v9;
int v10;
INT8 *v11;
int v12;
signed __int64 v13;
INT8 v14;
int v15;
UINT64 v17;
LODWORD(v17) = 0;
v4 = (char *)RtlImageDirectoryEntryToData(DllBase, 1u, 0, &v17);
v5 = v4;
v6 = 0i64;
if( v4 )
{
v7 = 0;
v8 = (char *)DllBase + *((unsigned int *)v4 + 8);
v9 = (char *)DllBase + *((unsigned int *)v4 + 9);
v10 = *((_DWORD *)v4 + 6) - 1;
if( v10 >= 0 )
{
do
{
v11 = AnsiImageRoutineName;
v12 = (v7 + v10) >> 1;
v13 = (_BYTE *)DllBase + *(unsigned int *)&v8[4 * v12] - AnsiImageRoutineName;
while( 1 )
{
v14 = *v11;
if( *v11 != v11[v13] )
break;
++v11;
if( !v14 )
{
v15 = 0;
goto LABEL_7;
}
}
v15 = (unsigned __int8)*v11 < (unsigned __int8)v11[v13] ? -1 : 1;
LABEL_7:
if( v15 < 0 )
{
if( !v12 )
return v6;
v10 = v12 - 1;
}
else
{
if( v15 <= 0 )
break;
v7 = v12 + 1;
}
}
while( v10 >= v7 );
if( v10 >= v7 && (unsigned int)*(unsigned __int16 *)&v9[2 * v12] < *((_DWORD *)v5 + 5) )
{
v6 = (char *)DllBase
+ *(unsigned int *)((char *)DllBase + 4 * *(unsigned __int16 *)&v9[2 * v12] + *((unsigned int *)v5 + 7));
if( v6 > v5 && v6 < &v5[(unsigned int)v17] )
return 0i64;
}
}
}
return v6;
}Referenced by:
KsepResolveShimHooks
MiCompactServiceTable
MiUnloadApproved
MmCallDllInitialize
MmGetSystemRoutineAddress
PspInitializeSystemDlls