Skip to content

Instantly share code, notes, and snippets.

@arton
Created February 1, 2014 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arton/8751303 to your computer and use it in GitHub Desktop.
Save arton/8751303 to your computer and use it in GitHub Desktop.
# 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
Copy link
Author

arton commented Feb 1, 2014

GPLv3

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