BUG: SHGetFileInfo Fails to Retrieve Attributes with SHGFI_ATTR_SPECIFIEDID: Q236376
|
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.
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.
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.
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
Additional query words:
Keywords : kbLib kbNTOS400bug kbSDKPlatform kbSDKWin32 kbShellGrp kbWinOS95bug kbWinOS98bug kbDSupport
Version : winnt:4.0
Platform : winnt
Issue type : kbbug
Last Reviewed: July 7, 1999