The customer calls the COM Process and calls the com process.
Reference: COM technical insider
DllGetClassObject
Https://msdn.microsoft.com/en-us/library/windows/desktop/ms680760.aspx
If a call to the CoGetClassObject function finds the class object that is to be loaded in a DLL,
CoGetClassObject uses the DLL's exported DllGetClassObject function.
IClassFactory
Https://msdn.microsoft.com/en-us/library/windows/desktop/ms694364.aspx
After calling the CoGetClassObject function to get an IClassFactory interface pointer to the class object,
Call the CreateInstance method of this interface to create an object.
CoCreateInstance
Https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615.aspx
CoCreateInstance is equivalent
{
CoGetClassObject (rclsid, dwClsContext, NULL, IID_IClassFactory, & pCF );
Hresult = pCF-> CreateInstance (pUnkOuter, riid, ppvObj
PCF-> Release ();
}
CoGetClassObject: searches for the specified component in the registry. After finding it, it will load the DLL that implements this component.
After successful loading, it will call the DllGetClassObject implemented in the DLL server.
DllGetClassObject: This function is used to create a response class field.
Query the IClassFactory interface and return it to CoCreateInstance.
CoCreateInstance will use this interface to call the IClassFactory: CreateInstance Function
IClassFactory: CreateInstance calls the new operator to create a specified component and query the component's IX interface.
// The customer calls the COM process:
CoCreateInstace (rclsid, NULL, dwClsContext, IID_IX, (void **) & pIX); // IX * pIX
| --> CoGetClassObject (rclsid, dwClsContext, NULL, IID_IClassFactory, & pCF) // IClassFactory * pCF
| --> DllGetClassObject (rclsid, IID_IClassFactory, & pCF)
| --> CFactory * pFactory = new CFactory ();
| --> PFactory-> QueryInterface (IID_IClassFactory, & pCF); // return class field pointer IClassFactory * pCF
| --> PCF-> CreateInstance (pUnkOuter, IID_IX, & pIX); // IX * pIX component interface pointer pIX
PIX-> Fx ();
Note:. def module definition file
LIBRARY "ComComponent"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE