microsoft / winfile

Original Windows File Manager (winfile) with enhancements
MIT License
6.75k stars 698 forks source link

Read-only attribute on files copied from CD-ROM #404

Closed YELLO-belly closed 11 months ago

YELLO-belly commented 11 months ago

Resolved. Code changes available in this commit: https://github.com/YELLO-belly/winfile/commit/b0facdaa9d3016d91ba85b2e57dc4a69eb0a2cf3

I use Winfile mainly as a replacement for Windows Explorer due to the issue that the latter has with optical media. When using Explorer the CD or DVD is being read a lot and it can take several minutes or even lock up optical drive requiring disc eject. I guess Microsoft doesn't do much testing with optical drives these days...

Anyhow Winfile works great and has no issues reading and copying files from CD-ROM or DVD discs. Only issue I have with it is that it retains the read-only file attribute when the files are copied to the hard disk. I guess this is by design but since Windows Explorer does not do this and it is a bit tedious to go through the files manually to remove the read-only attribute I was wondering if a winfile.ini option could be implement to not retain the read-only attribute when files are copied from optical media?

schinagl commented 11 months ago

Winfile uses the Win32 CopyFile() function:

File attributes for the existing file are copied to the new file. For example, if an existing file has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute.

YELLO-belly commented 11 months ago

Yes, I believe the code is in lfn.c. I am probably just going to build a custom build for my personal use that does not retain the read-only attribute for any files copied. Should be good enough for my needs. I am closing this issue.

YELLO-belly commented 11 months ago

Well I re-opened this issue since it is probably better for the project owner to decide if it should be closed or not.

Something like this to remove a read only attribute should do: SetFileAttributes(FileName, GetFileAttributes(FileName) & ~FILE_ATTRIBUTE_READONLY);

And if one wanted more control then an if statement could check if the file was originating from CD-ROM drive or not...

schinagl commented 11 months ago

Usually people close the items themselves if done.