PiControlMakeUserModeCallersCopy

NTSTATUS __stdcall PiControlMakeUserModeCallersCopy(
        VOID **Destination,
        VOID *Src,
        UINT64 Length,
        UINT64 Alignment,
        INT8 CallerMode,
        UINT64 AllocateDestination){
  unsigned int v6; 
  unsigned int v7; 
  VOID *PoolWithQuotaTag; 
  int v12; 
  UINT64 ReadUserModeBuffer; 

  v6 = Alignment;
  v7 = Length;
  if( !CallerMode )
  {
    *Destination = Src;
    return 0;
  }
  if( !(_DWORD)Length )
  {
    *Destination = 0i64;
    return 0;
  }
  if( (_DWORD)AllocateDestination )
  {
    PoolWithQuotaTag = ExAllocatePoolWithQuotaTag((POOL_TYPE)9, (unsigned int)Length, 0x20207050ui64);
    *Destination = PoolWithQuotaTag;
    if( !PoolWithQuotaTag )
      return -1073741670;
  }
  v12 = 0;
  if( *Destination )
  {
    LODWORD(ReadUserModeBuffer) = AllocateDestination;
    v12 = PiControlCopyUserModeCallersBuffer(*Destination, Src, v7, v6, CallerMode, ReadUserModeBuffer);
    if( v12 < 0 )
    {
      if( (_DWORD)AllocateDestination )
      {
        ExFreePoolWithTag(*Destination, 0);
        *Destination = 0i64;
      }
    }
  }
  return v12;
}

Referenced by:

NtPlugPlayControl
NtReplacePartitionUnit
PiCMCaptureCreateDeviceInputData
PiCMCaptureDeviceListInputData
PiCMCaptureInterfaceAliasInputData
PiCMCaptureInterfaceListInputData
PiCMCaptureObjectInputData
PiCMCapturePropertyInputData
PiCMCaptureRegisterInterfaceInputData
PiCMCaptureRegistryInputData
PiCMCaptureRegistryPropertyInputData
PiControlGetDeviceDepth
PiControlGetDeviceInterfaceEnabled
PiControlGetPropertyData
PiControlGetRelatedDevice
PiControlGetSetDeviceStatus
PiControlQueryAndRemoveDevice
PiControlQueryConflictList
PiControlQueryDeviceRelations
PiControlStartDevice