Microsoft KB Archive/272136

{|
 * width="100%"|

CreateFileMapping and MapViewOfFile May Fail with ERROR_INVALID_HANDLE

 * }

Q272136

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * the operating system: Microsoft Windows 95
 * the operating system: Microsoft Windows 98
 * the operating system: Microsoft Windows 98 Second Edition
 * the operating system: Microsoft Windows Millennium Edition

-

SYMPTOMS
If an application opens a single handle to a file and creates multiple mappings of the file and then closes all of the mappings, additional calls to CreateFileMapping and MapViewOfFile may fail with error code 6 (ERROR_INVALID_HANDLE). This error is inconsistent. It does not always occur.

CAUSE
The Installable File System Manager (IFSMgr) makes the assumption that a file handle will only be duplicated once for a memory-mapped file. The system violates this assumption when it duplicates a file handle multiple times for use with multiple memory-mapped views of a single open file. IFSMgr's extended handle closing logic works correctly for the original file handle and one duplicated handle, but it sometimes breaks when there is more than one memory-mapped view.

RESOLUTION
To work around this problem in Windows 95 and Windows 98, an application should use a separate open file handle for each file mapping it creates.

Fix Available for Windows Millennium Edition
A supported fix is now available from Microsoft, but it is only intended to correct the problem described in this article and should be applied only to systems experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information on support costs, please go to the following address on the World Wide Web:

http://support.microsoft.com/directory/overview.asp

NOTE: In special cases, charges that are normally incurred for support calls may be canceled, if a Microsoft Support Professional determines that a specific update will resolve your problem. Normal support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix should have the following file attributes or later:

  Date      Time    Version      Size    File name - 08/31/2000 3:55p   4.90.3001    185,910 IFSMGR.vxd

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words:

Keywords : kbAPI kbFileIO kbKernBase kbMemory kbSDKWin32 kbDSupport kbGrpDSKernBase

Issue type : kbbug

Technology : kbAudDeveloper kbWin32sSearch kbWin32API