[Bug 50308] New: Starting certain Wine builtin apps with explicit SysWOW64 path in 64-bit WINEPREFIX causes infinite process restart loop (wineboot, winecfg, ...)
WineHQ Bugzilla
wine-bugs at winehq.org
Thu Dec 10 12:36:59 CST 2020
https://bugs.winehq.org/show_bug.cgi?id=50308
Bug ID: 50308
Summary: Starting certain Wine builtin apps with explicit
SysWOW64 path in 64-bit WINEPREFIX causes infinite
process restart loop (wineboot, winecfg, ...)
Product: Wine
Version: 6.0-rc1
Hardware: x86-64
OS: Linux
Status: NEW
Severity: minor
Priority: P2
Component: programs
Assignee: wine-bugs at winehq.org
Reporter: focht at gmx.net
Distribution: ---
Hello folks,
found while playing around with Wow64 file system redirection.
Certain Wine builtin apps restart themselves as 64-bit process when running
under Wow64 environment by design to avoid synchronization issues of registry
data (shared/redirected/reflected).
Although most users will never try this, explicitly specifying SysWOW64
directory will result in an infinite process restart loop. SysWOW64 is used to
bypass the filesystem redirector. In this case it's questionable but still it
shouldn't result in the observed behaviour.
--- snip ---
$ wine cmd.exe /c "%WINDIR%\\syswow64\\winecfg.exe"
<will infinitely restart>
--- snip ---
Affected apps:
* regedit
* uninstaller
* wineboot
* winecfg
* winedbg
* wusa
The process restart code is mostly identical across these.
Wine source:
https://source.winehq.org/git/wine.git/blob/76c9dbd4fb99f1257734908906c846a3c25ca77b:/programs/regedit/main.c#l139
--- snip ---
139 int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR
lpCmdLine, int nCmdShow)
140 {
141 MSG msg;
142 HACCEL hAccel;
143 BOOL is_wow64;
144
145 if (ProcessCmdLine(GetCommandLineW())) {
146 return 0;
147 }
148
149 if (IsWow64Process( GetCurrentProcess(), &is_wow64 ) && is_wow64)
150 {
151 STARTUPINFOW si;
152 PROCESS_INFORMATION pi;
153 WCHAR filename[MAX_PATH];
154 void *redir;
155 DWORD exit_code;
156
157 memset( &si, 0, sizeof(si) );
158 si.cb = sizeof(si);
159 GetModuleFileNameW( 0, filename, MAX_PATH );
160
161 Wow64DisableWow64FsRedirection( &redir );
162 if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL,
FALSE, 0, NULL, NULL, &si, &pi ))
163 {
164 WINE_TRACE( "restarting %s\n", wine_dbgstr_w(filename) );
165 WaitForSingleObject( pi.hProcess, INFINITE );
166 GetExitCodeProcess( pi.hProcess, &exit_code );
167 ExitProcess( exit_code );
168 }
169 else WINE_ERR( "failed to restart 64-bit %s, err %d\n",
wine_dbgstr_w(filename), GetLastError() );
170 Wow64RevertWow64FsRedirection( redir );
171 }
--- snip ---
'regsvr32' has some code that might be useful:
https://source.winehq.org/git/wine.git/blob/76c9dbd4fb99f1257734908906c846a3c25ca77b:/programs/regsvr32/regsvr32.c#l114
Although that case is a bit different as it supports restart in both
directions.
$ wine --version
wine-6.0-rc1-39-g76c9dbd4fb9
Regards
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list