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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
// RunScanDisk.cpp : Implementation of CRunScanDisk
#include "stdafx.h"
#include "NSCmpts.h"
#include "RunScanDisk.h"
#include "../Common/Defines.h"
#include <appmisc.h>
/////////////////////////////////////////////////////////////////////////////
// CRunScanDisk
STDMETHODIMP CRunScanDisk::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_ISecureShutdownDOS,
};
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
//////////////////////////////////////////////////////////////////////
// This won't run under Windows NT so don't even show it
HRESULT CRunScanDisk::FinalConstruct()
{
if(::GetVersion() < 0x80000000)
return E_FAIL;
else
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// Returns text to put in Batch File
STDMETHODIMP CRunScanDisk::GetBatchText(BSTR* psText)
{
// This should never be true as the object shouldn't
// even be creatable under WIN NT;
// ASSERT(::GetPlatform() == VER_PLATFORM_WIN32_NT);
ASSERT(::GetVersion() >= 0x80000000);
// Format and return string with options
string sParamNoSave;
string sParamAutoFix;
if(m_Data.GetInt(_T("Auto Fix"), true))
{
sParamAutoFix.load_string(IDS_SCANDISK_AUTOFIX);
sParamNoSave.load_string(IDS_SCANDISK_NOSAVE);
if(!m_Data.GetInt(_T("Save Clusters"), false))
sParamNoSave = _T("");
}
string sRetVal;
sRetVal.format(IDS_SCANDISK_BATCHTEXT, (LPCTSTR)sParamAutoFix, (LPCTSTR)sParamNoSave);
CComBSTR bsRet(sRetVal);
*psText = bsRet.Detach();
return S_OK;
}
////////////////////////////////////////////////////////
// Returns Info about our object
STDMETHODIMP CRunScanDisk::get_Info(NightSecInfo nsItem, VARIANT* pvVal)
{
::VariantClear(pvVal);
CComBSTR bsRetVal;
switch(nsItem)
{
case nsName:
pvVal->vt = VT_BSTR;
bsRetVal.LoadString(IDS_SCANDISK_NAME);
pvVal->bstrVal = bsRetVal.Detach();
return S_OK;
case nsHelpText:
pvVal->vt = VT_BSTR;
bsRetVal.LoadString(IDS_SCANDISK_DESC);
pvVal->bstrVal = bsRetVal.Detach();
return S_OK;
}
::VariantClear(pvVal);
return S_FALSE;
}
////////////////////////////////////////////////////////
// Called to initialize our data object
STDMETHODIMP CRunScanDisk::SetData(IUnknown* pUnk)
{
return m_Data.Initialize(pUnk);
}
///////////////////////////////////////////////////////////////////////////////
// Property Page Stuff
// Updates all controls
bool CRunScanDisk::UpdateAutoFix()
{
bool bEnable = IsDlgButtonChecked(IDC_AUTOFIX) ? true : false;
::EnableWindow(GetDlgItem(IDC_SAVE), bEnable);
::EnableWindow(GetDlgItem(IDC_NOSAVE), bEnable);
return bEnable;
}
LRESULT CRunScanDisk::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// Load Auto Fix State
CheckDlgButton(IDC_AUTOFIX, m_Data.GetInt(_T("Auto Fix"), true));
// Load Save Clusters State
bool bSave = m_Data.GetInt(_T("Save Clusters"), false) ? true : false;
CheckDlgButton(IDC_SAVE, bSave);
CheckDlgButton(IDC_NOSAVE, !bSave);
UpdateAutoFix();
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
// Used to enable/disable controls
LRESULT CRunScanDisk::OnAutoFix(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
UpdateAutoFix();
SetDirty(true);
return 0;
}
|