Allow user to choose "native", "native,builtin", "builtin",

"builtin,native" and "disable" for each library they override.
This commit is contained in:
Robert van Herk 2004-02-17 20:26:15 +00:00 committed by Alexandre Julliard
parent 393ae7d204
commit 2f1bc74b2e
3 changed files with 145 additions and 28 deletions

View File

@ -85,17 +85,20 @@ STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
GROUPBOX "DLL Overrides",IDC_STATIC,8,4,244,240 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." 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,47 , 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,65,142,172 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,65,37,8 LTEXT "Load order:",IDC_STATIC,163,50,37,8
CONTROL "Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,163,80,57,10 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,95,72,10 CONTROL "Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,163,80,72,10
PUSHBUTTON "Add application...",IDC_DLLS_ADDAPP,163,114,82,14 CONTROL "Builtin, Native",IDC_RAD_BUILTIN_NATIVE,"Button", BS_AUTORADIOBUTTON,163,95,57,10
PUSHBUTTON "Remove application",IDC_DLLS_REMOVEAPP, 163,134,82,14 CONTROL "Native, Builtin",IDC_RAD_NATIVE_BUILTIN,"Button", BS_AUTORADIOBUTTON,163,110,72,10
PUSHBUTTON "Add DLL override for:",IDC_DLLS_ADDDLL, 163,154,82,14 CONTROL "Disable",IDC_RAD_DISABLE,"Button", BS_AUTORADIOBUTTON,163,125,72,10
COMBOBOX IDC_DLLLIST,163,174,82,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE PUSHBUTTON "Add application...",IDC_DLLS_ADDAPP,163,144,82,14
PUSHBUTTON "Remove DLL override",IDC_DLLS_REMOVEDLL,163,194,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 END
IDD_SYSTEMCFG DIALOG DISCARDABLE 0, 0, 260, 250 IDD_SYSTEMCFG DIALOG DISCARDABLE 0, 0, 260, 250

View File

