Spelunking - Which API Functions Are Used?

Our main goal is to analyze Getright and see by ourselves what functions the program is using. We don't want to harm the program, we are just curious.


Note: It's not illegal to perform this analysis. On the contrary, it's perfectly legal and Microsoft itself has published tools equivalent to Hackman Debugger in order to help debugging.
IN: C:\Program Files\GetRight\getright.exe opened.

And the party starts. Explore the information menu that is now enabled. We can see (depending on your settings, you may need to manually dump the file from Dump menu):

PE Header Sections

If you click on PE Header, then on File Header and on Number of sections you'll see (you have to click on each section):

Section Name Description
.text Here's located the executable code of the file.
.rdata Here are all the initialized data (debug information, description strings, OLE info, etc)
.data Also initialized data (variables)
.idata The most useful! It contains the Import Address Table of the program!
.rsrc Contains all the program resources (icons, menus, labels, AVIs, etc)

We know beforehand that all of these may seem nonsense. But you have to know how windows really work. If you use this function in your program:

int main()
{
GetVersion();
}
The GetVersion function belongs to Kernel32.DLL. However if you compile this program, you'll see that you program is not pointing directly to Kernel32.DLL. When it sees this instruction, it points to the equivalent address within the .idata section. So the .idata section contains all the real addresses of the functions used by your program.

Imported Modules:

Here's a list given by Hackman Debugger of the modules that GetRight imports:

But that's not enough; KERNEL32.DLL contains too many functions. To see what functions are imported, then you have to use the Imported Modules dialog box (in Hackman Debugger, Information|Imported modules). Here's an example of what functions are imported for COMDLG32.DLL:

Where A stands for ASCII and W for Unicode. Now, don't tell us you can't guess what the above do! That's how GetRight is using common dialog boxes!

Common questions & some answers:

Yes, but sometimes Hackman Debugger says <no name> instead of the name of the imported functions.
Yes, but i don't get any imported modules but msvbvmxx.dll.

Return