SmcCacheStart

__int64 __fastcall SmcCacheStart(__int64 a1, __int64 a2, const WCHAR *a3){
  struct _DMA_ADAPTER *v3; 
  int v5; 
  int UniqueId; 
  __int64 v9; 
  UINT64 v10; 
  UINT64 v11; 
  DEVICE_OBJECT *v12; 
  int v13; 
  INT64 v15; 
  PADAPTER_OBJECT DmaAdapter; 
  __int64 FileSizeInOut; 
  INT64 VdlNotSetOut; 
  INT64 PerformsFileIoInOut; 
  LODWORD(VdlNotSetOut) = 0;
  v3 = 0i64;
  DmaAdapter = 0i64;
  v5 = *(_DWORD *)(a2 + 8);
  if( !v5 || ((v5 - 1) & v5) != 0 )
  {
    UniqueId = -1073741811;
  }
  else
  {
    if( !*(_QWORD *)a2 )
      return(unsigned int)-1073741811;
    if( *(_QWORD *)a2 > 0x800000000ui64 )
      return(unsigned int)-1073739516;
    *(_OWORD *)(a1 + 16) = *(_OWORD *)a2;
    v9 = (unsigned __int8)a3 & 1;
    *(_QWORD *)(a1 + 32) = *(_QWORD *)(a2 + 16);
    v10 = *(unsigned int *)(a1 + 24);
    LODWORD(PerformsFileIoInOut) = *(_DWORD *)(a2 + 12) & 1;
    FileSizeInOut = *(_QWORD *)a2;
    UniqueId = SmKmStoreFileCreate(
                 a1 + 4,
                 (INT64)a3,
                 v10,
                 (unsigned int)v10,
                 &FileSizeInOut,
                 v15,
                 &PerformsFileIoInOut,
                 (_OWORD *)(a1 + 40),
                 (_DWORD *)(a1 + 4),
                 (_DWORD *)(a1 + 8),
                 (INT64)&VdlNotSetOut);
    if( UniqueId < 0 )
      return(unsigned int)UniqueId;
    if( (-(__int64)(v9 != 0) & (unsigned __int64)a3 & 0xFFFFFFFFFFFFFFFEui64) != 0 && FileSizeInOut != *(_QWORD *)a2 )
      return(unsigned int)-1073741792;
    *(_DWORD *)(a1 + 28) = PerformsFileIoInOut & 1 | *(_DWORD *)(a1 + 28) & 0xFFFFFFFC | (2 * (VdlNotSetOut & 1));
    v12 = *(DEVICE_OBJECT **)(a1 + 64);
    VdlNotSetOut = (INT64)v12;
    if( v12 )
      goto LABEL_14;
    v13 = SmKmStoreFileOpenVolume(
            *(FILE_OBJECT **)(a1 + 48),
            (FILE_OBJECT **)&DmaAdapter,
            (DEVICE_OBJECT **)&VdlNotSetOut);
    v3 = DmaAdapter;
    UniqueId = v13;
    if( v13 >= 0 )
    {
      v12 = (DEVICE_OBJECT *)VdlNotSetOut;
LABEL_14:
      UniqueId = SmKmVolumeQueryUniqueId(v12, (VOID *)(a1 + 552), 0x200ui64, v11);
      if( UniqueId >= 0 )
      {
        UniqueId = StEtaHelper::StartHelper((struct _ST_ETA_CONTEXT *)(a1 + 104), *(_DWORD *)(a1 + 24));
        if( UniqueId >= 0 )
          UniqueId = 0;
      }
    }
  }
  if( v3 )
    HalPutDmaAdapter(v3);
  return(unsigned int)UniqueId;
}

Referenced by:

SmcProcessCreateRequest