SMKM_STORE_MGR::SmPageRead

__int64 __fastcall SMKM_STORE_MGR::SmPageRead(
        __int64 a1,
        unsigned int *a2,
        unsigned __int64 a3,
        __int64 a4,
        __int64 a5){
  __int64 v5; 
  unsigned __int64 v6; 
  unsigned int v8; 
  unsigned int v9; 
  void *v10; 
  int v11; 
  unsigned __int64 v12; 
  unsigned int v13; 
  char v14; 
  _OWORD *v15; 
  _OWORD *PoolWithTag; 
  bool v17; 
  unsigned int v18; 
  struct _EX_RUNDOWN_REF *v20; 
  VOID *Context; 
  _MDL *v22; 
  UINT64 v23; 
  unsigned int v24; 
  int v25; 
  unsigned __int64 v26; 
  v5 = a5;
  v25 = 0;
  v6 = a3;
  v26 = 0i64;
  v8 = 0;
  if( (a3 & 3) != 0 )
  {
    v6 = a3 & 0xFFFFFFFFFFFFFFFCui64;
    v8 = a3 & 1 | 2;
    if( (a3 & 2) == 0 )
      v8 = a3 & 1;
  }
  *(_QWORD *)(a5 + 8) = 0i64;
  *(_QWORD *)v5 = a4;
  v9 = *(_DWORD *)(v6 + 40) >> 12;
  v24 = v9;
  v10 = (void *)v5;
  LODWORD(a5) = v9;
  v11 = SMKM_STORE_MGR::SmReadPickStore((__int64)&SmGlobals, a2, (unsigned int *)&a5, &v26, &v25);
  v12 = v26;
  v13 = v11;
  if( v11 >= 0 )
  {
    v14 = a5;
    *(_QWORD *)(v5 + 8) = (unsigned int)a5;
    if( v8 >= 2 && !*(_BYTE *)(v12 + 6020) )
    {
      v13 = -1073741791;
      goto LABEL_18;
    }
    if( (dword_140D230F0 & 0x10) == 0 )
    {
LABEL_7:
      if( (v8 & 1) != 0 )
      {
        PoolWithTag = RtlpInterlockedPopEntrySList((PSLIST_HEADER)&word_140D22EA0);
        if( PoolWithTag )
          goto LABEL_9;
        PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x58ui64, 0x61576D73ui64);
        if( PoolWithTag )
          goto LABEL_9;
        LOBYTE(v8) = v8 & 0xFE;
      }
      LODWORD(Context) = dword_140D230F0 & 1;
      SmFpAllocate((INT64)&qword_140D22FC0, 1i64, v5, 0i64, Context, v22, v23);
      PoolWithTag = v15;
      if( !v15 )
      {
        v13 = -1073741670;
LABEL_17:
        v9 = v24;
        goto LABEL_18;
      }
LABEL_9:
      v17 = (v25 & 1) == 0;
      v18 = *a2;
      *PoolWithTag = 0i64;
      PoolWithTag[1] = 0i64;
      *(_DWORD *)PoolWithTag = 2;
      *((_DWORD *)PoolWithTag + 6) = v18;
      *((_QWORD *)PoolWithTag + 2) = v6;
      *((_BYTE *)PoolWithTag + 8) = v14;
      *((_QWORD *)PoolWithTag + 4) = v5;
      if( !v17 )
        *((_DWORD *)PoolWithTag + 2) |= 0x1000000u;
      if( (v8 & 1) != 0 )
        *((_DWORD *)PoolWithTag + 2) |= 0x4000000u;
      if( (int)SMKM_STORE_MGR::SmIoCtxQueueWork(
                  (_ETHREAD *)v5,
                  (__int64)&SmGlobals,
                  *(_DWORD *)(v12 + 6016) & 0x3FF,
                  (__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, (struct _MDL *)PoolWithTag, (__int64)v10);
      goto LABEL_17;
    }
    v8 |= 8 * (SmAcquireReleaseResAvailForRead((PVOID)v5, v9, 0i64) & 1);
    if( v8 >= 8 )
    {
      LOBYTE(v8) = v8 | 4;
      goto LABEL_7;
    }
    v13 = -1073741670;
  }
LABEL_18:
  if( v12 )
  {
    v20 = (struct _EX_RUNDOWN_REF *)SmKmStoreRefFromStoreIndex((INT64)&SmGlobals, *(_DWORD *)(v12 + 6016) & 0x3FF);
    ExReleaseRundownProtection(v20 + 1);
  }
  if( (v8 & 4) != 0 )
    SmAcquireReleaseResAvailForRead(v10, v9, 1ui64);
  if( v10 )
  {
    *(_OWORD *)v5 = 0i64;
    *(_DWORD *)v5 = v13;
  }
  return v13;
}

Referenced by:

No references.