#DEFINE FILE_ATTRIBUTE_READONLY 0x01 #DEFINE FILE_ATTRIBUTE_HIDDEN 0x02 #DEFINE FILE_ATTRIBUTE_SYSTEM 0x04 #DEFINE FILE_ATTRIBUTE_DIRECTORY 0x10 #DEFINE FILE_ATTRIBUTE_ARCHIVE 0x20 #DEFINE FILE_ATTRIBUTE_NORMAL 0x80 #DEFINE FILE_ATTRIBUTE_TEMPORARY 0x0100 declare Integer GetFileAttributes in win32api string @ declare Integer SetFileAttributes in win32api string @, Integer *-------------------------------------------------------------------------- function FileResetReadOnly(FileName) local fa fa = GetFileAttributes(@FileName) if( fa == -1 ) return FALSE endif if( empty(bitand(fa, FILE_ATTRIBUTE_READONLY)) ) && file was not readonly return FALSE endif fa = bitand(fa, bitnot(FILE_ATTRIBUTE_READONLY)) if( empty(SetFileAttributes(@FileName, fa)) ) return FALSE endif endfunc *-------------------------------------------------------------------------- function FileSetReadOnly(FileName) local fa fa = GetFileAttributes(@FileName) if( fa == -1 ) return FALSE endif fa = bitor(fa, FILE_ATTRIBUTE_READONLY) if( empty(SetFileAttributes(@FileName, fa)) ) return FALSE endif endfunc *--------------------------------------------------------------------------