KsepGetLoadedModulesList

NTSTATUS __stdcall KsepGetLoadedModulesList(_RTL_PROCESS_MODULES **LoadedModules){
  unsigned int i; 
  _RTL_PROCESS_MODULES *v3; 
  _RTL_PROCESS_MODULES *v4; 
  int SystemInformation; 
  ULONG NumberOfModules; 
  NTSTATUS v7; 
  if( !LoadedModules )
    return -1073741811;
  for( i = 304; ; i = 296 * NumberOfModules + 8 )
  {
    KsepPoolAllocatePaged(i);
    v4 = v3;
    if( !v3 )
      return -1073741670;
    SystemInformation = ZwQuerySystemInformation();
    NumberOfModules = v4->NumberOfModules;
    v7 = SystemInformation;
    if( SystemInformation >= 0 )
      break;
    if( SystemInformation != -1073741820 )
      goto LABEL_8;
    KsepPoolFreePaged(v4);
  }
  *LoadedModules = v4;
LABEL_8:
  if( SystemInformation < 0 )
    KsepPoolFreePaged(v4);
  return v7;
}

Referenced by:

KseRegisterShimEx
KsepResolveApplicableShimsForDriver