Alexandre Julliard : winecfg: Display a warning when the user tries to change the load

Alexandre Julliard julliard at wine.codeweavers.com
Sat Feb 4 11:15:03 CST 2006


Module: wine
Branch: refs/heads/master
Commit: c919112a740df0003b23ee40d96f4091a3b7aeb9
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=c919112a740df0003b23ee40d96f4091a3b7aeb9

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Feb  4 17:05:14 2006 +0100

winecfg: Display a warning when the user tries to change the load
order of a system dll.

---

 programs/winecfg/En.rc       |   10 ++++++++++
 programs/winecfg/libraries.c |   40 ++++++++++++++++++++++++++++++++++++++--
 programs/winecfg/resource.h  |    7 +++++++
 3 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/programs/winecfg/En.rc b/programs/winecfg/En.rc
index a959b60..22bdeb0 100644
--- a/programs/winecfg/En.rc
+++ b/programs/winecfg/En.rc
@@ -204,6 +204,16 @@ BEGIN
     IDS_AUDIO_MISSING       "There is no audio driver currently specified in the registry.\n\nA recommended driver has been selected for you.\nYou can use this driver or select another driver if available.\n\nYou must click Apply for the selection to take effect."
 END
 
+STRINGTABLE DISCARDABLE
+BEGIN
+    IDS_DLL_WARNING         "Changing the load order of this library is not recommended.\nAre you sure you want to do this?"
+    IDS_DLL_WARNING_CAPTION "Warning: system library"
+    IDS_DLL_NATIVE          "native"
+    IDS_DLL_BUILTIN         "builtin"
+    IDS_DLL_NATIVE_BUILTIN  "native, builtin"
+    IDS_DLL_BUILTIN_NATIVE  "builtin, native"
+    IDS_DLL_DISABLED        "disabled"
+END
 
 /****************************************************************/
 /* English neutral resources
diff --git a/programs/winecfg/libraries.c b/programs/winecfg/libraries.c
index 7b8e7e8..2d9e60d 100644
--- a/programs/winecfg/libraries.c
+++ b/programs/winecfg/libraries.c
@@ -148,8 +148,20 @@ static const char* mode_to_string(enum d
 /* Convert a dllmode to a pretty string for display. TODO: use translations. */
 static const char* mode_to_label(enum dllmode mode)
 {
-    WINE_FIXME("translate me\n");
-    return mode_to_string(mode);
+    static char buffer[256];
+    UINT id = 0;
+
+    switch( mode )
+    {
+    case NATIVE: id = IDS_DLL_NATIVE; break;
+    case BUILTIN: id = IDS_DLL_BUILTIN; break;
+    case NATIVE_BUILTIN: id = IDS_DLL_NATIVE_BUILTIN; break;
+    case BUILTIN_NATIVE: id = IDS_DLL_BUILTIN_NATIVE; break;
+    case DISABLE: id = IDS_DLL_DISABLED; break;
+    default: assert(FALSE);
+    }
+    if (!LoadStringA( GetModuleHandleA(NULL), id, buffer, sizeof(buffer) )) buffer[0] = 0;
+    return buffer;
 }
 
 /* Convert a control id (IDC_ constant) to a dllmode */
@@ -417,6 +429,30 @@ static void on_add_click(HWND dialog)
             *ptr = '\0';
         }
     }
+
+    /* check if dll is in the builtin-only list */
+    if (!(ptr = strrchr( buffer, '\\' )))
+    {
+        ptr = buffer;
+        if (*ptr == '*') ptr++;
+    }
+    else ptr++;
+    if (is_builtin_only( ptr ))
+    {
+        MSGBOXPARAMSA params;
+        params.cbSize = sizeof(params);
+        params.hwndOwner = dialog;
+        params.hInstance = GetModuleHandleA( NULL );
+        params.lpszText = MAKEINTRESOURCEA( IDS_DLL_WARNING );
+        params.lpszCaption = MAKEINTRESOURCEA( IDS_DLL_WARNING_CAPTION );
+        params.dwStyle = MB_ICONWARNING | MB_YESNO;
+        params.lpszIcon = NULL;
+        params.dwContextHelpId = 0;
+        params.lpfnMsgBoxCallback = NULL;
+        params.dwLanguageId = 0;
+        if (MessageBoxIndirectA( &params ) != IDYES) return;
+    }
+
     SendDlgItemMessage(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM) "");
     disable(IDC_DLLS_ADDDLL);
     
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index e7554c3..4fac41f 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -76,6 +76,13 @@
 #define IDC_DLLS_REMOVEDLL              8003
 #define IDC_DLLCOMBO                    8004
 #define IDD_LOADORDER                   8005
+#define IDS_DLL_WARNING                 8010
+#define IDS_DLL_WARNING_CAPTION         8011
+#define IDS_DLL_NATIVE                  8012
+#define IDS_DLL_BUILTIN                 8013
+#define IDS_DLL_NATIVE_BUILTIN          8014
+#define IDS_DLL_BUILTIN_NATIVE          8015
+#define IDS_DLL_DISABLED                8016
 
 /* drive editing */
 #define IDC_LIST_DRIVES                 1042




More information about the wine-cvs mailing list