mirror of
https://github.com/WPMGPRoSToTeMa/SafeNameAndChat.git
synced 2025-01-26 10:57:54 +03:00
Fixed crashes on the latest ReHLDS (#4)
Fixes #1 by updating the memory pattern for `gMsgBuffer` and `gMsgType` variables.
This commit is contained in:
parent
83fc271222
commit
baf100c59d
6
Main.cpp
6
Main.cpp
@ -355,7 +355,7 @@ void Init() {
|
||||
}
|
||||
|
||||
if (isReHLDS) {
|
||||
uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83 ?? 3A");
|
||||
uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83");
|
||||
g_msgBuffer = decltype(g_msgBuffer)(*(uintptr_t *)(addr + 2) - offsetof(remove_pointer_t<decltype(g_msgBuffer)>, flags));
|
||||
g_msgType = *(int **)(addr + 15);
|
||||
} else {
|
||||
@ -381,7 +381,7 @@ void Init() {
|
||||
if (g_msgBuffer != nullptr) {
|
||||
g_msgType = (decltype(g_msgType))dlsym(handle, "gMsgType");
|
||||
} else {
|
||||
uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83 ?? 3A");
|
||||
uintptr_t addr = FindMemoryByPattern(g_engfuncs.pfnMessageEnd, "F6 05 ?? ?? ?? ?? 02 0F 85 ?? ?? ?? ?? 8B ?? ?? ?? ?? ?? 83");
|
||||
g_msgBuffer = decltype(g_msgBuffer)(*(uintptr_t *)(addr + 2) - offsetof(remove_pointer_t<decltype(g_msgBuffer)>, flags));
|
||||
g_msgType = *(int **)(addr + 15);
|
||||
}
|
||||
@ -1050,4 +1050,4 @@ void PF_MessageEnd_I() {
|
||||
memcpy((void*)g_engfuncs.pfnMessageEnd, g_patchedBytes, 5);
|
||||
mprotect((void*)(addr/PAGESIZE*PAGESIZE), 5 + addr%PAGESIZE, PROT_EXEC | PROT_READ);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user