Setting/overriding DOS File attributes

Questions about Wine on Linux
Post Reply
Atrax
Newbie
Newbie
Posts: 3
Joined: Thu Dec 06, 2018 2:20 am

Setting/overriding DOS File attributes

Post by Atrax » Thu Dec 06, 2018 4:16 am

Hi there. I'm new to Wine and to this forum so please excuse me if I make some brain-dead mistakes.

I have some very old Windows software I'm trying to run under Wine on Ubuntu, and the problem is that it requires a certain file to have specific file attributes.

The file in question is on a FAT32 formatted USB drive. It needs to have "Read-only", "System" and "Hidden" attributes set and the "Archive" attribute must NOT be set. On my Windows system, I can verify that this file has the correct attributes, both under Windows Explorer and by running "attrib" under a DOS box.

However, when I run the software under Wine it tells me the file has the wrong attributes. I ran cmd.exe under Wine and executed the DOS command "attrib" and it tells me the file is "Read-only" and "Archive". I tried to change the file attributes by using the attrib command, but this didn't change anything.

Now I can understand why this may be the case; The Unix file system doesn't have any concept of an "Archive" bit and the closest it comes to "System" and "Hidden" attributes is by using a dot prefix. So it seems to me that what I need is a way to either have Wine access the file attributes on the FAT32 volume directly (which presumably means bypassing the Linux file system) or at least to have some way of manually setting the attributes of a file within Wine. However, I have been unable to find any reference to this in the documentation or Wiki, so I assume that neither of these solutions has been implemented.

Am I missing something? Is there a known solution to this issue? Even an ugly kludge would be acceptable.

spoon0042
Level 4
Level 4
Posts: 176
Joined: Thu Dec 24, 2009 11:00 am

Re: Setting/overriding DOS File attributes

Post by spoon0042 » Thu Dec 06, 2018 10:25 pm

There is a staging patch implementing attributes. Unfortunately it doesn't appear to let you unset the archive attribute. Unless I'm missing something ntdll sets that no matter what (for regular files) and would require another hack / patch to work.

https://github.com/wine-staging/wine-st ... Attributes

Atrax
Newbie
Newbie
Posts: 3
Joined: Thu Dec 06, 2018 2:20 am

Re: Setting/overriding DOS File attributes

Post by Atrax » Thu Dec 06, 2018 10:50 pm

Thank you very much. It's really helpful to know that there wasn't something obvious that I was missing and that this is a known problem that's had at least had some work done on it.

I'll have a look at the patch and see if I can work out what it's doing. Now that I know where to look, I might be able to patch ntdll myself to deal with the Archive attribute.

spoon0042
Level 4
Level 4
Posts: 176
Joined: Thu Dec 24, 2009 11:00 am

Re: Setting/overriding DOS File attributes

Post by spoon0042 » Sat Dec 08, 2018 11:10 pm

If you haven't yet you should probably try a staging build to see if it works and isn't just attrib being screwy... and since I did some more poking around and only confused myself further. ;)

It looks like the attrib in wine cmd only sets one flag at a time, and you have to set +r last (which may be how it worked on dos as well). So +s then +h then -a then +r. When I do that, the saved attrs under linux look right but attrib in cmd still says A is set.

If that works, then great. If not then you'd probably want to file an issue. I think. Or there may be an issue either way.

Atrax
Newbie
Newbie
Posts: 3
Joined: Thu Dec 06, 2018 2:20 am

Re: Setting/overriding DOS File attributes

Post by Atrax » Tue Dec 11, 2018 5:29 pm

Sorry for not letting you know how things were going, but unfortunately (paid) work has got in the way and I haven't been able to do any more testing. I haven't yet installed a staging build, but that's my next priority and I'll let you know what happens.

I do appreciate the help you're giving me; it's not often that I'll post about a problem on a forum and actually get someone interested in giving me genuine help.

Post Reply