SMKM_STORE_MGR::SmPageRead

__int64 __fastcall SMKM_STORE_MGR::SmPageRead(
        __int64 a1,
        unsigned int *a2,
        unsigned __int64 a3,
        __int64 a4,
        VOID *UniqueOwnerId){
  _QWORD *v5; 
  unsigned __int64 v6; 
  unsigned int v8; 
  unsigned int v9; 
  VOID *v10; 
  int v11; 
  __int64 v12; 
  unsigned int v13; 
  char v14; 
  _OWORD *PoolWithTag; 
  bool v16; 
  unsigned int v17; 
  _EX_RUNDOWN_REF *v19; 
  UINT64 DontFail; 
  unsigned int v21; 
  __int64 v22; 
  __int64 v23; 

  v5 = UniqueOwnerId;
  LODWORD(v22) = 0;
  v6 = a3;
  v23 = 0i64;
  v8 = 0;
  if( (a3 & 3) != 0 )
  {
    v6 = a3 & 0xFFFFFFFFFFFFFFFCui64;
    v8 = a3 & 1 | 2;
    if( (a3 & 2) == 0 )
      v8 = a3 & 1;
  }
  *((_QWORD *)UniqueOwnerId + 1) = 0i64;
  *v5 = a4;
  v9 = *(_DWORD *)(v6 + 40) >> 12;
  v21 = v9;
  v10 = v5;
  LODWORD(UniqueOwnerId) = v9;
  v11 = SMKM_STORE_MGR::SmReadPickStore(
          (_SMKM_STORE_LIST *)SmGlobals,
          a2,
          (unsigned int *)&UniqueOwnerId,
          &v23,
          (__int64)&v22);
  v12 = v23;
  v13 = v11;
  if( v11 >= 0 )
  {
    v14 = (char)UniqueOwnerId;
    v5[1] = (unsigned int)UniqueOwnerId;
    if( v8 >= 2 && !*(_BYTE *)(v12 + 6020) )
    {
      v13 = -1073741791;
      goto LABEL_18;
    }
    if( (dword_140D230F0 & 0x10) == 0 )
    {
LABEL_7:
      if( (v8 & 1) != 0 )
      {
        PoolWithTag = RtlpInterlockedPopEntrySList(&stru_140D22EA0);
        if( PoolWithTag )
          goto LABEL_9;
        PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x58ui64, 1633119603i64);
        if( PoolWithTag )
          goto LABEL_9;
        LOBYTE(v8) = v8 & 0xFE;
      }
      LODWORD(DontFail) = dword_140D230F0 & 1;
      PoolWithTag = SmFpAllocate(&dword_140D22FC0, SmFpResourceWorkItem, v5, 0i64, DontFail);
      if( !PoolWithTag )
      {
        v13 = -1073741670;
LABEL_17:
        v9 = v21;
        goto LABEL_18;
      }
LABEL_9:
      v16 = (v22 & 1) == 0;
      v17 = *a2;
      *PoolWithTag = 0i64;
      PoolWithTag[1] = 0i64;
      *(_DWORD *)PoolWithTag = 2;
      *((_DWORD *)PoolWithTag + 6) = v17;
      *((_QWORD *)PoolWithTag + 2) = v6;
      *((_BYTE *)PoolWithTag + 8) = v14;
      *((_QWORD *)PoolWithTag + 4) = v5;
      if( !v16 )
        *((_DWORD *)PoolWithTag + 2) |= 0x1000000u;
      if( (v8 & 1) != 0 )
        *((_DWORD *)PoolWithTag + 2) |= 0x4000000u;
      if( (int)SMKM_STORE_MGR::SmIoCtxQueueWork(
                  v5,
                  (__int64)SmGlobals,
                  *(_DWORD *)(v12 + 6016) & 0x3FF,
                  (unsigned __int64)PoolWithTag) < 0 )
      {
        v13 = -1073741670;
      }
      else
      {
        PoolWithTag = 0i64;
        v10 = 0i64;
        v12 = 0i64;
        LOBYTE(v8) = -5;
        v13 = 259;
      }
      if( PoolWithTag )
        SMKM_STORE_MGR::SmWorkItemFreeResource((__int64)SmGlobals, PoolWithTag, v10);
      goto LABEL_17;
    }
    v8 |= 8 * (SmAcquireReleaseResAvailForRead(v5, v9, 0i64) & 1);
    if( v8 >= 8 )
    {
      LOBYTE(v8) = v8 | 4;
      goto LABEL_7;
    }
    v13 = -1073741670;
  }
LABEL_18:
  if( v12 )
  {
    v19 = (_EX_RUNDOWN_REF *)SmKmStoreRefFromStoreIndex((__int64)SmGlobals, *(_DWORD *)(v12 + 6016) & 0x3FF);
    ExReleaseRundownProtection(v19 + 1);
  }
  if( (v8 & 4) != 0 )
    SmAcquireReleaseResAvailForRead(v10, v9, 1ui64);
  if( v10 )
  {
    *(_OWORD *)v5 = 0i64;
    *(_DWORD *)v5 = v13;
  }
  return v13;
}

Referenced by:

No references.