Home COM GDI+ WebBrowser Data Access

IPersistStream Interface

 

IID_IPersistStream

{00000109-0000-0000-C000-000000000046}

 

 

The IPersistStream interface provides methods for saving and loading objects that use a simple serial stream for their storage needs. The IPersistStream interface inherits its definition from the IPersist interface, and so includes the GetClassID method of IPersist.

 

One way in which it is used is to support OLE moniker implementations. Each of the OLE-provided moniker interfaces provides an IPersistStream implementation through which the moniker saves or loads itself. An instance of the OLE generic composite moniker class calls the IPersistStream methods of its component monikers to load or save the components in the proper sequence in a single stream.

 

OLE containers with embedded and linked component objects do not use this interface; they use the IPersistStorage interface instead.

 

Call methods of IPersistStream from a container application to save or load objects that are contained in a simple stream. When used to save or load monikers, typical applications do not call the methods directly, but allow the default link handler to make the calls to save and load the monikers that identify the link source. These monikers are stored in a stream in the storage for the linked object. If you are writing a custom link handler for your class of objects, you would call the methods of IPersistStream to implement the link handler.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IPersist Method

Description

GetClassID

Returns the class identifier (CLSID) for the component object.

IPersistStream Methods

Description

IsDirty

Checks the object for changes since it was last saved.

Load

Initializes an object from the stream where it was previously saved.

Save

Saves an object into the specified stream and indicates whether the object should reset its dirty flag.

GetSizeMax

Return the size in bytes of the stream needed to save the object.

 

IsDirty

 

FUNCTION IPersistStream_IsDirty ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IPersistStream_IsDirty (pthis) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

 

FUNCTION IPersistStream_IsDirty ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG
 

  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+12]
  ! mov  FUNCTION, eax


END FUNCTION

 

 

Load

 

FUNCTION IPersistStream_Load ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pStm AS DWORD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING IPersistStream_Load (pthis, pStm) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

 

FUNCTION IPersistStream_Load ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pStm AS DWORD _

  ) AS LONG
 

  ! push pStm

  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+20]
  ! mov  FUNCTION, eax


END FUNCTION

 

 

Save

 

FUNCTION IPersistStream_Save ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pStm AS DWORD _

, BYVAL fClearDirty AS LONG _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[6] USING IPersistStream_Save (pthis, pStm, fClearDirty) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

 

FUNCTION IPersistStream_Save ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL pStm AS DWORD _

, BYVAL fClearDirty AS LONG _

  ) AS LONG
 

  ! push fClearDirty

  ! push pStm

  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+24]
  ! mov  FUNCTION, eax


END FUNCTION

 

 

GetSizeMax

 

FUNCTION IPersistStream_GetSizeMax ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pcbSize AS QUAD _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IPersistStream_GetSizeMax (pthis, pcbSize) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

 

FUNCTION IPersistStream_GetSizeMax ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pcbSize AS QUAD _

  ) AS LONG
 

  ! push pcbSize

  ! mov  eax, pthis
  ! push eax
  ! mov  eax, dword ptr[eax]
  ! call dword ptr[eax+28]
  ! mov  FUNCTION, eax


END FUNCTION

 

 

Page last updated on Monday, 03 April 2006 20:22:30 +0200