microsoft / Detours

Detours is a software package for monitoring and instrumenting API calls on Windows. It is distributed in source code form.
MIT License
5.02k stars 981 forks source link

Why Syslog Print Chinese garbled? #171

Open qinguoren opened 3 years ago

qinguoren commented 3 years ago

Instructions

Here, you can ask a question about Detours, and a maintainer or someone from the community will answer. Please read the examples below, then delete all of this text and replace it with your question. If you aren't sure whether a question is on-topic, just go ahead and ask it! :-)

Please make sure to check the Wiki, esspecially the FAQ, to make sure your question hasn't been answered there already: https://github.com/microsoft/Detours/wiki/FAQ

On-Topic Examples

Off-Topic Examples

qinguoren commented 3 years ago

Thank U!

bgianfo commented 3 years ago

Please fill out the template, you haven't provided any information to help us answer your question.

qinguoren commented 3 years ago

such as: 1 260 50.60: trcapi32: 001 -GetModuleFileNameA(,C:\Users\Administrator\Desktop\股票软件\股票自动交易助手3.0.5.2\StockOrder.exe,) -> 4e This is Right. but 0 260 50.60: trcapi32: 001 -GetModuleFileNameW(,C:\Users\Administrator\Desktop\o鯸戗?㎏3.0.5.2\StockOrder.exe,) -> 42 This is wrong The Chinese printed by the API with "W" at the back is garbled. "o鯸戗?㎏“ is garbled.

bgianfo commented 3 years ago

It sounds like a bug in wide string handling in VSafePrintf: https://github.com/microsoft/Detours/blob/d8b8144c54836918322d666559fccc13995c5f06/samples/syelog/syelog.cpp#L280

bgianfo commented 3 years ago

A patch would be appreciated if you can figure out what's going on. Reproing this will be difficult for me 😊

qinguoren commented 3 years ago

Thank U! but My C++ language is not good, I can have a try.