Skip to content

Instantly share code, notes, and snippets.

@jackson5sec
Created June 21, 2024 18:17
Show Gist options
  • Save jackson5sec/4f983ca5261e0a21cf4b4df8a9d21493 to your computer and use it in GitHub Desktop.
Save jackson5sec/4f983ca5261e0a21cf4b4df8a9d21493 to your computer and use it in GitHub Desktop.
annoying mouse swap
# Define the parameter
param (
[string]$side = "L"
)
# Create an external definition
$swapbuttons = @'
[DllImport("user32.dll")]
public static extern Int32 SwapMouseButton(Int32 swap);
'@
# Add class
$swapper = Add-Type -MemberDefinition $swapbuttons -Name "swap" -Namespace "user" -PassThru
$setting = if ($side -eq "L") {0} else {1}
$result = $swapper::SwapMouseButton($setting)
@jackson5sec
Copy link
Author

RUNDLL32.EXE user32.dll,SwapMouseButton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment