PiDrvDbEnumDriverStoreNodes

VOID __fastcall PiDrvDbEnumDriverStoreNodes(INT64 a1, INT64 a2){
  WCHAR v2; 
  _WORD *PoolWithTag; 
  NTSTATUS i; 
  _QWORD *v7; 
  void *DirectoryHandle; 
  struct _UNICODE_STRING DestinationString; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  UINT64 ReturnLength; 
  UINT64 Context; 
  *(_QWORD *)&ObjectAttributes.Length = 48i64;
  DirectoryHandle = 0i64;
  LODWORD(Context) = 0;
  LODWORD(ReturnLength) = 0;
  *(_QWORD *)&ObjectAttributes.Attributes = 576i64;
  PoolWithTag = 0i64;
  DestinationString = 0i64;
  RtlInitUnicodeString(&DestinationString, L"\\DriverStores", v2);
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.ObjectName = &DestinationString;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  if( ZwOpenDirectoryObject(&DirectoryHandle, 1ui64, &ObjectAttributes) >= 0 )
  {
    PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x400ui64, 0x62647050ui64);
    if( PoolWithTag )
    {
      for( i = ZwQueryDirectoryObject(DirectoryHandle, PoolWithTag, 0x400ui64, 1u, 1u, &Context, &ReturnLength);
            i != -2147483622 && i >= 0;
            i = ZwQueryDirectoryObject(DirectoryHandle, PoolWithTag, 0x400ui64, 1u, 0, &Context, &ReturnLength) )
      {
        v7 = PoolWithTag;
        if( *PoolWithTag )
        {
          do
          {
            if( !((unsigned __int8(__fastcall *)(_QWORD, INT64))a1)(v7[1], a2) )
              break;
            v7 += 4;
          }
          while( *(_WORD *)v7 );
        }
      }
    }
  }
  if( DirectoryHandle )
    ZwClose(DirectoryHandle);
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0);
}

Referenced by:

PiDrvDbInit
PiPnpRtlInit