Answer the question
In order to leave comments, you need to log in
How to pass a pointer to a function if it takes a reference?
hello i have a function
template <typename type>
static void readMemory(uintptr_t offset, unsigned int length, type var) {
ReadProcessMemory(targetHandle, (LPVOID)offset, &var, length * sizeof(type), 0);
}
uintptr_t adr; readMemory<uintptr_t&>(0x183422, 1, adr);
wchar_t* str = new wchar_t[length]; readMemory<wchar_t*>(0x124322, length, str);
Answer the question
In order to leave comments, you need to log in
No way. Make your function accept a pointer:
template <typename type>
static void readMemory(uintptr_t offset, unsigned int length, type* var) {
ReadProcessMemory(targetHandle, (LPVOID)offset, var, length * sizeof(type), 0);
}
uint8_t arr[100500];
readMemory<uint8_t>(0x00, 10, arr);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question