diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/oleutest/server1/ipersist.cxx | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/oleutest/server1/ipersist.cxx')
-rw-r--r-- | private/oleutest/server1/ipersist.cxx | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/private/oleutest/server1/ipersist.cxx b/private/oleutest/server1/ipersist.cxx new file mode 100644 index 000000000..4928a1e01 --- /dev/null +++ b/private/oleutest/server1/ipersist.cxx @@ -0,0 +1,251 @@ +//+------------------------------------------------------------------- +// File: ipersist.cxx +// +// Contents: IPersist and IPersistStorage methods of CPersistStorage class. +// +// Classes: CPersistStorage - IPersist, IPersistStorage implementations +// +// History: 7-Dec-92 DeanE Created +//--------------------------------------------------------------------- +#pragma optimize("",off) +#include <windows.h> +#include <ole2.h> +#include "testsrv.hxx" + + +//+------------------------------------------------------------------- +// Member: CPersistStorage::CPersistStorage() +// +// Synopsis: The constructor for CPersistStorage. +// +// Arguments: None +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +CPersistStorage::CPersistStorage(CTestEmbed *pteObject) +{ + _cRef = 1; + _pteObject = pteObject; + _fDirty = FALSE; +} + + +//+------------------------------------------------------------------- +// Member: CPersistStorage::~CPersistStorage() +// +// Synopsis: The destructor for CPersistStorage. +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +CPersistStorage::~CPersistStorage() +{ + // _cRef should be 1 + if (1 != _cRef) + { + // BUGBUG - Log error, someone hasn't released + } + return; +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::QueryInterface +// +// Synopsis: Forward this to the object we're associated with +// +// Parameters: [iid] - Interface ID to return. +// [ppv] - Pointer to pointer to object. +// +// Returns: S_OK if iid is supported, or E_NOINTERFACE if not. +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::QueryInterface(REFIID iid, void FAR * FAR *ppv) +{ + return(_pteObject->QueryInterface(iid, ppv)); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::AddRef +// +// Synopsis: Forward this to the object we're associated with +// +// Returns: New reference count. +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP_(ULONG) CPersistStorage::AddRef(void) +{ + ++_cRef; + return(_pteObject->AddRef()); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::Release +// +// Synopsis: Forward this to the object we're associated with +// +// Returns: New reference count. +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP_(ULONG) CPersistStorage::Release(void) +{ + --_cRef; + return(_pteObject->Release()); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::GetClassId +// +// Synopsis: See spec 2.00.09 p197. Answer the Class ID of this +// object. +// +// Parameters: [pClassId] - +// +// Returns: S_OK +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::GetClassID(LPCLSID pClassId) +{ + if (NULL != pClassId) + { + *pClassId = CLSID_TestEmbed; + } + return(S_OK); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::IsDirty +// +// Synopsis: See spec 2.00.09 p200. Return S_OK if the object needs +// to be saved in order to avoid data loss, or S_FALSE +// if not. +// +// Parameters: None +// +// Returns: S_OK or S_FALSE +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::IsDirty() +{ + // BUGBUG - NYI + // Because we are NYI, just return S_FALSE + return(S_FALSE); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::InitNew +// +// Synopsis: See spec 2.00.09 p197. This method provides a way +// for a container to provide persistent storage to this +// object. Call AddRef on the pStg passed if we do save +// it. +// +// Parameters: [pStg] - IStorage instance this object can use. +// +// Returns: S_OK +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::InitNew(LPSTORAGE pStg) +{ + // BUGBUG - NYI + return(S_OK); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::Load +// +// Synopsis: See spec 2.00.09 p200. Called by handler to put this +// object into the running state. Object should use the +// pStg passed to "initialize" itself. We can hold onto +// this pStg, but when ::Save is called, this can be +// a different IStorage. +// +// Parameters: [pStg] - IStorage to initialize object from. +// +// Returns: S_OK? +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::Load(LPSTORAGE pStg) +{ + // BUGBUG - NYI + // Initialize the object here, though, just as if we had obtained + // data from an IStorage + return(S_OK); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::Save +// +// Synopsis: See spec 2.00.09 p197. Save the data in the IStorage +// passed. Ignore flags for now. +// +// Parameters: [pStgSave] - Save data in here. +// [fSameAsLoad] - Indicates this object is the same one +// that was initially started. +// [fRemember] - Only matters if fSameAsLoad is FALSE. +// +// Returns: STG_E_MEDIUMFULL - why??? +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::Save( + LPSTORAGE pStgSave, + BOOL fSameAsLoad) +{ + // BUGBUG - NYI + return(STG_E_MEDIUMFULL); +} + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::SaveCompleted +// +// Synopsis: See spec 2.00.09 p198. Used only in certain circumstances. +// +// Parameters: [pStgSaved] - +// +// Returns: S_OK +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::SaveCompleted(LPSTORAGE pStgSaved) +{ + // BUGBUG - NYI + // We don't have to worry about this unless we allow a "Save As" + // operation + return(S_OK); +} + + + +//+------------------------------------------------------------------- +// Method: CPersistStorage::HandsOffStorage +// +// Synopsis: See spec 2.00.09 p198. Used only in certain circumstances. +// +// Parameters: [pStgSaved] - +// +// Returns: S_OK +// +// History: 7-Dec-92 DeanE Created +//-------------------------------------------------------------------- +STDMETHODIMP CPersistStorage::HandsOffStorage(void) +{ + // BUGBUG - NYI + // We don't have to worry about this unless we allow a "Save As" + // operation + return(S_OK); +} |