Applications using the ATL CAutoStackPtr class may crash

Symptoms

Consider the following scenario:
  • You use Visual Studio 2005 and a custom SDK exported using Platform Builder for Windows Embedded CE 6.0 to develop an application.
  • The application uses the ATL CAutoStackPtr class either directly or indirectly.
In this scenario when the application is executed on a Windows Embedded CE 6.0 debug image a DEBUGCHK occurs. On a Windows Embedded CE 6.0 release image a 'User Stack Overflow' exception occurs and an "Application Error", "Application <name> encountered a serious error and must shut down." error message box gets displayed on the screen of the target device.

Cause

The reason for this problem is an incompatibility between malloc.h included in the exported SDK and altcecrt.h included with Visual Studio 2005.

Resolution

To solve this problem update altcecrt.h in the Visual Studio 2005 VC\ce\include subfolder (%ProgramFiles%\Microsoft Visual Studio 8\VC\ce\include) as described below:Before:
#ifndef _malloca
#define _malloca malloc
#endif
#ifndef _freea
#define _freea free
#endif

After:
#ifndef _malloca
#define _malloca malloc
#define _freea free
#endif
內容

文章識別碼:2711419 - 最後檢閱時間:2012年5月16日 - 修訂: 1

意見反應