@ -37,10 +37,77 @@ typedef enum _DLGMODE
} DLGMODE; } DLGMODE;
typedef enum _DLLMODE { typedef enum _DLLMODE {
BUILTIN_NATIVE,
NATIVE_BUILTIN,
BUILTIN, BUILTIN,
NATIVE NATIVE,
DISABLE,
UNKNOWN /*Special value indicating an erronous DLL override mode*/
} DLLMODE; } 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 typedef struct _DLLOVERRIDE
{ {
char* lpcKey; /*The actual dll name*/ char* lpcKey; /*The actual dll name*/
@ -158,11 +225,9 @@ static VOID LoadLibrarySettings(LPAPPL appl /*DON'T FREE, treeview will own this
lpIt->lpDo = lpdo; lpIt->lpDo = lpdo;
tis.u.item.lParam = (LPARAM)lpIt; tis.u.item.lParam = (LPARAM)lpIt;
tis.u.item.pszText = name; tis.u.item.pszText = name;
if (strncmp (read, "built", 5) == 0)
lpdo->mode = BUILTIN; lpdo->mode = Str2DLLMode(read);
else
lpdo->mode = NATIVE;
TreeView_InsertItem(hwndTV,&tis); TreeView_InsertItem(hwndTV,&tis);
UpdateDLLList(hDlg, name); UpdateDLLList(hDlg, name);
i ++; size = 255; readSize = 255; i ++; size = 255; readSize = 255;
@ -176,10 +241,16 @@ static VOID SetEnabledDLLControls(HWND dialog, DLGMODE dlgmode)
if (dlgmode == DLL) { if (dlgmode == DLL) {
enable(IDC_RAD_BUILTIN); enable(IDC_RAD_BUILTIN);
enable(IDC_RAD_NATIVE); enable(IDC_RAD_NATIVE);
enable(IDC_RAD_BUILTIN_NATIVE);
enable(IDC_RAD_NATIVE_BUILTIN);
enable(IDC_RAD_DISABLE);
enable(IDC_DLLS_REMOVEDLL); enable(IDC_DLLS_REMOVEDLL);
} else { } else {
disable(IDC_RAD_BUILTIN); disable(IDC_RAD_BUILTIN);
disable(IDC_RAD_NATIVE); disable(IDC_RAD_NATIVE);
disable(IDC_RAD_BUILTIN_NATIVE);
disable(IDC_RAD_NATIVE_BUILTIN);
disable(IDC_RAD_DISABLE);
disable(IDC_DLLS_REMOVEDLL); disable(IDC_DLLS_REMOVEDLL);
} }
@ -227,6 +298,7 @@ static VOID OnTreeViewChangeItem(HWND hDlg, HWND hTV)
{ {
TVITEM ti; TVITEM ti;
LPITEMTAG lpit; LPITEMTAG lpit;
int buttonId;
ti.mask = TVIF_PARAM; ti.mask = TVIF_PARAM;
ti.hItem = TreeView_GetSelection(hTV); ti.hItem = TreeView_GetSelection(hTV);
@ -236,11 +308,29 @@ static VOID OnTreeViewChangeItem(HWND hDlg, HWND hTV)
if (lpit->lpDo) if (lpit->lpDo)
{ {
WINE_TRACE("%s\n", lpit->lpDo->lpcKey); WINE_TRACE("%s\n", lpit->lpDo->lpcKey);
if (lpit->lpDo->mode == BUILTIN) { buttonId = IDC_RAD_BUILTIN;
CheckRadioButton(hDlg, IDC_RAD_BUILTIN, IDC_RAD_NATIVE, IDC_RAD_BUILTIN); switch (lpit->lpDo->mode)
} else { {
CheckRadioButton(hDlg, IDC_RAD_BUILTIN, IDC_RAD_NATIVE, IDC_RAD_NATIVE); 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); SetEnabledDLLControls(hDlg, DLL);
} else { } else {
if (lpit->lpAppl) if (lpit->lpAppl)
@ -272,11 +362,7 @@ static VOID SetDLLMode(HWND hDlg, DLLMODE mode)
if (lpit->lpDo) if (lpit->lpDo)
{ {
lpit->lpDo->mode = mode; lpit->lpDo->mode = mode;
if (mode == NATIVE) cMode = DLLMode2Str (mode);
cMode = "native, builtin";
else
cMode = "builtin, native";
/*Find parent, so we can read registry section*/ /*Find parent, so we can read registry section*/
tiPar.mask = TVIF_PARAM; tiPar.mask = TVIF_PARAM;
tiPar.hItem = TreeView_GetParent(hTV, ti.hItem); tiPar.hItem = TreeView_GetParent(hTV, ti.hItem);
@ -288,6 +374,7 @@ static VOID SetDLLMode(HWND hDlg, DLLMODE mode)
addTransaction(lpitPar->lpAppl->lpcSection, lpit->lpDo->lpcKey, ACTION_SET, cMode); addTransaction(lpitPar->lpAppl->lpcSection, lpit->lpDo->lpcKey, ACTION_SET, cMode);
} }
} }
free(cMode);
} }
} }
} }
@ -302,6 +389,21 @@ static VOID OnNativeClick(HWND hDlg)
SetDLLMode(hDlg, NATIVE); 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) static VOID OnTreeViewDeleteItem(NMTREEVIEW* nmt)
{ {
FreeItemTag((LPITEMTAG)(nmt->itemOld.lParam)); FreeItemTag((LPITEMTAG)(nmt->itemOld.lParam));
@ -362,7 +464,7 @@ static VOID OnAddDLLClick(HWND hDlg)
tis.hParent = ti.hItem; tis.hParent = ti.hItem;
TreeView_InsertItem(hTV,&tis); TreeView_InsertItem(hTV,&tis);
UpdateDLLList(hDlg, dll); 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 MessageBox(hDlg, "A DLL with that name is already in this list...", "", MB_OK | MB_ICONINFORMATION);
} }
} else return; } else return;
@ -486,6 +588,15 @@ LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_RAD_NATIVE: case IDC_RAD_NATIVE:
OnNativeClick(hDlg); OnNativeClick(hDlg);
break; 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: case IDC_DLLS_ADDAPP:
OnAddApplicationClick(hDlg); OnAddApplicationClick(hDlg);
break; break;

View File

@ -55,7 +55,10 @@
#define IDC_XSHM 1028 #define IDC_XSHM 1028
#define IDC_RAD_BUILTIN 1029 #define IDC_RAD_BUILTIN 1029
#define IDC_RAD_NATIVE 1030 #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_ADDAPP 8000
#define IDC_DLLS_ADDDLL 8001 #define IDC_DLLS_ADDDLL 8001
#define IDC_DLLS_REMOVEAPP 8002 #define IDC_DLLS_REMOVEAPP 8002