Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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.

↑ Back to the top


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.

↑ Back to the top


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

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2711419
Revision : 1
Created on : 1/7/2017
Published on : 5/16/2012
Exists online : False
Views : 115