An application does not read or access a file correctly in Windows Server 2008 R2, Windows Server 2008, Windows 7, or Windows Vista

Symptoms

An application or driver silently skips reading some regions of a file. This issue may cause various other problems to occur, such as any of the following:
  • An antivirus product may not detect an infected file.
  • An application may report a problem that affects a file. This issue most likely would occur when another application, such as an on-demand scanner, is enumerating and scanning large collections of files at the same time. For example, the application may report that the file format is bad or corrupted.
  • An application or driver may not access the file correctly.

Cause

This problem occurs because of a bug in Windows file systems. The bug causes the file to become cached if an I/O on a non-cached handle does not pass byte range lock checks. When this problem occurs, the current file pointer may be changed even though the I/O fails and returns an ERROR_LOCK_VIOLATION error. Therefore, the next I/O occurs at an unexpected offset. This causes silent skips and the other problems that are mentioned in the "Symptoms" section.

More Information

An application that encounters this problem will have a noncached file handle’s file pointer repositioned randomly. When the file pointer is not repositioned to a multiple of the sector size, a later read operation may succeed, but a write operation will fail and return an ERROR_INVALID_FUNCTION error. In some cases, the file pointer can be repositioned to a multiple of the sector size. In such a case, a later read or write operation will succeed at the unexpected offset. When an application opens a noncached handle, the file system usually uncaches the file. However, if the application is one of a class of applications that independently enumerates and reads whole directory trees or volumes, and reads files by using cached or mapped file I/O, the files become cached. This can occur, for example, if the application is an on-demand antivirus scanner.

Workaround

To work around this problem, use the SetFilePointerEx function to query the current file offset before it issues noncached I/O. If the I/O fails and returns an ERROR_LOCK_VIOLATION error, restore the current file offset to make sure that the current file offset is not changed.

Resolution

Note This problem affects most file systems that are used by Microsoft Windows. However, this hotfix applies only to the NTFS file system. This hotfix does not correct this problem for the FAT12, FAT16, FAT32, or exFAT file systems.

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 the problem described in this article. 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, go to the following Microsoft website:
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 be running one of the following operating systems:
  • Windows Server 2008 R2 Service Pack 1 (SP1)
  • Windows Server 2008 R2
  • Windows Server 2008 Service Pack 2 (SP2)
  • Windows 7 Service Pack 1 (SP1)
  • Windows 7
  • Windows Server 2008
  • Windows Vista Service Pack 2 (SP2)
For more information about how to obtain a Windows 7 or a Windows Server 2008 R2 service pack, click the following article number to view the article in the Microsoft Knowledge Base:
976932 Information about Service Pack 1 for Windows 7 and for Windows Server 2008 R2
For more information about how to obtain a Windows Server 2008 service pack, click the following article number to view the article in the Microsoft Knowledge Base:
968849 How to obtain the latest service pack for Windows Server 2008
For more information about how to obtain a Windows Vista service pack, click the following article number to view the article in the Microsoft Knowledge Base:
935791 How to obtain the latest Windows Vista service pack

Registry information

To apply this hotfix, you do not have to make any changes to the registry.

Restart requirement

You must restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.
File information

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
Additional file information
Properties

Article ID: 2698155 - Last Review: Jun 11, 2013 - Revision: 1

Windows Server 2008 Enterprise, Windows Server 2008 Enterprise without Hyper-V, Windows Server 2008 Datacenter, Windows Server 2008 Datacenter without Hyper-V, Windows Server 2008 for Itanium-Based Systems, Windows Server 2008 Foundation, Windows Server 2008 Standard, Windows Server 2008 Standard without Hyper-V, Windows Web Server 2008, Windows Vista Enterprise, Windows Vista Enterprise 64-bit Edition, Windows Vista Business, Windows Vista Business 64-bit Edition, Windows Vista Home Basic, Windows Vista Home Basic 64-bit Edition, Windows Vista Home Premium, Windows Vista Home Premium 64-bit Edition, Windows Vista Ultimate, Windows Vista Ultimate 64-bit Edition, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 Datacenter, Windows Server 2008 R2 for Itanium-Based Systems, Windows Server 2008 R2 Foundation, Windows Server 2008 R2 Standard, Windows Web Server 2008 R2, Windows 7 Enterprise, Windows 7 Home Basic, Windows 7 Home Premium, Windows 7 Professional, Windows 7 Starter, Windows 7 Ultimate

Feedback