Well, i have two functions
void RealFunction()
{
MessageBox(NULL, "RealFunction()", "Trace", MB_OK);
}
void FakeFunction()
{
MessageBox(NULL, "FakeFunction()", "Trace", MB_OK);
}
and when i try to do that i get access violation error
void main()
{
DWORD target = (DWORD)RealFunction;
DWORD trampoline = (DWORD)Trampoline;
cout << target + " - " + trampoline << endl;
}
I don't know why it is even throwing access violation while i am trying to cout a DWORD ?
DWORD target = (DWORD)RealFunction;
DWORD trampoline = (DWORD)Trampoline;
cout << target + " - " + trampoline << endl;
You must've meant <<
instead of +
.
You have a const char *
, the string literal containing a dash. To that, you're adding two, likely fairly large numbers, with the result being some absurd memory address, which is interpreted as a string pointer. Undefined behavior.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.