Skip to content

Instantly share code, notes, and snippets.

@arton arton/kbchg.rb
Created Feb 1, 2014

Embed
What would you like to do?
# coding: cp932
require 'win32/registry'
VAL_NAMES = %w|
LayerDriver\ JPN
OverrideKeyboardIdentifier
OverrideKeyboardSubtype
OverrideKeyboardType
|
VAL_TYPES = [
Win32::Registry::REG_SZ, Win32::Registry::REG_SZ,
Win32::Registry::REG_DWORD, Win32::Registry::REG_DWORD
]
VAL_102 = %w|kbd101.dll PCAT_101KEY 0 7|
VAL_106 = %w|kbd106.dll PCAT_106KEY 2 7|
if ARGV.length != 1 || !%w|us jp|.include?(ARGV[0])
$stderr.puts 'usage: ruby kbchg.rb [us|jp]'
else
values = (ARGV[0] == 'jp') ? VAL_106 : VAL_102
Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\CurrentControlSet\Services\i8042prt\Parameters', Win32::Registry::KEY_ALL_ACCESS) do |reg|
VAL_NAMES.zip(VAL_TYPES, values).each do |key, type, val|
reg.write key, type, val
end
end
end
@arton

This comment has been minimized.

Copy link
Owner Author

commented Feb 1, 2014

GPLv3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.