I have used GetFileAttributes to recieve the attributes of a certain file, but how can I detect if readonly (1h) is set to true?


/Delight
Posted on 2001-08-31 06:56:48 by Delight
All u have to do is
OR return_value, FILE_ATTRIBUTE_READONLY

here is a proc that checks a file attrib of a file:


Invoke GetFileAttributes, ADDR FileName
Mov FileAttrib, Eax

Or Eax, FILE_ATTRIBUTE_READONLY
.If Eax == FileAttrib
Invoke MessageBox, 0, ADDR ReadOnlyAttrIsSet, ADDR cap, 0

.EndIf

Mov Eax, FileAttrib
Or Eax, FILE_ATTRIBUTE_HIDDEN
.If Eax == FileAttrib
Invoke MessageBox, 0, ADDR HiddenAttrIsSet, ADDR cap, 0

.EndIf

Mov Eax, FileAttrib
Or Eax, FILE_ATTRIBUTE_SYSTEM
.If Eax == FileAttrib
Invoke MessageBox, 0, ADDR SystemAttrIsSet, ADDR cap, 0

.EndIf

Mov Eax, FileAttrib
Or Eax, FILE_ATTRIBUTE_ARCHIVE
.If Eax == FileAttrib
Invoke MessageBox, 0, ADDR ArchivedAttrIsSet, ADDR cap, 0

.EndIf

Hope it will help:alright:
Posted on 2001-08-31 09:26:52 by NEMO
Or more simple:


Invoke GetFileAttributes, ADDR FileName
.IF (eax & FILE_ATTRIBUTE_READONLY)
; file is read only
.ENDIF


Thomas
Posted on 2001-08-31 10:08:43 by Thomas