Skip to content

Design how the dll works

ImmGetContext can't get hIMC until it's injected to the target process through dll. So I need a new approach to achieve these target:

  1. Get the conversion status in of a thread created by the target process
  2. backup the conversion status, and ImmSetConversionStatus to ALPHANUMERIC mode, if it goes to VIM_NORMAL mode
  3. recover the conversion status

Thank @PotatoTooLarge(@mzji) from the telegram group, He gives me an implementation approach:

  1. separate the program into an exe and a dll,
  2. when the exe is called, first check if the dll is injected into the target process, if not, inject it.
  3. the dll judges if the target process is exiting, in the DllMain
  4. the exe communicates with the dll through a channel mailslot (a channel is too expensive!)
  5. all the functions should run in a spawned worker thread, which also communicates with the exe
  6. when the target process is exiting, the DllMain entry point should notify the worker thread to exit.
huangjj27 编辑于