winecfg: Set the parameter of PropSheetInfo structure for restart the wineserver...
authorIlya Shpigor <shpigor@etersoft.ru>
Thu, 20 Aug 2009 11:05:54 +0000 (15:05 +0400)
committerVitaly Lipatov <lav@etersoft.ru>
Thu, 27 Aug 2009 15:45:41 +0000 (19:45 +0400)
programs/winecfg/dongleui.c

index a041a0eaa91c5001dfdbd54f346675ef5db329f7..e7e733361b6f0efcb4952dba9046dbc3beefd539 100644 (file)
@@ -34,6 +34,7 @@
 #include <shlguid.h>
 #include <shlwapi.h>
 #include <shlobj.h>
+#include <prsht.h>
 
 #include <wine/unicode.h>
 #include <wine/debug.h>
@@ -84,6 +85,45 @@ enum dongle_t
     smartkey3
 };
 
+static const WCHAR PropSheetInfoStr[] =
+    {'P','r','o','p','e','r','t','y','S','h','e','e','t','I','n','f','o',0 };
+
+typedef struct tagPropPageInfo
+{
+  HPROPSHEETPAGE hpage; /* to keep track of pages not passed to PropertySheet */
+  HWND hwndPage;
+  BOOL isDirty;
+  LPCWSTR pszText;
+  BOOL hasHelp;
+  BOOL useCallback;
+  BOOL hasIcon;
+} PropPageInfo;
+
+typedef struct tagPropSheetInfo
+{
+  HWND hwnd;
+  PROPSHEETHEADERW ppshheader;
+  BOOL unicode;
+  LPWSTR strPropertiesFor;
+  int nPages;
+  int active_page;
+  BOOL isModeless;
+  BOOL hasHelp;
+  BOOL hasApply;
+  BOOL hasFinish;
+  BOOL usePropPage;
+  BOOL useCallback;
+  BOOL activeValid;
+  PropPageInfo* proppage;
+  HFONT hFont;
+  HFONT hFontBold;
+  int width;
+  int height;
+  HIMAGELIST hImageList;
+  BOOL ended;
+  INT result;
+} PropSheetInfo;
+
 static int file_exists(LPCWSTR filename)
 {
     HANDLE file;
@@ -382,6 +422,14 @@ static void on_unload_click (HWND dialog, int num)
     SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0);
 }
 
+static void set_restart_param (HWND dialog)
+{
+    PropSheetInfo* psInfo = GetPropW(GetParent(dialog), PropSheetInfoStr);
+
+    if (!psInfo) return;
+    psInfo->result = ID_PSREBOOTSYSTEM;
+}
+
 INT_PTR CALLBACK
 DongleDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
 {
@@ -402,14 +450,20 @@ DongleDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
 
                     if (HIWORD(wParam) != BN_CLICKED) break;
                     if (!get_start(num))
+                    {
+                        set_restart_param(dialog);
                         on_load_click(dialog, num);
+                    }
                     break;
                 case IDC_BUTTON_UNLOAD:
                     num = get_list_selection(dialog);
 
                     if (HIWORD(wParam) != BN_CLICKED) break;
                     if (get_start(num))
+                    {
+                        set_restart_param(dialog);
                         on_unload_click(dialog, num);
+                    }
                     break;
             }
             break;