IoRegisterFileSystem

NTSTATUS __fastcall IoRegisterFileSystem(UINT64 a1, INT64 a2, INT64 a3){
  _ETHREAD *CurrentThread; 
  INT64 v5; 
  char *v6; 
  int v7; 
  char *v8; 
  int v9; 
  char *v10; 
  char **v11; 
  __int64 **v12; 
  NTSTATUS result; 
  void(__fastcall *v14)(UINT64, char *); 
  char **v15; 
  char **v16; 
  char **v17; 

  FsRtlSetDriverBacking(*(_DRIVER_OBJECT **)(a1 + 8), 1ui64);
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  IopSetFsRegistrationInProgress(1u);
  ExAcquireResourceExclusiveLite((UINT64)&stru_140C452E0 + 1280, 1, v5);
  v7 = *(_DWORD *)(a1 + 72);
  if( v7 == 20 )
  {
    v8 = (char *)&stru_140C452E0 + 1536;
  }
  else
  {
    switch( v7 )
    {
      case 3:
        v8 = (char *)&stru_140C452E0 + 1568;
        break;
      case 8:
        v8 = (char *)&stru_140C452E0 + 1552;
        break;
      case 32:
        v8 = (char *)&stru_140C452E0 + 1520;
        break;
      default:
        goto LABEL_13;
    }
    *(_DWORD *)(*(_QWORD *)(a1 + 8) + 16i64) |= 0x80u;
  }
  v9 = *(_DWORD *)(a1 + 48);
  if( (v9 & 0x10000) != 0 )
  {
    v6 = (char *)*((_QWORD *)v8 + 1);
    v15 = (char **)(a1 + 80);
    v16 = (char **)*((_QWORD *)v6 + 1);
    if( *v16 == v6 )
    {
      *v15 = v6;
      *(_QWORD *)(a1 + 88) = v16;
      *v16 = (char *)v15;
      *((_QWORD *)v6 + 1) = v15;
      goto LABEL_13;
    }
LABEL_26:
    __fastfail(3u);
  }
  v6 = *(char **)v8;
  if( (v9 & 0x200) != 0 )
  {
    v17 = (char **)(a1 + 80);
    if( *((char **)v6 + 1) == v8 )
    {
      *v17 = v6;
      *(_QWORD *)(a1 + 88) = v8;
      *((_QWORD *)v6 + 1) = v17;
      *(_QWORD *)v8 = v17;
      goto LABEL_13;
    }
    goto LABEL_26;
  }
  v10 = v8;
  while( v6 != v8 && (*((_DWORD *)v6 - 8) & 0x200) != 0 )
  {
    v10 = v6;
    v6 = *(char **)v6;
  }
  v6 = *(char **)v10;
  v11 = (char **)(a1 + 80);
  if( *(char **)(*(_QWORD *)v10 + 8i64) != v10 )
    goto LABEL_26;
  *v11 = v6;
  *(_QWORD *)(a1 + 88) = v10;
  *((_QWORD *)v6 + 1) = v11;
  *(_QWORD *)v10 = v11;
LABEL_13:
  ++*(&stru_140C452E0 + 282);
  *(_DWORD *)(a1 + 48) &= ~0x80u;
  v12 = (__int64 **)*(&stru_140C452E0 + 208);
  while( v12 != (__int64 **)((char *)&stru_140C452E0 + 1664) )
  {
    v14 = (void(__fastcall *)(UINT64, char *))v12[3];
    LOBYTE(v6) = 1;
    v12 = (__int64 **)*v12;
    v14(a1, v6);
  }
  IopSetFsRegistrationInProgress(0);
  ExReleaseResourceLite((PERESOURCE)((char *)&stru_140C452E0 + 1280));
  IopSetFsRegistrationInProgress(0);
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  IopIncrementDeviceObjectRefCount((_DEVICE_OBJECT *)a1, 1u);
  return result;
}

Referenced by:

RawInitialize