I am developing a game using the unity engine.
I am trying to delay hacks into the game by preventing tools like melonLoader to work.
I saw that MelonLoader use proxyGen rust tool to load their proxied version.dll into the game.
I tried to secure the dll loading order following this link by modifying the main.cpp file of the generated Unity project with this one:
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
SetDllDirectory((LPCWSTR)L"");
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
return UnityMain(hInstance, hPrevInstance, lpCmdLine, nShowCmd);
}
According to the Windows documentation, SetDllDirectory() called with an empty string should remove the working directory from the dll search path, so the proxied version.dll installed in the game folder should not be loaded.
But it doesn’t seem to prevent the proxied version.dll to be loaded.
Thanks for your answers.
EDIt: the aim is not to prevent hacking, because knowledgeable people will still be able to edit the exe or remove the protection, it’s just to prevent anybody without coding experience to hack the game, like a lock on your bike.
1