Beispiel #1
0
        internal static ComTypes.TYPEATTR GetTypeAttrForTypeInfo(ComTypes.ITypeInfo typeInfo) {
            IntPtr pAttrs = IntPtr.Zero;
            typeInfo.GetTypeAttr(out pAttrs);

            // GetTypeAttr should never return null, this is just to be safe
            if (pAttrs == IntPtr.Zero) {
                throw Error.CannotRetrieveTypeInformation();
            }

            try {
                return (ComTypes.TYPEATTR)Marshal.PtrToStructure(pAttrs, typeof(ComTypes.TYPEATTR));
            } finally {
                typeInfo.ReleaseTypeAttr(pAttrs);
            }
        }
Beispiel #2
0
 internal static COM.TYPEATTR GetTypeAttr(COM.ITypeInfo typeinfo)
 {
     IntPtr pTypeAttr;
     typeinfo.GetTypeAttr(out pTypeAttr);
     COM.TYPEATTR typeattr = ClrFacade.PtrToStructure<COM.TYPEATTR>(pTypeAttr);
     typeinfo.ReleaseTypeAttr(pTypeAttr);
     return typeattr;
 }
Beispiel #3
0
 /// <summary>
 /// returns id of an interface
 /// </summary>
 /// <param name="typeInfo"></param>
 /// <returns></returns>
 private static Guid GetTypeGuid(COMTypes.ITypeInfo typeInfo)
 {
     IntPtr attribPtr = IntPtr.Zero;
     typeInfo.GetTypeAttr(out attribPtr);
     COMTypes.TYPEATTR Attributes = (COMTypes.TYPEATTR)Marshal.PtrToStructure(attribPtr, typeof(COMTypes.TYPEATTR));
     Guid typeGuid = Attributes.guid;
     typeInfo.ReleaseTypeAttr(attribPtr);
     return typeGuid;
 }
 internal static Guid GetTypeGuid(COMTypes.ITypeInfo typeInfo)
 {
     if (null == typeInfo)
         return Guid.Empty;
     IntPtr attribPtr = IntPtr.Zero;
     typeInfo.GetTypeAttr(out attribPtr);
     COMTypes.TYPEATTR Attributes = (COMTypes.TYPEATTR)Marshal.PtrToStructure(attribPtr, typeof(COMTypes.TYPEATTR));
     Guid typeGuid = Attributes.guid;
     typeInfo.ReleaseTypeAttr(attribPtr);
     return typeGuid;
 }