MmGetSystemRoutineAddress

VOID *__stdcall MmGetSystemRoutineAddress(_UNICODE_STRING *SystemRoutineName){
  _UNICODE_STRING *i; 
  VOID *ExportedRoutineByName; 
  _STRING DestinationString; 

  DestinationString = 0i64;
  for( i = SystemRoutineName; RtlUnicodeStringToAnsiString(&DestinationString, i, 1u) < 0; i = SystemRoutineName )
    KeDelayExecutionThread(0, 0, (_LARGE_INTEGER *)&Interval);
  ExportedRoutineByName = RtlFindExportedRoutineByName((VOID *)PsNtosImageBase, DestinationString.Buffer);
  if( !ExportedRoutineByName )
    ExportedRoutineByName = RtlFindExportedRoutineByName(PsHalImageBase, DestinationString.Buffer);
  RtlFreeAnsiString((_UNICODE_STRING *)&DestinationString);
  if( ExportedRoutineByName && MiMarkKernelCfgTarget((INT64)ExportedRoutineByName) < 0 )
    return 0i64;
  else
    return ExportedRoutineByName;
}

Referenced by:

HalpCmciLoadThresholdConfiguration