📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  noob, _fastcall, LPARAM, what am I doing?

Topic created on: March 24, 2011 12:58 CDT by headedtomexico .

I'm fairly new to this RCE stuff, and relatively new to C++. I probably should have started with a simple project, but diving in seemed like a good idea.

My issue is: I'm detouring a function to investigate it. I know it has something to do with resizing the processes window and viewport. If I detour it, and don't call the trampoline, then resize my processes window the graphics get all distorted and stretched out. My ultimate goal is to SetWindowPos, then call a process function to reconfigure the viewport and graphics to prevent the distortion. I think this is the function that does it.

I've got a working detour setup, but my issue is calling the trampoline from my own function.

IDA prototypes this function as, and I don't have the assembly in front of me, but it looks like this:

int _fastcall sub_701120(LPARAM lParam);

in IDA when I double click lParam it shoots me over to 0x00B112AC. There is see a large data structure.

When I run the following code:

int __fastcall Trampoline(LPARAM);
int __fastcall Detour(LPARAM lParam)
{
    Outf("%08x",lParam);
    return Trampoline(lParam);
}

DETOUR_TRAMPOLINE_EMPTY(int __fastcall Trampoline(LPARAM));

#define MyFunction                                     0x701120

void enter()
{
    QuickDetour(MyFunction,Detour,Trampoline);
}

void exit();
{
    RemoveDetour(MyFunction);
}


My chat output is not the "00B112AC" that I expected, I get something like "0041102B". When going through the fastcall function I see several "call [ecx + 4Ch]" instructions, which makes me want to think 00B112AC is a prototyped class with pointers to the member functions.

is "0041102B" a pointer of the type "00B112A"? If so... how do I fire off 701120 on my own?

I'm picturing something like


#define pInstance 0x0041102B
LPARAM mylParam;
mylParam = (LPARAM)pInstance;
Trampoline(mylParam);


Am I barking up the right tree?

Sorry for the length/spelling, I wish I could say english isn't my native tongue, and sorry if i've violated some kind of standard etiquete of this forum that I was unnaware of.

  headedtomexico   March 24, 2011 17:48.36 CDT
Got it working:

#define pInstance 0x00B112AC
LPARAM mylParam;
mylParam = *(DWORD*)pInstance;
Trampoline(mylParam);


The 00B112AC was misread as being a large structure, it was a DWORD. I ran my sample code that spit out the 0041102B, then I laoded cheatengine, peeked in on address 00B112AC and it was set to, surprise, 0041102B. At that location in IDA was a table of pointers to class member functions.

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit