This commit is contained in:
Sarah
2025-03-12 16:19:34 -04:00
parent e911292a55
commit c37879d890
2 changed files with 35 additions and 29 deletions
+4 -4
View File
@@ -77,7 +77,7 @@ namespace Starfall {
void FindPushWidget()
{
constexpr static auto patch = pf_construct_patch_sig("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 30 48 8B E9 49 8B D9 48 8D 0D ? ? ? ? 49 8B F8 48 8B F2 E8 ? ? ? ? 4C 8B CF 48 89 5C 24 ? 4C 8B C6 48 8B D5 48 8B 48 78", PushWidgetCallback);
/*constexpr static auto patch = pf_construct_patch_sig("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 30 48 8B E9 49 8B D9 48 8D 0D ? ? ? ? 49 8B F8 48 8B F2 E8 ? ? ? ? 4C 8B CF 48 89 5C 24 ? 4C 8B C6 48 8B D5 48 8B 48 78", PushWidgetCallback);
constexpr static auto patch2 = pf_construct_patch_sig("48 8B C4 4C 89 40 18 48 89 50 10 48 89 48 08 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 B8 48 81 EC ? ? ? ? 65 48 8B 04 25", PushWidgetCallback); // 26.00
constexpr static auto patch3 = pf_construct_patch_sig("48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 65 48 8B 04 25 ? ? ? ? 48 8B F9 B9 ? ? ? ?", PushWidgetCallback); // 28.00/30.00
@@ -89,10 +89,10 @@ namespace Starfall {
constexpr static struct pf_patchset_t patchset = pf_construct_patchset(patches, sizeof(patches) / sizeof(struct pf_patch_t));
pf_patchset_emit(tbuf, tsize, patchset);
/*AsmHook((void*)(uint64_t(buf) + 0x221a404), Hooks::RequestExitWithStatusHook);
pf_patchset_emit(tbuf, tsize, patchset);*/
AsmHook((void*)(uint64_t(buf) + 0x221a404), Hooks::RequestExitWithStatusHook);
AsmHook((void*)(uint64_t(buf) + 0x221a438), Hooks::RequestExitWithStatusHook);
AsmHook((void*)(uint64_t(buf) + 0x48830b0), Hooks::UnsafeEnvironmentPopupHook);*/
AsmHook((void*)(uint64_t(buf) + 0x48830b0), Hooks::UnsafeEnvironmentPopupHook);
}
}
}
+31 -25
View File
@@ -135,41 +135,47 @@ def:
};
__forceinline void* checkStream(void *stream) {
__forceinline void* checkStream(void *stream, bool bEOS) {
for (int i = 0; i < 2048; i++) {
if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i, true)) {
Log(Display, "Found with 4C 8B DC\n");
goto setStream;
}
else if (CheckBytes<0x48, 0x8B, 0xC4>(stream, i, true)) {
Log(Display, "Found with 48 8B C4\n");
setStream:
return (uint8_t*)stream - i;
}
else if (CheckBytes<0x48, 0x81, 0xEC>(stream, i, true) || CheckBytes<0x48, 0x83, 0xEC>(stream, i, true)) {
for (int x = 0; x < 50; x++) {
if (CheckBytes<0x40>(stream, i + x, true)) {
Log(Display, "Found with 40\n");
return (uint8_t*)stream - i - x;
}
else if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i + x, true) || CheckBytes<0x48, 0x8B, 0xC4>(stream, i + x, true) || CheckBytes<0x48, 0x89, 0x5C>(stream, i + x, true))
break;
if (bEOS)
{
if (CheckBytes<0x48, 0x89, 0x5C>(stream, i, true)) {
Log(Display, "Found with 49 89 5C, offset: %llx\n", __int64(stream) - i - __int64(buf));
goto setStream;
}
}
else if (CheckBytes<0x48, 0x89, 0x5C>(stream, i, true)) {
Log(Display, "Found with 49 89 5C\n");
goto setStream;
else
{
if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i, true)) {
Log(Display, "Found with 4C 8B DC, offset: %llx\n", __int64(stream) - i - __int64(buf));
goto setStream;
}
else if (CheckBytes<0x48, 0x8B, 0xC4>(stream, i, true)) {
Log(Display, "Found with 48 8B C4, offset: %llx\n", __int64(stream) - i - __int64(buf));
setStream:
return (uint8_t*)stream - i;
}
else if (CheckBytes<0x48, 0x81, 0xEC>(stream, i, true) || CheckBytes<0x48, 0x83, 0xEC>(stream, i, true)) {
for (int x = 0; x < 50; x++) {
if (CheckBytes<0x40>(stream, i + x, true)) {
Log(Display, "Found with 40, offset: %llx\n", __int64(stream) - i - x - __int64(buf));
return (uint8_t*)stream - i - x;
}
else if (CheckBytes<0x4C, 0x8B, 0xDC>(stream, i + x, true) || CheckBytes<0x48, 0x8B, 0xC4>(stream, i + x, true) || CheckBytes<0x48, 0x89, 0x5C>(stream, i + x, true))
break;
}
}
}
}
return nullptr;
}
bool InternalCallback(void* stream, void* rbuf, size_t rsize, bool (*callback)(pf_patch_t*, void*)) {
bool InternalCallback(void* stream, void* rbuf, size_t rsize, bool (*callback)(pf_patch_t*, void*), bool bEOS) {
void* saddr = (void*)((__int64(stream) + 7) + *(int32_t*)(__int64(stream) + 3));
void* newStream = nullptr;
if (__int64(saddr) >= __int64(rbuf) && __int64(saddr) < (__int64(rbuf) + (int64_t)rsize))
if (wcscmp((wchar_t*)saddr, L"STAT_FCurlHttpRequest_ProcessRequest") == 0 || wcscmp((wchar_t*)saddr, L"%p: request (easy handle:%p) has been added to threaded queue for processing") == 0)
if (newStream = checkStream(stream)) goto Out;
if (newStream = checkStream(stream, bEOS)) goto Out;
return false;
Out:
char* ptrMatches = (char*)&newStream;
@@ -185,11 +191,11 @@ def:
return true;
}
bool StringCallback(struct pf_patch_t* patch, void* stream) {
return InternalCallback(stream, rbuf, rsize, PtrCallback);
return InternalCallback(stream, rbuf, rsize, PtrCallback, false);
}
bool EOSStringCallback(struct pf_patch_t* patch, void* stream) {
return InternalCallback(stream, EOSRDataBuf, EOSRDataSize, EOSPtrCallback);
return InternalCallback(stream, EOSRDataBuf, EOSRDataSize, EOSPtrCallback, true);
}
}