How program can get it's prefix bit count

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
sfx09
Newbie
Newbie
Posts: 3
Joined: Sun Apr 17, 2022 4:39 pm

How program can get it's prefix bit count

Post by sfx09 »

How program that run in Wine can get if it's running in 64 or 32-bit prefix?
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: How program can get it's prefix bit count

Post by jkfloris »

In the same way as the program will do in Windows.

There are several ways to do this. For example:
- check the %PROCESSOR_ARCHITECTURE% and/or %PROCESSOR_ARCHITEW6432% variabele
- check the registry key "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
- check kernel32.dll for IsWow64Process
sfx09
Newbie
Newbie
Posts: 3
Joined: Sun Apr 17, 2022 4:39 pm

Re: How program can get it's prefix bit count

Post by sfx09 »

Thank you!
Check GetEnvironmentVariable('PROCESSOR_ARCHITEW6432')='AMD64' works fine!
One more question - can program get Wine prefix name that is used to run it? I mean if program is located in prefix2 and run by prefix1 (i.e. WINEPREFIX=~\.prefix1 wine home/user/prefix2/drive_c/program) to check it and to show exception?
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: How program can get it's prefix bit count

Post by jkfloris »

To see if a prefix is 64 or 32 bit from another prefix, you can look in the system.reg file of the other prefix.

Code: Select all

WINEPREFIX=~/.prefix1 wine cmd /c "findstr /c:"#arch" Z:\\home\\user\\prefix2\\system.reg"
spoon0042
Level 6
Level 6
Posts: 572
Joined: Thu Dec 24, 2009 11:00 am

Re: How program can get it's prefix bit count

Post by spoon0042 »

sfx09 wrote: Fri Feb 17, 2023 3:17 am Thank you!
Check GetEnvironmentVariable('PROCESSOR_ARCHITEW6432')='AMD64' works fine!
One more question - can program get Wine prefix name that is used to run it? I mean if program is located in prefix2 and run by prefix1 (i.e. WINEPREFIX=~\.prefix1 wine home/user/prefix2/drive_c/program) to check it and to show exception?
it looks like WINEPREFIX and other wine stuff are available in the windows environment, at least it's there when i checked by running 'set' in a wineconsole

(though it might be simpler, more appropriate, etc to use a file or unique id somewhere to do that sort of thing)
Locked