News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

PathIsDirectory returned value

Started by jdoe, January 26, 2006, 04:03:02 AM

Previous topic - Next topic

jdoe

Hi,

Is it a well know behavior that PathIsDirectory API (shlwapi) return 16 (FILE_ATTRIBUTE_DIRECTORY) on a valid folder path ?
On MSDN it says the return is TRUE or FALSE. Maybe it is specific to Windows XP SP2 ?

What about your OS...


zooba

It's not something to be relied upon. By 'TRUE', they mean 'non-zero'. This means they'll guarantee that if it is a directory the return value will always be non-zero. It's entirely possible that the result is the directory attribute since the internal workings may be to return GetFileAttributes() & FILE_ATTRIBUTE_DIRECTORY. However, you shouldn't rely on it, or if you do, you can't blame Microsoft if they break it.

jdoe

Quote from: zooba on January 26, 2006, 05:07:06 AM
It's not something to be relied upon. By 'TRUE', they mean 'non-zero'. This means they'll guarantee that if it is a directory the return value will always be non-zero. It's entirely possible that the result is the directory attribute since the internal workings may be to return GetFileAttributes() & FILE_ATTRIBUTE_DIRECTORY. However, you shouldn't rely on it, or if you do, you can't blame Microsoft if they break it.

I thought TRUE/FALSE was refering to API constants, which make sense. PathIsDirectory is the first case I see that.

I surely won't blame Micro$oft, if it as to be treated as zero/non-zero, let's do so  :)