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/ --- km/build/wdk7.1/.gitignore | 2 + km/build/wdk7.1/add_cert.bat | 26 ++ km/build/wdk7.1/build_driver.bat | 122 +++++++++ km/build/wdk7.1/build_drivers.bat | 13 + km/build/wdk7.1/check_ddk.bat | 38 +++ km/build/wdk7.1/check_env.bat | 18 ++ km/build/wdk7.1/clean_driver.bat | 96 +++++++ km/build/wdk7.1/clean_drivers.bat | 13 + km/build/wdk7.1/setenv.bat | 35 +++ km/build/wdk7.1/sign.bat | 33 +++ km/build/wdk8.1update/minimal/.gitignore | 2 + km/build/wdk8.1update/minimal/minimal.vs12.sln | 64 +++++ km/build/wdk8.1update/minimal/minimal.vs12.vcxproj | 285 +++++++++++++++++++++ km/build/wdk8.1update/simple/.gitignore | 2 + km/build/wdk8.1update/simple/simple.vs12.sln | 64 +++++ km/build/wdk8.1update/simple/simple.vs12.vcxproj | 229 +++++++++++++++++ .../special/nt_path_converter/.gitignore | 2 + .../nt_path_converter/nt_path_converter.vs12.sln | 64 +++++ .../nt_path_converter.vs12.vcxproj | 232 +++++++++++++++++ km/build/wdk8.1update/special/sysenter/.gitignore | 2 + .../special/sysenter/sysenter.vs12.sln | 44 ++++ .../special/sysenter/sysenter.vs12.vcxproj | 65 +++++ km/src/dirs | 1 + km/src/minimal/main.c | 12 + km/src/minimal/makefile | 1 + km/src/minimal/sources | 3 + km/src/simple/device.c | 220 ++++++++++++++++ km/src/simple/device.h | 13 + km/src/simple/main.c | 29 +++ km/src/simple/makefile | 1 + km/src/simple/sources | 3 + km/src/special/dirs | 1 + km/src/special/nt_path_converter/control_codes.h | 12 + km/src/special/nt_path_converter/device.c | 203 +++++++++++++++ km/src/special/nt_path_converter/device.h | 13 + km/src/special/nt_path_converter/main.c | 27 ++ km/src/special/nt_path_converter/makefile | 1 + km/src/special/nt_path_converter/nt2dos.c | 151 +++++++++++ km/src/special/nt_path_converter/nt2dos.h | 12 + km/src/special/nt_path_converter/sources | 3 + km/src/special/sysenter/main.c | 106 ++++++++ km/src/special/sysenter/makefile | 1 + km/src/special/sysenter/sources | 4 + 43 files changed, 2268 insertions(+) create mode 100644 km/build/wdk7.1/.gitignore create mode 100644 km/build/wdk7.1/add_cert.bat create mode 100644 km/build/wdk7.1/build_driver.bat create mode 100644 km/build/wdk7.1/build_drivers.bat create mode 100644 km/build/wdk7.1/check_ddk.bat create mode 100644 km/build/wdk7.1/check_env.bat create mode 100644 km/build/wdk7.1/clean_driver.bat create mode 100644 km/build/wdk7.1/clean_drivers.bat create mode 100644 km/build/wdk7.1/setenv.bat create mode 100644 km/build/wdk7.1/sign.bat create mode 100644 km/build/wdk8.1update/minimal/.gitignore create mode 100644 km/build/wdk8.1update/minimal/minimal.vs12.sln create mode 100644 km/build/wdk8.1update/minimal/minimal.vs12.vcxproj create mode 100644 km/build/wdk8.1update/simple/.gitignore create mode 100644 km/build/wdk8.1update/simple/simple.vs12.sln create mode 100644 km/build/wdk8.1update/simple/simple.vs12.vcxproj create mode 100644 km/build/wdk8.1update/special/nt_path_converter/.gitignore create mode 100644 km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.sln create mode 100644 km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.vcxproj create mode 100644 km/build/wdk8.1update/special/sysenter/.gitignore create mode 100644 km/build/wdk8.1update/special/sysenter/sysenter.vs12.sln create mode 100644 km/build/wdk8.1update/special/sysenter/sysenter.vs12.vcxproj create mode 100644 km/src/dirs create mode 100644 km/src/minimal/main.c create mode 100644 km/src/minimal/makefile create mode 100644 km/src/minimal/sources create mode 100644 km/src/simple/device.c create mode 100644 km/src/simple/device.h create mode 100644 km/src/simple/main.c create mode 100644 km/src/simple/makefile create mode 100644 km/src/simple/sources create mode 100644 km/src/special/dirs create mode 100644 km/src/special/nt_path_converter/control_codes.h create mode 100644 km/src/special/nt_path_converter/device.c create mode 100644 km/src/special/nt_path_converter/device.h create mode 100644 km/src/special/nt_path_converter/main.c create mode 100644 km/src/special/nt_path_converter/makefile create mode 100644 km/src/special/nt_path_converter/nt2dos.c create mode 100644 km/src/special/nt_path_converter/nt2dos.h create mode 100644 km/src/special/nt_path_converter/sources create mode 100644 km/src/special/sysenter/main.c create mode 100644 km/src/special/sysenter/makefile create mode 100644 km/src/special/sysenter/sources (limited to 'km') diff --git a/km/build/wdk7.1/.gitignore b/km/build/wdk7.1/.gitignore new file mode 100644 index 0000000..e6416c5 --- /dev/null +++ b/km/build/wdk7.1/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/lib/ diff --git a/km/build/wdk7.1/add_cert.bat b/km/build/wdk7.1/add_cert.bat new file mode 100644 index 0000000..7223a2a --- /dev/null +++ b/km/build/wdk7.1/add_cert.bat @@ -0,0 +1,26 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +set cert_name=windows7_drivers + +echo ============================ CERT INFO ============================ +echo Certificate name: %cert_name% +echo ========================== END CERT INFO ========================== +echo. +echo ======================= ADDING CERTIFICATE ======================== +call check_ddk.bat || goto :add_cert_failure +echo makecert.exe -r -pe -ss root -n CN="%cert_name%" "%cert_name%.cer" + makecert.exe -r -pe -ss root -n CN="%cert_name%" "%cert_name%.cer" >nul || goto :add_cert_failure +echo del "%cert_name%.cer" + del "%cert_name%.cer" >nul || goto :add_cert_failure +echo =================== ADDING CERTIFICATE SUCCESS ==================== +exit /b 0 + +:add_cert_failure +echo =================== ADDING CERTIFICATE FAILURE ==================== +exit /b %errorlevel% diff --git a/km/build/wdk7.1/build_driver.bat b/km/build/wdk7.1/build_driver.bat new file mode 100644 index 0000000..1cf2a9a --- /dev/null +++ b/km/build/wdk7.1/build_driver.bat @@ -0,0 +1,122 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +if "%~1" == "" ( + echo Usage: %~nx0 DRIVER_SRC_ROOT >&2 + exit /b 1 +) + +call check_env.bat || exit /b !errorlevel! +call check_ddk.bat || exit /b !errorlevel! + +set "driver_src_root=%~f1" + +for /f %%i in ("%driver_src_root%") do ( + set "driver_name=%%~ni" + set "driver_dist_subdir=%%~dpi" +) + +call :make_relative driver_dist_subdir "%src_root%" + +set "sys_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_subdir%" +set "pdb_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_subdir%" +set "lib_dist_dir=%lib_root%\%target_platform%\%target_configuration%\%driver_dist_subdir%" + +echo =========================== DRIVER INFO =========================== +echo Driver source directory: %driver_src_root% +echo Driver name: %driver_name% +echo ========================= END DRIVER INFO ========================= +echo. +echo ============================== BUILD ============================== +set "LIBDISTDIR=%lib_dist_dir%" +pushd "%driver_src_root%" && ( + build.exe /cegwZ + popd +) +if errorlevel 0 ( + echo ========================== BUILD SUCCESS ========================== +) else ( + echo ========================== BUILD FAILURE ========================== + exit /b %errorlevel% +) + +if "%_BUILDARCH%" == "x86" ( + set buildarch_directory=i386 +) else ( + set "buildarch_directory=%_BUILDARCH%" +) + +set "sys_path=%driver_src_root%\obj%BUILD_ALT_DIR%\%buildarch_directory%\%driver_name%.sys" +set "pdb_path=%driver_src_root%\obj%BUILD_ALT_DIR%\%buildarch_directory%\%driver_name%.pdb" +set "lib_path=%driver_src_root%\obj%BUILD_ALT_DIR%\%buildarch_directory%\%driver_name%.lib" + +if exist "%sys_path%" ( + echo. + call "%build_root%\sign.bat" "%sys_path%" || exit /b !errorlevel! +) + +echo. +echo ============================== DISTR ============================== +if exist "%sys_path%" ( + call :distr_copy "%sys_path%" "%sys_dist_dir%" || goto :distr_failure + call :distr_copy "%pdb_path%" "%pdb_dist_dir%" || goto :distr_failure +) +if exist "%lib_path%" ( + call :distr_copy "%lib_path%" "%lib_dist_dir%" || goto :distr_failure +) +echo ========================== DISTR SUCCESS ========================== +exit /b + +:distr_mkdir +if not exist "%~1\" ( + echo mkdir "%~1" + mkdir "%~1" >nul + exit /b !errorlevel! +) +exit /b 0 + +:distr_copy +call :distr_mkdir "%~2" || exit /b !errorlevel! +echo copy "%~1" "%~2" + copy "%~1" "%~2" >nul +exit /b %errorlevel% + +:distr_failure +echo ========================== DISTR FAILURE ========================== +exit /b %errorlevel% + +:make_relative +@setlocal enabledelayedexpansion + +set "abs=%~1" +if defined %~1 set "abs=!%~1!" + +set "base=%~2" +if not defined base set "base=%CD%" + +for /f "tokens=*" %%i in ("%abs%") do set "abs=%%~fi" +for /f "tokens=*" %%i in ("%base%") do set "base=%%~fi" + +set match= +set upper= + +for /f "tokens=*" %%i in ('echo.%base:\=^&echo.%') do ( + set "sub=!sub!%%i\" + call set "tmp=%%abs:!sub!=%%" + if "!tmp!" == "!abs!" ( + set "upper=!upper!..\" + ) else ( + set "match=!sub!" + ) +) + +set "rel=%upper%!abs:%match%=!" + +(endlocal & if defined %~1 (set "%~1=%rel%") else (echo.%rel%)) + +exit /b 0 diff --git a/km/build/wdk7.1/build_drivers.bat b/km/build/wdk7.1/build_drivers.bat new file mode 100644 index 0000000..35b2867 --- /dev/null +++ b/km/build/wdk7.1/build_drivers.bat @@ -0,0 +1,13 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +for /f "delims=" %%i in ('dir "%src_root%\sources" /b /s') do ( + set "driver_src_root=%%~dpi" + echo. + call build_driver.bat "!driver_src_root:~0,-1!" || exit /b !errorlevel! +) diff --git a/km/build/wdk7.1/check_ddk.bat b/km/build/wdk7.1/check_ddk.bat new file mode 100644 index 0000000..aaabd76 --- /dev/null +++ b/km/build/wdk7.1/check_ddk.bat @@ -0,0 +1,38 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +call check_env.bat || exit /b !errorlevel! + +if not defined BUILD_ALT_DIR goto :ddk_not_set +if not defined _BUILDARCH goto :ddk_not_set + +if not exist "%build_root%\sign.bat" ( + echo Error: %build_root%\sign.bat was not found ^(don^'t know how to sign drivers otherwise^) >&2 + exit /b 1 +) + +where build.exe >nul 2>&1 || goto :build_not_found +where signtool.exe >nul 2>&1 || goto :signtool_not_found +where makecert.exe >nul 2>&1 || goto :makecert_not_found +exit /b 0 + +:ddk_not_set +echo Error: either %%BUILD_ALT_DIR%% or %%_BUILDARCH%% are not set ^(have you set up the WinDDK environment?^) >&2 +exit /b 1 + +:build_not_found +echo Error: build.exe was not found ^(have you set up the WinDDK environment?^) >&2 +exit /b 1 + +:signtool_not_found +echo Error: signtool.exe was not found ^(have you set up the WinDDK environment?^) >&2 +exit /b 1 + +:makecert_not_found +echo Error: makecert.exe was not found ^(have you set up the WinDDK environment?^) >&2 +exit /b 1 diff --git a/km/build/wdk7.1/check_env.bat b/km/build/wdk7.1/check_env.bat new file mode 100644 index 0000000..f3cb382 --- /dev/null +++ b/km/build/wdk7.1/check_env.bat @@ -0,0 +1,18 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +if not defined root goto :env_not_set +if not defined bin_root goto :env_not_set +if not defined lib_root goto :env_not_set +if not defined src_root goto :env_not_set + +exit /b 0 + +:env_not_set +echo Error: either %%root%%, %%bin_root%%, %%lib_root%% or %%src_root%% are not set ^(have you set up the build environment using setenv.bat?^) >&2 +exit /b 1 diff --git a/km/build/wdk7.1/clean_driver.bat b/km/build/wdk7.1/clean_driver.bat new file mode 100644 index 0000000..2a98624 --- /dev/null +++ b/km/build/wdk7.1/clean_driver.bat @@ -0,0 +1,96 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +if "%~1" == "" ( + echo Usage: %~nx0 DRIVER_SRC_ROOT >&2 + exit /b 1 +) + +call check_ddk.bat || exit /b !errorlevel! +call check_env.bat || exit /b !errorlevel! + +set "driver_src_root=%~f1" +cd "%driver_src_root%" || exit /b !errorlevel! + +for /f %%i in ("%driver_src_root%") do ( + set "driver_name=%%~ni" + set "driver_dist_root=%%~dpi" +) + +call :make_relative driver_dist_root "%src_root%" + +set "sys_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_root%" +set "pdb_dist_dir=%bin_root%\%target_platform%\%target_configuration%\%driver_dist_root%" +set "lib_dist_dir=%lib_root%\%target_platform%\%target_configuration%\%driver_dist_root%" + +echo =========================== DRIVER INFO =========================== +echo Driver source directory: %driver_src_root% +echo Driver name: %driver_name% +echo ========================= END DRIVER INFO ========================= +echo. +echo ============================== CLEAN ============================== +call :clean_rmdir "obj%BUILD_ALT_DIR%" || goto :clean_failure +call :clean_del "build%BUILD_ALT_DIR%.err" || goto :clean_failure +call :clean_del "build%BUILD_ALT_DIR%.log" || goto :clean_failure +call :clean_del "build%BUILD_ALT_DIR%.wrn" || goto :clean_failure +call :clean_del "%sys_dist_dir%%driver_name%.sys" || goto :clean_failure +call :clean_del "%pdb_dist_dir%%driver_name%.pdb" || goto :clean_failure +call :clean_del "%lib_dist_dir%%driver_name%.lib" || goto :clean_failure +echo ========================== CLEAN SUCCESS ========================== +exit /b 0 + +:clean_rmdir +if exist "%~1\" ( + echo rmdir /s /q "%~1" + rmdir /s /q "%~1" >nul + exit /b !errorlevel! +) +exit /b 0 + +:clean_del +if exist "%~1" ( + echo del "%~1" + del "%~1" >nul + exit /b !errorlevel! +) +exit /b 0 + +:clean_failure +echo ========================== CLEAN FAILURE ========================== +exit /b %errorlevel% + +:make_relative +@setlocal enabledelayedexpansion + +set "abs=%~1" +if defined %~1 set "abs=!%~1!" + +set "base=%~2" +if not defined base set "base=%CD%" + +for /f "tokens=*" %%i in ("%abs%") do set "abs=%%~fi" +for /f "tokens=*" %%i in ("%base%") do set "base=%%~fi" + +set match= +set upper= + +for /f "tokens=*" %%i in ('echo.%base:\=^&echo.%') do ( + set "sub=!sub!%%i\" + call set "tmp=%%abs:!sub!=%%" + if "!tmp!" == "!abs!" ( + set "upper=!upper!..\" + ) else ( + set "match=!sub!" + ) +) + +set "rel=%upper%!abs:%match%=!" + +(endlocal & if defined %~1 (set "%~1=%rel%") else (echo.%rel%)) + +exit /b 0 diff --git a/km/build/wdk7.1/clean_drivers.bat b/km/build/wdk7.1/clean_drivers.bat new file mode 100644 index 0000000..8442c90 --- /dev/null +++ b/km/build/wdk7.1/clean_drivers.bat @@ -0,0 +1,13 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +for /f "delims=" %%i in ('dir "%src_root%\sources" /b /s') do ( + set "driver_src_root=%%~dpi" + echo. + call clean_driver.bat "!driver_src_root:~0,-1!" || exit /b !errorlevel! +) diff --git a/km/build/wdk7.1/setenv.bat b/km/build/wdk7.1/setenv.bat new file mode 100644 index 0000000..c77bb92 --- /dev/null +++ b/km/build/wdk7.1/setenv.bat @@ -0,0 +1,35 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@echo off + +set "build_root=%~dp0%" + +set "root=%build_root%\..\..\.." +for /f "delims=" %%i in ("%root%") do set "root=%%~fi" + +set "src_root=%root%\km\src" +set "bin_root=%root%\km\build\wdk7.1\bin" +set "lib_root=%root%\km\build\wdk7.1\lib" + +set target_configuration=Release + +if not defined _BUILDARCH ( + echo Error: %%_BUILDARCH%% is not defined ^(have you set up the WinDDK environment?^) >&2 + exit /b 1 +) + +if "%_BUILDARCH%" == "AMD64" ( + set target_platform=x64 + exit /b 0 +) + +if "%_BUILDARCH%" == "x86" ( + set target_platform=x86 + exit /b 0 +) + +echo Error: invalid %%_BUILDARCH%% value "%_BUILDARCH%" ^(the only supported architecture is x86^(-64^)^) >&2 +exit /b 1 diff --git a/km/build/wdk7.1/sign.bat b/km/build/wdk7.1/sign.bat new file mode 100644 index 0000000..9955ac2 --- /dev/null +++ b/km/build/wdk7.1/sign.bat @@ -0,0 +1,33 @@ +@rem Copyright (c) 2015 Egor Tensin +@rem This file is part of the "Windows 7 drivers" project. +@rem For details, see https://github.com/egor-tensin/windows7-drivers. +@rem Distributed under the MIT License. + +@setlocal enabledelayedexpansion +@echo off + +set cert_name=windows7_drivers + +if "%~1" == "" ( + echo Usage: %~nx0 SYS_PATH >&2 + exit /b 1 +) + +set "sys_path=%~f1" + +echo ============================ CERT INFO ============================ +echo Certificate name: %cert_name% +echo ========================== END CERT INFO ========================== +echo. +echo ============================= SIGNING ============================= +call check_ddk.bat || goto :signing_failure +echo signtool.exe sign /s root /n "%cert_name%" "%sys_path%" + signtool.exe sign /s root /n "%cert_name%" "%sys_path%" >nul || goto :signing_failure +echo signtool.exe verify /pa "%sys_path%" + signtool.exe verify /pa "%sys_path%" >nul || goto :signing_failure +echo ========================= SIGNING SUCCESS ========================= +exit /b 0 + +:signing_failure +echo ========================= SIGNING FAILURE ========================= +exit /b %errorlevel% diff --git a/km/build/wdk8.1update/minimal/.gitignore b/km/build/wdk8.1update/minimal/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/km/build/wdk8.1update/minimal/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/km/build/wdk8.1update/minimal/minimal.vs12.sln b/km/build/wdk8.1update/minimal/minimal.vs12.sln new file mode 100644 index 0000000..ad150d0 --- /dev/null +++ b/km/build/wdk8.1update/minimal/minimal.vs12.sln @@ -0,0 +1,64 @@ + +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}") = "minimal.vs12", "minimal.vs12.vcxproj", "{4339268C-B8A8-422D-803B-5CF49DFA593B}" +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 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Debug|Win32.Deploy.0 = Win7 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Debug|x64.Deploy.0 = Win7 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Release|Win32.Deploy.0 = Win7 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Release|x64.Build.0 = Win7 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win7 Release|x64.Deploy.0 = Win7 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Debug|x64.Deploy.0 = Win8 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Release|Win32.Deploy.0 = Win8 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Release|x64.Build.0 = Win8 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8 Release|x64.Deploy.0 = Win8 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 + {4339268C-B8A8-422D-803B-5CF49DFA593B}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/km/build/wdk8.1update/minimal/minimal.vs12.vcxproj b/km/build/wdk8.1update/minimal/minimal.vs12.vcxproj new file mode 100644 index 0000000..fae1fe4 --- /dev/null +++ b/km/build/wdk8.1update/minimal/minimal.vs12.vcxproj @@ -0,0 +1,285 @@ + + + + + Win8.1 Debug + Win32 + + + Win8.1 Release + Win32 + + + Win8 Debug + Win32 + + + Win8 Release + Win32 + + + Win7 Debug + Win32 + + + Win7 Release + Win32 + + + Win8.1 Debug + x64 + + + Win8.1 Release + x64 + + + Win8 Debug + x64 + + + Win8 Release + x64 + + + Win7 Debug + x64 + + + Win7 Release + x64 + + + + {4339268C-B8A8-422D-803B-5CF49DFA593B} + {dd38f7fc-d7bd-488b-9242-7d8754cde80d} + v4.5 + 11.0 + Win8.1 Debug + Win32 + minimal_vs12 + + + + WindowsV6.3 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows7 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows7 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + 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\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + 4100;%(DisableSpecificWarnings) + + + + + + + + + + + + + \ No newline at end of file diff --git a/km/build/wdk8.1update/simple/.gitignore b/km/build/wdk8.1update/simple/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/km/build/wdk8.1update/simple/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/km/build/wdk8.1update/simple/simple.vs12.sln b/km/build/wdk8.1update/simple/simple.vs12.sln new file mode 100644 index 0000000..2b1ad11 --- /dev/null +++ b/km/build/wdk8.1update/simple/simple.vs12.sln @@ -0,0 +1,64 @@ + +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}") = "simple.vs12", "simple.vs12.vcxproj", "{8251FD47-D3D6-4A5D-8DFD-84669E075DAF}" +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 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Debug|Win32.Deploy.0 = Win7 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Debug|x64.Deploy.0 = Win7 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Release|Win32.Deploy.0 = Win7 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Release|x64.Build.0 = Win7 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win7 Release|x64.Deploy.0 = Win7 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Debug|x64.Deploy.0 = Win8 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Release|Win32.Deploy.0 = Win8 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Release|x64.Build.0 = Win8 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8 Release|x64.Deploy.0 = Win8 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/km/build/wdk8.1update/simple/simple.vs12.vcxproj b/km/build/wdk8.1update/simple/simple.vs12.vcxproj new file mode 100644 index 0000000..b758480 --- /dev/null +++ b/km/build/wdk8.1update/simple/simple.vs12.vcxproj @@ -0,0 +1,229 @@ + + + + + Win8.1 Debug + Win32 + + + Win8.1 Release + Win32 + + + Win8 Debug + Win32 + + + Win8 Release + Win32 + + + Win7 Debug + Win32 + + + Win7 Release + Win32 + + + Win8.1 Debug + x64 + + + Win8.1 Release + x64 + + + Win8 Debug + x64 + + + Win8 Release + x64 + + + Win7 Debug + x64 + + + Win7 Release + x64 + + + + {8251FD47-D3D6-4A5D-8DFD-84669E075DAF} + {dd38f7fc-d7bd-488b-9242-7d8754cde80d} + v4.5 + 11.0 + Win8.1 Debug + Win32 + simple_vs12 + + + + WindowsV6.3 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows7 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows7 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + 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\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/km/build/wdk8.1update/special/nt_path_converter/.gitignore b/km/build/wdk8.1update/special/nt_path_converter/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/km/build/wdk8.1update/special/nt_path_converter/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.sln b/km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.sln new file mode 100644 index 0000000..45cf003 --- /dev/null +++ b/km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.sln @@ -0,0 +1,64 @@ + +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}") = "nt_path_converter.vs12", "nt_path_converter.vs12.vcxproj", "{6B611107-4492-46B1-A233-12BAB1FF0FC2}" +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 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Debug|Win32.ActiveCfg = Win7 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Debug|Win32.Build.0 = Win7 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Debug|Win32.Deploy.0 = Win7 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Debug|x64.ActiveCfg = Win7 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Debug|x64.Build.0 = Win7 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Debug|x64.Deploy.0 = Win7 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Release|Win32.ActiveCfg = Win7 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Release|Win32.Build.0 = Win7 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Release|Win32.Deploy.0 = Win7 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Release|x64.ActiveCfg = Win7 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Release|x64.Build.0 = Win7 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win7 Release|x64.Deploy.0 = Win7 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Debug|Win32.ActiveCfg = Win8 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Debug|Win32.Build.0 = Win8 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Debug|Win32.Deploy.0 = Win8 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Debug|x64.ActiveCfg = Win8 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Debug|x64.Build.0 = Win8 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Debug|x64.Deploy.0 = Win8 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Release|Win32.ActiveCfg = Win8 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Release|Win32.Build.0 = Win8 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Release|Win32.Deploy.0 = Win8 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Release|x64.ActiveCfg = Win8 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Release|x64.Build.0 = Win8 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8 Release|x64.Deploy.0 = Win8 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Debug|Win32.ActiveCfg = Win8.1 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Debug|Win32.Build.0 = Win8.1 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Debug|Win32.Deploy.0 = Win8.1 Debug|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Debug|x64.ActiveCfg = Win8.1 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Debug|x64.Build.0 = Win8.1 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Debug|x64.Deploy.0 = Win8.1 Debug|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Release|Win32.ActiveCfg = Win8.1 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Release|Win32.Build.0 = Win8.1 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Release|Win32.Deploy.0 = Win8.1 Release|Win32 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Release|x64.ActiveCfg = Win8.1 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Release|x64.Build.0 = Win8.1 Release|x64 + {6B611107-4492-46B1-A233-12BAB1FF0FC2}.Win8.1 Release|x64.Deploy.0 = Win8.1 Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.vcxproj b/km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.vcxproj new file mode 100644 index 0000000..f87134e --- /dev/null +++ b/km/build/wdk8.1update/special/nt_path_converter/nt_path_converter.vs12.vcxproj @@ -0,0 +1,232 @@ + + + + + Win8.1 Debug + Win32 + + + Win8.1 Release + Win32 + + + Win8 Debug + Win32 + + + Win8 Release + Win32 + + + Win7 Debug + Win32 + + + Win7 Release + Win32 + + + Win8.1 Debug + x64 + + + Win8.1 Release + x64 + + + Win8 Debug + x64 + + + Win8 Release + x64 + + + Win7 Debug + x64 + + + Win7 Release + x64 + + + + {6B611107-4492-46B1-A233-12BAB1FF0FC2} + {dd38f7fc-d7bd-488b-9242-7d8754cde80d} + v4.5 + 11.0 + Win8.1 Debug + Win32 + nt_path_converter_vs12 + + + + WindowsV6.3 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows7 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows7 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + WindowsV6.3 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + true + WindowsKernelModeDriver8.1 + Driver + WDM + + + Windows8 + false + WindowsKernelModeDriver8.1 + Driver + WDM + + + 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\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\debug\ + obj\$(TargetVersion)\$(PlatformShortName)\debug\ + + + DbgengKernelDebugger + bin\$(TargetVersion)\$(PlatformShortName)\release\ + obj\$(TargetVersion)\$(PlatformShortName)\release\ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/km/build/wdk8.1update/special/sysenter/.gitignore b/km/build/wdk8.1update/special/sysenter/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/km/build/wdk8.1update/special/sysenter/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/km/build/wdk8.1update/special/sysenter/sysenter.vs12.sln b/km/build/wdk8.1update/special/sysenter/sysenter.vs12.sln new file mode 100644 index 0000000..ec3ab31 --- /dev/null +++ b/km/build/wdk8.1update/special/sysenter/sysenter.vs12.sln @@ -0,0 +1,44 @@ + +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/km/build/wdk8.1update/special/sysenter/sysenter.vs12.vcxproj b/km/build/wdk8.1update/special/sysenter/sysenter.vs12.vcxproj new file mode 100644 index 0000000..966eb6a --- /dev/null +++ b/km/build/wdk8.1update/special/sysenter/sysenter.vs12.vcxproj @@ -0,0 +1,65 @@ + + + + + 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 diff --git a/km/src/dirs b/km/src/dirs new file mode 100644 index 0000000..a32bc1d --- /dev/null +++ b/km/src/dirs @@ -0,0 +1 @@ +DIRS = minimal simple special diff --git a/km/src/minimal/main.c b/km/src/minimal/main.c new file mode 100644 index 0000000..6983929 --- /dev/null +++ b/km/src/minimal/main.c @@ -0,0 +1,12 @@ +#include + +static void on_driver_unload(DRIVER_OBJECT *driver_object) +{ } + +NTSTATUS DriverEntry( + DRIVER_OBJECT *driver_object, + UNICODE_STRING *registry_path) +{ + driver_object->DriverUnload = on_driver_unload; + return STATUS_SUCCESS; +} diff --git a/km/src/minimal/makefile b/km/src/minimal/makefile new file mode 100644 index 0000000..5acbbd2 --- /dev/null +++ b/km/src/minimal/makefile @@ -0,0 +1 @@ +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/km/src/minimal/sources b/km/src/minimal/sources new file mode 100644 index 0000000..b6e92c3 --- /dev/null +++ b/km/src/minimal/sources @@ -0,0 +1,3 @@ +TARGETTYPE = DRIVER +TARGETNAME = minimal +SOURCES = main.c diff --git a/km/src/simple/device.c b/km/src/simple/device.c new file mode 100644 index 0000000..859ba67 --- /dev/null +++ b/km/src/simple/device.c @@ -0,0 +1,220 @@ +/* + * 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 "device.h" + +#include + +static NTSTATUS device_open(DEVICE_OBJECT *device_object, IRP *irp) +{ + NTSTATUS status = STATUS_SUCCESS; + + UNREFERENCED_PARAMETER(device_object); + + irp->IoStatus.Status = status; + irp->IoStatus.Information = 0; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return status; +} + +typedef NTSTATUS (*ioctl_handler)( + void *, unsigned long, + void *, unsigned long, + ULONG_PTR *); + +static NTSTATUS handle_say_hello( + void *in_buf, + unsigned long in_buf_size, + void *out_buf, + unsigned long out_buf_size, + ULONG_PTR *nbwritten) +{ + UNREFERENCED_PARAMETER(in_buf); + UNREFERENCED_PARAMETER(in_buf_size); + UNREFERENCED_PARAMETER(out_buf); + UNREFERENCED_PARAMETER(out_buf_size); + UNREFERENCED_PARAMETER(nbwritten); + + DbgPrint("Hello, world!\n"); + return STATUS_SUCCESS; +} + +static unsigned int i = 42; + +static NTSTATUS handle_exchange_ints( + void *in_buf, + unsigned long in_buf_size, + void *out_buf, + unsigned long out_buf_size, + ULONG_PTR *nbwritten) +{ + unsigned int temp_i; + + if (in_buf_size != sizeof(temp_i)) + return STATUS_INVALID_BUFFER_SIZE; + + RtlCopyMemory(&temp_i, in_buf, in_buf_size); + DbgPrint("%08x\n", temp_i); + + if (out_buf_size < sizeof(i)) + return STATUS_BUFFER_TOO_SMALL; + + RtlCopyMemory(out_buf, &i, sizeof(i)); + *nbwritten += sizeof(i); + i = temp_i; + return STATUS_SUCCESS; +} + +#define SAY_HELLO CTL_CODE(0x8000, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define EXCHANGE_INTS CTL_CODE(0x8001, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) + +static NTSTATUS device_ioctl(DEVICE_OBJECT *device_object, IRP *irp) +{ + IO_STACK_LOCATION *io_stack_loc; + void* in_buf, *out_buf; + unsigned long in_buf_size, out_buf_size; + ioctl_handler handler; + NTSTATUS status = STATUS_UNSUCCESSFUL; + + UNREFERENCED_PARAMETER(device_object); + + irp->IoStatus.Status = status; + irp->IoStatus.Information = 0; + io_stack_loc = IoGetCurrentIrpStackLocation(irp); + + in_buf = out_buf = irp->AssociatedIrp.SystemBuffer; + in_buf_size = io_stack_loc->Parameters.DeviceIoControl.InputBufferLength; + out_buf_size = io_stack_loc->Parameters.DeviceIoControl.OutputBufferLength; + + switch (io_stack_loc->Parameters.DeviceIoControl.IoControlCode) + { + case SAY_HELLO: + handler = handle_say_hello; + break; + + case EXCHANGE_INTS: + handler = handle_exchange_ints; + break; + + default: + status = irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + goto complete_request; + } + + status = irp->IoStatus.Status = handler( + in_buf, in_buf_size, + out_buf, out_buf_size, + &irp->IoStatus.Information); + +complete_request: + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return status; +} + +typedef struct +{ + const wchar_t *path; + const wchar_t *symlink; +} +DeviceInfo; + +typedef struct +{ + DEVICE_OBJECT *object; + UNICODE_STRING path; + UNICODE_STRING symlink; +} +Device; + +#define NUMOF_DEVICES 2 + +static DeviceInfo devices_info[NUMOF_DEVICES] = +{ + { + L"\\Device\\simple_device1", + L"\\DosDevices\\simple_device1", + }, + { + L"\\Device\\simple_device2", + L"\\DosDevices\\simple_device2", + }, +}; + +static Device devices[NUMOF_DEVICES]; + +static void destroy_device(int i) +{ + IoDeleteSymbolicLink(&devices[i].symlink); + IoDeleteDevice(devices[i].object); +} + +void destroy_devices() +{ + int i; + for (i = 0; i < NUMOF_DEVICES; ++i) + destroy_device(i); +} + +static NTSTATUS set_up_device(DRIVER_OBJECT *driver_object, int i) +{ + NTSTATUS status = STATUS_SUCCESS; + + DbgPrint("Setting up device...\n"); + DbgPrint("\tPath: %ws\n", devices_info[i].path); + DbgPrint("\tSymlink: %ws\n", devices_info[i].symlink); + + RtlInitUnicodeString(&devices[i].path, devices_info[i].path); + RtlInitUnicodeString(&devices[i].symlink, devices_info[i].symlink); + + status = IoCreateDevice( + driver_object, + 0, + &devices[i].path, + FILE_DEVICE_UNKNOWN, + FILE_DEVICE_SECURE_OPEN, + FALSE, + &devices[i].object); + + if (!NT_SUCCESS(status)) + return status; + + devices[i].object->Flags |= DO_BUFFERED_IO; + devices[i].object->Flags &= ~DO_DEVICE_INITIALIZING; + + if (!NT_SUCCESS(status = IoCreateSymbolicLink( + &devices[i].symlink, &devices[i].path))) + goto delete_device; + + return status; + +delete_device: + IoDeleteDevice(devices[i].object); + + return status; +} + +NTSTATUS set_up_devices(DRIVER_OBJECT *driver_object) +{ + int i, j; + NTSTATUS status = STATUS_SUCCESS; + + for (i = 0; i < NUMOF_DEVICES; ++i) + if (!NT_SUCCESS(status = set_up_device(driver_object, i))) + goto destroy_devices; + + driver_object->MajorFunction[IRP_MJ_CREATE] = device_open; + driver_object->MajorFunction[IRP_MJ_DEVICE_CONTROL] = device_ioctl; + + return status; + +destroy_devices: + for (j = 0; j < i; ++j) + destroy_device(j); + + return status; +} diff --git a/km/src/simple/device.h b/km/src/simple/device.h new file mode 100644 index 0000000..4f117e9 --- /dev/null +++ b/km/src/simple/device.h @@ -0,0 +1,13 @@ +/* + * 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. + */ + +#pragma once + +#include + +NTSTATUS set_up_devices(DRIVER_OBJECT *); +void destroy_devices(); diff --git a/km/src/simple/main.c b/km/src/simple/main.c new file mode 100644 index 0000000..5148727 --- /dev/null +++ b/km/src/simple/main.c @@ -0,0 +1,29 @@ +/* + * 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 "device.h" + +#include + +static void on_driver_unload(DRIVER_OBJECT *driver_object) +{ + UNREFERENCED_PARAMETER(driver_object); + + DbgPrint("simple: unloading...\n"); + destroy_devices(); +} + +NTSTATUS DriverEntry( + DRIVER_OBJECT *driver_object, + UNICODE_STRING *registry_path) +{ + UNREFERENCED_PARAMETER(registry_path); + + DbgPrint("simple: loading...\n"); + driver_object->DriverUnload = on_driver_unload; + return set_up_devices(driver_object); +} diff --git a/km/src/simple/makefile b/km/src/simple/makefile new file mode 100644 index 0000000..5acbbd2 --- /dev/null +++ b/km/src/simple/makefile @@ -0,0 +1 @@ +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/km/src/simple/sources b/km/src/simple/sources new file mode 100644 index 0000000..1a5ce00 --- /dev/null +++ b/km/src/simple/sources @@ -0,0 +1,3 @@ +TARGETTYPE = DRIVER +TARGETNAME = simple +SOURCES = device.c main.c diff --git a/km/src/special/dirs b/km/src/special/dirs new file mode 100644 index 0000000..479f4db --- /dev/null +++ b/km/src/special/dirs @@ -0,0 +1 @@ +DIRS = nt_path_converter sysenter diff --git a/km/src/special/nt_path_converter/control_codes.h b/km/src/special/nt_path_converter/control_codes.h new file mode 100644 index 0000000..3fb2aff --- /dev/null +++ b/km/src/special/nt_path_converter/control_codes.h @@ -0,0 +1,12 @@ +/* + * 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. + */ + +#pragma once + +#include + +#define CONVERT_NT_PATH CTL_CODE(0x8000, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) diff --git a/km/src/special/nt_path_converter/device.c b/km/src/special/nt_path_converter/device.c new file mode 100644 index 0000000..a179984 --- /dev/null +++ b/km/src/special/nt_path_converter/device.c @@ -0,0 +1,203 @@ +/* + * 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 "control_codes.h" +#include "device.h" +#include "nt2dos.h" + +#include + +static NTSTATUS device_open(DEVICE_OBJECT *device_object, IRP *irp) +{ + NTSTATUS status = STATUS_SUCCESS; + + UNREFERENCED_PARAMETER(device_object); + + irp->IoStatus.Status = status; + irp->IoStatus.Information = 0; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return status; +} + +typedef NTSTATUS (*ioctl_handler)( + void *, unsigned long, + void *, unsigned long, + ULONG_PTR *); + +static NTSTATUS handle_convert_nt_path( + void *in_buf, + unsigned long in_buf_size, + void *out_buf, + unsigned long out_buf_size, + ULONG_PTR *nbwritten) +{ + UNICODE_STRING uUnresolved, uResolved; + NTSTATUS status = STATUS_SUCCESS; + + DbgPrint("nt_path_converter: unresolved path: %ws\n", (WCHAR *) in_buf); + DbgPrint("nt_path_converter: unresolved size: %lu\n", in_buf_size); + + RtlInitUnicodeString(&uUnresolved, (WCHAR *) in_buf); + status = nt2dos(&uResolved, &uUnresolved); + + if (!NT_SUCCESS(status)) + return status; + + *nbwritten = uResolved.Length + sizeof(WCHAR); + + DbgPrint("nt_path_converter: resolved path: %wZ\n", &uResolved); + DbgPrint("nt_path_converter: resolved size: %Iu\n", *nbwritten); + + if (out_buf_size < *nbwritten) + { + status = STATUS_BUFFER_OVERFLOW; + goto free_resolved; + } + + RtlFillMemory(out_buf, *nbwritten, L'\0'); + RtlCopyMemory(out_buf, uResolved.Buffer, uResolved.Length); + +free_resolved: + ExFreePool(uResolved.Buffer); + + return status; +} + +static NTSTATUS device_ioctl(DEVICE_OBJECT *device_object, IRP *irp) +{ + IO_STACK_LOCATION *io_stack_loc; + void* in_buf, *out_buf; + unsigned long in_buf_size, out_buf_size; + ioctl_handler handler; + NTSTATUS status = STATUS_UNSUCCESSFUL; + + UNREFERENCED_PARAMETER(device_object); + + irp->IoStatus.Status = status; + irp->IoStatus.Information = 0; + io_stack_loc = IoGetCurrentIrpStackLocation(irp); + + in_buf = out_buf = irp->AssociatedIrp.SystemBuffer; + in_buf_size = io_stack_loc->Parameters.DeviceIoControl.InputBufferLength; + out_buf_size = io_stack_loc->Parameters.DeviceIoControl.OutputBufferLength; + + switch (io_stack_loc->Parameters.DeviceIoControl.IoControlCode) + { + case CONVERT_NT_PATH: + handler = handle_convert_nt_path; + break; + + default: + status = irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + goto complete_request; + } + + status = irp->IoStatus.Status = handler( + in_buf, in_buf_size, + out_buf, out_buf_size, + &irp->IoStatus.Information); + +complete_request: + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return status; +} + +typedef struct +{ + const wchar_t *path; + const wchar_t *symlink; +} +DeviceInfo; + +typedef struct +{ + DEVICE_OBJECT *object; + UNICODE_STRING path; + UNICODE_STRING symlink; +} +Device; + +#define NUMOF_DEVICES 1 + +static DeviceInfo devices_info[NUMOF_DEVICES] = +{ + { + L"\\Device\\nt_path_converter", + L"\\DosDevices\\nt_path_converter", + }, +}; + +static Device devices[NUMOF_DEVICES]; + +static void destroy_device(int i) +{ + IoDeleteSymbolicLink(&devices[i].symlink); + IoDeleteDevice(devices[i].object); +} + +void destroy_devices() +{ + int i; + for (i = 0; i < NUMOF_DEVICES; ++i) + destroy_device(i); +} + +static NTSTATUS set_up_device(DRIVER_OBJECT *driver_object, int i) +{ + NTSTATUS status = STATUS_SUCCESS; + + RtlInitUnicodeString(&devices[i].path, devices_info[i].path); + RtlInitUnicodeString(&devices[i].symlink, devices_info[i].symlink); + + status = IoCreateDevice( + driver_object, + 0, + &devices[i].path, + FILE_DEVICE_UNKNOWN, + FILE_DEVICE_SECURE_OPEN, + FALSE, + &devices[i].object); + + if (!NT_SUCCESS(status)) + return status; + + devices[i].object->Flags |= DO_BUFFERED_IO; + devices[i].object->Flags &= ~DO_DEVICE_INITIALIZING; + + if (!NT_SUCCESS(status = IoCreateSymbolicLink( + &devices[i].symlink, &devices[i].path))) + goto delete_device; + + return status; + +delete_device: + IoDeleteDevice(devices[i].object); + + return status; +} + +NTSTATUS set_up_devices(DRIVER_OBJECT *driver_object) +{ + int i, j; + NTSTATUS status = STATUS_SUCCESS; + + for (i = 0; i < NUMOF_DEVICES; ++i) + if (!NT_SUCCESS(status = set_up_device(driver_object, i))) + goto destroy_devices; + + driver_object->MajorFunction[IRP_MJ_CREATE] = device_open; + driver_object->MajorFunction[IRP_MJ_DEVICE_CONTROL] = device_ioctl; + + return status; + +destroy_devices: + for (j = 0; j < i; ++j) + destroy_device(j); + + return status; +} diff --git a/km/src/special/nt_path_converter/device.h b/km/src/special/nt_path_converter/device.h new file mode 100644 index 0000000..4f117e9 --- /dev/null +++ b/km/src/special/nt_path_converter/device.h @@ -0,0 +1,13 @@ +/* + * 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. + */ + +#pragma once + +#include + +NTSTATUS set_up_devices(DRIVER_OBJECT *); +void destroy_devices(); diff --git a/km/src/special/nt_path_converter/main.c b/km/src/special/nt_path_converter/main.c new file mode 100644 index 0000000..a1c08e8 --- /dev/null +++ b/km/src/special/nt_path_converter/main.c @@ -0,0 +1,27 @@ +/* + * 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 "device.h" + +#include + +static void on_driver_unload(DRIVER_OBJECT *driver_object) +{ + UNREFERENCED_PARAMETER(driver_object); + + destroy_devices(); +} + +NTSTATUS DriverEntry( + DRIVER_OBJECT *driver_object, + UNICODE_STRING *registry_path) +{ + UNREFERENCED_PARAMETER(registry_path); + + driver_object->DriverUnload = on_driver_unload; + return set_up_devices(driver_object); +} diff --git a/km/src/special/nt_path_converter/makefile b/km/src/special/nt_path_converter/makefile new file mode 100644 index 0000000..5acbbd2 --- /dev/null +++ b/km/src/special/nt_path_converter/makefile @@ -0,0 +1 @@ +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/km/src/special/nt_path_converter/nt2dos.c b/km/src/special/nt_path_converter/nt2dos.c new file mode 100644 index 0000000..d1bdb3d --- /dev/null +++ b/km/src/special/nt_path_converter/nt2dos.c @@ -0,0 +1,151 @@ +/* + * 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 + +#include "nt2dos.h" + +static NTSTATUS get_object_name_info( + void *object, + OBJECT_NAME_INFORMATION **object_name_info) +{ + unsigned long nbneeded; + NTSTATUS status = STATUS_SUCCESS; + + status = ObQueryNameString(object, NULL, 0, &nbneeded); + + if (status != STATUS_INFO_LENGTH_MISMATCH) + return status; + + *object_name_info = ExAllocatePoolWithTag(PagedPool, nbneeded, '1l'); + + if (*object_name_info == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + status = ObQueryNameString(object, *object_name_info, nbneeded, &nbneeded); + + if (!NT_SUCCESS(status)) + goto free_object_name_info; + + return status; + +free_object_name_info: + ExFreePool(*object_name_info); + + return status; +} + +NTSTATUS nt2dos(UNICODE_STRING *u_resolved, UNICODE_STRING *u_unresolved) +{ + IO_STATUS_BLOCK io_status_block; + DEVICE_OBJECT *volume_object; + FILE_OBJECT *file_object; + HANDLE file; + OBJECT_ATTRIBUTES file_attrs; + OBJECT_NAME_INFORMATION *file_name_info, *volume_name_info; + UNICODE_STRING u_dos_name; + USHORT u_resolved_size; + NTSTATUS status = STATUS_SUCCESS; + + InitializeObjectAttributes( + &file_attrs, + u_unresolved, + OBJ_CASE_INSENSITIVE | OBJ_OPENIF, + NULL, + NULL); + + status = ZwCreateFile( + &file, + FILE_READ_ATTRIBUTES, + &file_attrs, + &io_status_block, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_OPEN, + FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + + if (!NT_SUCCESS(status)) + return status; + + status = ObReferenceObjectByHandle( + file, + FILE_READ_ATTRIBUTES, + *IoFileObjectType, + KernelMode, + &file_object, + NULL); + + if (!NT_SUCCESS(status)) + goto close_file; + + status = get_object_name_info(file_object, &file_name_info); + + if (!NT_SUCCESS(status)) + goto close_file; + + if (file_object->Vpb == NULL) + { + u_resolved->Buffer = ExAllocatePoolWithTag( + PagedPool, file_name_info->Name.Length, '1l'); + + if (u_resolved->Buffer == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + goto free_file_name_info; + } + + RtlInitEmptyUnicodeString( + u_resolved, u_resolved->Buffer, file_name_info->Name.Length); + RtlCopyUnicodeString(u_resolved, &file_name_info->Name); + goto free_file_name_info; + } + + volume_object = file_object->Vpb->RealDevice; + status = get_object_name_info(volume_object, &volume_name_info); + + if (!NT_SUCCESS(status)) + goto free_file_name_info; + + status = IoVolumeDeviceToDosName(volume_object, &u_dos_name); + + if (!NT_SUCCESS(status)) + goto free_volume_name_info; + + u_resolved_size = file_name_info->Name.Length - volume_name_info->Name.Length + u_dos_name.Length; + + u_resolved->Buffer = ExAllocatePoolWithTag(PagedPool, u_resolved_size, '1l'); + + if (u_resolved->Buffer == NULL) + { + status = STATUS_INSUFFICIENT_RESOURCES; + goto free_dos_name; + } + + RtlInitEmptyUnicodeString(u_resolved, u_resolved->Buffer, u_resolved_size); + + RtlCopyUnicodeString(u_resolved, &u_dos_name); + file_name_info->Name.Buffer += volume_name_info->Name.Length / sizeof(wchar_t); + file_name_info->Name.Length -= volume_name_info->Name.Length; + RtlUnicodeStringCat(u_resolved, &file_name_info->Name); + +free_dos_name: + ExFreePool(u_dos_name.Buffer); + +free_volume_name_info: + ExFreePool(volume_name_info); + +free_file_name_info: + ExFreePool(file_name_info); + +close_file: + ZwClose(file); + + return status; +} diff --git a/km/src/special/nt_path_converter/nt2dos.h b/km/src/special/nt_path_converter/nt2dos.h new file mode 100644 index 0000000..ce0b690 --- /dev/null +++ b/km/src/special/nt_path_converter/nt2dos.h @@ -0,0 +1,12 @@ +/* + * 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. + */ + +#pragma once + +#include + +NTSTATUS nt2dos(UNICODE_STRING *resolved, UNICODE_STRING *unresolved); diff --git a/km/src/special/nt_path_converter/sources b/km/src/special/nt_path_converter/sources new file mode 100644 index 0000000..02a42cd --- /dev/null +++ b/km/src/special/nt_path_converter/sources @@ -0,0 +1,3 @@ +TARGETTYPE = DRIVER +TARGETNAME = nt_path_converter +SOURCES = device.c main.c nt2dos.c diff --git a/km/src/special/sysenter/main.c b/km/src/special/sysenter/main.c new file mode 100644 index 0000000..9eb9b28 --- /dev/null +++ b/km/src/special/sysenter/main.c @@ -0,0 +1,106 @@ +/* + * 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/km/src/special/sysenter/makefile b/km/src/special/sysenter/makefile new file mode 100644 index 0000000..5acbbd2 --- /dev/null +++ b/km/src/special/sysenter/makefile @@ -0,0 +1 @@ +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/km/src/special/sysenter/sources b/km/src/special/sysenter/sources new file mode 100644 index 0000000..d6371b3 --- /dev/null +++ b/km/src/special/sysenter/sources @@ -0,0 +1,4 @@ +TARGETTYPE = DRIVER +TARGETNAME = sysenter +SOURCES = +I386_SOURCES = main.c -- cgit v1.2.3