Skip to content

Commit ca43458

Browse files
committed
Try full path for steam_api64_o.dll loading
1 parent 4d14fa3 commit ca43458

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

include/api/api_client.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,20 @@ S_API ESteamAPIInitResult S_CALLTYPE SteamInternal_SteamAPI_Init(const char* psz
101101
SetAppIDEnv();
102102
WriteAppIDFile();
103103

104-
HMODULE hRealSteam = LoadLibraryExA("steam_api64_o.dll", nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
104+
// Check if already loaded, or try with full path
105+
HMODULE hRealSteam = GetModuleHandleA("steam_api64_o.dll");
105106
FILE* _rt = nullptr;
106107
fopen_s(&_rt, "C:\\Users\\cools\\Desktop\\uc_online2_real.txt", "ab");
107-
if (_rt) { fprintf(_rt, "LoadLibrary(steam_api64_o.dll) -> 0x%p (err=%lu)\n", (void*)hRealSteam, GetLastError()); fclose(_rt); }
108+
if (!hRealSteam) {
109+
char oPath[MAX_PATH] = {0};
110+
GetModuleFileNameA(GetModuleHandleA("steam_api64.dll"), oPath, MAX_PATH);
111+
PathRemoveFileSpecA(oPath);
112+
strcat_s(oPath, MAX_PATH, "\\steam_api64_o.dll");
113+
hRealSteam = LoadLibraryA(oPath);
114+
if (_rt) { fprintf(_rt, "LoadLibrary(\"%s\") -> 0x%p (err=%lu)\n", oPath, (void*)hRealSteam, GetLastError()); fclose(_rt); }
115+
} else {
116+
if (_rt) { fprintf(_rt, "GetModuleHandle -> 0x%p (already loaded)\n", (void*)hRealSteam); fclose(_rt); }
117+
}
108118
if (hRealSteam)
109119
{
110120
UCOLOG("[UCOnline2] Loaded real Steam API DLL: steam_api64_o.dll");

0 commit comments

Comments
 (0)