DLL exports 4 COM function but not COM object ?! I just don't understand!
I've been looking at DLLs in windows, and I saw many DLLs that have the 4 开发者_运维技巧COM exported functions:
DllCanUnloadNow DllGetClassObject DllRegisterServer DllUnregisterServer
just for an example: c:\windows\system32\actxprxy.dll // <-- WINDOWS 7 !!! (I guess Vista as well)
B - U - T when I am looking for COM objects (using various tools, including visual studio, nirsoft.net's DLLEXP.exe and other tools) I can't find any!
Moreover, visual studio says it is not a COM object, how is it possible ?! I can think of a COM DLL without any interfaces/classes in it, but I know for certain applications use these DLLs.
Can anyone explain what is going on here? :-)
Thanks!
COM defines the vtables and calling parameters of the COM interface methods. However, the pointers to the method implementations are never exported using the DLL Export mechanism: these pointers to method implementations are stored on the vtable of the COM object that was created by the library.
That is, without asking the COM library to create one COM object for you, it is not possible to know how the COM library will "construct" a COM object. Part of that "construction" process involves putting the right method pointers into the object's virtual table.
精彩评论