Reference: COM Technology Insider
DllGetClassObject
Https://msdn.microsoft.com/en-us/library/windows/desktop/ms680760.aspx
If a call to the CoGetClassObject function finds the class object which is the 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 a 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 equivalence
{
CoGetClassObject (Rclsid, dwClsContext, NULL, Iid_iclassfactory, &pcf);
HRESULT = Pcf->createinstance (Punkouter, riid, ppvobj
Pcf->release ();
}
CoGetClassObject: The specified component will be found in the registry. Once found, it will load the DLL that implements this component.
After the mount succeeds, it calls the DllGetClassObject implemented in the DLL server.
DllGetClassObject: The function is to create a response class farm.
Queries the IClassFactory interface and returns it to CoCreateInstance.
CoCreateInstance will use this interface to invoke the IClassFactory::CreateInstance function
IClassFactory::CreateInstance invokes the new operator to create the specified component and queries 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); Returns the class field pointer iclassfactory* PCF
|--> pcf->createinstance (Punkouter, Iid_ix, &pix); ix* PIX Component Interface pointer pix
Pix->fx ();
Note:. def module definition files
LIBRARY "Comcomponent"
Exports
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
Customer calls COM process