From 974bd0388994715b4fa35ac54986e3c1ed4e3f55 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 27 Apr 2017 19:19:56 +0300 Subject: reorganize files * src/ -> km/src/ * utils/ -> um/ * Move WDK 7.1-specific *.bat files to km/build/wdk7.1/ * Move WDK 8.1 Update 1 solutions to km/build/wdk8.1update/ --- src/sysenter/main.c | 106 -------------------------------- src/sysenter/makefile | 1 - src/sysenter/sources | 4 -- src/sysenter/vs12/.gitignore | 2 - src/sysenter/vs12/sysenter.vs12.sln | 44 ------------- src/sysenter/vs12/sysenter.vs12.vcxproj | 65 -------------------- 6 files changed, 222 deletions(-) delete mode 100644 src/sysenter/main.c delete mode 100644 src/sysenter/makefile delete mode 100644 src/sysenter/sources delete mode 100644 src/sysenter/vs12/.gitignore delete mode 100644 src/sysenter/vs12/sysenter.vs12.sln delete mode 100644 src/sysenter/vs12/sysenter.vs12.vcxproj (limited to 'src/sysenter') diff --git a/src/sysenter/main.c b/src/sysenter/main.c deleted file mode 100644 index 9eb9b28..0000000 --- a/src/sysenter/main.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2015 Egor Tensin - * This file is part of the "Windows 7 drivers" project. - * For details, see https://github.com/egor-tensin/windows7-drivers. - * Distributed under the MIT License. - */ - -#include - -static __int64 old_msr_value = 0; -static void *old_ki_fast_call_entry = NULL; - -static void __stdcall log_system_call() -{ - static LONG count = 0; - static const LONG throttle = 10000; - - LONG n = InterlockedIncrement(&count); - - if (n % throttle == 0) - DbgPrint("Another %ld of `sysenter`s (eax=)!\n", throttle); -} - -static void __declspec(naked) new_ki_fast_call_entry() -{ - __asm - { - pushad - pushfd - mov ecx, 0x23 - push 0x30 - pop fs - mov ds, cx - mov es, cx - call log_system_call - popfd - popad - jmp [old_ki_fast_call_entry] - } -} - -#define IA32_SYSENTER_EIP 0x176 - -static void hook_sysenter() -{ - /* - __asm - { - mov ecx, IA32_SYSENTER_EIP - rdmsr - mov old_ki_fast_call_entry, eax - mov eax, new_ki_fast_call_entry - xor edx, edx - wrmsr - } - */ - - old_msr_value = __readmsr(IA32_SYSENTER_EIP); -#pragma warning(push) -#pragma warning(disable: 4305) - old_ki_fast_call_entry = (void *) old_msr_value; -#pragma warning(pop) - __writemsr(IA32_SYSENTER_EIP, new_ki_fast_call_entry); -} - -static void unhook_sysenter() -{ - /* - __asm - { - mov ecx, IA32_SYSENTER_EIP - mov eax, old_ki_fast_call_entry - xor edx, edx - wrmsr - } - */ - - __writemsr(IA32_SYSENTER_EIP, old_msr_value); -} - -static void on_driver_unload(DRIVER_OBJECT *driver_object) -{ - KTIMER timer; - LARGE_INTEGER time_out; - - UNREFERENCED_PARAMETER(driver_object); - - unhook_sysenter(); - - KeInitializeTimer(&timer); - time_out.QuadPart = -30000000; - KeSetTimer(&timer, time_out, NULL); - - KeWaitForSingleObject(&timer, Executive, KernelMode, FALSE, NULL); -} - -NTSTATUS DriverEntry( - DRIVER_OBJECT *driver_object, - UNICODE_STRING *registry_path) -{ - UNREFERENCED_PARAMETER(registry_path); - - driver_object->DriverUnload = on_driver_unload; - hook_sysenter(); - return STATUS_SUCCESS; -} diff --git a/src/sysenter/makefile b/src/sysenter/makefile deleted file mode 100644 index 5acbbd2..0000000 --- a/src/sysenter/makefile +++ /dev/null @@ -1 +0,0 @@ -!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/src/sysenter/sources b/src/sysenter/sources deleted file mode 100644 index d6371b3..0000000 --- a/src/sysenter/sources +++ /dev/null @@ -1,4 +0,0 @@ -TARGETTYPE = DRIVER -TARGETNAME = sysenter -SOURCES = -I386_SOURCES = main.c diff --git a/src/sysenter/vs12/.gitignore b/src/sysenter/vs12/.gitignore deleted file mode 100644 index cd42ee3..0000000 --- a/src/sysenter/vs12/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin/ -obj/ diff --git a/src/sysenter/vs12/sysenter.vs12.sln b/src/sysenter/vs12/sysenter.vs12.sln deleted file mode 100644 index ec3ab31..0000000 --- a/src/sysenter/vs12/sysenter.vs12.sln +++ /dev/null @@ -1,44 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sysenter.vs12", "sysenter.vs12.vcxproj", "{FEF249AF-C571-4F59-A72A-7226AA9F126E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Win7 Debug|Win32 = Win7 Debug|Win32 - Win7 Debug|x64 = Win7 Debug|x64 - Win7 Release|Win32 = Win7 Release|Win32 - Win7 Release|x64 = Win7 Release|x64 - Win8 Debug|Win32 = Win8 Debug|Win32 - Win8 Debug|x64 = Win8 Debug|x64 - Win8 Release|Win32 = Win8 Release|Win32 - Win8 Release|x64 = Win8 Release|x64 - Win8.1 Debug|Win32 = Win8.1 Debug|Win32 - Win8.1 Debug|x64 = Win8.1 Debug|x64 - Win8.1 Release|Win32 = Win8.1 Release|Win32 - Win8.1 Release|x64 = Win8.1 Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Debug|Win32.Deploy.0 = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Debug|x64.ActiveCfg = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Release|Win32.Deploy.0 = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win7 Release|x64.ActiveCfg = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8 Debug|x64.ActiveCfg = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8 Release|Win32.ActiveCfg = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8 Release|x64.ActiveCfg = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8.1 Debug|Win32.ActiveCfg = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8.1 Debug|x64.ActiveCfg = Win7 Debug|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8.1 Release|Win32.ActiveCfg = Win7 Release|Win32 - {FEF249AF-C571-4F59-A72A-7226AA9F126E}.Win8.1 Release|x64.ActiveCfg = Win7 Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/sysenter/vs12/sysenter.vs12.vcxproj b/src/sysenter/vs12/sysenter.vs12.vcxproj deleted file mode 100644 index eaba723..0000000 --- a/src/sysenter/vs12/sysenter.vs12.vcxproj +++ /dev/null @@ -1,65 +0,0 @@ - - - - - Win7 Debug - Win32 - - - Win7 Release - Win32 - - - - {FEF249AF-C571-4F59-A72A-7226AA9F126E} - {dd38f7fc-d7bd-488b-9242-7d8754cde80d} - v4.5 - 11.0 - Win7 Debug - Win32 - sysenter_vs12 - - - - Windows7 - true - WindowsKernelModeDriver8.1 - Driver - WDM - - - Windows7 - false - WindowsKernelModeDriver8.1 - Driver - WDM - - - - - - - - - - - DbgengKernelDebugger - bin\$(TargetVersion)\$(PlatformShortName)\debug\ - obj\$(TargetVersion)\$(PlatformShortName)\debug\ - - - DbgengKernelDebugger - bin\$(TargetVersion)\$(PlatformShortName)\release\ - obj\$(TargetVersion)\$(PlatformShortName)\release\ - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3