AtomCrafty / UniversalInjectorFramework

A framework to inject your own code into Windows applications.
46 stars 3 forks source link

Unable to replace charater #6

Closed jyxjyx1234 closed 4 months ago

jyxjyx1234 commented 5 months ago

when I use character_substitution or text_processor, the log both show that it hook sucessfully. image image However, the charater didn't be replaced. (It should be "这" instead of "這") image Here is the exe file, it uses Exhibit Engine. ExHIBIT.zip

AtomCrafty commented 5 months ago

Please post the full config file.

jyxjyx1234 commented 5 months ago

Here is the config file. uif_config.json Additionally,I tried to change my font to repalce the charactor,but the font manager also can't take effect.

AtomCrafty commented 5 months ago

uif_config.json Please try this config and post the console output.

jyxjyx1234 commented 5 months ago

Here is the output.The charater also didn't be replaced this time. [injector] ====================================================== [injector] Injecting into module ExHIBIT.exe at address 00400000 [injector] Loading original library from C:\Windows\system32\winmm.dll [text_processor] Hooking import MultiByteToWideChar in ExHIBIT.exe at 0045C180 --> 5438EB70 [text_processor] Hooking import GetGlyphOutlineA in ExHIBIT.exe at 0045C02C --> 5438F030 [text_processor] Unable to hook import GetGlyphOutlineW because it does not exist [text_processor] Hooking import GetTextExtentExPointA in ExHIBIT.exe at 0045C020 --> 5438F2E0 [text_processor] Unable to hook import GetTextExtentExPointW because it does not exist [text_processor] Hooking import GetTextExtentPoint32A in ExHIBIT.exe at 0045C030 --> 5438F5B0 [text_processor] Unable to hook import GetTextExtentPoint32W because it does not exist [text_processor] Unable to hook import GetTextExtentPointA because it does not exist [text_processor] Unable to hook import GetTextExtentPointW because it does not exist [text_processor] Hooking import TextOutA in ExHIBIT.exe at 0045C024 --> 5438FA70 [text_processor] Unable to hook import TextOutW because it does not exist [text_processor] Hooking import AppendMenuA in ExHIBIT.exe at 0045C500 --> 5438FCD0 [text_processor] Unable to hook import AppendMenuW because it does not exist [text_processor] Unable to hook import InsertMenuA because it does not exist [text_processor] Unable to hook import InsertMenuW because it does not exist [text_processor] Hooking import InsertMenuItemA in ExHIBIT.exe at 0045C418 --> 54390090 [text_processor] Unable to hook import InsertMenuItemW because it does not exist [text_processor] Unable to hook import ModifyMenuA because it does not exist [text_processor] Unable to hook import ModifyMenuW because it does not exist [text_processor] Unable to hook import SetMenuItemInfoA because it does not exist [text_processor] Unable to hook import SetMenuItemInfoW because it does not exist [text_processor] Hooking import SetDlgItemTextA in ExHIBIT.exe at 0045C4CC --> 54390630 [text_processor] Unable to hook import SetDlgItemTextW because it does not exist [text_processor] Hooking import DrawTextA in ExHIBIT.exe at 0045C49C --> 54390770 [text_processor] Unable to hook import DrawTextW because it does not exist [text_processor] Unable to hook import DrawTextExA because it does not exist [text_processor] Unable to hook import DrawTextExW because it does not exist [text_processor] Unable to hook import GrayStringA because it does not exist [text_processor] Unable to hook import GrayStringW because it does not exist [text_processor] Unable to hook import TabbedTextOutA because it does not exist [text_processor] Unable to hook import TabbedTextOutW because it does not exist [text_processor] Hooking import MessageBoxA in ExHIBIT.exe at 0045C4D4 --> 54391810 [text_processor] Unable to hook import MessageBoxW because it does not exist [text_processor] Unable to hook import MessageBoxExA because it does not exist [text_processor] Unable to hook import MessageBoxExW because it does not exist [text_processor] Unable to hook import MessageBoxIndirectA because it does not exist [text_processor] Unable to hook import MessageBoxIndirectW because it does not exist [text_processor] Hooking import DefWindowProcA in ExHIBIT.exe at 0045C518 --> 54391D70 [text_processor] Unable to hook import DefWindowProcW because it does not exist [text_processor] Unable to hook import DefDlgProcA because it does not exist [text_processor] Unable to hook import DefDlgProcW because it does not exist [text_processor] Unable to hook import DefWindowProcW because it does not exist [text_processor] Unable to hook import DefDlgProcA because it does not exist [text_processor] Unable to hook import DefDlgProcW because it does not exist [font_manager] Imported 2 font(s) from WenQuanYi_CNJP.ttf [font_manager] Unable to hook import CreateFontA because it does not exist [font_manager] Unable to hook import CreateFontW because it does not exist [font_manager] Hooking import CreateFontIndirectA in ExHIBIT.exe at 0045C098 --> 54386A80 [font_manager] Unable to hook import CreateFontIndirectW because it does not exist [font_manager] Unable to hook import CreateFontIndirectExA because it does not exist [font_manager] Unable to hook import CreateFontIndirectExW because it does not exist [locale_emulator] Codepage 936 matches expectation [injector] Initialization complete [injector] ====================================================== [text_processor] NCCREATE: 1/1 rules applied, 1 successful [text_processor] 鋼炎のソレイユ-ChaosRegion- [text_processor] 钢炎のソレイユ-ChaosRegion- [text_processor] NCCREATE: 1/1 rules applied, none successful [text_processor] AppendMenuA: 1/1 rules applied, none successful [text_processor] NCCREATE: 1/1 rules applied, none successful [text_processor] MessageBoxA: 1/1 rules applied, 1 successful

AtomCrafty commented 5 months ago

Looking at other ExHIBIT games I have installed, they seem to all include a file called resident.dll, which also imports text drawing functions. Let's see if it works if we inject into that as well.

uif_config.json

jyxjyx1234 commented 4 months ago

image image image image It seems that someting strange happened.

AtomCrafty commented 4 months ago

That appears to be an issue with my implementation of the GetTextExtentExPointA hook. It's a non-trivial fix, so I don't know when I'll get around to it.

jyxjyx1234 commented 4 months ago

Something interesting happened. When I set the text_processer as false,and use a Chinese font in font manager , the program become to use the GBK encoding rather than sjis (I don't know why), so I just need to use GBK encoding in the rld script. and don't need to use the text_processer now. Thank you very much.

Cosetto commented 4 months ago

image Well actually, the font settings of Exhibit are in "resident.dll" not the .exe

AtomCrafty commented 4 months ago

Well actually, the font settings of Exhibit are in "resident.dll" not the .exe

That's why the last config I posted injects into resident.dll

the program become to use the GBK encoding rather than sjis

No idea what's going on there, but I'll assume that solves your problem.