# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
arton commentedFeb 1, 2014
GPLv3