pwp
This commit is contained in:
CSlime 2021-10-22 16:42:29 +08:00
parent ba38f3aec5
commit b3d8ba3551
3 changed files with 1 additions and 79 deletions

View File

@ -3,6 +3,7 @@
#include "DDKCommon.h"
#include "MyMemoryIo64.h"
#pragma comment(lib,"oldnames.lib")
typedef struct _SBYTEINFO_3 {
@ -37,52 +38,6 @@ void UnicodeToAnsi(LPCWSTR UnicodeStr, LPSTR AnsiStrBuffer, ULONG MaxLenth) {
return;
}
static ULONG64 g_per = 0;
static BOOL g_first = TRUE;
ULONG64 GetRealTime() {
if (g_first) {
g_first = FALSE;
ULONG64 fir, sec;
fir = AsmRdtsc();
Sleep(50);
sec = AsmRdtsc();
g_per = (sec - fir) / 50;
}
return AsmRdtsc() / g_per;
}
static ULONG64 g_per_micro = 0;
static BOOL g_first_micro = TRUE;
ULONG64 GetRealMicroTime() {
if (g_first_micro) {
g_first_micro = FALSE;
ULONG64 fir, sec;
fir = AsmRdtsc();
Sleep(50);
sec = AsmRdtsc();
g_per_micro = (sec - fir) / 50000;
}
return AsmRdtsc() / g_per_micro;
}
VOID Sleep(LONG Millsecond) {
LARGE_INTEGER t;
t.QuadPart = Millsecond;
//µ¥Î»:100ÄÉÃë
t.QuadPart *= -10 * 1000;
KeDelayExecutionThread(KernelMode, FALSE, &t);
return;
}
VOID ForceSleep(LONG Millsecond) {
KeStallExecutionProcessor(Millsecond * 1000);
}
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
{
int iLen;
@ -605,8 +560,3 @@ VOID KLowerIrqlToState(PIRQL_STATE state) {
__writecr8(state->old_irql);
}
}
ULONG64 KGetRspBase() {
return __readgsqword(0x1A8);
}

View File

@ -32,28 +32,6 @@
#define POOL_TAG 'enoN'
typedef struct _XINPUT_GAMEPAD
{
WORD wButtons;
BYTE bLeftTrigger;
BYTE bRightTrigger;
SHORT sThumbLX;
SHORT sThumbLY;
SHORT sThumbRX;
SHORT sThumbRY;
} XINPUT_GAMEPAD, * PXINPUT_GAMEPAD;
typedef struct _XINPUT_STATE
{
DWORD dwPacketNumber;
XINPUT_GAMEPAD Gamepad;
} XINPUT_STATE, * PXINPUT_STATE;
typedef struct _KBuffer {
PVOID Address;
ULONG Size;
}KBuffer, * PKBuffer;
#ifdef __cplusplus
extern "C"{
#endif
@ -61,9 +39,6 @@ extern "C"{
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch);
LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch);
VOID Sleep(LONG Millsecond);
ULONG64 GetRealTime();
ULONG64 GetRealMicroTime();
LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch);
LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch);
LPWSTR WINAPI StrStrNIW(LPCWSTR lpszStr, LPCWSTR lpszSearch, SIZE_T max_chars);
@ -92,8 +67,6 @@ typedef struct _IRQL_STATE {
VOID KRaiseIrqlToDpcOrHigh(PIRQL_STATE state);
VOID KLowerIrqlToState(PIRQL_STATE state);
ULONG64 KGetRspBase();
#ifdef __cplusplus
}
#endif

View File

@ -52,7 +52,6 @@ VOID NtQueryVolumeInformationFileCallback(ULONG64 FsInformationClass, ULONG64 Fs
}
extern "C" NTSTATUS DriverEntry(PDRIVER_OBJECT drv, PUNICODE_STRING reg_path) {
Mmi_Init();
GetRealTime();//初始化GetRealTime
//设置是否启用 NtQueryVolumeInformationFile Hook,TRUE为开启,FALSE为关闭
//注意,win10 1507 - win10 1709不支持NtQueryVolumeInformationFile Hook,因为无法从堆栈中获取到参数