COMClassInfo Class |
A helper class for determining the address of COM object functions for hooking given a COM class id (CLSID) and COM interface id (IID), or COM class type and COM interface type.
Namespace: EasyHook
The COMClassInfo type exposes the following members.
Name | Description | |
---|---|---|
COMClassInfo(Guid, Guid, Int32) |
Creates a new COMClassInfo instance using the COM class and interface Guids. The function indexes to retrieve the addresses for as defined by the order of the methods in the COM interface.
| |
COMClassInfo(Type, Type, String) |
Creates a new COMClassInfo using the COM class and interface types. The function names to retrieve the addresses for should be provided as strings
|
Name | Description | |
---|---|---|
LibraryOfFunction |
Retrieve the module for the COM class. Only available after a call to Query.
| |
MethodPointers |
Will contain the method addresses after a call to Query. The index corresponds to the order method names / indexes are passed into COMClassInfo(Type, Type, String) or COMClassInfo(Guid, Guid, Int32).
|
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsModuleLoaded |
Determines if the module containing the COM class is already loaded
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Query |
Query the COM class for the specified method addresses. If not already loaded the COM module will be loaded.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
// 1. Use imported Class and Interface Types COMClassInfo cci1 = new COMClassInfo(typeof(CLSID_DirectInputDevice8), typeof(IID_IDirectInputDevice8W), "GetCapabilities"); // 2. Use Guid from class and interface types COMClassInfo cci2 = new COMClassInfo(typeof(CLSID_DirectInputDevice8).GUID, typeof(IID_IDirectInputDevice8W).GUID, 3); // 3. Use class and interface Guids directly (no need to have class and interface types defined) COMClassInfo cci3 = new COMClassInfo(new Guid("25E609E5-B259-11CF-BFC7-444553540000"), new Guid("54D41081-DC15-4833-A41B-748F73A38179"), 3); // Will output False if dinput8.dll is not already loaded Console.WriteLine(cci1.IsModuleLoaded()); cci1.Query(); cci2.Query(); cci3.Query(); // Will output True as dinput8.dll will be loaded by .Query() if not already Console.WriteLine(cci1.IsModuleLoaded()); // Output the function pointers we queried Console.WriteLine(cci1.FunctionPointers[0]); Console.WriteLine(cci2.FunctionPointers[0]); Console.WriteLine(cci3.FunctionPointers[0]); ... [ComVisible(true)] [Guid("25E609E5-B259-11CF-BFC7-444553540000")] public class CLSID_DirectInputDevice8 { } [ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("54D41081-DC15-4833-A41B-748F73A38179")] public interface IID_IDirectInputDevice8W { /*** IDirectInputDevice8W methods ***/ int GetCapabilities(IntPtr deviceCaps); // fourth method due to IUnknown methods QueryInterface, AddRef and Release // other methods... }