From f3e968b54cbec408de314b7df968060ee9fff3f0 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Fri, 12 Jul 2019 15:54:26 -0400 Subject: [PATCH] SteamInternal_CreateInterface should return NULL if not called with "SteamClient" --- dll/dll.cpp | 63 ++++++++++++++++++++++++-------------------- dll/steam_client.cpp | 2 -- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/dll/dll.cpp b/dll/dll.cpp index 7e1d45c2..eb35c2fe 100644 --- a/dll/dll.cpp +++ b/dll/dll.cpp @@ -135,38 +135,43 @@ Steam_Client *get_steam_clientserver_old() S_API void * S_CALLTYPE SteamInternal_CreateInterface( const char *ver ) { PRINT_DEBUG("SteamInternal_CreateInterface %s\n", ver); - void *steam_client; - if (strcmp(ver, "SteamClient007") == 0) { - steam_client = (ISteamClient007 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient008") == 0) { - steam_client = (ISteamClient008 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient009") == 0) { - steam_client = (ISteamClient009 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient010") == 0) { - steam_client = (ISteamClient010 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient011") == 0) { - steam_client = (ISteamClient011 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient012") == 0) { - steam_client = (ISteamClient012 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient013") == 0) { - steam_client = (ISteamClient013 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient014") == 0) { - steam_client = (ISteamClient014 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient015") == 0) { - steam_client = (ISteamClient015 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient016") == 0) { - steam_client = (ISteamClient016 *)get_steam_client(); - } else if (strcmp(ver, "SteamClient017") == 0) { - steam_client = (ISteamClient017 *)get_steam_client(); - } else if (strcmp(ver, STEAMCLIENT_INTERFACE_VERSION) == 0) { - steam_client = (ISteamClient *)get_steam_client(); + if (strstr(ver, "SteamClient") == ver) { + void *steam_client; + + if (strcmp(ver, "SteamClient007") == 0) { + steam_client = (ISteamClient007 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient008") == 0) { + steam_client = (ISteamClient008 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient009") == 0) { + steam_client = (ISteamClient009 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient010") == 0) { + steam_client = (ISteamClient010 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient011") == 0) { + steam_client = (ISteamClient011 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient012") == 0) { + steam_client = (ISteamClient012 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient013") == 0) { + steam_client = (ISteamClient013 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient014") == 0) { + steam_client = (ISteamClient014 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient015") == 0) { + steam_client = (ISteamClient015 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient016") == 0) { + steam_client = (ISteamClient016 *)get_steam_client(); + } else if (strcmp(ver, "SteamClient017") == 0) { + steam_client = (ISteamClient017 *)get_steam_client(); + } else if (strcmp(ver, STEAMCLIENT_INTERFACE_VERSION) == 0) { + steam_client = (ISteamClient *)get_steam_client(); + } else { + steam_client = (ISteamClient *)get_steam_client(); + } + + if (steam_client) g_pSteamClientGameServer = (ISteamClient *)steam_client; + return steam_client; } else { - steam_client = (ISteamClient *)get_steam_client(); + return NULL; } - - if (steam_client) g_pSteamClientGameServer = (ISteamClient *)steam_client; - return steam_client; } struct ContextInitData { void (*pFn)(void* pCtx); uintp counter; CSteamAPIContext ctx; }; diff --git a/dll/steam_client.cpp b/dll/steam_client.cpp index 2e5c5ca3..429be66a 100644 --- a/dll/steam_client.cpp +++ b/dll/steam_client.cpp @@ -699,8 +699,6 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe return GetISteamGameServerStats(hSteamUser, hSteamPipe, pchVersion); } else if (strstr(pchVersion, "SteamMatchMakingServers") == pchVersion) { return GetISteamMatchmakingServers(hSteamUser, hSteamPipe, pchVersion); - } else if (strstr(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION") == pchVersion) { - return GetISteamRemoteStorage(hSteamUser, hSteamPipe, pchVersion); } else if (strstr(pchVersion, "SteamFriends") == pchVersion) { return GetISteamFriends(hSteamUser, hSteamPipe, pchVersion); } else if (strstr(pchVersion, "SteamMatchMaking") == pchVersion) {