Alexandre Julliard : wineboot: Display a wait dialog while processing wine. inf.
Alexandre Julliard
julliard at winehq.org
Tue Mar 30 10:39:48 CDT 2010
Module: wine
Branch: master
Commit: 9254476d131bbf4b8982962f83fc37e4b36abab7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9254476d131bbf4b8982962f83fc37e4b36abab7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Mar 30 16:49:53 2010 +0200
wineboot: Display a wait dialog while processing wine.inf.
---
programs/wineboot/resource.h | 4 ++
programs/wineboot/wineboot.c | 60 +++++++++++++++++++++++++++++++++----
programs/wineboot/wineboot_En.rc | 10 ++++++
3 files changed, 67 insertions(+), 7 deletions(-)
diff --git a/programs/wineboot/resource.h b/programs/wineboot/resource.h
index a59454a..4ff3c69 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 ac403b9..32ac3ac 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -81,6 +81,7 @@
#include <shobjidl.h>
#include <shlwapi.h>
#include <shellapi.h>
+#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 4070b72..2b6720b 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
More information about the wine-cvs
mailing list