Skip to content

Commit

Permalink
Small bugs fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rat43 committed Jan 9, 2020
1 parent 4aeec8d commit 8fc551b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 48 deletions.
5 changes: 3 additions & 2 deletions src/ColdAPI_Steam/CSteamCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,14 @@ namespace SteamCallback
cst->m_cubParam = cresC.Size;
cst->m_hAsyncCall = cresC.Call;
cst->m_iCallback = cresC.Type;
Thread.unlock();
return true;
}
CBM->m_iCallback = 703;
CBM->m_cubParam = cresC.Size;
CBM->m_hSteamUser = 1;
CBM->m_pubParam = (unsigned char*)Buffer;

Thread.unlock();
return true;
}
}
}
Expand Down
43 changes: 5 additions & 38 deletions src/ColdAPI_Steam/ColdManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2575,20 +2575,17 @@ namespace ColdAPI_General
Steam_Config::AppBuildId = GetPrivateProfileIntA("SteamData", "AppBuildId", NULL, SteamINI);
Steam_Config::OnlineMod = GetPrivateProfileIntA("SteamData", "OnlineMode", NULL, SteamINI) != FALSE;
Steam_Config::LoadOverLay = GetPrivateProfileIntA("SteamData", "OverLay", NULL, SteamINI) != FALSE;
Steam_Config::UnlockAllDLCS = GetPrivateProfileIntA("SteamData", "UnlockAllDLCs", TRUE, SteamINI) != FALSE;
Steam_Config::UnlockAllDLCS = GetPrivateProfileIntA("SteamData", "UnlockAllDLCs", true, SteamINI) != FALSE;
Steam_Config::LowViolence = GetPrivateProfileIntA("SteamProfile", "LowViolence", NULL, SteamINI) != FALSE;
Steam_Config::RemoteStorage = GetPrivateProfileIntA("SteamData", "SteamFileSave", TRUE, SteamINI) != FALSE;
Steam_Config::RemoteStorage = GetPrivateProfileIntA("SteamData", "SteamFileSave", true, SteamINI) != FALSE;
Steam_Config::StubBypass = GetPrivateProfileIntA("SteamAdditional", "PatchSteamStub", NULL, SteamINI) != FALSE;
Steam_Config::ClientEmulation = GetPrivateProfileIntA("SteamAdditional", "ClientEmulation", NULL, SteamINI) != FALSE;
Steam_Config::HookForInjection = GetPrivateProfileIntA("SteamClient", "HookInjectionMode", NULL, SteamINI) != FALSE;
Steam_Config::InterfaceNFound = GetPrivateProfileIntA("SteamAdditional", "WarnInterfaceNFound", NULL, SteamINI) != FALSE;

if (!GetPrivateProfileStringA("SteamProfile", "Username", "ColdAPI", Steam_Config::Username, sizeof(Steam_Config::Username), SteamINI))
return false;
if (!GetPrivateProfileStringA("SteamProfile", "Language", "english", Steam_Config::Language, sizeof(Steam_Config::Language), SteamINI))
return false;
if (!GetPrivateProfileStringA("SteamData", "SavePath", "Auto", Steam_Config::SaveDirectory, sizeof(Steam_Config::SaveDirectory), SteamINI))
return false;
GetPrivateProfileStringA("SteamProfile", "Username", "ColdAPI", Steam_Config::Username, sizeof(Steam_Config::Username), SteamINI);
GetPrivateProfileStringA("SteamProfile", "Language", "english", Steam_Config::Language, sizeof(Steam_Config::Language), SteamINI);
GetPrivateProfileStringA("SteamData", "SavePath", "Auto", Steam_Config::SaveDirectory, sizeof(Steam_Config::SaveDirectory), SteamINI);

// DLC attempt:
if (!Steam_Config::UnlockAllDLCS)
Expand Down Expand Up @@ -2784,13 +2781,6 @@ namespace ColdAPI_InitAndShutDown
MessageBoxA(NULL, "Please set an AppID and try again.", "ColdAPI", MB_ICONERROR);
ExitProcess(NULL);
}

