PiCMCapturePropertyInputData

INT64 __fastcall PiCMCapturePropertyInputData(UINT64 a1, UINT64 a2, INT64 a3, INT64 a4){
  INT8 CallerMode; 
  int UserModeCallersCopy; 
  UINT64 v7; 
  _QWORD *v8; 
  VOID *v9; 
  UINT64 v10; 
  VOID *v11; 
  UINT64 v13; 
  UINT64 v14; 
  UINT64 AllocateDestination; 
  int v16; 
  int v17; 
  v16 = 0;
  v17 = 0;
  CallerMode = *((_BYTE *)KeGetCurrentThread() + 562);
  UserModeCallersCopy = 0;
  if( !a1 || !(_DWORD)a2 )
  {
    UserModeCallersCopy = -1073741811;
    goto LABEL_21;
  }
  if( (_DWORD)a3 )
  {
    if( (a1 & 3) != 0 )
      ExRaiseDatatypeMisalignment();
    v13 = a1 + (unsigned int)a2;
    if( v13 > 0x7FFFFFFF0000i64 || v13 < a1 )
      MEMORY[0x7FFFFFFF0000] = 0;
    if( (unsigned int)a2 >= 0x38 && *(_DWORD *)a1 == 56 )
    {
      *(_DWORD *)a4 = 72;
      *(_DWORD *)(a4 + 4) = *(_DWORD *)(a1 + 4);
      *(_DWORD *)(a4 + 8) = *(_DWORD *)(a1 + 8);
      *(_QWORD *)(a4 + 16) = *(unsigned int *)(a1 + 12);
      *(_DWORD *)(a4 + 24) = *(_DWORD *)(a1 + 16);
      *(_OWORD *)(a4 + 28) = *(_OWORD *)(a1 + 20);
      *(_DWORD *)(a4 + 44) = *(_DWORD *)(a1 + 36);
      *(_DWORD *)(a4 + 48) = *(_DWORD *)(a1 + 40);
      *(_QWORD *)(a4 + 56) = *(unsigned int *)(a1 + 44);
      *(_DWORD *)(a4 + 64) = *(_DWORD *)(a1 + 48);
      *(_DWORD *)(a4 + 68) = *(_DWORD *)(a1 + 52);
    }
    else
    {
      UserModeCallersCopy = -1073741811;
    }
  }
  else
  {
    if( (a1 & 7) != 0 )
      ExRaiseDatatypeMisalignment();
    v7 = a1 + (unsigned int)a2;
    if( v7 > 0x7FFFFFFF0000i64 || v7 < a1 )
      MEMORY[0x7FFFFFFF0000] = 0;
    if( (unsigned int)a2 < 0x48 )
    {
      UserModeCallersCopy = -1073741811;
    }
    else
    {
      *(_OWORD *)a4 = *(_OWORD *)a1;
      *(_OWORD *)(a4 + 16) = *(_OWORD *)(a1 + 16);
      *(_OWORD *)(a4 + 32) = *(_OWORD *)(a1 + 32);
      *(_OWORD *)(a4 + 48) = *(_OWORD *)(a1 + 48);
      *(_QWORD *)(a4 + 64) = *(_QWORD *)(a1 + 64);
      if( *(_DWORD *)a4 != 72 )
        UserModeCallersCopy = -1073741811;
    }
  }
  if( UserModeCallersCopy < 0 )
    goto LABEL_41;
  v8 = (_QWORD *)(a4 + 16);
  v9 = *(VOID **)(a4 + 16);
  *(_QWORD *)(a4 + 16) = 0i64;
  if( v9 )
  {
    v10 = *(unsigned int *)(a4 + 24);
    if( (unsigned int)v10 < 2 )
    {
      if( *(_DWORD *)(a4 + 24) < 2u )
        goto LABEL_40;
    }
    else
    {
      LODWORD(AllocateDestination) = 1;
      UserModeCallersCopy = PiControlMakeUserModeCallersCopy(
                              (VOID **)(a4 + 16),
                              v9,
                              v10,
                              2ui64,
                              CallerMode,
                              AllocateDestination);
      if( UserModeCallersCopy < 0 )
      {
        *v8 = 0i64;
        *(_DWORD *)(a4 + 24) = 0;
      }
      else
      {
        v16 = 1;
        *(_WORD *)(*v8 + 2 * ((unsigned __int64)*(unsigned int *)(a4 + 24) >> 1) - 2) = 0;
      }
    }
  }
  else if( *(_DWORD *)(a4 + 24) )
  {
    goto LABEL_40;
  }
  v11 = *(VOID **)(a4 + 56);
  *(_QWORD *)(a4 + 56) = 0i64;
  if( !v11 )
  {
    if( !*(_DWORD *)(a4 + 64) )
      goto LABEL_21;
    goto LABEL_40;
  }
  v14 = *(unsigned int *)(a4 + 64);
  if( (_DWORD)v14 )
  {
    LODWORD(AllocateDestination) = 1;
    UserModeCallersCopy = PiControlMakeUserModeCallersCopy(
                            (VOID **)(a4 + 56),
                            v11,
                            v14,
                            1ui64,
                            CallerMode,
                            AllocateDestination);
    if( UserModeCallersCopy < 0 )
    {
      *(_QWORD *)(a4 + 56) = 0i64;
      *(_DWORD *)(a4 + 64) = 0;
    }
    else
    {
      v17 = 1;
    }
LABEL_21:
    if( UserModeCallersCopy >= 0 )
      return(unsigned int)UserModeCallersCopy;
    goto LABEL_41;
  }
LABEL_40:
  UserModeCallersCopy = -1073741811;
LABEL_41:
  if( v16 )
    PiControlFreeUserModeCallersBuffer(CallerMode, *(PVOID *)(a4 + 16));
  if( v17 )
    PiControlFreeUserModeCallersBuffer(CallerMode, *(PVOID *)(a4 + 56));
  memset(a4, 0i64);
  return(unsigned int)UserModeCallersCopy;
}

Referenced by:

PiCMGetObjectProperty
PiCMSetObjectProperty