PiCMCaptureRegistryInputData

INT64 __fastcall PiCMCaptureRegistryInputData(_DWORD *a1, UINT64 a2, INT64 a3, INT64 a4){
  int v5; 
  INT8 CallerMode; 
  int UserModeCallersCopy; 
  char *v8; 
  _QWORD *v9; 
  VOID *v10; 
  UINT64 v11; 
  char *v13; 
  UINT64 AllocateDestination; 
  v5 = 0;
  CallerMode = *((_BYTE *)KeGetCurrentThread() + 562);
  UserModeCallersCopy = 0;
  if( !a1 || !(_DWORD)a2 )
  {
    UserModeCallersCopy = -1073741811;
    goto LABEL_18;
  }
  if( (_DWORD)a3 )
  {
    if( ((unsigned __int8)a1 & 3) != 0 )
      ExRaiseDatatypeMisalignment();
    v8 = (char *)a1 + (unsigned int)a2;
    if( (unsigned __int64)v8 > 0x7FFFFFFF0000i64 || v8 < (char *)a1 )
      MEMORY[0x7FFFFFFF0000] = 0;
    if( (unsigned int)a2 >= 0x24 && *a1 == 36 )
    {
      *(_DWORD *)a4 = 48;
      *(_DWORD *)(a4 + 4) = a1[1];
      *(_DWORD *)(a4 + 8) = a1[2];
      *(_QWORD *)(a4 + 16) = (unsigned int)a1[3];
      *(_DWORD *)(a4 + 24) = a1[4];
      *(_DWORD *)(a4 + 28) = a1[5];
      *(_DWORD *)(a4 + 32) = a1[6];
      *(_DWORD *)(a4 + 36) = a1[7];
      *(_DWORD *)(a4 + 40) = a1[8];
    }
    else
    {
      UserModeCallersCopy = -1073741811;
    }
  }
  else
  {
    if( ((unsigned __int8)a1 & 7) != 0 )
      ExRaiseDatatypeMisalignment();
    v13 = (char *)a1 + (unsigned int)a2;
    if( (unsigned __int64)v13 > 0x7FFFFFFF0000i64 || v13 < (char *)a1 )
      MEMORY[0x7FFFFFFF0000] = 0;
    if( (unsigned int)a2 < 0x30 )
    {
      UserModeCallersCopy = -1073741811;
    }
    else
    {
      *(_OWORD *)a4 = *(_OWORD *)a1;
      *(_OWORD *)(a4 + 16) = *((_OWORD *)a1 + 1);
      *(_OWORD *)(a4 + 32) = *((_OWORD *)a1 + 2);
      if( *(_DWORD *)a4 != 48 )
        UserModeCallersCopy = -1073741811;
    }
  }
  if( UserModeCallersCopy >= 0 )
  {
    v9 = (_QWORD *)(a4 + 16);
    v10 = *(VOID **)(a4 + 16);
    *(_QWORD *)(a4 + 16) = 0i64;
    if( v10 )
    {
      v11 = *(unsigned int *)(a4 + 24);
      if( (unsigned int)v11 >= 2 )
      {
        LODWORD(AllocateDestination) = 1;
        UserModeCallersCopy = PiControlMakeUserModeCallersCopy(
                                (VOID **)(a4 + 16),
                                v10,
                                v11,
                                2ui64,
                                CallerMode,
                                AllocateDestination);
        if( UserModeCallersCopy < 0 )
        {
          *v9 = 0i64;
          *(_DWORD *)(a4 + 24) = 0;
        }
        else
        {
          v5 = 1;
          *(_WORD *)(*v9 + 2 * ((unsigned __int64)*(unsigned int *)(a4 + 24) >> 1) - 2) = 0;
        }
LABEL_18:
        if( UserModeCallersCopy >= 0 )
          return(unsigned int)UserModeCallersCopy;
        goto LABEL_36;
      }
      if( *(_DWORD *)(a4 + 24) >= 2u )
        goto LABEL_18;
    }
    else if( !*(_DWORD *)(a4 + 24) )
    {
      goto LABEL_18;
    }
    UserModeCallersCopy = -1073741811;
  }
LABEL_36:
  if( v5 )
    PiControlFreeUserModeCallersBuffer(CallerMode, *(PVOID *)(a4 + 16));
  *(_OWORD *)a4 = 0i64;
  *(_OWORD *)(a4 + 16) = 0i64;
  *(_OWORD *)(a4 + 32) = 0i64;
  return(unsigned int)UserModeCallersCopy;
}

Referenced by:

PiCMOpenClassKey
PiCMOpenDeviceInterfaceKey
PiCMOpenDeviceKey
PiCMOpenObjectKey