diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-27 17:44:54 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-27 17:44:54 +0300 |
commit | 952970cc2a18a603e0bdccdc1f907b73da7eb4f4 (patch) | |
tree | f530b23fd873bbb87f6eed280322044b88b8cb51 | |
parent | *.bat: usage message updates (diff) | |
download | windows7-drivers-952970cc2a18a603e0bdccdc1f907b73da7eb4f4.tar.gz windows7-drivers-952970cc2a18a603e0bdccdc1f907b73da7eb4f4.zip |
test -> simple
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | src/simple/device.c (renamed from src/test/device.c) | 8 | ||||
-rw-r--r-- | src/simple/device.h (renamed from src/test/device.h) | 0 | ||||
-rw-r--r-- | src/simple/main.c (renamed from src/test/main.c) | 4 | ||||
-rw-r--r-- | src/simple/makefile (renamed from src/test/makefile) | 0 | ||||
-rw-r--r-- | src/simple/sources (renamed from src/test/sources) | 2 | ||||
-rw-r--r-- | src/simple/vs12/.gitignore (renamed from src/test/vs12/.gitignore) | 0 | ||||
-rw-r--r-- | src/simple/vs12/simple.vs12.sln (renamed from src/test/vs12/test.vs12.sln) | 2 | ||||
-rw-r--r-- | src/simple/vs12/simple.vs12.vcxproj (renamed from src/test/vs12/test.vs12.vcxproj) | 2 | ||||
-rw-r--r-- | utils/CMakeLists.txt | 3 | ||||
-rw-r--r-- | utils/README.md | 6 | ||||
-rw-r--r-- | utils/libsimple/CMakeLists.txt | 9 | ||||
-rw-r--r-- | utils/libsimple/README.md (renamed from utils/libtest/README.md) | 10 | ||||
-rw-r--r-- | utils/libsimple/include/libsimple/all.hpp (renamed from utils/libtest/include/libtest/all.hpp) | 0 | ||||
-rw-r--r-- | utils/libsimple/include/libsimple/device.hpp (renamed from utils/libtest/include/libtest/device.hpp) | 2 | ||||
-rw-r--r-- | utils/libsimple/src/device.cpp (renamed from utils/libtest/src/device.cpp) | 6 | ||||
-rw-r--r-- | utils/libsimple/utils/CMakeLists.txt (renamed from utils/libtest/utils/CMakeLists.txt) | 2 | ||||
-rw-r--r-- | utils/libsimple/utils/exchange_ints.cpp (renamed from utils/libtest/utils/exchange_ints.cpp) | 4 | ||||
-rw-r--r-- | utils/libtest/CMakeLists.txt | 9 |
19 files changed, 44 insertions, 42 deletions
@@ -43,7 +43,7 @@ To verify it's there, you can use the `certmgr.msc` utility. The binaries are signed automatically after they are built, but you can also sign manually by passing the path to a .sys file to `sign.bat`: - sign.bat C:\workspace\personal\windows7-drivers\bin\x64\Release\test.sys + sign.bat C:\workspace\personal\windows7-drivers\bin\x64\Release\simple.sys ### Building the drivers @@ -54,7 +54,7 @@ To build every driver under the "src/" directory, execute `build_drivers.bat`: To build a particular driver, pass the path to the driver's source directory to `build_driver.bat`: - build_driver.bat C:\workspace\personal\windows7-drivers\src\test + build_driver.bat C:\workspace\personal\windows7-drivers\src\simple Driver binaries are copied to the "bin/" directory under the project's root. @@ -72,25 +72,26 @@ To clean up after building every driver in the "src/" directory, execute To clean up after building a particular driver, pass the path to the driver's source directory to `clean_driver.bat`: - clean_driver.bat C:\workspace\personal\windows7-drivers\src\test + clean_driver.bat C:\workspace\personal\windows7-drivers\src\simple Installation ------------ To install a driver as a Windows service, you can use the `sc` utility. -For example, to install `test.sys` as a service with the name `test`, execute: +For example, to install `simple.sys` as a service with the name `simple`, +execute: - sc create test type= kernel binPath= C:\workspace\personal\windows7-drivers\bin\x64\Release\test.sys + sc create simple type= kernel binPath= C:\workspace\personal\windows7-drivers\bin\x64\Release\simple.sys You can then load/unload the driver by starting/stopping the corresponding service using the `net` utility. - net start test - net stop test + net start simple + net stop simple To uninstall a driver, delete the corresponding service using `sc`. - sc delete test + sc delete simple Please note, that **64-bit versions of Windows 7 disallow loading 32-bit drivers**! diff --git a/src/test/device.c b/src/simple/device.c index 7b871a3..859ba67 100644 --- a/src/test/device.c +++ b/src/simple/device.c @@ -136,12 +136,12 @@ Device; static DeviceInfo devices_info[NUMOF_DEVICES] = { { - L"\\Device\\test_device1", - L"\\DosDevices\\test_device1", + L"\\Device\\simple_device1", + L"\\DosDevices\\simple_device1", }, { - L"\\Device\\test_device2", - L"\\DosDevices\\test_device2", + L"\\Device\\simple_device2", + L"\\DosDevices\\simple_device2", }, }; diff --git a/src/test/device.h b/src/simple/device.h index 4f117e9..4f117e9 100644 --- a/src/test/device.h +++ b/src/simple/device.h diff --git a/src/test/main.c b/src/simple/main.c index b3d2b58..5148727 100644 --- a/src/test/main.c +++ b/src/simple/main.c @@ -13,7 +13,7 @@ static void on_driver_unload(DRIVER_OBJECT *driver_object) { UNREFERENCED_PARAMETER(driver_object); - DbgPrint("Unloading test driver...\n"); + DbgPrint("simple: unloading...\n"); destroy_devices(); } @@ -23,7 +23,7 @@ NTSTATUS DriverEntry( { UNREFERENCED_PARAMETER(registry_path); - DbgPrint("Loading test driver...\n"); + DbgPrint("simple: loading...\n"); driver_object->DriverUnload = on_driver_unload; return set_up_devices(driver_object); } diff --git a/src/test/makefile b/src/simple/makefile index 5acbbd2..5acbbd2 100644 --- a/src/test/makefile +++ b/src/simple/makefile diff --git a/src/test/sources b/src/simple/sources index 245a1a7..1a5ce00 100644 --- a/src/test/sources +++ b/src/simple/sources @@ -1,3 +1,3 @@ TARGETTYPE = DRIVER -TARGETNAME = test +TARGETNAME = simple SOURCES = device.c main.c diff --git a/src/test/vs12/.gitignore b/src/simple/vs12/.gitignore index cd42ee3..cd42ee3 100644 --- a/src/test/vs12/.gitignore +++ b/src/simple/vs12/.gitignore diff --git a/src/test/vs12/test.vs12.sln b/src/simple/vs12/simple.vs12.sln index d42e421..2b1ad11 100644 --- a/src/test/vs12/test.vs12.sln +++ b/src/simple/vs12/simple.vs12.sln @@ -3,7 +3,7 @@ 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}") = "test.vs12", "test.vs12.vcxproj", "{8251FD47-D3D6-4A5D-8DFD-84669E075DAF}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple.vs12", "simple.vs12.vcxproj", "{8251FD47-D3D6-4A5D-8DFD-84669E075DAF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/test/vs12/test.vs12.vcxproj b/src/simple/vs12/simple.vs12.vcxproj index 6793bdf..5fee57f 100644 --- a/src/test/vs12/test.vs12.vcxproj +++ b/src/simple/vs12/simple.vs12.vcxproj @@ -57,7 +57,7 @@ <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> <Configuration Condition="'$(Configuration)' == ''">Win8.1 Debug</Configuration> <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <RootNamespace>test_vs12</RootNamespace> + <RootNamespace>simple_vs12</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|Win32'" Label="Configuration"> diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 716c661..31c8511 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,5 +1,6 @@ project(windows7_drivers_utils) add_subdirectory(libservice) + add_subdirectory(libnt_path_converter) -add_subdirectory(libtest) +add_subdirectory(libsimple) diff --git a/utils/README.md b/utils/README.md index 5d03428..1579471 100644 --- a/utils/README.md +++ b/utils/README.md @@ -4,12 +4,12 @@ Driver utilities A couple of usage examples are included along with the drivers. * [libservice]: Utilities to load/unload the drivers. -* [libtest]: [test] driver usage examples. +* [libsimple]: [simple] driver usage examples. * [libnt_path_converter]: [nt_path_converter] driver usage examples. [libservice]: libservice/README.md -[libtest]: libtest/README.md -[test]: ../src/test +[libsimple]: libsimple/README.md +[simple]: ../src/simple [libnt_path_converter]: libnt_path_converter/README.md [nt_path_converter]: ../src/nt_path_converter diff --git a/utils/libsimple/CMakeLists.txt b/utils/libsimple/CMakeLists.txt new file mode 100644 index 0000000..ff61bd7 --- /dev/null +++ b/utils/libsimple/CMakeLists.txt @@ -0,0 +1,9 @@ +file(GLOB_RECURSE libsimple_headers "include/*.hpp") +file(GLOB libsimple_sources "src/*.cpp") +add_library(libsimple + ${libsimple_sources} + ${libsimple_headers}) +target_link_libraries(libsimple libservice) +target_include_directories(libsimple PUBLIC include/) + +add_subdirectory(utils) diff --git a/utils/libtest/README.md b/utils/libsimple/README.md index 0257c71..1d9896a 100644 --- a/utils/libtest/README.md +++ b/utils/libsimple/README.md @@ -1,9 +1,9 @@ -test driver utilities -===================== +simple driver utilities +======================= -[test] driver usage examples. +[simple] driver usage examples. -[test]: ../../src/test +[simple]: ../../src/simple Usage ----- @@ -15,7 +15,7 @@ Usage: exchange_ints.exe N ``` Parses its argument as an `unsigned int` and exchanges it with the one stored -in [test] driver's memory. +in [simple] driver's memory. For example: ``` diff --git a/utils/libtest/include/libtest/all.hpp b/utils/libsimple/include/libsimple/all.hpp index 474b802..474b802 100644 --- a/utils/libtest/include/libtest/all.hpp +++ b/utils/libsimple/include/libsimple/all.hpp diff --git a/utils/libtest/include/libtest/device.hpp b/utils/libsimple/include/libsimple/device.hpp index 591d215..3318818 100644 --- a/utils/libtest/include/libtest/device.hpp +++ b/utils/libsimple/include/libsimple/device.hpp @@ -7,7 +7,7 @@ #include "libservice/all.hpp" -namespace libtest +namespace libsimple { class Device : libservice::Device { diff --git a/utils/libtest/src/device.cpp b/utils/libsimple/src/device.cpp index f06a22a..57e6963 100644 --- a/utils/libtest/src/device.cpp +++ b/utils/libsimple/src/device.cpp @@ -3,17 +3,17 @@ // For details, see https://github.com/egor-tensin/windows7-drivers. // Distributed under the MIT License. -#include "libtest/all.hpp" +#include "libsimple/all.hpp" #include "libservice/all.hpp" #include <Windows.h> -namespace libtest +namespace libsimple { namespace { - const char* const device_path = "\\\\.\\test_device1"; + const char* const device_path = "\\\\.\\simple_device1"; const auto exchange_ints_ctl_code = CTL_CODE(0x8001, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS); } diff --git a/utils/libtest/utils/CMakeLists.txt b/utils/libsimple/utils/CMakeLists.txt index 9b22ab2..8824e3e 100644 --- a/utils/libtest/utils/CMakeLists.txt +++ b/utils/libsimple/utils/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(exchange_ints exchange_ints.cpp) -target_link_libraries(exchange_ints libtest) +target_link_libraries(exchange_ints libsimple) diff --git a/utils/libtest/utils/exchange_ints.cpp b/utils/libsimple/utils/exchange_ints.cpp index f70badf..2935b2f 100644 --- a/utils/libtest/utils/exchange_ints.cpp +++ b/utils/libsimple/utils/exchange_ints.cpp @@ -3,7 +3,7 @@ // For details, see https://github.com/egor-tensin/windows7-drivers. // Distributed under the MIT License. -#include "libtest/all.hpp" +#include "libsimple/all.hpp" #include <exception> #include <iostream> @@ -32,7 +32,7 @@ int main(int argc, char* argv[]) return 1; } - std::cout << libtest::Device().exchange_ints(src) << "\n"; + std::cout << libsimple::Device().exchange_ints(src) << "\n"; } catch (const std::exception& e) { diff --git a/utils/libtest/CMakeLists.txt b/utils/libtest/CMakeLists.txt deleted file mode 100644 index 8c64ba1..0000000 --- a/utils/libtest/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -file(GLOB_RECURSE libtest_headers "include/*.hpp") -file(GLOB libtest_sources "src/*.cpp") -add_library(libtest - ${libtest_sources} - ${libtest_headers}) -target_link_libraries(libtest libservice) -target_include_directories(libtest PUBLIC include/) - -add_subdirectory(utils) |