Reg. win32_find_data dwFileAttributes value
-
hi all, i am actually trying to load a readonly file into my application. i am using CFileStatus's Getstatus method to find out the value of dwFileAttributes value. i am getting the value as 33.. my doubt is, do we get this value as 33 for all readonly files?? but in msdn, its been given as 1 for readonly file.. thanks, rakesh.
-
hi all, i am actually trying to load a readonly file into my application. i am using CFileStatus's Getstatus method to find out the value of dwFileAttributes value. i am getting the value as 33.. my doubt is, do we get this value as 33 for all readonly files?? but in msdn, its been given as 1 for readonly file.. thanks, rakesh.
The status is a flag value, what means every bit that is set has his own meaning. In your case 33 equals 0x21 (hex) equals 100001b (binary), what means the first and the sixth bits are set. Now if you look at th attributes: enum Attribute { normal = 0x00, readOnly = 0x01, hidden = 0x02, system = 0x04, volume = 0x08, directory = 0x10, archive = 0x20 }; You will see the 33 (0x21) means it is a readOnly and an archived file (0x01 + 0x20 == 0x21).
Greetings Covean
-
hi all, i am actually trying to load a readonly file into my application. i am using CFileStatus's Getstatus method to find out the value of dwFileAttributes value. i am getting the value as 33.. my doubt is, do we get this value as 33 for all readonly files?? but in msdn, its been given as 1 for readonly file.. thanks, rakesh.
Rakesh5 wrote:
my doubt is, do we get this value as 33 for all readonly files??
Nope, according to ducomentation
33
means 'archive' AND 'read-only'. You should test the least significative bit of them_attribute
byte, in order to get the read-only property, for instancebool isReadOnly = (status.m_attribute & CFileStatus::Attribute.readOnly) == CFileStatus::Attribute.readOnly;
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]