This repository has been archived by the owner on Oct 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIEAmelioration.cpp
114 lines (95 loc) · 3.37 KB
/
IEAmelioration.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// IEAmelioration.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "IEAmelioration.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// IEAmelioration dialog
IEAmelioration::IEAmelioration(CWnd* pParent /*=NULL*/)
: CDialog(IEAmelioration::IDD, pParent)
{
//{{AFX_DATA_INIT(IEAmelioration)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void IEAmelioration::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(IEAmelioration)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(IEAmelioration, CDialog)
//{{AFX_MSG_MAP(IEAmelioration)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// IEAmelioration message handlers
BOOL IEAmelioration::OnInitDialog()
{
HKEY hKey = 0;
DWORD dwDisposition;
CDialog::OnInitDialog();
// JavaScript
if (RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("CLSID\\{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}\\InprocServer32"), 0, _T(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
{
wchar_t szBuff[256];
DWORD dwDataSize = 512;
if (RegQueryValueEx(hKey, _T("Default"), 0, 0, (LPBYTE)&szBuff, &dwDataSize) == ERROR_SUCCESS) {
if (! wcsicmp(szBuff, _T("\\windows\\jscript.dll"))){
this->CheckDlgButton(IDC_Java,true);
} else {
this->CheckDlgButton(IDC_Java,false);
}
}
RegCloseKey(hKey);
}
// VBScript
if (RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("CLSID\\{B54F3741-5B07-11CF-A4B0-00AA004A55E8}\\InprocServer32"), 0, _T(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
{
wchar_t szBuff[256];
DWORD dwDataSize = 512;
if (RegQueryValueEx(hKey, _T("Default"), 0, 0, (LPBYTE)&szBuff, &dwDataSize) == ERROR_SUCCESS) {
if (! wcsicmp(szBuff, _T("\\windows\\vbscript.dll"))){
this->CheckDlgButton(IDC_VB,true);
} else {
this->CheckDlgButton(IDC_VB,false);
}
}
RegCloseKey(hKey);
}
return TRUE;
}
void IEAmelioration::OnOK()
{
HKEY hKey = 0;
DWORD dwDisposition;
// JavaScript
if (RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("CLSID\\{F414C260-6AC0-11CF-B6D1-00AA00BBBB58}\\InprocServer32"), 0, _T(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
{
wchar_t* szScript = _T("\\windows\\jscript.dll");
if (this->IsDlgButtonChecked(IDC_Java)){
RegSetValueEx(hKey, _T("Default"), 0, REG_SZ, (LPBYTE)szScript, wcslen(szScript)*2+2);
} else {
RegSetValueEx(hKey, _T("Default"), 0, REG_SZ, (LPBYTE)_T(""), 2);
}
RegCloseKey(hKey);
}
// VBScript
if (RegCreateKeyEx(HKEY_CLASSES_ROOT, _T("CLSID\\{B54F3741-5B07-11CF-A4B0-00AA004A55E8}\\InprocServer32"), 0, _T(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
{
wchar_t* szScript = _T("\\windows\\vbscript.dll");
if (this->IsDlgButtonChecked(IDC_VB)){
RegSetValueEx(hKey, _T("Default"), 0, REG_SZ, (LPBYTE)szScript, wcslen(szScript)*2+2);
} else {
RegSetValueEx(hKey, _T("Default"), 0, REG_SZ, (LPBYTE)_T(""), 2);
}
RegCloseKey(hKey);
}
CDialog::OnOK();
}