CmpReplicateKeyToVirtual

__int64 __fastcall CmpReplicateKeyToVirtual(
        PVOID BugCheckParameter2,
        _SECURITY_SUBJECT_CONTEXT *a2,
        WCHAR a3,
        _QWORD *a4){
  char v4; 
  PVOID v7; 
  char v8; 
  _ERESOURCE *v9; 
  int VirtualStoreRoot; 
  _UNICODE_STRING *v11; 
  _DWORD *v12; 
  __int64 v13; 
  INT64 v14; 
  INT64 v15; 
  _UNICODE_STRING *p_DestinationString; 
  _DWORD a3a[2]; 
  _UNICODE_STRING DestinationString; 
  PVOID P; 
  UINT64 Cell; 
  __int64 v22; 
  _QWORD *v23; 
  _LARGE_INTEGER TimeStamp[2]; 
  __int128 v25; 

  v23 = a4;
  v4 = a3;
  a3a[1] = 0;
  DestinationString = 0i64;
  v7 = 0i64;
  *(_OWORD *)&TimeStamp[0].anonymous_0.LowPart = 0i64;
  v25 = 0i64;
  if( *(BOOLEAN **)((char *)&NlsMbCodePageTag + 7) )
    EtwGetKernelTraceTimestamp(TimeStamp, 0x20000ui64);
  Cell = 0i64;
  P = 0i64;
  a3a[0] = 0;
  v8 = 0;
  RtlInitUnicodeString(&DestinationString, 0i64);
  v22 = 0i64;
  if( *(BOOLEAN **)((char *)&NlsMbCodePageTag + 7) && BugCheckParameter2 )
    v7 = BugCheckParameter2;
  if( !v4 )
  {
    v8 = CmpTryConvertRegistryExclusive(v9);
    if( !v8 )
    {
      VirtualStoreRoot = -1073741739;
LABEL_22:
      if( *(BOOLEAN **)((char *)&NlsMbCodePageTag + 7) )
      {
        p_DestinationString = &DestinationString;
        LOBYTE(p_DestinationString) = 26;
        (*(void(__fastcall **)(_UNICODE_STRING *, _LARGE_INTEGER *, _QWORD, _QWORD, PVOID, _UNICODE_STRING *))((char *)&NlsMbCodePageTag + 7))(
          p_DestinationString,
          TimeStamp,
          (unsigned int)VirtualStoreRoot,
          0i64,
          v7,
          &DestinationString);
      }
      if( DestinationString.Buffer )
        RtlFreeAnsiString(&DestinationString);
      return(unsigned int)VirtualStoreRoot;
    }
  }
  CmpUnlockKcb((_CM_KEY_CONTROL_BLOCK *)BugCheckParameter2);
  VirtualStoreRoot = CmRealKCBToVirtualPath((__int64)BugCheckParameter2, 0i64, (__int64)a2, &DestinationString);
  if( VirtualStoreRoot >= 0 )
  {
    if( (int)CmpBuildVirtualReplicationStack((INT64)BugCheckParameter2, (INT64)&DestinationString, a3a, &P) >= 0 )
    {
      v12 = P;
      if( a3a[0] )
      {
        VirtualStoreRoot = CmpGetVirtualStoreRoot((_CMHIVE **)a2, &Cell);
        if( VirtualStoreRoot >= 0 )
        {
          v13 = v22;
          v14 = Cell;
          v15 = a3a[0];
          *v23 = Cell;
          v12[8] = *(_DWORD *)(v13 + 40);
          *((_QWORD *)v12 + 2) = v13;
          VirtualStoreRoot = CmpDoBuildVirtualStack((INT64)v12, v15, v14, (INT64)BugCheckParameter2, (INT64)a2);
        }
      }
      else
      {
        VirtualStoreRoot = -1073741811;
      }
      if( v12 )
      {
        CmpDestroyVirtualStack((INT64)v12, a3a[0]);
        ExFreePoolWithTag(v12, 0);
      }
    }
    else
    {
      VirtualStoreRoot = -1073741670;
    }
    CmpLockKcbExclusive((INT64)BugCheckParameter2);
    if( v8 )
      CmpConvertRegistryShared();
    goto LABEL_22;
  }
  if( *(BOOLEAN **)((char *)&NlsMbCodePageTag + 7) )
  {
    v11 = &DestinationString;
    LOBYTE(v11) = 26;
    (*(void(__fastcall **)(_UNICODE_STRING *, _LARGE_INTEGER *, _QWORD, _QWORD, PVOID, _UNICODE_STRING *))((char *)&NlsMbCodePageTag + 7))(
      v11,
      TimeStamp,
      (unsigned int)VirtualStoreRoot,
      0i64,
      v7,
      &DestinationString);
  }
  return(unsigned int)VirtualStoreRoot;
}

Referenced by:

No references.