windows-nt/Source/XPSP1/NT/shell/ext/pack/iperfile.cpp
2020-09-26 16:20:57 +08:00

106 lines
2.3 KiB
C++

#include "privcpp.h"
// Constructor
CPackage_IPersistFile::CPackage_IPersistFile(CPackage *pPackage) :
_pPackage(pPackage)
{
ASSERT(_cRef == 0);
}
CPackage_IPersistFile::~CPackage_IPersistFile()
{
DebugMsg(DM_TRACE,"CPackage_IPersistFile destroyed with ref count %d",_cRef);
}
//////////////////////////////////
//
// IUnknown Methods...
//
HRESULT CPackage_IPersistFile::QueryInterface(REFIID iid, void ** ppv)
{
return _pPackage->QueryInterface(iid,ppv); // delegate to CPackage
}
ULONG CPackage_IPersistFile::AddRef(void)
{
_cRef++; // interface ref count for debug
return _pPackage->AddRef(); // delegate to CPackage
}
ULONG CPackage_IPersistFile::Release(void)
{
_cRef--; // interface ref count for debug
return _pPackage->Release(); // delegate to CPackage
}
//////////////////////////////////
//
// IPersistFile Methods...
//
HRESULT CPackage_IPersistFile::GetClassID(LPCLSID pClassID)
{
DebugMsg(DM_TRACE, "pack ps - GetClassID() called.");
if (pClassID == NULL)
return E_INVALIDARG;
*pClassID = CLSID_CPackage;
return S_OK;
}
HRESULT CPackage_IPersistFile::IsDirty(void)
{
DebugMsg(DM_TRACE, "pack ps - IsDirty() called.");
return E_NOTIMPL;
}
HRESULT CPackage_IPersistFile::Load(LPCOLESTR pszFileName, DWORD dwMode)
{
HRESULT hr;
DebugMsg(DM_TRACE, "pack pf - Load() called.");
if (!pszFileName) {
DebugMsg(DM_TRACE," bad pointer!!");
return E_POINTER;
}
//
// We blow off the mode flags
//
hr = _pPackage->EmbedInitFromFile(pszFileName, TRUE);
DebugMsg(DM_TRACE, " leaving Load()");
return hr;
}
HRESULT CPackage_IPersistFile::Save(LPCOLESTR pszFileName, BOOL fRemember)
{
DebugMsg(DM_TRACE, "pack pf - Save() called.");
return E_NOTIMPL;
}
HRESULT CPackage_IPersistFile::SaveCompleted(LPCOLESTR pszFileName)
{
DebugMsg(DM_TRACE, "pack pf - SaveCompleted() called.");
return E_NOTIMPL;
}
HRESULT CPackage_IPersistFile::GetCurFile(LPOLESTR *ppszFileName)
{
DebugMsg(DM_TRACE, "pack pf - GetCurFile() called.");
if (!ppszFileName)
return E_POINTER;
*ppszFileName = NULL; // null the out param
return E_NOTIMPL;
}