PiDmObjectUpdateCachedObjectProperty

VOID __fastcall PiDmObjectUpdateCachedObjectProperty(
        UINT64 a1,
        WCHAR *a2,
        INT64 a3,
        INT64 a4,
        INT64 a5,
        INT64 a6,
        WCHAR *buf2,
        UINT64 NumberOfBytes){
  bool v8; 
  unsigned int v10; 
  INT64 *v11; 
  unsigned int CachedKeyIndex; 
  __int64 v13; 
  unsigned int v14; 
  _ETHREAD *CurrentThread; 
  ULONG_PTR v16; 
  __int64 v17; 
  WCHAR *v18; 
  unsigned int v19; 
  int ObjectProperty; 
  void *v21; 
  int v22; 
  unsigned int v23; 
  _ETHREAD *v24; 
  INT64 v25; 
  size_t Size; 
  void *Buf1; 
  ULONG_PTR BugCheckParameter2; 
  DEVPROPKEY **v29; 
  INT64 v30; 
  int v31; 
  int v32; 
  unsigned int v33; 
  v32 = HIDWORD(a3);
  BugCheckParameter2 = 0i64;
  v8 = 0;
  v29 = 0i64;
  v33 = 0;
  v10 = a1;
  v31 = 0;
  Buf1 = 0i64;
  LODWORD(Size) = 0;
  if( !a4 )
  {
    PiDmGetCacheKeys(a1, &v29, &v33);
    if( v33 )
    {
      v11 = (INT64 *)a5;
      CachedKeyIndex = PiDmGetCachedKeyIndex((__int64)v29, v33, a5);
      v13 = CachedKeyIndex;
      if( CachedKeyIndex < v14 && (int)PiDmGetObject(v10, a2, (INT64 *)&BugCheckParameter2) >= 0 )
      {
        CurrentThread = (_ETHREAD *)KeGetCurrentThread();
        --*((_WORD *)CurrentThread + 242);
        v16 = BugCheckParameter2;
        ExAcquirePushLockExclusiveEx(BugCheckParameter2, 0i64);
        v17 = 3 * v13;
        v18 = buf2;
        v19 = *(_DWORD *)(v16 + 112 + 8 * v17);
        v30 = v16 + 112 + 8 * v17;
        v33 = v19;
        if( v19 <= 1 )
        {
          PiDmCacheDataEncode(
            a6,
            (int *)buf2,
            NumberOfBytes,
            (int)v29[v17 + 1],
            HIDWORD(v29[v17 + 1]),
            v16 + 112 + 8 * v17);
          v8 = v33 == 0;
        }
        ExReleasePushLockEx(v16, 0i64);
        KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
        if( !v8 )
          goto LABEL_9;
        LODWORD(v25) = 0x10000;
        ObjectProperty = PnpGetObjectProperty(
                           1517317712i64,
                           (unsigned int)NumberOfBytes,
                           (INT64)a2,
                           v10,
                           0i64,
                           0i64,
                           v11,
                           (UINT64)&v31,
                           (INT64)&Buf1,
                           (ULONG *)&Size,
                           v25);
        v21 = Buf1;
        v22 = ObjectProperty;
        if( ObjectProperty == -1073741275 )
        {
          v31 = 0;
          v22 = 0;
          if( Buf1 )
          {
            ExFreePoolWithTag(Buf1, 0x5A706E50u);
            v21 = 0i64;
            Buf1 = 0i64;
          }
          v23 = 0;
        }
        else
        {
          v23 = Size;
        }
        if( v22 < 0 || v31 != (_DWORD)a6 || v23 != (_DWORD)NumberOfBytes )
          goto LABEL_26;
        if( v21 )
        {
          if( !v18 )
            goto LABEL_26;
        }
        else if( v18 )
        {
          goto LABEL_26;
        }
        if( !v23 )
          goto LABEL_20;
        if( !v21 )
        {
LABEL_9:
          PiDmObjectRelease((CHAR *)BugCheckParameter2);
          return;
        }
        if( !memcmp(v21, v18, v23) )
        {
LABEL_20:
          if( v21 )
            ExFreePoolWithTag(v21, 0x5A706E50u);
          goto LABEL_9;
        }
LABEL_26:
        v24 = (_ETHREAD *)KeGetCurrentThread();
        --*((_WORD *)v24 + 242);
        ExAcquirePushLockExclusiveEx(BugCheckParameter2, 0i64);
        PiDmCacheDataFree(v30);
        ExReleasePushLockEx(BugCheckParameter2, 0i64);
        KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
        v21 = Buf1;
        goto LABEL_20;
      }
    }
  }
}

Referenced by:

PiDmObjectUpdateCachedCmProperty
PiPnpRtlObjectActionCallback