COM and DCOM Sisimon Soman
COM • Binary standard by M$ • Objects exposed from dll through well defined interface. • All dll servers expose common function (DllGetClassObject()) so that COM subsystem can get the object. • One COM object support multiple interfaces, can query (QueryInterface()) other interfaces from an interface pointer. • All interfaces should derive from IUnknown (for reference counting, QueryInterface()). • Client calls CoCreateInstance() -> dll name from registry->LoadLibrary-> DllGetClassObject(IID).
Foo.dll IFoo Interface IFoo:public IUnknown { F1(); } Class CFoo : public IFoo { F1() {….} }; DllGetCLassObject (IID, pFoo) { If(IID == IID_IFoo) { pFoo = new CFoo; return SUCCESS; } else { return E_FAIL; } }
COM Subsystem Object DB Start DCOM process 2 DCOM Server Process Request COM Subsystem to get the Object pointer 3 Interface IFoo:public Client IUnknown 1 IFoo interface { F1(); } CoCreateInstance(Foo) Class CFoo : public IFoo { 4 F1() {….} Register object to Object DB }; CoRegisterClassObjects(pFoo)

COM and DCOM

  • 1.
    COM and DCOM Sisimon Soman
  • 2.
    COM • Binary standardby M$ • Objects exposed from dll through well defined interface. • All dll servers expose common function (DllGetClassObject()) so that COM subsystem can get the object. • One COM object support multiple interfaces, can query (QueryInterface()) other interfaces from an interface pointer. • All interfaces should derive from IUnknown (for reference counting, QueryInterface()). • Client calls CoCreateInstance() -> dll name from registry->LoadLibrary-> DllGetClassObject(IID).
  • 3.
    Foo.dll IFoo Interface IFoo:public IUnknown { F1(); } Class CFoo : public IFoo { F1() {….} }; DllGetCLassObject (IID, pFoo) { If(IID == IID_IFoo) { pFoo = new CFoo; return SUCCESS; } else { return E_FAIL; } }
  • 4.
    COM Subsystem Object DB Start DCOM process 2 DCOM Server Process Request COM Subsystem to get the Object pointer 3 Interface IFoo:public Client IUnknown 1 IFoo interface { F1(); } CoCreateInstance(Foo) Class CFoo : public IFoo { 4 F1() {….} Register object to Object DB }; CoRegisterClassObjects(pFoo)