diff options
author | Stef Walter <stef@thewalter.net> | 2003-09-17 19:07:23 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2003-09-17 19:07:23 +0000 |
commit | 3f95d417d9e623ac0c74df8ef11d7a01846392dd (patch) | |
tree | 45ec73f2dc07eafd7f41a6f62a8cdfbaa279469f /NSCmpts/DeleteSwapFile.cpp |
Diffstat (limited to 'NSCmpts/DeleteSwapFile.cpp')
-rw-r--r-- | NSCmpts/DeleteSwapFile.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
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 <mystring.h> +#include <appmisc.h> + +///////////////////////////////////////////////////////////////////////////// +// CDeleteSwapFile + +STDMETHODIMP CDeleteSwapFile::InterfaceSupportsErrorInfo(REFIID riid) +{ + static const IID* arr[] = + { + &IID_ISecureShutdownDOS, + }; + for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++) + { + if (InlineIsEqualGUID(*arr[i],riid)) + return S_OK; + } + return S_FALSE; +} + +////////////////////////////////////////////////////////////////////// +// This won't run under Windows NT so don't even show it + +HRESULT CDeleteSwapFile::FinalConstruct() +{ + if(::GetVersion() < 0x80000000) + return E_FAIL; + else + return S_OK; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns text to put in Batch File + +STDMETHODIMP CDeleteSwapFile::GetBatchText(BSTR* psText) +{ + // This should never be true as the object shouldn't + // even be creatable under WIN NT; + // ASSERT(::GetPlatform() == VER_PLATFORM_WIN32_NT); + ASSERT(::GetVersion() >= 0x80000000); + + // Format and return string + 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; +} |