DrvDbGetDriverPackageMappedPropertyKeys

__int64 __fastcall DrvDbGetDriverPackageMappedPropertyKeys(
        __int64 *a1,
        _WORD *a2,
        char *a3,
        __int64 a4,
        unsigned int a5,
        __int64 a6){
  unsigned int *v6; 
  unsigned int v7; 
  __int64 v10; 
  unsigned int v11; 
  signed int CompositeMappedPropertyKeys; 
  __int64 v13; 
  __int64 v14; 
  unsigned int v15; 
  __int64 *v16; 
  char *v17; 
  int DriverPackageMappedProperty; 
  __int64 v19; 
  __int64 v20; 
  __int64 v21; 
  unsigned int v22; 
  int v23; 
  unsigned int v24; 
  unsigned int v25; 
  const WCHAR **v26; 
  char *v27; 
  signed int Value; 
  const WCHAR *v29; 
  __int64 v30; 
  char *v31; 
  const WCHAR *v32; 
  __int64 v33; 
  __int64 v34; 
  unsigned int v35; 
  int v36; 
  unsigned int v37; 
  unsigned int *v39; 
  int v40; 
  __int64 v41; 
  void *Handle[2]; 
  v6 = (unsigned int *)a6;
  v7 = a5;
  v39 = (unsigned int *)a6;
  Handle[0] = 0i64;
  v41 = 0i64;
  v10 = a4;
  v11 = 0;
  v40 = 0;
  *(_DWORD *)a6 = 0;
  CompositeMappedPropertyKeys = DrvDbGetCompositeMappedPropertyKeys(
                                  (__int64)a1,
                                  (_OWORD **)&off_140C0F0B0,
                                  0xEu,
                                  a4,
                                  a5,
                                  v39);
  if( CompositeMappedPropertyKeys >= 0 )
  {
    v14 = *v6;
    if( (_DWORD)v14 )
    {
      if( v13 )
        v10 = v13 + 20 * v14;
      v7 = a5 - v14;
    }
    if( a3
      || (CompositeMappedPropertyKeys = DrvDbOpenDriverPackageRegKey(a1, (INT64)a2, 1i64, 0, (INT64)Handle, 0i64),
          CompositeMappedPropertyKeys >= 0) )
    {
      v15 = 0;
      v16 = off_1400099D0;
      while( 1 )
      {
        v17 = (char *)Handle[0];
        if( a3 )
          v17 = a3;
        DriverPackageMappedProperty = DrvDbGetDriverPackageMappedProperty(
                                        a1,
                                        a2,
                                        v17,
                                        *v16,
                                        (__int64)&v41 + 4,
                                        0i64,
                                        0,
                                        (__int64)&v41);
        if( DriverPackageMappedProperty != -1073741275 )
        {
          if( DriverPackageMappedProperty && DriverPackageMappedProperty != -1073741789 )
            goto LABEL_23;
          if( v10 && v11 < v7 )
          {
            v19 = *v16;
            v20 = v11++;
            v21 = 5 * v20;
            *(_OWORD *)(v10 + 4 * v21) = *(_OWORD *)*v16;
            *(_DWORD *)(v10 + 4 * v21 + 16) = *(_DWORD *)(v19 + 16);
          }
          v22 = *v6;
          v23 = -1;
          v24 = *v6 + 1;
          if( v24 >= *v6 )
            v23 = *v6 + 1;
          *v6 = v23;
          if( v24 < v22 )
            break;
        }
        ++v15;
        ++v16;
        if( v15 >= 2 )
          goto LABEL_23;
      }
      *v6 = 0;
LABEL_23:
      v25 = 0;
      v26 = (const WCHAR **)&off_140001760;
      do
      {
        LODWORD(a6) = 0;
        v27 = (char *)Handle[0];
        if( a3 )
          v27 = a3;
        Value = RegRtlQueryValue(v27, v26[2], 0i64, 0i64, (__int64)&a6);
        CompositeMappedPropertyKeys = Value;
        if( Value == -1073741772 )
        {
          v29 = *v26;
          if( *((_DWORD *)*v26 + 4) != 7 )
            goto LABEL_35;
          v30 = *(_QWORD *)v29 - *(_QWORD *)&DEVPKEY_DriverPackage_SignerName;
          if( *(_QWORD *)v29 == *(_QWORD *)&DEVPKEY_DriverPackage_SignerName )
            v30 = *((_QWORD *)v29 + 1) + 0x4524B8338B5D1E6Ci64;
          if( v30 )
            goto LABEL_35;
          v31 = (char *)Handle[0];
          if( a3 )
            v31 = a3;
          if( (int)DrvDbGetDriverPackageSignerScore(a1, a2, v31, (wchar_t *)&v40) < 0 || v40 != 218103811 )
          {
LABEL_35:
            CompositeMappedPropertyKeys = 0;
            goto LABEL_44;
          }
        }
        else if( Value && Value != -1073741789 )
        {
          break;
        }
        if( v10 && v11 < v7 )
        {
          v32 = *v26;
          v33 = v11++;
          v34 = 5 * v33;
          *(_OWORD *)(v10 + 4 * v34) = *(_OWORD *)*v26;
          *(_DWORD *)(v10 + 4 * v34 + 16) = *((_DWORD *)v32 + 4);
        }
        v35 = *v6;
        v36 = -1;
        v37 = *v6 + 1;
        if( v37 >= *v6 )
          v36 = *v6 + 1;
        CompositeMappedPropertyKeys = v37 < v35 ? 0xC0000095 : 0;
        *v6 = v36;
        if( v37 < v35 )
        {
          *v6 = 0;
          break;
        }
LABEL_44:
        ++v25;
        v26 += 5;
      }
      while( v25 < 0x20 );
    }
    if( Handle[0] )
      ZwClose(Handle[0]);
  }
  return(unsigned int)CompositeMappedPropertyKeys;
}

Referenced by:

DrvDbDispatchDriverPackage