Skip to content

About

Windows C++17 UDP input forwarding experiment with a documented seven-field protocol, bounded hook queue, explicit modes and loopback tests.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instruction Broadcaster

A Windows C++17 experiment for forwarding mouse and keyboard instructions over UDP to Instruction-Receiver. It also provides a single-packet CLI for testing the protocol without capturing input.

Build

Windows 10 version 1703+, C++17 and CMake 3.16+ are required.

cmake -S . -B build
cmake --build build --config Release
ctest --test-dir build -C Release --output-on-failure
.\build\Release\instruction-broadcaster.exe --check

For Ninja/MinGW-w64, the executable is directly in build. The Visual Studio project is retained.

Try one packet

Start Instruction-Receiver in its default dry-run mode, then run:

.\build\Release\instruction-broadcaster.exe --send 127.0.0.1 "2 100 200 0 0 0 0"

This sends one validated instruction; it installs no hooks. An optional final argument selects the port. The receiver applies input only when started with --apply.

Forward input

.\build\Release\instruction-broadcaster.exe --forward 192.168.1.20 1920 9009

The second argument is a screen-X boundary. While the pointer is at or to its right, the program forwards keys, button events, wheel deltas and cursor positions. X is sent relative to the boundary; Y remains the desktop coordinate. The default boundary is the primary display width. A monitor or virtual desktop area to its right must exist for that default to become active.

Local keys/buttons stay active in mirror mode. Add --suppress-local to suppress successfully queued events in the remote region. Pointer movement itself is not suppressed or warped. The old hard-coded 1919/3839 wraparound logic is removed.

Stop with Ctrl+Alt+F12 or Ctrl+C. The forwarding session reserves Ctrl+Alt+F12 as its stop gesture, including in suppression mode. On normal exit, queued key/button releases and a cursor-restore instruction are sent on a best-effort basis. Injected events are ignored to reduce feedback loops.

Protocol

Each packet is seven ASCII integers followed by one NUL:

type x y code key_up cursor wheel
Type Meaning Example
0 Button flag or signed wheel delta 0 0 0 32 0 0 0
1 Virtual key, key_up=0/1 1 0 0 65 1 0 0
2 Screen coordinates 2 100 200 0 0 0 0
3 Cursor: 1 hides, 2 restores 3 0 0 0 0 2 0

The receiver README specifies the full constraints. The former six-field middle-button message now has all seven fields.

Code guide

  • protocol.hpp — named fields and the same validation/serialization contract as the receiver.
  • Input_Surveillance.cpp — scoped hooks; callbacks only enqueue fixed-size instructions.
  • packet_queue.hpp — bounded queue, used solely on the message-loop thread.
  • Cursor_Surveillance.cpp — initialized cursor state and change-driven sampling.
  • Broadcast_UDP.cpp — one owned, nonblocking socket reused throughout the session.
  • main.cpp — message loop, timer, queue draining and explicit modes.

Network sends and string formatting happen outside hook callbacks. The program counts queue overflows, and send errors stop the session. It requests an 8 ms polling timer; Windows scheduling determines the actual interval.

Limits and legacy files

UDP provides no authentication, encryption, ordering or reliable delivery. Missing key-up packets can leave remote keys held; restart/stop the receiver to trigger its cleanup. Use this experiment only in a controlled environment.

The old AES.cpp/AES.h files are retained for historical reference and excluded from the build. They were not used to encrypt the transmitted instructions. The retained Virtual Desktop Screen DDI.rar archive is also outside the build and has not been validated. No driver installation is required by this example.

Generated build outputs and local Visual Studio user settings are excluded from version control.

Validation and license

Strict C++17 compilation, queue/UDP tests, brief hook installation/removal and a sender-to-receiver dry-run are checked locally. Sustained input forwarding and suppression need interactive testing. No standalone license file is currently present.

About

Windows C++17 UDP input forwarding experiment with a documented seven-field protocol, bounded hook queue, explicit modes and loopback tests.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages