Skip to content

Commit 1314a4b

Browse files
committed
fix: Pushed code for Nullderef to fix, because me dumb
1 parent 0dcbc4e commit 1314a4b

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

src/signatures.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*******************************************************************
2+
* @file signatures.cpp
3+
* @brief Header to store all gather memory signatures or offsets used by the plugin.
4+
* This is based on SAR's Offsets.hpp, but because P2SM++ is designed to only
5+
* support the latest version of Portal 2, it's only the one file with signatures
6+
* and offsets.
7+
* @author SAR Team, Orsell
8+
* @date 06 2025
9+
*********************************************************************/
10+
11+
#include "stdafx.hpp"
12+
#include "signatures.hpp"
13+
14+
#undef SIGSCAN
15+
#undef OFFSET
16+
17+
#define

src/signatures.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313
#ifndef SIGS_HPP
1414
#define SIGS_HPP
1515

16-
#define OFFSET(name, win, linux) int (name);
16+
#ifndef OFFSET
17+
#define OFFSET(name, win, linux) extern int (name);
18+
#endif
19+
20+
#ifndef SIGSCAN
1721
#define SIGSCAN(name, win, linux) const char* (name);
22+
#endif
1823

1924
namespace Signature
2025
{

src/utils/memory.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ namespace Memory
164164
inline void UnProtect(void* addr, const size_t len)
165165
{
166166
uintptr_t startPage = reinterpret_cast<uintptr_t>(addr) & 0xFFFFF000;
167-
uintptr_t endPage = (reinterpret_cast<uintptr_t>(addr) + len) & 0xFFFFF000;
167+
const uintptr_t endPage = (reinterpret_cast<uintptr_t>(addr) + len) & 0xFFFFF000;
168168
uintptr_t pageLen = endPage - startPage + 0x1000;
169169
#ifdef _WIN32
170-
DWORD wtf_microsoft_why_cant_this_be_null;
171-
VirtualProtect(reinterpret_cast<void*>(startPage), pageLen, PAGE_EXECUTE_READWRITE, &wtf_microsoft_why_cant_this_be_null);
170+
DWORD wtfMicrosoftWhyCantThisBeNull;
171+
VirtualProtect(reinterpret_cast<void*>(startPage), pageLen, PAGE_EXECUTE_READWRITE, &wtfMicrosoftWhyCantThisBeNull);
172172
#else
173173
mprotect((void *)startPage, pageLen, PROT_READ | PROT_WRITE | PROT_EXEC);
174174
#endif

0 commit comments

Comments
 (0)