The GetLastError function in the CreateFileMapping function may return an "ERROR_SUCCESS" error message even when there is a named file-mapping object in Windows Embedded CE 6.0 R3


Symptoms


In a Windows Embedded CE 6.0 R3-based device, threads of some processes call the following functions sequentially:
  • CreateFileMapping
  • MapViewOfFile
  • UnmapViewOfFile
  • CloseHandle
When there is already a named file-mapping object, the GetLastError function in the CreateFileMapping function may still return the following error message: 
ERROR_SUCCESS

Note In this situation, you expect that the GetLastError function in the CreateFileMapping function will return the following error message: 
ERROR_ALREADY_EXISTS

Cause


This issue occurs because of a race condition between the MapViewOfFilefunction function and the UnmapViewOfFile function.

When a higher-priority thread starts the MapViewOfFile function before a lower-priority thread finishes the UnmapViewOfFile function, the reference count of the named file-mapping objects is handled incorrectly.

Resolution


Software update information

A supported software update is now available from Microsoft as Windows Embedded CE 6.0 Platform Builder Monthly Update (April 2011). You can confirm this by scrolling to the "File information" sectionThe package file name contains the product version, date, Knowledge Base article number, and processor type. The package file name format is as follows: 
Product version-yymmdd-kbnnnnnn-processor type
For example, Wincepb50-060503-kb917590-armv4i.msi is the ARMV4i Windows CE 5.0 Platform Builder fix that is documented in Microsoft Knowledge Base article 917590 and that is contained in the May 2006 monthly update. To resolve this problem immediately, click the following article number for information about how to obtain Windows CE Platform Builder and core operating system software updates: 
837392 How to locate core operating system fixes for Microsoft Windows CE Platform Builder products
Note This Windows Embedded CE 6.0 Monthly Update is also available for download from the following Microsoft Download Center website:

Prerequisites

This software update is supported only if all previously issued software updates for this product have also been applied.

Prerequisites

This update is supported only if all previously issued updates for this product have also been installed.

Restart requirement

After you apply this update, you must perform a clean build of the whole platform. To do this, use one of the following methods:
  • On the Build menu, click Clean Solution, and then click Build Solution.
  • On the Build menu, click Rebuild Solution.
You do not have to restart the computer after you apply this software update.

Update replacement information

This update does not replace any other updates.

File information

The English version of this software update package has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone
tab in the
Date and Time
item in Control Panel.
Installer files
File nameFile sizeDateTime
Wincepb60-110426-kb2520539-armv4i.msi636,41626-Apr-201118:32
Wincepb60-110426-kb2520539-mipsii.msi626,68826-Apr-201118:32
Wincepb60-110426-kb2520539-mipsii_fp.msi627,20026-Apr-201118:32
Wincepb60-110426-kb2520539-mipsiv.msi627,20026-Apr-201118:32
Wincepb60-110426-kb2520539-mipsiv_fp.msi627,71226-Apr-201118:32
Wincepb60-110426-kb2520539-sh4.msi611,32826-Apr-201118:32
Wincepb60-110426-kb2520539-x86.msi597,50426-Apr-201118:32
Files that are included in this hotfix package
File nameFile sizeDateTimePath
Windows embedded ce 6.0_update_kb2520539.htm7,89326-Apr-201118:08110426_kb2520539
Mapfile.c83,17713-Apr-201115:13Private\Winceos\Coreos\Nk\Mapfile
Nkmapfile.lib345,64613-Apr-201115:12Public\Common\Oak\Lib\Armv4i\Debug
Nkmapfile.lib152,25213-Apr-201115:12Public\Common\Oak\Lib\Armv4i\Retail
Nkmapfile.lib325,86813-Apr-201115:12Public\Common\Oak\Lib\Mipsii\Debug
Nkmapfile.lib145,59213-Apr-201115:12Public\Common\Oak\Lib\Mipsii\Retail
Nkmapfile.lib325,90813-Apr-201115:12Public\Common\Oak\Lib\Mipsii_fp\Debug
Nkmapfile.lib145,61213-Apr-201115:12Public\Common\Oak\Lib\Mipsii_fp\Retail
Nkmapfile.lib326,93613-Apr-201115:12Public\Common\Oak\Lib\Mipsiv\Debug
Nkmapfile.lib147,40013-Apr-201115:12Public\Common\Oak\Lib\Mipsiv\Retail
Nkmapfile.lib326,97613-Apr-201115:13Public\Common\Oak\Lib\Mipsiv_fp\Debug
Nkmapfile.lib147,42013-Apr-201115:13Public\Common\Oak\Lib\Mipsiv_fp\Retail
Nkmapfile.lib261,73213-Apr-201115:13Public\Common\Oak\Lib\Sh4\Debug
Nkmapfile.lib132,11013-Apr-201115:13Public\Common\Oak\Lib\Sh4\Retail
Nkmapfile.lib263,13213-Apr-201115:12Public\Common\Oak\Lib\X86\Debug
Nkmapfile.lib128,80413-Apr-201115:12Public\Common\Oak\Lib\X86\Retail

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information


For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates