How to pass volume label to installer.

Questions about Wine on Linux
Locked
nofunever
Newbie
Newbie
Posts: 4
Joined: Mon Oct 11, 2021 8:45 pm

How to pass volume label to installer.

Post by nofunever »

I have a 20 year old game that was released with SafeDisk copy protection but the developers released an installer fix that bypassed it when Windows 10 dropped support for SafeDisk.

It installs and runs fine using the original install disks and the official install fix patch. Once installed a no-cd patch can be used to avoid further disk use. The problem is I don't want to use my original install disks at all or to ever open the game box again so i can keep it pristine. I already destroyed my childhood copy and was forced to buy a second copy on ebay...at full original retail price mind you. It's now gone over the original retail price so I don't want to damage this copy.


The problem is the game installer even with the copy protection officially removed, still does a very basic volume label check and wine cannot provide this it appears.
I have the iso mounted appropriately. In wincfg I have a drive letter and path to the mount point set in winecfg with the type set to CD-ROM. However it appears I cannot manually set a serial or volume label in winecfg and wine cannot pass the the built in volume label from the iso itself. I've checked my dosdevices folder to make sure it matches whats in winecfg and even attempted some manual symlinking with no issues.


When attempting to run the installer
"wine: Read access denied for device L"\\??\\E:\\", FS volume label and serial are not available."

gets printed to stdout on the terminal and a "Please Insert CD-ROM Disc" dialog box appears. Hitting retry causes it to keep print the same message.

Knowing wine doesn't work properly under root I decided to try it just to see if it would get passed the read access issue. Sure enough it does but then it crashes down the road which I assume is because i'm running wine as root which you aren't supposed to.

Is there some other way I can pass volume information through wine without using root? I've seen mention something about inserting a dotfile with volume info into the mounted directory. If I have to modify the iso to contain this so that wine can read it i'm ok with that I just don't know what to call or what to put in this dotfile and search results for more details are not giving me much.

I've tried stable, devel, and staging by the way. Careful to reset my prefix's after trying different things.



Thank you in advance for any guidance.
nofunever
Newbie
Newbie
Posts: 4
Joined: Mon Oct 11, 2021 8:45 pm

Re: How to pass volume label to installer.

Post by nofunever »

I found a post from back in 2011 by mod Vitamin responding to another poster who was "unable to set drive label"

viewtopic.php?p=56707#p56718

The issue it seems is you need two separate symlinks one connecting the iso mount point to a drive label followed by a colon, and another connecting the iso file itself to the same drive label followed by two colons.

I had seen the two colons but couldn't come up with the keywords to find out what they were used for so it was a hanging question until desperation drove me to look at posts as old as 2011.

Example :

Code: Select all


ln -s /media/user_name/mounted_iso  ~/.wine/dosdevices/g:
ln -s ~/archive/disk.iso ~/.wine/dosdevices/g::



While I had tried manually establishing the first link...I did not know about the second requirement. It seems winecfg does not have a way to establish this second link (at least with virtual drives, that or its broken) either so it must be done manually.



Another search for "wine double colon" turned up this post from 2008 referencing the double colon information.
https://www.winehq.org/pipermail/wine-u ... 32229.html

