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.