fixed crash when starting up

This commit is contained in:
Anonymous275
2020-12-27 23:19:24 +02:00
parent eaa8796c02
commit 775e44a68f
3 changed files with 11 additions and 7 deletions

View File

@@ -107,7 +107,7 @@ std::string QueryKey(HKEY hKey,int ID){
DWORD lpData = cbMaxValueData; DWORD lpData = cbMaxValueData;
buffer[0] = '\0'; buffer[0] = '\0';
LONG dwRes = RegQueryValueEx(hKey, achValue, nullptr, nullptr, buffer, &lpData); LONG dwRes = RegQueryValueEx(hKey, achValue, nullptr, nullptr, buffer, &lpData);
std::string data = reinterpret_cast<const char *const>(buffer); std::string data = (char *)(buffer);
std::string key = achValue; std::string key = achValue;
switch (ID){ switch (ID){
case 1: if(key == "SteamExe"){ case 1: if(key == "SteamExe"){
@@ -130,8 +130,8 @@ namespace fs = std::filesystem;
void FileList(std::vector<std::string>&a,const std::string& Path){ void FileList(std::vector<std::string>&a,const std::string& Path){
for (const auto &entry : fs::directory_iterator(Path)) { for (const auto &entry : fs::directory_iterator(Path)) {
if (!entry.is_directory()) { if (!entry.is_directory()) {
a.emplace_back(entry.path().string()); a.emplace_back(entry.path().u8string());
}else FileList(a,entry.path().string()); }else FileList(a,entry.path().u8string());
} }
} }
bool Find(const std::string& FName,const std::string& Path){ bool Find(const std::string& FName,const std::string& Path){
@@ -248,6 +248,7 @@ void LegitimacyCheck(){
if(dwRegOPenKey == ERROR_SUCCESS) { if(dwRegOPenKey == ERROR_SUCCESS) {
Result = QueryKey(hKey, 1); Result = QueryKey(hKey, 1);
if(Result.empty())Exit(1); if(Result.empty())Exit(1);
if(fs::exists(Result)){ if(fs::exists(Result)){
if(!Find("284160.json", Result))Exit(2); if(!Find("284160.json", Result))Exit(2);
if(FindHack(Result))SteamExit(1); if(FindHack(Result))SteamExit(1);

View File

@@ -118,9 +118,7 @@ void CheckForUpdates(int argc,char*args[],const std::string& CV){
} }
} }
URelaunch(argc,args); URelaunch(argc,args);
}else{ }else info("Version is up to date");
info("Version is up to date");
}
TraceBack++; TraceBack++;
} }
void CheckDir(int argc,char*args[]){ void CheckDir(int argc,char*args[]){

View File

@@ -9,6 +9,7 @@
#include "Security/Init.h" #include "Security/Init.h"
#include "Startup.h" #include "Startup.h"
#include <iostream> #include <iostream>
#include "Logger.h"
#include <thread> #include <thread>
@@ -26,7 +27,11 @@ int main(int argc, char* argv[]) {
#endif #endif
InitLauncher(argc,argv); InitLauncher(argc,argv);
//CheckDir(argc,argv); //CheckDir(argc,argv);
LegitimacyCheck(); try {
LegitimacyCheck();
}catch (std::exception&e){
fatal(e.what());
}
PreGame(GetGameDir()); PreGame(GetGameDir());
InitGame(GetGameDir()); InitGame(GetGameDir());
CoreNetwork(); CoreNetwork();