diff --git a/programs/wineboot/resource.h b/programs/wineboot/resource.h index a59454a502c..4ff3c69e2d5 100644 --- a/programs/wineboot/resource.h +++ b/programs/wineboot/resource.h @@ -20,4 +20,8 @@ #include "winuser.h" #define IDC_STATIC -1 +#define IDC_WAITICON 1 +#define IDC_WAITTEXT 2 + #define IDD_ENDTASK 100 +#define IDD_WAITDLG 101 diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index ac403b99d2c..32ac3acb3d3 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -81,6 +81,7 @@ #include #include #include +#include "resource.h" WINE_DEFAULT_DEBUG_CHANNEL(wineboot); @@ -859,6 +860,44 @@ static BOOL start_services_process(void) return TRUE; } +static INT_PTR CALLBACK wait_dlgproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) +{ + switch (msg) + { + case WM_INITDIALOG: + { + WCHAR *buffer, text[1024]; + const WCHAR *name = (WCHAR *)lp; + HICON icon = LoadImageW( 0, (LPCWSTR)IDI_WINLOGO, IMAGE_ICON, 48, 48, LR_SHARED ); + SendDlgItemMessageW( hwnd, IDC_WAITICON, STM_SETICON, (WPARAM)icon, 0 ); + SendDlgItemMessageW( hwnd, IDC_WAITTEXT, WM_GETTEXT, 1024, (LPARAM)text ); + buffer = HeapAlloc( GetProcessHeap(), 0, (strlenW(text) + strlenW(name) + 1) * sizeof(WCHAR) ); + sprintfW( buffer, text, name ); + SendDlgItemMessageW( hwnd, IDC_WAITTEXT, WM_SETTEXT, 0, (LPARAM)buffer ); + HeapFree( GetProcessHeap(), 0, buffer ); + } + break; + } + return 0; +} + +static HWND show_wait_window(void) +{ + const char *config_dir = wine_get_config_dir(); + WCHAR *name; + HWND hwnd; + DWORD len; + + len = MultiByteToWideChar( CP_UNIXCP, 0, config_dir, -1, NULL, 0 ); + name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + MultiByteToWideChar( CP_UNIXCP, 0, config_dir, -1, name, len ); + hwnd = CreateDialogParamW( GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_WAITDLG), 0, + wait_dlgproc, (LPARAM)name ); + ShowWindow( hwnd, SW_SHOWNORMAL ); + HeapFree( GetProcessHeap(), 0, name ); + return hwnd; +} + static HANDLE start_rundll32( const char *inf_path, BOOL wow64 ) { static const WCHAR rundll[] = {'\\','r','u','n','d','l','l','3','2','.','e','x','e',0}; @@ -930,16 +969,23 @@ static void update_wineprefix( int force ) if (update_timestamp( config_dir, st.st_mtime ) || force) { HANDLE process; + DWORD count = 0; if ((process = start_rundll32( inf_path, FALSE ))) { - WaitForSingleObject( process, INFINITE ); - CloseHandle( process ); - } - if ((process = start_rundll32( inf_path, TRUE ))) - { - WaitForSingleObject( process, INFINITE ); - CloseHandle( process ); + HWND hwnd = show_wait_window(); + for (;;) + { + MSG msg; + DWORD res = MsgWaitForMultipleObjects( 1, &process, FALSE, INFINITE, QS_ALLINPUT ); + if (res == WAIT_OBJECT_0) + { + CloseHandle( process ); + if (count++ || !(process = start_rundll32( inf_path, TRUE ))) break; + } + else while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageW( &msg ); + } + DestroyWindow( hwnd ); } WINE_MESSAGE( "wine: configuration in '%s' has been updated.\n", config_dir ); } diff --git a/programs/wineboot/wineboot_En.rc b/programs/wineboot/wineboot_En.rc index 4070b72a44b..2b6720b0802 100644 --- a/programs/wineboot/wineboot_En.rc +++ b/programs/wineboot/wineboot_En.rc @@ -35,3 +35,13 @@ BEGIN LTEXT "If you terminate the process you may lose all unsaved data.", IDC_STATIC,7,28,172,15 END + +IDD_WAITDLG DIALOG 0, 0, 200, 50 +STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_DISABLED +CAPTION "Wine" +FONT 8, "MS Shell Dlg" +BEGIN + ICON "", IDC_WAITICON, 3, 3, 10, 10 + LTEXT "The Wine configuration in %s is being updated, please wait...", + IDC_WAITTEXT, 40, 5, 150, 40, SS_NOPREFIX +END