summaryrefslogtreecommitdiff
path: root/NSCmpts/RunScanDisk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NSCmpts/RunScanDisk.cpp')
-rw-r--r--NSCmpts/RunScanDisk.cpp140
1 files changed, 140 insertions, 0 deletions
diff --git a/NSCmpts/RunScanDisk.cpp b/NSCmpts/RunScanDisk.cpp
new file mode 100644
index 0000000..60a3eb7
--- /dev/null
+++ b/NSCmpts/RunScanDisk.cpp
@@ -0,0 +1,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;
+}