Re: Executable enty points incorrectly documented



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.




.



Relevant Pages

  • Re: Form Bound to SQL Indexed View
    ... not insert/update any row in Access 2007, though I could insert new rows ... (ID int not null identity(1,1) ... Microsoft Online Community Support ... or a Microsoft Support Engineer within 1 business day is acceptable. ...
    (microsoft.public.access.forms)
  • Re: [patch 2/4] Configure out file locking features
    ... support for advisory locks. ... +config FILE_LOCKING ... +#ifdef CONFIG_FILE_LOCKING ... static int locks_open ...
    (Linux-Kernel)
  • RE: DateTimePicker wrongly displays MinDate when dropdown is pressed.
    ... the underlying Windows MonthCalendar control has been ... SYSTEMTIME t = DateTimeToSysTime(new DateTime(d.Year, d.Month, ... static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, ... Microsoft Managed Newsgroup Support Team ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • RE: DateTimePicker wrongly displays MinDate when dropdown is press
    ... Thank you for this response and explanation. ... SYSTEMTIME t = DateTimeToSysTime(new DateTime(d.Year, d.Month, ... static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, ... Microsoft Managed Newsgroup Support Team ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: "RT_PREEMPT for loongson" is updated to patch-2.6.29.1-rt8
    ... basic RT_PREEMPT support for mips/loongson2f ... extern int i8259A_irq_pending; ... +# Enable WiMAX to see the WiMAX drivers ...
    (Linux-Kernel)

Loading