Re: Executable enty points incorrectly documented
- From: jialge@xxxxxxxxxxxxxxxxxxxx ("Jialiang Ge [MSFT]")
- Date: Fri, 16 Jan 2009 09:19:12 GMT
Hello
This is an interesting topic. I basically agree with Jeroen. Here is the
addition of my opinion.
(w)mainCRTStartup, (w)WinMainCRTStartup are the starting addresses from the
C runtime library. They have the same signature of int XXXXX(void). Only
one of them will be compiled:
(The following code is quoted from C:\Program Files\Microsoft Visual Studio
9.0\VC\crt\src\crtexe.c)
#ifdef _WINMAIN_
#ifdef WPRFLAG
int wWinMainCRTStartup(
#else /* WPRFLAG */
int WinMainCRTStartup(
#endif /* WPRFLAG */
#else /* _WINMAIN_ */
#ifdef WPRFLAG
int wmainCRTStartup(
#else /* WPRFLAG */
int mainCRTStartup(
#endif /* WPRFLAG */
The starting function calls to the user-defined entry point (main or
WinMain) based on the app type. WinMain is not a starting function in CRT,
but an user-defined entry point for a Windows application. MSVC runtime
actually passes some Windows arguments to WinMain (see the Windows API
GetStartupInfo. GetStartupInfo is not a part of CRT):
(The following code is quoted from C:\Program Files\Microsoft Visual Studio
9.0\VC\crt\src\crtexe.c)
int wWinMainCRTStartup(
_TUCHAR *lpszCommandLine;
STARTUPINFO StartupInfo;
BOOL inDoubleQuote=FALSE;
......
__try {
/*
Note: MSDN specifically notes that GetStartupInfo
returns no error, and throws unspecified SEH if it fails, so
the very general exception handler below is
appropriate
*/
GetStartupInfo( &StartupInfo );
} __except(EXCEPTION_EXECUTE_HANDLER) {
return 255;
}
......
mainret = WinMain(
#endif /* WPRFLAG */
(HINSTANCE)&__ImageBase,
NULL,
lpszCommandLine,
StartupInfo.dwFlags & STARTF_USESHOWWINDOW
? StartupInfo.wShowWindow
: SW_SHOWDEFAULT
);
......
Therefore, I feel that it is reasonable to place WinMain in Win32
documentation, instead of C/C++ documentation. This is my opinion. Please
feel free to further discuss it with me.
Regards,
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- Follow-Ups:
- Re: Executable enty points incorrectly documented
- From: Kornél Pál
- Re: Executable enty points incorrectly documented
- References:
- Executable enty points incorrectly documented
- From: Kornél Pál
- Re: Executable enty points incorrectly documented
- From: Jeroen Mostert
- Executable enty points incorrectly documented
- Prev by Date: Re: Hardlink
- Next by Date: Re: Process ID lifetime and how to marshal a kernel object handle
- Previous by thread: Re: Executable enty points incorrectly documented
- Next by thread: Re: Executable enty points incorrectly documented
- Index(es):
Relevant Pages
|
Loading