PRB: Erratic FATFS File System Behavior If Wrong Length Returned For DISK_IOCTL_GETNAME (297335)



The information in this article applies to:

  • Microsoft Windows CE Operating System, Versions 2.12
  • Microsoft Windows CE Operating System, Versions 2.11
  • Microsoft Windows CE Platform Builder 2.11
  • Microsoft Windows CE Platform Builder 2.12
  • Microsoft Windows CE Platform Builder 3.0
  • Microsoft Windows CE Operating System, Versions 3.0

This article was previously published under Q297335

SYMPTOMS

When you are using a block driver, such as a modified version of the ATADISK driver that is provided in Platform Builder 3.0, you may experience erratic file system behavior if the block driver improperly implements DISK_IOCTL_GETNAME to set a custom folder name for the mounted file system.

Symptoms of this problem include: unexpected behavior when creating or deleting folder, access violations (exceptions), file permission problems, and improper attributes reported for folders created on the device handled by the block driver.

Also, Windows Explorer windows may not refresh automatically. New folders may not appear in the Explorer window until a manual refresh of the window is initiated. Deleted folders may give errors indicating "access denied", and may not be removed from the Explorer window until a manual refresh of the window is initiated.

CAUSE

When a block driver is returning a custom name in response to DISK_IOCTL_GETNAME to be used as the folder name for the block device, the length returned does not properly account for the correct number of trailing bytes on the end of the string.

RESOLUTION

The value returned for the length of the name to be returned for DISK_IOCTL_GETNAME must account for four trailing bytes in addition to the number of bytes used by the characters in the Unicode string returned. Two bytes must be added to the length in addition to the two bytes added to account for the double NULL string terminator.

Example:

To set the name "Storage", the buffer pointed to by lpOutBuffer should be filled with the bytes
53 00 74 00 6F 00 72 00 61 00 67 00 65 00 00 00 00 00
				
and lpBytesReturned should be set to "18".

STATUS

This behavior is by design.

Modification Type:MinorLast Reviewed:8/18/2005
Keywords:kbprb KB297335