NtApphelpCacheControl

NTSTATUS __stdcall NtApphelpCacheControl(_AHC_SERVICE_CLASS ServiceClass, VOID *ServiceContext){
  __int32 v3; 
  __int32 v4; 
  NTSTATUS v5; 
  PIRP *v6; 
  __int32 v9; 
  __int32 v10; 
  __int32 v11; 
  __int32 v12; 
  bool v13; 
  __int32 v14; 
  _UNICODE_STRING DestinationString; 
  _IO_STATUS_BLOCK IoStatusBlock; 
  INT64 Event[2]; 
  __int64 v18; 
  PDEVICE_OBJECT DeviceObject; 
  PFILE_OBJECT FileObject; 

  v18 = 0i64;
  DestinationString = 0i64;
  *(_OWORD *)Event = 0i64;
  IoStatusBlock = 0i64;
  if( ServiceClass >= (ApphelpCacheServiceMapQuirks|ApphelpCacheServiceSnapStatistics) )
    return -1073741811;
  FileObject = 0i64;
  DeviceObject = 0i64;
  v3 = (4 * ServiceClass) | 0x220003;
  if( ServiceClass == ApphelpCacheServiceHwIdQuery )
    return AhcCacheQueryHwId((unsigned __int64)ServiceContext);
  if( ServiceClass <= ApphelpCacheServiceSnapCache )
  {
    if( ServiceClass != ApphelpCacheServiceSnapCache )
    {
      if( ServiceClass == ApphelpCacheServiceLookup )
        goto LABEL_5;
      v9 = ServiceClass - 1;
      if( !v9 )
        goto LABEL_15;
      v10 = v9 - 1;
      if( !v10 )
        goto LABEL_15;
      v14 = v10 - 1;
      v13 = v14 == 0;
LABEL_19:
      if( !v13 )
      {
        if( v14 == 1 )
          goto LABEL_21;
        return -1073741811;
      }
LABEL_15:
      v5 = 0;
      goto LABEL_6;
    }
  }
  else
  {
    v4 = ServiceClass - 6;
    if( !v4 )
    {
LABEL_5:
      v5 = -1073741275;
      goto LABEL_6;
    }
    v11 = v4 - 1;
    if( !v11 )
      goto LABEL_15;
    v12 = v11 - 1;
    if( v12 )
    {
      v14 = v12 - 2;
      v13 = v14 == 0;
      goto LABEL_19;
    }
  }
LABEL_21:
  v5 = -1073741823;
LABEL_6:
  if( *(&WheapErrorSourceTable + 131) )
  {
LABEL_7:
    KeInitializeEvent((INT64)Event, 1, 0);
    v6 = IoBuildDeviceIoControlRequest(
           v3,
           *(&WheapErrorSourceTable + 131),
           ServiceContext,
           0x178u,
           0i64,
           0,
           0,
           (PKEVENT)Event,
           &IoStatusBlock);
    if( !v6 )
      return -1073741823;
    *((_BYTE *)v6 + 64) = ExGetPreviousMode();
    return IofCallDriver(*(&WheapErrorSourceTable + 131), (UINT64)v6);
  }
  if( RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)L"\\Device\\ahcache") >= 0
    && IoGetDeviceObjectPointer(&DestinationString, 0xC0000000ui64, &FileObject, &DeviceObject) >= 0 )
  {
    if( _InterlockedCompareExchange64((_QWORD *)&WheapErrorSourceTable + 131, (signed __int64)DeviceObject, 0i64) )
      HalPutDmaAdapter((PADAPTER_OBJECT)FileObject);
    goto LABEL_7;
  }
  return v5;
}

Referenced by:

No references.