PATCH: winecfg, more options in libraries tab

Robert van Herk robert at robertvanherk.nl
Tue Feb 17 06:13:45 CST 2004


This is a patch that allows user to choose for "native", 
"native,builtin", "builtin", "builtin,native" and "disable" for each 
library they override using winecfg.

In the old situation, only an option for native and builtin were available.

Grtz,
Robert
-------------- next part --------------
Index: programs/winecfg/En.rc
===================================================================
RCS file: /home/wine/wine/programs/winecfg/En.rc,v
retrieving revision 1.17
diff -u -r1.17 En.rc
--- programs/winecfg/En.rc	7 Feb 2004 01:01:34 -0000	1.17
+++ programs/winecfg/En.rc	17 Feb 2004 12:08:33 -0000
@@ -85,17 +85,20 @@
 FONT 8, "MS Sans Serif"
 BEGIN
     GROUPBOX        "DLL Overrides",IDC_STATIC,8,4,244,240
-    LTEXT           "Libraries can be specified individually to be either builtin or native. A DLL entry specified as ""*"" pertains to all DLLs not specified explicitly.\n\nBe careful, wrong settings here have the potential to pretty much kill your setup."
-                    ,  IDC_STATIC,15,17,228,47
-    CONTROL         "DLL Overrides", IDC_TREE_DLLS, "SysTreeView32", WS_BORDER | WS_TABSTOP | TVS_LINESATROOT | TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_HASBUTTONS, 15,65,142,172
-    LTEXT           "Load order:",IDC_STATIC,163,65,37,8
-    CONTROL         "Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,163,80,57,10
-    CONTROL         "Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,163,95,72,10
-    PUSHBUTTON	    "Add application...",IDC_DLLS_ADDAPP,163,114,82,14
-    PUSHBUTTON	    "Remove application",IDC_DLLS_REMOVEAPP, 163,134,82,14
-    PUSHBUTTON	    "Add DLL override for:",IDC_DLLS_ADDDLL, 163,154,82,14
-    COMBOBOX        IDC_DLLLIST,163,174,82,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE
-    PUSHBUTTON	    "Remove DLL override",IDC_DLLS_REMOVEDLL,163,194,82,14
+    LTEXT           "Libraries can be specified individually to be either builtin or native. A DLL entry specified as ""*"" pertains to all DLLs not specified explicitly."
+                    ,  IDC_STATIC,15,17,228,32
+    CONTROL         "DLL Overrides", IDC_TREE_DLLS, "SysTreeView32", WS_BORDER | WS_TABSTOP | TVS_LINESATROOT | TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_HASBUTTONS, 15,50,142,187
+    LTEXT           "Load order:",IDC_STATIC,163,50,37,8
+    CONTROL         "Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,163,65,57,10
+    CONTROL         "Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,163,80,72,10
+    CONTROL         "Builtin, Native",IDC_RAD_BUILTIN_NATIVE,"Button", BS_AUTORADIOBUTTON,163,95,57,10
+    CONTROL         "Native, Builtin",IDC_RAD_NATIVE_BUILTIN,"Button", BS_AUTORADIOBUTTON,163,110,72,10
+    CONTROL         "Disable",IDC_RAD_DISABLE,"Button", BS_AUTORADIOBUTTON,163,125,72,10
+    PUSHBUTTON	    "Add application...",IDC_DLLS_ADDAPP,163,144,82,14
+    PUSHBUTTON	    "Remove application",IDC_DLLS_REMOVEAPP, 163,164,82,14
+    PUSHBUTTON	    "Add DLL override for:",IDC_DLLS_ADDDLL, 163,184,82,14
+    COMBOBOX        IDC_DLLLIST,163,204,82,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE
+    PUSHBUTTON	    "Remove DLL override",IDC_DLLS_REMOVEDLL,163,224,82,14
 END
 
 IDD_SYSTEMCFG DIALOG DISCARDABLE  0, 0, 260, 250
Index: programs/winecfg/libraries.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/libraries.c,v
retrieving revision 1.1
diff -u -r1.1 libraries.c
--- programs/winecfg/libraries.c	7 Jan 2004 00:43:40 -0000	1.1
+++ programs/winecfg/libraries.c	17 Feb 2004 12:08:33 -0000
@@ -37,10 +37,77 @@
 } DLGMODE;
 
 typedef enum _DLLMODE {
+	BUILTIN_NATIVE,
+	NATIVE_BUILTIN,
 	BUILTIN,
-	NATIVE
+	NATIVE,
+	DISABLE,
+	UNKNOWN /*Special value indicating an erronous DLL override mode*/
 } DLLMODE;
 
