NtApphelpCacheControl
INT64 __fastcall NtApphelpCacheControl(INT64 a1, VOID *a2){
ULONG v3;
int v4;
unsigned int v5;
PIRP v6;
int v9;
int v10;
int v11;
int v12;
bool v13;
int v14;
struct _UNICODE_STRING DestinationString;
struct _IO_STATUS_BLOCK IoStatusBlock;
struct _KEVENT Event;
PDEVICE_OBJECT DeviceObject;
PFILE_OBJECT FileObject;
DestinationString = 0i64;
memset(&Event, 0, sizeof(Event));
IoStatusBlock = 0i64;
if( (int)a1 >= 12 )
return(unsigned int)-1073741811;
FileObject = 0i64;
DeviceObject = 0i64;
v3 = (4 * a1) | 0x220003;
if( (_DWORD)a1 == 9 )
return(unsigned int)AhcCacheQueryHwId((UINT64)a2);
if( (int)a1 <= 5 )
{
if( (_DWORD)a1 != 5 )
{
if( !(_DWORD)a1 )
goto LABEL_5;
v9 = a1 - 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(unsigned int)-1073741811;
}
LABEL_15:
v5 = 0;
goto LABEL_6;
}
}
else
{
v4 = a1 - 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( g_AhcDeviceObject )
{
LABEL_7:
KeInitializeEvent(&Event, SynchronizationEvent, 0);
v6 = IoBuildDeviceIoControlRequest(v3, g_AhcDeviceObject, a2, 0x178u, 0i64, 0, 0, &Event, &IoStatusBlock);
if( !v6 )
return(unsigned int)-1073741823;
*((_BYTE *)v6 + 64) = ExGetPreviousMode();
return(unsigned int)IofCallDriver(g_AhcDeviceObject, v6);
}
if( (int)RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)L"\\Device\\ahcache") >= 0
&& IoGetDeviceObjectPointer(&DestinationString, 0xC0000000ui64, &FileObject, &DeviceObject) >= 0 )
{
if( _InterlockedCompareExchange64(
(volatile signed __int64 *)&g_AhcDeviceObject,
(signed __int64)DeviceObject,
0i64) )
{
HalPutDmaAdapter((PADAPTER_OBJECT)FileObject);
}
goto LABEL_7;
}
return v5;
}Referenced by:
No references.