diff options
| author | JacobPalecki <[email protected]> | 2020-08-31 23:03:46 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-08-31 23:03:46 -0700 |
| commit | 471fe599bab6ba0632ddd1dacd20c7fc42db0eee (patch) | |
| tree | 90a82ee14dbb112621657efbd2523ed35f59d154 /common/rawaccel-io.hpp | |
| parent | Merge pull request #16 from JacobPalecki/Misc (diff) | |
| parent | add independent xy accel to driver (diff) | |
| download | rawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.tar.xz rawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.zip | |
Merge pull request #17 from a1xd/indep
Indep
Diffstat (limited to 'common/rawaccel-io.hpp')
| -rw-r--r-- | common/rawaccel-io.hpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/common/rawaccel-io.hpp b/common/rawaccel-io.hpp index 7f55392..74e2d1e 100644 --- a/common/rawaccel-io.hpp +++ b/common/rawaccel-io.hpp @@ -5,7 +5,8 @@ #define NOMINMAX #include <Windows.h> -#include "rawaccel.hpp" +#include "rawaccel-settings.h" +#include "rawaccel-error.hpp" #define RA_READ CTL_CODE(0x8888, 0x888, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) #define RA_WRITE CTL_CODE(0x8888, 0x889, METHOD_BUFFERED, FILE_ANY_ACCESS) @@ -15,7 +16,7 @@ namespace rawaccel { - mouse_modifier read() { + settings read() { HANDLE ra_handle = INVALID_HANDLE_VALUE; ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0); @@ -24,7 +25,7 @@ namespace rawaccel { throw install_error(); } - mouse_modifier mod; + settings args; DWORD dummy; BOOL success = DeviceIoControl( @@ -32,8 +33,8 @@ namespace rawaccel { RA_READ, NULL, // input buffer 0, // input buffer size - &mod, // output buffer - sizeof(mouse_modifier), // output buffer size + &args, // output buffer + sizeof(settings), // output buffer size &dummy, // bytes returned NULL // overlapped structure ); @@ -44,11 +45,11 @@ namespace rawaccel { throw std::system_error(GetLastError(), std::system_category(), "DeviceIoControl failed"); } - return mod; + return args; } - void write(mouse_modifier mod) { + void write(const settings& args) { HANDLE ra_handle = INVALID_HANDLE_VALUE; ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0); @@ -62,12 +63,12 @@ namespace rawaccel { BOOL success = DeviceIoControl( ra_handle, RA_WRITE, - &mod, // input buffer - sizeof(mouse_modifier), // input buffer size - NULL, // output buffer - 0, // output buffer size - &dummy, // bytes returned - NULL // overlapped structure + const_cast<settings*>(&args), // input buffer + sizeof(settings), // input buffer size + NULL, // output buffer + 0, // output buffer size + &dummy, // bytes returned + NULL // overlapped structure ); CloseHandle(ra_handle); |