+static void removeSpaces(char* in, char* out)
+{
+  int i,j;
+  j = 0;
+  for (i = 0; i < strlen(in); i++)
+  {
+    if (in[i] != ' ')
+    {
+      out[j] = in[i];
+      j++;
+    }
+  }
+  out[j] = 0;
+}
+
+static DLLMODE Str2DLLMode(char* c)
+{
+  /*Parse a string into a DLLMode*/ 
+  char* d = HeapAlloc(GetProcessHeap(), 0, sizeof(c));
+  removeSpaces(c,d);
+  if (strcmp (d, "builtin,native") == 0) {
+    return BUILTIN_NATIVE;
+  } else
+  if (strcmp (d, "native,builtin") == 0) {
+    return NATIVE_BUILTIN;
+  } else
+  if (strcmp (d, "native") == 0){
+    return NATIVE;
+  } else
+  if (strcmp (d, "builtin") == 0) {
+    return BUILTIN;
+  } else
+  if (strcmp (d, "") == 0) {
+    return DISABLE;
+  } else
+    return UNKNOWN;
+}
+
+static char* DLLMode2Str(DLLMODE mode)
+{
+  char* res;
+  switch (mode) {
+    case NATIVE:
+      res = "native";
+      break;
+    case BUILTIN:
+      res = "builtin";
+      break;
+    case NATIVE_BUILTIN:
+      res = "native, builtin";
+      break;
+    case BUILTIN_NATIVE:
+      res = "builtin, native";
+      break;
+    case DISABLE:
+      res = "";
+      break;
+    default:
+      res = "unknown";
+  }
+  return strdup(res);
+}
+
 typedef struct _DLLOVERRIDE
 {
 	char* lpcKey;    /*The actual dll name*/
@@ -158,11 +225,9 @@
 			lpIt->lpDo = lpdo;
 			tis.u.item.lParam = (LPARAM)lpIt;
 			tis.u.item.pszText = name;
-			if (strncmp (read, "built", 5) == 0)
-				lpdo->mode = BUILTIN;
-			else
-				lpdo->mode = NATIVE;
-
+			
+			lpdo->mode = Str2DLLMode(read);
+			
 			TreeView_InsertItem(hwndTV,&tis);
 			UpdateDLLList(hDlg, name);
 			i ++; size = 255; readSize = 255;
@@ -176,10 +241,16 @@
 	if (dlgmode == DLL) {
 		enable(IDC_RAD_BUILTIN);
 		enable(IDC_RAD_NATIVE);
+		enable(IDC_RAD_BUILTIN_NATIVE);
+		enable(IDC_RAD_NATIVE_BUILTIN);
+		enable(IDC_RAD_DISABLE);
 		enable(IDC_DLLS_REMOVEDLL);
 	} else {
 		disable(IDC_RAD_BUILTIN);
 		disable(IDC_RAD_NATIVE);
+		disable(IDC_RAD_BUILTIN_NATIVE);
+		disable(IDC_RAD_NATIVE_BUILTIN);
+		disable(IDC_RAD_DISABLE);
 		disable(IDC_DLLS_REMOVEDLL);
 	}
 
@@ -227,6 +298,7 @@
 {
 	TVITEM ti;
 	LPITEMTAG lpit;
+	int buttonId;
 
 	ti.mask = TVIF_PARAM;
 	ti.hItem = TreeView_GetSelection(hTV);
@@ -236,11 +308,29 @@
 		if (lpit->lpDo)
 		{
 			WINE_TRACE("%s\n", lpit->lpDo->lpcKey);
-			if (lpit->lpDo->mode == BUILTIN) {
-				CheckRadioButton(hDlg, IDC_RAD_BUILTIN, IDC_RAD_NATIVE, IDC_RAD_BUILTIN);
-			} else {
-				CheckRadioButton(hDlg, IDC_RAD_BUILTIN, IDC_RAD_NATIVE, IDC_RAD_NATIVE);
+			buttonId = IDC_RAD_BUILTIN;
+			switch (lpit->lpDo->mode)
+			{
+				case NATIVE:
+					buttonId = IDC_RAD_NATIVE;
+					break;
+				case BUILTIN:
+					buttonId = IDC_RAD_BUILTIN;
+					break;
+				case NATIVE_BUILTIN:
+					buttonId = IDC_RAD_NATIVE_BUILTIN;
+					break;
+				case BUILTIN_NATIVE:
+					buttonId = IDC_RAD_BUILTIN_NATIVE;
+					break;
+				case DISABLE:
+					buttonId = IDC_RAD_DISABLE;
+					break;
+				case UNKNOWN:
+					buttonId = -1;
+					break;
 			}
+			CheckRadioButton(hDlg, IDC_RAD_BUILTIN, IDC_RAD_DISABLE, buttonId);
 			SetEnabledDLLControls(hDlg, DLL);
 		} else {
 			if (lpit->lpAppl)
@@ -272,11 +362,7 @@
 		if (lpit->lpDo)
 		{
 			lpit->lpDo->mode = mode;
-			if (mode == NATIVE)
-				cMode = "native, builtin";
-			else
-				cMode = "builtin, native";
-
+			cMode = DLLMode2Str (mode);
 			/*Find parent, so we can read registry section*/
 			tiPar.mask = TVIF_PARAM;
 			tiPar.hItem = TreeView_GetParent(hTV, ti.hItem);
@@ -288,6 +374,7 @@
 					addTransaction(lpitPar->lpAppl->lpcSection, lpit->lpDo->lpcKey, ACTION_SET, cMode);
 				}
 			}
+			free(cMode);
 		}
 	}
 }
