News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

EXE Entry Point

Started by buck12, December 27, 2013, 12:45:04 PM

Previous topic - Next topic

buck12

Newbie here so bare with me.
I am using MASM32 and looking at the example files to get going.
I compiled the exe and ran it. Work like it is supposed to.
Now, I am looking at the assembly code to see the guts of the program.
I can see the functions, the calls to the functions, some kernel calls etc.

So here is my question and yes I have done some googling with no results.
Where is the application point stored?
I notice that the first thing in the application is the "press any key..." function in the hello example.
How does the application know where to start executing?
In the code its where it says start but the hex data is not organized as such.

Any references are also welcome.
:t

dedndave

at the end of the source, you will see an END directive
for executable application source files, the END directive should also have the entry point label
the label can be any public code symbol - i usually use a PROC around my Main code
Main    PROC

    INVOKE  ExitProcess,0

Main    ENDP

        END     Main


Start:

    INVOKE  ExitProcess,0

        END     Start


you can also do it in the linker command line, i think - but, why ? - lol

buck12

dadndave, I am looking at the hex data in the executable for this information.
I guess I was not clear, when windows goes to execute the program, where does it find the entry point?

dedndave

ohhh - in the PE header

Tedd posted a nice recent version of the pe/coff v 8.3 spec

http://masm32.com/board/index.php?topic=240.msg26288#msg26288

TWell

PEView is a nice tool to examine exe-file, look here
IMAGE_NT_HEADERS -> IMAGE_OPTIONAL_HEADER -> Address of Entry Point

Vortex

Tutorial 4: Optional Header :

http://win32assembly.programminghorizon.com/pe-tut4.html

buck12

This is great information, thanks guys!
:t

Gunther

Hi Erol,

Quote from: Vortex on December 28, 2013, 06:17:03 AM
Tutorial 4: Optional Header :

http://win32assembly.programminghorizon.com/pe-tut4.html

thank you for the link. You're a devil of a fellow.  :t

Gunther
You have to know the facts before you can distort them.