KsepPatchImportTableEntry

NTSTATUS __stdcall KsepPatchImportTableEntry(
        UINT64 *ImportThunk,
        UINT64 ImportSize,
        UINT64 OriginalAddress,
        UINT64 PatchedAddress){
  int v4; 
  unsigned int v6; 
  unsigned int v7; 

  v4 = 0;
  if( !ImportThunk || !(_DWORD)ImportSize || !OriginalAddress || !PatchedAddress )
    return -1073741811;
  v6 = (unsigned int)ImportSize >> 3;
  v7 = 0;
  if( v6 )
  {
    while( *ImportThunk != OriginalAddress )
    {
      ++v7;
      ++ImportThunk;
      if( v7 >= v6 )
        return v4 == 0 ? 0xC0000225 : 0;
    }
    MmReplaceImportEntry(ImportThunk, PatchedAddress);
    v4 = 1;
  }
  return v4 == 0 ? 0xC0000225 : 0;
}

Referenced by:

KsepPatchDriverImportsTable