// Declare some variables to be used for Steam registry.
DWORD UserIdentification = Steam_Config::UserID & 0xffffffff;
DWORD ProcessID = GetCurrentProcessId();

// Steam registry attempt.
HKEY Registrykey;

// Check if we're not emulating steamclient as Registry is mainly used to get the steamclient directory to load it and for process checks.
if (!Steam_Config::ClientEmulation)
Expand All @@ -2808,29 +2798,6 @@ namespace ColdAPI_InitAndShutDown
std::string OverLay32 = ColdAPI_General::FormatTheString("%s\\gameoverlayrenderer.dll", ColdAPI_General::ColdAPI_GetSteamInstallPath(),
NULL);

if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam\\ActiveProcess", 0, KEY_ALL_ACCESS, &Registrykey) == ERROR_SUCCESS)
{
// Set values to Windows registry.
RegSetValueExA(Registrykey, "ActiveUser", NULL, REG_DWORD, (LPBYTE)& UserIdentification, sizeof(DWORD));
RegSetValueExA(Registrykey, "pid", NULL, REG_DWORD, (LPBYTE)& ProcessID, sizeof(DWORD));
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)Clientpath32.c_str(), (DWORD)Clientpath32.length() + 1);
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Clientpath64.c_str(), (DWORD)Clientpath64.length() + 1);
RegSetValueExA(Registrykey, "Universe", NULL, REG_SZ, (LPBYTE)"Public", (DWORD)std::strlen("Public") + 1);

// Close the HKEY Handle.
RegCloseKey(Registrykey);
}
DWORD Disposition;
if (RegCreateKeyExA(HKEY_CURRENT_USER, ColdAPI_General::FormatTheString("Software\\Valve\\Steam\\Apps\\%i", EMPTY, Steam_Config::AppId), 0, NULL, 0, KEY_ALL_ACCESS, NULL, &Registrykey, &Disposition) == ERROR_SUCCESS)
{
// Mark the game running to the Windows registry.
DWORD Running = TRUE;

RegSetValueExA(Registrykey, "Installed", NULL, REG_DWORD, (LPBYTE)& Running, sizeof(DWORD));
RegSetValueExA(Registrykey, "Running", NULL, REG_DWORD, (LPBYTE)& Running, sizeof(DWORD));
RegCloseKey(Registrykey);
}

// Check if we should load the overlay
if (Steam_Config::LoadOverLay)
{
Expand Down
1 change: 1 addition & 0 deletions src/ColdAPI_Steam/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
lstrcpyA(FileoNe, myfile);
lstrcatA(FileoNe, "ColdAPI.ini");
if (GetFileAttributesA(FileoNe) == INVALID_FILE_ATTRIBUTES) {
ZeroMemory(FileoNe, sizeof(FileoNe));
lstrcpyA(FileoNe, myfile);
lstrcatA(FileoNe, STEAMAPPID);
if (GetFileAttributesA(FileoNe) == INVALID_FILE_ATTRIBUTES) {
Expand Down
16 changes: 8 additions & 8 deletions src/ColdClientLoader/ColdClientLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(ClientPath) + 1);
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(Client64Path) + 1);
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
}
else
Expand All @@ -245,13 +245,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(ClientPath) + 1);
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(Client64Path) + 1);
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
}

Expand Down Expand Up @@ -292,13 +292,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(ClientPath) + 1);
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(Client64Path) + 1);
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
}
else
Expand All @@ -315,13 +315,13 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)ClientPath, (DWORD)lstrlenA(ClientPath) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(ClientPath) + 1);
RegSetValueExA(Registrykey, "SteamClientDll", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
if (GetFileAttributesA(Client64Path) != INVALID_FILE_ATTRIBUTES) {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)Client64Path, (DWORD)lstrlenA(Client64Path) + 1);
}
else {
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(Client64Path) + 1);
RegSetValueExA(Registrykey, "SteamClientDll64", NULL, REG_SZ, (LPBYTE)"", (DWORD)lstrlenA(""));
}
}
RegSetValueExA(Registrykey, "Universe", NULL, REG_SZ, (LPBYTE)"Public", (DWORD)lstrlenA("Public") + 1);
Expand Down

0 comments on commit 8fc551b

Please sign in to comment.