Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit 27c44b8

Browse files
committed
fix origin update installation, hopefully this time for good
1 parent cc4d68e commit 27c44b8

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

src/main/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ void InternalSetup()
5454
auto exe_name = GetExeName();
5555
bool isOriginExe = exe_name == "Origin.exe";
5656
bool isOriginClientServiceExe = exe_name == "OriginClientService.exe";
57+
bool isOriginThinSetupInternalExe = exe_name == "OriginThinSetupInternal.exe";
5758
bool isEALinkExe = exe_name == "EALink.exe";
5859

5960
OriginExe = CModule("Origin.exe", uintptr_t(GetModuleHandleA(nullptr)));
@@ -76,6 +77,13 @@ void InternalSetup()
7677

7778
DoOriginClientServiceExePatches();
7879
}
80+
else if (isOriginThinSetupInternalExe)
81+
{
82+
// statically imported by OriginThinSetupInternal.exe
83+
Qt5Core = CModule("Qt5Core.dll");
84+
85+
DoOriginThinSetupInternalExePatches();
86+
}
7987
else if (isEALinkExe)
8088
{
8189
// statically imported by EALinkExe.exe

src/main/main.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extern CModule Qt5Network;
2121
extern void DoOriginExePatches();
2222
extern void DoOriginClientServiceExePatches();
2323
extern void DoOriginClientDllPatches();
24+
extern void DoOriginThinSetupInternalExePatches();
2425
extern void DoEALinkExePatches();
2526

2627
template<typename T>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Patches for OriginClientService.exe
2+
3+
#include "pch.hpp"
4+
#include "main.hpp"
5+
6+
namespace OriginThinSetupInternalExePatches
7+
{
8+
// Origin::ThinSetup::ThinSetupController::onDownloadUpdateContent
9+
bool(__thiscall* onDownloadUpdateContent_org)(uint32_t**);
10+
bool __fastcall onDownloadUpdateContent_hook(uint32_t** thisptr)
11+
{
12+
static auto QString_destroy = GetExport<void(__thiscall*)(void*)>(Qt5Core, "??1QString@@QAE@XZ");
13+
static auto QString_toStdString = GetExport<void* (__thiscall*)(void*, std::string*)>(Qt5Core, "?toStdString@QString@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ");
14+
static auto QString_QString_from_cchar = GetExport<void* (__thiscall*)(void*, const char*)>(Qt5Core, "??0QString@@QAE@PBD@Z");
15+
16+
if (QString_destroy && QString_toStdString && QString_QString_from_cchar)
17+
{
18+
void* updateURL = thisptr[17] + 17;
19+
20+
std::string qss;
21+
QString_toStdString(updateURL, &qss);
22+
//MessageBoxA(0, qss.c_str(), "updateURL", 0);
23+
24+
if (qss == "https://origin-a.akamaihd.net/Stage-Origin-Client-Download/origin/live/OriginUpdate_10_5_129_55742.zip")
25+
{
26+
QString_destroy(updateURL);
27+
QString_QString_from_cchar(updateURL, "https://origin-a.akamaihd.net/Origin-Client-Download/origin/live/OriginUpdate_10_5_129_55742.zip");
28+
29+
std::string qss;
30+
QString_toStdString(updateURL, &qss);
31+
//MessageBoxA(0, qss.c_str(), "updateURL overriden", 0);
32+
}
33+
}
34+
35+
auto ret = onDownloadUpdateContent_org(thisptr);
36+
return ret;
37+
}
38+
}
39+
40+
void DoOriginThinSetupInternalExePatches()
41+
{
42+
using namespace OriginThinSetupInternalExePatches;
43+
44+
auto OriginExe = CModule("OriginThinSetupInternal.exe", uintptr_t(GetModuleHandleA(nullptr)));
45+
46+
auto onDownloadUpdateContent_adr = CMemory(OriginExe.GetModuleBase()).FindPattern("55 8B EC 6A ? 68 ? ? ? ? 64 A1 ? ? ? ? 50 83 EC ? 56 A1 ? ? ? ? 33 C5 50 8D 45 ? 64 A3 ? ? ? ? 8B F1 8B 4E ? 8D 45 ? 50 E8 ? ? ? ? 68", CMemory::Direction::DOWN, 25 * 1024 * 1024);
47+
if (onDownloadUpdateContent_adr)
48+
{
49+
CreateHook(onDownloadUpdateContent_adr.GetPtr(), onDownloadUpdateContent_hook, reinterpret_cast<LPVOID*>(&onDownloadUpdateContent_org));
50+
}
51+
else
52+
{
53+
MessageBoxA(nullptr, "Failed resolving pattern of Origin::ThinSetup::ThinSetupController::onDownloadUpdateContent, we may fail to fix up Origin update.", ERROR_MSGBOX_CAPTION, MB_ICONERROR);
54+
}
55+
}

0 commit comments

Comments
 (0)