NO

Author Topic: Entry point usage  (Read 4206 times)

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Entry point usage
« on: October 16, 2011, 03:47:31 PM »
Reading the information of the MSDN articles /ENTRY (Entry-Point Symbol) and UMENTRYABS results in the following table of entry points.

Environment| Default Entry Point| Absolute Entry Point
EXE native| | NtProcessStartup
EXE console| main| mainCRTStartup
EXE GUI| WinMain| WinMainCRTStartup
DLL| DllMain| _DllMainCRTStartup

Why would one use the absolute entry points, except for a native application where only the absolute one exists.

What is the advantage of using the absolute entry point, since Timo seems to use them quite frequently, or is this just a personal preference?

Thanks in advance.
---
Stefan

Proud member of the UltraDefrag Development Team

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Entry point usage
« Reply #1 on: October 16, 2011, 04:58:44 PM »
Maybe bad habit  ;)
Just leaving out unnessary code (RTL/CRT) from executable when not needed, mostly when testing something.
Sometimes if i disassemble code with podump /DISASM to make shorter list to output window.
May the source be with you

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: Entry point usage
« Reply #2 on: October 16, 2011, 07:39:20 PM »
For testing to reduce the size of the executable it makes sense.

Thanks for your insight ;)
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

  • Guest
Re: Entry point usage
« Reply #3 on: October 16, 2011, 11:38:21 PM »
Reading the information of the MSDN articles /ENTRY (Entry-Point Symbol) and UMENTRYABS results in the following table of entry points.

Environment| Default Entry Point| Absolute Entry Point
EXE native| | NtProcessStartup
EXE console| main| mainCRTStartup
EXE GUI| WinMain| WinMainCRTStartup
DLL| DllMain| _DllMainCRTStartup

Why would one use the absolute entry points, except for a native application where only the absolute one exists.

What is the advantage of using the absolute entry point, since Timo seems to use them quite frequently, or is this just a personal preference?

Thanks in advance.

The application is always entered at the absolute entry point, Stefan.  Most programming languages do some startup stuff (memory manager, command line parsing, etc,) before calling their user entry point functions.   This startup code ends up in the executable.

For example:
Pelles C help file... Contents -> Appendix -> Program startup (two entries)... interesting stuff.
« Last Edit: October 16, 2011, 11:51:16 PM by CommonTater »