Ejemplo n.º 1
0
        public override int GetTypeInfoOfGuid(ref Guid guid, IntPtr ppTInfo)
        {
            var hr = _target_ITypeLib.GetTypeInfoOfGuid(guid, ppTInfo);

            if (ComHelper.HRESULT_FAILED(hr))
            {
                return(HandleBadHRESULT(hr));
            }

            var pTInfo = RdMarshal.ReadIntPtr(ppTInfo);

            using (var outVal = TypeApiFactory.GetTypeInfoWrapper(pTInfo)) // takes ownership of the COM reference [pTInfo]
            {
                RdMarshal.WriteIntPtr(ppTInfo, outVal.GetCOMReferencePtr());

                _cachedTypeInfos = _cachedTypeInfos ?? new DisposableList <ITypeInfoWrapper>();
                _cachedTypeInfos.Add(outVal);
            }

            return(hr);
        }