ntdll: Add a WINEARCH environment variable that allows forcing a specific 32- or 64-bit architecture.

This commit is contained in:
Alexandre Julliard 2010-06-24 15:10:58 +02:00
parent 9f7bc109d2
commit a49891f1e2
2 changed files with 38 additions and 2 deletions

View File

@ -752,6 +752,18 @@ static void setup_config_dir(void)
mkdir( config_dir, 0777 );
if (chdir( config_dir ) == -1) fatal_perror( "chdir to %s\n", config_dir );
if ((p = getenv( "WINEARCH" )) && !strcmp( p, "win32" ))
{
/* force creation of a 32-bit prefix */
int fd = open( "system.reg", O_WRONLY | O_CREAT | O_EXCL, 0666 );
if (fd != -1)
{
static const char regfile[] = "WINE REGISTRY Version 2\n\n#arch=win32\n";
write( fd, regfile, sizeof(regfile) - 1 );
close( fd );
}
}
MESSAGE( "wine: created the configuration directory '%s'\n", config_dir );
}
@ -1040,6 +1052,7 @@ NTSTATUS server_init_process_done(void)
size_t server_init_thread( void *entry_point )
{
static const int is_win64 = (sizeof(void *) > sizeof(int));
const char *arch = getenv( "WINEARCH" );
int ret;
int reply_pipe[2];
struct sigaction sig_act;
@ -1090,6 +1103,15 @@ size_t server_init_thread( void *entry_point )
switch (ret)
{
case STATUS_SUCCESS:
if (arch)
{
if (!strcmp( arch, "win32" ) && (is_win64 || is_wow64))
fatal_error( "WINEARCH set to win32 but '%s' is a 64-bit installation.\n",
wine_get_config_dir() );
if (!strcmp( arch, "win64" ) && !is_wow64)
fatal_error( "WINEARCH set to win64 but '%s' is a 32-bit installation.\n",
wine_get_config_dir() );
}
return info_size;
case STATUS_NOT_REGISTRY_FILE:
fatal_error( "'%s' is a 32-bit installation, it cannot support 64-bit applications.\n",

View File

@ -142,8 +142,9 @@ on all relay messages (API calls).
.TP
WINEDEBUG=relay
will turn on all relay messages. For more control on including or excluding
functions and dlls from the relay trace look into the [Debug] section
of the wine configuration file.
functions and dlls from the relay trace, look into the
.B HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Debug
registry key.
.PP
For more information on debugging messages, see the
.I Running Wine
@ -204,6 +205,19 @@ the builtin load fails; load shell32 always as builtin and comctl32
always as native. Oleaut32 will be disabled.
.RE
.TP
.I WINEARCH
Specifies the Windows architecture to support. It can be set either to
.B win32
(support only 32-bit applications), or to
.B win64
(support both 64-bit applications and 32-bit ones in WoW64 mode).
.br
The architecture supported by a given Wine prefix is set at prefix
creation time and cannot be changed afterwards. When running with an
existing prefix, Wine will refuse to start if
.I WINEARCH
doesn't match the prefix architecture.
.TP
.I DISPLAY
Specifies the X11 display to use.
.TP