From 0f0ee255f6e1a560ec6995a3cdb26e11b13b9aee Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 22 Jun 2006 21:14:42 +0200 Subject: [PATCH] oleview: Added system configuration dialog. --- programs/oleview/En.rc | 13 +++++++ programs/oleview/oleview.c | 77 ++++++++++++++++++++++++++++++++++++- programs/oleview/resource.h | 4 ++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/programs/oleview/En.rc b/programs/oleview/En.rc index 0baf385191c..767fc2cd5f4 100644 --- a/programs/oleview/En.rc +++ b/programs/oleview/En.rc @@ -128,3 +128,16 @@ FONT 8, "MS Shell Dlg" DEFPUSHBUTTON "&OK", IDOK, 200, 5, 45, 14 PUSHBUTTON "&Cancel", IDCANCEL, 200, 22, 45, 14 } + +DLG_SYSCONF DIALOG DISCARDABLE 0, 0, 170, 100 +STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_CAPTION | WS_SYSMENU +CAPTION "System Configuration" +FONT 8, "MS Shell Dlg" +{ + LTEXT "System Settings", IDIGNORE, 5, 6, 160, 8 + CHECKBOX "&Enable Distributed COM", IDC_ENABLEDCOM, 5, 20, 160, 10, WS_TABSTOP | WS_GROUP | BS_AUTOCHECKBOX + CHECKBOX "Enable &Remote Connections (Win95 only)", IDC_ENABLEREMOTE, 5, 35, 160, 10, WS_TABSTOP | WS_GROUP | BS_AUTOCHECKBOX + LTEXT "These settings changes only register values.\nIt has no effect on Wine performance.", IDIGNORE, 5, 50, 160, 40 + DEFPUSHBUTTON "&OK", IDOK, 70, 80, 45, 14 + PUSHBUTTON "&Cancel", IDCANCEL, 120, 80, 45, 14 +} diff --git a/programs/oleview/oleview.c b/programs/oleview/oleview.c index 3bd6dbf9b7f..fa6bdd92f81 100644 --- a/programs/oleview/oleview.c +++ b/programs/oleview/oleview.c @@ -24,7 +24,79 @@ GLOBALS globals; static WCHAR wszRegEdit[] = { 'r','e','g','e','d','i','t','.','e','x','e','\0' }; static WCHAR wszFormat[] = { '<','o','b','j','e','c','t','\n',' ',' ',' ', 'c','l','a','s','s','i','d','=','\"','c','l','s','i','d',':','%','s','\"','\n', - '>','\n','<','/','o','b','j','e','c','t','>' }; + '>','\n','<','/','o','b','j','e','c','t','>','\0' }; + +INT_PTR CALLBACK SysConfProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HKEY hKey; + WCHAR buffer[MAX_LOAD_STRING]; + DWORD bufSize; + + WCHAR wszReg[] = { 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\','O','L','E','\\','\0' }; + WCHAR wszEnableDCOM[] = { 'E','n','a','b','l','e','D','C','O','M','\0' }; + WCHAR wszEnableRemote[] = { 'E','n','a','b','l','e', + 'R','e','m','o','t','e','C','o','n','n','e','c','t','\0' }; + WCHAR wszYes[] = { 'Y', '\0' }; + WCHAR wszNo[] = { 'N', '\0' }; + + switch(uMsg) + { + case WM_INITDIALOG: + if(RegOpenKey(HKEY_LOCAL_MACHINE, wszReg, &hKey) != ERROR_SUCCESS) + RegCreateKey(HKEY_LOCAL_MACHINE, wszReg, &hKey); + + bufSize = sizeof(buffer); + if(RegGetValue(hKey, NULL, wszEnableDCOM, RRF_RT_REG_SZ, + NULL, buffer, &bufSize) != ERROR_SUCCESS) + { + bufSize = sizeof(wszYes); + RegSetValueEx(hKey, wszEnableDCOM, 0, REG_SZ, (BYTE*)wszYes, bufSize); + } + + CheckDlgButton(hDlgWnd, IDC_ENABLEDCOM, + buffer[0]=='Y' ? BST_CHECKED : BST_UNCHECKED); + + bufSize = sizeof(buffer); + if(RegGetValue(hKey, NULL, wszEnableRemote, RRF_RT_REG_SZ, + NULL, buffer, &bufSize) != ERROR_SUCCESS) + { + bufSize = sizeof(wszYes); + RegSetValueEx(hKey, wszEnableRemote, 0, REG_SZ, (BYTE*)wszYes, bufSize); + } + + CheckDlgButton(hDlgWnd, IDC_ENABLEREMOTE, + buffer[0]=='Y' ? BST_CHECKED : BST_UNCHECKED); + + RegCloseKey(hKey); + return TRUE; + case WM_COMMAND: + switch(LOWORD(wParam)) { + case IDOK: + bufSize = sizeof(wszYes); + + RegOpenKey(HKEY_LOCAL_MACHINE, wszReg, &hKey); + + RegSetValueEx(hKey, wszEnableDCOM, 0, REG_SZ, + IsDlgButtonChecked(hDlgWnd, IDC_ENABLEDCOM) == BST_CHECKED ? + (BYTE*)wszYes : (BYTE*)wszNo, bufSize); + + RegSetValueEx(hKey, wszEnableRemote, 0, REG_SZ, + IsDlgButtonChecked(hDlgWnd, IDC_ENABLEREMOTE) == BST_CHECKED ? + (BYTE*)wszYes : (BYTE*)wszNo, bufSize); + + RegCloseKey(hKey); + + EndDialog(hDlgWnd, IDOK); + return TRUE; + case IDCANCEL: + EndDialog(hDlgWnd, IDCANCEL); + return TRUE; + } + } + + return FALSE; +} INT_PTR CALLBACK CreateInstOnProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -295,6 +367,9 @@ int MenuCommand(WPARAM wParam, HWND hWnd) vis ? MF_UNCHECKED : MF_CHECKED); ResizeChild(); break; + case IDM_SYSCONF: + DialogBox(0, MAKEINTRESOURCE(DLG_SYSCONF), hWnd, SysConfProc); + break; case IDM_TOOLBAR: vis = IsWindowVisible(globals.hToolBar); ShowWindow(globals.hToolBar, vis ? SW_HIDE : SW_SHOW); diff --git a/programs/oleview/resource.h b/programs/oleview/resource.h index 2a6dc65ddb8..3554108cc88 100644 --- a/programs/oleview/resource.h +++ b/programs/oleview/resource.h @@ -70,3 +70,7 @@ #define DLG_CREATEINSTON 1000 #define IDC_MACHINE 1001 + +#define DLG_SYSCONF 1010 +#define IDC_ENABLEDCOM 1011 +#define IDC_ENABLEREMOTE 1012