From 0a8effcccac92ffd591f94c276fb797dd31f51ab Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Wed, 29 Jul 2020 15:39:39 -0700 Subject: Compiles but may file --- console/console.cpp | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) (limited to 'console/console.cpp') diff --git a/console/console.cpp b/console/console.cpp index 490051c..549cb68 100644 --- a/console/console.cpp +++ b/console/console.cpp @@ -4,39 +4,7 @@ #include #include - -#define RA_WRITE CTL_CODE(0x8888, 0x888, METHOD_BUFFERED, FILE_ANY_ACCESS) - -namespace ra = rawaccel; - -void write(ra::mouse_modifier vars) { - HANDLE ra_handle = INVALID_HANDLE_VALUE; - - ra_handle = CreateFileW(L"\\\\.\\rawaccel", 0, 0, 0, OPEN_EXISTING, 0, 0); - - if (ra_handle == INVALID_HANDLE_VALUE) { - throw std::system_error(GetLastError(), std::system_category(), "CreateFile failed"); - } - - DWORD dummy; - - BOOL success = DeviceIoControl( - ra_handle, - RA_WRITE, - &vars, - sizeof(ra::mouse_modifier), - NULL, // output buffer - 0, // output buffer size - &dummy, // bytes returned - NULL // overlapped structure - ); - - CloseHandle(ra_handle); - - if (!success) { - throw std::system_error(GetLastError(), std::system_category(), "DeviceIoControl failed"); - } -} +#include "console_write.hpp" int main(int argc, char** argv) { try { -- cgit v1.2.3