diff options
Diffstat (limited to 'utils/libsimple')
-rw-r--r-- | utils/libsimple/CMakeLists.txt | 9 | ||||
-rw-r--r-- | utils/libsimple/README.md | 43 | ||||
-rw-r--r-- | utils/libsimple/include/libsimple/all.hpp | 8 | ||||
-rw-r--r-- | utils/libsimple/include/libsimple/device.hpp | 19 | ||||
-rw-r--r-- | utils/libsimple/src/device.cpp | 37 | ||||
-rw-r--r-- | utils/libsimple/utils/CMakeLists.txt | 2 | ||||
-rw-r--r-- | utils/libsimple/utils/exchange_ints.cpp | 44 |
7 files changed, 0 insertions, 162 deletions
diff --git a/utils/libsimple/CMakeLists.txt b/utils/libsimple/CMakeLists.txt deleted file mode 100644 index ff61bd7..0000000 --- a/utils/libsimple/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -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/libsimple/README.md b/utils/libsimple/README.md deleted file mode 100644 index 1d9896a..0000000 --- a/utils/libsimple/README.md +++ /dev/null @@ -1,43 +0,0 @@ -simple driver utilities -======================= - -[simple] driver usage examples. - -[simple]: ../../src/simple - -Usage ------ - -### exchange_ints.exe - -``` -Usage: exchange_ints.exe N -``` - -Parses its argument as an `unsigned int` and exchanges it with the one stored -in [simple] driver's memory. -For example: - -``` -> exchange_ints.exe 1 -42 -``` - -``` -> exchange_ints.exe 32 -1 -``` - -``` -> exchange_ints.exe 100500 -32 -``` - -See also --------- - -* [Building the utilities] -* [License] - -[Building the utilities]: ../README.md#building-the-utilities -[License]: ../../README.md#license diff --git a/utils/libsimple/include/libsimple/all.hpp b/utils/libsimple/include/libsimple/all.hpp deleted file mode 100644 index 474b802..0000000 --- a/utils/libsimple/include/libsimple/all.hpp +++ /dev/null @@ -1,8 +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. - -#pragma once - -#include "device.hpp" diff --git a/utils/libsimple/include/libsimple/device.hpp b/utils/libsimple/include/libsimple/device.hpp deleted file mode 100644 index 3318818..0000000 --- a/utils/libsimple/include/libsimple/device.hpp +++ /dev/null @@ -1,19 +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. - -#pragma once - -#include "libservice/all.hpp" - -namespace libsimple -{ - class Device : libservice::Device - { - public: - Device(); - - unsigned int exchange_ints(unsigned int) const; - }; -} diff --git a/utils/libsimple/src/device.cpp b/utils/libsimple/src/device.cpp deleted file mode 100644 index 57e6963..0000000 --- a/utils/libsimple/src/device.cpp +++ /dev/null @@ -1,37 +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 "libsimple/all.hpp" - -#include "libservice/all.hpp" - -#include <Windows.h> - -namespace libsimple -{ - namespace - { - const char* const device_path = "\\\\.\\simple_device1"; - const auto exchange_ints_ctl_code = CTL_CODE(0x8001, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS); - } - - Device::Device() - : libservice::Device(libservice::Device::open(device_path)) - { } - - unsigned int Device::exchange_ints(unsigned int src) const - { - unsigned int dest; - - send_control_code( - exchange_ints_ctl_code, - &src, - sizeof(src), - &dest, - sizeof(dest)); - - return dest; - } -} diff --git a/utils/libsimple/utils/CMakeLists.txt b/utils/libsimple/utils/CMakeLists.txt deleted file mode 100644 index 8824e3e..0000000 --- a/utils/libsimple/utils/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(exchange_ints exchange_ints.cpp) -target_link_libraries(exchange_ints libsimple) diff --git a/utils/libsimple/utils/exchange_ints.cpp b/utils/libsimple/utils/exchange_ints.cpp deleted file mode 100644 index 2935b2f..0000000 --- a/utils/libsimple/utils/exchange_ints.cpp +++ /dev/null @@ -1,44 +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 "libsimple/all.hpp" - -#include <exception> -#include <iostream> -#include <sstream> -#include <string> - -namespace -{ - bool parse_int(unsigned int& dest, const std::string& src) - { - std::istringstream iss(src); - char c; - return iss >> dest && !iss.get(c); - } -} - -int main(int argc, char* argv[]) -{ - try - { - unsigned int src; - - if (argc != 2 || !parse_int(src, argv[1])) - { - std::cout << "Usage: " << argv[0] << " N\n"; - return 1; - } - - std::cout << libsimple::Device().exchange_ints(src) << "\n"; - } - catch (const std::exception& e) - { - std::cerr << e.what() << "\n"; - return 1; - } - - return 0; -} |