LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.38k stars 473 forks source link

Fixed an issue where we'd randomly fail to load the original DLL. #645

Closed WarrenHood closed 4 months ago

WarrenHood commented 4 months ago

Hi!

LoadLibraryA expects a null-terminated string. I noticed this issue with proxygen and realised it might also be a problem here. This PR simply pushes a null byte to the end of the path passed to LoadLibraryA. Additionally, I thought it'd be a good idea to also use INFO_BUFFER_SIZE (32767) as the buffer size when getting the current DLL path.

Testing I was able to reproduce it happening once in quite a few launches, and afterwards I was able to launch a few times without it happening. Should be fine.

Fixes #632

RinLovesYou commented 4 months ago

Two things, Pull requests need to be based on, and sent to the alpha-development branch. Secondly, this issue is already fixed on there.

Regardless, thank you for taking the time to do this!