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

Alexandre Julliard julliard at winehq.org
Thu Jun 24 11:15:23 CDT 2010


Module: wine
Branch: master
Commit: a49891f1e2e9852a113fcb8cbd365f477b686f03
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a49891f1e2e9852a113fcb8cbd365f477b686f03

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jun 24 15:10:58 2010 +0200

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

---

 dlls/ntdll/server.c |   22 ++++++++++++++++++++++
 loader/wine.man.in  |   18 ++++++++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 08ee784..8564c0a 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -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",
diff --git a/loader/wine.man.in b/loader/wine.man.in
index 7d6953c..6779b44 100644
--- a/loader/wine.man.in
+++ b/loader/wine.man.in
@@ -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




More information about the wine-cvs mailing list