PpCheckInDriverDatabase

NTSTATUS __stdcall PpCheckInDriverDatabase(
        UNICODE_STRING *KeyName,
        PVOID KeyHandle,
        PVOID ImageBase,
        UINT64 ImageSize,
        UINT64 IsFilter,
        GUID *EntryGuid){
  unsigned int v6; 
  INT64 v8; 
  INT64 v9; 
  NTSTATUS v10; 
  INT64 v11; 
  _ETHREAD *CurrentThread; 
  GUID *v13; 
  UINT64 v15; 
  UNICODE_STRING FullPath; 
  struct _UNICODE_STRING DestinationString; 
  FullPath = 0i64;
  v6 = ImageSize;
  if( InitIsWinPEMode || !PpBootDDBInitialized )
    return 0;
  v10 = IopBuildFullDriverPath(KeyName, KeyHandle, &FullPath);
  if( v10 < 0 )
  {
    if( (PiLoggedErrorEventsMask & 8) == 0 )
    {
      PiLoggedErrorEventsMask |= 8u;
      DestinationString = 0i64;
      RtlInitUnicodeString(&DestinationString, L"BUILD DRIVER PATH FAILED", v11);
      LODWORD(v15) = 0;
      PnpLogEvent(&DestinationString, 0i64, 3221226349i64, 0i64, v15);
    }
  }
  else
  {
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --*((_WORD *)CurrentThread + 242);
    ExAcquireResourceExclusiveLite(&PiDDBLock, 1u);
    v10 = PiLookupInDDBCache(&FullPath, ImageBase, v13);
    if( v10 == -1073741823 )
      v10 = PiLookupInDDB(&FullPath, ImageBase, v6, EntryGuid);
    if( v10 == -1073740948 && !(_DWORD)IsFilter )
      v10 = -1073740949;
    ExReleaseResourceLite(&PiDDBLock);
    KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
    ExFreePoolWithTag(FullPath.Buffer, 0);
  }
  if( (unsigned int)(v10 + 1073740949) > 1 )
    return 0;
  if( (byte_140C130BA & 2) != 0 )
    McTemplateK0j_EtwWriteTransfer(v9, v8, v11, (INT64)EntryGuid);
  return v10;
}

Referenced by:

PnpPrepareDriverLoading