PiDqDispatch

NTSTATUS __stdcall PiDqDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp){
  char *v2; 
  NTSTATUS v4; 
  __int64 v5; 
  char v6; 
  CHAR **v7; 
  INT64 v8; 
  unsigned int v10; 
  WCHAR *v12; 
  UINT8 v13; 
  _ETHREAD *CurrentThread; 
  __int64 v15; 
  VOID *ObjectManager; 
  _ETHREAD *v17; 
  __int64 v18; 
  v2 = (char *)*((_QWORD *)Irp + 23);
  v4 = *((_DWORD *)Irp + 12);
  v5 = *((_QWORD *)v2 + 6);
  v6 = *v2;
  v7 = (CHAR **)(v5 + 32);
  v8 = *(_QWORD *)(v5 + 32);
  if( *v2 )
  {
    if( v6 != 14 )
    {
      if( v6 == 2 )
      {
        if( v8 )
        {
          PiDqQueryRelease(*(VOID **)(v5 + 32));
          *(_QWORD *)(*((_QWORD *)v2 + 6) + 32i64) = 0i64;
        }
      }
      else
      {
        if( v6 != 18 )
          return v4;
        if( v8 )
        {
          CurrentThread = (_ETHREAD *)KeGetCurrentThread();
          v15 = 0i64;
          ObjectManager = 0i64;
          --*((_WORD *)CurrentThread + 242);
          ExAcquirePushLockExclusiveEx(v8 + 64, 0i64);
          if( (*(_DWORD *)(v8 + 216) & 4) != 0 )
            ObjectManager = PiDqQueryGetObjectManager(v8);
          ExReleasePushLockEx(v8 + 64, 0i64);
          KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
          if( ObjectManager )
            PiDqObjectManagerUnregisterQuery((INT64)ObjectManager, (INT64 *)v8);
          v17 = (_ETHREAD *)KeGetCurrentThread();
          --*((_WORD *)v17 + 242);
          ExAcquirePushLockExclusiveEx(v8 + 64, 0i64);
          v18 = *(_QWORD *)(v8 + 176);
          *(_DWORD *)(v8 + 216) |= 8u;
          if( v18 && _InterlockedExchange64((volatile __int64 *)(v18 + 104), 0i64) )
          {
            v15 = *(_QWORD *)(v8 + 176);
            *(_QWORD *)(v8 + 176) = 0i64;
          }
          ExReleasePushLockEx(v8 + 64, 0i64);
          KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
          if( v15 )
          {
            *(_QWORD *)(v15 + 56) = 0i64;
            *(_DWORD *)(v15 + 48) = -1073741536;
            IofCompleteRequest((_IRP *)v15, 0);
          }
        }
      }
      v4 = 0;
      *((_DWORD *)Irp + 12) = 0;
      goto LABEL_7;
    }
    v10 = *((_DWORD *)v2 + 6);
    if( v10 == 4653056 )
      return PiDqIrpQueryCreate(Irp);
    if( v10 > 0x470006 )
    {
      if( v10 <= 0x470008 )
        return PiDqIrpQueryGetResult(Irp);
      if( v10 == 4653068 )
        return PiDqIrpPropertySet(Irp);
    }
    v4 = -1073741637;
    *((_DWORD *)Irp + 12) = -1073741637;
  }
  else
  {
    v12 = *(WCHAR **)(v5 + 96);
    v4 = 0;
    if( !wcscmp((PWCHAR)L"\\Dev\\Query", v12) )
    {
      v13 = IoIs32bitProcess(Irp);
      v4 = PiDqQueryCreate(v13 == 0, v7);
    }
    else if( !wcscmp((PWCHAR)L"\\Dev\\NoState", v12) )
    {
      *v7 = 0i64;
    }
    else
    {
      v4 = -1073741811;
    }
    *((_DWORD *)Irp + 12) = v4;
  }
LABEL_7:
  IofCompleteRequest(Irp, 0);
  return v4;
}

Referenced by:

No references.