diff options
| author | a1xd <[email protected]> | 2020-12-02 05:25:19 -0500 |
|---|---|---|
| committer | a1xd <[email protected]> | 2020-12-02 05:25:19 -0500 |
| commit | 7d14daf1d5fce4d09471a3abe2aca49cf7680816 (patch) | |
| tree | 43411443aadc79d36ad1da8063208cd51fdb15fe /common | |
| parent | merge common-install with common (diff) | |
| download | rawaccel-7d14daf1d5fce4d09471a3abe2aca49cf7680816.tar.xz rawaccel-7d14daf1d5fce4d09471a3abe2aca49cf7680816.zip | |
embed version info into assemblies
check app versions against lib, lib against driver
add an 'about' dialog which displays version details, accessible from menu
refactor error handling + add check for negative offset
Diffstat (limited to 'common')
| -rw-r--r-- | common/common.vcxitems | 1 | ||||
| -rw-r--r-- | common/rawaccel-error.hpp | 6 | ||||
| -rw-r--r-- | common/rawaccel-io-def.h | 1 | ||||
| -rw-r--r-- | common/rawaccel-io.hpp | 7 | ||||
| -rw-r--r-- | common/rawaccel-version.h | 26 |
5 files changed, 36 insertions, 5 deletions
diff --git a/common/common.vcxitems b/common/common.vcxitems index 69b4a69..2b03405 100644 --- a/common/common.vcxitems +++ b/common/common.vcxitems @@ -26,6 +26,7 @@ <ClInclude Include="$(MSBuildThisFileDirectory)rawaccel-io-def.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)rawaccel-io.hpp" /> <ClInclude Include="$(MSBuildThisFileDirectory)rawaccel-settings.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)rawaccel-version.h" /> <ClInclude Include="$(MSBuildThisFileDirectory)rawaccel.hpp" /> <ClInclude Include="$(MSBuildThisFileDirectory)utility-install.hpp" /> <ClInclude Include="$(MSBuildThisFileDirectory)x64-util.hpp" /> diff --git a/common/rawaccel-error.hpp b/common/rawaccel-error.hpp index ecee526..cdbe1e5 100644 --- a/common/rawaccel-error.hpp +++ b/common/rawaccel-error.hpp @@ -8,17 +8,13 @@ namespace rawaccel { using std::runtime_error::runtime_error; }; - class invalid_argument : public error { - using error::error; - }; - class io_error : public error { using error::error; }; class install_error : public io_error { public: - install_error() : io_error("rawaccel is not installed") {} + install_error() : io_error("Raw Accel driver is not installed, run installer.exe") {} }; } diff --git a/common/rawaccel-io-def.h b/common/rawaccel-io-def.h index 791addb..d8d4088 100644 --- a/common/rawaccel-io-def.h +++ b/common/rawaccel-io-def.h @@ -10,3 +10,4 @@ #define RA_READ CTL_CODE(RA_DEV_TYPE, 0x888, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) #define RA_WRITE CTL_CODE(RA_DEV_TYPE, 0x889, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define RA_GET_VERSION CTL_CODE(RA_DEV_TYPE, 0x88a, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) diff --git a/common/rawaccel-io.hpp b/common/rawaccel-io.hpp index 4159b60..703ea92 100644 --- a/common/rawaccel-io.hpp +++ b/common/rawaccel-io.hpp @@ -7,6 +7,7 @@ #include "rawaccel-io-def.h" #include "rawaccel-settings.h" +#include "rawaccel-version.h" #include "rawaccel-error.hpp" #pragma warning(push) @@ -55,6 +56,12 @@ namespace rawaccel { io_control(RA_WRITE, in_ptr, sizeof(settings), NULL, 0); } + version_t get_version() { + version_t ver; + io_control(RA_GET_VERSION, NULL, 0, &ver, sizeof(version_t)); + return ver; + } + } #pragma warning(pop) diff --git a/common/rawaccel-version.h b/common/rawaccel-version.h new file mode 100644 index 0000000..c9828a0 --- /dev/null +++ b/common/rawaccel-version.h @@ -0,0 +1,26 @@ +#pragma once + +#define RA_VER_MAJOR 1 +#define RA_VER_MINOR 3 +#define RA_VER_PATCH 0 + +#define RA_MIN_OS "Win10" + +#define M_STR_HELPER(x) #x +#define M_STR(x) M_STR_HELPER(x) + +#define RA_VER_STRING M_STR(RA_VER_MAJOR) "." M_STR(RA_VER_MINOR) "." M_STR(RA_VER_PATCH) + +namespace rawaccel { + + struct version_t { + int major; + int minor; + int patch; + }; + +#ifndef _KERNEL_MODE + inline constexpr version_t min_driver_version = { 1, 3, 0 }; +#endif + +} |