Microsoft KB Archive/290601

{|
 * width="100%"|

INFO: File Change Notifications May Contain Either Short or Long File Names

 * }

Q290601

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * the operating system: Microsoft Windows NT 4.0
 * the operating system: Microsoft Windows 2000

-

SUMMARY
An application must be able to deal with both long and short file names when the application processes file change notifications through the ReadDirectoryChangesW API.

MORE INFORMATION
The method by which a file is accessed determines the name that is reported in the file change notification. For example, if the file is deleted through the DeleteFile API with a long file name specified in the lpFileName parameter, the delete notification will contain the long file name. But if the short file name is used when the file is deleted, the notification will contain the short file name.

The command interpreter that is included with Windows NT and Windows 2000, commonly referred to as the command prompt or Cmd.exe, performs most operations using long file names. However, the del command uses the short file name, if present, to delete a file. Programs should therefore anticipate receiving short file names for some delete operations.

When a delete notification is received, it is not possible to use the Win32 APIs to determine the long file name from the short file name because the file has already been deleted. An application would need to keep a cache of both short and long file names to match them up when the notification is received.

Additional query words:

Keywords : kbAPI kbFileIO kbKernBase kbSDKWin32 kbDSupport kbGrpDSKernBase

Issue type : kbinfo

Technology : kbAudDeveloper kbWin32sSearch kbWin32API