recently i was learning to make dll for injection and i found this func code:
Code:
unsigned long ReadPointer(unsigned long ulBase, int iOffset)
{
__try { return *(unsigned long*)(*(unsigned long*)ulBase + iOffset); }
__except (EXCEPTION_EXECUTE_HANDLER) { return 0; }
}
for example :
addr = 0x0012345
off = 0x10
readpointer(addr, off) -> let say this read value (DWORD) = 1701277249 and char/string value = egnA
DWORD/unsigned long is 4 byte which mean can contain up to 4 char.
i wanna ask how to get value into char/string which have control size that could contain up to 24 char.
ps : im newbie c++
---------- Post added 2012-07-31 at 04:23 PM ---------- Previous post was 2012-07-25 at 06:57 PM ----------
moderator can close this now..
here some solution i got..
Code:
LPCSTR ReadStringPointer(unsigned long ulBase, int iOffset)
{
__try { return (LPCSTR)(*(unsigned long*)ulBase + iOffset); }
__except (EXCEPTION_EXECUTE_HANDLER) { return "-"; }
}
and this..
Code:
std::string my_string((char*)0xdeadbeef, 24);