Created
February 1, 2014 11:55
-
-
Save arton/8751303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
GPLv3