BUG: SHGetFileInfo Fails to Retrieve Attributes with SHGFI_ATTR_SPECIFIED (236376)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- Microsoft Windows NT Server 4.0
- Microsoft Windows NT Workstation 4.0
This article was previously published under Q236376 This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.
No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location from which you downloaded the release. SYMPTOMS
When calling SHGetFileInfo with SHGFI_ATTR_SPECIFIED, the file object's attributes are not retrieved correctly. This occurs only when calling the ANSI version of SHGetFileInfo (SHGetFileInfoA) on Windows NT 4.0 or Windows 2000 beta 3.
CAUSE
On Windows NT 4.0 and Windows 2000, SHGetFileInfoA calls SHGetFileInfoW but fails to copy the dwAttributes of the SHFILEINFOA structure to the SHFILEINFOW structure that is passed to SHGetFileInfoW. The dwAttributes member of the SHFILEINFOW structure remains uninitialized, so the attributes retrieved are not predictable.
RESOLUTION
To avoid this problem, you should call SHGetFileInfoW directly. This resolution works only on Windows NT and Windows 2000. On Windows 95 or Windows 98, SHGetFileInfoW is not implemented, and therefore you need to detect the operating system at run time and call the appropriate function.
An alternative resolution is to use IShellFolder::GetAttributesOf to retrieve the attributes for a file object and not SHGetFileInfo.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 5/14/2004 |
---|
Keywords: | kbBug kbShellGrp KB236376 |
---|
|