END_INTERFACE_MAP

 

The END_INTERFACE_MAP macro is provided to flag the end of the Map list.

 

Each object that may be served from the dll will need its particular InterfaceMap. Each InterfaceItem will need to refer to it's iid and also hold a pointer to the table of member functions of the interface.

 

InterfaceItem STRUCT

m_refiid DWORD ; reference to the Interface ID (iid)

; the GUID of this interface

m_pVtbl DWORD ; pointer to implementation table ('virtual'

; function vtable , or just vtable) of this

; interface

InterfaceItem ENDS

OBJECT BASICS

 

As previously discussed elsewhere (see "Creating COM objects in ASM," Assembly Programming Journal, Issue 8: Mar-Aug 2000), an object should be thought of a run-time allocated area of memory. It needs a well defined structure so it's internal properties may be employed to give custom instance information and access to the methods of the object.

 

In the CoLib.Lib library, an object is defined as an array of structures, build up as so:

 

ProjectObject STRUCT

ObjectData1 { }

ProjectData { }

ObjectEntry0 { }

ObjectEntry1 { }

ObjectEntry2 { }

...

ObjectEntryN { }

ProjectObject ENDS

 

 

These internal structures are used as follows:

 

ObjectData Contains the internal state of a particular object, such as the reference count, a reference to class data and such.

 

ProjectData An arbitrary structure determined by the specific project, meant to be a catch-all for all object-specific data.

 

ObjectEntryX The ObjectEntry structure provides a uniform way to support multiple interfaces. The value of this_ at any time is in fact a pointer to a particular ObjectEntry. This structure is used to cast this_ internally to the base address of the object.

 

In CoLib version 1.1 and higher this structure need not be defined. Just be aware that this is how your object is created by the lib.

 

The ObjectDatais a standard structure holds the basic instance information for the object.

 

ObjectDataSTRUCT

m_RefCountDWORD ; The object reference count

m_pUnkOuterDWORD ; aggregating object's IUnknown

m_lcidDWORD ; current LCID of this object

m_ptiDWORD ; object ITypeInfo pointer

m_pAggListDWORD ; reference to aggregated object linked list

m_pClassItemDWORD ; ClassItem data pointer

m_pEntry0DWORD ; first ObjectEntry(to skip custom data)