Alexandre Julliard : winecfg: Relaunch the 64-bit version of winecfg on Wow64.

Alexandre Julliard julliard at winehq.org
Fri Dec 17 11:30:38 CST 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 15 22:29:49 2010 +0100

winecfg: Relaunch the 64-bit version of winecfg on Wow64.

---

 programs/winecfg/main.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c
index fdefefb..7376309 100644
--- a/programs/winecfg/main.c
+++ b/programs/winecfg/main.c
@@ -214,6 +214,32 @@ ProcessCmdLine(LPSTR lpCmdLine)
 int WINAPI
 WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
 {
+    BOOL is_wow64;
+
+    if (IsWow64Process( GetCurrentProcess(), &is_wow64 ) && is_wow64)
+    {
+        STARTUPINFOW si;
+        PROCESS_INFORMATION pi;
+        WCHAR filename[MAX_PATH];
+        void *redir;
+        DWORD exit_code;
+
+        memset( &si, 0, sizeof(si) );
+        si.cb = sizeof(si);
+        GetModuleFileNameW( 0, filename, MAX_PATH );
+
+        Wow64DisableWow64FsRedirection( &redir );
+        if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
+        {
+            WINE_TRACE( "restarting %s\n", wine_dbgstr_w(filename) );
+            WaitForSingleObject( pi.hProcess, INFINITE );
+            GetExitCodeProcess( pi.hProcess, &exit_code );
+            ExitProcess( exit_code );
+        }
+        else WINE_ERR( "failed to restart 64-bit %s, err %d\n", wine_dbgstr_w(filename), GetLastError() );
+        Wow64RevertWow64FsRedirection( redir );
+    }
+
     if (ProcessCmdLine(szCmdLine)) {
         return 0;
     }




More information about the wine-cvs mailing list