File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -377,9 +377,24 @@ bool CSteamClient::Load()
377377 return false ;
378378 }
379379
380+ static auto pAddDllDirectory = ([]() -> decltype (&AddDllDirectory) {
381+ if (const HMODULE kernel32 = GetModuleHandleW (L" kernel32.dll" ); kernel32 != nullptr )
382+ {
383+ return reinterpret_cast <decltype (&AddDllDirectory)>(static_cast <void *>(GetProcAddress (kernel32, " AddDllDirectory" )));
384+ }
385+
386+ return nullptr ;
387+ })();
388+
389+ if (pAddDllDirectory == nullptr )
390+ {
391+ WriteErrorEvent (" Your operating system is outdated and is missing the KB2533623 update package for AddDllDirectory" );
392+ return false ;
393+ }
394+
380395 WriteDebugEvent (SString (" Using steamclient.dll: %s" , *ToUTF8 (steamClientPath.value ())));
381396 SetEnvironmentVariableW (L" SteamAppId" , L" " STEAM_GTASA_APP_ID);
382- AddDllDirectory (steamDirPath.c_str ());
397+ pAddDllDirectory (steamDirPath.c_str ());
383398 {
384399 static wchar_t pathBuffer[65536 ];
385400 GetEnvironmentVariableW (L" PATH" , pathBuffer, sizeof (pathBuffer) / sizeof (wchar_t ));
@@ -425,7 +440,7 @@ bool CSteamClient::Load()
425440
426441 releaseLibraryLock.reset ();
427442
428- Native::CreateInterface = reinterpret_cast <decltype (Native::CreateInterface)>(GetProcAddress (dll, " CreateInterface" ));
443+ Native::CreateInterface = reinterpret_cast <decltype (Native::CreateInterface)>(static_cast < void *>( GetProcAddress (dll, " CreateInterface" ) ));
429444
430445 if (!Native::CreateInterface)
431446 {
You can’t perform that action at this time.
0 commit comments