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.

When you use the VirtualProtect function together with the PAGE_WRITECOPY flag on a Windows Server 2003-based computer, the Protect property of mapped file pages is unexpectedly changed


View products that this article applies to.

Symptoms

Consider the following scenario:
  • On a Windows Server 2003-based computer, you map a file in memory by using the CreateFile function, the CreateFileMapping(PAGE_READWRITE) function, and the MapViewOfFileEx(FILE_MAP_WRITE) function.
  • You use the VirtualProtect(PAGE_WRITECOPY) function on the first mapped file page. After the VirtualProtect function is called, the pages that are returned by the VirtualQuery function have the following properties:
    First page                          Pages following first page
    --------                            ------------------------
    BaseAddress       0x00cf0000        BaseAddress       0x00cf1000
    AllocationBase    0x00cf0000        AllocationBase    0x00cf0000
    AllocationProtect PAGE_READWRITE    AllocationProtect PAGE_READWRITE
    RegionSize        0x00001000        RegionSize        0x00400000
    State             MEM_COMMIT        State             MEM_COMMIT
    Protect           PAGE_WRITECOPY    Protect           PAGE_READWRITE
    Type              MEM_MAPPED        Type              MEM_MAPPED
    
  • You write some bytes of data to the first page. After this change, the pages now have the following properties:
    First page                          Pages following first page
    --------                            ------------------------
    BaseAddress       0x00cf0000        BaseAddress       0x00cf1000
    AllocationBase    0x00cf0000        AllocationBase    0x00cf0000
    AllocationProtect PAGE_READWRITE    AllocationProtect PAGE_READWRITE
    RegionSize        0x00001000        RegionSize        0x00007000
    State             MEM_COMMIT        State             MEM_COMMIT
    Protect           PAGE_READWRITE    Protect           PAGE_WRITECOPY
    Type              MEM_MAPPED        Type              MEM_MAPPED
    
In this scenario, the Protect type of the first page is PAGE_READWRITE, as expected. However, the Protect type of the remaining seven pages is unexpectedly changed to PAGE_WRITECOPY. The Protect type of these pages should remain PAGE_READWRITE.

Note This problem also occurs in Windows XP x64-based versions.

↑ Back to the top


Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must have Windows Server 2003 Service Pack 2 (SP2) installed. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
889100 How to obtain the latest service pack for Windows Server 2003

Restart requirement

You must restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix 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.
Windows Server 2003 with Service Pack 2, x86-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Ntkrnlmp.exe5.2.3790.42802,496,00025-Apr-200810:50Not ApplicableSP2SP2QFE
Ntkrnlpa.exe5.2.3790.42802,307,58425-Apr-200809:45x86SP2SP2QFE
Ntkrpamp.exe5.2.3790.42802,348,54425-Apr-200809:44Not ApplicableSP2SP2QFE
Ntoskrnl.exe5.2.3790.42802,455,55225-Apr-200810:50x86SP2SP2QFE
Windows Server 2003 with Service Pack 2, x64-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Hal.dll5.2.3790.4280280,06425-Apr-200814:27x64SP2SP2QFE
Ntkrnlmp.exe5.2.3790.42804,604,41625-Apr-200814:27x64SP2SP2QFE
Ntoskrnl.exe5.2.3790.42804,534,27225-Apr-200814:27x64SP2SP2QFE
Windows Server 2003 with Service Pack 2, Itanium-based versions
File nameFile versionFile sizeDateTimePlatformSP requirementService branch
Ntdll.dll5.2.3790.42801,636,86425-Apr-200814:25IA-64SP2SP2QFE
Ntkrnlmp.exe5.2.3790.42806,568,96025-Apr-200814:25IA-64SP2SP2QFE
Wntdll.dll5.2.3790.4280766,46425-Apr-200814:25x86SP2WOW

↑ Back to the top


Keywords: KB952177, kbpubtypekc, kbqfe, kbhotfixserver, kbautohotfix

↑ Back to the top

Article Info
Article ID : 952177
Revision : 3
Created on : 6/11/2008
Published on : 6/11/2008
Exists online : False
Views : 310