Pointer Moniker Class

A pointer moniker is a kind of moniker that wraps an existing object pointer in a moniker so that it may participate as a piece in the moniker binding process. Think of pointers as a referencing mechanism into the "active space:" a process's memory. Most moniker implementations are by contrast references into "passive space:" the representation of an object on disk. Pointer monikers provide a means by which a given use of a moniker can transparently reference either active or passive space.

Implementations of functions in IMoniker interface for Pointer Monikers work roughly as follows. IMoniker::BindToObject turns into a QueryInterface on the pointer; IMoniker::BindToStorage returns MK_E_NOSTORAGE; IMoniker::Reduce() reduces the moniker to itself; IMoniker::ComposeWith always does a generic composition; IMoniker::Enum returns NULL; IMoniker::IsSystemMoniker returns MKSYS_PTR; IMoniker::IsEqual() uses the identity test paradigm on pointers after first checking that the other moniker for the right class; IMoniker::Hash returns a constant; IMoniker::GetTimeOfLastChange returns MK_E_UNAVAILABLE; IMoniker::Inverse returns an anti-moniker; IMoniker::RelativePathTo returns the other moniker; IMoniker::GetDisplayName returns NULL; and IMoniker::ParseDisplayName() binds to the punk pointer using IParseDisplayName interface and works from there.

Instances of this kind of moniker refuse to be serialized; that is, IPersistStream::Save will return an error. These monikers can, however, be marshaled to a different process; internally, this marshals and unmarshals the pointer using the standard paradigm for marshaling interface pointers: CoMarshalInterface and CoUnmarshalInterface.