From 3f95d417d9e623ac0c74df8ef11d7a01846392dd Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 17 Sep 2003 19:07:23 +0000 Subject: Initial Import --- NSCmpts/ActionEngine.cpp | 276 ++++++++++++ NSCmpts/ActionEngine.h | 157 +++++++ NSCmpts/Backup.cpp | 177 ++++++++ NSCmpts/Backup.h | 64 +++ NSCmpts/Backup.rgs | 42 ++ NSCmpts/BackupActions.cpp | 293 +++++++++++++ NSCmpts/BackupActions.h | 113 +++++ NSCmpts/BackupAdvancedProp.cpp | 56 +++ NSCmpts/BackupAdvancedProp.h | 100 +++++ NSCmpts/BackupAdvancedProp.rgs | 13 + NSCmpts/BackupData.cpp | 105 +++++ NSCmpts/BackupData.h | 47 ++ NSCmpts/BackupDestProp.cpp | 67 +++ NSCmpts/BackupDestProp.h | 89 ++++ NSCmpts/BackupDestProp.rgs | 13 + NSCmpts/BackupProgress.cpp | 20 + NSCmpts/BackupSourceProp.cpp | 27 ++ NSCmpts/BackupSourceProp.h | 91 ++++ NSCmpts/BackupSourceProp.rgs | 13 + NSCmpts/CmptIfaces.h | 780 ++++++++++++++++++++++++++++++++++ NSCmpts/DeleteSwapFile.cpp | 95 +++++ NSCmpts/DeleteSwapFile.h | 71 ++++ NSCmpts/EmptyRecycleBin.cpp | 315 ++++++++++++++ NSCmpts/EmptyRecycleBin.h | 110 +++++ NSCmpts/EmptyRecycleBin.rgs | 42 ++ NSCmpts/EmptyTempFolder.cpp | 197 +++++++++ NSCmpts/EmptyTempFolder.h | 59 +++ NSCmpts/Encrypt.cpp | 144 +++++++ NSCmpts/Encrypt.h | 103 +++++ NSCmpts/Encrypt.rgs | 43 ++ NSCmpts/EncryptActions.cpp | 235 ++++++++++ NSCmpts/EncryptActions.h | 93 ++++ NSCmpts/EncryptAdvancedProp.cpp | 51 +++ NSCmpts/EncryptAdvancedProp.h | 104 +++++ NSCmpts/EncryptAdvancedProp.rgs | 14 + NSCmpts/EncryptData.cpp | 105 +++++ NSCmpts/EncryptData.h | 47 ++ NSCmpts/EncryptSourceProp.cpp | 28 ++ NSCmpts/EncryptSourceProp.h | 87 ++++ NSCmpts/EncryptSourceProp.rgs | 23 + NSCmpts/IDropTargetImpl.cpp | 20 + NSCmpts/IDropTargetImpl.h | 20 + NSCmpts/IgnoreProp.cpp | 179 ++++++++ NSCmpts/IgnoreProp.h | 51 +++ NSCmpts/NSCmpts.aps | Bin 0 -> 126400 bytes NSCmpts/NSCmpts.cpp | 130 ++++++ NSCmpts/NSCmpts.def | 9 + NSCmpts/NSCmpts.dsp | 695 ++++++++++++++++++++++++++++++ NSCmpts/NSCmpts.h | 298 +++++++++++++ NSCmpts/NSCmpts.idl | 123 ++++++ NSCmpts/NSCmpts.plg | 16 + NSCmpts/NSCmpts.rc | 516 ++++++++++++++++++++++ NSCmpts/NSCmptsps.def | 11 + NSCmpts/NSCmptsps.mk | 16 + NSCmpts/NSMessages.h | 35 ++ NSCmpts/NSSettings.h | 32 ++ NSCmpts/NightSecError.cpp | 176 ++++++++ NSCmpts/NightSecError.h | 134 ++++++ NSCmpts/ProgressDlg.cpp | 151 +++++++ NSCmpts/ProgressDlg.h | 73 ++++ NSCmpts/PromptClose.cpp | 11 + NSCmpts/PromptClose.h | 51 +++ NSCmpts/RunScanDisk.cpp | 140 ++++++ NSCmpts/RunScanDisk.h | 107 +++++ NSCmpts/SourceProp.cpp | 306 +++++++++++++ NSCmpts/SourceProp.h | 80 ++++ NSCmpts/StdAfx.cpp | 12 + NSCmpts/StdAfx.h | 48 +++ NSCmpts/TempActions.cpp | 153 +++++++ NSCmpts/TempActions.h | 79 ++++ NSCmpts/TempWarnDlg.cpp | 44 ++ NSCmpts/TempWarnDlg.h | 35 ++ NSCmpts/WipefreeSpace.cpp | 217 ++++++++++ NSCmpts/WipefreeSpace.h | 102 +++++ NSCmpts/dlldata.c | 40 ++ NSCmpts/res/161.avi | Bin 0 -> 14336 bytes NSCmpts/res/DeleteSwapFile.rgs | 42 ++ NSCmpts/res/EmptyTempFolder.rgs | 42 ++ NSCmpts/res/Night Security Worker.ico | Bin 0 -> 1078 bytes NSCmpts/res/RunScanDisk.rgs | 42 ++ NSCmpts/res/WipefreeSpace.rgs | 42 ++ NSCmpts/res/advanced.ico | Bin 0 -> 766 bytes NSCmpts/res/backup1.ico | Bin 0 -> 766 bytes NSCmpts/res/backupad.bin | 13 + NSCmpts/res/backupde.bin | 13 + NSCmpts/res/copyfile.ico | Bin 0 -> 766 bytes NSCmpts/res/cursor1.cur | Bin 0 -> 326 bytes NSCmpts/res/enc.avi | Bin 0 -> 45468 bytes NSCmpts/res/ico00001.ico | Bin 0 -> 2998 bytes NSCmpts/res/ico00002.ico | Bin 0 -> 766 bytes NSCmpts/res/ico00003.ico | Bin 0 -> 766 bytes NSCmpts/res/ico00004.ico | Bin 0 -> 766 bytes NSCmpts/res/ico00005.ico | Bin 0 -> 766 bytes NSCmpts/res/ico00006.ico | Bin 0 -> 766 bytes NSCmpts/res/ico00007.ico | Bin 0 -> 766 bytes NSCmpts/res/ico00008.ico | Bin 0 -> 766 bytes NSCmpts/res/icon1.ico | Bin 0 -> 766 bytes NSCmpts/res/icon2.ico | Bin 0 -> 766 bytes NSCmpts/res/idr_.bin | 23 + NSCmpts/res/items.ico | Bin 0 -> 766 bytes NSCmpts/res/n_161.avi | Bin 0 -> 10144 bytes NSCmpts/res/n_temp.avi | Bin 0 -> 11000 bytes NSCmpts/res/new1.ico | Bin 0 -> 766 bytes NSCmpts/res/recycle.ico | Bin 0 -> 2998 bytes NSCmpts/res/temp.avi | Bin 0 -> 12722 bytes NSCmpts/res/wxpy.ico | Bin 0 -> 766 bytes NSCmpts/resource.h | 168 ++++++++ 107 files changed, 9004 insertions(+) create mode 100644 NSCmpts/ActionEngine.cpp create mode 100644 NSCmpts/ActionEngine.h create mode 100644 NSCmpts/Backup.cpp create mode 100644 NSCmpts/Backup.h create mode 100644 NSCmpts/Backup.rgs create mode 100644 NSCmpts/BackupActions.cpp create mode 100644 NSCmpts/BackupActions.h create mode 100644 NSCmpts/BackupAdvancedProp.cpp create mode 100644 NSCmpts/BackupAdvancedProp.h create mode 100644 NSCmpts/BackupAdvancedProp.rgs create mode 100644 NSCmpts/BackupData.cpp create mode 100644 NSCmpts/BackupData.h create mode 100644 NSCmpts/BackupDestProp.cpp create mode 100644 NSCmpts/BackupDestProp.h create mode 100644 NSCmpts/BackupDestProp.rgs create mode 100644 NSCmpts/BackupProgress.cpp create mode 100644 NSCmpts/BackupSourceProp.cpp create mode 100644 NSCmpts/BackupSourceProp.h create mode 100644 NSCmpts/BackupSourceProp.rgs create mode 100644 NSCmpts/CmptIfaces.h create mode 100644 NSCmpts/DeleteSwapFile.cpp create mode 100644 NSCmpts/DeleteSwapFile.h create mode 100644 NSCmpts/EmptyRecycleBin.cpp create mode 100644 NSCmpts/EmptyRecycleBin.h create mode 100644 NSCmpts/EmptyRecycleBin.rgs create mode 100644 NSCmpts/EmptyTempFolder.cpp create mode 100644 NSCmpts/EmptyTempFolder.h create mode 100644 NSCmpts/Encrypt.cpp create mode 100644 NSCmpts/Encrypt.h create mode 100644 NSCmpts/Encrypt.rgs create mode 100644 NSCmpts/EncryptActions.cpp create mode 100644 NSCmpts/EncryptActions.h create mode 100644 NSCmpts/EncryptAdvancedProp.cpp create mode 100644 NSCmpts/EncryptAdvancedProp.h create mode 100644 NSCmpts/EncryptAdvancedProp.rgs create mode 100644 NSCmpts/EncryptData.cpp create mode 100644 NSCmpts/EncryptData.h create mode 100644 NSCmpts/EncryptSourceProp.cpp create mode 100644 NSCmpts/EncryptSourceProp.h create mode 100644 NSCmpts/EncryptSourceProp.rgs create mode 100644 NSCmpts/IDropTargetImpl.cpp create mode 100644 NSCmpts/IDropTargetImpl.h create mode 100644 NSCmpts/IgnoreProp.cpp create mode 100644 NSCmpts/IgnoreProp.h create mode 100644 NSCmpts/NSCmpts.aps create mode 100644 NSCmpts/NSCmpts.cpp create mode 100644 NSCmpts/NSCmpts.def create mode 100644 NSCmpts/NSCmpts.dsp create mode 100644 NSCmpts/NSCmpts.h create mode 100644 NSCmpts/NSCmpts.idl create mode 100644 NSCmpts/NSCmpts.plg create mode 100644 NSCmpts/NSCmpts.rc create mode 100644 NSCmpts/NSCmptsps.def create mode 100644 NSCmpts/NSCmptsps.mk create mode 100644 NSCmpts/NSMessages.h create mode 100644 NSCmpts/NSSettings.h create mode 100644 NSCmpts/NightSecError.cpp create mode 100644 NSCmpts/NightSecError.h create mode 100644 NSCmpts/ProgressDlg.cpp create mode 100644 NSCmpts/ProgressDlg.h create mode 100644 NSCmpts/PromptClose.cpp create mode 100644 NSCmpts/PromptClose.h create mode 100644 NSCmpts/RunScanDisk.cpp create mode 100644 NSCmpts/RunScanDisk.h create mode 100644 NSCmpts/SourceProp.cpp create mode 100644 NSCmpts/SourceProp.h create mode 100644 NSCmpts/StdAfx.cpp create mode 100644 NSCmpts/StdAfx.h create mode 100644 NSCmpts/TempActions.cpp create mode 100644 NSCmpts/TempActions.h create mode 100644 NSCmpts/TempWarnDlg.cpp create mode 100644 NSCmpts/TempWarnDlg.h create mode 100644 NSCmpts/WipefreeSpace.cpp create mode 100644 NSCmpts/WipefreeSpace.h create mode 100644 NSCmpts/dlldata.c create mode 100644 NSCmpts/res/161.avi create mode 100644 NSCmpts/res/DeleteSwapFile.rgs create mode 100644 NSCmpts/res/EmptyTempFolder.rgs create mode 100644 NSCmpts/res/Night Security Worker.ico create mode 100644 NSCmpts/res/RunScanDisk.rgs create mode 100644 NSCmpts/res/WipefreeSpace.rgs create mode 100644 NSCmpts/res/advanced.ico create mode 100644 NSCmpts/res/backup1.ico create mode 100644 NSCmpts/res/backupad.bin create mode 100644 NSCmpts/res/backupde.bin create mode 100644 NSCmpts/res/copyfile.ico create mode 100644 NSCmpts/res/cursor1.cur create mode 100644 NSCmpts/res/enc.avi create mode 100644 NSCmpts/res/ico00001.ico create mode 100644 NSCmpts/res/ico00002.ico create mode 100644 NSCmpts/res/ico00003.ico create mode 100644 NSCmpts/res/ico00004.ico create mode 100644 NSCmpts/res/ico00005.ico create mode 100644 NSCmpts/res/ico00006.ico create mode 100644 NSCmpts/res/ico00007.ico create mode 100644 NSCmpts/res/ico00008.ico create mode 100644 NSCmpts/res/icon1.ico create mode 100644 NSCmpts/res/icon2.ico create mode 100644 NSCmpts/res/idr_.bin create mode 100644 NSCmpts/res/items.ico create mode 100644 NSCmpts/res/n_161.avi create mode 100644 NSCmpts/res/n_temp.avi create mode 100644 NSCmpts/res/new1.ico create mode 100644 NSCmpts/res/recycle.ico create mode 100644 NSCmpts/res/temp.avi create mode 100644 NSCmpts/res/wxpy.ico create mode 100644 NSCmpts/resource.h (limited to 'NSCmpts') diff --git a/NSCmpts/ActionEngine.cpp b/NSCmpts/ActionEngine.cpp new file mode 100644 index 0000000..59673b1 --- /dev/null +++ b/NSCmpts/ActionEngine.cpp @@ -0,0 +1,276 @@ +// ActionEngine.cpp: implementation of the CActionEngine class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ActionEngine.h" + +#include "NSMessages.h" +#include + +////////////////////////////////////////////////////////////////////// +// CActionEngine + +// Starts with only this action +HRESULT CActionEngine::Start(CAction* pFirstAction) +{ + ASSERT(pFirstAction); + clear(); + pFirstAction->addref(); + push_back(pFirstAction); + return Start(); +} + +/////////////////////////////////////////////////////////////////////// +// Starts the Actual Processing + +HRESULT CActionEngine::Start() +{ + HRESULT hr = S_OK; + CAction* pAction = NULL; + UINT nDone = 0; + + // Keep going while there are actions to process + while(size()) + { + // Get current action + pAction = at(0); + ASSERT(pAction); + + try + { + // Do Action + pAction->Do(this, m_hwndUpdates); + + } + catch(CActionError& e) + { + if(m_hwndErrors) + { + // Send Error to Window + NS_ERROR_DATA nsErr; + nsErr.hRes = e.m_hRes; + nsErr.szDesc = e.m_sDesc; + nsErr.lParam = (LPARAM)pAction; + + ::SendMessage(m_hwndErrors, NSM_ERROR, NULL, (LPARAM)&nsErr); + } + + hr = E_FAIL; + } + + // Update the Window + nDone++; + + if(m_hwndUpdates) + { + // Send Update Message + NS_UPDATE_DATA nsUpd; + nsUpd.lCur = nDone; + nsUpd.lTot = nDone + size(); + nsUpd.szMessage1 = NULL; + nsUpd.szMessage2 = NULL; + + // If message returns false then cancel + if(!::SendMessage(m_hwndUpdates, NSM_UPDATE, NULL, (LPARAM)&nsUpd)) + { + hr = E_ABORT; + break; + } + } + + // Remove action from array and release it + erase(begin()); + pAction->release(); + } + + return hr; +} + +///////////////////////////////////////////////////////////////////// +// Starts the Engine in another thread +HANDLE CActionEngine::StartThread() +{ + DWORD dwThreadID = NULL; + return (HANDLE)CreateThread(NULL, 0, ThreadProc, + (LPVOID)this, 0, &dwThreadID); +} + +DWORD CALLBACK CActionEngine::ThreadProc(LPVOID lpParam) +{ + // Need to Initialize for this thread + // BUG: This didn't work in Win95 (non-OSR2) because + // only have CoInitialize + // HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + HRESULT hr = CoInitialize(NULL); + + ASSERT(lpParam); + + CActionEngine* pEngine = (CActionEngine*)lpParam; + HRESULT hRet = pEngine->Start(); + + if(SUCCEEDED(hr)) + CoUninitialize(); + + // Return the result of the engine + // as our thread exit code + return hRet; +} + +// Sets the pointers for the update windows +void CActionEngine::SetUpdates(HWND hwndUpdates /*= NULL*/, + HWND hwndErrors /*= NULL*/) +{ + m_hwndUpdates = hwndUpdates; + m_hwndErrors = hwndErrors; +} + + +/////////////////////////////////////////////////////////////// +// Array Management Stuff + +UINT CActionEngine::Add(CAction* pAction) +{ + ASSERT(pAction); + pAction->addref(); + push_back(pAction); + return size(); +} + +UINT CActionEngine::Insert(CAction* pAction, UINT nIndex) +{ + ASSERT(pAction); + ASSERT(nIndex < size()); + pAction->addref(); + insert(begin() + nIndex, pAction); + return nIndex; +} + +void CActionEngine::Remove(UINT nIndex) +{ + ASSERT(nIndex < size()); + CAction* pAction = at(nIndex); + erase(begin() + nIndex); + pAction->release(); +} + +void CActionEngine::RemoveAll(CAction* pKeep /*= NULL*/) +{ + if(pKeep) + pKeep->addref(); + + while(size()) + { + CAction* pAction = at(0); + pAction->release(); + erase(begin()); + } + + if(pKeep) + { + Add(pKeep); + pKeep->release(); + } +} + +CAction* CActionEngine::At(UINT nIndex) +{ + ASSERT(nIndex < size()); + return at(nIndex); +} + + + + + +//////////////////////////////////////////////////////////////////////// +// CAction Helper Function +//////////////////////////////////////////////////////////////////////// + +void CAction::Update(HWND hwndUpdates, LPCTSTR szDesc) +{ + // Send a message with only the string valid + NS_UPDATE_DATA nsUpd; + nsUpd.lCur = -1; + nsUpd.lTot = -1; + nsUpd.szMessage1 = NULL; + nsUpd.szMessage2 = szDesc; + + ::SendMessage(hwndUpdates, NSM_UPDATE, NULL, (LPARAM)&nsUpd); +} + +void CAction::Update(HWND hwndUpdates, LPCTSTR szStatus, LPCTSTR szDesc) +{ + // Send a message with only the string valid + NS_UPDATE_DATA nsUpd; + nsUpd.lCur = -1; + nsUpd.lTot = -1; + nsUpd.szMessage1 = szStatus; + nsUpd.szMessage2 = szDesc; + + ::SendMessage(hwndUpdates, NSM_UPDATE, NULL, (LPARAM)&nsUpd); +} + + + +////////////////////////////////////////////////////////////////////// +// CActionError Construction Helper Functions + +inline CActionError::CActionError(HRESULT hr, const string& sMessage, + const file_path& path /*= file_path()*/) +{ + Construct(hr, sMessage, path); +} + +CActionError::CActionError(HRESULT hr, UINT nID, + const file_path& path /*= file_path()*/) +{ + string sTemp; + sTemp.load_string(nID); + Construct(hr, sTemp, path); +} + +CActionError::CActionError(const string& sError, HRESULT hr, UINT nID, + const file_path& path /*= file_path()*/) +{ + string sTemp; + sTemp.load_string(nID); + Construct(sError, hr, sTemp, path); +} + +inline CActionError::CActionError(const string& sError, HRESULT hr, const string& sMessage, + const file_path& path /*= file_path()*/) +{ + Construct(sError, hr, sMessage, path); +} + + +void CActionError::Construct(const string& sError, HRESULT hr, string sMessage, const file_path& path) +{ + // Replace with custom message before passing on + sMessage.replace(_T("%e"), sError); + Construct(hr, sMessage, path); +} + +void CActionError::Construct(HRESULT hr, string sMessage, const file_path& path) +{ + m_hRes = hr; + + // If there's a need then replace + if(sMessage.find(_T("%e")) != string::npos) + sMessage.replace(_T("%e"), FormatHR(m_hRes)); + + // Same here + if(path.valid()) + { + sMessage.replace(_T("%f"), path.file()); + sMessage.replace(_T("%F"), path); + } + + m_sDesc = sMessage; +} + +void Lower(string& s) +{ + s.make_lower(); +} diff --git a/NSCmpts/ActionEngine.h b/NSCmpts/ActionEngine.h new file mode 100644 index 0000000..301ed81 --- /dev/null +++ b/NSCmpts/ActionEngine.h @@ -0,0 +1,157 @@ +// ActionEngine.h: interface for the CActionEngine class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ACTIONENGINE_H__00EC1855_A1A5_11D3_82DB_0020182B97FC__INCLUDED_) +#define AFX_ACTIONENGINE_H__00EC1855_A1A5_11D3_82DB_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include "NSMessages.h" + +//////////////////////////////////////////////////////////////////////// +// Hooks onto any object to provide reference count services + +template +class counted_obj +{ +public: + counted_obj() + { m_lCount = 0; } + long addref() + { return ++m_lCount; } + long release() + { + long lCount = --m_lCount; + + if(lCount <= 0) + delete (TBase*)this; + + return lCount; + } +protected: + long m_lCount; +}; + +//////////////////////////////////////////////////////////////////////// +// Forward Declarations + +class CAction; // Action processed by the Action Engine +class CActionError; // Error thrown by an Action +class CActionEngine; // The Engine + +///////////////////////////////////////////////////////////////////////// +// Abstract class: An Action for the Action Engine + +class CAction + : public counted_obj +{ +public: + CAction() {}; + virtual ~CAction() {}; + + // Does the actual action + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates) + throw(CActionError) = 0; + // Retry after an error + virtual bool IsRetryable() const throw() = 0; + + // Try and fix after there's an error + virtual void Fix(HRESULT hr) throw(CActionError) = 0; + virtual bool IsFixable(HRESULT hr) const throw() = 0; + +protected: + // Helper function for implementations + // Updates the dialog + void Update(HWND hwndUpdates, LPCTSTR szDesc); + void Update(HWND hwndUpdates, LPCTSTR szStatus, LPCTSTR szDesc); +}; + + + +////////////////////////////////////////////////////////////////////// +// An Error thrown by an Action Object and caught by Action Engine +// With built in formatting +// +// %e Error Text +// %f File Name +// %F Full File Path + +class CActionError +{ +// Constructors +public: + // These two get the error message from the HRESULT + CActionError(HRESULT hr, const string& sMessage, + const file_path& path = file_path()); + CActionError(HRESULT hr, UINT nID, + const file_path& path = file_path()); + + // These two ask you to supply the error message + CActionError(const string& sError, HRESULT hr, UINT nID, + const file_path& path = file_path()); + CActionError(const string& sError, HRESULT hr, const string& sMessage, + const file_path& path = file_path()); + + string m_sDesc; // Formatted Error Text + HRESULT m_hRes; // Original HRESULT + +// Helper Functions +protected: + void Construct(HRESULT hr, string sMessage, const file_path& path); + void Construct(const string& sError, HRESULT hr, string sMessage, + const file_path& path); +}; + +///////////////////////////////////////////////////////////////////////// +// The Engine that processes CAction objects +// Derives from a vector of Action pointers + +typedef std::vector action_array; + +class CActionEngine + : protected action_array +{ +// Construction +public: + CActionEngine() {}; + CActionEngine(CAction* pFirstAction) + { push_back(pFirstAction); } + virtual ~CActionEngine() + { RemoveAll(); }; + +// Actions +public: + // These start engine in current thread + HRESULT Start(CAction* pFirstAction); + HRESULT Start(); + + // Start engine in another thread and return immediately + HANDLE StartThread(); + +// Set Properties +public: + void SetUpdates(HWND hwndUpdates = NULL, HWND hwndErrors = NULL); + +// A few array management functions for the outside world +public: + UINT Add(CAction* pAction); + UINT Insert(CAction* pAction, UINT nIndex); + void Remove(UINT nIndex); + void RemoveAll(CAction* pKeep = NULL); + CAction* At(UINT nIndex); + +protected: + HWND m_hwndUpdates; // Window to Send Updates to + HWND m_hwndErrors; // Window to Send Errors to + + // Used to start in a separate thread + static DWORD CALLBACK ThreadProc(LPVOID lpParam); +}; + +void Lower(string& s); +#endif // !defined(AFX_ACTIONENGINE_H__00EC1855_A1A5_11D3_82DB_0020182B97FC__INCLUDED_) + diff --git a/NSCmpts/Backup.cpp b/NSCmpts/Backup.cpp new file mode 100644 index 0000000..5f108bd --- /dev/null +++ b/NSCmpts/Backup.cpp @@ -0,0 +1,177 @@ +// Backup.cpp : Implementation of CBackup + +#include "stdafx.h" +#include "NSCmpts.h" +#include "Backup.h" +#include "ProgressDlg.h" +#include + +///////////////////////////////////////////////////////////////////////////// +// CBackup + +STDMETHODIMP CBackup::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownWin + }; + for (int i=0;iget_Info(nsAdvanced, &var); + + if(var.vt == VT_BOOL && var.bVal == TRUE) + return pAdvancedPropMap; + } + + return pNormalPropMap; +} + +/*static DWORD CALLBACK BackupProc(LPVOID lpParam) +{ + CActionEngine* pEngine = (CActionEngine*)lpParam; + return pEngine->Start(); +} +*/ + +STDMETHODIMP CBackup::DoShutdown(long hParent, long lMode) +{ + // Whether or not to show prompts + bool bPrompt = lMode & nsNoPrompt ? false : true; + + // We don't support this option yet + // bool bSilent = lMode & nsQuiet ? true : false; + + // Create the dialog + CActionProgressDlg dlgProgress(m_spUnkSite, IDD_PROGRESSBACKUP); + dlgProgress.Create((HWND)hParent); + dlgProgress.PlayAmination(IDR_AVIBACKUP); + + // Create the first Action + string sTemp = m_Data.GetString(NS_BACKUP_REG_ENGINE, _T("Archive")); + + HRESULT hr = S_OK; + + // Date based backup + if(sTemp == _T("Date")) + { + CBackupActions::DatePrepare* pAction = new CBackupActions::DatePrepare; + hr = pAction->Initialize(m_Data); + m_Engine.Add(pAction); + } + // Archive Based Backup + else + { + CBackupActions::ArchivePrepare* pAction = new CBackupActions::ArchivePrepare; + hr = pAction->Initialize(m_Data); + m_Engine.Add(pAction); + } + + if(FAILED(hr)) + { + if(bPrompt) + MessageBoxTimeout((HWND)hParent, _T("The backup options aren't set up correctly. \n\nRun Night Security Checklist to set the options."), _T("Night Security Backup"), MB_OK | MB_ICONWARNING, 15000, 5000); + + dlgProgress.DestroyWindow(); + return E_INVALIDARG; + } + + // Init the update_monitor + m_Engine.SetUpdates(dlgProgress, dlgProgress); + + // start the backup + HANDLE hThread = m_Engine.StartThread(); + + // Wait for the Thread + WaitForAndIdle(1, &hThread, INFINITE); + + // Get the HRESULT from the Thread + GetExitCodeThread(hThread, (LPDWORD)&hr); + + // Close Dialog + dlgProgress.DestroyWindow(); + + return hr; +} + +// Gets Miscellaneous Info about the Object +STDMETHODIMP CBackup::get_Info(NightSecInfo nsItem, VARIANT* pvVal) +{ + ::VariantClear(pvVal); + + CComBSTR bsRetVal; + + switch(nsItem) + { + case nsName: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_BACKUPNAME); + pvVal->bstrVal = bsRetVal; + return S_OK; + case nsHelpText: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_BACKUPDESC); + pvVal->bstrVal = bsRetVal; + return S_OK; + case nsCmdLine: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_BACKUPPARAM); + pvVal->bstrVal = bsRetVal; + return S_OK; + case nsForceShow: // We have to have our pages shown + pvVal->vt = VT_BOOL; + pvVal->bVal = TRUE; + return S_OK; + case nsCopyAble: + pvVal->vt = VT_BOOL; + pvVal->bVal = TRUE; + return S_OK; + } + + return S_FALSE; +} + +STDMETHODIMP CBackup::SetData(IUnknown* pUnk) +{ + return m_Data.Initialize(pUnk); +} + +/*UINT CBackup::LoadPaths() +{ + m_destPath = m_Data.GetString(NS_BACKUP_REG_DEST, _T("")); + return m_Data.GetStringSet(NS_BACKUP_REG_SOURCE, m_srcPaths); +} +*/ diff --git a/NSCmpts/Backup.h b/NSCmpts/Backup.h new file mode 100644 index 0000000..8cc0c3e --- /dev/null +++ b/NSCmpts/Backup.h @@ -0,0 +1,64 @@ +// Backup.h : Declaration of the CBackup + +#ifndef __BACKUP_H_ +#define __BACKUP_H_ + +#include "resource.h" // main symbols + +#include "ActionEngine.h" +#include "BackupActions.h" + +#include "../common/interfaces.h" +#include + +///////////////////////////////////////////////////////////////////////////// +// CBackup +class ATL_NO_VTABLE CBackup : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl, + public IObjectWithSiteImpl, + public ISpecifyPropertyPagesImplEx +{ +public: + CBackup() + { } + ~CBackup() + { ATLTRACE(_T("Destroying Backup\n")); } + +DECLARE_REGISTRY_RESOURCEID(IDR_BACKUP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CBackup) + COM_INTERFACE_ENTRY(ISecureShutdownWin) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY(IObjectWithSite) + COM_INTERFACE_ENTRY(ISpecifyPropertyPages) +END_COM_MAP() + + // Custom version of normal property Map Mechanism (atlextra.h) + virtual ATL_PROPMAP_ENTRY* GetPropertyMap(); + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownWin +public: + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + STDMETHOD(DoShutdown)(/*[in]*/ long hParent, /*[in]*/ long lMode); + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + +protected: + + CActionEngine m_Engine; // The Engine + CPropertyBag m_Data; // Standard Data Object + +// UINT LoadPaths(); +// string_array m_srcPaths; +// file_path m_destPath; +}; + +#endif //__BACKUP_H_ diff --git a/NSCmpts/Backup.rgs b/NSCmpts/Backup.rgs new file mode 100644 index 0000000..de94758 --- /dev/null +++ b/NSCmpts/Backup.rgs @@ -0,0 +1,42 @@ +HKCR +{ + NightSecurity.Backup.25 = s 'Backup Class' + { + CLSID = s '{2E47D920-3D64-11D3-BF0A-0020182B97FC}' + } + NightSecurity.Backup = s 'Backup Class' + { + CurVer = s 'NightSecurity.Backup.25' + CLSID = s '{2E47D920-3D64-11D3-BF0A-0020182B97FC}' + } + NoRemove CLSID + { + ForceRemove {2E47D920-3D64-11D3-BF0A-0020182B97FC} = s 'Backup Class' + { + ProgID = s 'NightSecurity.Backup.25' + VersionIndependentProgID = s 'NightSecurity.Backup' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.Backup' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/BackupActions.cpp b/NSCmpts/BackupActions.cpp new file mode 100644 index 0000000..0dff71e --- /dev/null +++ b/NSCmpts/BackupActions.cpp @@ -0,0 +1,293 @@ +// BackupActions.cpp: implementation of the CBackupActions class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "BackupActions.h" + +#include "resource.h" +#include + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +bool CBackupActions::ArchivePrepare::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + // Some Checks + ASSERT(pEngine != NULL); + + if(!m_dest.valid()) + throw CActionError(E_INVALIDARG, IDS_BACKUP_ERR_DEST, m_dest); + + // Create destination folder + HRESULT hr = m_dest.create(); + if(FAILED(hr)) + throw CActionError(hr, IDS_BACKUP_ERR_CREATE_DEST, m_dest); + + // This could take a while so message + Update(hwndUpdates, _T("Listing files to backup..."), NULL); + + // Iterate through source folders + string_array::const_iterator iterSrc; + for(iterSrc = m_src.begin(); iterSrc != m_src.end(); iterSrc++) + { + Update(hwndUpdates, NULL, (LPCTSTR)*iterSrc); + + // Variables Used below + file_path srcPath = *iterSrc; + file_path srcFile; + file_path destFile; + + file_iterator fileIter(srcPath.files_begin(file_iterator::sub_folders)); + file_iterator end; + + for( ; fileIter != end; fileIter++) + { + // Check if it has the ARCHIVE attribute set + if(!(fileIter->dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)) + continue; + + if(fileIter->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + continue; + + // Make File Paths + srcFile = *iterSrc; + + // Destination is root destination + same folder structure as + // original folder + destFile = m_dest; + + if(srcFile.attributes() & FILE_ATTRIBUTE_DIRECTORY) + destFile += *(srcFile.end(false) - 1); + + destFile += fileIter->cFileName; + + srcFile = srcFile.folder() + fileIter->cFileName; + + + // Make sure extension is not in list + if(m_asIgnore.find(srcFile.ext().make_lower()) == m_asIgnore.end()) + { + // Add the file + ArchiveCopy* pCopy = new ArchiveCopy(srcFile, destFile); + pEngine->Add(pCopy); + } + } + + // Error from file_iterator (listing folders) + if(fileIter.state() != ERROR_SUCCESS) + throw CActionError(HRESULT_FROM_WIN32(fileIter.state()), IDS_BACKUP_ERR_LIST, (file_path)*iterSrc); + } + + return false; +} + +HRESULT CBackupActions::BasePrepare::Initialize(const CPropertyBag& data) +{ + m_dest = data.GetString(NS_BACKUP_REG_DEST, _T("")); + data.GetStringSet(NS_BACKUP_REG_SOURCE, m_src); + + string_array asTemp; + data.GetStringSet(NS_IGNORE_REG_EXT, asTemp); + + // Make them all lower + for_each(asTemp.begin(), asTemp.end(), Lower); + + // And copy them to the set (removes doubles) + copy(asTemp.begin(), asTemp.end(), inserter(m_asIgnore, m_asIgnore.begin())); + + // Remove any blanks from ignore + m_asIgnore.erase(_T("")); + + if(!m_dest.valid()) + return E_INVALIDARG; + + return S_OK; +} + +#define FILETIME_TO_64(ft) \ + ((__int64) (ft.dwLowDateTime | ((__int64)(ft.dwHighDateTime << 32)))) + + +bool CBackupActions::DatePrepare::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + // Some Checks + ASSERT(pEngine != NULL); + + if(!m_dest.valid()) + throw CActionError(E_INVALIDARG, IDS_BACKUP_ERR_DEST, m_dest); + + // Create destination folder + HRESULT hr = m_dest.create(); + if(FAILED(hr)) + throw CActionError(hr, IDS_BACKUP_ERR_CREATE_DEST, m_dest); + + // This could take a while so message + Update(hwndUpdates, _T("Comparing dates on backup files..."), NULL); + + HANDLE hFile; + FILETIME ftModify; + + // Iterate through source folders + string_array::const_iterator iterSrc; + for(iterSrc = m_src.begin(); iterSrc != m_src.end(); iterSrc++) + { + Update(hwndUpdates, NULL, (LPCTSTR)*iterSrc); + + // Variables Used below + file_path srcPath = *iterSrc; + file_path srcFile; + file_path destFile; + + file_iterator fileIter(srcPath.files_begin(file_iterator::sub_folders)); + file_iterator end; + + for( ; fileIter != end; fileIter++) + { + if(fileIter->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + continue; + + // Make File Paths + srcFile = *iterSrc; + + // Destination is root destination + same folder structure as + // original folder + destFile = m_dest; + + if(srcFile.attributes() & FILE_ATTRIBUTE_DIRECTORY) + destFile += *(srcFile.end(false) - 1); + + destFile += fileIter->cFileName; + + srcFile = srcFile.folder() + fileIter->cFileName; + + + // Make sure extension is not in list + if(m_asIgnore.find(srcFile.ext().make_lower()) != m_asIgnore.end()) + continue; + + // Open the file + hFile = CreateFile(destFile, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, 0, NULL); + + // Check return Value + if(hFile == INVALID_HANDLE_VALUE) + { + // If no file then Backup + switch(::GetLastError()) + { + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + break; + default: + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_BACKUP_ERR_FILE, m_dest); + } + } + else + { + // Get the filetime + ftModify.dwHighDateTime = 0; + ftModify.dwLowDateTime = 0; + + if(!GetFileTime(hFile, NULL, NULL, &ftModify)) + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_BACKUP_ERR_FILE, destFile); + + CloseHandle(hFile); + + // Are we newer? + if(FILETIME_TO_64(fileIter->ftLastWriteTime) <= FILETIME_TO_64(ftModify)) + continue; + } + + // Add the file + ArchiveCopy* pCopy = new ArchiveCopy(srcFile, destFile); + pEngine->Add(pCopy); + + } + + // Error from file_iterator (listing folders) + if(fileIter.state() != ERROR_SUCCESS) + throw CActionError(HRESULT_FROM_WIN32(fileIter.state()), IDS_BACKUP_ERR_LIST, (file_path)*iterSrc); + } + + return false; +} + +bool CBackupActions::ArchiveCopy::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ +start: + try + { + // Update any monitors + Update(hwndUpdates, _T("Copying..."), m_src); + + // Create the folder this file is in + HRESULT hr = m_dest.folder().create(); + if(FAILED(hr)) + throw CActionError(hr, IDS_BACKUP_ERR_CREATE_DEST, m_dest.folder()); + + // SetAttributes of the file to make sure it's not read-only + // when read-only CopyFile fails (CopyFile copies attributes) + ::SetFileAttributes(m_dest, FILE_ATTRIBUTE_NORMAL); + + // Copy. Don't worry about overwriting old files + if(!CopyFile(m_src, m_dest, FALSE)) + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_BACKUP_ERR_COPY, m_src); + + // Remove the Archive Attribute of the file + SetFileAttributes(m_src, m_src.attributes() ^ FILE_ATTRIBUTE_ARCHIVE); + + return false; + } + catch(CActionError& err) + { + switch(err.m_hRes) + { + case ERROR_HANDLE_DISK_FULL: + case ERROR_DISK_FULL: + case ERROR_DESTINATION_ELEMENT_FULL: + case STG_E_MEDIUMFULL: + { + string sTemp; + sTemp.format(IDS_BACKUP_ERR_DISKFULL, (LPCTSTR)m_src.root()); + + if(IDYES == MessageBoxTimeout(hwndUpdates, sTemp, _T("Secure Shutdown"), MB_OKCANCEL | MB_ICONQUESTION, 15000, 5000)) + break; + } + default: + throw; + } + + } + + goto start; +} + +bool CBackupActions::DateCopy::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + // Update any monitors + Update(hwndUpdates, _T("Copying..."), m_src); + + // Create the folder this file is in + HRESULT hr = m_dest.folder().create(); + if(FAILED(hr)) + throw CActionError(hr, IDS_BACKUP_ERR_CREATE_DEST, m_dest.folder()); + + // SetAttributes of the file to make sure it's not read-only + // when read-only CopyFile fails (CopyFile copies attributes) + ::SetFileAttributes(m_dest, FILE_ATTRIBUTE_NORMAL); + + // Copy. Don't worry about overwriting old files + if(!CopyFile(m_src, m_dest, FALSE)) + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_BACKUP_ERR_COPY, m_src); + + return false; + + // We don't try to catch disk full errors (and prompt for another disk) + // because that doesn't make any sense in a date based backup +} diff --git a/NSCmpts/BackupActions.h b/NSCmpts/BackupActions.h new file mode 100644 index 0000000..ae1a977 --- /dev/null +++ b/NSCmpts/BackupActions.h @@ -0,0 +1,113 @@ +// BackupActions.h: interface for the CBackupActions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_BACKUPACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) +#define AFX_BACKUPACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ActionEngine.h" +#include +#include + +#include "../common/cmptdata.h" + +class CBackupActions +{ +public: + /////////////////////////////////////////////////////// + // Holds the data read functionality for all the + // Different types of backups + class BasePrepare : public CAction + { + public: + BasePrepare() {}; + + // Read Our own Data here + HRESULT Initialize(const CPropertyBag& data); + + protected: + file_path m_dest; + string_array m_src; + string_set m_asIgnore; + }; + + //////////////////////////////////////////////////// + // This action is the first action to go into + // the engine. It adds all the other actions + class ArchivePrepare : public BasePrepare + { + public: + ArchivePrepare() {}; + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT) { } + virtual bool IsFixable(HRESULT) const + { return false; } + virtual bool IsRetryable() const + { return false; } + }; + + //////////////////////////////////////////////////// + // This action is the first action to go into + // the engine. It adds all the other actions + class DatePrepare : public BasePrepare + { + public: + DatePrepare() {}; + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT) { } + virtual bool IsFixable(HRESULT) const + { return false; } + virtual bool IsRetryable() const + { return false; } + }; + + ////////////////////////////////////////////////////// + // Standard Archive Backup File + class ArchiveCopy : public CAction + { + public: + ArchiveCopy(const file_path& src, const file_path& dest) + : m_src(src), m_dest(dest) + { } + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT) { } + virtual bool IsFixable(HRESULT) const + { return false; } + virtual bool IsRetryable() const + { return true; } + + protected: + file_path m_dest; + file_path m_src; + }; + + ////////////////////////////////////////////////////// + // Standard Date Backup File + class DateCopy : public CAction + { + public: + DateCopy(const file_path& src, const file_path& dest) + : m_src(src), m_dest(dest) + { } + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT/* hr*/) { } + virtual bool IsFixable(HRESULT/* hr*/) const + { return false; } + virtual bool IsRetryable() const + { return true; } + + protected: + file_path m_dest; + file_path m_src; + }; +}; + +#endif // !defined(AFX_BACKUPACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/BackupAdvancedProp.cpp b/NSCmpts/BackupAdvancedProp.cpp new file mode 100644 index 0000000..d1c03d9 --- /dev/null +++ b/NSCmpts/BackupAdvancedProp.cpp @@ -0,0 +1,56 @@ +// BackupAdvancedProp.cpp : Implementation of CBackupAdvancedProp +#include "stdafx.h" +#include "NSCmpts.h" +#include "BackupAdvancedProp.h" + +///////////////////////////////////////////////////////////////////////////// +// CBackupAdvancedProp Property Sheet Stuff + +LRESULT CBackupAdvancedProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Let it choose an object to get data from + m_Data.Initialize(m_nObjects, m_ppUnk); + + // Set this for CIgnoreProp + m_hwndIgnore = m_hWnd; + + // Let the Ignore stuff initialize + CIgnoreProp::OnInitDialog(uMsg, wParam, lParam, bHandled); + + // Setup the Combo box + m_sEngineType = m_Data.GetString(NS_BACKUP_REG_ENGINE, _T("Archive")); + + m_ctlEngine = GetDlgItem(IDC_ENGINE_TYPE); + m_ctlEngine.AddString(_T("Archive")); + m_ctlEngine.AddString(_T("Date")); + + UpdateData(false); + + bHandled = true; + return TRUE; +} + +LRESULT CBackupAdvancedProp::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Just in case, before going out + UpdateData(true); + return 0; +} + +void CBackupAdvancedProp::UpdateData(bool bSave) +{ + // Let it save/load first + CIgnoreProp::UpdateData(bSave); + + if(bSave) + { + // Get Selected Text + int nSel = m_ctlEngine.GetCurSel(); + m_ctlEngine.GetLBText(nSel, m_sEngineType.get_buffer(m_ctlEngine.GetLBTextLen(nSel))); + } + else + { + // Just Select the Appropriate One + m_ctlEngine.SelectString(-1, m_sEngineType); + } +} diff --git a/NSCmpts/BackupAdvancedProp.h b/NSCmpts/BackupAdvancedProp.h new file mode 100644 index 0000000..5f1fa49 --- /dev/null +++ b/NSCmpts/BackupAdvancedProp.h @@ -0,0 +1,100 @@ +// BackupAdvancedProp.h : Declaration of the CBackupAdvancedProp + +#ifndef __BACKUPADVANCEDPROP_H_ +#define __BACKUPADVANCEDPROP_H_ + +#include "resource.h" // main symbols +#include +#include "../common/CmptData.h" +#include "IgnoreProp.h" +#include +#include + +EXTERN_C const CLSID CLSID_BackupAdvancedProp; + +///////////////////////////////////////////////////////////////////////////// +// CBackupAdvancedProp +class ATL_NO_VTABLE CBackupAdvancedProp : + public CComObjectRootEx, + public CComCoClass, + public IPropertyPageImpl, + public CDialogImplEx, + public CIgnoreProp, + public CContextHelp +{ +// Construction +public: + CBackupAdvancedProp() : CIgnoreProp(m_Data), CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLEBackupAdvancedProp; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGBackupAdvancedProp; + } + ~CBackupAdvancedProp() + { ATLTRACE(_T("Destroying BackupAdvancedProp\n")); } + + enum {IDD = IDD_BACKUPADVANCED}; + +DECLARE_REGISTRY_RESOURCEID(IDR_BACKUPADVANCEDPROP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CBackupAdvancedProp) + COM_INTERFACE_ENTRY(IPropertyPage) +END_COM_MAP() + +BEGIN_MSG_MAP(CBackupAdvancedProp) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + NOTIFY_HANDLER(IDC_IGNORE_LIST, LVN_ENDLABELEDIT, OnEndLabelEdit) + NOTIFY_HANDLER(IDC_IGNORE_LIST, NM_SETFOCUS, OnListSetFocus) + NOTIFY_HANDLER(IDC_IGNORE_LIST, LVN_KEYDOWN, OnKeyDown) + COMMAND_ID_HANDLER(IDC_NEW, OnAdd) + COMMAND_ID_HANDLER(IDC_DEL, OnRemove) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_ENGINE_TYPE, 4002) + HELP_ID(IDC_IGNORE_LIST, 4005) + HELP_ID(IDC_NEW, 4018) + HELP_ID(IDC_DEL, 4017) +END_HELP_MAP + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CBackupAdvancedProp::Apply\n")); + m_Data.Initialize(m_nObjects, m_ppUnk); + + if(!m_Data.IsInitialized()) + E_FAIL; + + UpdateData(true); + + m_Data.WriteStringSet(NS_IGNORE_REG_EXT, m_asExtensions); + m_Data.WriteString(NS_BACKUP_REG_ENGINE, m_sEngineType); + + m_bDirty = FALSE; + return S_OK; + } + +protected: + // Controls for Dialog + CComboBox m_ctlEngine; + + // Data Stuff + CPropertyBag m_Data; + string m_sEngineType; + void UpdateData(bool bSave = true); +}; + +#endif //__BACKUPADVANCEDPROP_H_ diff --git a/NSCmpts/BackupAdvancedProp.rgs b/NSCmpts/BackupAdvancedProp.rgs new file mode 100644 index 0000000..6a0546a --- /dev/null +++ b/NSCmpts/BackupAdvancedProp.rgs @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {E85A26C3-946D-11D3-BFC4-0020182B97FC} = s 'Backup Advanced Properties' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/BackupData.cpp b/NSCmpts/BackupData.cpp new file mode 100644 index 0000000..5459f2a --- /dev/null +++ b/NSCmpts/BackupData.cpp @@ -0,0 +1,105 @@ +// BackupData.cpp: implementation of the CBackupData class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "BackupData.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +UINT CBackupData::m_nExtensions = 0; +UINT CBackupData::m_nSources = 0; + + +UINT CBackupData::LoadExtensions(string_array& asExt, const CPropertyBag& settings) +{ + int nCnt = 0; // Number of URLs from Registry + string sExt; + string sKeyName; + + // Format Key Name + sKeyName.format(NS_BACKUP_REG_EXT, nCnt++); + + while((sExt = settings.GetString(sKeyName, NS_NO_KEY)) != NS_NO_KEY) + { + asExt.push_back(sExt); + sKeyName.format(NS_BACKUP_REG_EXT, nCnt++); + } + + m_nExtensions = max(m_nExtensions, --nCnt); + return nCnt; +} + +UINT CBackupData::SaveExtensions(const string_array& asExt, CPropertyBag& settings) +{ + UINT nCnt = 0; // Number of URLs from Registry + string sKeyName = _T(""); + + string_array::const_iterator iter = asExt.begin(); + for(; iter != asExt.end(); iter++) + { + sKeyName.format(NS_BACKUP_REG_EXT, nCnt++); + settings.WriteString(sKeyName, *iter); + } + + UINT nRet = nCnt - 1; + + for(; nCnt < m_nExtensions; nCnt++) + { + // Format Registry Key + sKeyName.format(NS_BACKUP_REG_EXT, nCnt); + settings.DeleteProperty(sKeyName); + } + + m_nExtensions = 0; + + return nRet; +} + +UINT CBackupData::LoadSources(file_array& aSources, const CPropertyBag& settings) +{ + int nCnt = 0; + string sPath; + string sKeyName; + + // Format Key Name + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt++); + + // Add URLs to List Box + while((sPath = settings.GetString(sKeyName, NS_NO_KEY)) != NS_NO_KEY) + { + aSources.push_back(sPath); + + // Format Key Name + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt++); + } + + return m_nSources = --nCnt; + +} + +UINT CBackupData::SaveSources(const file_array& aSources, CPropertyBag& settings) +{ + UINT nCnt = 0; // Number of URLs from Registry + string sKeyName; + + file_array::const_iterator iter = aSources.begin(); + for(; iter != aSources.end(); iter++) + { + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt++); + settings.WriteString(sKeyName, *iter); + } + + UINT nRet = nCnt - 1; + + for(; nCnt < m_nSources; nCnt++) + { + // Format Registry Key + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt); + settings.DeleteProperty(sKeyName); + } + + return nRet; +} diff --git a/NSCmpts/BackupData.h b/NSCmpts/BackupData.h new file mode 100644 index 0000000..a424d40 --- /dev/null +++ b/NSCmpts/BackupData.h @@ -0,0 +1,47 @@ +// BackupData.h: interface for the CBackupData class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_BACKUPDATA_H__00EC1850_A1A5_11D3_82DB_0020182B97FC__INCLUDED_) +#define AFX_BACKUPDATA_H__00EC1850_A1A5_11D3_82DB_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include + +#include +typedef std::vector string_array; + +#include +typedef std::vector file_array; + +#include "../common/cmptdata.h" + +#define NS_NO_KEY _T("No Key") +#define NS_BACKUP_REG_EXT _T("Ignore%.4d") +#define NS_BACKUP_REG_SOURCE _T("Source%.4d") +#define NS_BACKUP_REG_DEST _T("Destination") +#define NS_BACKUP_REG_ENGINE _T("Engine") + +class CBackupData +{ +public: + CBackupData() { }; + + // For Filtering and Advanced Property Sheet + static UINT LoadExtensions(string_array& asExt, const CPropertyBag& settings); + static UINT SaveExtensions(const string_array& asExt, CPropertyBag& settings); + + // For Backup and Source Property Sheet + static UINT LoadSources(file_array& aSources, const CPropertyBag& settings); + static UINT SaveSources(const file_array& aSources, CPropertyBag& settings); + +protected: + static UINT m_nExtensions; + static UINT m_nSources; +}; + +#endif // !defined(AFX_BACKUPDATA_H__00EC1850_A1A5_11D3_82DB_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/BackupDestProp.cpp b/NSCmpts/BackupDestProp.cpp new file mode 100644 index 0000000..6153945 --- /dev/null +++ b/NSCmpts/BackupDestProp.cpp @@ -0,0 +1,67 @@ +// BackupDestProp.cpp : Implementation of CBackupDestProp +#include "stdafx.h" +#include "NSCmpts.h" +#include "BackupDestProp.h" + +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CBackupDestProp + +LRESULT CBackupDestProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Let it choose an object to get data from + m_Data.Initialize(m_nObjects, m_ppUnk); + + // Set Control Text + m_sPath = m_Data.GetString(NS_BACKUP_REG_DEST, _T("")); + SetDlgItemText(IDC_DEST, m_sPath); + + return TRUE; // Let the system set the focus +} + +LRESULT CBackupDestProp::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Last resort. Save text in case of Destroy somewhere + GetDlgItemText(IDC_DEST, m_sPath.get_buffer(MAX_PATH), MAX_PATH); + m_sPath.release_buffer(); + + return 0; +} + +LRESULT CBackupDestProp::OnBrowse(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + // Show a Browse for Folder Dialog + + LPMALLOC pMalloc; + if(FAILED(::SHGetMalloc(&pMalloc))) + return 0; + + BROWSEINFO bi; + bi.hwndOwner = m_hWnd; + bi.pidlRoot = NULL; + bi.pszDisplayName = m_sPath.get_buffer(MAX_PATH); + bi.lpszTitle = _T("Choose folder to backup to:"); + bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; + bi.lpfn = NULL; + bi.lParam = 0; + + LPITEMIDLIST pidl = SHBrowseForFolder(&bi); + + if(pidl == NULL) + return 0; + + m_sPath.release_buffer(); + + if(::SHGetPathFromIDList(pidl, m_sPath.get_buffer(MAX_PATH))) + ::SetWindowText(GetDlgItem(IDC_DEST), m_sPath); + + m_sPath.release_buffer(); + + pMalloc->Free(pidl); + pMalloc->Release(); + + bHandled = true; + return 0; +} diff --git a/NSCmpts/BackupDestProp.h b/NSCmpts/BackupDestProp.h new file mode 100644 index 0000000..0c7e1ee --- /dev/null +++ b/NSCmpts/BackupDestProp.h @@ -0,0 +1,89 @@ +// BackupDestProp.h : Declaration of the CBackupDestProp + +#ifndef __BACKUPDESTPROP_H_ +#define __BACKUPDESTPROP_H_ + +#include "resource.h" // main symbols +#include "../common/cmptdata.h" +#include + +EXTERN_C const CLSID CLSID_BackupDestProp; + +///////////////////////////////////////////////////////////////////////////// +// CBackupDestProp +class ATL_NO_VTABLE CBackupDestProp : + public CComObjectRootEx, + public CComCoClass, + public IPropertyPageImpl, + public CDialogImplEx, + public CContextHelp +{ +// Construction +public: + CBackupDestProp() : CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLEBackupDestProp; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGBackupDestProp; + } + ~CBackupDestProp() + { ATLTRACE(_T("Destroying BackupDestProp\n")); } + + enum {IDD = IDD_BACKUPDEST}; + +DECLARE_REGISTRY_RESOURCEID(IDR_BACKUPDESTPROP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CBackupDestProp) + COM_INTERFACE_ENTRY(IPropertyPage) +END_COM_MAP() + +BEGIN_MSG_MAP(CBackupDestProp) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + COMMAND_ID_HANDLER(IDC_BROWSE, OnBrowse) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_DEST, 4004) + HELP_ID(IDC_BROWSE, 4003) +END_HELP_MAP + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnBrowse(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + // Get text from Control first if poss + if(IsWindow()) + { + GetDlgItemText(IDC_DEST, m_sPath.get_buffer(MAX_PATH), MAX_PATH); + m_sPath.release_buffer(); + } + + if(!m_Data.IsInitialized()) + m_Data.Initialize(m_nObjects, m_ppUnk); + + if(!m_Data.IsInitialized()) + return E_FAIL; + + m_Data.WriteString(NS_BACKUP_REG_DEST, m_sPath); + m_bDirty = FALSE; + return S_OK; + } + +protected: + CPropertyBag m_Data; + string m_sPath; +}; + +#endif //__BACKUPDESTPROP_H_ diff --git a/NSCmpts/BackupDestProp.rgs b/NSCmpts/BackupDestProp.rgs new file mode 100644 index 0000000..54bec7e --- /dev/null +++ b/NSCmpts/BackupDestProp.rgs @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {E85A26C2-946D-11D3-BFC4-0020182B97FC} = s 'Backup Destination Properties' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/BackupProgress.cpp b/NSCmpts/BackupProgress.cpp new file mode 100644 index 0000000..4f0a062 --- /dev/null +++ b/NSCmpts/BackupProgress.cpp @@ -0,0 +1,20 @@ +// BackupProgress.cpp: implementation of the CBackupProgress class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "BackupProgress.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CBackupProgress::CBackupProgress() +{ + +} + +CBackupProgress::~CBackupProgress() +{ + +} diff --git a/NSCmpts/BackupSourceProp.cpp b/NSCmpts/BackupSourceProp.cpp new file mode 100644 index 0000000..a311ffb --- /dev/null +++ b/NSCmpts/BackupSourceProp.cpp @@ -0,0 +1,27 @@ +// BackupSourceProp.cpp : Implementation of CBackupSourceProp +#include "stdafx.h" +#include "NSCmpts.h" +#include "BackupSourceProp.h" + +///////////////////////////////////////////////////////////////////////////// +// CBackupSourceProp + +LRESULT CBackupSourceProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + CSourceProp::OnInitDialog(uMsg, wParam, lParam, bHandled); + + // Let it choose an object for data + m_Data.Initialize(m_nObjects, m_ppUnk); + + // Load the File List + if(m_Data.IsInitialized()) + m_Data.GetStringSet(NS_BACKUP_REG_SOURCE, m_aPaths); + + UpdateData(false); + + // Change Caption Text + SetDlgItemText(IDC_MESSAGE, _T("Backup these files or folders: ")); + + return TRUE; +} + diff --git a/NSCmpts/BackupSourceProp.h b/NSCmpts/BackupSourceProp.h new file mode 100644 index 0000000..8d258be --- /dev/null +++ b/NSCmpts/BackupSourceProp.h @@ -0,0 +1,91 @@ +// BackupSourceProp.h : Declaration of the CBackupSourceProp + +#ifndef __BACKUPSOURCEPROP_H_ +#define __BACKUPSOURCEPROP_H_ + +#include "resource.h" // main symbols + +#include "../common/cmptdata.h" +#include + +#include "sourceprop.h" + + +EXTERN_C const CLSID CLSID_BackupSourceProp; + +///////////////////////////////////////////////////////////////////////////// +// CBackupSourceProp +class ATL_NO_VTABLE CBackupSourceProp : + public CComObjectRootEx, + public CComCoClass, + public IPropertyPageImpl, + + // Get's most of functionality from here + public CSourceProp, + public CContextHelp +{ + +// Construction +public: + CBackupSourceProp() + { + m_dwTitleID = IDS_TITLEBackupSourceProp; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGBackupSourceProp; + } + ~CBackupSourceProp() + { ATLTRACE(_T("Destroying BackupSourceProp\n")); } + + +DECLARE_REGISTRY_RESOURCEID(IDR_BACKUPSOURCEPROP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CBackupSourceProp) + COM_INTERFACE_ENTRY(IPropertyPage) + COM_INTERFACE_ENTRY(IDropTarget) +END_COM_MAP() + +BEGIN_MSG_MAP(CBackupSourceProp) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + CHAIN_MSG_MAP(CSourceProp) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_SOURCE_LIST, 4007) + HELP_ID(IDC_ADD, 4001) + HELP_ID(IDC_REMOVE, 4006) +END_HELP_MAP + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CBackupSourceProp::Apply\n")); + + m_Data.Initialize(m_nObjects, m_ppUnk); + + if(!m_Data.IsInitialized()) + return E_FAIL; + + UpdateData(true); + + m_Data.WriteStringSet(NS_BACKUP_REG_SOURCE, m_aPaths); + + m_bDirty = FALSE; + return S_OK; + } + +protected: + CPropertyBag m_Data; + +}; + +#endif //__BACKUPSOURCEPROP_H_ diff --git a/NSCmpts/BackupSourceProp.rgs b/NSCmpts/BackupSourceProp.rgs new file mode 100644 index 0000000..eac62e0 --- /dev/null +++ b/NSCmpts/BackupSourceProp.rgs @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {E85A26C1-946D-11D3-BFC4-0020182B97FC} = s 'Backup Source Properties' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/CmptIfaces.h b/NSCmpts/CmptIfaces.h new file mode 100644 index 0000000..56c30a8 --- /dev/null +++ b/NSCmpts/CmptIfaces.h @@ -0,0 +1,780 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sat Mar 04 13:53:21 2000 + */ +/* Compiler settings for E:\Projects\NightSec\Interfaces\CmptIfaces.idl: + Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __CmptIfaces_h__ +#define __CmptIfaces_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ISecureShutdownWin_FWD_DEFINED__ +#define __ISecureShutdownWin_FWD_DEFINED__ +typedef interface ISecureShutdownWin ISecureShutdownWin; +#endif /* __ISecureShutdownWin_FWD_DEFINED__ */ + + +#ifndef __ISecureShutdownDOS_FWD_DEFINED__ +#define __ISecureShutdownDOS_FWD_DEFINED__ +typedef interface ISecureShutdownDOS ISecureShutdownDOS; +#endif /* __ISecureShutdownDOS_FWD_DEFINED__ */ + + +#ifndef __INightSecError_FWD_DEFINED__ +#define __INightSecError_FWD_DEFINED__ +typedef interface INightSecError INightSecError; +#endif /* __INightSecError_FWD_DEFINED__ */ + + +#ifndef __INightSecErrorFix_FWD_DEFINED__ +#define __INightSecErrorFix_FWD_DEFINED__ +typedef interface INightSecErrorFix INightSecErrorFix; +#endif /* __INightSecErrorFix_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +/* interface __MIDL_itf_CmptIfaces_0000 */ +/* [local] */ + +typedef /* [helpstring][uuid][v1_enum] */ +enum NightSecInfo + { nsName = 0, + nsCmdLine = nsName + 1, + nsHelpText = nsCmdLine + 1, + nsForceShow = nsHelpText + 1, + nsHideNormal = nsForceShow + 1, + nsCopyAble = nsHideNormal + 1, + nsHelpFile = nsCopyAble + 1, + nsHelpTopic = nsHelpFile + 1 + } NightSecInfo; + +/* [helpstring] */ #define nsNoPrompt ( 0x2 ) + +/* [helpstring] */ #define nsQuiet ( 0x4 ) + + + +extern RPC_IF_HANDLE __MIDL_itf_CmptIfaces_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_CmptIfaces_0000_v0_0_s_ifspec; + +#ifndef __ISecureShutdownWin_INTERFACE_DEFINED__ +#define __ISecureShutdownWin_INTERFACE_DEFINED__ + +/* interface ISecureShutdownWin */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISecureShutdownWin; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("34F11691-F275-11d2-A589-0020182B97FC") + ISecureShutdownWin : public IDispatch + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE DoShutdown( + /* [in] */ long hParent, + /* [in] */ long Mode) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetData( + /* [in] */ IUnknown __RPC_FAR *pUnk) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Info( + /* [in] */ NightSecInfo nsItem, + /* [retval][out] */ VARIANT __RPC_FAR *pvVal) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISecureShutdownWinVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ISecureShutdownWin __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ISecureShutdownWin __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ISecureShutdownWin __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DoShutdown )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ long hParent, + /* [in] */ long Mode); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetData )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pUnk); + + /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Info )( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ NightSecInfo nsItem, + /* [retval][out] */ VARIANT __RPC_FAR *pvVal); + + END_INTERFACE + } ISecureShutdownWinVtbl; + + interface ISecureShutdownWin + { + CONST_VTBL struct ISecureShutdownWinVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISecureShutdownWin_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISecureShutdownWin_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISecureShutdownWin_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISecureShutdownWin_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISecureShutdownWin_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISecureShutdownWin_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISecureShutdownWin_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISecureShutdownWin_DoShutdown(This,hParent,Mode) \ + (This)->lpVtbl -> DoShutdown(This,hParent,Mode) + +#define ISecureShutdownWin_SetData(This,pUnk) \ + (This)->lpVtbl -> SetData(This,pUnk) + +#define ISecureShutdownWin_get_Info(This,nsItem,pvVal) \ + (This)->lpVtbl -> get_Info(This,nsItem,pvVal) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISecureShutdownWin_DoShutdown_Proxy( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ long hParent, + /* [in] */ long Mode); + + +void __RPC_STUB ISecureShutdownWin_DoShutdown_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISecureShutdownWin_SetData_Proxy( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pUnk); + + +void __RPC_STUB ISecureShutdownWin_SetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISecureShutdownWin_get_Info_Proxy( + ISecureShutdownWin __RPC_FAR * This, + /* [in] */ NightSecInfo nsItem, + /* [retval][out] */ VARIANT __RPC_FAR *pvVal); + + +void __RPC_STUB ISecureShutdownWin_get_Info_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISecureShutdownWin_INTERFACE_DEFINED__ */ + + +#ifndef __ISecureShutdownDOS_INTERFACE_DEFINED__ +#define __ISecureShutdownDOS_INTERFACE_DEFINED__ + +/* interface ISecureShutdownDOS */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISecureShutdownDOS; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("34F11692-F275-11d2-A589-0020182B97FC") + ISecureShutdownDOS : public IDispatch + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetBatchText( + /* [retval][out] */ BSTR __RPC_FAR *psText) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetData( + /* [in] */ IUnknown __RPC_FAR *pUnk) = 0; + + virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Info( + /* [in] */ NightSecInfo nsItem, + /* [retval][out] */ VARIANT __RPC_FAR *pvVal) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISecureShutdownDOSVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ISecureShutdownDOS __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ISecureShutdownDOS __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ISecureShutdownDOS __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBatchText )( + ISecureShutdownDOS __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *psText); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetData )( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pUnk); + + /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Info )( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ NightSecInfo nsItem, + /* [retval][out] */ VARIANT __RPC_FAR *pvVal); + + END_INTERFACE + } ISecureShutdownDOSVtbl; + + interface ISecureShutdownDOS + { + CONST_VTBL struct ISecureShutdownDOSVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISecureShutdownDOS_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISecureShutdownDOS_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISecureShutdownDOS_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISecureShutdownDOS_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISecureShutdownDOS_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISecureShutdownDOS_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISecureShutdownDOS_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISecureShutdownDOS_GetBatchText(This,psText) \ + (This)->lpVtbl -> GetBatchText(This,psText) + +#define ISecureShutdownDOS_SetData(This,pUnk) \ + (This)->lpVtbl -> SetData(This,pUnk) + +#define ISecureShutdownDOS_get_Info(This,nsItem,pvVal) \ + (This)->lpVtbl -> get_Info(This,nsItem,pvVal) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISecureShutdownDOS_GetBatchText_Proxy( + ISecureShutdownDOS __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *psText); + + +void __RPC_STUB ISecureShutdownDOS_GetBatchText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISecureShutdownDOS_SetData_Proxy( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pUnk); + + +void __RPC_STUB ISecureShutdownDOS_SetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE ISecureShutdownDOS_get_Info_Proxy( + ISecureShutdownDOS __RPC_FAR * This, + /* [in] */ NightSecInfo nsItem, + /* [retval][out] */ VARIANT __RPC_FAR *pvVal); + + +void __RPC_STUB ISecureShutdownDOS_get_Info_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISecureShutdownDOS_INTERFACE_DEFINED__ */ + + +#ifndef __INightSecError_INTERFACE_DEFINED__ +#define __INightSecError_INTERFACE_DEFINED__ + +/* interface INightSecError */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_INightSecError; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("409C4B09-9310-11d3-BFC1-0020182B97FC") + INightSecError : public IUnknown + { + public: + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Err( + /* [retval][out] */ HRESULT __RPC_FAR *pbsRet) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Description( + /* [retval][out] */ BSTR __RPC_FAR *pbsRet) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_HelpFile( + /* [retval][out] */ BSTR __RPC_FAR *pbsRet) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_HelpContext( + /* [retval][out] */ long __RPC_FAR *plRet) = 0; + + }; + +#else /* C style interface */ + + typedef struct INightSecErrorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + INightSecError __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + INightSecError __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + INightSecError __RPC_FAR * This); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Err )( + INightSecError __RPC_FAR * This, + /* [retval][out] */ HRESULT __RPC_FAR *pbsRet); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Description )( + INightSecError __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbsRet); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_HelpFile )( + INightSecError __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbsRet); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_HelpContext )( + INightSecError __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *plRet); + + END_INTERFACE + } INightSecErrorVtbl; + + interface INightSecError + { + CONST_VTBL struct INightSecErrorVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INightSecError_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define INightSecError_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define INightSecError_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define INightSecError_get_Err(This,pbsRet) \ + (This)->lpVtbl -> get_Err(This,pbsRet) + +#define INightSecError_get_Description(This,pbsRet) \ + (This)->lpVtbl -> get_Description(This,pbsRet) + +#define INightSecError_get_HelpFile(This,pbsRet) \ + (This)->lpVtbl -> get_HelpFile(This,pbsRet) + +#define INightSecError_get_HelpContext(This,plRet) \ + (This)->lpVtbl -> get_HelpContext(This,plRet) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE INightSecError_get_Err_Proxy( + INightSecError __RPC_FAR * This, + /* [retval][out] */ HRESULT __RPC_FAR *pbsRet); + + +void __RPC_STUB INightSecError_get_Err_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE INightSecError_get_Description_Proxy( + INightSecError __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbsRet); + + +void __RPC_STUB INightSecError_get_Description_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE INightSecError_get_HelpFile_Proxy( + INightSecError __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbsRet); + + +void __RPC_STUB INightSecError_get_HelpFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE INightSecError_get_HelpContext_Proxy( + INightSecError __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *plRet); + + +void __RPC_STUB INightSecError_get_HelpContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __INightSecError_INTERFACE_DEFINED__ */ + + +#ifndef __INightSecErrorFix_INTERFACE_DEFINED__ +#define __INightSecErrorFix_INTERFACE_DEFINED__ + +/* interface INightSecErrorFix */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_INightSecErrorFix; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("409C4B04-9310-11d3-BFC1-0020182B97FC") + INightSecErrorFix : public IUnknown + { + public: + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Fixable( + /* [retval][out] */ BOOL __RPC_FAR *pbRet) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Fix( void) = 0; + + virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Retryable( + /* [retval][out] */ BOOL __RPC_FAR *pbRet) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Retry( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct INightSecErrorFixVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + INightSecErrorFix __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + INightSecErrorFix __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + INightSecErrorFix __RPC_FAR * This); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Fixable )( + INightSecErrorFix __RPC_FAR * This, + /* [retval][out] */ BOOL __RPC_FAR *pbRet); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Fix )( + INightSecErrorFix __RPC_FAR * This); + + /* [id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Retryable )( + INightSecErrorFix __RPC_FAR * This, + /* [retval][out] */ BOOL __RPC_FAR *pbRet); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Retry )( + INightSecErrorFix __RPC_FAR * This); + + END_INTERFACE + } INightSecErrorFixVtbl; + + interface INightSecErrorFix + { + CONST_VTBL struct INightSecErrorFixVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INightSecErrorFix_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define INightSecErrorFix_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define INightSecErrorFix_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define INightSecErrorFix_get_Fixable(This,pbRet) \ + (This)->lpVtbl -> get_Fixable(This,pbRet) + +#define INightSecErrorFix_Fix(This) \ + (This)->lpVtbl -> Fix(This) + +#define INightSecErrorFix_get_Retryable(This,pbRet) \ + (This)->lpVtbl -> get_Retryable(This,pbRet) + +#define INightSecErrorFix_Retry(This) \ + (This)->lpVtbl -> Retry(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE INightSecErrorFix_get_Fixable_Proxy( + INightSecErrorFix __RPC_FAR * This, + /* [retval][out] */ BOOL __RPC_FAR *pbRet); + + +void __RPC_STUB INightSecErrorFix_get_Fixable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE INightSecErrorFix_Fix_Proxy( + INightSecErrorFix __RPC_FAR * This); + + +void __RPC_STUB INightSecErrorFix_Fix_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][propget] */ HRESULT STDMETHODCALLTYPE INightSecErrorFix_get_Retryable_Proxy( + INightSecErrorFix __RPC_FAR * This, + /* [retval][out] */ BOOL __RPC_FAR *pbRet); + + +void __RPC_STUB INightSecErrorFix_get_Retryable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE INightSecErrorFix_Retry_Proxy( + INightSecErrorFix __RPC_FAR * This); + + +void __RPC_STUB INightSecErrorFix_Retry_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __INightSecErrorFix_INTERFACE_DEFINED__ */ + + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * ); + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/NSCmpts/DeleteSwapFile.cpp b/NSCmpts/DeleteSwapFile.cpp new file mode 100644 index 0000000..5e89f44 --- /dev/null +++ b/NSCmpts/DeleteSwapFile.cpp @@ -0,0 +1,95 @@ +// DeleteSwapFile.cpp : Implementation of CDeleteSwapFile +#include "stdafx.h" +#include "NSCmpts.h" +#include "DeleteSwapFile.h" +#include "../Common/Defines.h" +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CDeleteSwapFile + +STDMETHODIMP CDeleteSwapFile::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownDOS, + }; + for (int i=0;i= 0x80000000); + + // Format and return string + string sRetVal; + string sWinFolder; + + if(!GetWindowsDirectory(sWinFolder.get_buffer(MAX_PATH), MAX_PATH)) + sWinFolder = _T("C:\\WINDOWS"); + + sRetVal.format(IDS_DELSWAP_BATCHTEXT, (LPCTSTR)sWinFolder, (LPCTSTR)sWinFolder); + + CComBSTR bsRet(sRetVal); + *psText = bsRet.Detach(); + + return S_OK; +} + +//////////////////////////////////////////////////////// +// Called to initialize our data object + +STDMETHODIMP CDeleteSwapFile::SetData(IUnknown* pUnk) +{ + // Just let CProperty Bag do it + return m_Data.Initialize(pUnk); +} + +//////////////////////////////////////////////////////// +// Returns Info about our object + +STDMETHODIMP CDeleteSwapFile::get_Info(NightSecInfo nsItem, VARIANT* pvVal) +{ + ::VariantClear(pvVal); + + CComBSTR bsRetVal; + switch(nsItem) + { + case nsName: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_DELSWAP_NAME); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + case nsHelpText: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_DELSWAP_DESC); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + } + + ::VariantClear(pvVal); + return S_FALSE; +} diff --git a/NSCmpts/DeleteSwapFile.h b/NSCmpts/DeleteSwapFile.h new file mode 100644 index 0000000..4483466 --- /dev/null +++ b/NSCmpts/DeleteSwapFile.h @@ -0,0 +1,71 @@ +// DeleteSwapFile.h : Declaration of the CDeleteSwapFile + +#ifndef __DELETESWAPFILE_H_ +#define __DELETESWAPFILE_H_ + +#include "resource.h" // main symbols +#include "..\Common\CmptData.h" + +#include "appmisc.h" + +///////////////////////////////////////////////////////////////////////////// +// CDeleteSwapFile +class ATL_NO_VTABLE CDeleteSwapFile : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl +{ +// Construction +public: + CDeleteSwapFile() { } + ~CDeleteSwapFile() + { ATLTRACE(_T("Destroying DeleteSwapFile\n")); } + HRESULT FinalConstruct(); + +DECLARE_REGISTRY_RESOURCEID(IDR_DELETESWAPFILE) + +BEGIN_COM_MAP(CDeleteSwapFile) +// COM_INTERFACE_ENTRY_FUNC(ISecureShutdownDOS, 0, ComMapDOS) +// COM_INTERFACE_ENTRY_FUNC(ISecureShutdownWin, 0, ComMapWin) + COM_INTERFACE_ENTRY(ISecureShutdownDOS) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) +END_COM_MAP() + + /*HRESULT WINAPI ComMapDOS(void* pv, REFIID riid, LPVOID* ppv, DWORD dw) + { + if(::GetPlatform() == VER_PLATFORM_WIN32_NT) + return S_FALSE; + + ASSERT(::IsEqualGUID(riid, IID_ISecureShutdownDOS)); + + *ppv = pv + (DWORD)offsetofclass(ISecureShutdownDOS, _ComMapClass); + } + + HRESULT WINAPI ComMapDOS(void* pv, REFIID riid, LPVOID* ppv, DWORD dw) + { + if(::GetPlatform() == VER_PLATFORM_WIN32_NT) + return S_FALSE; + + ASSERT(::IsEqualGUID(riid, IID_ISecureShutdownDOS)); + + *ppv = pv + (DWORD)offsetofclass(ISecureShutdownDOS, _ComMapClass); + }*/ + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownDOS +public: + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + STDMETHOD(GetBatchText)(/*[out, retval]*/ BSTR* psText); + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + +// Data +protected: + CPropertyBag m_Data; + +}; + +#endif //__DELETESWAPFILE_H_ diff --git a/NSCmpts/EmptyRecycleBin.cpp b/NSCmpts/EmptyRecycleBin.cpp new file mode 100644 index 0000000..8dd09dd --- /dev/null +++ b/NSCmpts/EmptyRecycleBin.cpp @@ -0,0 +1,315 @@ +// EmptyRecycleBin.cpp : Implementation of CEmptyRecycleBin +#include "stdafx.h" +#include "NSCmpts.h" +#include "EmptyRecycleBin.h" +//#include "DummyDlg.h" +#include "..\common\defines.h" +#include + +#include "PromptClose.h" + +///////////////////////////////////////////////////////////////////////////// +// CEmptyRecycleBin + +STDMETHODIMP CEmptyRecycleBin::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownWin, + }; + for (int i=0;i psfDesktop; + CComPtr pMalloc; + + + // Get the Malloc Interface for freeing Mem later + HRESULT hr = SHGetMalloc(&pMalloc); + + if(FAILED(hr)) + return hr; + + // Get Desktop Folder. Recylce is always a child of Desktop + hr = ::SHGetDesktopFolder(&psfDesktop); + + if(FAILED(hr)) + return hr; + + + // Get ITEMID of Recycle + hr = ::SHGetSpecialFolderLocation(hwndParent, + CSIDL_BITBUCKET, // Recycle Bin + &ppidl); + if(FAILED(hr)) + return hr; + + // Start Major Stuff + CComPtr pcm; + DWORD dwAttribs = 0; + int idCmd = 0; + HRESULT hRet = S_OK; + HMENU hMenu; + + // Get Context Menu Interface on Recycle ITEM ID + hr = psfDesktop->GetUIObjectOf (hwndParent, + 1, // get attributes for only one object + (const struct _ITEMIDLIST **)&ppidl, + IID_IContextMenu, + 0, + (LPVOID *)&pcm); + + if (SUCCEEDED(hr)) + { + // Even though we won't display it we have to create it + hMenu = CreatePopupMenu(); + + if (hMenu) + { + // Get the context menu items for recycle + hr = pcm->QueryContextMenu (hMenu, 0, 1, 0x7fff, CMF_EXPLORE); + + if(FAILED(hr)) + hRet = hr; + + else + { + + // Did the user want to Recycle? + if(m_Data.GetInt(ER_REG_RECYCLE, true)) + { + hr = InvokeMenuCommand(pcm, hMenu, IDS_EMPTYCOMMAND, hwndParent, true); + + if (FAILED(hr)) + hRet = hr; + } + + // Did the use want to clear Norton? + if(m_Data.GetInt(ER_REG_NORTON, true)) + { + hr = InvokeMenuCommand(pcm, hMenu, IDS_NORTONCOMMAND, hwndParent, true); + + if (FAILED(hr)) + hRet = hr; + } + } + + DestroyMenu (hMenu); + + } + + } + + else + { + hRet = E_FAIL; + } + + // Free Recycle Bin Item ID + pMalloc->Free(ppidl); + + if(hRet != S_OK) + if (!bSilent) + MessageBox(_T("Couldn't Empty Recycle Bin"), _T("Empty Recycle Bin"), MB_OK | MB_ICONEXCLAMATION); + + return hRet; + +} + +STDMETHODIMP CEmptyRecycleBin::get_Info(NightSecInfo nsItem, VARIANT* pvVal) +{ + ::VariantClear(pvVal); + + CComBSTR bsRetVal; + + switch(nsItem) + { + case nsName: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_RECYCLENAME); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + case nsHelpText: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_RECYCLEDESC); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + case nsCmdLine: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_RECYCLEPARAM); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + } + + ::VariantClear(pvVal); + return S_FALSE; +} + + +STDMETHODIMP CEmptyRecycleBin::SetData(IUnknown* pUnk) +{ + return m_Data.Initialize(pUnk); +} + + +HRESULT InvokeMenuCommand(IContextMenu* pcm, HMENU hMenu, UINT nMenuItem, HWND hWndParent, bool bClosePrompt) +{ + HRESULT hRet = S_OK; + int idCmd = 0; + + // Get the ID + idCmd = GetMenuIdFromString(hMenu, nMenuItem); + + // Only Proceed if We Found it + if(!idCmd) + return S_FALSE; + + UINT nMenuState = ::GetMenuState(hMenu, idCmd, MF_BYCOMMAND); + + if(!(nMenuState & MF_GRAYED || nMenuState & MF_DISABLED)) + { + if(bClosePrompt) + { + CPromptClose closer; + closer.CloseNext(IDYES); + } + + // Do the Stuff + hRet = InvokeMenuId(pcm, idCmd, hWndParent); + + return hRet; + } + + return S_FALSE; +} + + +////////////////////////////////////////////////////////////////// +int GetMenuIdFromString(HMENU hMenu, UINT nStrID) +{ + + string sSearch; + if(sSearch.load_string(nStrID)) + return GetMenuIdFromString(hMenu, sSearch); + else + ASSERT(false); // Need a valid Resource ID + + return 0; +} + + +////////////////////////////////////////////////////////////////// +int GetMenuIdFromString(HMENU hMenu, string sSearch) +{ + + string sMenuItem; + sSearch.make_upper(); + + for(int nCnt = 0; nCnt < ::GetMenuItemCount(hMenu); nCnt++) + { + if(::GetMenuString(hMenu, nCnt, + sMenuItem.get_buffer(MAX_PATH), MAX_PATH, + MF_BYPOSITION)) + { + sMenuItem.release_buffer(); + sMenuItem.make_upper(); + + if(sMenuItem.find(sSearch) != string::npos) + return ::GetMenuItemID(hMenu, nCnt); + + } + } + + return 0; +} + + +HRESULT InvokeMenuId(IContextMenu* pcm, int nIDCmd, HWND hWndParent) +{ + CMINVOKECOMMANDINFO cmi; + + // Setup for Invoking. + cmi.cbSize = sizeof (CMINVOKECOMMANDINFO); + + cmi.fMask = CMIC_MASK_FLAG_NO_UI; + + cmi.hwnd = hWndParent; + cmi.lpVerb = MAKEINTRESOURCEA (nIDCmd - 1); + cmi.lpParameters = NULL; + cmi.lpDirectory = NULL; + cmi.nShow = SW_HIDE; + cmi.dwHotKey = 0; + cmi.hIcon = NULL; + + // Do the Stuff + return pcm->InvokeCommand (&cmi); +} + + +////////////////////////////////////////////////////////////////// +// If the user is at the computer switching windows this won't +// work, but that's okay because then the user can close the +// window +/* +static DWORD WINAPI ClosePromptWindow( LPVOID pParam ) +{ + + HWND hwndParent = (HWND)pParam; // The Parent of the Prompt Window + HWND hwndTop = ::GetTopLevel(hwndParent);// The Top Level Parent of the Prompt Window + + HWND hwndDlg = NULL; // Will Hold the Final Prompt Window to Close + DWORD dwStartCount = ::GetTickCount(); + + // Find the Active Popup + // Give it at least 20 seconds to come + while((hwndDlg = ::GetLastActivePopup(hwndTop)) == hwndParent + && ::GetTickCount() < dwStartCount + 20000) + { + } + + // Error: Window Didn't Pop up in 20 seconds + if(hwndDlg == hwndParent) + return 1; + + SetActiveWindow(hwndTop); + + SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + + keybd_event(VK_RETURN, 0, 0, 0); + + return 0; + +} + +HWND GetTopLevel(HWND hwnd) +{ + while(::GetParent(hwnd)) + hwnd = ::GetParent(hwnd); + + return hwnd; + +} +*/ \ No newline at end of file diff --git a/NSCmpts/EmptyRecycleBin.h b/NSCmpts/EmptyRecycleBin.h new file mode 100644 index 0000000..ab8cf0d --- /dev/null +++ b/NSCmpts/EmptyRecycleBin.h @@ -0,0 +1,110 @@ +// EmptyRecycleBin.h : Declaration of the CEmptyRecycleBin + +#ifndef __EMPTYRECYCLEBIN_H_ +#define __EMPTYRECYCLEBIN_H_ + +#include "resource.h" // main symbols +#include "Shlobj.h" +#include "../Common/CmptData.h" +#include + +HRESULT InvokeMenuCommand(IContextMenu* pcm, HMENU hMenu, UINT nMenuItem, HWND hWndParent, bool bClosePrompt = false); +HRESULT InvokeMenuId(IContextMenu* pcm, int nIDCmd, HWND hWndParent); +int GetMenuIdFromString(HMENU hMenu, string sMenuItem); +int GetMenuIdFromString(HMENU hMenu, UINT nStrID); + +DWORD WINAPI ClosePromptWindow( LPVOID pParam ); +HWND GetTopLevel(HWND hwndChild); + +#define ER_REG_RECYCLE _T("Empty Recycle Bin") +#define ER_REG_NORTON _T("Empty Norton Protected") + +///////////////////////////////////////////////////////////////////////////// +// CEmptyRecycleBin +class ATL_NO_VTABLE CEmptyRecycleBin : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl, + public IPropertyPageImpl, + public CDialogImplEx, + public CContextHelp + +{ +public: + CEmptyRecycleBin() : CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLERecycle; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGRecycle; + } + ~CEmptyRecycleBin() + { ATLTRACE(_T("Destroying EmptyRecycleBin\n")); } + + +DECLARE_REGISTRY_RESOURCEID(IDR_EMPTYRECYCLEBIN) + +BEGIN_COM_MAP(CEmptyRecycleBin) + COM_INTERFACE_ENTRY(ISecureShutdownWin) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY_IMPL(IPropertyPage) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownWin +public: + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + STDMETHOD(DoShutdown)(/*[in]*/ long hParent, /*[in]*/ long lMode); + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + +// Data +protected: + CPropertyBag m_Data; + + /////////////////////////////////////////////////////////////////// +// Property Sheet Stuff + +public: + + enum {IDD = IDD_EMPTYRECYCLE}; + +BEGIN_MSG_MAP(CEmptyRecycleBin) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_EMPTYRECYCLE, 4020) + HELP_ID(IDC_EMPTYNORTON, 4019) +END_HELP_MAP + +// Property Sheet Messages + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CEmptyRecycleBun::Apply\n")); + + HRESULT hr; + HRESULT hrRet = S_OK; + + // Save AutoFix State + hr = m_Data.WriteInt(ER_REG_RECYCLE, IsDlgButtonChecked(IDC_EMPTYRECYCLE)); + if(FAILED(hr)) hrRet = hr; + + // Save Cluster State + hr = m_Data.WriteInt(ER_REG_NORTON, IsDlgButtonChecked(IDC_EMPTYNORTON)); + if(FAILED(hr)) hrRet = hr; + + m_bDirty = FALSE; + return hrRet; + + } + +}; + +#endif //__EMPTYRECYCLEBIN_H_ diff --git a/NSCmpts/EmptyRecycleBin.rgs b/NSCmpts/EmptyRecycleBin.rgs new file mode 100644 index 0000000..ef4a2fb --- /dev/null +++ b/NSCmpts/EmptyRecycleBin.rgs @@ -0,0 +1,42 @@ +HKCR +{ + NightSecurity.EmptyRecycleBin.25 = s 'EmptyRecycleBin Class' + { + CLSID = s '{34F11694-F275-11d2-A589-0020182B97FC}' + } + NightSecurity.EmptyRecycleBin = s 'EmptyRecycleBin Class' + { + CurVer = s 'NightSecurity.EmptyRecycleBin.25' + CLSID = s '{34F11694-F275-11d2-A589-0020182B97FC}' + } + NoRemove CLSID + { + ForceRemove {34F11694-F275-11d2-A589-0020182B97FC} = s 'EmptyRecycleBin Class' + { + ProgID = s 'NightSecurity.EmptyRecycleBin.25' + VersionIndependentProgID = s 'NightSecurity.EmptyRecycleBin' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.EmptyRecycleBin' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/EmptyTempFolder.cpp b/NSCmpts/EmptyTempFolder.cpp new file mode 100644 index 0000000..cfd0510 --- /dev/null +++ b/NSCmpts/EmptyTempFolder.cpp @@ -0,0 +1,197 @@ +// EmptyTempFolder.cpp : Implementation of CEmptyTempFolder +#include "stdafx.h" +#include "NSCmpts.h" +#include "EmptyTempFolder.h" +#include "..\common\defines.h" +#include "ProgressDlg.h" +#include "TempWarnDlg.h" +#include "TempActions.h" +#include + +///////////////////////////////////////////////////////////////////////////// +// CEmptyTempFolder + +STDMETHODIMP CEmptyTempFolder::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownWin, + }; + for (int i=0;iInitialize(sWindowsTempPath); + m_Engine.Add(pAction); + + // Create the update_monitor + m_Engine.SetUpdates(dlgProgress, dlgProgress); + + // start the backup + HANDLE hThread = m_Engine.StartThread(); + + WaitForAndIdle(1, &hThread, INFINITE); + + HRESULT hr = S_OK; + GetExitCodeThread(hThread, (LPDWORD)&hr); + + dlgProgress.DestroyWindow(); + + return hr; +} + +// XError: We should be using file_path here +/*string CEmptyTempFolder::CleanSlashes(const string& sPath) +{ + string sTemp; + if(sPath.at(sPath.length() - 1) == _T('\\')) + sTemp = sPath.substr(0, sPath.length() - 1); + else + sTemp = sPath; + + int nPos; + while((nPos = sTemp.find(_T("\\\\"), 2)) != string::npos) + sTemp.erase(nPos, 1); + + return sTemp; +} +*/ +STDMETHODIMP CEmptyTempFolder::get_Info(NightSecInfo nsItem, VARIANT* pvVal) +{ + ::VariantClear(pvVal); + + CComBSTR bsRetVal; + + switch(nsItem) + { + case nsName: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_TEMPNAME); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + case nsHelpText: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_TEMPDESC); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + case nsCmdLine: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_TEMPPARAM); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + } + + ::VariantClear(pvVal); + return S_FALSE; +} + + +STDMETHODIMP CEmptyTempFolder::SetData(IUnknown* pUnk) +{ + return m_Data.Initialize(pUnk); +} + + + + + diff --git a/NSCmpts/EmptyTempFolder.h b/NSCmpts/EmptyTempFolder.h new file mode 100644 index 0000000..1453b2f --- /dev/null +++ b/NSCmpts/EmptyTempFolder.h @@ -0,0 +1,59 @@ +// EmptyTempFolder.h : Declaration of the CEmptyTempFolder + +#ifndef __EMPTYTEMPFOLDER_H_ +#define __EMPTYTEMPFOLDER_H_ + +#include "resource.h" // main symbols +#include "../Common/CmptData.h" + +#include "ActionEngine.h" + +#include + +///////////////////////////////////////////////////////////////////////////// +// CEmptyTempFolder +class ATL_NO_VTABLE CEmptyTempFolder : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IObjectWithSiteImpl, + public IDispatchImpl +{ +public: + CEmptyTempFolder() + { + } + ~CEmptyTempFolder() + { ATLTRACE(_T("Destroying EmptyTempFolder\n")); } + + +DECLARE_REGISTRY_RESOURCEID(IDR_EMPTYTEMPFOLDER) + +BEGIN_COM_MAP(CEmptyTempFolder) + COM_INTERFACE_ENTRY(ISecureShutdownWin) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(IObjectWithSite) + COM_INTERFACE_ENTRY(ISupportErrorInfo) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownWin +public: + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + STDMETHOD(DoShutdown)(/*[in]*/ long hParent, /*[in]*/ long lMode); + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + +// Data +protected: + CPropertyBag m_Data; + CActionEngine m_Engine; + + +// Helpers +private: +// string CleanSlashes(const string& sPath); +}; + +#endif //__EMPTYTEMPFOLDER_H_ diff --git a/NSCmpts/Encrypt.cpp b/NSCmpts/Encrypt.cpp new file mode 100644 index 0000000..617dc69 --- /dev/null +++ b/NSCmpts/Encrypt.cpp @@ -0,0 +1,144 @@ +// Encrypt.cpp : Implementation of CEncrypt +#include "stdafx.h" +#include "NSCmpts.h" +#include "Encrypt.h" +#include "ProgressDlg.h" +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CEncrypt + +STDMETHODIMP CEncrypt::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownWin + }; + for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) + { + if (InlineIsEqualGUID(*arr[i],riid)) + return S_OK; + } + return S_FALSE; +} + +STDMETHODIMP CEncrypt::DoShutdown(long hParent, long lMode) +{ + bool bPrompt = lMode & nsNoPrompt ? false : true; +// bool bSilent = lMode & nsQuiet ? true : false; + + // Put it out here so it'll stay in scope + m_bDisablePassword = m_Data.GetInt(NS_ENCRYPT_REG_DISABLE, false) ? true : false; + + try + { + // Ask for Password here + if(m_xpyPass == NULL) + try_(m_xpyPass.CreateInstance(__uuidof(XpyEx))); + + VARIANT_BOOL vbEnabled = m_xpyPass->Enabled[xpyMainPass]; + + if(!vbEnabled && bPrompt) + m_xpyPass->Prompt(hParent, xpyuiMainPassword); + + vbEnabled = m_xpyPass->Enabled[xpyMainPass]; + + if(!vbEnabled) + return XPY_E_NO_PASSWORD; + + } + catch(_com_error& e) + { + // These are big errors and means something's not + // set up properly. Make sure it gets user's attention + // can't just go into the log window + + if(bPrompt) + { + string sMessage; + IErrorInfo* pError; + if(pError = e.ErrorInfo()) + { + sMessage.format(IDS_ENCRYPT_ERR_XPY, e.Description()); + pError->Release(); + } + else + sMessage.format(IDS_ENCRYPT_ERR_XPY, e.ErrorMessage()); + + MessageBox((HWND)hParent, sMessage, _T("XPY Encryption Problem"), MB_OK | MB_ICONSTOP); + } + + route_to_atl(e); + } + + // Create the dialog + CActionProgressDlg dlgProgress(m_spUnkSite, IDD_PROGRESSENCRYPT); + dlgProgress.Create((HWND)hParent); + dlgProgress.PlayAmination(IDR_AVIENCRYPT); + + CEncryptActions::EncryptPrepare* pAction = new CEncryptActions::EncryptPrepare; + HRESULT hr = pAction->Initialize(m_Data); + + if(hr != S_OK) + return hr; + + m_Engine.Add(pAction); + + // Create the update_monitor + m_Engine.SetUpdates(dlgProgress, dlgProgress); + + // start the backup + HANDLE hThread = m_Engine.StartThread(); + + WaitForAndIdle(1, &hThread, INFINITE); + + hr = S_OK; + GetExitCodeThread(hThread, (LPDWORD)&hr); + + dlgProgress.DestroyWindow(); + + return hr; + +} + +STDMETHODIMP CEncrypt::get_Info(NightSecInfo nsItem, VARIANT* pvVal) +{ + ::VariantClear(pvVal); + + CComBSTR bsRetVal; + + switch(nsItem) + { + case nsName: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_ENCRYPTNAME); + pvVal->bstrVal = bsRetVal; + return S_OK; + case nsHelpText: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_ENCRYPTDESC); + pvVal->bstrVal = bsRetVal; + return S_OK; + case nsCmdLine: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_ENCRYPTPARAM); + pvVal->bstrVal = bsRetVal; + return S_OK; + case nsForceShow: + pvVal->vt = VT_BOOL; + pvVal->bVal = TRUE; + return S_OK; + case nsCopyAble: + pvVal->vt = VT_BOOL; + pvVal->bVal = TRUE; + return S_OK; + } + + return S_FALSE; +} + +STDMETHODIMP CEncrypt::SetData(IUnknown* pUnk) +{ + return m_Data.Initialize(pUnk); +} \ No newline at end of file diff --git a/NSCmpts/Encrypt.h b/NSCmpts/Encrypt.h new file mode 100644 index 0000000..a7b449f --- /dev/null +++ b/NSCmpts/Encrypt.h @@ -0,0 +1,103 @@ +// Encrypt.h : Declaration of the CEncrypt + +#ifndef __ENCRYPT_H_ +#define __ENCRYPT_H_ + +#include "resource.h" // main symbols +#include + +#include "../common/cmptdata.h" +#include "ActionEngine.h" + +#include "../common/interfaces.h" +#include "EncryptActions.h" + +///////////////////////////////////////////////////////////////////////////// +// CEncrypt +class ATL_NO_VTABLE CEncrypt : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl, + public IObjectWithSiteImpl, + public ISpecifyPropertyPagesImplEx + + +{ +public: + CEncrypt() + { + m_bDisablePassword = false; + } + ~CEncrypt() + { + try + { + if(m_bDisablePassword && (m_xpyPass != NULL)) + m_xpyPass->Disable(); + } + catch(_com_error&) + { } + + ATLTRACE(_T("Destroying Backup\n")); + } + +DECLARE_REGISTRY_RESOURCEID(IDR_ENCRYPT) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CEncrypt) + COM_INTERFACE_ENTRY(ISecureShutdownWin) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY(IObjectWithSite) + COM_INTERFACE_ENTRY(ISpecifyPropertyPages) +END_COM_MAP() + + virtual ATL_PROPMAP_ENTRY* GetPropertyMap() + { + static ATL_PROPMAP_ENTRY pNormalPropMap[] = + { + PROP_PAGE(CLSID_EncryptSourceProp) + {NULL, 0, NULL, &IID_NULL, 0, 0, 0} + }; + + static ATL_PROPMAP_ENTRY pAdvancedPropMap[] = + { + PROP_PAGE(CLSID_EncryptSourceProp) + PROP_PAGE(CLSID_EncryptAdvancedProp) + {NULL, 0, NULL, &IID_NULL, 0, 0, 0} + }; + + INightSecSiteInfoPtr pInfo = (IUnknown*)m_spUnkSite; + + if(pInfo) + { + CComVariant var; + pInfo->get_Info(nsAdvanced, &var); + + if(var.vt == VT_BOOL && var.bVal == TRUE) + return pAdvancedPropMap; + } + + return pNormalPropMap; + } + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownWin +public: + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + STDMETHOD(DoShutdown)(/*[in]*/ long hParent, /*[in]*/ long lMode); + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + +protected: + CPropertyBag m_Data; + CActionEngine m_Engine; + bool m_bDisablePassword; + + IXpyPassUIPtr m_xpyPass; +}; + +#endif //__ENCRYPT_H_ diff --git a/NSCmpts/Encrypt.rgs b/NSCmpts/Encrypt.rgs new file mode 100644 index 0000000..5e2e3b8 --- /dev/null +++ b/NSCmpts/Encrypt.rgs @@ -0,0 +1,43 @@ +HKCR +{ + NightSecurity.Encrypt.25 = s 'Encrypt Class' + { + CLSID = s '{22AD5F42-A7F1-11D3-82E3-0020182B97FC}' + } + NightSecurity.Encrypt = s 'Encrypt Class' + { + CLSID = s '{22AD5F42-A7F1-11D3-82E3-0020182B97FC}' + CurVer = s 'NightSecurity.Encrypt.25' + } + NoRemove CLSID + { + ForceRemove {22AD5F42-A7F1-11D3-82E3-0020182B97FC} = s 'Encrypt Class' + { + ProgID = s 'NightSecurity.Encrypt.25' + VersionIndependentProgID = s 'NightSecurity.Encrypt' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{34F11693-F275-11d2-A589-0020182B97FC}' + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.Encrypt' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/EncryptActions.cpp b/NSCmpts/EncryptActions.cpp new file mode 100644 index 0000000..aac7fb5 --- /dev/null +++ b/NSCmpts/EncryptActions.cpp @@ -0,0 +1,235 @@ +// EncryptActions.cpp: implementation of the CEncryptActions class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "EncryptActions.h" + +#include "resource.h" +#include + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +bool CEncryptActions::EncryptPrepare::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + ASSERT(pEngine != NULL); + + Update(hwndUpdates, _T("Listing files to encrypt..."), NULL); + + // Iterate through source folders + string_array::const_iterator iterSrc; + for(iterSrc = m_aFiles.begin(); iterSrc != m_aFiles.end(); iterSrc++) + { + Update(hwndUpdates, NULL, (LPCTSTR)*iterSrc); + + file_iterator fileIter((file_path)*iterSrc, file_iterator::sub_folders | file_iterator::full_paths), end; + for( ; fileIter != end; fileIter++) + { + file_path srcFile(fileIter->cFileName); + if(!(srcFile.attributes() & FILE_ATTRIBUTE_DIRECTORY)) + { + if(m_asIgnore.find(srcFile.ext().make_lower()) == m_asIgnore.end()) + { + // Construct File + Encrypt* pEncrypt = new Encrypt(srcFile); + pEngine->Add(pEncrypt); + } + } + } + + // Error from file_iterator (listing folders) + if(fileIter.state() != ERROR_SUCCESS) + throw CActionError(HRESULT_FROM_WIN32(fileIter.state()), IDS_ENCRYPT_ERR_LIST, (file_path)*iterSrc); + } + + return false; +} + +HRESULT CEncryptActions::EncryptPrepare::Initialize(const CPropertyBag& data) +{ + if(!data.GetStringSet(NS_ENCRYPT_REG_FILES, m_aFiles)) + return S_FALSE; + + CEncryptActions::Encrypt::m_bEncryptReadOnly = data.GetInt(NS_ENCRYPT_REG_READONLY, false) ? true : false; + + string_array asTemp; + data.GetStringSet(NS_IGNORE_REG_EXT, asTemp); + + // Make them all lower + for_each(asTemp.begin(), asTemp.end(), Lower); + + // And copy them to the set (removes doubles) + copy(asTemp.begin(), asTemp.end(), inserter(m_asIgnore, m_asIgnore.begin())); + + // Remove any blanks from ignore + m_asIgnore.erase(_T("")); + + return S_OK; +} + + +IXpyExPtr CEncryptActions::Encrypt::m_pXpy; +bool CEncryptActions::Encrypt::m_bEncryptReadOnly = false; +UINT CEncryptActions::Encrypt::m_nXpyRefs = 0; + +bool CEncryptActions::Encrypt::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + // Update any monitors + Update(hwndUpdates, _T("Encrypting..."), m_file); + + // Initialize XPY + HRESULT hr; + if(FAILED(hr = InitXpy())) + { + // If it doesn't work then trash all the encryption actions + // in the engine + if(pEngine) + pEngine->RemoveAll(this); + + // And spit out an error + throw CActionError(hr, IDS_ENCRYPT_ERR_XPYINIT); + } + + + // Use this in case we need to reset the attributes + // in order to encrypt the file. XPY won't encrypt + // read-only files. There's an option here + // to let you. So basically what we have to do is + // reset the file to normal attributes and then set + // it back + + // If it's 0 that means we haven't messed with the + // attributes yet. If it has a value that means we + // need to set the value back before returning + DWORD dwAttributes = 0; + +encrypt: + + try + { + // Here's the actual close code + // rest is basically error checking + m_pXpy->Close((LPCTSTR)m_file); + + } + catch(_com_error& e) + { + // Here we check for the read-only error that Xpy + // will spit up. If the flag is set then go ahead + // and reset the attributes + + if(e.Error() == XPY_E_FILE_ATTRIBUTES && // Read Only Error + m_bEncryptReadOnly) // flag to encrypt read-only + { + + // If we haven't messed with the attributes + // yet then go ahead and reset them + if(!dwAttributes) + { + // Get Attributes + dwAttributes = GetFileAttributes(m_file); + + // Let System files blow! (with an error) + if(!(dwAttributes & FILE_ATTRIBUTE_SYSTEM)) + { + SetFileAttributes(m_file, FILE_ATTRIBUTE_NORMAL); + + // Reencrypt + goto encrypt; + } + + } + + // Otherwise we won't try again + } + + // Set the Attributes back + if(dwAttributes) + SetFileAttributes(m_file, dwAttributes); + + // Get the proper error message + _bstr_t bsError = e.Description(); + + if(bsError.length()) + throw CActionError((LPCTSTR)bsError, e.Error(), IDS_ENCRYPT_ERR, m_file); + else + throw CActionError(e.Error(), IDS_ENCRYPT_ERR, m_file); + } + + // Set the Attributes back + if(dwAttributes) + SetFileAttributes(m_file, dwAttributes); + + return false; +} + +bool CEncryptActions::Encrypt::IsFixable(HRESULT hr) const +{ + switch(hr) + { + case XPY_E_FILE_ATTRIBUTES: + case HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION): + case HRESULT_FROM_WIN32(ERROR_LOCK_VIOLATION): + return true; + default: + return false; + } +} + +void CEncryptActions::Encrypt::Fix(HRESULT hr) +{ + if(hr == XPY_E_FILE_ATTRIBUTES) + { + if(SetFileAttributes(m_file, FILE_ATTRIBUTE_NORMAL)) + Do(NULL, NULL); + else + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_ENCRYPT_ERR, m_file); + } + else if(hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) || + hr == HRESULT_FROM_WIN32(ERROR_LOCK_VIOLATION)) + { + bool bFirst = true; +start: + try + { + // Try again + Do(NULL, NULL); + return; + } + catch(CActionError& err) + { + // If it's the first around and the error is the same... + if(bFirst && IsFixable(err.m_hRes)) + { + HCURSOR hCurs = ::GetCursor(); + + // ... Prompt user to close programs + MessageBox(NULL, _T("Files cannot be encrypted while they are opened in a program. Close all other programs and then click the OK button."), _T("Encrypt Files"), MB_OK | MB_ICONINFORMATION); + + if(hCurs) + ::SetCursor(hCurs); + + bFirst = false; + } + // Otherwise out with the error + else + throw; + } + + goto start; + } +} + +HRESULT CEncryptActions::Encrypt::InitXpy() +{ + if(m_pXpy) + return S_OK; + else + return m_pXpy.CreateInstance(__uuidof(XpyEx)); +} + diff --git a/NSCmpts/EncryptActions.h b/NSCmpts/EncryptActions.h new file mode 100644 index 0000000..70f9dd6 --- /dev/null +++ b/NSCmpts/EncryptActions.h @@ -0,0 +1,93 @@ +// EncryptActions.h: interface for the CBackupActions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) +#define AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ActionEngine.h" +#include +#include + +#include "../common/cmptdata.h" +#include + +class CEncryptActions +{ +public: + + class Encrypt : public CAction + { + public: + Encrypt(const file_path& file) + { + m_file = file; + AddXpyRef(); + } + virtual ~Encrypt() + { + ReleaseXpyRef(); + } + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr); + virtual bool IsFixable(HRESULT hr) const; + virtual bool IsRetryable() const + { return true; } + + static bool m_bEncryptReadOnly; + + protected: + file_path m_file; + + /////////////////////////////////////////////////// + // Xpy Related stuff + + // Starts XpyEx + static HRESULT InitXpy(); + + // These are used in reference counting and when to release the + // XpyEx pointer + + // XXXXXXXXXXXXXXX + // We don't use the built in reference counting, because the then + // we have no way of telling whether it's released or not + static void AddXpyRef() + { m_nXpyRefs++; } + static void ReleaseXpyRef() + { + if(!--m_nXpyRefs && m_pXpy != NULL) + m_pXpy = NULL; + } + static IXpyExPtr m_pXpy; + static UINT m_nXpyRefs; + }; + + class EncryptPrepare : public CAction + { + public: + EncryptPrepare() {}; + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr) { } + virtual bool IsFixable(HRESULT hr) const + { return false; } + virtual bool IsRetryable() const + { return false; } + + HRESULT Initialize(const CPropertyBag& data); + + protected: + string_array m_aFiles; + string_set m_asIgnore; + + friend class Encrypt; + }; + +}; + +#endif // !defined(AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/EncryptAdvancedProp.cpp b/NSCmpts/EncryptAdvancedProp.cpp new file mode 100644 index 0000000..2149139 --- /dev/null +++ b/NSCmpts/EncryptAdvancedProp.cpp @@ -0,0 +1,51 @@ +// EncryptAdvancedProp.cpp : Implementation of CEncryptAdvancedProp +#include "stdafx.h" +#include "NSCmpts.h" +#include "EncryptAdvancedProp.h" + +///////////////////////////////////////////////////////////////////////////// +// CEncryptAdvancedProp + +LRESULT CEncryptAdvancedProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Let it choose an object for data + m_Data.Initialize(m_nObjects, m_ppUnk); + + // Set this for CIgnoreProp + m_hwndIgnore = m_hWnd; + + CIgnoreProp::OnInitDialog(uMsg, wParam, lParam, bHandled); + + // Other Data Init + m_bDisablePassword = m_Data.GetInt(NS_ENCRYPT_REG_DISABLE, true) ? true : false; + m_bEncryptReadOnly = m_Data.GetInt(NS_ENCRYPT_REG_READONLY, false) ? true : false; + + UpdateData(false); + + bHandled = true; + return TRUE; +} + +LRESULT CEncryptAdvancedProp::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Just in case, save before destroy + UpdateData(true); + return 0; +} + +void CEncryptAdvancedProp::UpdateData(bool bSave) +{ + // Do Ignore Extensions first + CIgnoreProp::UpdateData(bSave); + + if(bSave) + { + m_bDisablePassword = IsDlgButtonChecked(IDC_DISABLEPASSWORD) ? true : false; + m_bEncryptReadOnly = IsDlgButtonChecked(IDC_ENCRYPTREADONLY) ? true : false; + } + else + { + CheckDlgButton(IDC_DISABLEPASSWORD, m_bDisablePassword ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(IDC_ENCRYPTREADONLY, m_bEncryptReadOnly ? BST_CHECKED : BST_UNCHECKED); + } +} diff --git a/NSCmpts/EncryptAdvancedProp.h b/NSCmpts/EncryptAdvancedProp.h new file mode 100644 index 0000000..864407c --- /dev/null +++ b/NSCmpts/EncryptAdvancedProp.h @@ -0,0 +1,104 @@ +// EncryptAdvancedProp.h : Declaration of the CEncryptAdvancedProp + +#ifndef __ENCRYPTADVANCEDPROP_H_ +#define __ENCRYPTADVANCEDPROP_H_ + +#include "resource.h" // main symbols + +#include "../common/CmptData.h" +#include + +#include "IgnoreProp.h" + +EXTERN_C const CLSID CLSID_EncryptAdvancedProp; + +///////////////////////////////////////////////////////////////////////////// +// CEncryptAdvancedProp +class ATL_NO_VTABLE CEncryptAdvancedProp : + public CComObjectRootEx, + public CComCoClass, + public IPropertyPageImpl, + public CDialogImplEx, + + // Some dialog functionality from + public CIgnoreProp, + public CContextHelp +{ + +// Construction +public: + CEncryptAdvancedProp() : CIgnoreProp(m_Data), CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLEEncryptAdvancedProp; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGEncryptAdvancedProp; + } + + enum {IDD = IDD_ENCRYPTADVANCED}; + +DECLARE_REGISTRY_RESOURCEID(IDR_ENCRYPTADVANCEDPROP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CEncryptAdvancedProp) + COM_INTERFACE_ENTRY(IPropertyPage) +END_COM_MAP() + +BEGIN_MSG_MAP(CEncryptAdvancedProp) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + NOTIFY_HANDLER(IDC_IGNORE_LIST, LVN_ENDLABELEDIT, OnEndLabelEdit) + NOTIFY_HANDLER(IDC_IGNORE_LIST, NM_SETFOCUS, OnListSetFocus) + NOTIFY_HANDLER(IDC_IGNORE_LIST, LVN_KEYDOWN, OnKeyDown) + COMMAND_ID_HANDLER(IDC_NEW, OnAdd) + COMMAND_ID_HANDLER(IDC_DEL, OnRemove) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_DISABLEPASSWORD, 4009) + HELP_ID(IDC_ENCRYPTREADONLY, 4011) + HELP_ID(IDC_IGNORE_LIST, 4010) + HELP_ID(IDC_NEW, 4018) + HELP_ID(IDC_DEL, 4017) +END_HELP_MAP + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CEncryptAdvancedProp::Apply\n")); + + // Let it choose an object for data + if(!m_Data.IsInitialized()) + m_Data.Initialize(m_nObjects, m_ppUnk); + + if(!m_Data.IsInitialized()) + E_FAIL; + + UpdateData(true); + + m_Data.WriteStringSet(NS_IGNORE_REG_EXT, m_asExtensions); + m_Data.WriteInt(NS_ENCRYPT_REG_DISABLE, m_bDisablePassword); + m_Data.WriteInt(NS_ENCRYPT_REG_READONLY, m_bEncryptReadOnly); + + m_bDirty = FALSE; + return S_OK; + } + +protected: + CPropertyBag m_Data; + bool m_bDisablePassword; + bool m_bEncryptReadOnly; + + void UpdateData(bool bSave = true); +}; + +#endif //__ENCRYPTADVANCEDPROP_H_ diff --git a/NSCmpts/EncryptAdvancedProp.rgs b/NSCmpts/EncryptAdvancedProp.rgs new file mode 100644 index 0000000..0dcda59 --- /dev/null +++ b/NSCmpts/EncryptAdvancedProp.rgs @@ -0,0 +1,14 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {93425F13-BC15-11D3-82FF-005056D45AB0} = s 'EncryptAdvancedProp Class' + { + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/EncryptData.cpp b/NSCmpts/EncryptData.cpp new file mode 100644 index 0000000..4c1660a --- /dev/null +++ b/NSCmpts/EncryptData.cpp @@ -0,0 +1,105 @@ +// EncryptData.cpp: implementation of the CEncryptData class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "EncryptData.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +UINT CEncryptData::m_nExtensions = 0; +UINT CEncryptData::m_nPaths = 0; + + +UINT CEncryptData::LoadExtensions(string_array& asExt, const CPropertyBag& settings) +{ + int nCnt = 0; // Number of URLs from Registry + string sExt; + string sKeyName; + + // Format Key Name + sKeyName.format(NS_BACKUP_REG_EXT, nCnt++); + + while((sExt = settings.GetString(sKeyName, NS_NO_KEY)) != NS_NO_KEY) + { + asExt.push_back(sExt); + sKeyName.format(NS_BACKUP_REG_EXT, nCnt++); + } + + m_nExtensions = max(m_nExtensions, --nCnt); + return nCnt; +} + +UINT CEncryptData::SaveExtensions(const string_array& asExt, CPropertyBag& settings) +{ + UINT nCnt = 0; // Number of URLs from Registry + string sKeyName = _T(""); + + string_array::const_iterator iter = asExt.begin(); + for(; iter != asExt.end(); iter++) + { + sKeyName.format(NS_BACKUP_REG_EXT, nCnt++); + settings.WriteString(sKeyName, *iter); + } + + UINT nRet = nCnt - 1; + + for(; nCnt < m_nExtensions; nCnt++) + { + // Format Registry Key + sKeyName.format(NS_BACKUP_REG_EXT, nCnt); + settings.DeleteProperty(sKeyName); + } + + m_nExtensions = 0; + + return nRet; +} + +UINT CEncryptData::LoadPaths(file_array& aPaths, const CPropertyBag& settings) +{ + int nCnt = 0; + string sPath; + string sKeyName; + + // Format Key Name + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt++); + + // Add URLs to List Box + while((sPath = settings.GetString(sKeyName, NS_NO_KEY)) != NS_NO_KEY) + { + aPaths.push_back(sPath); + + // Format Key Name + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt++); + } + + return m_nPaths = --nCnt; + +} + +UINT CEncryptData::SavePaths(const file_array& aPaths, CPropertyBag& settings) +{ + UINT nCnt = 0; // Number of URLs from Registry + string sKeyName; + + file_array::const_iterator iter = aPaths.begin(); + for(; iter != aPaths.end(); iter++) + { + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt++); + settings.WriteString(sKeyName, *iter); + } + + UINT nRet = nCnt - 1; + + for(; nCnt < m_nPaths; nCnt++) + { + // Format Registry Key + sKeyName.format(NS_BACKUP_REG_SOURCE, nCnt); + settings.DeleteProperty(sKeyName); + } + + return nRet; +} diff --git a/NSCmpts/EncryptData.h b/NSCmpts/EncryptData.h new file mode 100644 index 0000000..2b39152 --- /dev/null +++ b/NSCmpts/EncryptData.h @@ -0,0 +1,47 @@ +// EncryptData.h: interface for the CEncryptData class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_BACKUPDATA_H__00EC1850_A1A5_11D3_82DB_0020182B97FC__INCLUDED_) +#define AFX_BACKUPDATA_H__00EC1850_A1A5_11D3_82DB_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include + +#include +typedef std::vector string_array; + +#include +typedef std::vector file_array; + +#include "../common/cmptdata.h" + +#define NS_NO_KEY _T("No Key") +#define NS_ENCRYPT_REG_EXT _T("Ignore%.4d") +#define NS_ENCRYPT_REG_SOURCE _T("Path%.4d") +#define NS_ENCRYPT_REG_DEST _T("Destination") +#define NS_ENCRYPT_REG_ENGINE _T("Engine") + +class CEncryptData +{ +public: + CEncryptData() { }; + + // For Filtering and Advanced Property Sheet + static UINT LoadExtensions(string_array& asExt, const CPropertyBag& settings); + static UINT SaveExtensions(const string_array& asExt, CPropertyBag& settings); + + // For Backup and Source Property Sheet + static UINT LoadSources(file_array& aSources, const CPropertyBag& settings); + static UINT SaveSources(const file_array& aSources, CPropertyBag& settings); + +protected: + static UINT m_nExtensions; + static UINT m_nSources; +}; + +#endif // !defined(AFX_BACKUPDATA_H__00EC1850_A1A5_11D3_82DB_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/EncryptSourceProp.cpp b/NSCmpts/EncryptSourceProp.cpp new file mode 100644 index 0000000..17b47f7 --- /dev/null +++ b/NSCmpts/EncryptSourceProp.cpp @@ -0,0 +1,28 @@ +// EncryptSourceProp.cpp : Implementation of CEncryptSourceProp +#include "stdafx.h" +#include "NSCmpts.h" +#include "EncryptSourceProp.h" + +///////////////////////////////////////////////////////////////////////////// +// CEncryptSourceProp + +LRESULT CEncryptSourceProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Let it initialize + CSourceProp::OnInitDialog(uMsg, wParam, lParam, bHandled); + + // Load the File List + m_Data.Initialize(m_nObjects, m_ppUnk); + + if(m_Data.IsInitialized()) + m_Data.GetStringSet(NS_ENCRYPT_REG_FILES, m_aPaths); + + // Set Icon and Caption for Xpy + CStatic icon = GetDlgItem(IDC_ICO); + icon.SetIcon(::LoadIcon(_Module.m_hInstResource, MAKEINTRESOURCE(IDI_WXPY))); + SetDlgItemText(IDC_MESSAGE, _T("Encrypt these files or folders: ")); + + UpdateData(false); + + return TRUE; +} diff --git a/NSCmpts/EncryptSourceProp.h b/NSCmpts/EncryptSourceProp.h new file mode 100644 index 0000000..0be6b5a --- /dev/null +++ b/NSCmpts/EncryptSourceProp.h @@ -0,0 +1,87 @@ +// EncryptSourceProp.h : Declaration of the CEncryptSourceProp + +#ifndef __ENCRYPTSOURCEPROP_H_ +#define __ENCRYPTSOURCEPROP_H_ + +#include "resource.h" // main symbols + +#include "../common/cmptdata.h" +#include + +#include "sourceprop.h" + +EXTERN_C const CLSID CLSID_EncryptSourceProp; + +///////////////////////////////////////////////////////////////////////////// +// CEncryptSourceProp +class ATL_NO_VTABLE CEncryptSourceProp : + public CComObjectRootEx, + public CComCoClass, + public IPropertyPageImpl, + + // Most of functionality comes from + public CSourceProp, + public CContextHelp +{ + +// Construction +public: + CEncryptSourceProp() + { + m_dwTitleID = IDS_TITLEEncryptSourceProp; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGEncryptSourceProp; + } + +DECLARE_REGISTRY_RESOURCEID(IDR_ENCRYPTSOURCEPROP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CEncryptSourceProp) + COM_INTERFACE_ENTRY(IPropertyPage) + COM_INTERFACE_ENTRY(IDropTarget) +END_COM_MAP() + +BEGIN_MSG_MAP(CEncryptSourceProp) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + CHAIN_MSG_MAP(CSourceProp) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_SOURCE_LIST, 4013) + HELP_ID(IDC_ADD, 4008) + HELP_ID(IDC_REMOVE, 4012) +END_HELP_MAP + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CBackupSourceProp::Apply\n")); + + m_Data.Initialize(m_nObjects, m_ppUnk); + + if(!m_Data.IsInitialized()) + return E_FAIL; + + UpdateData(true); + + m_Data.WriteStringSet(NS_ENCRYPT_REG_FILES, m_aPaths); + + m_bDirty = FALSE; + return S_OK; + } + +protected: + CPropertyBag m_Data; + +}; + +#endif //__ENCRYPTSOURCEPROP_H_ diff --git a/NSCmpts/EncryptSourceProp.rgs b/NSCmpts/EncryptSourceProp.rgs new file mode 100644 index 0000000..dc935cf --- /dev/null +++ b/NSCmpts/EncryptSourceProp.rgs @@ -0,0 +1,23 @@ +HKCR +{ + NSCmpts.EncryptSourceProp.1 = s 'EncryptSourceProp Class' + { + CLSID = s '{B4981E50-A882-11D3-82E4-0020182B97FC}' + } + NSCmpts.EncryptSourceProp = s 'EncryptSourceProp Class' + { + CLSID = s '{B4981E50-A882-11D3-82E4-0020182B97FC}' + CurVer = s 'NSCmpts.EncryptSourceProp.1' + } + NoRemove CLSID + { + ForceRemove {B4981E50-A882-11D3-82E4-0020182B97FC} = s 'EncryptSourceProp Class' + { + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/IDropTargetImpl.cpp b/NSCmpts/IDropTargetImpl.cpp new file mode 100644 index 0000000..0ca984d --- /dev/null +++ b/NSCmpts/IDropTargetImpl.cpp @@ -0,0 +1,20 @@ +// IDropTargetImpl.cpp: implementation of the IDropTargetImpl class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "IDropTargetImpl.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +IDropTargetImpl::IDropTargetImpl() +{ + +} + +IDropTargetImpl::~IDropTargetImpl() +{ + +} diff --git a/NSCmpts/IDropTargetImpl.h b/NSCmpts/IDropTargetImpl.h new file mode 100644 index 0000000..fe8c75e --- /dev/null +++ b/NSCmpts/IDropTargetImpl.h @@ -0,0 +1,20 @@ +// IDropTargetImpl.h: interface for the IDropTargetImpl class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_IDROPTARGETIMPL_H__C9CF5F33_A181_11D3_82DB_0020182B97FC__INCLUDED_) +#define AFX_IDROPTARGETIMPL_H__C9CF5F33_A181_11D3_82DB_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class IDropTargetImpl +{ +public: + IDropTargetImpl(); + virtual ~IDropTargetImpl(); + +}; + +#endif // !defined(AFX_IDROPTARGETIMPL_H__C9CF5F33_A181_11D3_82DB_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/IgnoreProp.cpp b/NSCmpts/IgnoreProp.cpp new file mode 100644 index 0000000..9769246 --- /dev/null +++ b/NSCmpts/IgnoreProp.cpp @@ -0,0 +1,179 @@ +// IgnoreProp.cpp: implementation of the CIgnoreProp class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "IgnoreProp.h" + +#include "resource.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + + +LRESULT CIgnoreProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Our Current Window + CWindow wndIgnore = m_hwndIgnore; + + + // Load the System Image list + m_imgList.Load(true); + + + // Set the List + m_ctlList = wndIgnore.GetDlgItem(IDC_IGNORE_LIST); + m_ctlList.SetImageList(m_imgList, LVSIL_SMALL); + + + // Set Button Icons + HICON hIconNew = ::LoadIcon(_Module.m_hInstResource, MAKEINTRESOURCE(IDI_NEW)); + HICON hIconDel = ::LoadIcon(_Module.m_hInstResource, MAKEINTRESOURCE(IDI_DEL)); + + CButton btn = wndIgnore.GetDlgItem(IDC_NEW); + btn.SetIcon(hIconNew); + + btn = wndIgnore.GetDlgItem(IDC_DEL); + btn.SetIcon(hIconDel); + + + // Load the Extension List + if(m_Data.IsInitialized()) + m_Data.GetStringSet(NS_IGNORE_REG_EXT, m_asExtensions); + + + UpdateData(false); + + return TRUE; +} + +// Adds an extension to the List Control +int CIgnoreProp::AddExtension(string sExtension) +{ + // Get the Extension Icon + int nIndex = m_imgList.GetTypeIndex(sExtension); + + LVITEM lv; + lv.mask = LVIF_TEXT | LVIF_IMAGE; + lv.iItem = 0; + lv.iSubItem = 0; + lv.pszText = sExtension.get_buffer(); + lv.iImage = nIndex; + + // Set it + return m_ctlList.InsertItem(&lv); +} + +// Updates or Saves data from Dialog +void CIgnoreProp::UpdateData(bool bSave) +{ + if(bSave) + { + m_asExtensions.clear(); + + // Go through List Box and take down names + TCHAR buff[MAX_PATH]; + int nItem = 0; + while(m_ctlList.GetItemText(nItem++, 0, buff, MAX_PATH)) + m_asExtensions.push_back(buff); + } + else + { + m_ctlList.DeleteAllItems(); + + // Add everything to the List Control + string_array::const_iterator iter = m_asExtensions.begin(); + for(; iter != m_asExtensions.end(); iter++) + AddExtension(*iter); + } +} + +LRESULT CIgnoreProp::OnEndLabelEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + LVITEM* pItem = &((NMLVDISPINFO*)pnmh)->item; + + // Only Change if there is Text + if(pItem->pszText) + { + // Make sure text is sort of valid + // without illegal Characters + string sTemp(pItem->pszText); + string::size_type nPos; + while((nPos = sTemp.find_first_of(_T("\\/:*?\"<>|."))) != string::npos) + sTemp.erase(nPos, 1); + + // Copy it back to structure + _tcscpy(pItem->pszText, sTemp); + + // Modify Icon + pItem->iImage = m_imgList.GetTypeIndex(sTemp); + pItem->mask = pItem->mask | LVIF_IMAGE; + + // Set it + m_ctlList.SetItem(pItem); + } + + return 0; +} + +LRESULT CIgnoreProp::OnListSetFocus(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + // Disclaimer: This is a kludge fix + // SysListView32 wouldn't redraw itself when it had focus + // and app was activated + m_ctlList.Invalidate(); + m_ctlList.RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + return 0; +} + +LRESULT CIgnoreProp::OnKeyDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + NMLVKEYDOWN* pLVKeyDow = (NMLVKEYDOWN*)pnmh; + + // if F2 then Edit + if(pLVKeyDow->wVKey == VK_F2) + { + m_ctlList.SetFocus(); // Needs to have the Focus in order to edit + m_ctlList.EditLabel(m_ctlList.GetNextItem(-1, LVNI_ALL | LVNI_FOCUSED)); + } + + // If Delete then call Delete Handler + if(pLVKeyDow->wVKey == VK_DELETE) + { + OnRemove(0, 0, 0, bHandled); + } + + return 0; +} + +LRESULT CIgnoreProp::OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + int iItem = -1; + + // Loop through selected items + while((iItem = m_ctlList.GetNextItem(-1, LVNI_ALL | LVNI_SELECTED)) != -1) + // Take it out of List Box + m_ctlList.DeleteItem(iItem); + + return 0; +} + +/*template*/ +LRESULT CIgnoreProp/**/::OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + int iItem = -1; + + // Add an basic extension + string sExt; + sExt.load_string(IDS_BACKUP_NEWEXT); + + if((iItem = AddExtension(sExt)) != -1) + { + // Open for Editing + m_ctlList.SetFocus(); // Needs to have the Focus in order to edit + m_ctlList.EditLabel(iItem); + } + + return 0; +} \ No newline at end of file diff --git a/NSCmpts/IgnoreProp.h b/NSCmpts/IgnoreProp.h new file mode 100644 index 0000000..206519e --- /dev/null +++ b/NSCmpts/IgnoreProp.h @@ -0,0 +1,51 @@ +// IgnoreProp.h: interface for the CIgnoreProp class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_IGNOREPROP_H__93425F11_BC15_11D3_82FF_005056D45AB0__INCLUDED_) +#define AFX_IGNOREPROP_H__93425F11_BC15_11D3_82FF_005056D45AB0__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +#include "../common/CmptData.h" + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// CIgnoreProp is common code for the Advanced Property Pages + +class CIgnoreProp +{ +public: + CIgnoreProp(CPropertyBag& data) : m_Data(data) {} + +// Message Handlers +protected: + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnEndLabelEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnListSetFocus(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnKeyDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + +// Helper Functions +protected: + int AddExtension(string sExtension); + void UpdateData(bool bSave); + +// Data +protected: + CSysImageList m_imgList; // For looking up Icons + CListViewCtrl m_ctlList; // List Control + string_array m_asExtensions; // Set of Extensions + CPropertyBag& m_Data; // Reference to Data + HWND m_hwndIgnore; // Dialog Window to work with (set by class user) +}; + +#endif // !defined(AFX_IGNOREPROP_H__93425F11_BC15_11D3_82FF_005056D45AB0__INCLUDED_) diff --git a/NSCmpts/NSCmpts.aps b/NSCmpts/NSCmpts.aps new file mode 100644 index 0000000..5d2aa14 Binary files /dev/null and b/NSCmpts/NSCmpts.aps differ diff --git a/NSCmpts/NSCmpts.cpp b/NSCmpts/NSCmpts.cpp new file mode 100644 index 0000000..8dcaecf --- /dev/null +++ b/NSCmpts/NSCmpts.cpp @@ -0,0 +1,130 @@ +// NSCmpts.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f NSCmptsps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "NSCmpts.h" + +#include "NSCmpts_i.c" +#include "../common/interfaces.cpp" +#include "EmptyRecycleBin.h" +#include "EmptyTempFolder.h" +#include "DeleteSwapFile.h" +#include "RunScanDisk.h" +#include "WipefreeSpace.h" +#include "Backup.h" + +#include "..\Common\Defines.h" +#include "BackupSourceProp.h" +#include "BackupDestProp.h" +#include "BackupAdvancedProp.h" +#include "NightSecError.h" +#include "Encrypt.h" +#include "EncryptSourceProp.h" +#include "EncryptAdvancedProp.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) + OBJECT_ENTRY(CLSID_EmptyRecycleBin, CEmptyRecycleBin) + OBJECT_ENTRY(CLSID_EmptyTempFolder, CEmptyTempFolder) + OBJECT_ENTRY(CLSID_DeleteSwapFile, CDeleteSwapFile) + OBJECT_ENTRY(CLSID_RunScanDisk, CRunScanDisk) + OBJECT_ENTRY(CLSID_WipefreeSpace, CWipefreeSpace) + OBJECT_ENTRY(CLSID_Backup, CBackup) + OBJECT_ENTRY(CLSID_BackupSourceProp, CBackupSourceProp) + OBJECT_ENTRY(CLSID_BackupDestProp, CBackupDestProp) + OBJECT_ENTRY(CLSID_BackupAdvancedProp, CBackupAdvancedProp) + OBJECT_ENTRY(CLSID_Encrypt, CEncrypt) + OBJECT_ENTRY(CLSID_EncryptSourceProp, CEncryptSourceProp) + OBJECT_ENTRY(CLSID_EncryptAdvancedProp, CEncryptAdvancedProp) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_NightSecCmpts); + DisableThreadLibraryCalls(hInstance); + + // Not mission critical (used only for drag drop) + OleInitialize(NULL); + } + else if (dwReason == DLL_PROCESS_DETACH) + { + _Module.Term(); + + // Not mission critical (used only for drag drop) + OleUninitialize(); + } + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // <<<< Addition + // InstallShield Doesn't call this for the current thread + // And if we're using the _ATL_DLL (COM Based) we need this + HRESULT hr = CoInitialize(NULL); + // End >>>> + + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); + + // <<<< Addition + if(SUCCEEDED(hr)) + CoUninitialize(); + + return hr; + // End >>>> + +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + // <<<< Addition + HRESULT hr = CoInitialize(NULL); + // End >>>> + + return _Module.UnregisterServer(TRUE); + + // <<<< Addition + if(SUCCEEDED(hr)) + CoUninitialize(); + + return S_OK; + // End >>>> +} + + diff --git a/NSCmpts/NSCmpts.def b/NSCmpts/NSCmpts.def new file mode 100644 index 0000000..aad945f --- /dev/null +++ b/NSCmpts/NSCmpts.def @@ -0,0 +1,9 @@ +; NSCmpts.def : Declares the module parameters. + +LIBRARY "NSCmpts.DLL" + +EXPORTS + DllCanUnloadNow @1 PRIVATE + DllGetClassObject @2 PRIVATE + DllRegisterServer @3 PRIVATE + DllUnregisterServer @4 PRIVATE diff --git a/NSCmpts/NSCmpts.dsp b/NSCmpts/NSCmpts.dsp new file mode 100644 index 0000000..1b706f4 --- /dev/null +++ b/NSCmpts/NSCmpts.dsp @@ -0,0 +1,695 @@ +# Microsoft Developer Studio Project File - Name="NSCmpts" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=NSCmpts - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "NSCmpts.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "NSCmpts.mak" CFG="NSCmpts - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "NSCmpts - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "NSCmpts - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "NSCmpts - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "NSCmpts - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "NSCmpts - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "NSCmpts - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "NSCmpts - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 comdlg32.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x67870000" /subsystem:windows /dll /debug /machine:I386 /out:"../Debug/NSCmpts.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=\Projects\NightSec\Debug\NSCmpts.dll +InputPath=\Projects\NightSec\Debug\NSCmpts.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 comdlg32.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x67870000" /subsystem:windows /dll /debug /machine:I386 /out:"../Debug/NSCmpts.dll" /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=\Projects\NightSec\Debug\NSCmpts.dll +InputPath=\Projects\NightSec\Debug\NSCmpts.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 comdlg32.lib kernel32.lib user32.lib gdi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x67870000" /subsystem:windows /dll /machine:I386 /out:"../Release/NSCmpts.dll" /OPT:NOWIN98 +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=\Projects\NightSec\Release\NSCmpts.dll +InputPath=\Projects\NightSec\Release\NSCmpts.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x67870000" /subsystem:windows /dll /machine:I386 /out:"../Release/NSCmpts.dll" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=\Projects\NightSec\Release\NSCmpts.dll +InputPath=\Projects\NightSec\Release\NSCmpts.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 comdlg32.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x67870000" /subsystem:windows /dll /machine:I386 /out:"../Release/NSCmpts.dll" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=\Projects\NightSec\Release\NSCmpts.dll +InputPath=\Projects\NightSec\Release\NSCmpts.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 comdlg32.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x67870000" /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\NSCmpts.dll +InputPath=.\ReleaseUMinDependency\NSCmpts.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "NSCmpts - Win32 Debug" +# Name "NSCmpts - Win32 Unicode Debug" +# Name "NSCmpts - Win32 Release MinSize" +# Name "NSCmpts - Win32 Release MinDependency" +# Name "NSCmpts - Win32 Unicode Release MinSize" +# Name "NSCmpts - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ActionEngine.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Include\src\appmisc.cpp +# End Source File +# Begin Source File + +SOURCE=.\Backup.cpp +# End Source File +# Begin Source File + +SOURCE=.\BackupActions.cpp +# End Source File +# Begin Source File + +SOURCE=.\BackupAdvancedProp.cpp +# End Source File +# Begin Source File + +SOURCE=.\BackupDestProp.cpp +# End Source File +# Begin Source File + +SOURCE=.\BackupSourceProp.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\CmptData.cpp +# End Source File +# Begin Source File + +SOURCE=..\Interfaces\CmptIfaces.idl + +!IF "$(CFG)" == "NSCmpts - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Unicode Debug" + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Release MinSize" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Release MinDependency" + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Unicode Release MinSize" + +!ELSEIF "$(CFG)" == "NSCmpts - Win32 Unicode Release MinDependency" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\DeleteSwapFile.cpp +# End Source File +# Begin Source File + +SOURCE=.\EmptyRecycleBin.cpp +# End Source File +# Begin Source File + +SOURCE=.\EmptyTempFolder.cpp +# End Source File +# Begin Source File + +SOURCE=.\Encrypt.cpp +# End Source File +# Begin Source File + +SOURCE=.\EncryptActions.cpp +# End Source File +# Begin Source File + +SOURCE=.\EncryptAdvancedProp.cpp +# End Source File +# Begin Source File + +SOURCE=.\EncryptSourceProp.cpp +# End Source File +# Begin Source File + +SOURCE=.\IgnoreProp.cpp +# End Source File +# Begin Source File + +SOURCE=.\NightSecError.cpp +# End Source File +# Begin Source File + +SOURCE=.\NSCmpts.cpp +# End Source File +# Begin Source File + +SOURCE=.\NSCmpts.def +# End Source File +# Begin Source File + +SOURCE=.\NSCmpts.idl +# ADD MTL /tlb ".\NSCmpts.tlb" /h "NSCmpts.h" /iid "NSCmpts_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\NSCmpts.rc +# End Source File +# Begin Source File + +SOURCE=..\..\Include\src\path.cpp +# End Source File +# Begin Source File + +SOURCE=.\ProgressDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\RunScanDisk.cpp +# End Source File +# Begin Source File + +SOURCE=.\SourceProp.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TempActions.cpp +# End Source File +# Begin Source File + +SOURCE=.\TempWarnDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\WipefreeSpace.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ActionEngine.h +# End Source File +# Begin Source File + +SOURCE=.\Backup.h +# End Source File +# Begin Source File + +SOURCE=.\BackupActions.h +# End Source File +# Begin Source File + +SOURCE=.\BackupAdvancedProp.h +# End Source File +# Begin Source File + +SOURCE=.\BackupDestProp.h +# End Source File +# Begin Source File + +SOURCE=.\BackupSourceProp.h +# End Source File +# Begin Source File + +SOURCE=..\Common\CmptData.h +# End Source File +# Begin Source File + +SOURCE=.\DeleteSwapFile.h +# End Source File +# Begin Source File + +SOURCE=.\EmptyRecycleBin.h +# End Source File +# Begin Source File + +SOURCE=.\EmptyTempFolder.h +# End Source File +# Begin Source File + +SOURCE=.\Encrypt.h +# End Source File +# Begin Source File + +SOURCE=.\EncryptActions.h +# End Source File +# Begin Source File + +SOURCE=.\EncryptAdvancedProp.h +# End Source File +# Begin Source File + +SOURCE=.\EncryptSourceProp.h +# End Source File +# Begin Source File + +SOURCE=.\IgnoreProp.h +# End Source File +# Begin Source File + +SOURCE=.\NightSecError.h +# End Source File +# Begin Source File + +SOURCE=.\NSMessages.h +# End Source File +# Begin Source File + +SOURCE=.\ProgressDlg.h +# End Source File +# Begin Source File + +SOURCE=.\PromptClose.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\RunScanDisk.h +# End Source File +# Begin Source File + +SOURCE=.\SourceProp.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TempActions.h +# End Source File +# Begin Source File + +SOURCE=.\TempWarnDlg.h +# End Source File +# Begin Source File + +SOURCE=..\Common\types.h +# End Source File +# Begin Source File + +SOURCE=.\WipefreeSpace.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\161.avi +# End Source File +# Begin Source File + +SOURCE=.\res\advanced.ico +# End Source File +# Begin Source File + +SOURCE=.\Backup.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\backup1.ico +# End Source File +# Begin Source File + +SOURCE=.\BackupAdvancedProp.rgs +# End Source File +# Begin Source File + +SOURCE=.\BackupDestProp.rgs +# End Source File +# Begin Source File + +SOURCE=.\BackupSourceProp.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\copyfile.ico +# End Source File +# Begin Source File + +SOURCE=.\res\cursor1.cur +# End Source File +# Begin Source File + +SOURCE=.\res\DeleteSwapFile.rgs +# End Source File +# Begin Source File + +SOURCE=.\EmptyRecycleBin.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\EmptyTempFolder.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\enc.avi +# End Source File +# Begin Source File + +SOURCE=.\Encrypt.rgs +# End Source File +# Begin Source File + +SOURCE=.\EncryptAdvancedProp.rgs +# End Source File +# Begin Source File + +SOURCE=.\EncryptSourceProp.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\ico00001.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00002.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00003.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00004.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00005.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00006.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00007.ico +# End Source File +# Begin Source File + +SOURCE=.\res\ico00008.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icon1.ico +# End Source File +# Begin Source File + +SOURCE=.\res\icon2.ico +# End Source File +# Begin Source File + +SOURCE=.\res\items.ico +# End Source File +# Begin Source File + +SOURCE=.\res\new1.ico +# End Source File +# Begin Source File + +SOURCE=".\res\Night Security Worker.ico" +# End Source File +# Begin Source File + +SOURCE=.\res\recycle.ico +# End Source File +# Begin Source File + +SOURCE=.\res\RunScanDisk.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\temp.avi +# End Source File +# Begin Source File + +SOURCE=.\res\WipefreeSpace.rgs +# End Source File +# Begin Source File + +SOURCE=.\res\wxpy.ico +# End Source File +# End Group +# End Target +# End Project +# Section NSCmpts : {00708077-0000-0000-0000-000077087800} +# 1:18:IDR_BACKUPDESTPROP:112 +# 1:27:IDS_DOCSTRINGBackupDestProp:111 +# 1:23:IDS_TITLEBackupDestProp:106 +# 1:18:IDD_BACKUPDESTPROP:113 +# 1:26:IDS_HELPFILEBackupDestProp:110 +# End Section +# Section NSCmpts : {00008088-0000-0000-0000-000000000000} +# 1:23:IDR_ENCRYPTADVANCEDPROP:170 +# 1:32:IDS_DOCSTRINGEncryptAdvancedProp:169 +# 1:28:IDS_TITLEEncryptAdvancedProp:167 +# 1:23:IDD_ENCRYPTADVANCEDPROP:171 +# 1:31:IDS_HELPFILEEncryptAdvancedProp:168 +# End Section +# Section NSCmpts : {00008077-0800-7777-7777-777777777777} +# 1:22:IDR_BACKUPADVANCEDPROP:126 +# 1:30:IDS_HELPFILEBackupAdvancedProp:115 +# 1:31:IDS_DOCSTRINGBackupAdvancedProp:116 +# 1:22:IDD_BACKUPADVANCEDPROP:127 +# 1:27:IDS_TITLEBackupAdvancedProp:114 +# End Section diff --git a/NSCmpts/NSCmpts.h b/NSCmpts/NSCmpts.h new file mode 100644 index 0000000..629dd78 --- /dev/null +++ b/NSCmpts/NSCmpts.h @@ -0,0 +1,298 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 5.01.0164 */ +/* at Sat Mar 04 00:04:32 2000 + */ +/* Compiler settings for E:\Projects\NightSec\NSCmpts\NSCmpts.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __NSCmpts_h__ +#define __NSCmpts_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __EmptyRecycleBin_FWD_DEFINED__ +#define __EmptyRecycleBin_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class EmptyRecycleBin EmptyRecycleBin; +#else +typedef struct EmptyRecycleBin EmptyRecycleBin; +#endif /* __cplusplus */ + +#endif /* __EmptyRecycleBin_FWD_DEFINED__ */ + + +#ifndef __EmptyTempFolder_FWD_DEFINED__ +#define __EmptyTempFolder_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class EmptyTempFolder EmptyTempFolder; +#else +typedef struct EmptyTempFolder EmptyTempFolder; +#endif /* __cplusplus */ + +#endif /* __EmptyTempFolder_FWD_DEFINED__ */ + + +#ifndef __DeleteSwapFile_FWD_DEFINED__ +#define __DeleteSwapFile_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class DeleteSwapFile DeleteSwapFile; +#else +typedef struct DeleteSwapFile DeleteSwapFile; +#endif /* __cplusplus */ + +#endif /* __DeleteSwapFile_FWD_DEFINED__ */ + + +#ifndef __RunScanDisk_FWD_DEFINED__ +#define __RunScanDisk_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class RunScanDisk RunScanDisk; +#else +typedef struct RunScanDisk RunScanDisk; +#endif /* __cplusplus */ + +#endif /* __RunScanDisk_FWD_DEFINED__ */ + + +#ifndef __WipefreeSpace_FWD_DEFINED__ +#define __WipefreeSpace_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class WipefreeSpace WipefreeSpace; +#else +typedef struct WipefreeSpace WipefreeSpace; +#endif /* __cplusplus */ + +#endif /* __WipefreeSpace_FWD_DEFINED__ */ + + +#ifndef __Backup_FWD_DEFINED__ +#define __Backup_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class Backup Backup; +#else +typedef struct Backup Backup; +#endif /* __cplusplus */ + +#endif /* __Backup_FWD_DEFINED__ */ + + +#ifndef __BackupSourceProp_FWD_DEFINED__ +#define __BackupSourceProp_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class BackupSourceProp BackupSourceProp; +#else +typedef struct BackupSourceProp BackupSourceProp; +#endif /* __cplusplus */ + +#endif /* __BackupSourceProp_FWD_DEFINED__ */ + + +#ifndef __BackupDestProp_FWD_DEFINED__ +#define __BackupDestProp_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class BackupDestProp BackupDestProp; +#else +typedef struct BackupDestProp BackupDestProp; +#endif /* __cplusplus */ + +#endif /* __BackupDestProp_FWD_DEFINED__ */ + + +#ifndef __BackupAdvancedProp_FWD_DEFINED__ +#define __BackupAdvancedProp_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class BackupAdvancedProp BackupAdvancedProp; +#else +typedef struct BackupAdvancedProp BackupAdvancedProp; +#endif /* __cplusplus */ + +#endif /* __BackupAdvancedProp_FWD_DEFINED__ */ + + +#ifndef __Encrypt_FWD_DEFINED__ +#define __Encrypt_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class Encrypt Encrypt; +#else +typedef struct Encrypt Encrypt; +#endif /* __cplusplus */ + +#endif /* __Encrypt_FWD_DEFINED__ */ + + +#ifndef __EncryptSourceProp_FWD_DEFINED__ +#define __EncryptSourceProp_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class EncryptSourceProp EncryptSourceProp; +#else +typedef struct EncryptSourceProp EncryptSourceProp; +#endif /* __cplusplus */ + +#endif /* __EncryptSourceProp_FWD_DEFINED__ */ + + +#ifndef __EncryptAdvancedProp_FWD_DEFINED__ +#define __EncryptAdvancedProp_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class EncryptAdvancedProp EncryptAdvancedProp; +#else +typedef struct EncryptAdvancedProp EncryptAdvancedProp; +#endif /* __cplusplus */ + +#endif /* __EncryptAdvancedProp_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "cmptifaces.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + + +#ifndef __NightSecCmpts_LIBRARY_DEFINED__ +#define __NightSecCmpts_LIBRARY_DEFINED__ + +/* library NightSecCmpts */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_NightSecCmpts; + +EXTERN_C const CLSID CLSID_EmptyRecycleBin; + +#ifdef __cplusplus + +class DECLSPEC_UUID("34F11694-F275-11d2-A589-0020182B97FC") +EmptyRecycleBin; +#endif + +EXTERN_C const CLSID CLSID_EmptyTempFolder; + +#ifdef __cplusplus + +class DECLSPEC_UUID("34F11695-F275-11d2-A589-0020182B97FC") +EmptyTempFolder; +#endif + +EXTERN_C const CLSID CLSID_DeleteSwapFile; + +#ifdef __cplusplus + +class DECLSPEC_UUID("34F11696-F275-11d2-A589-0020182B97FC") +DeleteSwapFile; +#endif + +EXTERN_C const CLSID CLSID_RunScanDisk; + +#ifdef __cplusplus + +class DECLSPEC_UUID("34F11697-F275-11d2-A589-0020182B97FC") +RunScanDisk; +#endif + +EXTERN_C const CLSID CLSID_WipefreeSpace; + +#ifdef __cplusplus + +class DECLSPEC_UUID("34F11698-F275-11d2-A589-0020182B97FC") +WipefreeSpace; +#endif + +EXTERN_C const CLSID CLSID_Backup; + +#ifdef __cplusplus + +class DECLSPEC_UUID("2E47D920-3D64-11D3-BF0A-0020182B97FC") +Backup; +#endif + +EXTERN_C const CLSID CLSID_BackupSourceProp; + +#ifdef __cplusplus + +class DECLSPEC_UUID("E85A26C1-946D-11D3-BFC4-0020182B97FC") +BackupSourceProp; +#endif + +EXTERN_C const CLSID CLSID_BackupDestProp; + +#ifdef __cplusplus + +class DECLSPEC_UUID("E85A26C2-946D-11D3-BFC4-0020182B97FC") +BackupDestProp; +#endif + +EXTERN_C const CLSID CLSID_BackupAdvancedProp; + +#ifdef __cplusplus + +class DECLSPEC_UUID("E85A26C3-946D-11D3-BFC4-0020182B97FC") +BackupAdvancedProp; +#endif + +EXTERN_C const CLSID CLSID_Encrypt; + +#ifdef __cplusplus + +class DECLSPEC_UUID("22AD5F42-A7F1-11D3-82E3-0020182B97FC") +Encrypt; +#endif + +EXTERN_C const CLSID CLSID_EncryptSourceProp; + +#ifdef __cplusplus + +class DECLSPEC_UUID("B4981E50-A882-11D3-82E4-0020182B97FC") +EncryptSourceProp; +#endif + +EXTERN_C const CLSID CLSID_EncryptAdvancedProp; + +#ifdef __cplusplus + +class DECLSPEC_UUID("93425F13-BC15-11D3-82FF-005056D45AB0") +EncryptAdvancedProp; +#endif +#endif /* __NightSecCmpts_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/NSCmpts/NSCmpts.idl b/NSCmpts/NSCmpts.idl new file mode 100644 index 0000000..77c0c0e --- /dev/null +++ b/NSCmpts/NSCmpts.idl @@ -0,0 +1,123 @@ +// NSCmpts.idl : IDL source for NSCmpts.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (NSCmpts.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + +import "../interfaces/cmptifaces.idl"; +[ + uuid(34F11693-F275-11d2-A589-0020182B97FC), + version(2.5), + helpstring("NightSec Components 2.5") +] +library NightSecCmpts +{ + importlib("stdole32.tlb"); + + [ + uuid(34F11694-F275-11d2-A589-0020182B97FC), + helpstring("Empties the recycle bin and Norton Protected Files") + ] + coclass EmptyRecycleBin + { + interface ISecureShutdownWin; + }; + [ + uuid(34F11695-F275-11d2-A589-0020182B97FC), + helpstring("Clears the temp folder") + ] + coclass EmptyTempFolder + { + interface ISecureShutdownWin; + }; + [ + uuid(34F11696-F275-11d2-A589-0020182B97FC), + helpstring("Delete swap file command") + ] + coclass DeleteSwapFile + { + interface ISecureShutdownDOS; + }; + [ + uuid(34F11697-F275-11d2-A589-0020182B97FC), + helpstring("Command for running scandisk") + ] + coclass RunScanDisk + { + interface ISecureShutdownDOS; + }; + [ + uuid(34F11698-F275-11d2-A589-0020182B97FC), + helpstring("Command for Wiping free space on hard disk(s)") + ] + coclass WipefreeSpace + { + interface ISecureShutdownDOS; + }; + + [ + uuid(2E47D920-3D64-11D3-BF0A-0020182B97FC), + helpstring("Backs up the users files") + ] + coclass Backup + { + [default] interface ISecureShutdownWin; + }; + + [ + uuid(E85A26C1-946D-11D3-BFC4-0020182B97FC), + helpstring("BackupSourceProp Class") + ] + coclass BackupSourceProp + { + interface IUnknown; + }; + + [ + uuid(E85A26C2-946D-11D3-BFC4-0020182B97FC), + helpstring("BackupDestProp Class") + ] + coclass BackupDestProp + { + interface IUnknown; + }; + + [ + uuid(E85A26C3-946D-11D3-BFC4-0020182B97FC), + helpstring("BackupAdvancedProp Class") + ] + coclass BackupAdvancedProp + { + interface IUnknown; + }; + + [ + uuid(22AD5F42-A7F1-11D3-82E3-0020182B97FC), + helpstring("Encrypts the user's files") + ] + coclass Encrypt + { + [default] interface ISecureShutdownWin; + }; + + [ + uuid(B4981E50-A882-11D3-82E4-0020182B97FC), + helpstring("EncryptSourceProp Class") + ] + coclass EncryptSourceProp + { + interface IUnknown; + }; + + [ + uuid(93425F13-BC15-11D3-82FF-005056D45AB0), + helpstring("EncryptAdvancedProp Class") + ] + coclass EncryptAdvancedProp + { + interface IUnknown; + }; +}; diff --git a/NSCmpts/NSCmpts.plg b/NSCmpts/NSCmpts.plg new file mode 100644 index 0000000..aa7bb20 --- /dev/null +++ b/NSCmpts/NSCmpts.plg @@ -0,0 +1,16 @@ + + +
+