Wanting to know where in documentation this magic piece of information rests?
After having gone through what I thought was all the documentation I was only able to find this golden tid bit after 2 days of searching by looking at the bottom of a 10 year old forum posts. Is this info documented anywhere officially? Am I stupid? (please don't answer i know it is a yes).



Anyway I can now safely install emperor battle for dune using my back up iso's but this lead to me discovering another problem....


The installer runs fine now on my system using the default apt wine package for kubuntu (5.03 i think). If I try to use say stable or devel or staging....the installer screen glitches over to my right monitor and hangs requiring a pkill to end.

I have a three monitor set up so i doubt most people would encounter this issue or trigger it so I tried turning my two outside monitors off and running the installer again. Sure enough works just like it does with 5.0

For some reason only Wine 5.0 can handle my three monitor set up while running the installer. Stable and later all freak out and require i turn them off to get through the installation....weird quirk..


Anway. I figured I'd leave the solution here in case anyone else encounters this issue so that there is something more recent record of this problem and solution. I tend to ignore posts 10 years old and assume they are outdated.

In case it helps someone google search...the game in question was Emperor: Battle for Dune
spoon0042
Level 6
Level 6
Posts: 566
Joined: Thu Dec 24, 2009 11:00 am

Re: How to pass volume label to installer.

Post by spoon0042 »

huh. yeah, you'd think that would just work. wine kind of handles drives automagically and when I loop mount an iso I get, for example

Code: Select all

g: -> /mnt
g:: -> /dev/loop0
... and I would think it would be able to get the label from /dev/loop0. Something I can take a look at next time I'm bored. :)

... if I change the link to point to the .iso the next time I run winecfg it creates a second drive for /mnt and *that* one has the correct label so something is definitely going screwy.
spoon0042
Level 6
Level 6
Posts: 566
Joined: Thu Dec 24, 2009 11:00 am

Re: How to pass volume label to installer.

Post by spoon0042 »

From a little poking around I'm starting to make some sense of it. By default /dev/loop0 isn't readable by normal users, so wine can't see the label. Doing a 'chmod 0664' and creating a new prefix does get the label. Presumably manually setting the link to the .iso does something weird and wine can see it, somehow. (And perhaps not intentionally?)

A little more info at least.
nofunever
Newbie
Newbie
Posts: 4
Joined: Mon Oct 11, 2021 8:45 pm

Re: How to pass volume label to installer.

Post by nofunever »

spoon0042 wrote: Tue Oct 12, 2021 9:07 pm From a little poking around I'm starting to make some sense of it. By default /dev/loop0 isn't readable by normal users, so wine can't see the label. Doing a 'chmod 0664' and creating a new prefix does get the label. Presumably manually setting the link to the .iso does something weird and wine can see it, somehow. (And perhaps not intentionally?)

A little more info at least.
Thanks for the input!!! I had seen this post suggesting changing permissions to the loop but then the person listed reasons as to why that might not be safe and I honestly don't know enough to confirm or deny.

https://forums.gentoo.org/viewtopic-t-5 ... art-0.html

The same issue, a guy needs to pass a volume label through wine. If I can safely grant my user profile access to a loop permanently that seems like the perma-fix does it not?

I did more searching on getting volume information off a loop based on your input and found this post on an open office forum...by our buddy vitamin....who seems to be the expert on this issue.

"vitamin13 years ago
Permalink
Post by Beau
I also have created a symlink called "d:" pointing to mount_dir. This works almost fine; Wine sees the drive and the files on the disk.... except.... the drive has NO LABEL!! The ISO has a label, but Wine doesn't seem to detect this properly.

Make sure that you (as user) can access /dev/loop* Also that you can read that .iso file. "



So here vitamin's solution is to make sure users have permission to access the loop. In another instance, i reference in earlier posts he recommends setting a symlink. It' seems both solutions have been recommended by him. My question is..what is considered the "proper" way? Or is it' just whatever you feel like, if it works it works?
spoon0042
Level 6
Level 6
Posts: 566
Joined: Thu Dec 24, 2009 11:00 am

Re: How to pass volume label to installer.

Post by spoon0042 »

One simple way I guess would be to just make /dev/loop* world-readable which I assume udev can be configured to do. This may not be ideal permissions-wise but if you're the only one using your computer and you have to be root to mount it anyway, *shrug*

Or if just the symlink works for you keep doing it.

As for a more "proper" way you could put it in /etc/fstab but that wouldn't solve the permissions issue. Searching for "losetup on boot" gives some ideas. Making a systemd service (or whatever your distro uses) looks good. You could use whatever device and set whatever permissions that way. Or possibly do the same with a script and sudo? And now I'm wondering if there's some sort of disk manager thing that would Just Let Me Mount An ISO Dammit. ...I found fuseiso and it almost works? After making the symlink to the .iso wine reads the label but fails to keep it for some reason. May look into this a little more, idk.
spoon0042
Level 6
Level 6
Posts: 566
Joined: Thu Dec 24, 2009 11:00 am

Re: How to pass volume label to installer.

Post by spoon0042 »

I kind of forgot you only needed the installer to work so that may not be that relevant, oh well. May still be of use to someone. :)

Spent too much time messing with this but it was interesting. It's possible it used to work differently but current wine looks at (in my case) /tmp/tmp.iso and decides that's just a file on / and uses the label and serial for / instead. Actual devices are treated as you'd expect. Inconvenient but could be worked around with an ugly hack somewhere.
nofunever
Newbie
Newbie
Posts: 4
Joined: Mon Oct 11, 2021 8:45 pm

Re: How to pass volume label to installer.

Post by nofunever »

spoon0042 wrote: Wed Oct 13, 2021 8:09 pm I kind of forgot you only needed the installer to work so that may not be that relevant, oh well. May still be of use to someone. :)

Spent too much time messing with this but it was interesting. It's possible it used to work differently but current wine looks at (in my case) /tmp/tmp.iso and decides that's just a file on / and uses the label and serial for / instead. Actual devices are treated as you'd expect. Inconvenient but could be worked around with an ugly hack somewhere.
Well, I truly appreciate your time in helping me illuminate this. I'll just have to weigh my pro's and cons.

I'm trying to write an install guide for this game that's easily repeatable, so while I have a working solution for myself at this point i'm trying to come up with one that is essentially "fool proof" This game is kind of the genesis of my life as a computer nerd so there is some real nostalgia and love motivating this.

The pro to the permissions route is that I'm able to condense it down to one line after the original mount takes place.

sudo losetup --list | grep 'Dune\|Emperor\|Emperor1\|Install\|.iso\|' | cut -f1 -d' ' | xargs sudo chmod 0664

The con is the user will have to use this line every time they finish mounting the image before they play unless they use the no-cd patch... I'm trying to make the guide friendly to people using original backups as well. This could be done with a simple script that mounts and sets permissions in one go but still. Ideally, after install I'd like the user to be able to just click the desktop shortcut and go...that way the game works a year later when they've forgotten all about the "start up script"

The pro to the symlink is in theory the symlink to the ISO should remain in the WINEPREFIX even after the image is mounted and unmounted making it a one and done sort of deal.

The con is I haven't figured out how to condense the symlink to easily repeatable steps yet as i'm not sure how to automate checking what drive letter winecfg decided to associate with the drive mount point. Right now I have to either look at the drive tab in winecfg or navigate to the dosdevices folder and check all the drive labels. I don't know why but my dosdevices directory starts out populated with 8 drive letters at first config but only drive C is actually linked to anything when winecfg runs the first time.. So i'd have to check them one by one to see which one got linked up by winecfg... Guess I could go full nuclear have the user wipe out all drive labels that aren't C and then regenerate both symlinks. It doesn't really need to all fit on one line as long as the steps can be copied and pasted.

Anyways, thanks again, don't feel obligated respond or spend any more time on this, i'm just thinking to myself at this point, you've been a lot of help.
spoon0042
Level 6
Level 6
Posts: 566
Joined: Thu Dec 24, 2009 11:00 am

Re: How to pass volume label to installer.

Post by spoon0042 »

Happy to help. Sounds like an interesting challenge, good luck. :)
Locked