diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-27 19:19:56 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-27 19:19:56 +0300 |
commit | 974bd0388994715b4fa35ac54986e3c1ed4e3f55 (patch) | |
tree | 53b23c15bde662804ecb7ef8f54026ff883a7cc2 /src/sysenter | |
parent | sysenter: add missing configurations to solution (diff) | |
download | windows7-drivers-974bd0388994715b4fa35ac54986e3c1ed4e3f55.tar.gz windows7-drivers-974bd0388994715b4fa35ac54986e3c1ed4e3f55.zip |
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/
Diffstat (limited to 'src/sysenter')
-rw-r--r-- | src/sysenter/main.c | 106 | ||||
-rw-r--r-- | src/sysenter/makefile | 1 | ||||
-rw-r--r-- | src/sysenter/sources | 4 | ||||
-rw-r--r-- | src/sysenter/vs12/.gitignore | 2 | ||||
-rw-r--r-- | src/sysenter/vs12/sysenter.vs12.sln | 44 | ||||
-rw-r--r-- | src/sysenter/vs12/sysenter.vs12.vcxproj | 65 |
6 files changed, 0 insertions, 222 deletions
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 <Egor.Tensin@gmail.com> - * 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 <ntddk.h> - -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 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Win7 Debug|Win32"> - <Configuration>Win7 Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Win7 Release|Win32"> - <Configuration>Win7 Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{FEF249AF-C571-4F59-A72A-7226AA9F126E}</ProjectGuid> - <TemplateGuid>{dd38f7fc-d7bd-488b-9242-7d8754cde80d}</TemplateGuid> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> - <Configuration Condition="'$(Configuration)' == ''">Win7 Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <RootNamespace>sysenter_vs12</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'" Label="Configuration"> - <TargetVersion>Windows7</TargetVersion> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - <DriverType>WDM</DriverType> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'" Label="Configuration"> - <TargetVersion>Windows7</TargetVersion> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - <DriverType>WDM</DriverType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'"> - <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <OutDir>bin\$(TargetVersion)\$(PlatformShortName)\debug\</OutDir> - <IntDir>obj\$(TargetVersion)\$(PlatformShortName)\debug\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'"> - <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor> - <OutDir>bin\$(TargetVersion)\$(PlatformShortName)\release\</OutDir> - <IntDir>obj\$(TargetVersion)\$(PlatformShortName)\release\</IntDir> - </PropertyGroup> - <ItemGroup> - <FilesToPackage Include="$(TargetPath)" /> - <FilesToPackage Include="@(Inf->'%(CopyOutput)')" Condition="'@(Inf)'!=''" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\main.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file |