Build Log

+

+--------------------Configuration: NSCmpts - Win32 Release MinSize-------------------- +

+

Command Lines

+ + + +

Results

+NSCmpts.dll - 0 error(s), 0 warning(s) +
+ + diff --git a/NSCmpts/NSCmpts.rc b/NSCmpts/NSCmpts.rc new file mode 100644 index 0000000..9c36b8d --- /dev/null +++ b/NSCmpts/NSCmpts.rc @@ -0,0 +1,516 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""NSCmpts.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,5,0,1 + PRODUCTVERSION 2,5,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Components for Night Security Program\0" + VALUE "CompanyName", "The Family (Thailand)\0" + VALUE "FileDescription", "Night Security (Component Module)\0" + VALUE "FileVersion", "2, 5, 0, 1\0" + VALUE "InternalName", "NSCmpts\0" + VALUE "LegalCopyright", "Copyright (C) 1998 - 1999, The Family (Thailand)\0" + VALUE "LegalTrademarks", "\0" + VALUE "OLESelfRegister", "\0" + VALUE "OriginalFilename", "nscmpts.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Night Security 2.5\0" + VALUE "ProductVersion", "2, 5, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_EMPTYRECYCLE DIALOG DISCARDABLE 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Recycle Bin Options: ",IDC_STATIC,0,0,199,114 + ICON IDI_RECYCLE,IDC_STATIC,7,16,20,20 + ICON IDI_NOTE,IDC_STATIC,5,86,20,20 + LTEXT "Normally it's best to leave both these options on. Norton Protected Files can have things in it you hadn't even saved.", + IDC_STATIC,33,85,159,24 + CONTROL "Empty Recycle Bin",IDC_EMPTYRECYCLE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,35,23,75,10 + CONTROL "Empty Norton Protected Files",IDC_EMPTYNORTON,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,35,53,107,10 + ICON IDI_NORTONPROT,IDC_STATIC,7,46,20,20 + GROUPBOX "Note: ",IDC_STATIC,0,75,198,38 +END + +IDD_RUNSCANDISK DIALOG DISCARDABLE 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Automatically Fix Errors",IDC_AUTOFIX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,35,20,88,10 + CONTROL "&Save Lost Clusters as Files",IDC_SAVE,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,49,33,100,10 + CONTROL "&Delete Lost Clusters",IDC_NOSAVE,"Button", + BS_AUTORADIOBUTTON,49,44,79,10 + GROUPBOX "Scandisk Options: ",IDC_STATIC,0,0,199,114 + ICON IDI_SCANDISK,IDC_STATIC,7,14,20,20 + LTEXT "For security reasons it's usually best to leave 'Delete Lost Clusters' checked.", + IDC_STATIC,33,84,160,18 + GROUPBOX "Note: ",IDC_STATIC,0,74,199,40 + ICON IDI_NOTE,IDC_STATIC,5,86,20,20 +END + +IDD_TEMPWARNDLG DIALOG DISCARDABLE 0, 0, 250, 84 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Empty Temporary Files" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Yes",IDOK,139,63,50,14 + DEFPUSHBUTTON "No",IDCANCEL,193,63,50,14 + ICON IDI_EXCLAM,IDC_STATIC,7,7,20,20 + LTEXT "This folder doesn't look like a folder where temporary files are normally stored. Please check and make sure this is actually the folder where you keep temporary files. \n\nAre you sure you want to remove all the files inside it? ", + IDC_FOLDERWARN,33,7,210,48 + CONTROL "Don't show this again.",IDC_DONTSHOW,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,67,124,10 +END + +IDD_WIPEFREESPACE DIALOG DISCARDABLE 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Wipe free space on: ",IDC_STATIC,0,0,199,114 + ICON IDI_DRIVE,IDC_STATIC,7,13,20,20 + LTEXT "Wipe the free space on all your hard drives unless you are sure there is no sensitive material on that drive. (Always wipe your system drive)", + IDC_STATIC,31,84,161,24 + GROUPBOX "Note: ",IDC_STATIC,0,74,199,40 + CONTROL "Item1",IDC_FIRST_DRIVE,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,38,14,42,10 + CONTROL "Item1",IDC_FIRST_DRIVE2,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,85,14,41,10 + CONTROL "Item1",IDC_FIRST_DRIVE3,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,132,14,42,10 + CONTROL "Item1",IDC_FIRST_DRIVE4,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,38,25,43,10 + CONTROL "Item1",IDC_FIRST_DRIVE5,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,85,25,44,10 + CONTROL "Item1",IDC_FIRST_DRIVE6,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,132,25,42,10 + CONTROL "Item1",IDC_FIRST_DRIVE7,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,38,37,41,10 + CONTROL "Item1",IDC_FIRST_DRIVE8,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,85,37,42,10 + CONTROL "Item1",IDC_FIRST_DRIVE9,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,132,37,43,10 + CONTROL "Item1",IDC_FIRST_DRIVE10,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,38,49,44,10 + CONTROL "Item1",IDC_FIRST_DRIVE11,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,85,50,42,10 + CONTROL "Item1",IDC_FIRST_DRIVE12,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,132,50,41,10 + CONTROL "Item1",IDC_FIRST_DRIVE13,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,38,62,42,10 + CONTROL "Item1",IDC_FIRST_DRIVE14,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,85,62,43,10 + CONTROL "Item1",IDC_FIRST_DRIVE15,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,132,62,44,10 + ICON IDI_NOTE,IDC_STATIC,5,86,20,20 +END + +IDD_SOURCE DIALOGEX 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "List1",IDC_SOURCE_LIST,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | LVS_SORTASCENDING | + LVS_SHAREIMAGELISTS | LVS_EDITLABELS | + LVS_NOCOLUMNHEADER | WS_TABSTOP,6,11,141,96, + WS_EX_CLIENTEDGE + PUSHBUTTON "Add...",IDC_ADD,153,11,39,15 + PUSHBUTTON "Remove",IDC_REMOVE,153,29,39,15 + GROUPBOX "Files or folders: ",IDC_MESSAGE,0,0,199,114 + ICON IDI_BACKUP,IDC_ICO,162,86,20,20 +END + +IDD_BACKUPDEST DIALOG DISCARDABLE 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Backup files to: ",IDC_STATIC,0,0,199,114 + EDITTEXT IDC_DEST,7,40,182,14,ES_AUTOHSCROLL + PUSHBUTTON "Browse...",IDC_BROWSE,139,58,50,14 + ICON IDI_BACKUP,IDC_STATIC,9,13,20,20 + LTEXT "Select the drive or location you'd like to back up to:", + IDC_STATIC,39,14,150,22 +END + +IDD_BACKUPADVANCED DIALOG DISCARDABLE 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + COMBOBOX IDC_ENGINE_TYPE,117,14,72,73,CBS_DROPDOWNLIST | CBS_SORT | + CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Advanced options: ",IDC_STATIC,0,0,199,114 + CONTROL "List1",IDC_IGNORE_LIST,"SysListView32",LVS_LIST | + LVS_SORTASCENDING | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | + WS_BORDER | WS_TABSTOP,9,53,162,54 + LTEXT "&Ignore files with these extensions: ",IDC_STATIC,9,42, + 108,8 + LTEXT "Backup &according to:",IDC_STATIC,43,16,69,8 + PUSHBUTTON "&New URL",IDC_NEW,175,53,16,15,BS_ICON | BS_CENTER | + BS_VCENTER + PUSHBUTTON "&Delete",IDC_DEL,175,71,16,15,BS_ICON | BS_CENTER | + BS_VCENTER + ICON IDI_ADVANCED,IDC_STATIC,8,12,20,20 +END + +IDD_ENCRYPTADVANCED DIALOG DISCARDABLE 0, 0, 200, 115 +STYLE DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "More Encryption Options: ",-1,0,0,199,114 + CONTROL "List1",IDC_IGNORE_LIST,"SysListView32",LVS_LIST | + LVS_SORTASCENDING | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | + WS_BORDER | WS_TABSTOP,9,53,162,54 + LTEXT "&Ignore files with these extensions: ",-1,9,42,108,8 + PUSHBUTTON "New",IDC_NEW,175,53,16,15,BS_ICON | BS_CENTER | + BS_VCENTER + PUSHBUTTON "Del",IDC_DEL,175,71,16,15,BS_ICON | BS_CENTER | + BS_VCENTER + ICON IDI_PASSWORD,-1,8,13,20,20 + CONTROL "&Disable HomeARC password",IDC_DISABLEPASSWORD,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,45,14,105,10 + CONTROL "&Encrypt read-only/system files",IDC_ENCRYPTREADONLY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,28,105,10 +END + +IDD_PROGRESSBACKUP DIALOG FIXED IMPURE 20, 20, 250, 84 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "Backing up files..." +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Animate1",IDC_ANIMATION,"SysAnimate32",ACS_TRANSPARENT | + ACS_AUTOPLAY | WS_TABSTOP,7,1,235,34 + CONTROL "",IDC_PROGRESS,"msctls_progress32",0x0,7,63,185,8 + DEFPUSHBUTTON "Cancel",IDCANCEL,197,63,45,14,NOT WS_TABSTOP + CONTROL "",IDC_MESSAGE1,"Static",SS_SIMPLE | SS_NOPREFIX,7,39, + 236,10 + CONTROL "",IDC_MESSAGE2,"Static",SS_SIMPLE | SS_NOPREFIX,7,50, + 236,10 +END + +IDD_PROGRESSENCRYPT DIALOG FIXED IMPURE 20, 20, 250, 84 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "Encrypting..." +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Animate1",IDC_ANIMATION,"SysAnimate32",ACS_TRANSPARENT | + ACS_AUTOPLAY | WS_TABSTOP,7,6,235,30 + CONTROL "",IDC_PROGRESS,"msctls_progress32",0x0,7,63,185,8 + DEFPUSHBUTTON "Cancel",IDCANCEL,197,63,45,14,NOT WS_TABSTOP + CONTROL "",IDC_MESSAGE1,"Static",SS_SIMPLE | SS_NOPREFIX,7,39, + 236,10 + CONTROL "",IDC_MESSAGE2,"Static",SS_SIMPLE | SS_NOPREFIX,7,50, + 236,10 +END + +IDD_PROGRESSTEMP DIALOG FIXED IMPURE 20, 20, 250, 84 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "Emptying Temp Folder..." +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Animate1",IDC_ANIMATION,"SysAnimate32",ACS_TRANSPARENT | + ACS_AUTOPLAY | WS_TABSTOP,7,1,235,34 + CONTROL "",IDC_PROGRESS,"msctls_progress32",0x0,7,63,185,8 + DEFPUSHBUTTON "Cancel",IDCANCEL,197,63,45,14,NOT WS_TABSTOP + CONTROL "",IDC_MESSAGE1,"Static",SS_SIMPLE | SS_NOPREFIX,7,39, + 236,10 + CONTROL "",IDC_MESSAGE2,"Static",SS_SIMPLE | SS_NOPREFIX,7,50, + 236,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\Night Security Worker.ico" +IDI_DRIVE ICON DISCARDABLE "res\\ico00007.ico" +IDI_EXCLAM ICON DISCARDABLE "res\\ico00002.ico" +IDI_NORTONPROT ICON DISCARDABLE "res\\ico00001.ico" +IDI_NOTE ICON DISCARDABLE "res\\ico00003.ico" +IDI_RECYCLE ICON DISCARDABLE "res\\recycle.ico" +IDI_SCANDISK ICON DISCARDABLE "res\\ico00006.ico" +IDI_COPYFILES ICON DISCARDABLE "res\\icon1.ico" +IDI_BACKUP ICON DISCARDABLE "res\\icon2.ico" +IDI_ITEMS ICON DISCARDABLE "res\\items.ico" +IDI_NEW ICON DISCARDABLE "res\\ico00005.ico" +IDI_DEL ICON DISCARDABLE "res\\new1.ico" +IDI_ADVANCED ICON DISCARDABLE "res\\ico00004.ico" +IDI_PASSWORD ICON DISCARDABLE "res\\ico00008.ico" +IDI_WXPY ICON DISCARDABLE "res\\wxpy.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_DELETESWAPFILE REGISTRY DISCARDABLE "res\\DeleteSwapFile.rgs" +IDR_EMPTYRECYCLEBIN REGISTRY DISCARDABLE "EmptyRecycleBin.rgs" +IDR_EMPTYTEMPFOLDER REGISTRY DISCARDABLE "res\\EmptyTempFolder.rgs" +IDR_RUNSCANDISK REGISTRY DISCARDABLE "res\\RunScanDisk.rgs" +IDR_WIPEFREESPACE REGISTRY DISCARDABLE "res\\WipefreeSpace.rgs" +IDR_BACKUPSOURCEPROP REGISTRY DISCARDABLE "BackupSourceProp.rgs" +IDR_BACKUPDESTPROP REGISTRY DISCARDABLE "BackupDestProp.rgs" +IDR_BACKUPADVANCEDPROP REGISTRY DISCARDABLE "BackupAdvancedProp.rgs" +IDR_BACKUP REGISTRY DISCARDABLE "Backup.rgs" +IDR_ENCRYPT REGISTRY DISCARDABLE "Encrypt.rgs" +IDR_ENCRYPTSOURCEPROP REGISTRY DISCARDABLE "EncryptSourceProp.rgs" +IDR_ENCRYPTADVANCEDPROP REGISTRY DISCARDABLE "EncryptAdvancedProp.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_EMPTYRECYCLE, DIALOG + BEGIN + VERTGUIDE, 33 + END + + IDD_RUNSCANDISK, DIALOG + BEGIN + VERTGUIDE, 33 + END + + IDD_TEMPWARNDLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 243 + TOPMARGIN, 7 + BOTTOMMARGIN, 77 + END + + IDD_SOURCE, DIALOG + BEGIN + VERTGUIDE, 192 + BOTTOMMARGIN, 114 + END + + IDD_BACKUPDEST, DIALOG + BEGIN + BOTTOMMARGIN, 105 + END + + IDD_PROGRESSBACKUP, DIALOG + BEGIN + VERTGUIDE, 7 + VERTGUIDE, 242 + END + + IDD_PROGRESSENCRYPT, DIALOG + BEGIN + VERTGUIDE, 7 + VERTGUIDE, 242 + END + + IDD_PROGRESSTEMP, DIALOG + BEGIN + VERTGUIDE, 7 + VERTGUIDE, 242 + HORZGUIDE, 40 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AVI +// + +IDR_AVIBACKUP AVI DISCARDABLE "res\\161.avi" +IDR_AVIENCRYPT AVI DISCARDABLE "res\\enc.avi" +IDR_AVITEMP AVI DISCARDABLE "res\\temp.avi" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "NSCmpts" + IDS_TITLEBackupSourceProp "From" + IDS_NSHELPFILE "nightsec.hlp" + IDS_DOCSTRINGBackupSourceProp "Source to Backup From" + IDS_TITLEBackupDestProp "To" + IDS_RECYCLENAME "Empty Recycle Bin" + IDS_RECYCLEDESC "Empty your Recycle Bin and Norton Protected Files automatically. Any files you delete can easily be restored if they're in your Recycle Bin." + IDS_RECYCLEPARAM "r" + IDS_DOCSTRINGBackupDestProp "Backup Destination" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BACKUPNAME "Backup Data" + IDS_BACKUPDESC "Use this option to backup your important files to a disk, network or another location on your computer. " + IDS_TITLEBackupAdvancedProp "More" + IDS_DOCSTRINGBackupAdvancedProp "Advanced Options" + IDS_TEMPNAME "Empty Temp Folder" + IDS_TEMPDESC "Empties the folder where your Temp files are stored. Temp files are files programs make while running. These files can contain private information and should be deleted if a program leaves them laying around." + IDS_TEMPPARAM "t" + IDS_DELSWAP_BATCHTEXT "ECHO Deleting Swap File\r\nSET NSSWAP=%s\r\nIF NOT EXIST %%NSSWAP%%\\WIN386.SWP GOTO nsswaproot\r\nDEL %%NSSWAP%%\\WIN386.SWP\r\n:nsswaproot\r\nIF NOT EXIST C:\\WIN386.SWP GOTO nsswapend\r\nDEL C:\\WIN386.SWP\r\n:nsswapend\r\nECHO.\r\nECHO.\r\n\r\n" + IDS_DELSWAP_DESC "Deletes Windows Swap File. This file can contain sensitive information as Windows uses it for extra memory. " + IDS_DELSWAP_NAME "Delete Windows Swap File " + IDS_SCANDISK_NAME "Check hard disk for lost clusters" + IDS_SCANDISK_DESC "Checks for and deletes lost clusters. Lost clusters are areas on the hard disk that are marked as used but actually aren't. They can contain private information. " + IDS_SCANDISK_BATCHTEXT "SCANDISK /all %s %s /nosummary" + IDS_BACKUPPARAM "b" + IDS_ENCRYPTNAME "Encrypt Data" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ENCRYPTDESC "Use this option to encrypt all your data files. You'll need to have your XPY password. " + IDS_SCANDISK_NOSAVE "/nosave" + IDS_SCANDISK_AUTOFIX "/autofix" + IDS_WIPEFREE_NAME "Wipe free space" + IDS_WIPEFREE_DESC "Wipe the free space on your hard disk(s). When a file is deleted it isn't actually removed, only it's name is deleted from an index. This command overwrites your deleted files and is what the secure shutdown is all about." + IDS_WIPEFREE_BATCHTEXT "SET NSWIPER=%s\\NSWIPE.EXE\r\nIF EXIST %%NSWIPER%% GOTO nswipeokay\r\nECHO Couldn't find the Wiper Program! Make sure you installed Night Security correctly.\r\nPAUSE\r\nGOTO nswipeend\r\n:nswipeokay\r\n%%NSWIPER%% %s\r\n:nswipeend\r\nECHO.\r\nECHO.\r\n\r\n" + IDS_WIPEFREE_DRIVE "%s:" + IDS_ENCRYPTPARAM "x" + IDS_TITLERunScanDiskProps "Options" + IDS_DOCSTRINGRunScanDiskProps "Checks for and deletes lost clusters. " + IDS_TITLEEncryptSourceProp "Files" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_EMPTYCOMMAND "recycle" + IDS_NORTONCOMMAND "protected" + IDS_TITLERecycle "Options" + IDS_DOCSTRINGRecycle "Empty your Recycle Bin and Norton Protected Files automatically." + IDS_EMPTYTEMP_WARN "The folder %s doesn't look like a temp directory. Please check and make sure this is actually the folder where you keep temporary files. \n\nAre you sure you want to remove all the files inside it? " + IDS_TITLEWipeFreeSpace "Options" + IDS_DOCSTRINGWipeFreeSpace "Wipe the free space on your hard disk(s)." + IDS_BACKUP_NEWEXT "ext" + IDS_BACKUP_VALID_PATH "File or folder does not exist.\n\nClick the 'Add' button to add a folder, or try dragging a file into the list." + IDS_BACKUP_ERR_LIST "Couldn't list all the files in %F to backup. %e" + IDS_BACKUP_ERR_CREATE_DEST + "Couldn't create the backup destination folder %F. %e" + IDS_BACKUP_ERR_DEST "The backup destination path %F is invalid." + IDS_BACKUP_ERR_COPY "Couldn't backup the file %f. %e" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BACKUP_ERR_DISKFULL "The disk in drive %s is full. Please insert another empty disk." + IDS_ENCRYPT_ERR_LIST "Couldn't list all the files in %F to encrypt. %e" + IDS_ENCRYPT_ERR_XPYINIT "Couldn't initialize XPY for encryption. Make sure you installed correctly. %e" + IDS_ENCRYPT_ERR "Couldn't encrypt file %f. %e" + IDS_TEMP_ERR_LIST "Couldn't list all the files in the temp folder %F. %e" + IDS_TEMP_ERR_DELETE "Couldn't delete the temp file %f. %e" + IDS_TITLEEncryptAdvancedProp "More" + IDS_DOCSTRINGEncryptAdvancedProp "Advanced Encryption Options" + IDS_BACKUP_ERR_FILE "Couldn't backup the file %F. %e" + IDS_ENCRYPT_ERR_XPY "Couldn't initialize XPY for encryption. Please make sure the Menu Extensions are installed correctly. \n\n" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "NSCmpts.tlb" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/NSCmpts/NSCmptsps.def b/NSCmpts/NSCmptsps.def new file mode 100644 index 0000000..3f23af3 --- /dev/null +++ b/NSCmpts/NSCmptsps.def @@ -0,0 +1,11 @@ + +LIBRARY "NSCmptsPS" + +DESCRIPTION 'Proxy/Stub DLL' + +EXPORTS + DllGetClassObject @1 PRIVATE + DllCanUnloadNow @2 PRIVATE + GetProxyDllInfo @3 PRIVATE + DllRegisterServer @4 PRIVATE + DllUnregisterServer @5 PRIVATE diff --git a/NSCmpts/NSCmptsps.mk b/NSCmpts/NSCmptsps.mk new file mode 100644 index 0000000..9a85966 --- /dev/null +++ b/NSCmpts/NSCmptsps.mk @@ -0,0 +1,16 @@ + +NSCmptsps.dll: dlldata.obj NSCmpts_p.obj NSCmpts_i.obj + link /dll /out:NSCmptsps.dll /def:NSCmptsps.def /entry:DllMain dlldata.obj NSCmpts_p.obj NSCmpts_i.obj \ + kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ + +.c.obj: + cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ + $< + +clean: + @del NSCmptsps.dll + @del NSCmptsps.lib + @del NSCmptsps.exp + @del dlldata.obj + @del NSCmpts_p.obj + @del NSCmpts_i.obj diff --git a/NSCmpts/NSMessages.h b/NSCmpts/NSMessages.h new file mode 100644 index 0000000..f7a3930 --- /dev/null +++ b/NSCmpts/NSMessages.h @@ -0,0 +1,35 @@ +#ifndef __NS_MESSAGES_H__990929 +#define __NS_MESSAGES_H__990929 + + +struct NS_ERROR_DATA +{ + HRESULT hRes; + LPCTSTR szDesc; + LPARAM lParam; +}; + +struct NS_UPDATE_DATA +{ + LPCTSTR szMessage1; + LPCTSTR szMessage2; + long lCur; + long lTot; +}; + +/*struct NS_UPDATE_DATA +{ + LPCTSTR szMessage; + long lCur; + long lTot; +};*/ + +// WPARAM: NULL +// LPARAM: address of NS_ERROR_DATA +#define NSM_ERROR (WM_APP + 10) + +// WPARAM: NULL +// LPARAM: address of NS_UPDATE_DATA +#define NSM_UPDATE (NSM_ERROR + 1) + +#endif //__NS_MESSAGES_H__990929 \ No newline at end of file diff --git a/NSCmpts/NSSettings.h b/NSCmpts/NSSettings.h new file mode 100644 index 0000000..ab90341 --- /dev/null +++ b/NSCmpts/NSSettings.h @@ -0,0 +1,32 @@ +// NSSettings.h: interface for the CSettings class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_NSSETTINGS_H__4D76E505_722D_11D3_BF84_0020182B97FC__INCLUDED_) +#define AFX_NSSETTINGS_H__4D76E505_722D_11D3_BF84_0020182B97FC__INCLUDED_ + +#include +#include "../Common/CmptData.h" + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CNightSecSettings : + public settings, + public CPropertyBag +{ +public: + virtual HRESULT erase(const string& sKeyName) + { return DeleteProperty(sKeyName); }; + virtual HRESULT write_string(const string& sKeyName, const string& sValue) + { return WriteString(sKeyName, sValue); }; + virtual HRESULT write_int(const string& sKeyName, int nValue) + { return WriteInt(sKeyName, nValue); }; + virtual string get_string(const string& sKeyName, const string& sDefault) const + { return GetString(sKeyName, sDefault); }; + virtual int get_int(const string& sKeyName, int nDefault) const + { return GetInt(sKeyName, nDefault); } +}; + +#endif // !defined(AFX_NSSETTINGS_H__4D76E505_722D_11D3_BF84_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/NightSecError.cpp b/NSCmpts/NightSecError.cpp new file mode 100644 index 0000000..252c19a --- /dev/null +++ b/NSCmpts/NightSecError.cpp @@ -0,0 +1,176 @@ +// NightSecError.cpp : Implementation of CNSCmptsApp and DLL registration. + +#include "stdafx.h" +#include "NSCmpts.h" +#include "NightSecError.h" + +///////////////////////////////////////////////////////////////////////////// +// Set the current error to +void CBaseErrorImpl::SetError(const string& sDesc, HRESULT hRes, + LPCTSTR szHelpFile /*= _T("")*/, long lHelpContext /*= 0*/) +{ + // Initialize Other Stuff + m_hRes = hRes; + m_bsDescription = sDesc; + m_bsHelpFile = szHelpFile; + m_lHelpContext = lHelpContext; +} + +/*void CActionErrorImpl::SetError(CAction* pAction, const string& sDesc, HRESULT hRes, + LPCTSTR szHelpFile, long lHelpContext) +{ + // Attach to Action + m_pAction = pAction; + pAction->addref(); + + CBaseErrorImpl::SetError(sDesc, hRes, szHelpFile, lHelpContext); +} +*/ + +void CActionErrorImpl::Attach(CAction* pAction) +{ + // Attach to Action + ASSERT(pAction); + m_pAction = pAction; + pAction->addref(); +} + +////////////////////////////////////////////////////////////////////////// +// Fix the error + +STDMETHODIMP CActionErrorImpl::Fix() +{ + // Sanity Checks + ASSERT(m_pAction); + ASSERT(m_pAction->IsFixable(m_hRes)); + + if(!m_pAction) + return E_UNEXPECTED; + if(!m_pAction->IsFixable(m_hRes)) + return E_FAIL; + + // Fix it + try + { + m_pAction->Fix(m_hRes); + + // Clear error information + m_bsDescription = _T("Fixed Successfully"); + m_hRes = S_OK; + m_lHelpContext = 0; + } + catch(CActionError& err) + { + // Set new error information + m_hRes = err.m_hRes; + m_bsDescription = err.m_sDesc; + m_lHelpContext = 0; + } + + return m_hRes; +} + + +/////////////////////////////////////////////////////////////////// +// Check if fixable + +STDMETHODIMP CActionErrorImpl::get_Fixable(/*[out, retval]*/ BOOL* pbRet) +{ + ASSERT(m_pAction); + + if(!m_pAction) + return E_UNEXPECTED; + + *pbRet = m_pAction->IsFixable(m_hRes) ? TRUE : FALSE; + + return S_OK; +} + +//////////////////////////////////////////////////////////////////// +// Retry the action + +STDMETHODIMP CActionErrorImpl::Retry() +{ + // Sanity Checks + + ASSERT(m_pAction); + ASSERT(m_pAction->IsRetryable()); + + if(!m_pAction) + return E_UNEXPECTED; + if(!m_pAction->IsRetryable()) + return E_FAIL; + + // Do it Again + try + { + m_pAction->Do(NULL, NULL); + + // Clear error Information + m_hRes = S_OK; + m_bsDescription = _T("Completed Successfully"); + m_lHelpContext = 0; + } + catch(CActionError& err) + { + // Set New Error Information + m_hRes = err.m_hRes; + m_bsDescription = err.m_sDesc; + m_lHelpContext = 0; + } + + return m_hRes; + +} + + +///////////////////////////////////////////////////////////////////// +// Check if retryable + +STDMETHODIMP CActionErrorImpl::get_Retryable(/*[out, retval]*/ BOOL* pbRet) +{ + ASSERT(m_pAction); + + if(!m_pAction) + return E_UNEXPECTED; + + *pbRet = m_pAction->IsRetryable() ? TRUE : FALSE; + + return S_OK; +} + +void CNightSecErrorImpl::Attach(ISecureShutdownWin* pShutdown) +{ + // Attach to Secure Shutdown + ASSERT(pShutdown); + m_pShutdown = pShutdown; + m_pShutdown->AddRef(); +} + + +//////////////////////////////////////////////////////////////////// +// Retry the action + +STDMETHODIMP CNightSecErrorImpl::Retry() +{ + // Sanity Checks + ASSERT(m_pShutdown); + + if(!m_pShutdown) + return E_UNEXPECTED; + + + // Do it Again + HRESULT hr = m_pShutdown->DoShutdown(NULL, 0); + + if(SUCCEEDED(hr)) + { + // Clear error Information + m_hRes = S_OK; + m_bsDescription = _T("Completed Successfully"); + m_lHelpContext = 0; + } + // Otherwise it should have filled us up with new error info + + return m_hRes; +} diff --git a/NSCmpts/NightSecError.h b/NSCmpts/NightSecError.h new file mode 100644 index 0000000..164c5fb --- /dev/null +++ b/NSCmpts/NightSecError.h @@ -0,0 +1,134 @@ +// NightSecError.h: Definition of the CNightSecError class +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_NIGHTSECERROR_H__F6662FF3_94AB_11D3_BFC4_0020182B97FC__INCLUDED_) +#define AFX_NIGHTSECERROR_H__F6662FF3_94AB_11D3_BFC4_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" // main symbols +#include "../common/Defines.h" +#include "../common/interfaces.h" + +#include "ActionEngine.h" + +///////////////////////////////////////////////////////////////////////////// +// CXXXXErrorImpl: A COM object that gets added to INightSecErrorLog on +// the host + +class CBaseErrorImpl : + public INightSecError +{ +public: + CBaseErrorImpl() + : m_lHelpContext(0) {}; + + // Set the error codes for this object + void SetError(const string& sDesc, HRESULT hRes, + LPCTSTR szHelpFile = _T(""), long lHelpContext = 0); + void SetError(const string& sDesc, HRESULT hRes, long lHelpContext) + { SetError(sDesc, hRes, NS_HELP_FILE, lHelpContext); } + +// INightSecError +public: + STDMETHOD(get_Err)(/*[out, retval]*/ HRESULT* phRet) + { *phRet = m_hRes; return S_OK; } + STDMETHOD(get_Description)(/*[out, retval]*/ BSTR* pbsRet) + { *pbsRet = m_bsDescription.Copy(); return S_OK; } + STDMETHOD(get_HelpFile)(/*[out, retval]*/ BSTR* pbsRet) + { *pbsRet = m_bsHelpFile.Copy(); return S_OK; } + STDMETHOD(get_HelpContext)(/*[out, retval]*/ long* plRet) + { *plRet = m_lHelpContext; return S_OK; } + +protected: + CComBSTR m_bsDescription; // Description of Error + CComBSTR m_bsHelpFile; // Helpfile for Error + long m_lHelpContext; // Location in Help File + HRESULT m_hRes; // Original HRESULT +}; + +//////////////////////////////////////////////////////////////// +// This is a special case CBaseErrorImpl that wraps a +// CAction + +class CActionErrorImpl : + public CComObjectRoot, + public CBaseErrorImpl, + public INightSecErrorFix +{ + +// Construction +public: + CActionErrorImpl() + { m_pAction = NULL; }; + ~CActionErrorImpl() + { m_pAction->release(); } + + // Attach to this action (addrefs) + void Attach(CAction* pAction); + +// COM MAP +BEGIN_COM_MAP(CActionErrorImpl) + COM_INTERFACE_ENTRY(INightSecError) + COM_INTERFACE_ENTRY(INightSecErrorFix) +END_COM_MAP() + +DECLARE_NOT_AGGREGATABLE(CActionErrorImpl) + +// INightSecErrorFix +public: + STDMETHOD(Fix)(); + STDMETHOD(get_Fixable)(/*[out, retval]*/ BOOL* pbRet); + STDMETHOD(Retry)(); + STDMETHOD(get_Retryable)(/*[out, retval]*/ BOOL* pbRet); + +protected: + CAction* m_pAction; // Action that caused the error +}; + +/////////////////////////////////////////////////////////// +// Special Case CBaseErrorIpml that wraps a +// ISecureShutdownWin Object + +class CNightSecErrorImpl : + public CComObjectRoot, + public CBaseErrorImpl, + public INightSecErrorFix +{ + +// Construction +public: + CNightSecErrorImpl() + { m_pShutdown = NULL; }; + ~CNightSecErrorImpl() + { if(m_pShutdown) m_pShutdown->Release(); } + + // Attach to object (addrefs) + void Attach(ISecureShutdownWin* pShutdown); + +// COM MAP +BEGIN_COM_MAP(CActionErrorImpl) + COM_INTERFACE_ENTRY(INightSecError) + COM_INTERFACE_ENTRY(INightSecErrorFix) +END_COM_MAP() + +DECLARE_NOT_AGGREGATABLE(CActionErrorImpl) + +// INightSecErrorFix +public: + STDMETHOD(Fix)() + { return E_FAIL; }; + STDMETHOD(get_Fixable)(/*[out, retval]*/ BOOL* pbRet) + { *pbRet = FALSE; return S_OK; }; + STDMETHOD(Retry)(); + STDMETHOD(get_Retryable)(/*[out, retval]*/ BOOL* pbRet) + { *pbRet = TRUE; return S_OK; }; + +protected: + ISecureShutdownWin* m_pShutdown; // Object that caused the error +}; + +#endif // !defined(AFX_NIGHTSECERROR_H__F6662FF3_94AB_11D3_BFC4_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/ProgressDlg.cpp b/NSCmpts/ProgressDlg.cpp new file mode 100644 index 0000000..9f1ae5c --- /dev/null +++ b/NSCmpts/ProgressDlg.cpp @@ -0,0 +1,151 @@ +// ProgressDlg.cpp : Implementation of CProgressDlg +#include "stdafx.h" +#include "ProgressDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CProgressDlg + +CActionProgressDlg::CActionProgressDlg(IUnknown* pSite, UINT nIDD) + : CDialogImplEx(nIDD) +{ + m_pUnk = pSite; + m_bCancel = false; +} + +CActionProgressDlg::~CActionProgressDlg() +{ + if(IsWindow()) + DestroyWindow(); + + // Release any pointers we're holding on to + if(m_pUnk) + m_pUnk->Release(); + if(m_pErrorLog) + m_pErrorLog->Release(); +} + +LRESULT CActionProgressDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Used later + m_ctlProgress = GetDlgItem(IDC_PROGRESS); + + CenterWindow(GetDesktopWindow()); + + // This sets up the Event Mechanism + if(m_pUnk != NULL) + DispEventAdvise(m_pUnk); // Pointer from IObjectWithSite + + return 1; // Let the system set the focus +} + +LRESULT CActionProgressDlg::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + + // Release any pointers we're holding on to + if(m_pUnk) + { + // Drop the Event Stuff + DispEventUnadvise(m_pUnk); // Pointer from IObjectWithSite + + m_pUnk->Release(); + } + if(m_pErrorLog) + m_pErrorLog->Release(); + + return 0; +} + +// Update Message from Action Engine +LRESULT CActionProgressDlg::OnUpdateFile(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + NS_UPDATE_DATA* pData = (NS_UPDATE_DATA*)lParam; + + // If there 0 in the total then clear + if(pData->lTot == 0) + { + m_ctlProgress.SetRange(0, 1); + m_ctlProgress.SetPos(0); + } + else + { + // If total != -1 then change range + if(pData->lTot > 0) + m_ctlProgress.SetRange(0, pData->lTot); + + // If Current changed (!= -1) then set state + if(pData->lCur >= 0) + m_ctlProgress.SetPos(pData->lCur); + } + + // If there's a message display it + if(pData->szMessage1) + ::SetWindowText(GetDlgItem(IDC_MESSAGE1), pData->szMessage1); + if(pData->szMessage2) + ::SetWindowText(GetDlgItem(IDC_MESSAGE2), pData->szMessage2); + + // If m_bCancel is set then this cancels the CActionEngine + return m_bCancel ? 0 : 1; +} + +// Called in response to the button being pressed, window being closed, or +// event being fired +LRESULT CActionProgressDlg::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + // This gets checked when the Engine sends and Update (OnUpdateFile) + m_bCancel = true; + + // We're working on cancelling so reflect that in UI + ::SetWindowText(GetDlgItem(IDCANCEL), _T("Cancelling...")); + ::EnableWindow(GetDlgItem(IDCANCEL), FALSE); + return 0; +} + +// Called when event Fired +STDMETHODIMP CActionProgressDlg::OnCancelEv() +{ + // Just call normal cancel event + BOOL bHandled = TRUE; + OnCancel(0, 0, NULL, bHandled); + + return S_OK; +}; + +// Error Message from CActionEngine +LRESULT CActionProgressDlg::OnError(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // See if we can get an INightSecErrorLog pointer that IObjectWithSite + // gave us + if(m_pErrorLog == NULL) + m_pErrorLog = m_pUnk; + + if(m_pErrorLog == NULL) + return 0; + + // Create a new NightSecError object + CComObject* pError = NULL; + HRESULT hr = CComObject::CreateInstance(&pError); + + if(FAILED(hr)) + return 0; + + // Set info on the Error Object + NS_ERROR_DATA* pData = (NS_ERROR_DATA*)lParam; + pError->SetError(pData->szDesc, pData->hRes); + pError->Attach((CAction*)pData->lParam); + + // Send it to the INightSecErrorLog + m_pErrorLog->AddError(pError->GetUnknown()); + + return 0; +} + +// Starts the AVI file playing from resources +bool CActionProgressDlg::PlayAmination(UINT nID) +{ + ASSERT(IsWindow()); + ASSERT(GetDlgItem(IDC_ANIMATION)); + + // Dialog box should have AutoPlay enabled + return ((BOOL)::SendMessage(GetDlgItem(IDC_ANIMATION), ACM_OPEN, 0, (LPARAM)MAKEINTRESOURCE(nID))) ? true : false; +} + diff --git a/NSCmpts/ProgressDlg.h b/NSCmpts/ProgressDlg.h new file mode 100644 index 0000000..b8bc7d6 --- /dev/null +++ b/NSCmpts/ProgressDlg.h @@ -0,0 +1,73 @@ +// ProgressDlg.h : Declaration of the CActionProgressDlg + +#ifndef __ProgressDLG_H_ +#define __ProgressDLG_H_ + +#include "resource.h" // main symbols +#include +#include +#include "NSMessages.h" +#include "../common/events.h" +#include "../common/interfaces.h" +#include "NightSecError.h" + +///////////////////////////////////////////////////////////////////////////// +// CActionProgressDlg +// This is the update window the Action Engine +// Handles receiving of the error and update messages +// Also catches events from host program + +class CActionProgressDlg : + public CDialogImplEx, + public IDispEventImpl<0, CActionProgressDlg, &DIID_DShutdownEvents, &LIBID_NightSecShutdown, 2, 5> +{ +public: + // Construction + CActionProgressDlg(IUnknown* pSite, UINT nIDD); + ~CActionProgressDlg(); + +// Catch Cancel Events +BEGIN_SINK_MAP(CActionProgressDlg) + SINK_ENTRY_EX(0, DIID_DShutdownEvents, 1, OnCancelEv) +END_SINK_MAP() + +// Message Map +BEGIN_MSG_MAP(CActionProgressDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(NSM_UPDATE, OnUpdateFile) + MESSAGE_HANDLER(NSM_ERROR, OnError) + COMMAND_ID_HANDLER(IDCANCEL, OnCancel) +END_MSG_MAP() + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + // Message from Action Engine + LRESULT OnUpdateFile(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + + // Called in response to the button being pressed, window being closed, or + // event being fired + LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + // Called when event Fired + STDMETHOD(OnCancelEv)(); + + // Message from CActionEngine + LRESULT OnError(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + bool PlayAmination(UINT nID); + + +protected: + bool m_bCancel; // True when cancelled, but not stopped + CProgressBarCtrl m_ctlProgress; // Progress Bar + IUnknownPtr m_pUnk; // Pointer from IObjectWithSite + INightSecErrorLogPtr m_pErrorLog; // ErrorLog on same object as m_pUnk +}; + +#endif //__ProgressDLG_H_ diff --git a/NSCmpts/PromptClose.cpp b/NSCmpts/PromptClose.cpp new file mode 100644 index 0000000..8871415 --- /dev/null +++ b/NSCmpts/PromptClose.cpp @@ -0,0 +1,11 @@ +// PromptClose.cpp: implementation of the CPromptClose class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "PromptClose.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + diff --git a/NSCmpts/PromptClose.h b/NSCmpts/PromptClose.h new file mode 100644 index 0000000..a10c058 --- /dev/null +++ b/NSCmpts/PromptClose.h @@ -0,0 +1,51 @@ +// PromptClose.h: interface for the CPromptClose class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PROMPTCLOSE_H__5BB78C71_C041_11D3_8306_005056C1D336__INCLUDED_) +#define AFX_PROMPTCLOSE_H__5BB78C71_C041_11D3_8306_005056C1D336__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +template +class CPromptCloseT : public CWindowImplBaseT< TBase > +{ +public: + CPromptCloseT() + { + m_nIDRet = IDCANCEL; + } + + bool CloseNext(UINT nRet) + { + m_nIDRet = nRet; + _Module.AddCreateWndData(&m_thunk.cd, this); + return HOOK_AND_SUBCLASS_NEXT() ? true : false; + } + + +BEGIN_MSG_MAP(CPromptCloseT) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) +END_MSG_MAP() + + DECLARE_HOOK_AND_SUBCLASS(CPromptCloseT) + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + EndDialog(m_hWnd, m_nIDRet); + UnsubclassWindow(); + // Hide this Dialog + return TRUE; + } + +protected: + UINT m_nIDRet; +}; + +typedef CPromptCloseT CPromptClose; + +#endif // !defined(AFX_PROMPTCLOSE_H__5BB78C71_C041_11D3_8306_005056C1D336__INCLUDED_) 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 + +///////////////////////////////////////////////////////////////////////////// +// CRunScanDisk + +STDMETHODIMP CRunScanDisk::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownDOS, + }; + for (int i=0;i= 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; +} diff --git a/NSCmpts/RunScanDisk.h b/NSCmpts/RunScanDisk.h new file mode 100644 index 0000000..79d261a --- /dev/null +++ b/NSCmpts/RunScanDisk.h @@ -0,0 +1,107 @@ +// RunScanDisk.h : Declaration of the CRunScanDisk + +#ifndef __RUNSCANDISK_H_ +#define __RUNSCANDISK_H_ + +#include "resource.h" // main symbols +#include "..\Common\CmptData.h" +#include + +///////////////////////////////////////////////////////////////////////////// +// CRunScanDisk +class ATL_NO_VTABLE CRunScanDisk : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl, + public IPropertyPageImpl, + public CDialogImplEx, + public CContextHelp +// public CDialogImpl + +{ +// Construction +public: + CRunScanDisk() : CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLERunScanDiskProps; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGRunScanDiskProps; + } + ~CRunScanDisk() + { ATLTRACE(_T("Destroying RunScanDisk\n")); } + HRESULT FinalConstruct(); + + +DECLARE_REGISTRY_RESOURCEID(IDR_RUNSCANDISK) + +BEGIN_COM_MAP(CRunScanDisk) + COM_INTERFACE_ENTRY(ISecureShutdownDOS) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY_IMPL(IPropertyPage) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownDOS +public: + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + STDMETHOD(GetBatchText)(/*[out, retval]*/ BSTR* psText); + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + +// Data +protected: + CPropertyBag m_Data; + +/////////////////////////////////////////////////////////////////// +// Property Sheet Stuff + +public: + enum {IDD = IDD_RUNSCANDISK}; + +BEGIN_MSG_MAP(CRunScanDisk) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_HANDLER(IDC_AUTOFIX, BN_CLICKED, OnAutoFix) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) +END_MSG_MAP() + +BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_AUTOFIX, 4021) + HELP_ID(IDC_SAVE, 4023) + HELP_ID(IDC_NOSAVE, 4022) +END_HELP_MAP + +// Property Sheet Messages + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnAutoFix(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + + STDMETHOD(Apply)(void) + { + ATLTRACE(_T("CClearInetCache::Apply\n")); + + HRESULT hr; + HRESULT hrRet = S_OK; + + // Save AutoFix State + hr = m_Data.WriteInt(_T("Auto Fix"), IsDlgButtonChecked(IDC_AUTOFIX)); + if(FAILED(hr)) hrRet = hr; + + // Save Cluster State + hr = m_Data.WriteInt(_T("Save Clusters"), IsDlgButtonChecked(IDC_SAVE)); + if(FAILED(hr)) hrRet = hr; + + m_bDirty = FALSE; + return hrRet; + + } + +protected: + bool UpdateAutoFix(); + +}; + +#endif //__RUNSCANDISK_H_ diff --git a/NSCmpts/SourceProp.cpp b/NSCmpts/SourceProp.cpp new file mode 100644 index 0000000..40cb0bf --- /dev/null +++ b/NSCmpts/SourceProp.cpp @@ -0,0 +1,306 @@ +// SourceProp.cpp : Implementation of CSourceProp +#include "stdafx.h" +#include "NSCmpts.h" +#include "SourceProp.h" +#include + +///////////////////////////////////////////////////////////////////////////// +// CSourceProp + +LRESULT CSourceProp::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + // Load the System Image list + m_imgList.Load(true); + + // Set the List + m_ctlList = GetDlgItem(IDC_SOURCE_LIST); + m_ctlList.SetImageList(m_imgList, LVSIL_SMALL); + + // We need at least one bogus column since we're using + // report view + LV_COLUMN lvC; // list view column structure + + // Now initialize the columns you will need. + // Initialize the LV_COLUMN structure. + // The mask specifies that the fmt, width, pszText, and subitem members + // of the structure are valid. + lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; + lvC.fmt = LVCFMT_LEFT; // left-align column + lvC.cx = 200; // width of column in pixels + lvC.iSubItem = 0; + + if(m_ctlList.InsertColumn(0, &lvC) == -1) + return true; + + bHandled = true; + return TRUE; +} + +LRESULT CSourceProp::OnChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + // Make sure the column is the width of control + RECT rect; + m_ctlList.GetClientRect(&rect); + m_ctlList.SetColumnWidth(0, rect.right); + + return 0; +} + + +LRESULT CSourceProp::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + UpdateData(true); + return 0; +} + +LRESULT CSourceProp::OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + HWND hwndParent = GetParent(); + + // Sets the DropTarget for the Parent Window and removes + // it when hidden. For some reason if we set it for the + // property page itself it doesn't work. + // + // Since there could be multiple property pages fiddling + // with the parent windows Drag Drop Status, we use a + // window property to keep track of the current owner. + + if(wParam) + { + IDropTarget* pTarget = NULL; + QueryInterface(IID_IDropTarget, (void**)&pTarget); + ASSERT(pTarget); + + // Not mission critical (used only for drag drop) + RevokeDragDrop(hwndParent); + HRESULT hr = RegisterDragDrop(hwndParent, pTarget); + + // Register Drag Drop Addrefs + pTarget->Release(); + + // Set the window property to a pointer to us + if(SUCCEEDED(hr)) + SetProp(hwndParent, _T("DropTarget"), (HANDLE)this); + } + else + { + // If window property is pointer to us then ... + if((CSourceProp*)GetProp(hwndParent, _T("DropTarget")) == this) + { + // Remove Drag Drop + RevokeDragDrop(hwndParent); + RemoveProp(hwndParent, _T("DropTarget")); + } + } + + return 0; +} + +LRESULT CSourceProp::OnEndLabelEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + LVITEM* pItem = &((NMLVDISPINFO*)pnmh)->item; + + // Only Change if there is Text + if(pItem->pszText == NULL) + return 0; + + file_path path(pItem->pszText); + if(path.exists()) + { + pItem->iImage = m_imgList.GetFileIndex(pItem->pszText); + // WINBUG: Windows 95 (original version) doesn't set LVIF_TEXT + // have to set it here. + pItem->mask |= (LVIF_IMAGE | LVIF_TEXT); + + // Set Item text + m_ctlList.SetItem(pItem); + } + else + { + string sTemp; + sTemp.load_string(IDS_BACKUP_VALID_PATH); + + MessageBox(sTemp, _T("Night Security"), MB_OK | MB_ICONWARNING); + } + + return 0; +} + +LRESULT CSourceProp::OnListSetFocus(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + // Disclaimer: This is a kludge fix + // SysListView32 wouldn't redraw itself when it had focus + // and app was activated + m_ctlList.Invalidate(); + m_ctlList.RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + return 0; +} + +LRESULT CSourceProp::OnKeyDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) +{ + NMLVKEYDOWN* pLVKeyDow = (NMLVKEYDOWN*)pnmh; + + // if F2 then Edit + if(pLVKeyDow->wVKey == VK_F2) + { + m_ctlList.SetFocus(); // Needs to have the Focus in order to edit + m_ctlList.EditLabel(m_ctlList.GetNextItem(-1, LVNI_ALL | LVNI_FOCUSED)); + } + + // If Delete then call Delete Handler + if(pLVKeyDow->wVKey == VK_DELETE) + { + OnRemove(0, 0, 0, bHandled); + } + + return 0; +} + +LRESULT CSourceProp::OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + int iItem = -1; + + // Loop through selected items + while((iItem = m_ctlList.GetNextItem(-1, LVNI_ALL | LVNI_SELECTED)) != -1) + // Take it out of List Box + m_ctlList.DeleteItem(iItem); + + return 0; +} + +LRESULT CSourceProp::OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + LPMALLOC pMalloc; + if(FAILED(::SHGetMalloc(&pMalloc))) + return 0; + + TCHAR buff[MAX_PATH]; + BROWSEINFO bi; + bi.hwndOwner = m_hWnd; + bi.pidlRoot = NULL; + bi.pszDisplayName = buff; + bi.lpszTitle = _T("Choose a folder to add."); + bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; + bi.lpfn = NULL; + bi.lParam = 0; + + LPITEMIDLIST pidl = SHBrowseForFolder(&bi); + + if(pidl == NULL) + return 0; + + if(::SHGetPathFromIDList(pidl, buff)) + AddFile(buff); + + pMalloc->Free(pidl); + pMalloc->Release(); + + bHandled = true; + return 0; +} + +bool CSourceProp::AddFile(string sFileName) +{ + int nIndex = m_imgList.GetFileIndex(sFileName); + + LVITEM lv; + lv.mask = LVIF_TEXT | LVIF_IMAGE; + lv.iItem = 0; + lv.iSubItem = 0; + lv.pszText = sFileName.get_buffer(sFileName.size() + 1); + lv.iImage = nIndex; + + return ListView_InsertItem(GetDlgItem(IDC_SOURCE_LIST), &lv) >= 0; +} + +STDMETHODIMP CSourceProp::DragEnter(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) +{ + HRESULT hr = E_FAIL; + FORMATETC fmte = + { + CF_HDROP, // use CF_HDROP format + NULL, // no specific device required + DVASPECT_CONTENT, // embedded object + -1, // must be -1 for DVASPECT_CONTENT + TYMED_HGLOBAL // how to transfer data + }; + STGMEDIUM medium; + + // No data object + if (pDataObject == NULL) + return E_FAIL; + + // Use the given IDataObject to get a list of filenames (CF_HDROP). + hr = pDataObject->GetData(&fmte, &medium); + + if(SUCCEEDED(hr)) + { + ReleaseStgMedium(&medium); + *pdwEffect = DROPEFFECT_LINK; + } + else + *pdwEffect = DROPEFFECT_NONE; + + return hr; +} + +STDMETHODIMP CSourceProp::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) +{ + HRESULT hr = E_FAIL; + FORMATETC fmte = + { + CF_HDROP, // use CF_HDROP format + NULL, // no specific device required + DVASPECT_CONTENT, // embedded object + -1, // must be -1 for DVASPECT_CONTENT + TYMED_HGLOBAL // how to transfer data + }; + STGMEDIUM medium; + + // No data object + if(!pDataObject) + return hr; + + // Use the given IDataObject to get a list of filenames (CF_HDROP). + hr = pDataObject->GetData(&fmte, &medium); + + if(FAILED(hr)) + return hr; + + // Get Number of Files + int nFiles = DragQueryFile((HDROP)medium.hGlobal, (UINT) -1, NULL, 0); + + string sFile; + int nTotLength = 0; + + // Okay now Circle through and get all the files + for (int nCnt = 0; nCnt < nFiles; nCnt++) + { + if(DragQueryFile((HDROP) medium.hGlobal, nCnt, sFile.get_buffer(MAX_PATH), MAX_PATH)) + AddFile(sFile); + } + + // Release the data. + ReleaseStgMedium(&medium); + + return hr; +} + +void CSourceProp::UpdateData(bool bSave) +{ + if(bSave) + { + m_aPaths.clear(); + TCHAR buff[MAX_PATH]; + int nItem = 0; + while(m_ctlList.GetItemText(nItem++, 0, buff, MAX_PATH)) + m_aPaths.push_back(buff); + } + else + { + string_array::const_iterator iter = m_aPaths.begin(); + for(; iter != m_aPaths.end(); iter++) + AddFile(*iter); + } + +} diff --git a/NSCmpts/SourceProp.h b/NSCmpts/SourceProp.h new file mode 100644 index 0000000..9e3aa46 --- /dev/null +++ b/NSCmpts/SourceProp.h @@ -0,0 +1,80 @@ +// SourceProp.h : Declaration of the CSourceProp + +#ifndef __SOURCEPROP_H_ +#define __SOURCEPROP_H_ + +#include "resource.h" // main symbols + +#include "../common/cmptdata.h" + +#include +#include +#include +#include +#include + + +///////////////////////////////////////////////////////////////////////////// +// CSourceProp: Base functionality for Night Sec File List Property Pages +// With dragdrop, browse etc... + +class ATL_NO_VTABLE CSourceProp : +// public CDialogImpl, + public CDialogImplEx, + public IDropTarget +{ +public: + CSourceProp() : CDialogImplEx(IDD_SOURCE) {} + + enum { IDD = IDD_SOURCE }; + +BEGIN_MSG_MAP(CSourceProp) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_SHOWWINDOW, OnShowWindow) + NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_ENDLABELEDIT, OnEndLabelEdit) + NOTIFY_HANDLER(IDC_SOURCE_LIST, NM_SETFOCUS, OnListSetFocus) + NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_KEYDOWN, OnKeyDown) + NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_ITEMCHANGED, OnChange) + NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_INSERTITEM, OnChange) + NOTIFY_HANDLER(IDC_SOURCE_LIST, LVN_DELETEITEM, OnChange) + COMMAND_ID_HANDLER(IDC_ADD, OnAdd) + COMMAND_ID_HANDLER(IDC_REMOVE, OnRemove) +END_MSG_MAP() + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnEndLabelEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnListSetFocus(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnKeyDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + LRESULT OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + + bool AddFile(string sFileName); + +protected: + CSysImageList m_imgList; + CListViewCtrl m_ctlList; + string_array m_aPaths; + + void UpdateData(bool bSave = true); + +// IDropTarget +public: + STDMETHOD(DragEnter)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); + STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) + { return S_OK; } + STDMETHOD(DragLeave)(void) + { return S_OK; } + STDMETHOD(Drop)(IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect); +}; + +#endif //__SOURCEPROP_H_ diff --git a/NSCmpts/StdAfx.cpp b/NSCmpts/StdAfx.cpp new file mode 100644 index 0000000..a5eea17 --- /dev/null +++ b/NSCmpts/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/NSCmpts/StdAfx.h b/NSCmpts/StdAfx.h new file mode 100644 index 0000000..1edb277 --- /dev/null +++ b/NSCmpts/StdAfx.h @@ -0,0 +1,48 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__EAA0D02A_91CC_11D3_BFBF_0020182B97FC__INCLUDED_) +#define AFX_STDAFX_H__EAA0D02A_91CC_11D3_BFBF_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define STRICT + +// Windows 95 Compatible +#undef WINVER +#define WINVER 0x0400 +#undef _WIN32_WINNT + +// Don't want our program dependant on some browser! +#undef _WIN32_IE +#define _WIN32_IE 0x0000 + +#define _ATL_APARTMENT_THREADED + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include +#include +#include + +#define NO_KEY _T("No Key") + +#include +using std::find; +using std::copy; +using std::inserter; +using std::replace; +using std::for_each; + +#include "../common/types.h" +#include "../common/defines.h" +#include +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__EAA0D02A_91CC_11D3_BFBF_0020182B97FC__INCLUDED) diff --git a/NSCmpts/TempActions.cpp b/NSCmpts/TempActions.cpp new file mode 100644 index 0000000..24c8a91 --- /dev/null +++ b/NSCmpts/TempActions.cpp @@ -0,0 +1,153 @@ +// TempActions.cpp: implementation of the CEncryptActions class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "TempActions.h" + +#include "resource.h" +#include + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +bool CTempActions::DeletePrepare::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + ASSERT(pEngine != NULL); + + // Need to create another array for the folders + // since they need to pushed on backwards after the files + // so we don't get "Folder not empty" errors + action_array aFolders; + + Update(hwndUpdates, _T("Preparing to clear Temp Folder...")); + + file_iterator fileIter(m_tempFolder, file_iterator::sub_folders | file_iterator::full_paths), end; + for( ; fileIter != end; fileIter++) + { + file_path srcFile(fileIter->cFileName); + + CAction* pAction; + if(srcFile.attributes() & FILE_ATTRIBUTE_DIRECTORY) + { + pAction = new DeleteFolder(srcFile); + aFolders.push_back(pAction); + } + else + { + pAction = new DeleteFile(srcFile); + pEngine->Add(pAction); + } + } + + while(!aFolders.empty()) + { + pEngine->Add(aFolders.back()); + aFolders.pop_back(); + } + + // Error from file_iterator (listing folders) + if(fileIter.state() != ERROR_SUCCESS) + throw CActionError(HRESULT_FROM_WIN32(fileIter.state()), IDS_TEMP_ERR_LIST, m_tempFolder); + + return false; +} + +HRESULT CTempActions::DeletePrepare::Initialize(const file_path& temp_folder) +{ + m_tempFolder = temp_folder; + return S_OK; +} + +bool CTempActions::DeleteFile::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + // Update any monitors + Update(hwndUpdates, m_file); + + ::SetFileAttributes(m_file, FILE_ATTRIBUTE_NORMAL); + + try + { + if(!::DeleteFile(m_file)) + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_TEMP_ERR_DELETE, m_file); + } + catch(CActionError& err) + { + // These errors are okay. The file is gone + if(err.m_hRes != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) && + err.m_hRes != HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)) + throw; + } + + return false; + +} +bool CTempActions::DeleteFile::IsFixable(HRESULT hr) const +{ + return (hr == HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) || + hr == HRESULT_FROM_WIN32(ERROR_LOCK_VIOLATION) || + hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || + hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)); +} + +void CTempActions::DeleteFile::Fix(HRESULT hr) +{ + bool bFirst = true; + +start: + + if(IsFixable(hr)) + { + try + { + // Try again + Do(NULL, NULL); + return; + + } + catch(CActionError& err) + { + // If it's the first around and the error is the same... + if(bFirst && IsFixable(err.m_hRes)) + { + // ... Prompt user to close programs + MessageBox(NULL, _T("Many programs keep files in the temp folder. These files cannot be deleted while the program is open. Close all other programs and then click the OK button."), _T("Empty Temp Folder"), MB_OK | MB_ICONINFORMATION); + bFirst = false; + } + // Otherwise out with the error + else + throw; + } + } + + goto start; +} + +bool CTempActions::DeleteFolder::Do(CActionEngine* pEngine, + HWND hwndUpdates) +{ + // Update any monitors + Update(hwndUpdates, m_folder); + + if(!::RemoveDirectory(m_folder)) + { + DWORD dwError = ::GetLastError(); + + // This error will be accompanied by another file error + // so we don't need to show it + if(dwError != ERROR_DIR_NOT_EMPTY) + throw CActionError(HRESULT_FROM_WIN32(::GetLastError()), IDS_TEMP_ERR_DELETE, m_folder); + } + + return false; + +} + +void CTempActions::DeleteFolder::Fix(HRESULT hr) +{ + +} diff --git a/NSCmpts/TempActions.h b/NSCmpts/TempActions.h new file mode 100644 index 0000000..5b78d1e --- /dev/null +++ b/NSCmpts/TempActions.h @@ -0,0 +1,79 @@ +// TempActions.h: interface for the CBackupActions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TEMPACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) +#define AFX_TEMPACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ActionEngine.h" +#include +#include + +class CTempActions +{ +public: + + class DeleteFile : public CAction + { + public: + DeleteFile(const file_path& file) + { + m_file = file; + } + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr); + virtual bool IsFixable(HRESULT hr) const; + virtual bool IsRetryable() const + { return true; } + + protected: + file_path m_file; + static HWND hWndParent; + }; + + class DeleteFolder : public CAction + { + public: + DeleteFolder(const file_path& folder) + { + m_folder = folder; + } + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr); + virtual bool IsFixable(HRESULT hr) const + { return false; } + virtual bool IsRetryable() const + { return true; } + + protected: + file_path m_folder; + }; + + class DeletePrepare : public CAction + { + public: + DeletePrepare() {}; + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr) { } + virtual bool IsFixable(HRESULT hr) const + { return false; } + virtual bool IsRetryable() const + { return false; } + + HRESULT Initialize(const file_path& temp_folder); + + protected: + file_path m_tempFolder; + friend class Encrypt; + }; + +}; + +#endif // !defined(AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) diff --git a/NSCmpts/TempWarnDlg.cpp b/NSCmpts/TempWarnDlg.cpp new file mode 100644 index 0000000..702519e --- /dev/null +++ b/NSCmpts/TempWarnDlg.cpp @@ -0,0 +1,44 @@ +// TempWarnDlg.cpp : Implementation of CTempWarnDlg +#include "stdafx.h" +#include "TempWarnDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CTempWarnDlg + +CTempWarnDlg::CTempWarnDlg(const string& sFolderName) + : CDialogImplEx(IDD) +{ + m_sFolderName = sFolderName; + m_bNotAgain = false; +} + +CTempWarnDlg::~CTempWarnDlg() +{ + +} + +LRESULT CTempWarnDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + string sTemp; + sTemp.format(IDS_EMPTYTEMP_WARN, (LPCTSTR)m_sFolderName); + + SetDlgItemText(IDC_FOLDERWARN, sTemp); + CheckDlgButton(IDC_DONTSHOW, m_bNotAgain); + + return 1; // Let the system set the focus +} + +LRESULT CTempWarnDlg::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + m_bNotAgain = IsDlgButtonChecked(IDC_DONTSHOW) ? true : false; + EndDialog(wID); + return 0; +} + +LRESULT CTempWarnDlg::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + m_bNotAgain = IsDlgButtonChecked(IDC_DONTSHOW) ? true : false; + EndDialog(wID); + return 0; +} + diff --git a/NSCmpts/TempWarnDlg.h b/NSCmpts/TempWarnDlg.h new file mode 100644 index 0000000..1c007b2 --- /dev/null +++ b/NSCmpts/TempWarnDlg.h @@ -0,0 +1,35 @@ +// TempWarnDlg.h : Declaration of the CTempWarnDlg + +#ifndef __TEMPWARNDLG_H_ +#define __TEMPWARNDLG_H_ + +#include "resource.h" // main symbols +#include + +///////////////////////////////////////////////////////////////////////////// +// CTempWarnDlg +class CTempWarnDlg : + public CDialogImplEx +// public CDialogImpl +{ +public: + CTempWarnDlg(const string& sFolderName); + ~CTempWarnDlg(); + + enum { IDD = IDD_TEMPWARNDLG }; + +BEGIN_MSG_MAP(CTempWarnDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_ID_HANDLER(IDOK, OnOK) + COMMAND_ID_HANDLER(IDCANCEL, OnCancel) +END_MSG_MAP() + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + + string m_sFolderName; + bool m_bNotAgain; +}; + +#endif //__TEMPWARNDLG_H_ diff --git a/NSCmpts/WipefreeSpace.cpp b/NSCmpts/WipefreeSpace.cpp new file mode 100644 index 0000000..72bc199 --- /dev/null +++ b/NSCmpts/WipefreeSpace.cpp @@ -0,0 +1,217 @@ +// WipefreeSpace.cpp : Implementation of CWipefreeSpace +#include "stdafx.h" +#include "NSCmpts.h" +#include "WipefreeSpace.h" + +///////////////////////////////////////////////////////////////////////////// +// CWipefreeSpace + +STDMETHODIMP CWipefreeSpace::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownDOS, + }; + for (int i=0;ivt = VT_BSTR; + bsRetVal.LoadString(IDS_WIPEFREE_NAME); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + case nsHelpText: + pvVal->vt = VT_BSTR; + bsRetVal.LoadString(IDS_WIPEFREE_DESC); + pvVal->bstrVal = bsRetVal.Detach(); + return S_OK; + } + + ::VariantClear(pvVal); + return S_FALSE; +} + + +STDMETHODIMP CWipefreeSpace::SetData(IUnknown* pUnk) +{ + return m_Data.Initialize(pUnk); +} + +/////////////////////////////////////////////////////////////////////////////// +// Property Sheet Stuff + +STDMETHODIMP CWipefreeSpace::Apply() +{ + ATLTRACE(_T("CClearInetCache::Apply\n")); + + string sTemp; + string sDrives; + + // If the user has selected just some drives then + // save them individually + if(m_bCustomDrives) + { + for(int nCnt = 0; nCnt < m_nDrives; nCnt++) + { + // Loop through check boxes + if(IsDlgButtonChecked(IDC_FIRST_DRIVE + nCnt)) + { + // Get Label of Checked Button + ::GetWindowText(GetDlgItem(IDC_FIRST_DRIVE + nCnt), sTemp.get_buffer(10), 10); + sTemp.release_buffer(); + + // Label should be "Drive C" (C is the 7th Char) + sDrives += sTemp[6]; + + } + + } + } + // All Drives + else + sDrives = _T("!!!"); + + m_bDirty = FALSE; + return m_Data.WriteString(_T("Drives"), sDrives); + +} + +LRESULT CWipefreeSpace::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + string sDrives; + string sTemp; + + // Get Property + string sSelectedDrives = m_Data.GetString(_T("Drives"), _T("!!!")); + + // Has the User Changed the Defaults? + m_bCustomDrives = (sSelectedDrives != _T("!!!")); + + ::GetLogicalDriveStrings(220, sDrives.get_buffer(220)); + sDrives.release_buffer(); + + sSelectedDrives.make_upper(); + + LPCTSTR szCurDrive = sDrives; // Pointer to Current Drive in sDrives + int nCnt = 0; // Current Drive Num (for interface) + + + // Loop Through Drives + while(szCurDrive[0] != _T('\0')) + { + // We're only interested in fixed drives + if(GetDriveType(szCurDrive) == DRIVE_FIXED) + { + sTemp = szCurDrive; + sTemp.make_upper(); + + // Due to interface limitations we only support 15 drives (MAX_DRIVES) + if(nCnt < MAX_DRIVES) + { + // Give the Window the Appropriate Label + SetDlgItemText(IDC_FIRST_DRIVE + nCnt, (string)(_T("Drive ") + string(sTemp[0]))); + + // Since it's hidden in the dialog template, show it + ::ShowWindow(GetDlgItem(IDC_FIRST_DRIVE + nCnt), SW_SHOW); + + // Check it if the user has selected it or if we are going for all of'm + CheckDlgButton(IDC_FIRST_DRIVE + nCnt, (!m_bCustomDrives) || ((sSelectedDrives.find(sTemp[0]) != string::npos))); + + nCnt++; + } + + + } + + // Next Drive + szCurDrive += _tcslen(szCurDrive) + 1; // ???? Later: What does this do + } + + // Counter for Apply() + m_nDrives = nCnt; + + return false; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +LRESULT CWipefreeSpace::OnDrivesChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + // User is overriding the default + m_bCustomDrives = true; + return 0; +} diff --git a/NSCmpts/WipefreeSpace.h b/NSCmpts/WipefreeSpace.h new file mode 100644 index 0000000..9c68a20 --- /dev/null +++ b/NSCmpts/WipefreeSpace.h @@ -0,0 +1,102 @@ +// WipefreeSpace.h : Declaration of the CWipefreeSpace + +#ifndef __WIPEFREESPACE_H_ +#define __WIPEFREESPACE_H_ + +#include "resource.h" // main symbols +#include "../Common/CmptData.h" +#include + +#define MAX_DRIVES 15 + +///////////////////////////////////////////////////////////////////////////// +// CWipefreeSpace +class ATL_NO_VTABLE CWipefreeSpace : + public CComObjectRootEx, + public CComCoClass, + public ISupportErrorInfo, + public IDispatchImpl, + public IPropertyPageImpl, +// public CDialogImpl + public CDialogImplEx, + public CContextHelp +{ +// Construction +public: + CWipefreeSpace() : CDialogImplEx(IDD) + { + m_dwTitleID = IDS_TITLEWipeFreeSpace; + m_dwHelpFileID = IDS_NSHELPFILE; + m_dwDocStringID = IDS_DOCSTRINGWipeFreeSpace; + m_bCustomDrives = true; + } + ~CWipefreeSpace() + { ATLTRACE(_T("Destroying WipefreeSpace\n")); } + +DECLARE_REGISTRY_RESOURCEID(IDR_WIPEFREESPACE) + +BEGIN_COM_MAP(CWipefreeSpace) + COM_INTERFACE_ENTRY(ISecureShutdownDOS) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY_IMPL(IPropertyPage) +END_COM_MAP() + +// ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + +// ISecureShutdownDOS +public: + STDMETHOD(get_Info)(/*[in]*/ NightSecInfo nsItem, /*[out, retval]*/ VARIANT* pvVal); + STDMETHOD(GetBatchText)(/*[out, retval]*/ BSTR* psText); + STDMETHOD(SetData)(/*[in]*/ IUnknown* pUnk); + +// Data +protected: + bool m_bCustomDrives; + int m_nDrives; + CPropertyBag m_Data; + + +/////////////////////////////////////////////////////////////////// +// Property Sheet Stuff + +public: + + enum {IDD = IDD_WIPEFREESPACE}; + + BEGIN_MSG_MAP(CWipefreeSpace) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_RANGE_HANDLER(IDC_FIRST_DRIVE, IDC_FIRST_DRIVE + MAX_DRIVES - 1, OnDrivesChange) + CHAIN_MSG_MAP(IPropertyPageImpl) + CHAIN_MSG_MAP(CContextHelp) + END_MSG_MAP() + + BEGIN_HELP_MAP(NS_HELP_FILE) + HELP_ID(IDC_FIRST_DRIVE, 4024) + HELP_ID(IDC_FIRST_DRIVE2, 4024) + HELP_ID(IDC_FIRST_DRIVE3, 4024) + HELP_ID(IDC_FIRST_DRIVE4, 4024) + HELP_ID(IDC_FIRST_DRIVE5, 4024) + HELP_ID(IDC_FIRST_DRIVE6, 4024) + HELP_ID(IDC_FIRST_DRIVE7, 4024) + HELP_ID(IDC_FIRST_DRIVE8, 4024) + HELP_ID(IDC_FIRST_DRIVE9, 4024) + HELP_ID(IDC_FIRST_DRIVE10, 4024) + HELP_ID(IDC_FIRST_DRIVE11, 4024) + HELP_ID(IDC_FIRST_DRIVE12, 4024) + HELP_ID(IDC_FIRST_DRIVE13, 4024) + HELP_ID(IDC_FIRST_DRIVE14, 4024) + HELP_ID(IDC_FIRST_DRIVE15, 4024) + END_HELP_MAP + +// Property Sheet Messages + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDrivesChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + +public: + STDMETHOD(Apply)(void); + +}; + +#endif //__WIPEFREESPACE_H_ diff --git a/NSCmpts/dlldata.c b/NSCmpts/dlldata.c new file mode 100644 index 0000000..3f7c11d --- /dev/null +++ b/NSCmpts/dlldata.c @@ -0,0 +1,40 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( CmptIfaces ) +EXTERN_PROXY_FILE( NSCmpts ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( CmptIfaces ), + REFERENCE_PROXY_FILE( NSCmpts ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/NSCmpts/res/161.avi b/NSCmpts/res/161.avi new file mode 100644 index 0000000..5d7b02d Binary files /dev/null and b/NSCmpts/res/161.avi differ diff --git a/NSCmpts/res/DeleteSwapFile.rgs b/NSCmpts/res/DeleteSwapFile.rgs new file mode 100644 index 0000000..06e059a --- /dev/null +++ b/NSCmpts/res/DeleteSwapFile.rgs @@ -0,0 +1,42 @@ +HKCR +{ + NightSecurity.DeleteSwapFile.25 = s 'DeleteSwapFile Class' + { + CLSID = s '{34F11696-F275-11d2-A589-0020182B97FC}' + } + NightSecurity.DeleteSwapFile = s 'DeleteSwapFile Class' + { + CurVer = s 'NightSecurity.DeleteSwapFile.25' + CLSID = s '{34F11696-F275-11d2-A589-0020182B97FC}' + } + NoRemove CLSID + { + ForceRemove {34F11696-F275-11d2-A589-0020182B97FC} = s 'DeleteSwapFile Class' + { + ProgID = s 'NightSecurity.DeleteSwapFile.25' + VersionIndependentProgID = s 'NightSecurity.DeleteSwapFile' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.DeleteSwapFile' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/res/EmptyTempFolder.rgs b/NSCmpts/res/EmptyTempFolder.rgs new file mode 100644 index 0000000..1ee786e --- /dev/null +++ b/NSCmpts/res/EmptyTempFolder.rgs @@ -0,0 +1,42 @@ +HKCR +{ + NightSecurity.EmptyTempFolder.25 = s 'EmptyTempFolder Class' + { + CLSID = s '{34F11695-F275-11d2-A589-0020182B97FC}' + } + NightSecurity.EmptyTempFolder = s 'EmptyTempFolder Class' + { + CurVer = s 'NightSecurity.EmptyTempFolder.25' + CLSID = s '{34F11695-F275-11d2-A589-0020182B97FC}' + } + NoRemove CLSID + { + ForceRemove {34F11695-F275-11d2-A589-0020182B97FC} = s 'EmptyTempFolder Class' + { + ProgID = s 'NightSecurity.EmptyTempFolder.25' + VersionIndependentProgID = s 'NightSecurity.EmptyTempFolder' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.EmptyTempFolder' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/res/Night Security Worker.ico b/NSCmpts/res/Night Security Worker.ico new file mode 100644 index 0000000..f1486e4 Binary files /dev/null and b/NSCmpts/res/Night Security Worker.ico differ diff --git a/NSCmpts/res/RunScanDisk.rgs b/NSCmpts/res/RunScanDisk.rgs new file mode 100644 index 0000000..06bf1cd --- /dev/null +++ b/NSCmpts/res/RunScanDisk.rgs @@ -0,0 +1,42 @@ +HKCR +{ + NightSecurity.RunScanDisk.25 = s 'RunScanDisk Class' + { + CLSID = s '{34F11697-F275-11d2-A589-0020182B97FC}' + } + NightSecurity.RunScanDisk = s 'RunScanDisk Class' + { + CurVer = s 'NightSecurity.RunScanDisk.25' + CLSID = s '{34F11697-F275-11d2-A589-0020182B97FC}' + } + NoRemove CLSID + { + ForceRemove {34F11697-F275-11d2-A589-0020182B97FC} = s 'RunScanDisk Class' + { + ProgID = s 'NightSecurity.RunScanDisk.25' + VersionIndependentProgID = s 'NightSecurity.RunScanDisk' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.RunScanDisk' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/res/WipefreeSpace.rgs b/NSCmpts/res/WipefreeSpace.rgs new file mode 100644 index 0000000..74ae6fb --- /dev/null +++ b/NSCmpts/res/WipefreeSpace.rgs @@ -0,0 +1,42 @@ +HKCR +{ + NightSecurity.WipefreeSpace.25 = s 'WipefreeSpace Class' + { + CLSID = s '{34F11698-F275-11d2-A589-0020182B97FC}' + } + NightSecurity.WipefreeSpace = s 'WipefreeSpace Class' + { + CurVer = s 'NightSecurity.WipefreeSpace.25' + CLSID = s '{34F11698-F275-11d2-A589-0020182B97FC}' + } + NoRemove CLSID + { + ForceRemove {34F11698-F275-11d2-A589-0020182B97FC} = s 'WipefreeSpace Class' + { + ProgID = s 'NightSecurity.WipefreeSpace.25' + VersionIndependentProgID = s 'NightSecurity.WipefreeSpace' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} + +HKEY_LOCAL_MACHINE +{ + NoRemove 'Software' + { + NoRemove 'Heavenly Helpers' + { + NoRemove 'Night Security' + { + NoRemove 'Installed Components' + { + ForceRemove 'NightSecurity.WipefreeSpace' + } + } + } + } +} \ No newline at end of file diff --git a/NSCmpts/res/advanced.ico b/NSCmpts/res/advanced.ico new file mode 100644 index 0000000..b08ce7a Binary files /dev/null and b/NSCmpts/res/advanced.ico differ diff --git a/NSCmpts/res/backup1.ico b/NSCmpts/res/backup1.ico new file mode 100644 index 0000000..9cde683 Binary files /dev/null and b/NSCmpts/res/backup1.ico differ diff --git a/NSCmpts/res/backupad.bin b/NSCmpts/res/backupad.bin new file mode 100644 index 0000000..6a0546a --- /dev/null +++ b/NSCmpts/res/backupad.bin @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {E85A26C3-946D-11D3-BFC4-0020182B97FC} = s 'Backup Advanced Properties' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/res/backupde.bin b/NSCmpts/res/backupde.bin new file mode 100644 index 0000000..54bec7e --- /dev/null +++ b/NSCmpts/res/backupde.bin @@ -0,0 +1,13 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {E85A26C2-946D-11D3-BFC4-0020182B97FC} = s 'Backup Destination Properties' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + } + } +} diff --git a/NSCmpts/res/copyfile.ico b/NSCmpts/res/copyfile.ico new file mode 100644 index 0000000..3c297c6 Binary files /dev/null and b/NSCmpts/res/copyfile.ico differ diff --git a/NSCmpts/res/cursor1.cur b/NSCmpts/res/cursor1.cur new file mode 100644 index 0000000..048f06b Binary files /dev/null and b/NSCmpts/res/cursor1.cur differ diff --git a/NSCmpts/res/enc.avi b/NSCmpts/res/enc.avi new file mode 100644 index 0000000..e4e321b Binary files /dev/null and b/NSCmpts/res/enc.avi differ diff --git a/NSCmpts/res/ico00001.ico b/NSCmpts/res/ico00001.ico new file mode 100644 index 0000000..8462541 Binary files /dev/null and b/NSCmpts/res/ico00001.ico differ diff --git a/NSCmpts/res/ico00002.ico b/NSCmpts/res/ico00002.ico new file mode 100644 index 0000000..e8e1f6f Binary files /dev/null and b/NSCmpts/res/ico00002.ico differ diff --git a/NSCmpts/res/ico00003.ico b/NSCmpts/res/ico00003.ico new file mode 100644 index 0000000..9e7944d Binary files /dev/null and b/NSCmpts/res/ico00003.ico differ diff --git a/NSCmpts/res/ico00004.ico b/NSCmpts/res/ico00004.ico new file mode 100644 index 0000000..b08ce7a Binary files /dev/null and b/NSCmpts/res/ico00004.ico differ diff --git a/NSCmpts/res/ico00005.ico b/NSCmpts/res/ico00005.ico new file mode 100644 index 0000000..da61e8d Binary files /dev/null and b/NSCmpts/res/ico00005.ico differ diff --git a/NSCmpts/res/ico00006.ico b/NSCmpts/res/ico00006.ico new file mode 100644 index 0000000..f60a0ee Binary files /dev/null and b/NSCmpts/res/ico00006.ico differ diff --git a/NSCmpts/res/ico00007.ico b/NSCmpts/res/ico00007.ico new file mode 100644 index 0000000..23a0e26 Binary files /dev/null and b/NSCmpts/res/ico00007.ico differ diff --git a/NSCmpts/res/ico00008.ico b/NSCmpts/res/ico00008.ico new file mode 100644 index 0000000..72c81b9 Binary files /dev/null and b/NSCmpts/res/ico00008.ico differ diff --git a/NSCmpts/res/icon1.ico b/NSCmpts/res/icon1.ico new file mode 100644 index 0000000..3c297c6 Binary files /dev/null and b/NSCmpts/res/icon1.ico differ diff --git a/NSCmpts/res/icon2.ico b/NSCmpts/res/icon2.ico new file mode 100644 index 0000000..9cde683 Binary files /dev/null and b/NSCmpts/res/icon2.ico differ diff --git a/NSCmpts/res/idr_.bin b/NSCmpts/res/idr_.bin new file mode 100644 index 0000000..58d5ce0 --- /dev/null +++ b/NSCmpts/res/idr_.bin @@ -0,0 +1,23 @@ +HKCR +{ + = s '' + { + CLSID = s '{51B91363-FFFF-FFFF-50F3-12007CA3B851}' + } + = s '' + { + CLSID = s '{51B91363-FFFF-FFFF-50F3-12007CA3B851}' + } + NoRemove CLSID + { + ForceRemove {51B91363-FFFF-FFFF-50F3-12007CA3B851} = s '' + { + ProgID = s '' + VersionIndependentProgID = s '' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'both' + } + } + } +} diff --git a/NSCmpts/res/items.ico b/NSCmpts/res/items.ico new file mode 100644 index 0000000..0faf9dc Binary files /dev/null and b/NSCmpts/res/items.ico differ diff --git a/NSCmpts/res/n_161.avi b/NSCmpts/res/n_161.avi new file mode 100644 index 0000000..edc09e3 Binary files /dev/null and b/NSCmpts/res/n_161.avi differ diff --git a/NSCmpts/res/n_temp.avi b/NSCmpts/res/n_temp.avi new file mode 100644 index 0000000..4d150fa Binary files /dev/null and b/NSCmpts/res/n_temp.avi differ diff --git a/NSCmpts/res/new1.ico b/NSCmpts/res/new1.ico new file mode 100644 index 0000000..2027b3e Binary files /dev/null and b/NSCmpts/res/new1.ico differ diff --git a/NSCmpts/res/recycle.ico b/NSCmpts/res/recycle.ico new file mode 100644 index 0000000..4b1e077 Binary files /dev/null and b/NSCmpts/res/recycle.ico differ diff --git a/NSCmpts/res/temp.avi b/NSCmpts/res/temp.avi new file mode 100644 index 0000000..6da080d Binary files /dev/null and b/NSCmpts/res/temp.avi differ diff --git a/NSCmpts/res/wxpy.ico b/NSCmpts/res/wxpy.ico new file mode 100644 index 0000000..f363761 Binary files /dev/null and b/NSCmpts/res/wxpy.ico differ diff --git a/NSCmpts/resource.h b/NSCmpts/resource.h new file mode 100644 index 0000000..5855e5d --- /dev/null +++ b/NSCmpts/resource.h @@ -0,0 +1,168 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by NSCmpts.rc +// +#define IDS_PROJNAME 100 +#define IDS_TITLEBackupSourceProp 101 +#define IDR_BACKUP 101 +#define IDS_HELPFILEBackupSourceProp 102 +#define IDD_BACKUPPROGRESS 102 +#define IDS_NSHELPFILE 102 +#define IDS_DOCSTRINGBackupSourceProp 103 +#define IDC_MESSAGE1 103 +#define IDR_BACKUPSOURCEPROP 104 +#define IDC_MESSAGE2 104 +#define IDD_BACKUPSOURCE 105 +#define IDD_SOURCE 105 +#define IDS_TITLEBackupDestProp 106 +#define IDS_RECYCLENAME 107 +#define IDS_RECYCLEDESC 108 +#define IDR_EMPTYRECYCLEBIN 109 +#define IDS_RECYCLEPARAM 109 +#define IDS_HELPFILEBackupDestProp 110 +#define IDS_DOCSTRINGBackupDestProp 111 +#define IDR_BACKUPDESTPROP 112 +#define IDS_BACKUPNAME 112 +#define IDD_BACKUPDEST 113 +#define IDS_BACKUPDESC 113 +#define IDS_TITLEBackupAdvancedProp 114 +#define IDS_HELPFILEBackupAdvancedProp 115 +#define IDS_DOCSTRINGBackupAdvancedProp 116 +#define IDS_TEMPNAME 117 +#define IDR_EMPTYTEMPFOLDER 118 +#define IDS_TEMPDESC 118 +#define IDS_TEMPPARAM 119 +#define IDR_DELETESWAPFILE 120 +#define IDS_DELSWAP_BATCHTEXT 120 +#define IDS_DELSWAP_DESC 121 +#define IDS_DELSWAP_NAME 122 +#define IDR_RUNSCANDISK 123 +#define IDS_SCANDISK_NAME 123 +#define IDS_SCANDISK_DESC 124 +#define IDS_SCANDISK_BATCHTEXT 125 +#define IDR_BACKUPADVANCEDPROP 126 +#define IDS_BACKUPPARAM 126 +#define IDD_BACKUPADVANCED 127 +#define IDS_ENCRYPTNAME 127 +#define IDR_MAINFRAME 128 +#define IDS_ENCRYPTDESC 128 +#define IDD_DUMMY 129 +#define IDS_SCANDISK_NOSAVE 129 +#define IDS_SCANDISK_AUTOFIX 130 +#define IDS_WIPEFREE_NAME 131 +#define IDS_WIPEFREE_DESC 132 +#define IDI_NOTE 133 +#define IDS_WIPEFREE_BATCHTEXT 133 +#define IDS_WIPEFREE_DRIVE 134 +#define IDS__DESC 135 +#define IDI_ITEMS 135 +#define IDS_ENCRYPTPARAM 135 +#define IDI_RECYCLE 136 +#define IDR_WIPEFREESPACE 137 +#define IDS_TITLERunScanDiskProps 139 +#define IDS_HELPFILERunScanDiskProps 140 +#define IDS_DOCSTRINGRunScanDiskProps 141 +#define IDR_ENCRYPT 142 +#define IDS_TITLEEncryptSourceProp 143 +#define IDS_HELPFILEEncryptSourceProp 144 +#define IDS_EMPTYCOMMAND 145 +#define IDS_NORTONCOMMAND 146 +#define IDS_TITLERecycle 147 +#define IDS_HELPFILERecycle 148 +#define IDS_DOCSTRINGRecycle 149 +#define IDD_TEMPWARNDLG 150 +#define IDS_EMPTYTEMP_WARN 150 +#define IDD_EMPTYRECYCLE 151 +#define IDS_TITLEWipeFreeSpace 151 +#define IDD_RUNSCANDISK 152 +#define IDS_HELPFILEWipeFreeSpace 152 +#define IDD_WIPEFREESPACE 153 +#define IDS_DOCSTRINGWipeFreeSpace 153 +#define IDS_BACKUP_NEWEXT 154 +#define IDD_ENCRYPTADVANCED 154 +#define IDS_BACKUP_VALID_PATH 155 +#define IDS_BACKUP_ERR_LIST 156 +#define IDS_BACKUP_ERR_CREATE_DEST 157 +#define IDS_BACKUP_ERR_DEST 158 +#define IDS_BACKUP_ERR_COPY 159 +#define IDS_BACKUP_ERR_DISKFULL 160 +#define IDS_ENCRYPT_ERR_LIST 161 +#define IDS_ENCRYPT_ERR_XPYINIT 162 +#define IDS_ENCRYPT_ERR 163 +#define IDS_DOCSTRINGEncryptSourceProp 164 +#define IDS_TEMP_ERR_LIST 164 +#define IDR_ENCRYPTSOURCEPROP 165 +#define IDS_TEMP_ERR_DELETE 165 +#define IDS_TITLEEncryptAdvancedProp 167 +#define IDS_HELPFILEEncryptAdvancedProp 168 +#define IDS_DOCSTRINGEncryptAdvancedProp 169 +#define IDR_ENCRYPTADVANCEDPROP 170 +#define IDS_BACKUP_ERR_FILE 170 +#define IDS_ENCRYPT_ERR_XPY 171 +#define IDC_AUTOFIX 201 +#define IDC_PROGRESS 201 +#define IDC_BUTTON1 201 +#define IDI_COPYFILES 201 +#define IDI_BACKUP 202 +#define IDC_SAVE 203 +#define IDI_SCANDISK 203 +#define IDC_IGNORE_LIST 203 +#define IDC_NOSAVE 204 +#define IDI_DRIVE 204 +#define IDI_ADVANCED 205 +#define IDI_PASSWORD 207 +#define IDC_ICO 207 +#define IDC_ANIMATION 208 +#define IDC_DISABLEPASSWORD 209 +#define IDR_AVIBACKUP 209 +#define IDR_AVIENCRYPT 210 +#define IDC_ENCRYPTREADONLY 210 +#define IDI_NORTONPROT 211 +#define IDC_MESSAGE 211 +#define IDR_AVITEMP 211 +#define IDC_EMPTYRECYCLE 212 +#define IDI_EXCLAM 212 +#define IDC_SOURCE_LIST 212 +#define IDC_EMPTYNORTON 213 +#define IDC_DONTSHOW 213 +#define IDC_BROWSE 213 +#define IDI_NEW 213 +#define IDC_FOLDERWARN 214 +#define IDC_REMOVE 214 +#define IDC_DEST 214 +#define IDI_DEL 214 +#define IDC_TYPE 215 +#define IDC_ENGINE_TYPE 215 +#define IDI_WXPY 215 +#define IDC_DEL 216 +#define IDC_NEW 217 +#define IDC_ADD 230 +#define IDD_PROGRESSBACKUP 1020 +#define IDD_PROGRESSENCRYPT 1021 +#define IDD_PROGRESSTEMP 1022 +#define IDC_FIRST_DRIVE 1865 +#define IDC_FIRST_DRIVE2 1866 +#define IDC_FIRST_DRIVE3 1867 +#define IDC_FIRST_DRIVE4 1868 +#define IDC_FIRST_DRIVE5 1869 +#define IDC_FIRST_DRIVE6 1870 +#define IDC_FIRST_DRIVE7 1871 +#define IDC_FIRST_DRIVE8 1872 +#define IDC_FIRST_DRIVE9 1873 +#define IDC_FIRST_DRIVE10 1874 +#define IDC_FIRST_DRIVE11 1875 +#define IDC_FIRST_DRIVE12 1876 +#define IDC_FIRST_DRIVE13 1877 +#define IDC_FIRST_DRIVE14 1878 +#define IDC_FIRST_DRIVE15 1879 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 213 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 211 +#define _APS_NEXT_SYMED_VALUE 172 +#endif +#endif -- cgit v1.2.3