The MCCustomMethod structure describes a COM vtable method that uses a custom method marshaling hook (DISPATCH and DUAL methods cannot be custom marshaled). This feature is only supported in Microsoft® Internet Explorer 4.0 or later.
SpecialArgumentEntry_attribute { u1 bArgIndex; u1 bArgFlavor; } CustomMethod_attribute { u2 IIDIndex; u2 VTblIndex; u2 hookclsIndex; u2 j2cmethodIndex; u2 c2jmethodIndex; u2 cbUserData; u4 reserved; u1 bRetFlavor; u1 cbSpecialComArgs; MCSpecialArgumentEntry paramFlavor[cbSpecialComArgs]; u1 UserData[cbUserData]; };
The C structure MCCustomMethod, declared in comattr.h, defines the layout of this attribute for use in C/C++ programs.
Name | Value | Comments |
MCARGF_I4 | 0 | A signed 32-bit integer. |
MCARGF_R4 | 1 | A 32-bit IEEE floating value. |
MCARGF_R8 | 2 | A 64-bit IEEE floating value. |
MCARGF_I8 | 3 | A signed 64-bit integer. |
MCARGF_PTR | 4 | A pointer (a machine address). |
MCARGF_STRUCT | 5 | A by-value structure. Note that entries of this type take two slots. Only the bArgFlavor field of the first slot is valid, and will be MCARGF_STRUCT. The following slot (two bytes, treated as a WORD) is the size of the structure in bytes. |
IIDIndex
This value must be a valid index into the GUIDPool represented by the COM_GuidPool attribute and denotes the IID through which this method is exposed.
VtblIndex
Denotes which vtable element this method occupies. Index values of 0, 1 and 2 are not legal because these correspond to the IUnknown interface methods, which cannot be overridden. In addition, if the method pool contains MCDispMethods using the same IID, index values of 3, 4, 5, and 6 cannot be specified because they correspond to IDispatch methods that are supplied by the Microsoft VM.
hookclsIndex
An index of a CONSTANT_Class constant pool item that denotes the Java class that holds the hook methods. This class should derive directly from java.lang.Object to avoid circular loading problems.
j2cmethodIndex
Index of a CONSTANT_Utf8 constant pool item that denotes the method within the hook class that handles Java calls to COM. The method has the following prototype:
public static JTYPE j2chook(int)
where JTYPE must be identical to the return type of the associated Java method, with one exception: If the associated Java method returns a reference type (object or array), JTYPE can be declared as "java.lang.Object".
c2jmethodIndex
Index of a CONSTANT_Utf8 constant pool item that denotes the method within the hook class that handles COM calls to Java. The method has the following prototype:
public static void c2jhook(int)
cbUserData
Number of bytes of user data following the paramFlavor[] array. The Microsoft VM will not interpret this data but will make it available to the hook methods. This allows one hook method to handle multiple methods.
reserved
Must be set to 0 (zero).
bRetFlavor
Certain platforms have calling conventions that require distinguishing between normal and floating point values. See the MCARGF table for the possible flavors. Because COM methods almost universally return HRESULT values, this field will usually be set to MCARGF_I4. This field cannot be used to indicate the flavor of an [out,retval] parameter. These must be set in the paramFlavor[] array, and the flavor is MCARGF_PTR).
cbSpecialComArgs
Indicates the size of the paramFlavor[] array.
MCSpecialArgumentEntry paramFlavor[cbSpecialComArgs]
This is a variable-length array and is not indicated in the struct definition. It follows the cbSpecialComArgs field. This array indicates the flavor of all parameters that are not type MCARGF_I4 or the final parameter. The final parameter must always be declared because on some platforms, the total size of the argument stack is needed to implement the stdcall calling convention correctly. The fields of MCSpecialArgumentEntry are as follows:
bArgIndex
In this index of the argument, 0 denotes the first 4-byte argument after the "this" pointer, 1 denotes the second 4-byte argument after the "this" pointer, and so forth. The "this" pointer is implicitly MCARGF_PTR, so its flavor neither can nor need be indicated in bArgIndex.
bArgFlavor
This must be one of the MCARGF values.
UserData
This is a variable-length array and is not indicated in the struct definition. It follows the cbSpecialComArgs field. This array indicates any user data associated with this method. The Microsoft VM does not interpret this data, but hook methods can access it.