Microsoft KB Archive/297335

= PRB: Erratic FATFS File System Behavior If Wrong Length Returned For DISK_IOCTL_GETNAME =

Article ID: 297335

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Windows CE 2.12 for the Handheld PC
 * Microsoft Windows CE 2.11 for the Handheld PC
 * Microsoft Windows CE Platform Builder 2.11
 * Microsoft Windows CE Platform Builder 2.12
 * Microsoft Encarta Reference Suite 2001
 * Microsoft Windows CE 3.0 for the Handheld PC

-



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 &quot;access denied&quot;, 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 &quot;Storage&quot;, 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 &quot;18&quot;.



STATUS
This behavior is by design.

Additional query words: ATADISK

Keywords: kbprb KB297335

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.