PiDevCfgCopyObjectProperties

__int64 __fastcall PiDevCfgCopyObjectProperties(
        INT64 a1,
        INT64 a2,
        UINT64 a3,
        VOID *a4,
        UINT64 NumberOfBytes,
        INT64 a6,
        UINT64 a7,
        __int64 a8,
        __int64 a9,
        __int64 a10,
        INT64 a11){
  __int64 v11; 
  unsigned int v13; 
  int ObjectPropertyKeys; 
  int ObjectProperty; 
  HANDLE v19; 
  char *PoolWithTag; 
  HANDLE v21; 
  int GenericStorePropertyKeys; 
  void *v23; 
  int v24; 
  HANDLE v25; 
  unsigned int v26; 
  INT64 v27; 
  int a5; 
  int a5a; 
  INT64 v30; 
  INT64 v31; 
  INT64 v32; 
  INT64 v33; 
  INT64 v34; 
  HANDLE Handle; 
  __int64 v36; 
  HANDLE v37; 
  INT64 v38; 
  INT64 a1a; 
  unsigned int v42; 
  v11 = PiPnpRtlCtx;
  a1a = PiPnpRtlCtx;
  Handle = 0i64;
  v13 = a3;
  v37 = 0i64;
  v42 = 0;
  LODWORD(v34) = 1;
  LODWORD(NumberOfBytes) = 0;
  if( !a4 )
  {
    ObjectProperty = PnpOpenObjectRegKey(a1, a2, a3, 33554433, 0, (__int64)&Handle);
    if( ObjectProperty < 0 )
      goto LABEL_8;
    v11 = a1a;
  }
  if( a8 || (ObjectProperty = PnpOpenObjectRegKey(v11, a6, a7, 33554433, 0, (__int64)&v37), ObjectProperty >= 0) )
  {
    if( v13 )
    {
      v19 = Handle;
      if( a4 )
        v19 = a4;
      ObjectPropertyKeys = PnpGetObjectPropertyKeys(a1, a2, v13, (__int64)v19, a5, 0, 0i64, 0, (__int64)&v42);
    }
    else
    {
      ObjectPropertyKeys = PnpGetGenericStorePropertyKeys(a1, (char *)a4, 0i64, 0, 0i64, 0, &v42);
    }
    ObjectProperty = ObjectPropertyKeys;
    if( (int)(ObjectPropertyKeys + 0x80000000) < 0 || ObjectPropertyKeys == -1073741789 )
    {
      if( !v42 )
      {
        ObjectProperty = 0;
        goto LABEL_8;
      }
      PoolWithTag = (char *)ExAllocatePoolWithTag(PagedPool, 20i64 * v42, 0x63647050ui64);
      if( !PoolWithTag )
      {
        ObjectProperty = -1073741670;
        goto LABEL_8;
      }
      if( v13 )
      {
        v21 = Handle;
        if( a4 )
          v21 = a4;
        GenericStorePropertyKeys = PnpGetObjectPropertyKeys(
                                     a1,
                                     a2,
                                     v13,
                                     (__int64)v21,
                                     a5a,
                                     0,
                                     (__int64)PoolWithTag,
                                     v42,
                                     (__int64)&v42);
      }
      else
      {
        GenericStorePropertyKeys = PnpGetGenericStorePropertyKeys(
                                     a1,
                                     (char *)a4,
                                     0i64,
                                     0,
                                     (__int64)PoolWithTag,
                                     v42,
                                     &v42);
      }
      ObjectProperty = GenericStorePropertyKeys;
      if( GenericStorePropertyKeys < 0 )
        goto LABEL_57;
      v36 = 256i64;
      v23 = ExAllocatePoolWithTag(PagedPool, 0x100ui64, 0x63647050ui64);
      if( !v23 )
      {
        ObjectProperty = -1073741670;
LABEL_57:
        ExFreePoolWithTag(PoolWithTag, 0);
        goto LABEL_8;
      }
      v24 = 0;
      if( !v42 )
      {
LABEL_55:
        if( v23 )
          ExFreePoolWithTag(v23, 0);
        goto LABEL_57;
      }
      while( 1 )
      {
        if( a9 && !((unsigned __int8(__fastcall *)(char *, __int64))a9)(&PoolWithTag[20 * v24], a10) )
          goto LABEL_51;
        if( v13 )
        {
          v25 = Handle;
          v26 = v36;
          if( a4 )
            v25 = a4;
          v38 = (INT64)&PoolWithTag[20 * v24];
          ObjectProperty = PnpGetObjectProperty(
                             a1,
                             a2,
                             v13,
                             (__int64)v25,
                             0i64,
                             v38,
                             (int *)&v34,
                             (unsigned __int64)v23,
                             v36,
                             (ULONG *)&NumberOfBytes,
                             a11);
          if( ObjectProperty == -1073741822 )
          {
            ObjectProperty = 0;
            goto LABEL_51;
          }
        }
        else
        {
          v26 = v36;
          v38 = (INT64)&PoolWithTag[20 * v24];
          ObjectProperty = PnpGetGenericStoreProperty(
                             a1,
                             (char *)a4,
                             0i64,
                             v38,
                             &v34,
                             (__int64)v23,
                             v36,
                             &NumberOfBytes);
        }
        if( ObjectProperty == -1073741789 )
        {
          if( (unsigned int)NumberOfBytes <= v26 )
          {
            ObjectProperty = -1073741595;
            goto LABEL_55;
          }
          ExFreePoolWithTag(v23, 0);
          v36 = (unsigned int)NumberOfBytes;
          v23 = ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x63647050ui64);
          if( !v23 )
          {
            ObjectProperty = -1073741670;
            goto LABEL_55;
          }
          ObjectProperty = 0;
          --v24;
        }
        else
        {
          if( ObjectProperty < 0 )
            goto LABEL_55;
          v27 = (INT64)v37;
          if( a8 )
            v27 = a8;
          LODWORD(v33) = a11;
          LODWORD(v32) = NumberOfBytes;
          LODWORD(v31) = v34;
          ObjectProperty = PiDevCfgSetObjectProperty(
                             a1a,
                             0i64,
                             (WCHAR *)a6,
                             (unsigned int)a7,
                             v27,
                             v30,
                             v38,
                             v31,
                             (WCHAR *)v23,
                             v32,
                             v33);
          if( ObjectProperty == -1073741790 )
            ObjectProperty = 0;
          if( ObjectProperty < 0 )
            goto LABEL_55;
        }
LABEL_51:
        if( ++v24 >= v42 )
          goto LABEL_55;
      }
    }
  }
LABEL_8:
  if( Handle )
    ZwClose(Handle);
  if( v37 )
    ZwClose(v37);
  return(unsigned int)ObjectProperty;
}

Referenced by:

PiDevCfgConfigureDeviceDriverConfiguration
PiDevCfgConfigureDeviceInterface
PiDevCfgInitDriverDatabaseCallback