deadlinecode / dll-inject

MIT License
10 stars 5 forks source link

DLL Unicode path issues #3

Open Titanic4 opened 1 year ago

Titanic4 commented 1 year ago

So far, the module works fine if the path doesn't contain any Unicode/UTF8 characters like emojis, country specific characters, etc. If the path does contain such path, due to way the DLL path is acquired from the second parameter of injectPID function, it will attempt to convert the path to the local encoding instead. This leads to the non-existing path to be used instead. I've just noticed this, since the new TruckersMP launcher actually uses this library for DLL injection. The most recent update(as for 20th December 2022) gives a warning in case if there's non-English character detected in the installation path.

For your information: TruckersMP is the multiplayer modification, which adds multiplayer functionality to both Euro Truck Simulator 2 and American Truck Simulator.

Examples:

  1. The requested DLL is located in D:\DLLs\ExampleDLL.dll - result: DLL gets injected without issues.
  2. The requested DLL is located in D:\😂\DLLs\ExampleDLL.dll - result: DLL doesn't get loaded, since the first subdirectory of the root of the D:\ drive has the emoji in its name. During name's conversion the emoji changes into mojibake, causing the path to unexpectedly change before the requested DLL gets injected.

I'm sure that other functions, which are using DLL paths as parameters are affected by the issue.

h110m commented 1 year ago

Yea good to know that this doesnt work xD I am working on a new version of this injector with a couple new features like manuel mapping n stuff Will be adding this to the feature list

If you want i can notify you as soon as it is fixed Otherwise please close for now

3ventic commented 8 months ago

This is fixed in https://github.com/3ventic/dll-inject/tree/2024main (along with module root for electron, which may be specific to our usage, and node-gyp version upgrade) but the conversion to wchar_t should probably be made into a function instead of repeating in both inject funcs.