Commit 2f1bc74b authored by Robert van Herk's avatar Robert van Herk Committed by Alexandre Julliard

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

"builtin,native" and "disable" for each library they override.
parent 393ae7d2
......@@ -85,17 +85,20 @@ STYLE WS_CHILD | WS_DISABLED
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
......
......@@ -37,10 +37,77 @@ typedef enum _DLGMODE
} 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 @@ static VOID LoadLibrarySettings(LPAPPL appl /*DON'T FREE, treeview will own this
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 @@ static VOID SetEnabledDLLControls(HWND dialog, DLGMODE dlgmode)
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 @@ static VOID OnTreeViewChangeItem(HWND hDlg, HWND hTV)
{
TVITEM ti;
LPITEMTAG lpit;
int buttonId;
ti.mask = TVIF_PARAM;
ti.hItem = TreeView_GetSelection(hTV);
......@@ -236,11 +308,29 @@ static VOID OnTreeViewChangeItem(HWND hDlg, HWND hTV)
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 @@ static VOID SetDLLMode(HWND hDlg, DLLMODE mode)
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 @@ static VOID SetDLLMode(HWND hDlg, DLLMODE mode)
addTransaction(lpitPar->lpAppl->lpcSection, lpit->lpDo->lpcKey, ACTION_SET, cMode);
}
}
free(cMode);
}
}
}
......@@ -302,6 +389,21 @@ static VOID OnNativeClick(HWND hDlg)
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 @@ static VOID OnAddDLLClick(HWND hDlg)
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;
......@@ -486,6 +588,15 @@ LibrariesDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
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);
break;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment