Permalink
Browse files

reg_layout fix, better chance for layout to work immediately

  • Loading branch information...
1 parent fd59504 commit 3591226eb5ef88121fd1915c1ecf710f81973d31 @grompe committed Jun 12, 2016
Showing with 13 additions and 0 deletions.
  1. +1 −0 install_workman.bat
  2. +12 −0 reg_layout.asm
View
@@ -1,3 +1,4 @@
@echo off
+if not exist reg_layout.exe call make reg_layout.asm
if not exist layouts\workman.dll call make layouts\workman.asm
install layouts\workman.dll 07440409 00d2 "US+W" "Workman US-Custom"
View
@@ -12,6 +12,7 @@ struc pstr [text*]
entry main
STD_OUTPUT_HANDLE = 0FFFFFFF5h
+KLF_ACTIVATE = 1
section ".text" readable executable
@@ -64,6 +65,12 @@ main:
call [InstallLayoutOrTip]
test eax, eax
jz .install_error
+ lea eax, [_layout + 9]
+ push KLF_ACTIVATE
+ push eax
+ call [LoadKeyboardLayoutW]
+ test eax, eax
+ jz .load_error
mov eax, _op_success
call write_pstr
push 0
@@ -75,6 +82,10 @@ main:
mov eax, _usage
call write_pstr
jmp .exit_err
+.load_error:
+ mov eax, _load_error
+ call write_pstr
+ jmp .exit_err
.install_error:
mov eax, _op_error
call write_pstr
@@ -161,6 +172,7 @@ _usage pstr "Register layout:",13,10,\
" reg_layout r 0x0419:0x12340419",13,10,\
"Unregister layout:",13,10,\
" reg_layout u 0x0419:0x12340419",13,10
+_load_error pstr "Error: LoadKeyboardLayoutW function returned an error",13,10
_op_error pstr "Error: InstallLayoutOrTip function returned an error",13,10
_op_success pstr "Operation successful",13,10

0 comments on commit 3591226

Please sign in to comment.