itâs been a while since i played with that, but from what i remember the code to get/set the path for loading the .dll file doesnât work right.
once i rewrote it in .net style and it did work.
here is a basic checklist what could make LoadLibrary function fail:
1.1. âAppPathâ found in âHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Games\Freelancer\1.0â doesnât exist.
1.2. âEXEâ directory doesnât exist inside âAppPathâ.
1.3. âcommon.dllâ file doesnât exist inside âEXEâ directory.
2. RegOpenKeyEx function fails.
3. SetExeDirectory function fails.
here is the code snippet that worked for me:
using namespace Microsoft::Win32;
using namespace System::IO;
Common::Common(bool loadres)
{
String^ cwd = Directory::GetCurrentDirectory();
Object^ reg = Registry::GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft Games\\Freelancer\\1.0", "AppPath", nullptr);
if (reg != nullptr) Directory::SetCurrentDirectory(String::Concat(reg->ToString(), "\\EXE"));
...
Directory::SetCurrentDirectory(cwd);
}
so you could either debug and fix the original code or use .net, which i recommend anyway.
hope it helped.