EldoS | Feel safer!

Software components for data protection, secure storage and transfer

FileAttributes does not indicate File vs Directory

Posted: 06/30/2009 11:33:47
by Phil Nash (Standard support level)
Joined: 05/18/2009
Posts: 10

From the docs:

"To check, whether it's file or directory that should be opened, check FileAttributes as follows (C++ / C# notation): Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY == FILE_ATTRIBUTE_DIRECTORY;"

However I do not find this to be the case. Whether it is a file or directory being opened or created, the value of FileAttributes is 128. The value of FILE_ATTRIBUTE_DIRECTORY is 0x10. There does not appear to be any correlation between them.

I've seen this with various v2 drivers (including some sent privately), but have not tried a v1 driver.

Is this a known issue?
Posted: 09/03/2009 10:05:35
by Vladimir Cherniga (Team)

This is an error in documentation. FileAttributes parameter is a bitmask of attribute flags to be applied when creating or opening the file. Explicitly specified attributes are applied only when the file is created, superseded, or, in some cases, overwritten. By default, this value is FILE_ATTRIBUTE_NORMAL, which can be overridden by any other flag or by an ORed combination of compatible flags. This member corresponds to the FileAttributes parameter to IoCreateFileSpecifyDeviceObjectHint().
Possible bitmasks for this parameter include the next values:

FILE_ATTRIBUTE_NORMAL - a file with standard attributes should be created.
FILE_ATTRIBUTE_READONLY - a read-only file should be created.
FILE_ATTRIBUTE_HIDDEN - a hidden file should be created.
FILE_ATTRIBUTE_SYSTEM - a system file should be created.
FILE_ATTRIBUTE_ARCHIVE - the file should be marked so that it will be archived.
FILE_ATTRIBUTE_TEMPORARY - a temporary file should be created.

In order to detect file object type you should send a request to the file system, e.g. in the form of GetFileAttrributes() or GetFileAttributesEx() api.



Topic viewed 4926 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!