public void GetTypeAttr(out IntPtr ppTypeAttr) { // Fail BEFORE allocating the handle to avoid leaks. If the real COM object fails in this method // and doesn't return the handle or clean it up itself there's not much we can do to avoid the leak. _faultInjector.FailurePointThrow(MockTypeLibrariesFailurePoints.ITypeInfo_GetTypeAttr); ppTypeAttr = _memoryHelper.AllocateHandle(Marshal.SizeOf <TYPEATTR>()); Marshal.StructureToPtr(_typeAttributes, ppTypeAttr, false); }
public TYPEDESC CreateTypeDesc(IntPtr finalTypeHRef, MockUnmanagedMemoryHelper memoryHelper) { TYPEDESC typeDesc; typeDesc.vt = (short)VarEnum.VT_PTR; typeDesc.lpValue = memoryHelper.AllocateHandle(Marshal.SizeOf <TYPEDESC>()); Marshal.StructureToPtr(_baseElementType.CreateTypeDesc(finalTypeHRef, memoryHelper), typeDesc.lpValue, false); return(typeDesc); }