summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-03-09 22:18:11 +0100
committermanuel <manuel@mausz.at>2013-03-09 22:18:11 +0100
commitd6adb8507ed0637686b92eeecd2ef0013d112a56 (patch)
tree29864c51d4a6e26eb25511e650925996d9a45633 /main.cpp
parent3b61fd8e1f381a813484ba25b7ef04c79d9ea7bf (diff)
downloadsteamcmd-d6adb8507ed0637686b92eeecd2ef0013d112a56.tar.gz
steamcmd-d6adb8507ed0637686b92eeecd2ef0013d112a56.tar.bz2
steamcmd-d6adb8507ed0637686b92eeecd2ef0013d112a56.zip
prevent crash if signature required for anonymous logon isn't found
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/main.cpp b/main.cpp
index 656d4ca..45662dd 100644
--- a/main.cpp
+++ b/main.cpp
@@ -579,15 +579,21 @@ bool CApplication::InitSteam()
579 579
580#ifdef _WIN32 580#ifdef _WIN32
581 void* pppUsePICS = steamclientScanner.FindSignature("\x00\x00\x00\x00\x83\x78\x34\x00\x75\x00\xc6\x81\x74\x0c\x00\x00\x00\x5d\xc2\x04\x00", "????xxxxx?xxxxxxxxxxx"); 581 void* pppUsePICS = steamclientScanner.FindSignature("\x00\x00\x00\x00\x83\x78\x34\x00\x75\x00\xc6\x81\x74\x0c\x00\x00\x00\x5d\xc2\x04\x00", "????xxxxx?xxxxxxxxxxx");
582 g_pUsePICS = **(void***)pppUsePICS; 582 if(pppUsePICS)
583 g_pUsePICS = **(void***)pppUsePICS;
583#else 584#else
584 unsigned char* pSig = (unsigned char*)steamclientScanner.FindSignature("\x55\x89\xE5\xE8\x00\x00\x00\x00\x81\xC1\x00\x00\x00\x00\x8B\x45\x08\x80\x7D\x0C\x00", "xxxx????xx????xxxxxxx"); 585 unsigned char* pSig = (unsigned char*)steamclientScanner.FindSignature("\x55\x89\xE5\xE8\x00\x00\x00\x00\x81\xC1\x00\x00\x00\x00\x8B\x45\x08\x80\x7D\x0C\x00", "xxxx????xx????xxxxxxx");
585 int uOffset = *(int*)(pSig + 10); 586 if(pSig)
586 int uOffset2 = *(int*)(pSig + 34); 587 {
588 int uOffset = *(int*)(pSig + 10);
589 int uOffset2 = *(int*)(pSig + 34);
587 590
588 void* ppUsePICS = pSig + 8 + uOffset + uOffset2; 591 void* ppUsePICS = pSig + 8 + uOffset + uOffset2;
589 g_pUsePICS = *(void**)ppUsePICS; 592 g_pUsePICS = *(void**)ppUsePICS;
593 }
590#endif 594#endif
595 if(!g_pUsePICS)
596 Msg("Unable to find function signature required for anonymous logon. Anonymous logon is disabled\n");
591 597
592 const char* cszDir = commandLine.ParmValue("-dir"); 598 const char* cszDir = commandLine.ParmValue("-dir");
593 if(cszDir) 599 if(cszDir)
@@ -867,6 +873,11 @@ bool CApplication::LogOn()
867 const char* cszUsername = commandLine.ParmValue("-username"); 873 const char* cszUsername = commandLine.ParmValue("-username");
868 if(!cszUsername) 874 if(!cszUsername)
869 { 875 {
876 if (!g_pUsePICS)
877 {
878 Error("Anonymous logon is disabled\n");
879 return false;
880 }
870#ifdef _WIN32 881#ifdef _WIN32
871 void (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (void (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[12]; 882 void (__thiscall* pSetValue)(void* pThis, const char* cszValue) = (void (__thiscall *)(void *,const char *)) (*(void***)g_pUsePICS)[12];
872#else 883#else