CreateFile Improperly Returns ERROR_ALREADY_EXISTS if the Drive Is Locked and the File Did Not Exist


The CreateFile API improperly returns ERROR_ALREADY_EXISTS even though the file does not exist if the volume the file is on is currently locked. Programs such as ScanDisk, Disk Defragmenter, and many anti-virus utilities often keep a lock on the volume while they are running. While these types of programs are running with the volume locked, other programs that make calls to CreateFile and check for this condition may malfunction.


While the volume a file resides on is locked, Installable File System manager loses the return status while it processes the CreateFile request.


A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual 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 Version Size File name Operating system
June 19, 2001 4.90.3003 185,910 Ifsmgr.vxd Windows Millennium
Edition (Me)

NOTE: If you have several thousand 0kb OEM*.inf files, delete those files first. If after deleting these files, the issue still exists, then apply for this hotfix. Use the following steps to delete any files found:

  1. Click on Start, Search, then For Files or Folders.
  2. Under Search for Files or Folder, type in OEM*.INF
  3. Next click on Search Options. Put a check mark next to Size. Change at least to at most and then change the 0 to a 1.
  4. Under Look in, ensure Local Hard drive(s) are listed. Click on search.
  5. Minimize the search window. Double click My Computer and then double click the C drive. Right click on the Window background, choose New, and then Folder. Assign a name to the folder. Once created, double click on the folder to open it up. Minimize this folder.
  6. Maximize the other folder that was created on the C drive. Click on Edit, and then Paste.
  7. Once this is done, reboot the computer with a startup disk. If you do not have one, click Start, Settings, and then Control Panel. Double click Add/Remove Programs. Click on the Startup Disk tab and then Create Disk. Leave the disk in the drive and reboot the computer. Start the computer without CD-ROM support.
  8. At the A prompt, type in C: , press ENTER. At the C prompt, type DIR and ENTER to view files. Ensure that the folder is present.
  9. Do a deltree "folder name". This will remove the files. Depending on how many files there are and the speed of the computer, this could expend from several minutes to several hours.


If the logic of the program dictates that different actions should be taken if the file already exists on the computer, the program can be written to call CreateFile with OPEN_EXISTING first. If this returns INVALID_HANDLE_VALUE, the file did not exist.


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

More Information

For additional information about Windows Me hotfixes, click the article number below to view the article in the Microsoft Knowledge Base:

295413 General Information About Windows Millennium Edition Hotfixes