@@ -302,6 +389,21 @@
 	SetDLLMode(hDlg, NATIVE);
 }
 
+static VOID OnBuiltinNativeClick(HWND hDlg)
+{
+	SetDLLMode(hDlg, BUILTIN_NATIVE);
+}
+
+static VOID OnNativeBuiltinClick(HWND hDlg)
+{
+	SetDLLMode(hDlg, NATIVE_BUILTIN);
+}
+
+static VOID OnDisableClick(HWND hDlg)
+{
+	SetDLLMode(hDlg, DISABLE);
+}
+
 static VOID OnTreeViewDeleteItem(NMTREEVIEW* nmt)
 {
 	FreeItemTag((LPITEMTAG)(nmt->itemOld.lParam));
@@ -362,7 +464,7 @@
 				tis.hParent = ti.hItem;
 				TreeView_InsertItem(hTV,&tis);
 				UpdateDLLList(hDlg, dll);
-				addTransaction(lpit->lpAppl->lpcSection, dll, ACTION_SET, "native, builtin");
+				addTransaction(lpit->lpAppl->lpcSection, dll, ACTION_SET, "native");
 			} else MessageBox(hDlg, "A DLL with that name is already in this list...", "", MB_OK | MB_ICONINFORMATION);
 		}
 	} else return;
@@ -485,6 +587,15 @@
 				break;
 			case IDC_RAD_NATIVE:
 				OnNativeClick(hDlg);
+				break;
+			case IDC_RAD_BUILTIN_NATIVE:
+				OnBuiltinNativeClick(hDlg);
+				break;
+			case IDC_RAD_NATIVE_BUILTIN:
+				OnNativeBuiltinClick(hDlg);
+				break;
+			case IDC_RAD_DISABLE:
+				OnDisableClick(hDlg);
 				break;
 			case IDC_DLLS_ADDAPP:
 				OnAddApplicationClick(hDlg);
Index: programs/winecfg/resource.h
===================================================================
RCS file: /home/wine/wine/programs/winecfg/resource.h,v
retrieving revision 1.12
diff -u -r1.12 resource.h
--- programs/winecfg/resource.h	7 Feb 2004 01:01:34 -0000	1.12
+++ programs/winecfg/resource.h	17 Feb 2004 12:08:33 -0000
@@ -55,7 +55,10 @@
 #define IDC_XSHM                        1028
 #define IDC_RAD_BUILTIN                 1029
 #define IDC_RAD_NATIVE                  1030
-#define IDC_TREE_DLLS                   1031
+#define IDC_RAD_BUILTIN_NATIVE          1031
+#define IDC_RAD_NATIVE_BUILTIN          1032
+#define IDC_RAD_DISABLE                 1033
+#define IDC_TREE_DLLS                   1034
 #define IDC_DLLS_ADDAPP                 8000
 #define IDC_DLLS_ADDDLL                 8001
 #define IDC_DLLS_REMOVEAPP              8002


More information about the wine-patches mailing list