Monday, April 12, 2010

Error in MSDN documentation for ssfPROGRAMFILESx86

There is a documentation error here: (or even header error)

http://msdn.microsoft.com/en-us/library/bb774096(VS.85).aspx

When using ssfPROGRAMFILESx86 with the value of 0x30, it gives the administrative tools path, while with a value of 0x2A gives Program Files X86.

Can be tested with the following vbscript:

Const PROGRAM_FILES_XEIGHTYSIX = &H2A&
Const PROGRAM_FILES_XEIGHTYSIXWRONG = &H30&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(PROGRAM_FILES_XEIGHTYSIXWRONG)
Set objFolderItem = objFolder.Self
msgbox ("Wrong Path: 0x30 :"+objFolderItem.Path)  
Set objFolder = objShell.Namespace(PROGRAM_FILES_XEIGHTYSIX)
Set objFolderItem = objFolder.Self
msgbox ("Correct Path: 0x2A : "+objFolderItem.Path)

To get the correct path, just use 0x2a instead of 0x30.