📄 iltiming.c
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
// -----------------------------------------------------------------------------
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// -----------------------------------------------------------------------------
#include <windows.h>
#include <iltiming.h>
#include <oal_nkxp.h>
// ILTIMING Globals
extern BOOL fIntrTime;
extern DWORD dwIntrTimeIsr1;
extern DWORD dwIntrTimeIsr2;
extern DWORD dwIntrTimeNumInts;
extern DWORD dwIntrTimeCountdown;
extern DWORD dwIntrTimeCountdownRef;
extern DWORD dwIntrTimeSPC;
BOOL x86IoCtllTiming (
UINT32 code, VOID *lpInBuf, UINT32 nInBufSize, VOID *lpOutBuf,
UINT32 nOutBufSize, UINT32 *lpBytesReturned
) {
if ((nInBufSize == sizeof(ILTIMING_MESSAGE)) && (lpInBuf != NULL)) {
extern DWORD PerfCountSinceTick();
extern DWORD PerfCountFreq();
PILTIMING_MESSAGE pITM = (PILTIMING_MESSAGE) lpInBuf;
switch (pITM->wMsg) {
case ILTIMING_MSG_ENABLE : {
dwIntrTimeCountdownRef = pITM->dwFrequency;
RETAILMSG (1, (TEXT("ILTiming Enable (@ every %d ticks)\r\n"), dwIntrTimeCountdownRef));
dwIntrTimeCountdown = dwIntrTimeCountdownRef;
dwIntrTimeNumInts = 0;
fIntrTime = TRUE;
break;
}
case ILTIMING_MSG_DISABLE : {
RETAILMSG (1, (TEXT("ILTiming Disable\r\n")));
fIntrTime = FALSE;
break;
}
case ILTIMING_MSG_GET_TIMES : {
pITM->dwIsrTime1 = dwIntrTimeIsr1;
pITM->dwIsrTime2 = dwIntrTimeIsr2;
pITM->wNumInterrupts = (WORD) dwIntrTimeNumInts;
pITM->dwSPC = dwIntrTimeSPC;
pITM->dwFrequency = PerfCountFreq();
dwIntrTimeNumInts = 0;
break;
}
case ILTIMING_MSG_GET_PFN : {
pITM->pfnPerfCountSinceTick = (PVOID) PerfCountSinceTick;
RETAILMSG (1, (TEXT("ILTiming GetPFN\r\n")));
break;
}
default : {
RETAILMSG (1, (TEXT("IOCTL_HAL_ILTIMING : BAD MESSAGE!!!\r\n")));
NKSetLastError(ERROR_INVALID_PARAMETER);
return(FALSE);
}
}
} else {
RETAILMSG (1, (TEXT("IOCTL_HAL_ILTIMING : BAD PARAMETERS!!!\r\n")));
NKSetLastError(ERROR_INVALID_PARAMETER);
return(FALSE);
}
return(TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -