Skip to content

Commit

Permalink
Restore wineboot
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcenx committed Sep 3, 2019
1 parent 8de3ae6 commit 0d2c827
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 94 deletions.
9 changes: 2 additions & 7 deletions programs/wineboot/shutdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "winbase.h"
#include "winuser.h"
#include "tlhelp32.h"
#include "wine/unicode.h"

#include "wine/debug.h"

#include "resource.h"
Expand Down Expand Up @@ -290,8 +290,7 @@ static DWORD_PTR send_end_session_messages( struct window_info *win, UINT count,
/* Check whether the app quit on its own */
ret = WaitForSingleObject( process_handle, 0 );
CloseHandle( process_handle );
/* CODEWEAVERS HACK: avoid killing winewrapper, other processes will be killed in kill_processes */
if (0 && ret == WAIT_TIMEOUT)
if (ret == WAIT_TIMEOUT)
{
/* If not, it returned from all WM_ENDSESSION and is finished cleaning
* up, so we can safely kill the process. */
Expand Down Expand Up @@ -390,12 +389,8 @@ void kill_processes( BOOL kill_desktop )
process.dwSize = sizeof(process);
for (res = Process32FirstW( snapshot, &process ); res; res = Process32NextW( snapshot, &process ))
{
static const WCHAR winewrapperW[] = {'w','i','n','e','w','r','a','p','p','e','r',0};
if (process.th32ProcessID == GetCurrentProcessId()) continue;
if (process.th32ProcessID == desktop_pid) continue;
/* CODEWEAVERS HACK: don't kill winewrapper so end-of-installation
* detection works properly */
if (strstrW( process.szExeFile, winewrapperW )) continue;
WINE_TRACE("killing process %04x %s\n",
process.th32ProcessID, wine_dbgstr_w(process.szExeFile) );
if (!(handle = OpenProcess( PROCESS_TERMINATE, FALSE, process.th32ProcessID )))
Expand Down
90 changes: 3 additions & 87 deletions programs/wineboot/wineboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,20 +976,6 @@ static HANDLE start_rundll32( const char *inf_path, BOOL wow64 )
strcatW( buffer, inf );
MultiByteToWideChar( CP_UNIXCP, 0, inf_path, -1, buffer + strlenW(buffer), inf_len );

if (1)
{
/* CROSSOVER HACK bug 7736. Do prefix initialization in the root desktop. */
static WCHAR root[] = {'r','o','o','t',0};
HDESK desktop;

desktop = CreateDesktopW(root, NULL, NULL, 0, GENERIC_ALL, NULL);
if (desktop)
{
SetThreadDesktop(desktop);
CloseHandle(desktop);
}
}

if (CreateProcessW( app, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
CloseHandle( pi.hThread );
else
Expand All @@ -999,42 +985,6 @@ static HANDLE start_rundll32( const char *inf_path, BOOL wow64 )
return pi.hProcess;
}

/* ---------------------------------------------------------------
** This function is a CrossOver HACK for 9411 / 8979.
** --------------------------------------------------------------- */
static char* setup_dll_overrides(void)
{
/* See CXBT.pm for reference */
static char overrides[] = "shdocvw=b;*iexplore.exe=b;advpack=b;atl=b;oleaut32=b;rpcrt4=b";
char* old_dlloverrides;
HANDLE hFile;

/* Save the original dll overrides so we can restore them after running
* rundll32.
*/
old_dlloverrides = getenv("WINEDLLOVERRIDES");
if (old_dlloverrides)
old_dlloverrides = strdup(old_dlloverrides);

/* Check whether shdocvw is usable */
hFile = CreateFileA("c:/windows/system32/shdocvw.dll", FILE_READ_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
char buf[0x40+20];
if (ReadFile(hFile, buf, sizeof(buf), NULL, NULL))
{
if (strncmp(buf+0x40, "Wine placeholder DLL", 20) != 0)
overrides[8] = 'd';
}
CloseHandle(hFile);
}
WINE_TRACE("for rundll32: WINEDLLOVERRIDES=%s\n", overrides);
setenv("WINEDLLOVERRIDES", overrides, 1);
return old_dlloverrides;
}

/* execute rundll32 on the wine.inf file if necessary */
static void update_wineprefix( BOOL force )
{
Expand All @@ -1061,12 +1011,10 @@ static void update_wineprefix( BOOL force )
{
HANDLE process;
DWORD count = 0;
char* old_dlloverrides = setup_dll_overrides();

if ((process = start_rundll32( inf_path, FALSE )))
{
/* HACK: Disable the wait window as it is deemed confusing */
HWND hwnd = 1 ? NULL : show_wait_window();
HWND hwnd = show_wait_window();
for (;;)
{
MSG msg;
Expand All @@ -1080,14 +1028,7 @@ static void update_wineprefix( BOOL force )
}
DestroyWindow( hwnd );
}
WINE_TRACE( "wine: configuration in '%s' has been updated.\n", config_dir );
if (old_dlloverrides)
{
setenv("WINEDLLOVERRIDES", old_dlloverrides, 1);
free(old_dlloverrides);
}
else
unsetenv("WINEDLLOVERRIDES");
WINE_MESSAGE( "wine: configuration in '%s' has been updated.\n", config_dir );
}

done:
Expand Down Expand Up @@ -1303,33 +1244,9 @@ int main( int argc, char *argv[] )
ProcessRunKeys( HKEY_LOCAL_MACHINE, RunServicesW, FALSE, FALSE );
start_services_process();
}

if (end_session || kill || restart) /* CodeWeavers hack: let reboot.exe do the reboot processing */
{
static const WCHAR rebootW[] = { '\\','r','e','b','o','o','t','.','e','x','e',0 };
WCHAR cmdline[MAX_PATH + sizeof(rebootW)/sizeof(WCHAR)];
PROCESS_INFORMATION pi;
STARTUPINFOW si;

GetSystemDirectoryW( cmdline, MAX_PATH );
lstrcatW( cmdline, rebootW );
memset( &si, 0, sizeof si );
si.cb = sizeof si;
if (CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
{
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
goto done;
}
WINE_ERR("Failed to start reboot\n");
}

create_volatile_environment_registry_key();

if (init || update) update_wineprefix( update );

goto done; /* CodeWeavers hack: reboot.exe should have handled these already */
create_volatile_environment_registry_key();

ProcessRunKeys( HKEY_LOCAL_MACHINE, RunOnceW, TRUE, TRUE );

Expand All @@ -1340,7 +1257,6 @@ int main( int argc, char *argv[] )
ProcessStartupItems();
}

done:
WINE_TRACE("Operation done\n");

SetEvent( event );
Expand Down

0 comments on commit 0d2c827

Please sign in to comment.