4852 references to Marshal
ComSvcConfig (1)
SafeNativeMethods.cs (1)
355Marshal.ThrowExceptionForHR(hr);
mscorlib (409)
microsoft\win32\fusionwrap.cs (4)
130Marshal.ThrowExceptionForHR(hr); 135Marshal.ThrowExceptionForHR(hr); 143Marshal.ThrowExceptionForHR(hr); 171sDisplayName = Marshal.PtrToStringUni(pDisplayName);
microsoft\win32\registrykey.cs (1)
370secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);
microsoft\win32\win32native.cs (5)
401OSVersionInfoSize = (int)Marshal.SizeOf(this); 418OSVersionInfoSize = (int)Marshal.SizeOf(this); 637internal static readonly long SizeOf = (long)Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES)); 788buffer.length = Marshal.SizeOf(typeof(MEMORYSTATUSEX)); 1060if (lo == -1 && ((hr = Marshal.GetLastWin32Error()) != 0))
system\__comobject.cs (4)
68return System.Runtime.InteropServices.Marshal.GetIUnknownForObject(this); 146Marshal.ReleaseComObject(ComObj); 175return Marshal.InternalReleaseComObject(this); 181Marshal.InternalFinalReleaseComObject(this);
system\activationcontext.cs (3)
359Marshal.ReleaseComObject(o); 377Marshal.ReleaseComObject(o); 438Marshal.ReleaseComObject(_actContext);
system\appdomainmanager.cs (2)
212punkAppDomainManager = Marshal.GetIUnknownForObject(this); 217Marshal.Release(punkAppDomainManager);
system\collections\concurrent\PartitionerStatic.cs (1)
1717chunkSize = Math.Max(1, DEFAULT_BYTES_PER_CHUNK / Marshal.SizeOf(typeof(TSource)));
system\console.cs (4)
985int errorCode = Marshal.GetLastWin32Error(); 1136int errorCode = Marshal.GetLastWin32Error(); 1292int errorCode = Marshal.GetLastWin32Error(); 1575int errorCode = Marshal.GetLastWin32Error();
system\deployment\cmsinterop.cs (12)
271Marshal.FreeCoTaskMem(StringIds); 276Marshal.FreeCoTaskMem(IntegerIds); 323Marshal.FreeCoTaskMem(StringIds); 328Marshal.FreeCoTaskMem(IntegerIds); 375Marshal.FreeCoTaskMem(ResourceTypeIdInt); 380Marshal.FreeCoTaskMem(ResourceTypeIdString); 432Marshal.FreeCoTaskMem(TransformMetadata); 437Marshal.FreeCoTaskMem(DigestValue); 503Marshal.FreeCoTaskMem(HashValue); 780Marshal.FreeCoTaskMem(HashValue); 1148Marshal.FreeCoTaskMem(ManifestHash); 1153Marshal.FreeCoTaskMem(MvidValue);
system\deployment\isolationinterop.cs (49)
22Marshal.FreeCoTaskMem(BlobData); 1221Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationStageComponent)); 1261Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationStageComponentFile)); 1292Size = (UInt32)Marshal.SizeOf(typeof(StoreApplicationReference)); 1302IntPtr Reference = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 1303Marshal.StructureToPtr(this, Reference, false); 1312Marshal.DestroyStructure(ip, typeof(StoreApplicationReference)); 1313Marshal.FreeCoTaskMem(ip); 1344Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationPinDeployment)); 1390Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationUnpinDeployment)); 1434Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationInstallDeployment)); 1478Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationUninstallDeployment)); 1545Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationSetDeploymentMetadata)); 1604ulong iSlotSize = (ulong)Marshal.SizeOf(typeof(StoreOperationMetadataProperty)); 1608Marshal.DestroyStructure( 1613Marshal.FreeCoTaskMem(rgItems); 1623int iSlotSize = Marshal.SizeOf(typeof(StoreOperationMetadataProperty)); 1624IntPtr retval = Marshal.AllocCoTaskMem(iSlotSize * Props.Length); 1628Marshal.StructureToPtr( 1655Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationSetCanonicalizationContext)); 1687Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationScavenge)); 2154Marshal.Copy(b.BlobData, retval, 0, (int)b.Size); 2451Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationStageComponent)); 2454Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationStageComponentFile)); 2457Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationPinDeployment)); 2460Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationUninstallDeployment)); 2463Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationUnpinDeployment)); 2466Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationInstallDeployment)); 2469Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationSetCanonicalizationContext)); 2472Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationSetDeploymentMetadata)); 2475Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationScavenge)); 2482Marshal.FreeCoTaskMem(op.Data.DataPtr); 2513txnList[i].Data.DataPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(o)); 2514Marshal.StructureToPtr(o, txnList[i].Data.DataPtr, false); 2743IntPtr p = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 2744Marshal.StructureToPtr(this, p, false); 2751Marshal.DestroyStructure(p, typeof(CreateActContextParametersSource)); 2752Marshal.FreeCoTaskMem(p); 2789IntPtr p = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 2790Marshal.StructureToPtr(this, p, false); 2797Marshal.DestroyStructure(p, typeof(CreateActContextParametersSourceDefinitionAppid)); 2798Marshal.FreeCoTaskMem(p); 2809Parameters.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParameters)); 2817SourceInfo.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParametersSource)); 2822DefAppIdSource.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParametersSourceDefinitionAppid));
system\diagnostics\eventing\eventprovider.cs (2)
536if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8) 559Marshal.Copy((IntPtr)filterData->Ptr, data, 0, data.Length);
system\diagnostics\eventing\eventsource.cs (1)
1873return System.Runtime.InteropServices.Marshal.PtrToStringUni(dataPointer);
System\Diagnostics\Eventing\TraceLogging\DataCollector.cs (1)
136Marshal.Copy((IntPtr)p, this.buffer, oldPos, size);
system\environment.cs (13)
495Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 504Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 525Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 534Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 635if (Marshal.GetLastWin32Error() == Win32Native.ERROR_ENVVAR_NOT_FOUND) { 914int errorCode = Marshal.GetLastWin32Error(); 1018if (r == IntPtr.Zero) BCLDebug.Assert(false, "SetEnvironmentVariable failed: " + Marshal.GetLastWin32Error()); 1426if (Win32Native.GetUserObjectInformation(hwinsta, Win32Native.UOI_FLAGS, flags, Marshal.SizeOf(flags),ref lengthNeeded)) { 1583int errorCode = Marshal.GetLastWin32Error();
system\globalization\compareinfo.cs (1)
1328v.dwNLSVersionInfoSize = Marshal.SizeOf(typeof(Win32Native.NlsVersionInfoEx));
system\globalization\idnmapping.cs (4)
187lastError = Marshal.GetLastWin32Error(); 201lastError = Marshal.GetLastWin32Error(); 276lastError = Marshal.GetLastWin32Error(); 290lastError = Marshal.GetLastWin32Error();
system\guid.cs (1)
1152Marshal.ThrowExceptionForHR(Win32Native.CoCreateGuid(out guid), new IntPtr(-1));
system\io\__consolestream.cs (2)
223int errorCode = Marshal.GetLastWin32Error(); 277int errorCode = Marshal.GetLastWin32Error();
system\io\__error.cs (2)
125int errorCode = Marshal.GetLastWin32Error(); 195int errorCode = Marshal.GetLastWin32Error();
system\io\directory.cs (15)
309secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 331int currentError = Marshal.GetLastWin32Error(); 468int errorCode = Marshal.GetLastWin32Error(); 505int errorCode = Marshal.GetLastWin32Error(); 542int errorCode = Marshal.GetLastWin32Error(); 1120int errorCode = Marshal.GetLastWin32Error(); 1195int errorCode = Marshal.GetLastWin32Error(); 1265int hr = Marshal.GetLastWin32Error(); 1374hr = Marshal.GetLastWin32Error(); 1413hr = Marshal.GetLastWin32Error(); 1432hr = Marshal.GetLastWin32Error(); 1450hr = Marshal.GetLastWin32Error(); 1466hr = Marshal.GetLastWin32Error(); 1478hr = Marshal.GetLastWin32Error(); 1519int hr = Marshal.GetLastWin32Error();
system\io\directoryinfo.cs (1)
679int hr = Marshal.GetLastWin32Error();
system\io\driveinfo.cs (3)
128int errorCode = Marshal.GetLastWin32Error(); 245int errorCode = Marshal.GetLastWin32Error(); 269int errorCode = Marshal.GetLastWin32Error();
system\io\file.cs (11)
171int errorCode = Marshal.GetLastWin32Error(); 305int hr = Marshal.GetLastWin32Error(); 332int errorCode = Marshal.GetLastWin32Error(); 363int errorCode = Marshal.GetLastWin32Error(); 501int errorCode = Marshal.GetLastWin32Error(); 565int errorCode = Marshal.GetLastWin32Error(); 629int errorCode = Marshal.GetLastWin32Error(); 711int hr = Marshal.GetLastWin32Error(); 1378dataInitialised = Marshal.GetLastWin32Error(); 1431dataInitialised = Marshal.GetLastWin32Error(); 1467int hr = Marshal.GetLastWin32Error();
system\io\fileinfo.cs (1)
349int hr = Marshal.GetLastWin32Error();
system\io\filestream.cs (8)
384int errorCode = Marshal.GetLastWin32Error(); 856int errorCode = Marshal.GetLastWin32Error(); 1084secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 1101secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 1184int hr = Marshal.GetLastWin32Error(); 1482int hr = Marshal.GetLastWin32Error(); 2517hr = Marshal.GetLastWin32Error(); 2574hr = Marshal.GetLastWin32Error();
system\io\filesystemenumerable.cs (4)
277int hr = Marshal.GetLastWin32Error(); 432int hr = Marshal.GetLastWin32Error(); 481int hr = Marshal.GetLastWin32Error(); 537int hr = Marshal.GetLastWin32Error();
system\io\filesysteminfo.cs (1)
316int hr = Marshal.GetLastWin32Error();
system\io\isolatedstorage\isolatedstoragefile.cs (2)
2466hr = Marshal.GetLastWin32Error(); 2494hr = Marshal.GetLastWin32Error();
system\io\longpath.cs (11)
219int errorCode = Marshal.GetLastWin32Error(); 266int hr = Marshal.GetLastWin32Error(); 543secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 568int currentError = Marshal.GetLastWin32Error(); 657int hr = Marshal.GetLastWin32Error(); 755hr = Marshal.GetLastWin32Error(); 800hr = Marshal.GetLastWin32Error(); 824hr = Marshal.GetLastWin32Error(); 848hr = Marshal.GetLastWin32Error(); 868hr = Marshal.GetLastWin32Error(); 881hr = Marshal.GetLastWin32Error();
system\io\path.cs (1)
913int errorCode = Marshal.GetLastWin32Error();
system\io\pathhelper.cs (2)
255int lastErr = Marshal.GetLastWin32Error(); 294int lastErr = Marshal.GetLastWin32Error();
system\io\unmanagedmemoryaccessor.cs (3)
559UInt32 sizeOfT = Marshal.SizeOfType(typeof(T)); 605UInt32 sizeOfT = Marshal.AlignedSizeOf<T>(); 1043UInt32 sizeOfT = Marshal.SizeOfType(typeof(T));
system\marshalbyrefobject.cs (1)
55pUnk = Marshal.GetIUnknownForObject(this);
system\reflection\assembly.cs (1)
1206ppv = Marshal.GetComInterfaceForObject(this, typeof(_Assembly));
system\reflection\customattribute.cs (2)
1744if (Marshal.ReadInt16(blobStart) != CustomAttributeVersion) 1748cNamedArgs = Marshal.ReadInt16(blobStart);
system\Runtime\InteropServices\ComEventsHelper.cs (4)
182Marshal.SetComObjectData(rcw, typeof(ComEventsInfo), null); 194IntPtr punk = Marshal.GetIUnknownForObject(rcw); 196rcw = Marshal.GetObjectForIUnknown(punk); 198Marshal.Release(punk);
system\Runtime\InteropServices\ComEventsInfo.cs (2)
55return (ComEventsInfo)Marshal.GetComObjectData(rcw, typeof(ComEventsInfo)); 64Marshal.SetComObjectData(rcw, typeof(ComEventsInfo), eventsInfo);
system\Runtime\InteropServices\ComEventsSink.cs (3)
223Marshal.GetNativeVariantForObject(result, pvarResult); 244ppv = Marshal.GetComInterfaceForObject(this, typeof(NativeMethods.IDispatch), CustomQueryInterfaceMode.Ignore); 278Marshal.ReleaseComObject(_connectionPoint);
system\runtime\interopservices\criticalhandle.cs (2)
199int lastError = Marshal.GetLastWin32Error(); 204Marshal.SetLastWin32Error(lastError);
system\runtime\interopservices\dispatchwrapper.cs (2)
35IntPtr pdisp = Marshal.GetIDispatchForObject(obj); 38Marshal.Release(pdisp);
system\runtime\interopservices\errorwrapper.cs (1)
43m_ErrorCode = Marshal.GetHRForException(e);
system\runtime\interopservices\marshal.cs (1)
2767Marshal.GetTypeLibName((ITypeLib)TypeLib) + ".dll",
system\runtime\interopservices\registrationservices.cs (13)
256return Marshal.GenerateProgIdForType(type); 304if (Marshal.GenerateGuidForType(type) == Marshal.GenerateGuidForType(baseComImportType)) 364return Marshal.IsTypeVisibleFromCom(type); 378String strRecordId = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 416String strClsId = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 500String strClsId = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 546String strRecordId = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 608String strClsId = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 800String strClsId = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 874String strTlbId = "{" + Marshal.GetTypeLibGuidForAssembly(assembly).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 900String strTlbId = "{" + Marshal.GetTypeLibGuidForAssembly(assembly).ToString().ToUpper(CultureInfo.InvariantCulture) + "}"; 1056objs[0] = "HKEY_CLASSES_ROOT\\CLSID\\{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}";
system\runtime\interopservices\runtimeenvironment.cs (2)
172return Marshal.GetObjectForIUnknown(p); 175Marshal.Release(p);
system\runtime\interopservices\safebuffer.cs (7)
145Initialize(numElements, Marshal.AlignedSizeOf<T>()); 221uint sizeofT = Marshal.SizeOfType(typeof(T)); 261uint sizeofT = Marshal.SizeOfType(typeof(T)); 262uint alignedSizeofT = Marshal.AlignedSizeOf<T>(); 296uint sizeofT = Marshal.SizeOfType(typeof(T)); 333uint sizeofT = Marshal.SizeOfType(typeof(T)); 334uint alignedSizeofT = Marshal.AlignedSizeOf<T>();
system\runtime\interopservices\tceadaptergen\eventproviderwriter.cs (2)
286MethodInfo ReleaseComObjectMethod = typeof(Marshal).GetMethod( "ReleaseComObject" ); 607MethodInfo ReleaseComObjectMethod = typeof(Marshal).GetMethod( "ReleaseComObject" );
system\runtime\interopservices\typelibconverter.cs (5)
332Marshal.GetTypeLibVersion(pTLB, out major, out minor); 374Object[] aArgs = new Object[1] {Marshal.GetTypeLibGuid((ITypeLib)typeLib).ToString()}; 389String strTypeLibName = Marshal.GetTypeLibName((ITypeLib)typeLib); 408Marshal.GetTypeLibVersion((ITypeLib)typeLib, out major, out minor); 456Attr = (_TYPELIBATTR)Marshal.PtrToStructure(pAttr, typeof(_TYPELIBATTR));
system\Runtime\InteropServices\Variant.cs (12)
159Marshal.GetNativeVariantForObject(value, (IntPtr)(void*)&vArray); 220*(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.GetIUnknownForObject(value); 224*(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.GetIDispatchForObject(value); 228*(IntPtr*)this._typeUnion._unionTypes._byref = Marshal.StringToBSTR((string)value); 240Marshal.GetNativeVariantForObject(value, this._typeUnion._unionTypes._byref); 296return Marshal.GetObjectForNativeVariant((System.IntPtr)pThis); 620return (string)Marshal.PtrToStringBSTR(this._typeUnion._unionTypes._bstr); 625this._typeUnion._unionTypes._bstr = Marshal.StringToBSTR(value); 636return Marshal.GetObjectForIUnknown(_typeUnion._unionTypes._unknown); 644_typeUnion._unionTypes._unknown = Marshal.GetIUnknownForObject(value); 655return Marshal.GetObjectForIUnknown(_typeUnion._unionTypes._dispatch); 663_typeUnion._unionTypes._dispatch = Marshal.GetIDispatchForObject(value);
system\runtime\interopservices\windowsruntime\clripropertyvalueimpl.cs (8)
515Contract.Requires(Marshal.SizeOf(expectedBoxedType) == Marshal.SizeOf(typeof(T))); 525Buffer.Memcpy(pUnboxed, pData, Marshal.SizeOf(unboxed)); 536Contract.Requires(Marshal.SizeOf(expectedArrayElementType) == Marshal.SizeOf(typeof(T))); 548byte *pData = (byte *)Marshal.UnsafeAddrOfPinnedArrayElement(dataArray, 0); 549byte *pConverted = (byte *)Marshal.UnsafeAddrOfPinnedArrayElement(converted, 0); 551Buffer.Memcpy(pConverted, pData, checked(Marshal.SizeOf(typeof(T)) * converted.Length));
system\runtime\interopservices\windowsruntime\iteratortoenumeratoradapter.cs (1)
192if (Marshal.GetHRForException(e) == __HResults.E_CHANGED_STATE)
system\runtime\interopservices\windowsruntime\windowsruntimemarshal.cs (16)
53if (target == null || Marshal.IsComObject(target)) 80if (target == null || Marshal.IsComObject(target)) 98if (target == null || Marshal.IsComObject(target)) 549Contract.Assert(target == null || Marshal.IsComObject(target), "Must be null or a RCW"); 554return (object) Marshal.GetRawIUnknownForComObjectNoAddRef(target); 1169exceptionIUnknown = Marshal.GetIUnknownForObject(e); 1172Marshal.QueryInterface(exceptionIUnknown, ref s_iidIErrorInfo, out exceptionIErrorInfo); 1175if (RoOriginateLanguageException(Marshal.GetHRForException_WinRT(e), e.Message, exceptionIErrorInfo)) 1191Marshal.Release(exceptionIErrorInfo); 1196Marshal.Release(exceptionIUnknown); 1211return Marshal.GetComInterfaceForObject(activationFactory, typeof(IActivationFactory)); 1221Marshal.InitializeManagedWinRTFactoryObject(activationFactory, (RuntimeType)type); 1247Marshal.Release(pActivator); 1258Marshal.AddRef(s_pClassActivator); 1283return (IActivationFactory)Marshal.GetNativeActivationFactory(type); 1311Marshal.ThrowExceptionForHR(hrCreate, new IntPtr(-1));
system\runtime\interopservices\windowsruntime\winrtclassactivator.cs (4)
33int hr = Marshal.QueryInterface(activationFactory, ref iid, out factoryInterface); 36Marshal.ThrowExceptionForHR(hr); 45Marshal.Release(activationFactory); 65return Marshal.GetComInterfaceForObject(this, typeof(IWinRTClassActivator));
system\runtime\memoryfailpoint.cs (1)
371UIntPtr sizeOfMemInfo = (UIntPtr) Marshal.SizeOf(memInfo);
system\runtime\remoting\enterpriseserviceshelper.cs (2)
40return Marshal.InternalWrapIUnknownWithComObject(punk); 66Marshal.InternalSwitchCCW(oldtp, newtp);
system\runtime\remoting\objref.cs (2)
803ret1 = InteropServices.Marshal.GetTypedObjectForIUnknown(pUnk, serverType); 814InteropServices.Marshal.Release(pUnk);
system\runtimehandles.cs (4)
72if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.Ptr) 75else if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.ByRef) 78else if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.SzArray) 82type = type.MakeArrayType(Marshal.ReadInt32((IntPtr)arModifiers, ++i * sizeof(int)));
system\security\accesscontrol\privilege.cs (8)
121int error = Marshal.GetLastWin32Error(); 210cachingError = Marshal.GetLastWin32Error(); 263error = Marshal.GetLastWin32Error(); 524( uint )Marshal.SizeOf( previousState ), 528error = Marshal.GetLastWin32Error(); 530else if ( Win32Native.ERROR_NOT_ALL_ASSIGNED == Marshal.GetLastWin32Error()) 641( uint )Marshal.SizeOf( previousState ), 645error = Marshal.GetLastWin32Error();
system\security\accesscontrol\securitydescriptor.cs (2)
655error = Marshal.GetLastWin32Error(); 689Marshal.Copy( byteArray, binaryForm, 0, ( int )byteArraySize );
system\security\accesscontrol\win32.cs (3)
40errorCode = Marshal.GetLastWin32Error(); 48resultSddl = Marshal.PtrToStringUni( ByteArray ); 212Marshal.Copy( ByteArray, BinaryForm, 0, ( int )Length );
system\security\cryptography\capinative.cs (10)
294throw new CryptographicException(Marshal.GetLastWin32Error()); 310throw new CryptographicException(Marshal.GetLastWin32Error()); 325throw new CryptographicException(Marshal.GetLastWin32Error()); 344throw new CryptographicException(Marshal.GetLastWin32Error()); 371int errorCode = Marshal.GetLastWin32Error(); 380throw new CryptographicException(Marshal.GetLastWin32Error()); 408int errorCode = Marshal.GetLastWin32Error(); 417throw new CryptographicException(Marshal.GetLastWin32Error()); 433throw new CryptographicException(Marshal.GetLastWin32Error()); 479int error = Marshal.GetLastWin32Error();
system\security\cryptography\utils.cs (2)
383IntPtr szPassword = Marshal.SecureStringToCoTaskMemAnsi(parameters.KeyPassword); 389Marshal.ZeroFreeCoTaskMemAnsi(szPassword);
system\security\cryptography\x509certificates\safex509handles.cs (1)
47return Marshal.ReadIntPtr(handle);
system\security\cryptography\x509certificates\x509certificate.cs (3)
772Marshal.ZeroFreeGlobalAllocUnicode(szPassword); 815Marshal.ZeroFreeGlobalAllocUnicode(szPassword); 855Marshal.ZeroFreeGlobalAllocUnicode(szPassword);
system\security\cryptography\x509certificates\x509utils.cs (8)
137rawKey = Marshal.StringToCoTaskMemAnsi(key); 140rawKey = Marshal.StringToCoTaskMemUni(key); 149return (CRYPT_OID_INFO)Marshal.PtrToStructure(localOidInfo, typeof(CRYPT_OID_INFO)); 156return (CRYPT_OID_INFO)Marshal.PtrToStructure(fullOidInfo, typeof(CRYPT_OID_INFO)); 164return (CRYPT_OID_INFO)Marshal.PtrToStructure(allGroupOidInfo, typeof(CRYPT_OID_INFO)); 173Marshal.FreeCoTaskMem(rawKey); 328return Marshal.StringToHGlobalUni(pwd); 332return Marshal.SecureStringToGlobalAllocUnicode(securePwd);
system\security\policy\applicationtrust.cs (1)
403Marshal.ReleaseComObject(m_pStore.InternalStore);
system\security\policymanager.cs (1)
315Exception extendedError = Marshal.GetExceptionForHR(hrSave);
system\security\principal\ntaccount.cs (4)
364SidsPtr.Initialize((uint)sourceAccounts.Count, (uint)Marshal.SizeOf(typeof(Win32Native.LSA_TRANSLATED_SID2))); 396SidsPtr.Initialize((uint)sourceAccounts.Count, (uint)Marshal.SizeOf(typeof(Win32Native.LSA_TRANSLATED_SID))); 403Win32Native.LSA_TRUST_INFORMATION ti = ( Win32Native.LSA_TRUST_INFORMATION )Marshal.PtrToStructure( new IntPtr(( long )rdl.Domains + i * Marshal.SizeOf( typeof( Win32Native.LSA_TRUST_INFORMATION ))), typeof( Win32Native.LSA_TRUST_INFORMATION ));
system\security\principal\sid.cs (5)
1003NamesPtr.Initialize((uint)sourceSids.Count, (uint)Marshal.SizeOf(typeof(Win32Native.LSA_TRANSLATED_NAME))); 1023Win32Native.LSA_TRUST_INFORMATION ti = ( Win32Native.LSA_TRUST_INFORMATION )Marshal.PtrToStructure( new IntPtr(( long )rdl.Domains + i * Marshal.SizeOf( typeof( Win32Native.LSA_TRUST_INFORMATION ))), typeof( Win32Native.LSA_TRUST_INFORMATION )); 1024ReferencedDomains[i] = Marshal.PtrToStringUni(ti.Name.Buffer, ti.Name.Length / sizeof(char)); 1041string account = Marshal.PtrToStringUni(Ltn.Name.Buffer, Ltn.Name.Length / sizeof(char)); ;
system\security\principal\win32.cs (8)
129Loa.Length = Marshal.SizeOf( typeof( Win32Native.LSA_OBJECT_ATTRIBUTES )); 166byte Revision = Marshal.ReadByte( binaryForm, 0 ); 177byte SubAuthorityCount = Marshal.ReadByte( binaryForm, 1 ); 196Marshal.Copy( binaryForm, ResultSid, 0, BinaryLength ); 218ErrorCode = Marshal.GetLastWin32Error(); 280return Marshal.GetLastWin32Error(); 327referencedDomains.Initialize((uint)Marshal.SizeOf(typeof(Win32Native.LSA_REFERENCED_DOMAIN_LIST))); 397return Marshal.GetLastWin32Error();
system\security\principal\windowsidentity.cs (33)
175uint dwLength = (uint) Marshal.SizeOf(typeof(uint)); 178if (Marshal.GetLastWin32Error() == Win32Native.ERROR_INVALID_HANDLE) 188throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error())); 317pLogonSessionData.Initialize((uint)Marshal.SizeOf(typeof(Win32Native.SECURITY_LOGON_SESSION_DATA))); 320return Marshal.PtrToStringUni(logonSessionData.AuthenticationPackage.Buffer); 415throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error())); 423throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error())); 574pGroups.ReadArray((uint)Marshal.OffsetOf(typeof(Win32Native.TOKEN_GROUPS), "Groups").ToInt32(), 868hr = GetHRForWin32Error(Marshal.GetLastWin32Error()); 889Contract.Assert(information.ByteLength >= (ulong)Marshal.SizeOf(typeof(T)), 940uint dwLength = (uint) Marshal.SizeOf(typeof(uint)); 946int dwErrorCode = Marshal.GetLastWin32Error(); 965throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error())); 1054throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error())); 1072Contract.Assert(Marshal.SizeOf(typeof(Win32Native.KERB_S4U_LOGON)) % IntPtr.Size == 0, "Potential allignment issue setting up S4U logon buffer"); 1073uint logonInfoSize = (uint) (Marshal.SizeOf(typeof(Win32Native.KERB_S4U_LOGON)) + upnBytes.Length); 1082ulong upnOffset = (ulong)Marshal.SizeOf(typeof(Win32Native.KERB_S4U_LOGON)); 1333int count = Marshal.ReadInt32(safeAllocHandle.DangerousGetHandle()); 1334IntPtr pSidAndAttributes = new IntPtr((long)safeAllocHandle.DangerousGetHandle() + (long)Marshal.OffsetOf(typeof(Win32Native.TOKEN_GROUPS), "Groups")); 1339Win32Native.SID_AND_ATTRIBUTES group = (Win32Native.SID_AND_ATTRIBUTES)Marshal.PtrToStructure(pSidAndAttributes, typeof(Win32Native.SID_AND_ATTRIBUTES)); 1383Win32Native.TOKEN_PRIMARY_GROUP primaryGroup = (Win32Native.TOKEN_PRIMARY_GROUP)Marshal.PtrToStructure(safeAllocHandlePrimaryGroup.DangerousGetHandle(), typeof(Win32Native.TOKEN_PRIMARY_GROUP)); 1391int count = Marshal.ReadInt32(safeAllocHandle.DangerousGetHandle()); 1392IntPtr pSidAndAttributes = new IntPtr((long)safeAllocHandle.DangerousGetHandle() + (long)Marshal.OffsetOf(typeof(Win32Native.TOKEN_GROUPS), "Groups")); 1395Win32Native.SID_AND_ATTRIBUTES group = (Win32Native.SID_AND_ATTRIBUTES)Marshal.PtrToStructure(pSidAndAttributes, typeof(Win32Native.SID_AND_ATTRIBUTES)); 1445Win32Native.SID_AND_ATTRIBUTES user = (Win32Native.SID_AND_ATTRIBUTES)Marshal.PtrToStructure(safeAllocHandle.DangerousGetHandle(), typeof(Win32Native.SID_AND_ATTRIBUTES)); 1479Win32Native.CLAIM_SECURITY_ATTRIBUTES_INFORMATION claimAttributes = (Win32Native.CLAIM_SECURITY_ATTRIBUTES_INFORMATION)Marshal.PtrToStructure(safeAllocHandle.DangerousGetHandle(), typeof(Win32Native.CLAIM_SECURITY_ATTRIBUTES_INFORMATION)); 1489Win32Native.CLAIM_SECURITY_ATTRIBUTE_V1 windowsClaim = (Win32Native.CLAIM_SECURITY_ATTRIBUTE_V1)Marshal.PtrToStructure(pAttribute, typeof(Win32Native.CLAIM_SECURITY_ATTRIBUTE_V1)); 1496Marshal.Copy(windowsClaim.Values.ppString, stringPointers, 0, (int)windowsClaim.ValueCount); 1500instanceClaims.Add( new Claim(windowsClaim.Name, Marshal.PtrToStringAuto(stringPointers[item]), ClaimValueTypes.String, m_issuerName, m_issuerName, this, propertyValue, string.Empty)); 1506Marshal.Copy(windowsClaim.Values.pInt64, intValues, 0, (int)windowsClaim.ValueCount); 1517Marshal.Copy(windowsClaim.Values.pUint64, uintValues, 0, (int)windowsClaim.ValueCount); 1527Marshal.Copy(windowsClaim.Values.pUint64, boolValues, 0, (int)windowsClaim.ValueCount); 1556offset += Marshal.SizeOf(windowsClaim);
system\security\principal\windowsimpersonationcontext.cs (1)
55throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error()));
system\security\principal\windowsprincipal.cs (2)
247throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error())); 255throw new SecurityException(Win32Native.GetMessage(Marshal.GetLastWin32Error()));
system\security\securestring.cs (8)
543ptr = Marshal.AllocHGlobal((length + 1) * 2); 546ptr = Marshal.AllocCoTaskMem((length + 1) * 2); 573Marshal.FreeHGlobal(ptr); 576Marshal.FreeCoTaskMem(ptr); 611ptr = Marshal.AllocHGlobal(byteCount); 614ptr = Marshal.AllocCoTaskMem(byteCount); 636Marshal.FreeHGlobal(ptr); 639Marshal.FreeCoTaskMem(ptr);
system\string.cs (1)
1441Contract.Assert(cbNativeBuffer >= (Length + 1) * Marshal.SystemMaxDBCSCharSize, "Insufficient buffer length passed to ConvertToAnsi");
system\stubhelpers.cs (25)
30byte[] buffer = new byte[(str.Length + 1) * Marshal.SystemMaxDBCSCharSize]; 41int cbAllocLength = (1 + 1) * Marshal.SystemMaxDBCSCharSize; 74if (pbNativeBuffer != null || Marshal.SystemMaxDBCSCharSize == 1) 80nb = (strManaged.Length + 1) * Marshal.SystemMaxDBCSCharSize; 87pbNativeBuffer = (byte*)Marshal.AllocCoTaskMem(nb + 1); 102pbNativeBuffer = (byte*)Marshal.AllocCoTaskMem(nb + 2); 163pbNativeBuffer = (byte*)Marshal.AllocCoTaskMem(nb + 1); 381int nbytes = sizeof(uint) + ((cch + 1) * Marshal.SystemMaxDBCSCharSize); 383pNative = (byte*)Marshal.AllocCoTaskMem(nbytes); 556Marshal.ThrowExceptionForHR(hrCreate, new IntPtr(-1)); 581Marshal.ThrowExceptionForHR(hrCreate, new IntPtr(-1)); 706newItemsIP = Marshal.GetComInterfaceForObject(newItems, typeof(IBindableVector)); 708oldItemsIP = Marshal.GetComInterfaceForObject(oldItems, typeof(IBindableVector)); 715Marshal.Release(oldItemsIP); 717Marshal.Release(newItemsIP); 1117pNativeHome = Marshal.AllocCoTaskMem(allocSize); 1150int allocSize = (pManagedHome.Capacity * Marshal.SystemMaxDBCSCharSize) + 4; 1151pNativeHome = Marshal.AllocCoTaskMem(allocSize); 1187pNativeHome = Marshal.AllocCoTaskMem(allocSize); 1218int allocSize = Marshal.SizeOfHelper(pManagedHome.GetType(), false); 1219IntPtr pNativeHome = Marshal.AllocCoTaskMem(allocSize); 1329Marshal.DestroyStructure(pNativeHome, layoutType); 1347return Marshal.GetComInterfaceForObject(impl, typeof(IReference<T>)); 1447Marshal.ThrowExceptionForHR(hrCreate, new IntPtr(-1)); 1539return Marshal.GetComInterfaceForObject(impl, typeof(IKeyValuePair<K, V>));
system\threading\eventwaithandle.cs (4)
81int errorCode = Marshal.GetLastWin32Error(); 115secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 140int errorCode = Marshal.GetLastWin32Error(); 250int errorCode = Marshal.GetLastWin32Error();
system\threading\mutex.cs (4)
74secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 389errorCode = Marshal.GetLastWin32Error(); 440errorCode = Marshal.GetLastWin32Error(); 470errorCode = Marshal.GetLastWin32Error();
system\threading\timer.cs (2)
90throw Marshal.GetExceptionForHR(Marshal.GetLastWin32Error());
PresentationBuildTasks (3)
Base\MS\Internal\IO\Packaging\Compoundfile\ContainerUtilities.cs (2)
306return Marshal.SizeOf(typeof(Int16)); 319return Marshal.SizeOf(typeof(Int32));
BuildTasks\Microsoft\Build\Tasks\Windows\GetWinFXPath.cs (1)
222IsWow64ProcessDelegate isWow64Process = (IsWow64ProcessDelegate)Marshal.GetDelegateForFunctionPointer(isWow64ProcessHandle, typeof(IsWow64ProcessDelegate));
PresentationCore (173)
Core\CSharp\MS\Internal\AppModel\CookieHandler.cs (1)
142if (!throwIfNoCookie && Marshal.GetLastWin32Error() == NativeMethods.ERROR_NO_MORE_ITEMS)
Core\CSharp\MS\Internal\FontCache\FontCacheUtil.cs (2)
126Marshal.Copy((IntPtr)_pointer, b, 0, Size); 1053Util.ThrowWin32Exception(Marshal.GetLastWin32Error(), fileName);
Core\CSharp\MS\Internal\FontFace\FontDriver.cs (1)
288Marshal.Copy((IntPtr)fontData, fontCopy, 0, fileSize);
Core\CSharp\MS\Internal\Ink\GestureRecognizer\NativeRecognizer.cs (11)
600packetDescription.cbPacketSize = (uint)(propertyGuids.Length * Marshal.SizeOf(typeof(Int32))); 632int allocationSize = (int)(Marshal.SizeOf(typeof(MS.Win32.Recognizer.PACKET_PROPERTY)) * packetDescription.cPacketProperties); 633packetDescription.pPacketProperties = Marshal.AllocCoTaskMem(allocationSize); 639Marshal.StructureToPtr(packetProperties[i], new IntPtr(pElement), false); 649countOfBytes = packetCount * Marshal.SizeOf(typeof(Int32)); 650packets = Marshal.AllocCoTaskMem(countOfBytes); 651Marshal.Copy(rawPackets, 0, packets, packetCount); 675Marshal.DestroyStructure(new IntPtr(pElement), typeof(MS.Win32.Recognizer.PACKET_PROPERTY)); 679Marshal.FreeCoTaskMem(pd.pPacketProperties); 685Marshal.FreeCoTaskMem(pd.pguidButtons); 691Marshal.FreeCoTaskMem(packets);
Core\CSharp\MS\Internal\IO\Packaging\ByteRangeDownloader.cs (1)
568throw new Win32Exception(Marshal.GetLastWin32Error());
Core\CSharp\MS\Internal\TextFormatting\LineServicesCallbacks.cs (1)
2495Marshal.StructureToPtr(inlineInit, (System.IntPtr)objectInfo, false);
Core\CSharp\System\Windows\Clipboard.cs (3)
82Marshal.ThrowExceptionForHR(hr); 592Marshal.ThrowExceptionForHR(hr); 782Marshal.ThrowExceptionForHR(hr);
Core\CSharp\System\Windows\DataObject.cs (32)
726Marshal.ThrowExceptionForHR(NativeMethods.E_NOTIMPL); 845medium.unionmember = Marshal.GetComInterfaceForObject(istream, typeof(IStream)); 846Marshal.ReleaseComObject(istream); 852Marshal.Release(medium.unionmember); 873Marshal.ThrowExceptionForHR(hr); 893Marshal.ThrowExceptionForHR(DV_E_TYMED); 899Marshal.ThrowExceptionForHR(hr); 962Marshal.ThrowExceptionForHR(NativeMethods.E_NOTIMPL); 1174int win32Error = Marshal.GetLastWin32Error(); 1195Marshal.ThrowExceptionForHR(hr); 1211int win32Error = Marshal.GetLastWin32Error(); 1228int win32Error = Marshal.GetLastWin32Error(); 1247int win32Error = Marshal.GetLastWin32Error(); 1266int win32Error = Marshal.GetLastWin32Error(); 1284int win32Error = Marshal.GetLastWin32Error(); 1407int win32Error = Marshal.GetLastWin32Error(); 1695int win32Error = Marshal.GetLastWin32Error(); // Dance around FxCop 1875IStream istream = (IStream)( Marshal.GetObjectForIUnknown(medium.unionmember) ); 1905Marshal.ReleaseComObject(istream); 2050Marshal.Copy(bytes, 0, ptr, NativeMethods.IntPtrToInt32(size)); 2143if (Marshal.SystemDefaultCharSize == 1) 2179Marshal.Copy(structData, 0, currentPtr, structData.Length); 2195Marshal.Copy(new char[] { '\0' }, 0, currentPtr, 1); 2204Marshal.Copy(new char[] { '\0' }, 0, currentPtr, 1); 2260Marshal.Copy(new char[] { '\0' }, 0, (IntPtr)((ulong)ptr + (ulong)chars.Length * 2), 1); 2310Marshal.Copy(new byte[] { 0 }, 0, (IntPtr)((long)ptr + pinvokeSize), 1); 2370Marshal.Copy(new byte[] { 0 }, 0, (IntPtr)((long)pointerUtf8 + utf8ByteCount), 1); 2885Marshal.FreeCoTaskMem(formatetc[formatetcIndex].ptd); 3092pStream = (UnsafeNativeMethods.IStream)Marshal.GetObjectForIUnknown(medium.unionmember); 3390Marshal.Copy(ptr, bytes, 0, size); 3596byte endByte = Marshal.ReadByte((IntPtr)((long)pointerUtf8 + utf8ByteCount)); 3610Marshal.Copy(pointerUtf8, bytes, 0, utf8ByteCount);
Core\CSharp\System\Windows\Input\Cursor.cs (1)
214int errorCode = Marshal.GetLastWin32Error();
Core\CSharp\System\Windows\Input\DefaultTextStore.cs (1)
329Marshal.ReleaseComObject(compartment);
Core\CSharp\System\Windows\Input\DefaultTextStoreTextComposition.cs (4)
85Marshal.ReleaseComObject(composition); 88Marshal.ReleaseComObject(context); 113Marshal.ReleaseComObject(doc); 137Marshal.ReleaseComObject(enumCompositionView);
Core\CSharp\System\Windows\Input\InputMethod.cs (5)
1654Marshal.ReleaseComObject(fnConfigure); 1657Marshal.ReleaseComObject(funcPrv); 1716Marshal.ReleaseComObject(fnConfigure); 1719Marshal.ReleaseComObject(funcPrv); 1849Marshal.ReleaseComObject(enumIpp);
Core\CSharp\System\Windows\Input\InputProcessorProfiles.cs (4)
108Marshal.ReleaseComObject(_ipp.Value); 189int sizeOfShort = Marshal.SizeOf(typeof(short)); 194short langid = (short)Marshal.PtrToStructure((IntPtr)((Int64)langids + sizeOfShort * i), typeof(short)); 199Marshal.FreeCoTaskMem(langids);
Core\CSharp\System\Windows\Input\TextCompositionManager.cs (1)
525int win32Err = Marshal.GetLastWin32Error();
Core\CSharp\System\Windows\Input\TextServicesCompartment.cs (6)
119Marshal.ReleaseComObject(compartment); 120Marshal.ReleaseComObject(source); 142Marshal.ReleaseComObject(compartment); 143Marshal.ReleaseComObject(source); 232Marshal.ReleaseComObject(compartment); 245Marshal.ReleaseComObject(compartment);
Core\CSharp\System\Windows\Input\TextServicesContext.cs (6)
103Marshal.ReleaseComObject(_defaultTextStore.DocumentManager); 144Marshal.ReleaseComObject(_dimEmpty.Value); 156Marshal.ReleaseComObject(_threadManager.Value); 254Marshal.ReleaseComObject(context); 433Marshal.ReleaseComObject(comp); 475Marshal.ReleaseComObject(comp);
Core\CSharp\System\Windows\Interop\HwndMouseInputProvider.cs (1)
291int n = UnsafeNativeMethods.GetMouseMovePointsEx((uint)(Marshal.SizeOf(mp_in)), ref mp_in, mp_out, 64, mode);
Core\CSharp\System\Windows\Interop\HwndSource.cs (1)
1633Marshal.StructureToPtr(windowPos, lParam, true);
Core\CSharp\System\Windows\Interop\HwndTarget.cs (1)
1621return new IntPtr(Marshal.GetHRForException(e));
Core\CSharp\System\Windows\Media\ByteStreamGeometryContext.cs (2)
571Marshal.Copy(_chunkList[currentChunk], bufferOffset, (IntPtr)pbData, cbDataForThisChunk); 575Marshal.Copy((IntPtr)pbData, _chunkList[currentChunk], bufferOffset, cbDataForThisChunk);
Core\CSharp\System\Windows\Media\ColorContext.cs (2)
770HRESULT.Check(Marshal.GetHRForLastWin32Error()); 784HRESULT.Check(Marshal.GetHRForLastWin32Error());
Core\CSharp\System\Windows\Media\ColorContextHelper.cs (1)
136HRESULT.Check(Marshal.GetHRForLastWin32Error());
Core\CSharp\System\Windows\Media\ColorTransform.cs (7)
147paInputColors = Marshal.AllocHGlobal(64); 149Marshal.WriteInt64(paInputColors, inputColor); 151paOutputColors = Marshal.AllocHGlobal(64); 154Marshal.WriteInt64(paOutputColors, outputColor); 164outputColor = Marshal.ReadInt64(paOutputColors); 178Marshal.FreeHGlobal(paInputColors); 179Marshal.FreeHGlobal(paOutputColors);
Core\CSharp\System\Windows\Media\ColorTransformHelper.cs (1)
135HRESULT.Check(Marshal.GetHRForLastWin32Error());
Core\CSharp\System\Windows\Media\EventProxy.cs (1)
131return Marshal.GetHRForException(e);
Core\CSharp\System\Windows\Media\GlyphTypeface.cs (1)
1634Marshal.Copy(new IntPtr(pMilPathGeometry), data, 0, checked((int)size));
Core\CSharp\System\Windows\Media\ImageSourceConverter.cs (2)
264if (Marshal.ReadInt16(addr) != 0x1c15) 275OBJECTHEADER pHeader = (OBJECTHEADER)Marshal.PtrToStructure(addr, typeof(OBJECTHEADER));
Core\CSharp\System\Windows\Media\Imaging\BitmapEncoder.cs (2)
55pstrName = Marshal.StringToCoTaskMemUni(name); 65Marshal.FreeCoTaskMem(pstrName);
Core\CSharp\System\Windows\Media\Imaging\BitmapMetadata.cs (3)
267pIEnumMetadata = Marshal.GetComInterfaceForObject( 784blockWriter = Marshal.GetComInterfaceForObject( 838blockWriter = Marshal.GetComInterfaceForObject(
Core\CSharp\System\Windows\Media\Imaging\BitmapMetadataEnumerator.cs (2)
108_current = Marshal.PtrToStringUni(ppStr); 115Marshal.FreeCoTaskMem(ppStr);
Core\CSharp\System\Windows\Media\Imaging\BitmapSource.cs (3)
635_wicSource = new BitmapSourceSafeMILHandle(Marshal.GetComInterfaceForObject( 1963rc = (Int32Rect)Marshal.PtrToStructure(prc, typeof(Int32Rect)); 2005Marshal.Copy(managedArray, y * rectRowSize, new IntPtr(rowPtr), rectRowSize);
Core\CSharp\System\Windows\Media\Imaging\PropVariant.cs (40)
170long size = Marshal.SizeOf(type) * length; 177destPtr = Marshal.AllocCoTaskMem((int) size); 198Marshal.FreeCoTaskMem(destPtr); 233destPtr = Marshal.AllocCoTaskMem((int)size); 239pString = Marshal.StringToCoTaskMemAnsi(value[index]); 243pString = Marshal.StringToCoTaskMemUni(value[index]); 245Marshal.WriteIntPtr(destPtr, (int)index*sizeIntPtr, pString); 258IntPtr pString = Marshal.ReadIntPtr(destPtr, i*sizeIntPtr); 259Marshal.FreeCoTaskMem(pString); 262Marshal.FreeCoTaskMem(destPtr); 294pszVal = Marshal.StringToCoTaskMemAnsi(new String(value as char[])); 373pwszVal = Marshal.StringToCoTaskMemUni(value as String); 393pszVal = Marshal.StringToCoTaskMemAnsi(new String(new char[] { (char)value })); 439pclsidVal = Marshal.AllocCoTaskMem(guid.Length); 440Marshal.Copy(guid, 0, pclsidVal, guid.Length); 506UnsafeNativeMethods.MILUnknown.Release(Marshal.ReadIntPtr(punkPtr, (int) (i*sizeIntPtr))); 520Marshal.FreeCoTaskMem(Marshal.ReadIntPtr(strPtr, (int) (i*sizeIntPtr))); 524Marshal.FreeCoTaskMem(ca.pElems); 531Marshal.FreeCoTaskMem(pwszVal); 562array[i] = (sbyte) Marshal.ReadByte(ca.pElems, i); 569Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 576Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 584array[i] = (ushort) Marshal.ReadInt16(ca.pElems, i*sizeof(ushort)); 591Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 599array[i] = (uint) Marshal.ReadInt32(ca.pElems, i*sizeof(uint)); 606Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 614array[i] = (UInt64) Marshal.ReadInt64(ca.pElems, i*sizeof(UInt64)); 621Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 628Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 636array[i] = (bool) (Marshal.ReadInt16(ca.pElems, i*sizeof(ushort)) != 0); 646Marshal.Copy(ca.pElems, guid, i*16, 16); 663IntPtr ptr = Marshal.ReadIntPtr(ca.pElems, i*sizeIntPtr); 664array[i] = Marshal.PtrToStringAnsi(ptr); 680IntPtr ptr = Marshal.ReadIntPtr(ca.pElems, i*sizeIntPtr); 681array[i] = Marshal.PtrToStringUni(ptr); 736Marshal.Copy(pclsidVal, guid, 0, 16); 740return Marshal.PtrToStringAnsi(pszVal); 743return Marshal.PtrToStringUni(pwszVal); 748Marshal.Copy(ca.pElems, blob, 0, (int)ca.cElems);
Core\CSharp\System\Windows\Media\Imaging\WriteableBitmap.cs (2)
1294elementSize = Marshal.SizeOf(exemplar); 1321elementSize = Marshal.SizeOf(exemplar);
Core\CSharp\System\Windows\Media\MediaContextNotificationWindow.cs (1)
258ChangeWindowMessageFilterNative function = Marshal.GetDelegateForFunctionPointer(
Core\CSharp\System\Windows\Media\PixelFormat.cs (1)
180Debug.Assert(Marshal.SizeOf(typeof(Guid)) == 16);
Core\CSharp\System\Windows\Media\RenderData.cs (2)
125Marshal.Copy((IntPtr)(&header), this._buffer, _curOffset, sizeof(RecordHeader)); 126Marshal.Copy((IntPtr)pbRecord, this._buffer, _curOffset + sizeof(RecordHeader), cbRecordSize);
Graphics\include\wgx_render.cs (1)
797Exception exceptionForHR = Marshal.GetExceptionForHR(hr, (IntPtr)(-1));
Shared\MS\Internal\Ink\Native.cs (8)
22SizeOfInt = (uint)Marshal.SizeOf(typeof(int)); 23SizeOfUInt = (uint)Marshal.SizeOf(typeof(uint)); 24SizeOfUShort = (uint)Marshal.SizeOf(typeof(ushort)); 25SizeOfByte = (uint)Marshal.SizeOf(typeof(byte)); 26SizeOfFloat = (uint)Marshal.SizeOf(typeof(float)); 27SizeOfDouble = (uint)Marshal.SizeOf(typeof(double)); 28SizeOfGuid = (uint)Marshal.SizeOf(typeof(Guid)); 29SizeOfDecimal = (uint)Marshal.SizeOf(typeof(decimal));
Shared\MS\Internal\SafeSecurityHelper.cs (1)
72int win32Err = Marshal.GetLastWin32Error();
Shared\MS\Internal\SecurityHelper.cs (4)
926return Marshal.GetExceptionForHR(hr, new IntPtr(-1)); 940Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); 961int hr = Marshal.GetHRForException(exception); 965Marshal.GetHRForException(new Exception());
Shared\MS\Win32\WinInet.cs (3)
34UInt32 size = (UInt32)Marshal.SizeOf(icci); 44int hr = Marshal.GetHRForLastWin32Error(); 48Marshal.ThrowExceptionForHR(hr);
PresentationFramework (221)
src\Framework\Microsoft\Win32\FileDialog.cs (5)
797Marshal.FreeCoTaskMem(ofn.lpstrFile); 811Marshal.StructureToPtr(ofn, notify.lpOFN, true); 812Marshal.StructureToPtr(notify, lParam, true); 1008ofn.lStructSize = Marshal.SizeOf(typeof(NativeMethods.OPENFILENAME_I)); 1109Marshal.FreeCoTaskMem(ofn.lpstrFile);
src\Framework\MS\Internal\AppModel\ApplicationProxyInternal.cs (6)
219IntPtr pObj = Marshal.GetIUnknownForObject(initData.HostBrowser); 220try { initData.HostBrowser = (IHostBrowser)Marshal.GetObjectForIUnknown(pObj); } 221finally { Marshal.Release(pObj); } 952Marshal.ReleaseComObject(_unmanagedStream.Value); 963Marshal.ReleaseComObject(browserCallback); 1110_unmanagedStream = new SecurityCriticalData<object>(Marshal.GetObjectForIUnknown((IntPtr)value));
src\Framework\MS\Internal\AppModel\AppSecurityManager.cs (2)
205sei.cbSize = Marshal.SizeOf(sei); 461Marshal.SizeOf( typeof (int) ),
src\Framework\MS\Internal\AppModel\IconHelper.cs (1)
276Marshal.Copy(colorArray, 0, bits, colorArray.Length);
src\Framework\MS\Internal\AppModel\OleCmdHelper.cs (4)
80Marshal.ThrowExceptionForHR(NativeMethods.E_FAIL); 90Marshal.ThrowExceptionForHR(OleCmdHelper.OLECMDERR_E_UNKNOWNGROUP); 137Marshal.ThrowExceptionForHR(NativeMethods.E_FAIL); 148Marshal.ThrowExceptionForHR(hresult);
src\Framework\MS\Internal\Controls\ActiveXSite.cs (1)
297lpFrameInfo.cb = (uint)Marshal.SizeOf(typeof(NativeMethods.OLEINPLACEFRAMEINFO));
src\Framework\MS\Internal\Controls\ConnectionPointCookie.cs (4)
64else if (sink == null || !eventInterface.IsInstanceOfType(sink) && !Marshal.IsComObject(sink)) 74Marshal.FinalReleaseComObject(connectionPoint); 90Marshal.FinalReleaseComObject(connectionPoint); 141System.Runtime.InteropServices.Marshal.FinalReleaseComObject(connectionPoint);
src\Framework\MS\Internal\Controls\EnumUnknown.cs (4)
55Marshal.WriteInt32(pceltFetched, 0, 0); 73Marshal.WriteIntPtr(rgelt, Marshal.GetIUnknownForObject(this.arr[this.loc])); 81Marshal.WriteInt32(pceltFetched, 0, fetched);
src\Framework\MS\Internal\IO\Packaging\indexingfiltermarshaler.cs (9)
127Marshal.Copy(s.ToCharArray(), 0, p, s.Length); 130Marshal.WriteInt16(p, s.Length * _int16Size, 0); 152native.union.name = Marshal.StringToCoTaskMemUni(propSpec.PropName); 225pszVal = Marshal.StringToCoTaskMemAnsi((string)obj); 246pNative = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(PROPVARIANT))); 251Marshal.StructureToPtr(v, pNative, false); 257Marshal.FreeCoTaskMem(pszVal); 262Marshal.FreeCoTaskMem(pNative);
src\Framework\MS\Internal\IO\Packaging\ManagedFilter.cs (1)
146PropName = Marshal.PtrToStringUni(propSpec.union.name);
src\Framework\MS\Internal\IO\Packaging\managedIStream.cs (3)
62Marshal.WriteInt32(bytesReadPtr, bytesRead); 105Marshal.WriteInt64(newPositionPtr, position); 172Marshal.WriteInt32(bytesWrittenPtr, bufferSize);
src\Framework\MS\Internal\IO\Packaging\XpsFilter.cs (4)
142Marshal.WriteInt16(pBuffer, 0); 197short shCharacter = Marshal.ReadInt16(pBuffer); 216shCharacter = Marshal.ReadInt16(pBuffer, _int16Size); 274Marshal.WriteInt16(pBuffer, (int)bufCharacterCount * _int16Size, 0);
src\Framework\MS\Internal\Printing\NativeMethods.cs (2)
28public int lStructSize = Marshal.SizeOf(typeof(PRINTDLGEX32)); 54public int lStructSize = Marshal.SizeOf(typeof(PRINTDLGEX64));
src\Framework\MS\Internal\Printing\PrintDlgExMarshaler.cs (38)
276NativeMethods.PRINTDLGEX32 pdex = (NativeMethods.PRINTDLGEX32)Marshal.PtrToStructure( 286NativeMethods.PRINTDLGEX64 pdex = (NativeMethods.PRINTDLGEX64)Marshal.PtrToStructure( 302NativeMethods.PRINTPAGERANGE pageRangeStruct = (NativeMethods.PRINTPAGERANGE)Marshal.PtrToStructure( 323NativeMethods.DEVNAMES devNames = (NativeMethods.DEVNAMES)Marshal.PtrToStructure( 326int devNamesOffset = checked(devNames.wDeviceOffset * Marshal.SystemDefaultCharSize); 327printerName = Marshal.PtrToStringAuto(pDevNames + devNamesOffset); 440NativeMethods.DEVMODE devMode = (NativeMethods.DEVMODE)Marshal.PtrToStructure( 444Marshal.Copy(pDevMode, devModeData, 0, devModeData.Length); 500NativeMethods.PRINTDLGEX32 pdex = (NativeMethods.PRINTDLGEX32)Marshal.PtrToStructure( 507NativeMethods.PRINTDLGEX64 pdex = (NativeMethods.PRINTDLGEX64)Marshal.PtrToStructure( 582pdex.lpPageRanges = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE))); 588Marshal.StructureToPtr(range, pdex.lpPageRanges, false); 621int cbBufferSize = Marshal.SizeOf(typeof(NativeMethods.PRINTDLGEX32)); 622unmanagedBuffer = Marshal.AllocHGlobal(cbBufferSize); 623Marshal.StructureToPtr(pdex, unmanagedBuffer, false); 659pdex.lpPageRanges = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE))); 665Marshal.StructureToPtr(range, pdex.lpPageRanges, false); 698int cbBufferSize = Marshal.SizeOf(typeof(NativeMethods.PRINTDLGEX64)); 699unmanagedBuffer = Marshal.AllocHGlobal(cbBufferSize); 700Marshal.StructureToPtr(pdex, unmanagedBuffer, false); 749NativeMethods.PRINTDLGEX32 pdex = (NativeMethods.PRINTDLGEX32)Marshal.PtrToStructure( 758NativeMethods.PRINTDLGEX64 pdex = (NativeMethods.PRINTDLGEX64)Marshal.PtrToStructure( 781Marshal.FreeHGlobal(unmanagedBuffer); 798return Marshal.SizeOf(temp) == 8; 830int cbDevNames = checked(((printer.Length + 3) * Marshal.SystemDefaultCharSize) + 831Marshal.SizeOf(typeof(NativeMethods.DEVNAMES))); 832hDevNames = Marshal.AllocHGlobal(cbDevNames); 834ushort baseOffset = (ushort)Marshal.SizeOf(typeof(NativeMethods.DEVNAMES)); 844devNames.wDeviceOffset = (ushort)(baseOffset / Marshal.SystemDefaultCharSize); 848Marshal.StructureToPtr(devNames, hDevNames, false); 858checked((IntPtr)((long)offsetName + (printer.Length * Marshal.SystemDefaultCharSize))); 868byte[] nulls = new byte[3 * Marshal.SystemDefaultCharSize]; 870Marshal.Copy( 875Marshal.Copy( 938IntPtr hDevMode = Marshal.AllocHGlobal(devModeData.Length); 939Marshal.Copy(devModeData, 0, hDevMode, devModeData.Length);
src\Framework\System\Windows\Controls\PasswordBox.cs (2)
181IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(securePassword); 192System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(ptr);
src\Framework\System\Windows\Controls\Primitives\Popup.cs (2)
2681monitorInfo.cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX)); 2795resultOfGetObject = UnsafeNativeMethods.GetObject(iconInfo.hbmMask.MakeHandleRef(null), Marshal.SizeOf(typeof(NativeMethods.BITMAP)), bm);
src\Framework\System\Windows\Controls\WebBrowser.cs (4)
603if (!System.Runtime.InteropServices.Marshal.IsTypeVisibleFromCom(t)) 1510Marshal.ThrowExceptionForHR(hr); 1541object webOC = Marshal.GetTypedObjectForIUnknown(pWebOC, typeof(UnsafeNativeMethods.IWebBrowser2)); 1542Marshal.Release(pWebOC);
src\Framework\System\windows\Documents\CaretElement.cs (4)
1021int win32Error = Marshal.GetLastWin32Error(); 1058int win32Error = Marshal.GetLastWin32Error(); 1118int win32Error = Marshal.GetLastWin32Error(); 1130win32Error = Marshal.GetLastWin32Error();
src\Framework\System\Windows\Documents\FrameworkTextComposition.cs (4)
191Marshal.ReleaseComObject(composition); 194Marshal.ReleaseComObject(context); 209Marshal.ReleaseComObject(context); 361Marshal.ReleaseComObject(enumCompositionView);
src\Framework\System\Windows\Documents\ImmComposition.cs (15)
520result = new char[size / Marshal.SizeOf(typeof(short))]; 537composition = new char[size / Marshal.SizeOf(typeof(short))]; 567attributes = new byte[size / Marshal.SizeOf(typeof(byte))]; 1493int requestSize = Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)) + (target.Length * Marshal.SizeOf(typeof(short))) + ((_maxSrounding + 1) * Marshal.SizeOf(typeof(short)) * 2); 1502NativeMethods.RECONVERTSTRING reconv = (NativeMethods.RECONVERTSTRING)Marshal.PtrToStructure(lParam, typeof(NativeMethods.RECONVERTSTRING)); 1507reconv.dwStrOffset = Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)); // in byte count 1509reconv.dwCompStrOffset = offsetStart * Marshal.SizeOf(typeof(short)); // in byte count 1511reconv.dwTargetStrOffset = offsetStart * Marshal.SizeOf(typeof(short)); // in byte count 1524Marshal.StructureToPtr(reconv, lParam, true); 1543p += Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)); 1544Marshal.Copy(surrounding.ToCharArray(), 0, new IntPtr((void*)p), surrounding.Length); 1674NativeMethods.RECONVERTSTRING reconv = (NativeMethods.RECONVERTSTRING)Marshal.PtrToStructure(lParam, typeof(NativeMethods.RECONVERTSTRING)); 1697start = MoveToNextCharPos(start, (reconv.dwCompStrOffset - _reconv.dwCompStrOffset) / Marshal.SizeOf(typeof(short)));
src\Framework\System\Windows\Documents\InputScopeAttribute.cs (15)
78ppinputscopes = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(Int32)) * count); 87Marshal.WriteInt32(ppinputscopes, offset, (Int32)((InputScopeName)_inputScope.Names[i]).NameValue); 88offset += Marshal.SizeOf(typeof(Int32)); 93ppinputscopes = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(Int32)) * 1); 94Marshal.WriteInt32(ppinputscopes, (Int32)InputScopeNameValue.Default); 111ppbstrPhrases = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(IntPtr))*count); 124pbstr = Marshal.StringToBSTR(((InputScopePhrase)_inputScope.PhraseList[i]).Name); 131Marshal.FreeBSTR(Marshal.ReadIntPtr(ppbstrPhrases, offset)); 132offset += Marshal.SizeOf(typeof(IntPtr)); 137Marshal.WriteIntPtr(ppbstrPhrases , offset, pbstr); 138offset += Marshal.SizeOf(typeof(IntPtr));
src\Framework\System\Windows\Documents\NLGSpellerInterop.cs (19)
69Marshal.ReleaseComObject(textContext); 91Marshal.ReleaseComObject(_textChunk); 136Marshal.ReleaseComObject(_textChunk); 192Marshal.ReleaseComObject(options); 198Marshal.ReleaseComObject(textContext); 218IntPtr inputArray = Marshal.AllocHGlobal(count * 2); 223Marshal.Copy(text, 0, inputArray, count); 282Marshal.ReleaseComObject(sentenceEnumerator); 287Marshal.FreeHGlobal(inputArray); 314Marshal.ReleaseComObject(lexicon); 318Marshal.ReleaseComObject(textContext); 399Marshal.ReleaseComObject(lexicon); 408Marshal.ReleaseComObject(textContext); 681suggestions.Add(Marshal.PtrToStringUni(variant.data1.Value)); 686Marshal.ReleaseComObject(variantEnumerator); 873Marshal.ReleaseComObject(_textSegment); 970Marshal.ReleaseComObject(sentence); 1134Marshal.ReleaseComObject(lexicon); 1138Marshal.ReleaseComObject(textContext);
src\Framework\System\windows\Documents\TextEditor.cs (1)
1598Marshal.ReleaseComObject(threadManager);
src\Framework\System\windows\Documents\TextEditorContextMenu.cs (2)
614Marshal.ReleaseComObject(candString); 696Marshal.ReleaseComObject(CandidateList);
src\Framework\System\Windows\Documents\TextFindEngine.cs (1)
599int win32Error = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
src\Framework\System\Windows\Documents\TextServicesDisplayAttributePropertyRanges.cs (6)
188Marshal.ReleaseComObject(attributeRanges[0]); 207Marshal.ReleaseComObject(attributeRangeEnumerator); 210Marshal.ReleaseComObject(displayAttributeProperty); 269Marshal.ReleaseComObject(catmgr); 293Marshal.ReleaseComObject(dai); 301Marshal.ReleaseComObject(dam);
src\Framework\System\Windows\Documents\TextServicesHost.cs (6)
178Marshal.ReleaseComObject(comp); 214Marshal.ReleaseComObject(comp); 304Marshal.ReleaseComObject(context); 316Marshal.ReleaseComObject(textstore.DocumentManager); 422Marshal.ReleaseComObject(context); 465Marshal.ReleaseComObject(_threadManager.Value);
src\Framework\System\Windows\Documents\TextServicesPropertyRanges.cs (5)
116Marshal.ReleaseComObject(outRangesProp[0]); 118Marshal.ReleaseComObject(rangesProp); 121Marshal.ReleaseComObject(outRanges[0]); 124Marshal.ReleaseComObject(ranges); 126Marshal.ReleaseComObject(prop);
src\Framework\System\Windows\Documents\TextStore.cs (17)
114Marshal.ReleaseComObject(_sink); 139Marshal.ReleaseComObject(_sink); 1326Marshal.ReleaseComObject(editRecord); 1670Marshal.ReleaseComObject(funcReconv); 1675Marshal.ReleaseComObject(range); 1697Marshal.ReleaseComObject(funcReconv); 1702Marshal.ReleaseComObject(range); 1756Marshal.ReleaseComObject(functionPrv); 1760Marshal.ReleaseComObject(funcReconv); 1764Marshal.ReleaseComObject(range); 1765Marshal.ReleaseComObject(context); 2700attrval.val.data1.Value = Marshal.GetIUnknownForObject(obj); 2715attrval.val.data1.Value = Marshal.StringToBSTR(familyName); 2845Marshal.ReleaseComObject(range); 2846Marshal.ReleaseComObject(view); 4098Marshal.ReleaseComObject(_range.Value); 4103Marshal.ReleaseComObject(_sink.Value);
src\Framework\System\Windows\Interop\ActiveXHost.cs (1)
679Marshal.FinalReleaseComObject(_axInstance);
src\Framework\System\Windows\Interop\BrowserInteropHelper.cs (2)
243Marshal.ReleaseComObject(HostBrowser); 249Marshal.ReleaseComObject(_hostHtmlDocumentServiceProvider.Value);
src\Framework\System\Windows\Interop\DocobjHost.cs (3)
311IntPtr punk = Marshal.GetIUnknownForObject(streamContainer); 313Marshal.Release(punk); 1045Marshal.ReleaseComObject(_browserCallbackServices);
src\Framework\System\Windows\Interop\DynamicScriptObject.cs (2)
427if (!Marshal.IsTypeVisibleFromCom(argType) && !argType.IsCOMObject && argType != typeof(DateTime)) 579if (result != null && Marshal.IsComObject(result))
src\Framework\System\Windows\Shell\WindowChromeWorker.cs (3)
696var rcClientArea = (RECT)Marshal.PtrToStructure(lParam, typeof(RECT)); 714Marshal.StructureToPtr(rcClientArea, lParam, false); 875var wp = (WINDOWPOS)Marshal.PtrToStructure(lParam, typeof(WINDOWPOS));
src\Framework\System\Windows\Standard\ErrorCodes.cs (1)
129return new Win32Error(Marshal.GetLastWin32Error());
src\Framework\System\Windows\Standard\MessageWindow.cs (2)
78cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), 201var createStruct = (CREATESTRUCT)Marshal.PtrToStructure(lParam, typeof(CREATESTRUCT));
src\Framework\System\Windows\Standard\NativeMethods.cs (10)
1993ncm.cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)); 2005ncm.cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) - sizeof(int); 2052public int cbSize = Marshal.SizeOf(typeof(MONITORINFO)); 2288public int length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); 2487var filterstruct = new CHANGEFILTERSTRUCT { cbSize = (uint)Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)) }; 2535IntPtr currArg = Marshal.ReadIntPtr(argv, i * Marshal.SizeOf(typeof(IntPtr))); 2536result[i] = Marshal.PtrToStringUni(currArg); 3639var hc = new HIGHCONTRAST { cbSize = Marshal.SizeOf(typeof(HIGHCONTRAST)) }; 3898var dti = new DWM_TIMING_INFO { cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO)) };
src\Framework\System\Windows\Standard\Utilities.cs (2)
248Assert.IsTrue(Marshal.IsComObject(t)); 249Marshal.ReleaseComObject(t);
src\Framework\System\Windows\SystemParameters.cs (1)
197highContrast.cbSize = Marshal.SizeOf(typeof(NativeMethods.HIGHCONTRAST_I));
src\Framework\System\Windows\Window.cs (6)
4083wp.length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT)); 5110Marshal.StructureToPtr(mmi, lParam, true); 5432placement.length = Marshal.SizeOf(placement); 6190wp.length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT)); 6285monitorInfo.cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX)); 7863monitorInfo.cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX));
src\Shared\MS\Internal\SecurityHelper.cs (1)
926return Marshal.GetExceptionForHR(hr, new IntPtr(-1));
SMDiagnostics (1)
System\ServiceModel\Diagnostics\SafeEventLogWriteHandle.cs (1)
30int error = Marshal.GetLastWin32Error();
SMSvcHost (3)
System\ServiceModel\Activation\ListenerAdapterBase.cs (3)
63listenerCallbacks.dwBytesInCallbackStructure = Marshal.SizeOf(listenerCallbacks); 109return Marshal.GetDelegateForFunctionPointer(funcPtr, typeof(TDelegate)); 128string bindingString = Marshal.PtrToStringUni((IntPtr)bindingsBufferPtr);
System (669)
compmod\microsoft\win32\NativeMethods.cs (3)
129cb = Marshal.SizeOf(this); 243secAttrs.nLength = Marshal.SizeOf(secAttrs); 1468cbSize = Marshal.SizeOf(this);
compmod\microsoft\win32\SystemEvents.cs (8)
126if (UnsafeNativeMethods.GetUserObjectInformation(new HandleRef(null, hwinsta), NativeMethods.UOI_FLAGS, flags, Marshal.SizeOf(flags), ref lengthNeeded)) { 412string defproc = (Marshal.SystemDefaultCharSize == 1 ? "DefWindowProcA" : "DefWindowProcW"); 463} while (atom == 0 && Marshal.GetLastWin32Error() == NativeMethods.ERROR_CLASS_ALREADY_EXISTS); 622if (lParam != IntPtr.Zero && Marshal.PtrToStringAuto(lParam).Equals("Policy")) { 625else if (lParam != IntPtr.Zero && Marshal.PtrToStringAuto(lParam).Equals("intl")) { 1445newString = Marshal.PtrToStringAuto(lParam); 1447newStringPtr = Marshal.StringToHGlobalAuto(newString); 1480Marshal.FreeHGlobal(lParam);
compmod\system\codedom\compiler\Executor.cs (3)
176si.cb = Marshal.SizeOf(si); 307throw new ExternalException(SR.GetString(SR.ExecCantGetRetCode, cmd), Marshal.GetLastWin32Error()); 320int err = Marshal.GetLastWin32Error();
compmod\system\codedom\compiler\TempFiles.cs (1)
228if (retryCount == 0 || Marshal.GetHRForException(e) != HR_ERROR_FILE_EXISTS)
compmod\system\componentmodel\LicenseManager.cs (4)
404licensecontext.SetSavedLicenseKey(type, Marshal.PtrToStringBSTR(bstrKey)); 446pbstrKey = Marshal.StringToBSTR(licenseKey); 522bstrKey = Marshal.StringToBSTR(key); 533this.savedLicenseContext.SetSavedLicenseKey(this.savedType, Marshal.PtrToStringBSTR(bstrKey));
compmod\system\componentmodel\ReferenceConverter.cs (1)
115if (!Marshal.IsComObject(value) && value is IComponent) {
compmod\system\componentmodel\Win32Exception.cs (4)
41public Win32Exception() : this(Marshal.GetLastWin32Error()) { 64public Win32Exception( string message ) : this(Marshal.GetLastWin32Error(), message) { 74nativeErrorCode = Marshal.GetLastWin32Error(); 110else if (Marshal.GetLastWin32Error() == SafeNativeMethods.ERROR_INSUFFICIENT_BUFFER) {
compmod\System\Runtime\InteropServices\StandardOleMarshalObject.cs (6)
43IntPtr pUnk = Marshal.GetIUnknownForObject(this); 56Marshal.Release(pUnk); 85GetMarshalSizeMax_Delegate del = (GetMarshalSizeMax_Delegate)Marshal.GetDelegateForFunctionPointer(method, typeof(GetMarshalSizeMax_Delegate)); 90Marshal.Release(pStandardMarshal); 108MarshalInterface_Delegate del = (MarshalInterface_Delegate)Marshal.GetDelegateForFunctionPointer(method, typeof(MarshalInterface_Delegate)); 113Marshal.Release(pStandardMarshal);
net\System\Net\_AutoWebProxyScriptHelper.cs (4)
643int cbRequiredBytes = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.SOCKET_ADDRESS_LIST)) + 644 (SockAddrIn6List.Length -1)*Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.SOCKET_ADDRESS)); 651 IntPtr pSocketAddressList = Marshal.AllocHGlobal(cbRequiredBytes); 702 Marshal.FreeHGlobal(pSocketAddressList);
net\System\Net\_DigestClient.cs (20)
1147private static int InitiatorTypeOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "dwInitiatorAddrType"); 1148private static int InitiatorLengthOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "cbInitiatorLength"); 1149private static int InitiatorOffsetOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "dwInitiatorOffset"); 1150private static int AcceptorTypeOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "dwAcceptorAddrType"); 1151private static int AcceptorLengthOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "cbAcceptorLength"); 1152private static int AcceptorOffsetOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "dwAcceptorOffset"); 1153private static int ApplicationDataLengthOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "cbApplicationDataLength"); 1154private static int ApplicationDataOffsetOffset = (int)Marshal.OffsetOf(typeof(SecChannelBindings), "dwApplicationDataOffset"); 1156private static int SizeOfInt = Marshal.SizeOf(typeof(int)); 1172int initiatorType = Marshal.ReadInt32(binding.DangerousGetHandle(), InitiatorTypeOffset); 1173int initiatorLength = Marshal.ReadInt32(binding.DangerousGetHandle(), InitiatorLengthOffset); 1174int acceptorType = Marshal.ReadInt32(binding.DangerousGetHandle(), AcceptorTypeOffset); 1175int acceptorLength = Marshal.ReadInt32(binding.DangerousGetHandle(), AcceptorLengthOffset); 1176int applicationDataLength = Marshal.ReadInt32(binding.DangerousGetHandle(), ApplicationDataLengthOffset); 1186int initiatorOffset = Marshal.ReadInt32(binding.DangerousGetHandle(), InitiatorOffsetOffset); 1187Marshal.Copy(IntPtrHelper.Add(binding.DangerousGetHandle(), initiatorOffset), formattedData, offset, initiatorLength); 1197int acceptorOffset = Marshal.ReadInt32(binding.DangerousGetHandle(), AcceptorOffsetOffset); 1198Marshal.Copy(IntPtrHelper.Add(binding.DangerousGetHandle(), acceptorOffset), formattedData, offset, acceptorLength); 1207int applicationDataOffset = Marshal.ReadInt32(binding.DangerousGetHandle(), ApplicationDataOffsetOffset); 1208Marshal.Copy(IntPtrHelper.Add(binding.DangerousGetHandle(), applicationDataOffset), formattedData, offset, applicationDataLength);
net\System\Net\_ListenerRequestStream.cs (1)
386m_pPinnedBuffer = (void*)(Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset));
net\System\Net\_ListenerResponseStream.cs (9)
171Marshal.WriteByte(pBufferAsIntPtr, i, (byte)chunkHeader[i]); 173Marshal.WriteInt16(pBufferAsIntPtr, chunkHeader.Length, 0x0A0D); 174Marshal.Copy(buffer, offset, IntPtrHelper.Add(pBufferAsIntPtr, chunkHeader.Length + 2), size); 175Marshal.WriteInt16(pBufferAsIntPtr, (int)(dataToWrite - 2), 0x0A0D); 503return (UnsafeNclNativeMethods.HttpApi.HTTP_DATA_CHUNK*)(Marshal.UnsafeAddrOfPinnedArrayElement(m_DataChunks, 0)); 567m_DataChunks[0].pBuffer = (byte*)(Marshal.UnsafeAddrOfPinnedArrayElement(chunkHeaderBuffer, chunkHeaderOffset)); 568m_DataChunks[1].pBuffer = (byte*)(Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset)); 569m_DataChunks[2].pBuffer = (byte*)(Marshal.UnsafeAddrOfPinnedArrayElement(NclConstants.CRLF, 0)); 573m_DataChunks[0].pBuffer = (byte*)(Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset));
net\System\Net\_OSSOCK.cs (2)
19internal static readonly int Size = Marshal.SizeOf(typeof(IPMulticastRequest)); 95internal static readonly int Size = Marshal.SizeOf(typeof(IPv6MulticastRequest));
net\System\Net\_RegBlobWebProxyDataBuilder.cs (1)
185intValue = Marshal.ReadInt32((IntPtr)pBuffer, m_ByteOffset);
net\System\Net\_SafeNetHandles.cs (31)
914IntPtr ptr = Marshal.AllocHGlobal(size); 921IntPtr ptr = Marshal.StringToHGlobalAnsi(str); 938criteriaArray = AllocBuffer(criteriaCount * Marshal.SizeOf(criteria)); 946paraArray = AllocBuffer(Marshal.SizeOf(oidString)); 947Marshal.WriteIntPtr(paraArray, oidString); 951Marshal.StructureToPtr(criteria, criteriaArray, false); 966IntPtr keyUsageCriteria = AllocBuffer(Marshal.SizeOf(CERT_DIGITAL_SIGNATURE_KEY_USAGE)); 967Marshal.WriteByte(keyUsageCriteria, CERT_DIGITAL_SIGNATURE_KEY_USAGE); 970IntPtr pCertExtension = AllocBuffer(Marshal.SizeOf(certExtension)); 972Marshal.StructureToPtr(certExtension, pCertExtension, false); 974paraArray = AllocBuffer(Marshal.SizeOf(pCertExtension)); 975Marshal.WriteIntPtr(paraArray, pCertExtension); 979Marshal.StructureToPtr(criteria, criteriaArray + Marshal.SizeOf(criteria), false); 993Marshal.FreeHGlobal(ptr); 1539inUnmanagedBuffer[index].token = Marshal.UnsafeAddrOfPinnedArrayElement(securityBuffer.token, securityBuffer.offset); 1558outUnmanagedBuffer[0].token = Marshal.UnsafeAddrOfPinnedArrayElement(outSecBuffer.token, outSecBuffer.offset); 1610Marshal.Copy(outUnmanagedBuffer[0].token, outSecBuffer.token, 0, outSecBuffer.size); 1864inUnmanagedBuffer[index].token = Marshal.UnsafeAddrOfPinnedArrayElement(securityBuffer.token, securityBuffer.offset); 1884outUnmanagedBuffer[0].token = Marshal.UnsafeAddrOfPinnedArrayElement(outSecBuffer.token, outSecBuffer.offset); 1928Marshal.Copy(outUnmanagedBuffer[0].token, outSecBuffer.token, 0, outSecBuffer.size); 2121inUnmanagedBuffer[index].token = Marshal.UnsafeAddrOfPinnedArrayElement(securityBuffer.token, securityBuffer.offset); 2237inUnmanagedBuffer[index].token = Marshal.UnsafeAddrOfPinnedArrayElement(securityBuffer.token, securityBuffer.offset); 2591if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error(); 2607if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error(); 2617GlobalLog.Print("SafeCloseSocket::ReleaseHandle(handle:" + handle.ToString("x") + ") WSAEventSelect():" + (errorCode == SocketError.SocketError ? (SocketError)Marshal.GetLastWin32Error() : errorCode).ToString()); 2624GlobalLog.Print("SafeCloseSocket::ReleaseHandle(handle:" + handle.ToString("x") + ") ioctlsocket#2():" + (errorCode == SocketError.SocketError ? (SocketError)Marshal.GetLastWin32Error() : errorCode).ToString()); 2635if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error(); 2662if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error(); 2676GlobalLog.Print("SafeCloseSocket::ReleaseHandle(handle:" + handle.ToString("x") + ") closesocket#3():" + (errorCode == SocketError.SocketError ? (SocketError)Marshal.GetLastWin32Error() : errorCode).ToString()); 3003error = (_WinInetCache.Status)Marshal.GetLastWin32Error();
net\System\Net\_SecureChannel.cs (2)
165_CERT_CONTEXT context = (_CERT_CONTEXT)Marshal.PtrToStructure(certContext.DangerousGetHandle(), typeof(_CERT_CONTEXT)); 1266throw new CryptographicException(Marshal.GetLastWin32Error());
net\System\Net\_SSPIWrapper.cs (51)
332int alertTokenByteSize = Marshal.SizeOf(typeof(Interop.SChannel.SCHANNEL_ALERT_TOKEN)); 333IntPtr p = Marshal.AllocHGlobal(alertTokenByteSize); 338Marshal.StructureToPtr(alertToken, p, false); 339Marshal.Copy(p, buffer, 0, alertTokenByteSize); 346Marshal.FreeHGlobal(p); 403unmanagedBuffer[i].token = Marshal.UnsafeAddrOfPinnedArrayElement(iBuffer.token, iBuffer.offset); 454byte* bufferAddress = (byte*) Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j], 0); 543nativeBlockSize = Marshal.SizeOf(typeof(NegotiationInfo)); 559nativeBlockSize = Marshal.SizeOf(typeof(IssuerListInfoEx)); 564nativeBlockSize = Marshal.SizeOf(typeof(SslConnectionInfo)); 592attribute = Marshal.PtrToStringUni(SspiHandle.DangerousGetHandle()); 602attribute = new NegotiationInfoClass(SspiHandle, Marshal.ReadInt32(new IntPtr(ptr), NegotiationInfo.NegotiationStateOffest)); 608attribute = Marshal.PtrToStringUni(SspiHandle.DangerousGetHandle()); 726header = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress)); 727trailer = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 4)); 728maximumMessage = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 8)); 729buffersCount = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 12)); 730blockSize = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 16)); 739public static readonly int SizeOf = Marshal.SizeOf(typeof(StreamSizes)); 755MaxToken = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress)); 756MaxSignature = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 4)); 757BlockSize = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 8)); 758SecurityTrailer = (int) checked((uint) Marshal.ReadInt32(unmanagedAddress, 12)); 767public static readonly int SizeOf = Marshal.SizeOf(typeof(SecSizes)); 850Protocol = Marshal.ReadInt32(unmanagedAddress); 851DataCipherAlg = Marshal.ReadInt32(unmanagedAddress, 4); 852DataKeySize = Marshal.ReadInt32(unmanagedAddress, 8); 853DataHashAlg = Marshal.ReadInt32(unmanagedAddress, 12); 854DataHashKeySize = Marshal.ReadInt32(unmanagedAddress, 16); 855KeyExchangeAlg = Marshal.ReadInt32(unmanagedAddress, 20); 856KeyExchKeySize = Marshal.ReadInt32(unmanagedAddress, 24); 868internal static readonly int Size = Marshal.SizeOf(typeof(NegotiationInfo)); 869internal static readonly int NegotiationStateOffest = (int)Marshal.OffsetOf(typeof(NegotiationInfo), "NegotiationState"); 896IntPtr unmanagedString = Marshal.ReadIntPtr(packageInfo, SecurityPackageInfo.NameOffest); 899name = Marshal.PtrToStringUni(unmanagedString); 930internal static readonly int Size = Marshal.SizeOf(typeof(SecurityPackageInfo)); 931internal static readonly int NameOffest = (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "Name"); 954Capabilities = Marshal.ReadInt32(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo),"Capabilities")); 955Version = Marshal.ReadInt16(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo),"Version")); 956RPCID = Marshal.ReadInt16(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo),"RPCID")); 957MaxToken = Marshal.ReadInt32(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo),"MaxToken")); 961unmanagedString = Marshal.ReadIntPtr(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo),"Name")); 963Name = Marshal.PtrToStringUni(unmanagedString); 967unmanagedString = Marshal.ReadIntPtr(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo),"Comment")); 969Comment = Marshal.PtrToStringUni(unmanagedString);
net\System\Net\_WinHttpWebProxyDataBuilder.cs (7)
28proxy = Marshal.PtrToStringUni(ieProxyConfig.Proxy); 29proxyByPass = Marshal.PtrToStringUni(ieProxyConfig.ProxyBypass); 30autoConfigUrl = Marshal.PtrToStringUni(ieProxyConfig.AutoConfigUrl); 48int errorCode = Marshal.GetLastWin32Error(); 61Marshal.FreeHGlobal(ieProxyConfig.Proxy); 62Marshal.FreeHGlobal(ieProxyConfig.ProxyBypass); 63Marshal.FreeHGlobal(ieProxyConfig.AutoConfigUrl);
net\System\Net\Cache\WinInetCache.cs (7)
151public static int MarshalSize = Marshal.SizeOf(typeof(EntryBuffer)); 245entry.Error = (Status)Marshal.GetLastWin32Error(); 344entry.Error = (Status) Marshal.GetLastWin32Error(); 380entry.Error = (Status)Marshal.GetLastWin32Error(); 407newEntry.Error = (Status)Marshal.GetLastWin32Error(); 505entry.Error = (Status)Marshal.GetLastWin32Error(); 529return Marshal.PtrToStringUni(pointer);
net\System\Net\DNS.cs (10)
68hostent Host = (hostent)Marshal.PtrToStructure(nativePointer, typeof(hostent)); 72HostEntry.HostName = Marshal.PtrToStringAnsi(Host.h_name); 91nativePointer = Marshal.ReadIntPtr(currentArrayElement); 98IPAddressToAdd = Marshal.ReadInt32(nativePointer); 120nativePointer = Marshal.ReadIntPtr(currentArrayElement); 133nativePointer = Marshal.ReadIntPtr(currentArrayElement); 143AliasToAdd = Marshal.PtrToStringAnsi(nativePointer); 154nativePointer = Marshal.ReadIntPtr(currentArrayElement); 415Marshal.SizeOf(typeof(int)), 1133canonicalname = Marshal.PtrToStringUni((IntPtr)pAddressInfo->ai_canonname);
net\System\Net\HttpListener.cs (15)
184return (UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST*) Marshal.UnsafeAddrOfPinnedArrayElement(RequestBuffer, 0); 252return (UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST*) Marshal.UnsafeAddrOfPinnedArrayElement(RequestBuffer, 0); 286Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_REQUEST_CHANNEL_BIND_STATUS)); 544infoptr, (uint)Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO))); 929infoptr, (uint)Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO))); 950infoptr, (uint)Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO))); 1006throw new HttpListenerException(Marshal.GetLastWin32Error()); 2362httpResponse.Headers.pUnknownHeaders = (UnsafeNclNativeMethods.HttpApi.HTTP_UNKNOWN_HEADER*) Marshal.UnsafeAddrOfPinnedArrayElement(headersArray, 0); 2364sbyte* wwwAuthenticate = (sbyte*) Marshal.UnsafeAddrOfPinnedArrayElement(s_WwwAuthenticateBytes, 0); 2372headersArray[i].pRawValue = (sbyte*) Marshal.UnsafeAddrOfPinnedArrayElement(byteChallenge, 0); 2425IntPtr tokenPointer = Marshal.ReadIntPtr((IntPtr)blob, (int)Marshal.OffsetOf(ChannelBindingStatusType, "ChannelToken")); 2434return Marshal.ReadInt32(blob, (int)Marshal.OffsetOf(ChannelBindingStatusType, "ChannelTokenSize")); 2482Marshal.Copy(blob, tokenOffset, token.DangerousGetHandle(), tokenSize);
net\System\Net\HttpListenerException.cs (1)
17public HttpListenerException() : base(Marshal.GetLastWin32Error())
net\System\Net\HttpListenerRequest.cs (9)
87m_MemoryBlob = (UnsafeNclNativeMethods.HttpApi.HTTP_SSL_CLIENT_CERT_INFO*) Marshal.UnsafeAddrOfPinnedArrayElement(m_BackingBuffer, 0); 143Marshal.Copy((IntPtr)pClientCertInfo->pCertEncoded, certEncoded, 0, certEncoded.Length); 265m_RawUrl = Marshal.PtrToStringAnsi((IntPtr) memoryBlob.RequestBlob->pRawUrl, memoryBlob.RequestBlob->RawUrlLength); 270m_CookedUrlHost = Marshal.PtrToStringUni((IntPtr)cookedUrl.pHost, cookedUrl.HostLength / 2); 273m_CookedUrlPath = Marshal.PtrToStringUni((IntPtr)cookedUrl.pAbsPath, cookedUrl.AbsPathLength / 2); 276m_CookedUrlQuery = Marshal.PtrToStringUni((IntPtr)cookedUrl.pQueryString, cookedUrl.QueryStringLength / 2); 958Marshal.Copy((IntPtr)pClientCertInfo->pCertEncoded, certEncoded, 0, certEncoded.Length); 1154Marshal.Copy((IntPtr)(pThisResultData->identifierData), retVal, 0, retVal.Length); 1187Marshal.Copy((IntPtr)(&pThisResultData->identifierData->hashAlgorithm), retVal, 0, retVal.Length);
net\System\Net\Internal.cs (5)
230IpAdapterAddresses adapterAddresses = (IpAdapterAddresses)Marshal.PtrToStructure( 1206public static readonly uint StructSize = (uint) Marshal.SizeOf(typeof(ChainPolicyParameter)); 1232static readonly uint StructSize = (uint) Marshal.SizeOf(typeof(SSL_EXTRA_CERT_CHAIN_POLICY_PARA)); 1243public static readonly uint StructSize = (uint) Marshal.SizeOf(typeof(ChainPolicyStatus)); 1280public static readonly uint StructSize = (uint) Marshal.SizeOf(typeof(ChainParameters));
net\System\Net\Logging.cs (1)
572Marshal.Copy(bufferPtr, buffer, 0, length);
net\System\Net\mail\iisPickupDirectory.cs (3)
390serverState = Marshal.ReadInt32((IntPtr)bufferPtr); 406pickupDirectory = Marshal.PtrToStringUni((IntPtr)bufferPtr); 440pickupDirectory = Marshal.PtrToStringUni((IntPtr)bufferPtr);
net\System\Net\NetworkInformation\NetworkInformationException.cs (1)
26public NetworkInformationException() : base(Marshal.GetLastWin32Error()) {
net\System\Net\NetworkInformation\ping.cs (5)
230Icmp6EchoReply icmp6Reply = (Icmp6EchoReply)Marshal.PtrToStructure (buffer.DangerousGetHandle (), typeof(Icmp6EchoReply)); 234IcmpEchoReply icmpReply = (IcmpEchoReply)Marshal.PtrToStructure (buffer.DangerousGetHandle (), typeof(IcmpEchoReply)); 701error = (int)Marshal.GetLastWin32Error(); 728Icmp6EchoReply icmp6Reply = (Icmp6EchoReply)Marshal.PtrToStructure(replyBuffer.DangerousGetHandle(), typeof(Icmp6EchoReply)); 732IcmpEchoReply icmpReply = (IcmpEchoReply)Marshal.PtrToStructure(replyBuffer.DangerousGetHandle(), typeof(IcmpEchoReply));
net\System\Net\NetworkInformation\PingReply.cs (2)
50Marshal.Copy (reply.data, buffer, 0, reply.dataSize); 68Marshal.Copy (IntPtrHelper.Add(dataPtr, 36), buffer, 0, sendSize);
net\System\Net\NetworkInformation\SystemIPGlobalProperties.cs (17)
39fixedInfo = new FixedInfo( (FIXED_INFO)Marshal.PtrToStructure(buffer.DangerousGetHandle(),typeof(FIXED_INFO))); 172MibTcpTable tcpTableInfo = (MibTcpTable)Marshal.PtrToStructure(newPtr, typeof(MibTcpTable)); 176newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(tcpTableInfo.numberOfEntries)); 179MibTcpRow tcpRow = (MibTcpRow)Marshal.PtrToStructure(newPtr, typeof(MibTcpRow)); 183newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(tcpRow)); 221= (MibTcp6TableOwnerPid)Marshal.PtrToStructure(newPtr, typeof(MibTcp6TableOwnerPid)); 225newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(tcpTable6OwnerPid.numberOfEntries)); 229= (MibTcp6RowOwnerPid)Marshal.PtrToStructure(newPtr, 234newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(tcp6RowOwnerPid)); 277MibUdpTable udpTableInfo = (MibUdpTable)Marshal.PtrToStructure(newPtr, typeof(MibUdpTable)); 281newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(udpTableInfo.numberOfEntries)); 283MibUdpRow udpRow = (MibUdpRow)Marshal.PtrToStructure(newPtr, typeof(MibUdpRow)); 289newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(udpRow)); 324= (MibUdp6TableOwnerPid)Marshal.PtrToStructure(newPtr, typeof(MibUdp6TableOwnerPid)); 328newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(udp6TableOwnerPid.numberOfEntries)); 331= (MibUdp6RowOwnerPid)Marshal.PtrToStructure(newPtr, 339newPtr = (IntPtr)((long)newPtr + Marshal.SizeOf(udp6RowOwnerPid));
net\System\Net\NetworkInformation\SystemIPv4InterfaceProperties.cs (1)
90IpPerAdapterInfo ipPerAdapterInfo = (IpPerAdapterInfo)Marshal.PtrToStructure(buffer.DangerousGetHandle(),typeof(IpPerAdapterInfo));
net\System\Net\NetworkInformation\SystemNetworkInterface.cs (1)
106(IpAdapterAddresses)Marshal.PtrToStructure(ptr, typeof(IpAdapterAddresses));
net\System\Net\NetworkInformation\SystemUnicastIPAddressInformation.cs (1)
139(IpAdapterUnicastAddress)Marshal.PtrToStructure(ptr, typeof(IpAdapterUnicastAddress));
net\System\Net\NetworkInformation\UnSafeNetInfoNativemethods.cs (3)
120Marshal.Copy(address, sockAddress.m_Buffer, 0, addressLength); 143(IpAdapterAddress)Marshal.PtrToStructure(ptr, typeof(IpAdapterAddress)); 157(IpAdapterAddress)Marshal.PtrToStructure(ptr, typeof(IpAdapterAddress));
net\System\Net\SocketException.cs (2)
29public SocketException() : base(Marshal.GetLastWin32Error()) { 33internal SocketException(EndPoint endPoint) : base(Marshal.GetLastWin32Error()) {
net\System\Net\Sockets\_AcceptOverlappedAsyncResult.cs (5)
69Marshal.UnsafeAddrOfPinnedArrayElement(m_Buffer, 0), 78Marshal.Copy(remoteAddr, remoteSocketAddress.m_Buffer, 0, remoteSocketAddress.m_Size); 87Marshal.SizeOf(handle)); 89if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error(); 140IntPtr pinnedBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_Buffer, 0);
net\System\Net\Sockets\_BaseOverlappedAsyncResult.cs (4)
179Marshal.WriteIntPtr( m_UnmanagedBlob.DangerousGetHandle(), Win32.OverlappedhEventOffset, m_OverlappedEvent.SafeWaitHandle.DangerousGetHandle() ); 369socketError = (SocketError)Marshal.GetLastWin32Error(); 419uint errorCode = (uint)Marshal.ReadInt32(IntPtrHelper.Add(asyncResult.m_UnmanagedBlob.DangerousGetHandle(), 421uint numBytes = errorCode!=0 ? unchecked((uint)-1) : (uint)Marshal.ReadInt32(IntPtrHelper.Add(asyncResult.m_UnmanagedBlob.DangerousGetHandle(),
net\System\Net\Sockets\_ConnectOverlappedAsyncResult.cs (1)
47if (errorCode == SocketError.SocketError) errorCode = (SocketError) Marshal.GetLastWin32Error();
net\System\Net\Sockets\_DynamicWinsockMethods.cs (8)
149acceptEx = (AcceptExDelegate)Marshal.GetDelegateForFunctionPointer(ptrAcceptEx, typeof(AcceptExDelegate)); 165getAcceptExSockaddrs = (GetAcceptExSockaddrsDelegate)Marshal.GetDelegateForFunctionPointer(ptrGetAcceptExSockaddrs, 182connectEx = (ConnectExDelegate)Marshal.GetDelegateForFunctionPointer(ptrConnectEx, typeof(ConnectExDelegate)); 198disconnectEx = (DisconnectExDelegate)Marshal.GetDelegateForFunctionPointer(ptrDisconnectEx, typeof(DisconnectExDelegate)); 199disconnectEx_Blocking = (DisconnectExDelegate_Blocking)Marshal.GetDelegateForFunctionPointer(ptrDisconnectEx, 216recvMsg = (WSARecvMsgDelegate)Marshal.GetDelegateForFunctionPointer(ptrWSARecvMsg, typeof(WSARecvMsgDelegate)); 217recvMsg_Blocking = (WSARecvMsgDelegate_Blocking)Marshal.GetDelegateForFunctionPointer(ptrWSARecvMsg, 234transmitPackets = (TransmitPacketsDelegate)Marshal.GetDelegateForFunctionPointer(ptrTransmitPackets,
net\System\Net\Sockets\_OverlappedAsyncResult.cs (5)
48return Marshal.UnsafeAddrOfPinnedArrayElement(m_SocketAddress.m_Buffer, 0); 53return Marshal.UnsafeAddrOfPinnedArrayElement(m_SocketAddress.m_Buffer, m_SocketAddress.GetAddressSizeOffset()); 100m_SingleBuffer.Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset); 127m_WSABuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffers[i].Buffer, buffers[i].Offset); 164m_WSABuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffersCopy[i].Array, buffersCopy[i].Offset);
net\System\Net\Sockets\_ReceiveMessageOverlappedAsyncResult.cs (13)
33private static readonly int s_ControlDataSize = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.ControlData)); 34private static readonly int s_ControlDataIPv6Size = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6)); 35private static readonly int s_WSABufferSize=Marshal.SizeOf(typeof(WSABuffer)); 36private static readonly int s_WSAMsgSize = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.WSAMsg)); 55return Marshal.UnsafeAddrOfPinnedArrayElement(m_SocketAddress.m_Buffer, m_SocketAddress.GetAddressSizeOffset()); 111m_WSABuffer = (WSABuffer*) Marshal.UnsafeAddrOfPinnedArrayElement(m_WSABufferArray, 0); 113m_WSABuffer->Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset); 117m_Message = (UnsafeNclNativeMethods.OSSOCK.WSAMsg*) Marshal.UnsafeAddrOfPinnedArrayElement(m_MessageBuffer, 0); 118m_Message->socketAddress = Marshal.UnsafeAddrOfPinnedArrayElement(m_SocketAddress.m_Buffer,0); 120m_Message->buffers = Marshal.UnsafeAddrOfPinnedArrayElement(m_WSABufferArray,0); 124m_Message->controlBuffer.Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(m_ControlBuffer, 0); 143UnsafeNclNativeMethods.OSSOCK.ControlData controlData = (UnsafeNclNativeMethods.OSSOCK.ControlData)Marshal.PtrToStructure(m_Message->controlBuffer.Pointer, typeof(UnsafeNclNativeMethods.OSSOCK.ControlData)); 152UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6 controlData = (UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6)Marshal.PtrToStructure(m_Message->controlBuffer.Pointer, typeof(UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6));
net\System\Net\Sockets\_TransmitFileOverlappedAsyncResult.cs (2)
99m_buffers.preBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(preBuffer, 0); 104m_buffers.postBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(postBuffer, 0);
net\System\Net\Sockets\Socket.cs (72)
114private readonly static int protocolInformationSize = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO)); 185UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO protocolInfo = (UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO)Marshal.PtrToStructure((IntPtr)pinnedBuffer, typeof(UnsafeNclNativeMethods.OSSOCK.WSAPROTOCOL_INFO)); 1339WSABuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffer.Array, buffer.Offset); 1353errorCode = (SocketError)Marshal.GetLastWin32Error(); 1461errorCode = (SocketError) Marshal.GetLastWin32Error(); 1565errorCode = (SocketError)Marshal.GetLastWin32Error(); 1788errorCode = (SocketError)Marshal.GetLastWin32Error(); 1875WSABuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffer.Array, buffer.Offset); 1889errorCode = (SocketError)Marshal.GetLastWin32Error(); 2006Marshal.UnsafeAddrOfPinnedArrayElement(asyncResult.m_MessageBuffer,0), 2011errorCode = (SocketError)Marshal.GetLastWin32Error(); 2894errorCode = (SocketError)Marshal.GetLastWin32Error(); 3029errorCode = (SocketError) Marshal.GetLastWin32Error(); 3236errorCode = (SocketError)Marshal.GetLastWin32Error(); 3286errorCode = (SocketError)Marshal.GetLastWin32Error(); 3533errorCode = (SocketError)Marshal.GetLastWin32Error(); 3649errorCode = (SocketError)Marshal.GetLastWin32Error(); 3767errorCode = (SocketError)Marshal.GetLastWin32Error(); 4039errorCode = (SocketError)Marshal.GetLastWin32Error(); 4279errorCode = (SocketError)Marshal.GetLastWin32Error(); 4395errorCode = (SocketError)Marshal.GetLastWin32Error(); 4592Marshal.UnsafeAddrOfPinnedArrayElement(asyncResult.m_MessageBuffer,0), 4598errorCode = (SocketError)Marshal.GetLastWin32Error(); 4859errorCode = (SocketError)Marshal.GetLastWin32Error(); 5095errorCode = acceptedSocketHandle.IsInvalid ? (SocketError) Marshal.GetLastWin32Error() : SocketError.Success; 5250errorCode = acceptedSocket.IsInvalid ? (SocketError) Marshal.GetLastWin32Error() : SocketError.Success; 5421Marshal.UnsafeAddrOfPinnedArrayElement(asyncResult.Buffer, 0), 5428errorCode = (SocketError)Marshal.GetLastWin32Error(); 5645errorCode = errorCode!=SocketError.SocketError ? SocketError.Success : (SocketError)Marshal.GetLastWin32Error(); 6002errorCode = (SocketError) Marshal.GetLastWin32Error(); 6018errorCode = (SocketError) Marshal.GetLastWin32Error(); 6316GlobalLog.Print("SafeCloseSocket::Dispose(handle:" + m_Handle.DangerousGetHandle().ToString("x") + ") ioctlsocket(FIONBIO):" + (errorCode == SocketError.SocketError ? (SocketError) Marshal.GetLastWin32Error() : errorCode).ToString()); 6329GlobalLog.Print("SafeCloseSocket::Dispose(handle:" + m_Handle.DangerousGetHandle().ToString("x") + ") shutdown():" + (errorCode == SocketError.SocketError ? (SocketError) Marshal.GetLastWin32Error() : errorCode).ToString()); 6338GlobalLog.Print("SafeCloseSocket::Dispose(handle:" + m_Handle.DangerousGetHandle().ToString("x") + ") setsockopt():" + (errorCode == SocketError.SocketError ? (SocketError) Marshal.GetLastWin32Error() : errorCode).ToString()); 6365GlobalLog.Print("SafeCloseSocket::Dispose(handle:" + m_Handle.DangerousGetHandle().ToString("x") + ") ioctlsocket(FIONREAD):" + (errorCode == SocketError.SocketError ? (SocketError) Marshal.GetLastWin32Error() : errorCode).ToString()); 6784errorCode = (SocketError) Marshal.GetLastWin32Error(); 6924Marshal.UnsafeAddrOfPinnedArrayElement(socketAddress.m_Buffer, 0), 6931errorCode = (SocketError)Marshal.GetLastWin32Error(); 7001WSABuffers[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffers[i].Buffer, buffers[i].Offset); 7245errorCode = (SocketError)Marshal.GetLastWin32Error(); 7735socketError = (SocketError)Marshal.GetLastWin32Error(); 7844socketError = (SocketError)Marshal.GetLastWin32Error(); 7944socketError = (SocketError)Marshal.GetLastWin32Error(); 8023socketError = (SocketError)Marshal.GetLastWin32Error(); 8115socketError = (SocketError)Marshal.GetLastWin32Error(); 8192socketError = (SocketError)Marshal.GetLastWin32Error(); 8265socketError = (SocketError)Marshal.GetLastWin32Error(); 8326socketError = (SocketError)Marshal.GetLastWin32Error(); 8421socketError = (SocketError)Marshal.GetLastWin32Error(); 8581internal static readonly int s_ControlDataSize = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.ControlData)); 8582internal static readonly int s_ControlDataIPv6Size = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6)); 8583internal static readonly int s_WSAMsgSize = Marshal.SizeOf(typeof(UnsafeNclNativeMethods.OSSOCK.WSAMsg)); 9185m_PtrWSAMessageBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_WSAMessageBuffer, 0); 9208m_PtrControlBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_ControlBuffer, 0); 9219m_PtrWSARecvMsgWSABufferArray = Marshal.UnsafeAddrOfPinnedArrayElement(m_WSARecvMsgWSABufferArray, 0); 9223m_PtrWSARecvMsgWSABufferArray = Marshal.UnsafeAddrOfPinnedArrayElement(m_WSABufferArray, 0); 9388m_PtrSingleBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_Buffer, m_Offset); 9465m_PtrSocketAddressBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_SocketAddress.m_Buffer, 0); 9466m_PtrSocketAddressBufferSize = Marshal.UnsafeAddrOfPinnedArrayElement(m_SocketAddress.m_Buffer, m_SocketAddress.GetAddressSizeOffset()); 9523m_PtrSingleBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_Buffer, m_Offset); 9552m_PtrAcceptBuffer = Marshal.UnsafeAddrOfPinnedArrayElement(m_AcceptBuffer, 0); 9603m_WSABufferArray[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(localCopy.Array, localCopy.Offset); 9646m_PtrSendPacketsDescriptor = Marshal.UnsafeAddrOfPinnedArrayElement(m_SendPacketsDescriptor, 0); 9655m_SendPacketsDescriptor[descriptorIndex].buffer = Marshal.UnsafeAddrOfPinnedArrayElement(spe.m_Buffer, spe.m_Offset); 9825Marshal.Copy(remoteAddr, remoteSocketAddress.m_Buffer, 0, remoteSocketAddress.m_Size); 9835Marshal.SizeOf(handle)); 9838socketError = (SocketError)Marshal.GetLastWin32Error(); 9873socketError = (SocketError)Marshal.GetLastWin32Error(); 9948UnsafeNclNativeMethods.OSSOCK.WSAMsg* PtrMessage = (UnsafeNclNativeMethods.OSSOCK.WSAMsg*)Marshal.UnsafeAddrOfPinnedArrayElement(m_WSAMessageBuffer, 0); 9952UnsafeNclNativeMethods.OSSOCK.ControlData controlData = (UnsafeNclNativeMethods.OSSOCK.ControlData)Marshal.PtrToStructure(PtrMessage->controlBuffer.Pointer, typeof(UnsafeNclNativeMethods.OSSOCK.ControlData)); 9960UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6 controlData = (UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6)Marshal.PtrToStructure(PtrMessage->controlBuffer.Pointer, typeof(UnsafeNclNativeMethods.OSSOCK.ControlDataIPv6)); 10060socketError = (SocketError)Marshal.GetLastWin32Error();
net\System\Net\UnsafeNativeMethods.cs (9)
243GlobalLog.Print("RasHelper::RasHelper() RasConnectionNotification() Marshal.GetLastWin32Error():" + Marshal.GetLastWin32Error()); 288uint dwSize = (uint) Marshal.SizeOf(typeof(RASCONN)); 330connectionStatus.dwSize = (uint)Marshal.SizeOf(connectionStatus); 1729Marshal.ReadIntPtr(chainList.DangerousGetHandle() 1730+ i * Marshal.SizeOf(typeof(IntPtr))), true)) 3381bstr = Marshal.SecureStringToBSTR(secureString); 3382plainString = Marshal.PtrToStringBSTR(bstr); 3387Marshal.ZeroFreeBSTR(bstr); 3436info.cbSize = Marshal.SizeOf(info);
net\System\Net\WebSockets\WebSocketBuffer.cs (11)
34private static readonly int s_SizeOfUInt = Marshal.SizeOf(typeof(uint)); 35private static readonly int s_SizeOfBool = Marshal.SizeOf(typeof(bool)); 76m_StartAddress = Marshal.UnsafeAddrOfPinnedArrayElement(internalBuffer.Array, internalBuffer.Offset).ToInt64(); 143Marshal.WriteInt32(internalBufferPtr, offset, m_ReceiveBufferSize); 145Marshal.WriteInt32(internalBufferPtr, offset, m_SendBufferSize); 147Marshal.WriteIntPtr(internalBufferPtr, offset, internalBufferPtr + m_InternalBuffer.Offset); 149Marshal.WriteInt32(internalBufferPtr, offset, useZeroMaskingKey ? (int)1 : (int)0); 212Marshal.UnsafeAddrOfPinnedArrayElement(m_PinnedSendBuffer.Array, m_PinnedSendBuffer.Offset).ToInt64(); 232Contract.Assert(Marshal.UnsafeAddrOfPinnedArrayElement(m_PinnedSendBuffer.Array, 250Contract.Assert(Marshal.UnsafeAddrOfPinnedArrayElement(m_PinnedSendBuffer.Array, 633Contract.Assert(Marshal.UnsafeAddrOfPinnedArrayElement(m_InternalBuffer.Array, m_InternalBuffer.Offset).ToInt64() == m_StartAddress,
net\System\Net\WebSockets\WebSocketException.cs (1)
25: this(Marshal.GetLastWin32Error())
net\System\Net\WebSockets\WebSocketHttpListenerDuplexStream.cs (1)
960return Marshal.UnsafeAddrOfPinnedArrayElement(m_DataChunks, 0);
net\System\Net\WebSockets\WebSocketProtocolComponent.cs (6)
794IntPtr httpHeaderNamePtr = Marshal.ReadIntPtr(httpHeaderPtr); 796int length = Marshal.ReadInt32(lengthPtr); 801httpHeader.Name = Marshal.PtrToStringAnsi(httpHeaderNamePtr, length); 822Marshal.ReadIntPtr(IntPtr.Add(httpHeaderPtr, valueOffset)); 824length = Marshal.ReadInt32(lengthPtr); 825httpHeader.Value = Marshal.PtrToStringAnsi(httpHeaderValuePtr, (int)length);
net\System\Net\WinHttpWebProxyFinder.cs (4)
230proxyListString = Marshal.PtrToStringUni(proxyInfo.Proxy); 235Marshal.FreeHGlobal(proxyInfo.Proxy); 236Marshal.FreeHGlobal(proxyInfo.ProxyBypass); 244int errorCode = Marshal.GetLastWin32Error();
parent\parent\parent\InternalApis\NDP_FX\inc\ZLibNative.cs (5)
442Int32 hresult = Marshal.GetHRForLastWin32Error(); 443Marshal.ThrowExceptionForHR(hresult, new IntPtr(-1)); 461return (DT) (Object) Marshal.GetDelegateForFunctionPointer(entryPoint, typeof(DT)); 571Marshal.FreeHGlobal((IntPtr)zStreamPtr); 763IntPtr ptr = Marshal.AllocHGlobal(byteCount);
security\system\security\Authentication\ExtendedProtection\ExtendedProtectionPolicy.cs (2)
96Marshal.Copy(channelBindingData, 0, customChannelBinding.DangerousGetHandle(), channelBindingData.Length); 186Marshal.Copy(customChannelBinding.DangerousGetHandle(), channelBindingData, 0, customChannelBinding.Size);
security\system\security\cryptography\cryptoapi.cs (20)
2766CAPI.CRYPTOAPI_BLOB blob = (CAPI.CRYPTOAPI_BLOB) Marshal.PtrToStructure(pBlob, typeof(CAPI.CRYPTOAPI_BLOB)); 2780Marshal.Copy(blob.pbData, data, 0, data.Length); 2895Marshal.Copy(pbEncoded.DangerousGetHandle(), encodedData, 0, (int) cbEncoded); 2932Marshal.Copy(pbEncoded.DangerousGetHandle(), encodedData, 0, (int) cbEncoded); 2966throw new CryptographicException(Marshal.GetLastWin32Error()); 2975throw new CryptographicException(Marshal.GetLastWin32Error()); 2977string name = Marshal.PtrToStringUni(ptr.DangerousGetHandle()); 3029if (!rc && Marshal.GetLastWin32Error() == CAPI.NTE_BAD_KEYSET) { 3054container = Marshal.PtrToStringUni(pwszContainer); 3059provider = Marshal.PtrToStringUni(pwszProvider); 3081CRYPT_OID_INFO pOIDInfo = new CRYPT_OID_INFO(Marshal.SizeOf(typeof(CRYPT_OID_INFO))); 3087pOIDInfo = (CRYPT_OID_INFO) Marshal.PtrToStructure(pv, typeof(CAPI.CRYPT_OID_INFO)); 3106CRYPT_OID_INFO pOIDInfo = new CRYPT_OID_INFO(Marshal.SizeOf(typeof(CRYPT_OID_INFO))); 3112pOIDInfo = (CRYPT_OID_INFO) Marshal.PtrToStructure(pv, typeof(CAPI.CRYPT_OID_INFO)); 3161string s = Marshal.PtrToStringUni(pbFormat.DangerousGetHandle()); 3211string s = Marshal.PtrToStringUni(pbFormat.DangerousGetHandle()); 3428int dwErrorCode = Marshal.GetLastWin32Error(); 3459int dwErrorCode = Marshal.GetLastWin32Error(); 3461throw new CryptographicException(Marshal.GetLastWin32Error()); 3672throw new CryptographicException(Marshal.GetLastWin32Error());
security\system\security\cryptography\x509\x500Name.cs (3)
101return Marshal.PtrToStringUni(pwszDecodeName.DangerousGetHandle()); 147throw new CryptographicException(Marshal.GetLastWin32Error()); 158throw new CryptographicException(Marshal.GetLastWin32Error());
security\system\security\cryptography\x509\x509certificate2.cs (42)
169throw new CryptographicException(Marshal.GetLastWin32Error()); 173Marshal.Copy(decodedKeyValue.DangerousGetHandle(), decodedData, 0, decodedData.Length); 183throw new CryptographicException(Marshal.GetLastWin32Error()); 206CAPI.CRYPTOAPI_BLOB pDssPubKey = (CAPI.CRYPTOAPI_BLOB) Marshal.PtrToStructure(decodedKeyValue.DangerousGetHandle(), typeof(CAPI.CRYPTOAPI_BLOB)); 207CAPI.CERT_DSS_PARAMETERS pDssParameters = (CAPI.CERT_DSS_PARAMETERS) Marshal.PtrToStructure(decodedParameters.DangerousGetHandle(), typeof(CAPI.CERT_DSS_PARAMETERS)); 232Marshal.Copy(pDssParameters.p.pbData, p, 0, p.Length); 241Marshal.Copy(pDssParameters.q.pbData, q, 0, q.Length); 252Marshal.Copy(pDssParameters.g.pbData, g, 0, g.Length); 263Marshal.Copy(pDssPubKey.pbData, y, 0, y.Length); 617ptr = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB)))); 623throw new CryptographicException(Marshal.GetLastWin32Error()); 666string friendlyName = Marshal.PtrToStringUni(ptr.DangerousGetHandle()); 695CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 715CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 736CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 841s_publicKeyOffset = Marshal.SizeOf(typeof(CAPIBase.BLOBHEADER)); 904CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 967CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 978CAPI.CERT_EXTENSION extension = (CAPI.CERT_EXTENSION) Marshal.PtrToStructure(pAltName[i], typeof(CAPI.CERT_EXTENSION)); 980Marshal.Copy(extension.Value.pbData, rawData, 0, rawData.Length); 992CAPI.CERT_ALT_NAME_INFO altNameInfo = (CAPI.CERT_ALT_NAME_INFO) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CERT_ALT_NAME_INFO)); 995IntPtr pAltInfoPtr = new IntPtr((long) altNameInfo.rgAltEntry + index * Marshal.SizeOf(typeof(CAPI.CERT_ALT_NAME_ENTRY))); 996CAPI.CERT_ALT_NAME_ENTRY altNameEntry = (CAPI.CERT_ALT_NAME_ENTRY) Marshal.PtrToStructure(pAltInfoPtr, typeof(CAPI.CERT_ALT_NAME_ENTRY)); 1001CAPI.CERT_OTHER_NAME otherName = (CAPI.CERT_OTHER_NAME) Marshal.PtrToStructure(altNameEntry.Value.pOtherName, typeof(CAPI.CERT_OTHER_NAME)); 1010CAPI.CERT_NAME_VALUE nameValue = (CAPI.CERT_NAME_VALUE) Marshal.PtrToStructure(pUpnName.DangerousGetHandle(), typeof(CAPI.CERT_NAME_VALUE)); 1012name = Marshal.PtrToStringUni(nameValue.Value.pbData); 1021name = Marshal.PtrToStringUni(altNameEntry.Value.pwszDNSName); 1027name = Marshal.PtrToStringUni(altNameEntry.Value.pwszURL); 1200int dwErrorCode = Marshal.GetLastWin32Error(); 1204throw new CryptographicException(Marshal.GetLastWin32Error()); 1212int dwErrorCode = Marshal.GetLastWin32Error(); 1216throw new CryptographicException(Marshal.GetLastWin32Error()); 1219CAPI.CRYPT_KEY_PROV_INFO pKeyProvInfo = (CAPI.CRYPT_KEY_PROV_INFO) Marshal.PtrToStructure(ptr.DangerousGetHandle(), typeof(CAPI.CRYPT_KEY_PROV_INFO)); 1305CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 1314CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 1338throw new CryptographicException(Marshal.GetLastWin32Error()); 1363throw new CryptographicException(Marshal.GetLastWin32Error()); 1382throw new CryptographicException(Marshal.GetLastWin32Error()); 1401ptr = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CRYPT_KEY_PROV_INFO)))); 1402Marshal.StructureToPtr(keyProvInfo, ptr.DangerousGetHandle(), false); 1410throw new CryptographicException(Marshal.GetLastWin32Error()); 1413Marshal.DestroyStructure(ptr.DangerousGetHandle(), typeof(CAPI.CRYPT_KEY_PROV_INFO));
security\system\security\cryptography\x509\x509certificate2collection.cs (37)
310Marshal.Copy(pCertContext.pbCertEncoded, pbBlob, 0, pbBlob.Length); 322throw new CryptographicException(Marshal.GetLastWin32Error()); 328throw new CryptographicException(Marshal.GetLastWin32Error()); 331Marshal.Copy(pbEncoded.DangerousGetHandle(), pbBlob, 0, pbBlob.Length); 340throw new CryptographicException(Marshal.GetLastWin32Error()); 348throw new CryptographicException(Marshal.GetLastWin32Error()); 351Marshal.Copy(DataBlob.pbData, pbBlob, 0, pbBlob.Length); 367throw new CryptographicException(Marshal.GetLastWin32Error()); 378throw new CryptographicException(Marshal.GetLastWin32Error()); 381Marshal.Copy(DataBlob.pbData, pbBlob, 0, pbBlob.Length); 598throw new CryptographicException(Marshal.GetLastWin32Error()); 680hr = Marshal.GetHRForLastWin32Error(); 742CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 745Marshal.Copy(pCertInfo.SerialNumber.pbData, hex, 0, hex.Length); 826CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 839CAPI.CERT_EXTENSION extension = (CAPI.CERT_EXTENSION) Marshal.PtrToStructure(pV1Template, typeof(CAPI.CERT_EXTENSION)); 841Marshal.Copy(extension.Value.pbData, rawData, 0, rawData.Length); 851CAPI.CERT_NAME_VALUE pNameValue = (CAPI.CERT_NAME_VALUE) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CERT_NAME_VALUE)); 852string s = Marshal.PtrToStringUni(pNameValue.Value.pbData); 859CAPI.CERT_EXTENSION extension = (CAPI.CERT_EXTENSION) Marshal.PtrToStructure(pV2Template, typeof(CAPI.CERT_EXTENSION)); 861Marshal.Copy(extension.Value.pbData, rawData, 0, rawData.Length); 871CAPI.CERT_TEMPLATE_EXT pTemplate = (CAPI.CERT_TEMPLATE_EXT) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CERT_TEMPLATE_EXT)); 912IntPtr pszOid = Marshal.ReadIntPtr(new IntPtr((long) rghOIDs.DangerousGetHandle() + index * Marshal.SizeOf(typeof(IntPtr)))); 913string oidValue = Marshal.PtrToStringAnsi(pszOid); 934CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 942CAPI.CERT_EXTENSION extension = (CAPI.CERT_EXTENSION) Marshal.PtrToStructure(pExtension, typeof(CAPI.CERT_EXTENSION)); 944Marshal.Copy(extension.Value.pbData, rawData, 0, rawData.Length); 954CAPI.CERT_POLICIES_INFO pInfo = (CAPI.CERT_POLICIES_INFO) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CERT_POLICIES_INFO)); 956IntPtr pPolicyInfoPtr = new IntPtr((long) pInfo.rgPolicyInfo + index * Marshal.SizeOf(typeof(CAPI.CERT_POLICY_INFO))); 957CAPI.CERT_POLICY_INFO pPolicyInfo = (CAPI.CERT_POLICY_INFO) Marshal.PtrToStructure(pPolicyInfoPtr, typeof(CAPI.CERT_POLICY_INFO)); 976CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 1045Marshal.Copy(ptr.DangerousGetHandle(), hex, 0, hex.Length); 1086throw new CryptographicException(Marshal.GetLastWin32Error()); 1098throw new CryptographicException(Marshal.GetLastWin32Error()); 1124throw new CryptographicException(Marshal.GetLastWin32Error()); 1136throw new CryptographicException(Marshal.GetLastWin32Error());
security\system\security\cryptography\x509\x509chain.cs (10)
225CAPI.CERT_CHAIN_POLICY_PARA PolicyPara = new CAPI.CERT_CHAIN_POLICY_PARA(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_PARA))); 226CAPI.CERT_CHAIN_POLICY_STATUS PolicyStatus = new CAPI.CERT_CHAIN_POLICY_STATUS(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_STATUS))); 235throw new CryptographicException(Marshal.GetLastWin32Error()); 277CAPI.CERT_CHAIN_CONTEXT pChain = new CAPI.CERT_CHAIN_CONTEXT(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_CONTEXT))); 278uint cbSize = (uint) Marshal.ReadInt32(safeCertChainHandle.DangerousGetHandle()); 279if (cbSize > Marshal.SizeOf(pChain)) 280cbSize = (uint) Marshal.SizeOf(pChain); 286m_chainElementCollection = new X509ChainElementCollection(Marshal.ReadIntPtr(pChain.rgpChain)); 362ChainPara.cbSize = (uint) Marshal.SizeOf(ChainPara); 399return Marshal.GetHRForLastWin32Error();
security\system\security\cryptography\x509\x509chainelement.cs (11)
26CAPI.CERT_CHAIN_ELEMENT chainElement = new CAPI.CERT_CHAIN_ELEMENT(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_ELEMENT))); 27uint cbSize = (uint) Marshal.ReadInt32(pChainElement); 28if (cbSize > Marshal.SizeOf(chainElement)) 29cbSize = (uint) Marshal.SizeOf(chainElement); 36m_description = Marshal.PtrToStringUni(chainElement.pwszExtendedErrorInfo); 75CAPI.CERT_SIMPLE_CHAIN simpleChain = new CAPI.CERT_SIMPLE_CHAIN(Marshal.SizeOf(typeof(CAPI.CERT_SIMPLE_CHAIN))); 76uint cbSize = (uint) Marshal.ReadInt32(pSimpleChain); 77if (cbSize > Marshal.SizeOf(simpleChain)) 78cbSize = (uint) Marshal.SizeOf(simpleChain); 82m_elements[index] = new X509ChainElement(Marshal.ReadIntPtr(new IntPtr((long) simpleChain.rgpElement + index * Marshal.SizeOf(typeof(IntPtr)))));
security\system\security\cryptography\x509\x509extension.cs (30)
27CAPI.CERT_EXTENSION extension = (CAPI.CERT_EXTENSION) Marshal.PtrToStructure(pExtension, typeof(CAPI.CERT_EXTENSION)); 33Marshal.Copy(extension.Value.pbData, rawData, 0, rawData.Length); 133throw new CryptographicException(Marshal.GetLastWin32Error()); 135CAPI.CRYPTOAPI_BLOB pKeyUsage = (CAPI.CRYPTOAPI_BLOB) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CRYPTOAPI_BLOB)); 140Marshal.Copy(pKeyUsage.pbData, keyUsage, 0, (int) pKeyUsage.cbData); 158throw new CryptographicException(Marshal.GetLastWin32Error()); 222throw new CryptographicException(Marshal.GetLastWin32Error()); 224CAPI.CERT_BASIC_CONSTRAINTS_INFO pBasicConstraints = (CAPI.CERT_BASIC_CONSTRAINTS_INFO) Marshal.PtrToStructure(decoded.DangerousGetHandle(), 229Marshal.Copy(pBasicConstraints.SubjectType.pbData, isCA, 0, 1); 240throw new CryptographicException(Marshal.GetLastWin32Error()); 242CAPI.CERT_BASIC_CONSTRAINTS2_INFO pBasicConstraints2 = (CAPI.CERT_BASIC_CONSTRAINTS2_INFO) Marshal.PtrToStructure(decoded.DangerousGetHandle(), 269throw new CryptographicException(Marshal.GetLastWin32Error()); 322throw new CryptographicException(Marshal.GetLastWin32Error()); 324CAPI.CERT_ENHKEY_USAGE pEnhKeyUsage = (CAPI.CERT_ENHKEY_USAGE) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CERT_ENHKEY_USAGE)); 328IntPtr pszOid = Marshal.ReadIntPtr(new IntPtr((long) pEnhKeyUsage.rgpszUsageIdentifier + index * Marshal.SizeOf(typeof(IntPtr)))); 329string oidValue = Marshal.PtrToStringAnsi(pszOid); 352throw new CryptographicException(Marshal.GetLastWin32Error()); 433throw new CryptographicException(Marshal.GetLastWin32Error()); 435CAPI.CRYPTOAPI_BLOB pSubjectKeyIdentifier = (CAPI.CRYPTOAPI_BLOB) Marshal.PtrToStructure(decoded.DangerousGetHandle(), typeof(CAPI.CRYPTOAPI_BLOB)); 467throw new CryptographicException(Marshal.GetLastWin32Error()); 484uint cbPublicKeyInfo = (uint) (Marshal.SizeOf(typeof(CAPI.CERT_PUBLIC_KEY_INFO2)) + 491IntPtr pszObjId = new IntPtr((long) pPublicKeyInfo + Marshal.SizeOf(typeof(CAPI.CERT_PUBLIC_KEY_INFO2))); 498Marshal.Copy(szObjId, 0, pszObjId, szObjId.Length); 502Marshal.Copy(encodedParameters, 0, pbParameters, encodedParameters.Length); 506Marshal.Copy(encodedKeyValue, 0, pbPublicKey, encodedKeyValue.Length); 543throw new CryptographicException(Marshal.GetHRForLastWin32Error()); 558throw new CryptographicException(Marshal.GetHRForLastWin32Error()); 606CAPI.CERT_INFO pCertInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 611X509Extension extension = new X509Extension(new IntPtr((long)rgExtensions + (index * Marshal.SizeOf(typeof(CAPI.CERT_EXTENSION)))));
security\system\security\cryptography\x509\x509store.cs (3)
163throw new CryptographicException(Marshal.GetLastWin32Error()); 202throw new CryptographicException(Marshal.GetLastWin32Error()); 294throw new CryptographicException(Marshal.GetLastWin32Error());
security\system\security\cryptography\x509\x509utils.cs (14)
272Marshal.Copy(managed, 0, pb.DangerousGetHandle(), managed.Length); 287*(byte*) ((long)dest + index) = Marshal.ReadByte(new IntPtr((long)source + index)); 296Marshal.Copy(unmanaged, array, 0, array.Length); 319Marshal.Copy(arr, 0, pb.DangerousGetHandle(), arr.Length); 330Marshal.Copy(arr, 0, pb.DangerousGetHandle(), arr.Length); 361throw new CryptographicException(Marshal.GetLastWin32Error()); 373throw new CryptographicException(Marshal.GetLastWin32Error()); 502int ptrSize = oidStrs.Count * Marshal.SizeOf(typeof(IntPtr)); 511Marshal.WriteIntPtr(new IntPtr((long) safeLocalAllocHandle.DangerousGetHandle() + index * Marshal.SizeOf(typeof(IntPtr))), pOid); 513Marshal.Copy(ansiOid, 0, pOid, ansiOid.Length); 556CAPI.CERT_CHAIN_POLICY_PARA PolicyPara = new CAPI.CERT_CHAIN_POLICY_PARA(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_PARA))); 557CAPI.CERT_CHAIN_POLICY_STATUS PolicyStatus = new CAPI.CERT_CHAIN_POLICY_STATUS(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_STATUS))); 583return Marshal.GetHRForLastWin32Error();
services\monitoring\system\diagnosticts\CounterSampleCalculator.cs (1)
237throw new Win32Exception( Marshal.GetLastWin32Error() );
services\monitoring\system\diagnosticts\EventLog.cs (3)
1028else if (Marshal.GetLastWin32Error() != 87) { // Windows returns ERROR_INVALID_PARAMETER for special keys which were added in RS5+ but do not represent actual event logs. 1043osv.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osv); 1316lastError = Marshal.GetLastWin32Error();
services\monitoring\system\diagnosticts\EventLogInternal.cs (5)
636int error = Marshal.GetLastWin32Error(); 899error = Marshal.GetLastWin32Error(); 1092int error = Marshal.GetLastWin32Error(); 1305if (Marshal.GetLastWin32Error() != 0) { 1335if (Marshal.GetLastWin32Error() != 0) {
services\monitoring\system\diagnosticts\FileVersionInfo.cs (4)
332Marshal.PtrToStructure(memRef, fixedFileInfo); 358data = Marshal.PtrToStringAuto(memRef); 371return(Marshal.ReadInt16(memRef) << 16) + Marshal.ReadInt16((IntPtr)((long)memRef + 2));
services\monitoring\system\diagnosticts\PerformanceCounterLib.cs (20)
104Marshal.PtrToStructure(dataRef, dataBlock); 117Marshal.PtrToStructure(dataRef, perfObject); 129Marshal.PtrToStructure(dataRef, perfCounter); 1204throw new Win32Exception(Marshal.GetHRForException(e)); 1238error = Marshal.GetHRForException(e); 1308Marshal.PtrToStructure(dataRef, dataBlock); 1326Marshal.PtrToStructure(dataRef, perfObject); 1356Marshal.PtrToStructure(dataRef, perfCounter); 1388Marshal.PtrToStructure(dataRef, perfInstance); 1394instanceName = parentInstanceNames[perfInstance.ParentObjectInstance] + "/" + Marshal.PtrToStringUni((IntPtr)((long)dataRef + perfInstance.NameOffset)); 1396instanceName = Marshal.PtrToStringUni((IntPtr)((long)dataRef + perfInstance.NameOffset)); 1418dataRef = (IntPtr)((long)dataRef + Marshal.ReadInt32(dataRef)); 1430Marshal.PtrToStructure(dataRef, dataBlock); 1438Marshal.PtrToStructure(dataRef, perfObject); 1461Marshal.PtrToStructure(dataRef, perfCounter); 1468Marshal.PtrToStructure(dataRef, perfInstance); 1469instanceNames[i] = Marshal.PtrToStringUni((IntPtr)((long)dataRef + perfInstance.NameOffset)); 1471dataRef = (IntPtr)((long)dataRef + Marshal.ReadInt32(dataRef)); 1551return (long)(uint)Marshal.ReadInt32((IntPtr)((long)pointer + this.offset)); 1554return (long)Marshal.ReadInt64((IntPtr)((long)pointer + this.offset));
services\monitoring\system\diagnosticts\Process.cs (16)
1485if (Marshal.GetLastWin32Error() != NativeMethods.ERROR_SUCCESS) { 2070password = Marshal.SecureStringToCoTaskMemUnicode(startInfo.Password); 2072password = Marshal.StringToCoTaskMemUni(startInfo.PasswordInClearText); 2074password = Marshal.StringToCoTaskMemUni(String.Empty); 2093errorCode = Marshal.GetLastWin32Error(); 2108Marshal.ZeroFreeCoTaskMemUnicode(password); 2128errorCode = Marshal.GetLastWin32Error(); 2235shellExecuteInfo.lpFile = Marshal.StringToHGlobalAuto(startInfo.FileName); 2237shellExecuteInfo.lpVerb = Marshal.StringToHGlobalAuto(startInfo.Verb); 2239shellExecuteInfo.lpParameters = Marshal.StringToHGlobalAuto(startInfo.Arguments); 2241shellExecuteInfo.lpDirectory = Marshal.StringToHGlobalAuto(startInfo.WorkingDirectory); 2271if (shellExecuteInfo.lpFile != (IntPtr)0) Marshal.FreeHGlobal(shellExecuteInfo.lpFile); 2272if (shellExecuteInfo.lpVerb != (IntPtr)0) Marshal.FreeHGlobal(shellExecuteInfo.lpVerb); 2273if (shellExecuteInfo.lpParameters != (IntPtr)0) Marshal.FreeHGlobal(shellExecuteInfo.lpParameters); 2274if (shellExecuteInfo.lpDirectory != (IntPtr)0) Marshal.FreeHGlobal(shellExecuteInfo.lpDirectory); 2846_errorCode = Marshal.GetLastWin32Error();
services\monitoring\system\diagnosticts\ProcessManager.cs (29)
265int result = Marshal.GetLastWin32Error(); 291int result = Marshal.GetLastWin32Error(); 358int entrySize = (int)Marshal.SizeOf(typeof(NativeMethods.WinProcessEntry)); 363Marshal.WriteInt32(bufferPtr, bufferSize); 370Marshal.PtrToStructure(bufferPtr, process); 372String name = Marshal.PtrToStringAnsi((IntPtr)((long)bufferPtr + entrySize)); 379Marshal.WriteInt32(bufferPtr, bufferSize); 385thread.dwSize = Marshal.SizeOf(thread); 428int entrySize = Marshal.SizeOf(typeof(NativeMethods.WinModuleEntry)); 433Marshal.WriteInt32(bufferPtr, bufferSize); 440Marshal.PtrToStructure(bufferPtr, module); 442moduleInfo.baseName = Marshal.PtrToStringAnsi((IntPtr)((long)bufferPtr + entrySize)); 443moduleInfo.fileName = Marshal.PtrToStringAnsi((IntPtr)((long)bufferPtr + entrySize + NativeMethods.WinModuleEntry.sizeofModuleName)); 448Marshal.WriteInt32(bufferPtr, bufferSize); 669if (!NativeMethods.GetModuleInformation(processHandle, new HandleRef(null, moduleHandle), ntModuleInfo, Marshal.SizeOf(ntModuleInfo))) 737int status = NativeMethods.NtQueryInformationProcess(processHandle, NativeMethods.NtQueryProcessBasicInfo, info, (int)Marshal.SizeOf(info), null); 800Marshal.PtrToStructure(dataBlockPtr, dataBlock); 806Marshal.PtrToStructure(typePtr, type); 813Marshal.PtrToStructure(counterPtr, counter); 826Marshal.PtrToStructure(instancePtr, instance); 828string instanceName = Marshal.PtrToStringUni(namePtr); 831Marshal.PtrToStructure(counterBlockPtr, counterBlock); 1006return Marshal.ReadInt64(dataPtr); 1008return(long)Marshal.ReadInt32(dataPtr); 1143Marshal.PtrToStructure(currentPtr, pi); 1179string processName = GetProcessShortName(Marshal.PtrToStringUni(pi.NamePtr, pi.NameLength/sizeof(char))); 1204currentPtr = (IntPtr)((long)currentPtr + Marshal.SizeOf(pi)); 1208Marshal.PtrToStructure(currentPtr, ti); 1220currentPtr = (IntPtr)((long)currentPtr + Marshal.SizeOf(ti));
services\monitoring\system\diagnosticts\processwaithandle.cs (2)
25Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
services\monitoring\system\diagnosticts\SharedPerformanceCounter.cs (8)
37private static readonly int CategoryEntrySize = Marshal.SizeOf(typeof(CategoryEntry)); 38private static readonly int InstanceEntrySize = Marshal.SizeOf(typeof(InstanceEntry)); 39private static readonly int CounterEntrySize = Marshal.SizeOf(typeof(CounterEntry)); 40private static readonly int ProcessLifetimeEntrySize = Marshal.SizeOf(typeof(ProcessLifetimeEntry)); 1213int error = Marshal.GetLastWin32Error(); 1590if ((Marshal.GetLastWin32Error() != NativeMethods.ERROR_ACCESS_DENIED) || !fileMappingHandle.IsInvalid) { 1598if ((Marshal.GetLastWin32Error() != NativeMethods.ERROR_FILE_NOT_FOUND) || !fileMappingHandle.IsInvalid) { 1646Marshal.Copy(tmp, 0, nativePointer, tmp.Length);
sys\system\io\ports\InternalResources.cs (3)
17using Marshal=System.Runtime.InteropServices.Marshal; 84int errorCode = Marshal.GetLastWin32Error(); 93int errorCode = Marshal.GetLastWin32Error();
sys\system\io\ports\SerialStream.cs (9)
700int errorCode = Marshal.GetLastWin32Error(); 807int hr = Marshal.GetLastWin32Error(); 1242if (Marshal.GetLastWin32Error() == NativeMethods.ERROR_COUNTER_TIMEOUT) 1271dcb.DCBlength = (uint) System.Runtime.InteropServices.Marshal.SizeOf(dcb); 1561hr = Marshal.GetLastWin32Error(); 1611hr = Marshal.GetLastWin32Error(); 1741int hr = Marshal.GetLastWin32Error(); 1757Debug.Assert(success, "waitCommEventWaitHandle.WaitOne() returned error " + Marshal.GetLastWin32Error()); 1762error = Marshal.GetLastWin32Error();
sys\system\Media\SoundPlayer.cs (3)
589if (dw < Marshal.SizeOf(typeof(NativeMethods.WAVEFORMATEX))) 590dw = Marshal.SizeOf(typeof(NativeMethods.WAVEFORMATEX)); 597Marshal.PtrToStructure((IntPtr) pdata, waveFormat);
sys\system\threading\semaphore.cs (5)
14using Marshal = System.Runtime.InteropServices.Marshal; 73int errorCode = Marshal.GetLastWin32Error(); 127secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 140int errorCode = Marshal.GetLastWin32Error(); 275int errorCode = Marshal.GetLastWin32Error();
System.Activities.Presentation (2)
System.Activities.Presentation\System\Activities\Presentation\View\DesignerView.Commands.cs (2)
1476dataObject = new DataObject((System.Runtime.InteropServices.ComTypes.IDataObject)Marshal.GetObjectForIUnknown(dataObjectPointer)); 1477Marshal.Release(dataObjectPointer);
System.AddIn (3)
System\Addin\Hosting\AddInProcess.cs (1)
331throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error()); // call failed
System\Addin\Hosting\AddInStore.cs (2)
1051if ((uint) System.Runtime.InteropServices.Marshal.GetHRForException(e) != 1114if ((uint) System.Runtime.InteropServices.Marshal.GetHRForException(e) !=
System.Configuration (15)
Microsoft\Win32\SafeNativeMemoryHandle.cs (1)
43Marshal.FreeHGlobal(handle);
System\Configuration\ClientConfigPaths.cs (1)
119&& Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER
System\Configuration\DATA_BLOB.cs (1)
29Marshal.FreeHGlobal(pbData);
System\Configuration\DPAPIProtectedConfigurationProvider.cs (9)
110Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 113Marshal.Copy(outputData.pbData, buf, 0, buf.Length); 177Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 180Marshal.Copy(outputData.pbData, buf, 0, buf.Length); 239db.pbData = Marshal.AllocHGlobal(db.cbData); 240Marshal.Copy(buf, 0, db.pbData, db.cbData); 250cps.cbSize = Marshal.SizeOf(typeof(CRYPTPROTECT_PROMPTSTRUCT));
System\Configuration\FileUtil.cs (1)
35int hr = Marshal.GetHRForLastWin32Error();
System\Configuration\RSAProtectedConfigurationProvider.cs (2)
200int hr = Marshal.GetHRForLastWin32Error(); 212Marshal.ThrowExceptionForHR(hr);
System.Core (239)
Microsoft\Win32\SafeHandles\BCryptSafeHandles.cs (1)
70Marshal.FreeCoTaskMem(m_hashObject);
Microsoft\Win32\SafeHandles\CapiSafeHandles.cs (3)
126error = Marshal.GetLastWin32Error(); 300throw new CryptographicException(Marshal.GetLastWin32Error()); 393error = Marshal.GetLastWin32Error();
Microsoft\Win32\UnsafeNativeMethods.cs (2)
227if (lo == -1 && ((hr = Marshal.GetLastWin32Error()) != 0)) 1480lpBuffer.dwLength = (uint)Marshal.SizeOf(typeof(MEMORYSTATUSEX));
System\Diagnostics\Eventing\Reader\CoTaskMemSafeHandle.cs (1)
50Marshal.FreeCoTaskMem(handle);
System\Diagnostics\Eventing\Reader\CoTaskMemUnicodeSafeHandle.cs (1)
55Marshal.ZeroFreeCoTaskMemUnicode(handle);
System\Diagnostics\Eventing\Reader\EventLogSession.cs (1)
137erLogin.Password.SetMemory(Marshal.SecureStringToCoTaskMemUnicode(password));
System\Diagnostics\Eventing\Reader\NativeWrapper.cs (115)
71int win32Error = Marshal.GetLastWin32Error(); 86int win32Error = Marshal.GetLastWin32Error(); 114int win32Error = Marshal.GetLastWin32Error(); 130int win32Error = Marshal.GetLastWin32Error(); 142int win32Error = Marshal.GetLastWin32Error(); 175int win32Error = Marshal.GetLastWin32Error(); 185int win32Error = Marshal.GetLastWin32Error(); 194int win32Error = Marshal.GetLastWin32Error(); 204int win32Error = Marshal.GetLastWin32Error(); 221int win32Error = Marshal.GetLastWin32Error(); 233int win32Error = Marshal.GetLastWin32Error(); 245int win32Error = Marshal.GetLastWin32Error(); 255int win32Error = Marshal.GetLastWin32Error(); 267int win32Error = Marshal.GetLastWin32Error(); 288int win32Error = Marshal.GetLastWin32Error(); 307int win32Error = Marshal.GetLastWin32Error(); 326int win32Error = Marshal.GetLastWin32Error(); 340int win32Error = Marshal.GetLastWin32Error(); 358int win32Error = Marshal.GetLastWin32Error(); 365win32Error = Marshal.GetLastWin32Error(); 379int win32Error = Marshal.GetLastWin32Error(); 391int win32Error = Marshal.GetLastWin32Error(); 400int win32Error = Marshal.GetLastWin32Error(); 414int error = Marshal.GetLastWin32Error(); 421buffer = Marshal.AllocHGlobal((int)bufferNeeded); 423error = Marshal.GetLastWin32Error(); 427UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 433Marshal.FreeHGlobal(buffer); 443int error = Marshal.GetLastWin32Error(); 448buffer = Marshal.AllocHGlobal((int)bufferNeeded); 450error = Marshal.GetLastWin32Error(); 454UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 458if (buffer != IntPtr.Zero) Marshal.FreeHGlobal(buffer); 471int error = Marshal.GetLastWin32Error(); 476buffer = Marshal.AllocHGlobal((int)bufferNeeded); 478error = Marshal.GetLastWin32Error(); 482UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 486if (buffer != IntPtr.Zero) Marshal.FreeHGlobal(buffer); 497int error = Marshal.GetLastWin32Error(); 502buffer = Marshal.AllocHGlobal((int)bufferNeeded); 504error = Marshal.GetLastWin32Error(); 515UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 519if (buffer != IntPtr.Zero) Marshal.FreeHGlobal(buffer); 534int error = Marshal.GetLastWin32Error(); 554error = Marshal.GetLastWin32Error(); 582int error = Marshal.GetLastWin32Error(); 588buffer = Marshal.AllocHGlobal((int)bufferNeeded); 590error = Marshal.GetLastWin32Error(); 594UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 598if (buffer != IntPtr.Zero) Marshal.FreeHGlobal(buffer); 609int win32Error = Marshal.GetLastWin32Error(); 614buffer = Marshal.AllocHGlobal((int)bufferNeeded); 616win32Error = Marshal.GetLastWin32Error(); 620UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 625Marshal.FreeHGlobal(buffer); 639int win32Error = Marshal.GetLastWin32Error(); 644buffer = Marshal.AllocHGlobal((int)bufferNeeded); 646win32Error = Marshal.GetLastWin32Error(); 657UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 662Marshal.FreeHGlobal(buffer); 688taskMem.SetMemory(Marshal.StringToCoTaskMemAuto((string)val)); 694taskMem.SetMemory(Marshal.StringToCoTaskMemAuto((string)val)); 733int win32Error = Marshal.GetLastWin32Error(); 745int win32Error = Marshal.GetLastWin32Error(); 758win32Error = Marshal.GetLastWin32Error(); 771int win32Error = Marshal.GetLastWin32Error(); 784win32Error = Marshal.GetLastWin32Error(); 798int win32Error = Marshal.GetLastWin32Error(); 803buffer = Marshal.AllocHGlobal((int)bufferNeeded); 805win32Error = Marshal.GetLastWin32Error(); 809UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(buffer, typeof(UnsafeNativeMethods.EvtVariant)); 814Marshal.FreeHGlobal(buffer); 830int error = Marshal.GetLastWin32Error(); 835buffer = Marshal.AllocHGlobal((int)bufferNeeded); 837int win32Error = Marshal.GetLastWin32Error(); 847UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(pointer, typeof(UnsafeNativeMethods.EvtVariant)); 904pointer = new IntPtr(((Int64)pointer + Marshal.SizeOf(varVal))); 909Marshal.FreeHGlobal(buffer); 928int error = Marshal.GetLastWin32Error(); 933buffer = Marshal.AllocHGlobal((int)bufferNeeded); 935int win32Error = Marshal.GetLastWin32Error(); 943UnsafeNativeMethods.EvtVariant varVal = (UnsafeNativeMethods.EvtVariant)Marshal.PtrToStructure(pointer, typeof(UnsafeNativeMethods.EvtVariant)); 945pointer = new IntPtr(((Int64)pointer + Marshal.SizeOf(varVal))); 952Marshal.FreeHGlobal(buffer); 965int error = Marshal.GetLastWin32Error(); 988error = Marshal.GetLastWin32Error(); 1018int error = Marshal.GetLastWin32Error(); 1033buffer = Marshal.AllocHGlobal(bufferNeeded * 2); 1035error = Marshal.GetLastWin32Error(); 1052string s = Marshal.PtrToStringAuto(pointer); 1064Marshal.FreeHGlobal(buffer); 1077int error = Marshal.GetLastWin32Error(); 1083buffer = Marshal.AllocHGlobal((int)bufferNeeded); 1085error = Marshal.GetLastWin32Error(); 1089return Marshal.PtrToStringAuto(buffer); 1093Marshal.FreeHGlobal(buffer); 1116int error = Marshal.GetLastWin32Error(); 1140error = Marshal.GetLastWin32Error(); 1195return (val.GuidReference == IntPtr.Zero) ? Guid.Empty : Marshal.PtrToStructure(val.GuidReference, typeof(Guid)); 1201UnsafeNativeMethods.SystemTime sysTime = (UnsafeNativeMethods.SystemTime)Marshal.PtrToStructure(val.SystemTime, typeof(UnsafeNativeMethods.SystemTime)); 1212Marshal.Copy(val.Reference, arByte, 0, (int)val.Count); 1217Marshal.Copy(val.Reference, arInt16, 0, (int)val.Count); 1222Marshal.Copy(val.Reference, arInt32, 0, (int)val.Count); 1227Marshal.Copy(val.Reference, arInt64, 0, (int)val.Count); 1232Marshal.Copy(val.Reference, arSingle, 0, (int)val.Count); 1237Marshal.Copy(val.Reference, arDouble, 0, (int)val.Count); 1284return Marshal.PtrToStringAuto(val.StringVal); 1292return Marshal.PtrToStringAnsi(val.AnsiString); 1314array.SetValue(Marshal.PtrToStructure(ptr, objType), i); 1332bool value = (Marshal.ReadInt32(ptr) != 0) ? true : false; 1349array[i] = DateTime.FromFileTime(Marshal.ReadInt64(ptr)); 1366UnsafeNativeMethods.SystemTime sysTime = (UnsafeNativeMethods.SystemTime)Marshal.PtrToStructure(ptr, typeof(UnsafeNativeMethods.SystemTime)); 1384Marshal.Copy(ptr, pointersToString, 0, (int)val.Count); 1387stringArray[i] = ansi ? Marshal.PtrToStringAnsi(pointersToString[i]) : Marshal.PtrToStringAuto(pointersToString[i]);
System\Diagnostics\PerformanceData\CounterSetInstance.cs (1)
47int Status = (int) ((m_nativeInst != null) ? UnsafeNativeMethods.ERROR_SUCCESS : Marshal.GetLastWin32Error());
System\Diagnostics\PerformanceData\CounterSetInstanceCounterDataSet.cs (2)
125m_dataBlock = (byte *) Marshal.AllocHGlobal(m_instance.m_counterSet.m_idToCounter.Count * sizeof(Int64)); 176Marshal.FreeHGlobal((System.IntPtr)m_dataBlock);
System\IO\__Error.cs (1)
139int errorCode = Marshal.GetLastWin32Error();
System\IO\LogStream.cs (3)
129int errorCode = Marshal.GetLastWin32Error(); 285hr = Marshal.GetLastWin32Error(); 460secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);
System\IO\MemoryMappedFiles\MemoryMappedFile.cs (5)
398Int32 errorCode = Marshal.GetLastWin32Error(); 425Int32 lastError = Marshal.GetLastWin32Error(); 482Int32 createErrorCode = Marshal.GetLastWin32Error(); 500Int32 openErrorCode = Marshal.GetLastWin32Error(); 784secAttrs.nLength = (Int32)Marshal.SizeOf(secAttrs);
System\IO\MemoryMappedFiles\MemoryMappedView.cs (6)
119__Error.WinIOError(Marshal.GetLastWin32Error(), String.Empty); 124UnsafeNativeMethods.VirtualQuery(viewHandle, ref viewInfo, (IntPtr)Marshal.SizeOf(viewInfo)); 142int lastError = Marshal.GetLastWin32Error(); 152UnsafeNativeMethods.VirtualQuery(viewHandle, ref viewInfo, (IntPtr)Marshal.SizeOf(viewInfo)); 198Int32 error = Marshal.GetLastWin32Error(); 214error = Marshal.GetLastWin32Error();
System\IO\Pipes\IOCancellationHelper.cs (1)
92int errorCode = Marshal.GetLastWin32Error();
System\IO\Pipes\Pipe.cs (14)
212__Error.WinIOError(Marshal.GetLastWin32Error(), String.Empty); 223__Error.WinIOError(Marshal.GetLastWin32Error(), String.Empty); 585__Error.WinIOError(Marshal.GetLastWin32Error(), String.Empty); 607int errorCode = Marshal.GetLastWin32Error(); 677int errorCode = Marshal.GetLastWin32Error(); 782__Error.WinIOError(Marshal.GetLastWin32Error(), String.Empty); 824execHelper.m_impersonateErrorCode = Marshal.GetLastWin32Error(); 841execHelper.m_revertImpersonateErrorCode = Marshal.GetLastWin32Error(); 873WinIOError(Marshal.GetLastWin32Error()); 1189int errorCode = Marshal.GetLastWin32Error(); 1215int errorCode = Marshal.GetLastWin32Error(); 1306int errorCode = Marshal.GetLastWin32Error(); 1340int errorCode = Marshal.GetLastWin32Error(); 1379WinIOError(Marshal.GetLastWin32Error());
System\IO\Pipes\PipeStream.cs (10)
652hr = Marshal.GetLastWin32Error(); 702hr = Marshal.GetLastWin32Error(); 760WinIOError(Marshal.GetLastWin32Error()); 843WinIOError(Marshal.GetLastWin32Error()); 871WinIOError(Marshal.GetLastWin32Error()); 899WinIOError(Marshal.GetLastWin32Error()); 931WinIOError(Marshal.GetLastWin32Error()); 948WinIOError(Marshal.GetLastWin32Error()); 1187secAttrs.nLength = (int)Marshal.SizeOf(secAttrs); 1210secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);
System\Linq\Parallel\Scheduling\Scheduling.cs (1)
90chunkSize = Math.Max(1, DEFAULT_BYTES_PER_CHUNK / Marshal.SizeOf(typeof(T)));
System\Runtime\InteropServices\ComAwareEventInfo.cs (2)
25if (Marshal.IsComObject(target)) { 47if (Marshal.IsComObject(target)) {
System\Security\Cryptography\AesCryptoServiceProvider.cs (2)
380throw new CryptographicException(Marshal.GetLastWin32Error()); 408throw new CryptographicException(Marshal.GetLastWin32Error());
System\Security\Cryptography\BCryptHashAlgorithm.cs (2)
135hashObjectBuffer = Marshal.AllocCoTaskMem(hashObjectSize); 158Marshal.FreeCoTaskMem(hashObjectBuffer);
System\Security\Cryptography\BCryptNative.cs (3)
608throw new CryptographicException(Marshal.GetLastWin32Error()); 622throw new CryptographicException(Marshal.GetLastWin32Error()); 628throw new CryptographicException(Marshal.GetLastWin32Error());
System\Security\Cryptography\CapiHashAlgorithm.cs (2)
81int error = Marshal.GetLastWin32Error(); 128throw new CryptographicException(Marshal.GetLastWin32Error());
System\Security\Cryptography\CapiNative.cs (27)
523int error = Marshal.GetLastWin32Error(); 556int error = Marshal.GetLastWin32Error(); 570throw new CryptographicException(Marshal.GetLastWin32Error()); 582int keyDataOffset = Marshal.SizeOf(typeof(BLOBHEADER)) + Marshal.SizeOf(typeof(int)); 585int keyLength = BitConverter.ToInt32(keyBlob, Marshal.SizeOf(typeof(BLOBHEADER))); 618throw new CryptographicException(Marshal.GetLastWin32Error()); 624throw new CryptographicException(Marshal.GetLastWin32Error()); 654int errorCode = Marshal.GetLastWin32Error(); 666Debug.Assert(Marshal.SizeOf(typeof(T)) <= bufferSize, "Buffer size does not match structure size"); 678buffer = Marshal.AllocCoTaskMem(bufferSize); 682throw new CryptographicException(Marshal.GetLastWin32Error()); 685return (T)Marshal.PtrToStructure(buffer, typeof(T)); 689Marshal.FreeCoTaskMem(buffer); 732int blobSize = Marshal.SizeOf(typeof(BLOBHEADER)) + Marshal.SizeOf(typeof(int)) + key.Length; 743int* pSize = (int *)(pBlob + Marshal.SizeOf(*pHeader)); 748Buffer.BlockCopy(key, 0, keyBlob, Marshal.SizeOf(typeof(BLOBHEADER)) + Marshal.SizeOf(typeof(int)), key.Length); 761throw new CryptographicException(Marshal.GetLastWin32Error()); 793throw new CryptographicException(Marshal.GetLastWin32Error()); 928CRYPT_OID_INFO pOIDInfo = new CRYPT_OID_INFO(Marshal.SizeOf(typeof(CRYPT_OID_INFO))); 934pOIDInfo = (CRYPT_OID_INFO)Marshal.PtrToStructure(pv, typeof(CRYPT_OID_INFO)); 958CRYPT_OID_INFO pOIDInfo = new CRYPT_OID_INFO(Marshal.SizeOf(typeof(CRYPT_OID_INFO))); 964pOIDInfo = (CRYPT_OID_INFO)Marshal.PtrToStructure(pv, typeof(CRYPT_OID_INFO)); 991return (T)Marshal.PtrToStructure(pBase, typeof(T)); 1028Marshal.Copy(arr, 0, pb.DangerousGetHandle(), arr.Length);
System\Security\Cryptography\CapiSymmetricAlgorithm.cs (2)
265throw new CryptographicException(Marshal.GetLastWin32Error()); 414throw new CryptographicException(Marshal.GetLastWin32Error());
System\Security\Cryptography\NCryptNative.cs (7)
1045hashAlgorithmString = Marshal.StringToCoTaskMemUni(hashAlgorithm); 1094Marshal.FreeCoTaskMem(hashAlgorithmString); 1493return Marshal.PtrToStringUni(new IntPtr(pValueBytes)); 1520return (T)Marshal.PtrToStructure(new IntPtr(pValue), typeof(T)); 1717byte[] buffer = new byte[Marshal.SizeOf(typeof(T))]; 1729Marshal.StructureToPtr(value, new IntPtr(pBuffer), false); 1737Marshal.DestroyStructure(new IntPtr(pBuffer), typeof(T));
System\Security\Cryptography\RsaCng.cs (3)
255int offset = Marshal.SizeOf(typeof(BCryptNative.BCRYPT_RSAKEY_BLOB)); 339int blobSize = Marshal.SizeOf(typeof(BCryptNative.BCRYPT_RSAKEY_BLOB)) + 369int offset = Marshal.SizeOf(typeof(BCryptNative.BCRYPT_RSAKEY_BLOB));
System\Security\Cryptography\X509Certificates\AuthenticodeSignatureInformation.cs (2)
36m_description = Marshal.PtrToStringUni(signer.pwszDescription); 39string descriptionUrl = Marshal.PtrToStringUni(signer.pwszDescriptionUrl);
System\Security\Cryptography\X509Certificates\ECDsaCertificateExtensions.cs (7)
44X509Native.CERT_CONTEXT pCertContext = (X509Native.CERT_CONTEXT)Marshal.PtrToStructure(certHandle, typeof(X509Native.CERT_CONTEXT)); 47(long)Marshal.OffsetOf(typeof(X509Native.CERT_INFO), "SubjectPublicKeyInfo")); 50(X509Native.CERT_PUBLIC_KEY_INFO)Marshal.PtrToStructure(pSubjectPublicKeyInfo, typeof(X509Native.CERT_PUBLIC_KEY_INFO)); 118X509Native.CERT_CONTEXT pCertContext = (X509Native.CERT_CONTEXT)Marshal.PtrToStructure(certHandle, typeof(X509Native.CERT_CONTEXT)); 121(long)Marshal.OffsetOf(typeof(X509Native.CERT_INFO), "SubjectPublicKeyInfo")); 123X509Native.CERT_PUBLIC_KEY_INFO certPublicKeyInfo = (X509Native.CERT_PUBLIC_KEY_INFO)Marshal.PtrToStructure(pSubjectPublicKeyInfo, 269string valueAsString = Marshal.PtrToStringUni((IntPtr)pValue);
System\Security\Cryptography\X509Certificates\RSACertificateExtensions.cs (2)
42throw new CryptographicException(Marshal.GetLastWin32Error()); 48Marshal.Copy(cngBlobHandle.DangerousGetHandle(), cngBlob, 0, cngBlob.Length);
System\Security\Cryptography\X509Certificates\X509Native.cs (5)
38(ErrorCode)Marshal.GetLastWin32Error() == ErrorCode.MoreData; 128ErrorCode errorCode = (ErrorCode)Marshal.GetLastWin32Error(); 139throw new CryptographicException(Marshal.GetLastWin32Error()); 156Debug.Assert(rawProperty.Length >= Marshal.SizeOf(typeof(T)), "Property did not return expected structure"); 160return (T)Marshal.PtrToStructure(new IntPtr(pRawProperty), typeof(T));
System\Security\Cryptography\Xml\ManifestSignedXml.cs (5)
173return HexStringToBytes(Marshal.PtrToStringUni(tokenBuffer.DangerousGetHandle())); 252timestamp = new TimestampInformation((SignatureVerificationResult)Marshal.GetHRForException(e)); 438actualKeyHash = Marshal.PtrToStringUni(issuerKeyBuffer.DangerousGetHandle()); 486signer.cbSize = Marshal.SizeOf(typeof(X509Native.AXL_AUTHENTICODE_SIGNER_INFO)); 489timestamper.cbsize = Marshal.SizeOf(typeof(X509Native.AXL_AUTHENTICODE_TIMESTAMPER_INFO));
System.Data (194)
cdf\src\NetFx40\Tools\System.Activities.Presentation\System\Activities\Presentation\View\DesignerView.Commands.cs (2)
1476dataObject = new DataObject((System.Runtime.InteropServices.ComTypes.IDataObject)Marshal.GetObjectForIUnknown(dataObjectPointer)); 1477Marshal.Release(dataObjectPointer);
fx\src\bid\inc\cs\bidPrivateBase.cs (1)
893BIDEXTINFO extInfo = new BIDEXTINFO(Marshal.GetHINSTANCE(mod),
fx\src\data\System\Data\Common\AdapterUtil.cs (2)
2085getComputerNameExError = Marshal.GetLastWin32Error(); 2094throw ADP.ComputerNameEx(Marshal.GetLastWin32Error());
fx\src\data\System\Data\OleDb\ColumnBinding.cs (7)
580value = Marshal.PtrToStringBSTR(ptr); 610Marshal.Copy(ptr, value, 0, value.Length); 651value = Marshal.PtrToStringUni(ptr, charCount); 911value = Marshal.GetObjectForIUnknown(ptr); 926IntPtr ptr = Marshal.GetIDispatchForObject(value); // MDAC 80727 940value = Marshal.GetObjectForIUnknown(ptr); 955IntPtr ptr = Marshal.GetIUnknownForObject(value); // MDAC 80727
fx\src\data\System\Data\OleDb\DBPropSet.cs (6)
128IntPtr rgProperties = Marshal.ReadIntPtr(ptr, offset); 130int cProperties = Marshal.ReadInt32(ptr, offset + ADP.PtrSize); 171Marshal.PtrToStructure(propertySetPtr, propset); 178Marshal.PtrToStructure(ptr, properties[i]); 223Marshal.StructureToPtr(propset, propsetPtr, false/*deleteold*/); 233Marshal.StructureToPtr(properties[i], propertyPtr, false/*deleteold*/);
fx\src\data\System\Data\OleDb\OLEDB_Util.cs (17)
506static internal readonly int SizeOf_tagDBBINDING = Marshal.SizeOf(typeof(tagDBBINDING)); 507static internal readonly int SizeOf_tagDBCOLUMNINFO = Marshal.SizeOf(typeof(tagDBCOLUMNINFO)); 508static internal readonly int SizeOf_tagDBLITERALINFO = Marshal.SizeOf(typeof(tagDBLITERALINFO)); 509static internal readonly int SizeOf_tagDBPROPSET = Marshal.SizeOf(typeof(tagDBPROPSET)); 510static internal readonly int SizeOf_tagDBPROP = Marshal.SizeOf(typeof(tagDBPROP)); 511static internal readonly int SizeOf_tagDBPROPINFOSET = Marshal.SizeOf(typeof(tagDBPROPINFOSET)); 512static internal readonly int SizeOf_tagDBPROPINFO = Marshal.SizeOf(typeof(tagDBPROPINFO)); 513static internal readonly int SizeOf_tagDBPROPIDSET = Marshal.SizeOf(typeof(tagDBPROPIDSET)); 514static internal readonly int SizeOf_Guid = Marshal.SizeOf(typeof(Guid)); 517static internal readonly int OffsetOf_tagDBPROP_Status = Marshal.OffsetOf(typeof(tagDBPROP), "dwStatus").ToInt32(); 518static internal readonly int OffsetOf_tagDBPROP_Value = Marshal.OffsetOf(typeof(tagDBPROP), "vValue").ToInt32(); 519static internal readonly int OffsetOf_tagDBPROPSET_Properties = Marshal.OffsetOf(typeof(tagDBPROPSET), "rgProperties").ToInt32(); 520static internal readonly int OffsetOf_tagDBPROPINFO_Value = Marshal.OffsetOf(typeof(tagDBPROPINFO), "vValue").ToInt32(); 521static internal readonly int OffsetOf_tagDBPROPIDSET_PropertySet = Marshal.OffsetOf(typeof(tagDBPROPIDSET), "guidPropertySet").ToInt32(); 522static internal readonly int OffsetOf_tagDBLITERALINFO_it = Marshal.OffsetOf(typeof(tagDBLITERALINFO), "it").ToInt32(); 523static internal readonly int OffsetOf_tagDBBINDING_obValue = Marshal.OffsetOf(typeof(tagDBBINDING), "obValue").ToInt32(); 524static internal readonly int OffsetOf_tagDBBINDING_wType = Marshal.OffsetOf(typeof(tagDBBINDING), "wType").ToInt32();
fx\src\data\System\Data\OleDb\OleDbCommand.cs (2)
513Marshal.ReleaseComObject(ict); 672Marshal.ReleaseComObject(executeResult);
fx\src\data\System\Data\OleDb\OleDbConnection.cs (1)
611Marshal.ReleaseComObject(errorInfo);
fx\src\data\System\Data\OleDb\OleDbConnectionInternal.cs (7)
269Marshal.ReleaseComObject(unknown); 401Marshal.PtrToStructure((IntPtr)offset, tag); 512if ((1 == literalCount) && Marshal.ReadInt32(literalInfo, ODB.OffsetOf_tagDBLITERALINFO_it) == literal) { // WebData 98612 513literalValue = Marshal.PtrToStringUni(Marshal.ReadIntPtr(literalInfo, 0)); 554supportedSchemas[i]._schemaRowset = (Guid) Marshal.PtrToStructure(ptr, typeof(Guid)); 559supportedSchemas[i]._restrictions = Marshal.ReadInt32(schemaRestrictions, i * 4);
fx\src\data\System\Data\OleDb\OleDbDataReader.cs (7)
467Marshal.PtrToStructure(ADP.IntPtrOffset(columnInfos, offset), dbColumnInfo); 528info.idname = Marshal.PtrToStringUni(dbColumnInfo.columnid.ulPropid); 587Marshal.ReleaseComObject(rowset); 643Marshal.ReleaseComObject(multipleResults); 725Marshal.ReleaseComObject(imultipleResults); 741Marshal.ReleaseComObject(irowset); 750Marshal.ReleaseComObject(irow);
fx\src\data\System\Data\OleDb\OleDbError.cs (4)
38Marshal.ReleaseComObject(errorInfo); 63Marshal.ReleaseComObject(errorInfo); 82Marshal.ReleaseComObject(errorInfo); 97Marshal.ReleaseComObject(sqlErrorInfo);
fx\src\data\System\Data\OleDb\OleDbTransaction.cs (1)
195Marshal.ReleaseComObject(wrapper);
fx\src\data\System\Data\OleDb\OleDbWrapper.cs (33)
35base.handle = Marshal.GetComInterfaceForObject(unknown, typeof(UnsafeNativeMethods.IDataInitialize)); // 40IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 41IntPtr method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); // GetDataSource is the 4'th vtable entry 42DangerousIDataInitializeGetDataSource = (UnsafeNativeMethods.IDataInitializeGetDataSource)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IDataInitializeGetDataSource)); 104IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 105IntPtr method = Marshal.ReadIntPtr(vtable, 0); 112if ((null == QueryInterface) || (method != Marshal.GetFunctionPointerForDelegate(QueryInterface))) { 113QueryInterface = (UnsafeNativeMethods.IUnknownQueryInterface)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IUnknownQueryInterface)); 120vtable = Marshal.ReadIntPtr(base.handle, 0); 121method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); // Initialize is the 4'th vtable entry 128if ((null == Initialize) || (method != Marshal.GetFunctionPointerForDelegate(Initialize))) { 129Initialize = (UnsafeNativeMethods.IDBInitializeInitialize)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IDBInitializeInitialize)); 146vtable = Marshal.ReadIntPtr(idbCreateSession, 0); 147method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); // CreateSession is the 4'th vtable entry 153if ((null == CreateSession) || (method != Marshal.GetFunctionPointerForDelegate(CreateSession))) { 154CreateSession = (UnsafeNativeMethods.IDBCreateSessionCreateSession)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IDBCreateSessionCreateSession)); 181Marshal.Release(idbCreateSession); 242IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 243IntPtr method = Marshal.ReadIntPtr(vtable, 0); 244UnsafeNativeMethods.IUnknownQueryInterface QueryInterface = (UnsafeNativeMethods.IUnknownQueryInterface)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IUnknownQueryInterface)); 248vtable = Marshal.ReadIntPtr(idbCreateCommand, 0); 249method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); 251DangerousIDBCreateCommandCreateCommand = (UnsafeNativeMethods.IDBCreateCommandCreateCommand)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IDBCreateCommandCreateCommand)); 262Marshal.Release(ptr); 279IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 280IntPtr method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); 287if ((null == CreateCommand) || (method != Marshal.GetFunctionPointerForDelegate(CreateCommand))) { 288CreateCommand = (UnsafeNativeMethods.IDBCreateCommandCreateCommand)Marshal.GetDelegateForFunctionPointer(method, typeof(UnsafeNativeMethods.IDBCreateCommandCreateCommand)); 357Marshal.ReleaseComObject(unknown); 384Marshal.ReleaseComObject(unknown); 409Marshal.ReleaseComObject(unknown); 436Marshal.ReleaseComObject(unknown); 461Marshal.ReleaseComObject(unknown);
fx\src\data\System\Data\OleDb\PropertyIDSet.cs (5)
36Marshal.WriteIntPtr(base.handle, 0, ptr); 38Marshal.WriteInt32(base.handle, ADP.PtrSize, /*propertyid count*/1); 41Marshal.StructureToPtr(propertySet, ptr, false/*deleteold*/); 44Marshal.WriteInt32(base.handle, PropertyIDSetSize, propertyID); 52Marshal.StructureToPtr(propertySets[i], ptr, false/*deleteold*/);
fx\src\data\System\Data\OleDb\PropertyInfoSet.cs (4)
78Marshal.PtrToStructure(setPtr, propinfoset); 83Marshal.PtrToStructure(infoPtr, propinfo); 119IntPtr infoPtr = Marshal.ReadIntPtr(ptr, offset); 121int infoCount = Marshal.ReadInt32(ptr, offset + ADP.PtrSize);
fx\src\data\System\Data\OleDb\RowBinding.cs (17)
137Marshal.StructureToPtr(dbbindings[i], ptr, false/*deleteold*/); 176value = Marshal.GetObjectForNativeVariant(buffer); 206Marshal.GetNativeVariantForObject(value, buffer); 241Marshal.WriteIntPtr(base.handle, offset, ptr); 242Marshal.WriteIntPtr(base.handle, offset + ADP.PtrSize, ptr); 271Marshal.WriteIntPtr(base.handle, offset, pinnedValue); // parameter input value 272Marshal.WriteIntPtr(base.handle, offset + ADP.PtrSize, pinnedValue); // original parameter value 358int valueOffset = _headerLength + Marshal.ReadIntPtr(ptr, ODB.OffsetOf_tagDBBINDING_obValue).ToInt32(); 359short wtype = Marshal.ReadInt16(ptr, ODB.OffsetOf_tagDBBINDING_wType); 447IntPtr currentValue = Marshal.ReadIntPtr(buffer, valueOffset); 448IntPtr originalValue = Marshal.ReadIntPtr(buffer, valueOffset + ADP.PtrSize); 458Marshal.WriteIntPtr(buffer, valueOffset, ADP.PtrZero); 459Marshal.WriteIntPtr(buffer, valueOffset + ADP.PtrSize, ADP.PtrZero); 471IntPtr currentValue = Marshal.ReadIntPtr(buffer, valueOffset); 472IntPtr originalValue = Marshal.ReadIntPtr(buffer, valueOffset + ADP.PtrSize); 480Marshal.WriteIntPtr(buffer, valueOffset, ADP.PtrZero); 481Marshal.WriteIntPtr(buffer, valueOffset + ADP.PtrSize, ADP.PtrZero);
fx\src\data\System\Data\ProviderBase\DbBuffer.cs (22)
79value = Marshal.PtrToStringUni(ptr, length); 102value = Marshal.PtrToStringUni(ptr, length); 124value = Marshal.ReadByte(ptr, offset); 152Marshal.Copy(ptr, destination, startIndex, length); 180Marshal.Copy(ptr, destination, startIndex, length); 207value = Marshal.ReadInt16(ptr, offset); 230Marshal.Copy(ptr, destination, startIndex, length); 251value = Marshal.ReadInt32(ptr, offset); 274Marshal.Copy(ptr, destination, startIndex, length); 295value = Marshal.ReadInt64(ptr, offset); 317value = Marshal.ReadIntPtr(ptr, offset); 345ValidateCheck(offset, Marshal.SizeOf(structure.GetType())); 354Marshal.StructureToPtr(structure, ptr, false/*fDeleteOld*/); 374Marshal.WriteByte(ptr, offset, value); 396Marshal.Copy(source, startIndex, ptr, length); 418Marshal.Copy(source, startIndex, ptr, length); 442Marshal.WriteInt16(ptr, offset, value); 464Marshal.Copy(source, startIndex, ptr, length); 484Marshal.WriteInt32(ptr, offset, value); 506Marshal.Copy(source, startIndex, ptr, length); 526Marshal.WriteInt64(ptr, offset, value); 546Marshal.WriteIntPtr(ptr, offset, value);
fx\src\data\System\Data\ProviderBase\DbConnectionPool.cs (4)
1262waitForMultipleObjectsExHR = Marshal.GetHRForLastWin32Error(); 1360Marshal.ThrowExceptionForHR(waitForMultipleObjectsExHR); 1384releaseSemaphoreResult = Marshal.GetHRForLastWin32Error(); 1392Marshal.ThrowExceptionForHR(releaseSemaphoreResult); // will only throw if (hresult < 0)
fx\src\data\System\Data\ProviderBase\DbConnectionPoolIdentity.cs (4)
161SID = Marshal.ReadIntPtr(tokenStruct, 0); 171string sidString = Marshal.PtrToStringUni(sidStringBuffer); 203int lastError = Marshal.GetHRForLastWin32Error(); 205Marshal.ThrowExceptionForHR(lastError); // will only throw if (hresult < 0)
fx\src\data\System\Data\ProviderBase\WrappedIUnknown.cs (2)
35base.handle = Marshal.GetIUnknownForObject(unknown); // 71Marshal.Release(ptr);
fx\src\data\System\Data\Sql\sqlnorm.cs (1)
92int offset = Marshal.OffsetOf(fi.DeclaringType, fi.Name).ToInt32();
fx\src\data\System\Data\SqlClient\LocalDBAPI.cs (4)
123int hResult=Marshal.GetLastWin32Error(); 127s_localDBCreateInstance = (LocalDBCreateInstanceDelegate)Marshal.GetDelegateForFunctionPointer(functionAddr, typeof(LocalDBCreateInstanceDelegate)); 165int hResult=Marshal.GetLastWin32Error(); 169s_localDBFormatMessage = (LocalDBFormatMessageDelegate)Marshal.GetDelegateForFunctionPointer(functionAddr, typeof(LocalDBFormatMessageDelegate));
fx\src\data\System\Data\SqlClient\SqlConnection.cs (24)
2152MEMMAP memMap = (MEMMAP)Marshal.PtrToStructure(sdc.pMemMap, typeof(MEMMAP)); 2347pNtAuthority = Marshal.AllocHGlobal(sizeofSID_IDENTIFIER_AUTHORITY); 2350Marshal.WriteInt32(pNtAuthority, 0, 0); 2351Marshal.WriteByte(pNtAuthority, 4, 0); 2352Marshal.WriteByte(pNtAuthority, 5, SECURITY_NT_AUTHORITY); 2389pSecurityDescriptor = Marshal.AllocHGlobal(sizeofSECURITY_DESCRIPTOR); 2394Marshal.WriteByte(pSecurityDescriptor, i, (byte)0); 2401pDacl = Marshal.AllocHGlobal(cbAcl); 2417Marshal.FreeHGlobal(pNtAuthority); 2427Marshal.FreeHGlobal(pSecurityDescriptor); 2476pSecurityAttributes = Marshal.AllocHGlobal(sizeofSECURITY_ATTRIBUTES); 2480Marshal.WriteInt32(pSecurityAttributes, 0, sizeofSECURITY_ATTRIBUTES); // nLength = sizeof(SECURITY_ATTRIBUTES) 2481Marshal.WriteIntPtr(pSecurityAttributes, 4, pSecurityDescriptor); // lpSecurityDescriptor = pSecurityDescriptor 2482Marshal.WriteInt32(pSecurityAttributes, 8, 0); // bInheritHandle = FALSE 2488Marshal.SizeOf(typeof(MEMMAP)), 2511Marshal.WriteInt32(pMemMap, offset, (int)dwpidDebugger); 2513Marshal.WriteInt32(pMemMap, offset, (int)dwOption); 2515Marshal.Copy(rgbMachineName, 0, ADP.IntPtrOffset(pMemMap, offset), rgbMachineName.Length); 2517Marshal.Copy(rgbSDIDLLName, 0, ADP.IntPtrOffset(pMemMap, offset), rgbSDIDLLName.Length); 2519Marshal.WriteInt32(pMemMap, offset, (int)cbData); 2522Marshal.Copy(rgbData, 0, ADP.IntPtrOffset(pMemMap, offset), (int)cbData); 2532Marshal.FreeHGlobal(pSecurityAttributes); 2534Marshal.FreeHGlobal(pSecurityDescriptor); 2536Marshal.FreeHGlobal(pDacl);
fx\src\data\System\Data\SQLTypes\SQLFileStream.cs (16)
683oa.length = Marshal.SizeOf(typeof(UnsafeNativeMethods.OBJECT_ATTRIBUTES)); 769System.ComponentModel.Win32Exception e = new System.ComponentModel.Win32Exception ( Marshal.GetLastWin32Error() ); 872Marshal.FreeHGlobal(base.handle); 895pbBuffer = Marshal.AllocHGlobal ( Marshal.SizeOf ( objectName ) ); 907Marshal.StructureToPtr ( objectName, ptr, false ); 964m_qos.length = (uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.SECURITY_QUALITY_OF_SERVICE)); 1021Marshal.FreeHGlobal(base.handle); 1053m_cbBuffer = Marshal.SizeOf(eaBuffer) + eaBuffer.EaNameLength + eaBuffer.EaValueLength; 1062pbBuffer = Marshal.AllocHGlobal(m_cbBuffer); 1075Marshal.StructureToPtr(eaBuffer, ptr, false); 1082System.Diagnostics.Debug.Assert(Marshal.OffsetOf(typeof(UnsafeNativeMethods.FILE_FULL_EA_INFORMATION), "EaName").ToInt64() <= (Int64) Int32.MaxValue); 1083int cbOffset = Marshal.OffsetOf(typeof(UnsafeNativeMethods.FILE_FULL_EA_INFORMATION), "EaName").ToInt32(); 1086Marshal.WriteByte(ptr, cbOffset, asciiName[i]); 1092Marshal.WriteByte(ptr, cbOffset, 0); 1100Marshal.WriteByte(ptr, cbOffset, transactionContext[i]);
fx\src\data\System\Data\SQLTypes\UnsafeNativeMethods.cs (1)
92int lastError = Marshal.GetLastWin32Error();
System.Drawing (403)
commonui\System\Drawing\Advanced\BitmapData.cs (1)
14using Marshal = System.Runtime.InteropServices.Marshal;
commonui\System\Drawing\Advanced\ColorPalette.cs (7)
68flags = Marshal.ReadInt32(memory); 72size = Marshal.ReadInt32((IntPtr)((long)memory + 4)); // Marshal.SizeOf(size.GetType()) 79int argb = Marshal.ReadInt32((IntPtr)((long)memory + 8 + i*4)); 93IntPtr memory = Marshal.AllocHGlobal(checked(4 * (2 + length))); 95Marshal.WriteInt32(memory, 0, flags); 97Marshal.WriteInt32((IntPtr)checked((long)memory + 4), 0, length); 102Marshal.WriteInt32((IntPtr)((long)memory + 4*(i+2)), 0, entries[i].ToArgb());
commonui\System\Drawing\Advanced\EncoderParameter.cs (57)
89Marshal.FreeHGlobal(parameterValue); 103parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Byte))); 108Marshal.WriteByte(parameterValue, value); 125parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Byte))); 130Marshal.WriteByte(parameterValue, value); 144parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int16))); 149Marshal.WriteInt16(parameterValue, value); 163parameterValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32))); 168Marshal.WriteInt32(parameterValue, unchecked((int)value)); 183int size = Marshal.SizeOf(typeof(Int32)); 184parameterValue = Marshal.AllocHGlobal(2*size); 189Marshal.WriteInt32(parameterValue, numerator); 190Marshal.WriteInt32(Add(parameterValue, size), denominator); 205int size = Marshal.SizeOf(typeof(Int32)); 206parameterValue = Marshal.AllocHGlobal(2*size); 211Marshal.WriteInt32(parameterValue, unchecked((int)rangebegin)); 212Marshal.WriteInt32(Add(parameterValue, size), unchecked((int)rangeend)); 229int size = Marshal.SizeOf(typeof(Int32)); 230parameterValue = Marshal.AllocHGlobal(4*size); 235Marshal.WriteInt32(parameterValue, numerator1); 236Marshal.WriteInt32(Add(parameterValue, size), demoninator1); 237Marshal.WriteInt32(Add(parameterValue, 2*size), numerator2); 238Marshal.WriteInt32(Add(parameterValue, 3*size), demoninator2); 252parameterValue = Marshal.StringToHGlobalAnsi(value); 270parameterValue = Marshal.AllocHGlobal(numberOfValues); 275Marshal.Copy(value, 0, parameterValue, numberOfValues); 293parameterValue = Marshal.AllocHGlobal(numberOfValues); 298Marshal.Copy(value, 0, parameterValue, numberOfValues); 312int size = Marshal.SizeOf(typeof(short)); 314parameterValue = Marshal.AllocHGlobal(checked(numberOfValues*size)); 319Marshal.Copy(value, 0, parameterValue, numberOfValues); 333int size = Marshal.SizeOf(typeof(Int32)); 335parameterValue = Marshal.AllocHGlobal(checked(numberOfValues*size)); 363int size = Marshal.SizeOf(typeof(Int32)); 365parameterValue = Marshal.AllocHGlobal(checked(numberOfValues*2*size)); 372Marshal.WriteInt32(Add(i*2*size, parameterValue), (int)numerator[i]); 373Marshal.WriteInt32(Add((i*2+1)*size, parameterValue), (int)denominator[i]); 392int size = Marshal.SizeOf(typeof(Int32)); 394parameterValue = Marshal.AllocHGlobal(checked(numberOfValues*2*size)); 401Marshal.WriteInt32(Add(i*2*size, parameterValue), unchecked((int)rangebegin[i])); 402Marshal.WriteInt32(Add((i*2+1)*size, parameterValue), unchecked((int)rangeend[i])); 425int size = Marshal.SizeOf(typeof(Int32)); 427parameterValue = Marshal.AllocHGlobal(checked(numberOfValues*4*size)); 434Marshal.WriteInt32(Add(parameterValue, 4*i*size), numerator1[i]); 435Marshal.WriteInt32(Add(parameterValue, (4*i+1)*size), denominator1[i]); 436Marshal.WriteInt32(Add(parameterValue, (4*i+2)*size), numerator2[i]); 437Marshal.WriteInt32(Add(parameterValue, (4*i+3)*size), denominator2[i]); 472parameterValue = Marshal.AllocHGlobal(bytes); 479Marshal.WriteByte(Add(parameterValue, i), Marshal.ReadByte((IntPtr)(Value + i))); 516parameterValue = Marshal.AllocHGlobal(bytes); 523Marshal.WriteByte(Add(parameterValue, i), Marshal.ReadByte((IntPtr)(value + i)));
commonui\System\Drawing\Advanced\EncoderParameters.cs (13)
16using Marshal = System.Runtime.InteropServices.Marshal; 78int size = Marshal.SizeOf(typeof(EncoderParameter)); 81IntPtr memory = Marshal.AllocHGlobal(checked(length * size + Marshal.SizeOf(typeof(IntPtr)))); 87Marshal.WriteIntPtr(memory, (IntPtr) length); 89long arrayOffset = checked((long) memory + Marshal.SizeOf(typeof(IntPtr))); 92Marshal.StructureToPtr(param[i], (IntPtr) (arrayOffset + i * size), false); 108int count = Marshal.ReadIntPtr(memory).ToInt32(); 111int size = Marshal.SizeOf(typeof(EncoderParameter)); 112long arrayOffset = (long)memory + Marshal.SizeOf(typeof(IntPtr)); 120int numberOfValues = Marshal.ReadInt32((IntPtr)( i * size + arrayOffset + 16)); 121EncoderParameterValueType type = (EncoderParameterValueType) Marshal.ReadInt32((IntPtr)(i * size + arrayOffset + 20)); 122IntPtr value = Marshal.ReadIntPtr((IntPtr)(i * size + arrayOffset + 24));
commonui\System\Drawing\Advanced\Font.cs (15)
453if (Marshal.SystemDefaultCharSize == 1) 469if (Marshal.SystemDefaultCharSize == 1) { 470gdiVerticalFont = (Marshal.ReadByte(lf, LogFontNameOffset) == (byte)(short)'@'); 473gdiVerticalFont = (Marshal.ReadInt16(lf, LogFontNameOffset) == (short)'@'); 476return new Font(font, Marshal.ReadByte(lf, LogFontCharSetOffset), gdiVerticalFont); 832if (Marshal.SystemDefaultCharSize == 1) 841if (Marshal.SystemDefaultCharSize == 1) { 846Marshal.WriteByte(logFont, 848Marshal.ReadByte(logFont, LogFontNameOffset + i)); 853Marshal.WriteByte(logFont, LogFontNameOffset, (byte)(int)'@'); 859Marshal.WriteInt16(logFont, 861Marshal.ReadInt16(logFont, LogFontNameOffset + i)); 866Marshal.WriteInt16(logFont, LogFontNameOffset, (short)'@'); 870if (Marshal.ReadByte(logFont, LogFontCharSetOffset) == 0) { 871Marshal.WriteByte(logFont, LogFontCharSetOffset, gdiCharSet);
commonui\System\Drawing\Advanced\Gdiplus.cs (16)
3219int size = (int)Marshal.SizeOf(pt.GetType()); 3241int size = (int)Marshal.SizeOf(pt.GetType()); 3260int size = (int)Marshal.SizeOf(typeof(GPPOINTF)); 3263IntPtr memory = Marshal.AllocHGlobal(checked(count*size)); 3266Marshal.StructureToPtr(new GPPOINTF(points[index]), (IntPtr)(checked((long)memory+index*size)), false); 3281int size = (int)Marshal.SizeOf(typeof(GPPOINT)); 3284IntPtr memory = Marshal.AllocHGlobal(checked(count*size)); 3287Marshal.StructureToPtr(new GPPOINT(points[index]), (IntPtr)(checked((long)memory+index*size)), false); 3302int size = (int)Marshal.SizeOf(typeof(GPRECTF)); 3305IntPtr memory = Marshal.AllocHGlobal(checked(count*size)); 3308Marshal.StructureToPtr(new GPRECTF(rect[index]), (IntPtr)(checked((long)memory+index*size)), false); 3323int size = (int)Marshal.SizeOf(typeof(GPRECT)); 3326IntPtr memory = Marshal.AllocHGlobal(checked(count*size)); 3329Marshal.StructureToPtr(new GPRECT(rect[index]), (IntPtr)(checked((long)memory+index*size)), false); 4079if (Marshal.SystemDefaultCharSize == 1) { 4879return GetObject(hObject, System.Runtime.InteropServices.Marshal.SizeOf(typeof(SafeNativeMethods.LOGFONT)), lp);
commonui\System\Drawing\Advanced\GPStream.cs (5)
74IntPtr buffer = Marshal.AllocHGlobal(bufsize); 90Marshal.FreeHGlobal(buffer); 118Marshal.Copy(buffer, 0, buf, length); 182Marshal.StructureToPtr(stats, pstatstg, true); 190Marshal.Copy(buf, buffer, 0, length);
commonui\System\Drawing\Advanced\GraphicsPath.cs (38)
104IntPtr typebuf = Marshal.AllocHGlobal(count); 106Marshal.Copy(types, 0, typebuf, count); 115Marshal.FreeHGlobal(ptbuf); 116Marshal.FreeHGlobal(typebuf); 157IntPtr typebuf = Marshal.AllocHGlobal(count); 159Marshal.Copy(types, 0, typebuf, count); 166Marshal.FreeHGlobal(ptbuf); 167Marshal.FreeHGlobal(typebuf); 302int ptSize = (int) Marshal.SizeOf(typeof(GPPOINTF)); 309IntPtr memoryPathData = Marshal.AllocHGlobal(3*IntPtr.Size); 310IntPtr memoryPoints = Marshal.AllocHGlobal(checked(ptSize*numPts)); 317Marshal.StructureToPtr(numPts, memoryPathData, false); 318Marshal.StructureToPtr(memoryPoints, (IntPtr)((long)memoryPathData+IntPtr.Size), false); 319Marshal.StructureToPtr(typesPtr, (IntPtr)((long)memoryPathData+2*IntPtr.Size), false); 332Marshal.FreeHGlobal(memoryPathData); 333Marshal.FreeHGlobal(memoryPoints); 717Marshal.FreeHGlobal(buf); 761Marshal.FreeHGlobal(buf); 868Marshal.FreeHGlobal(buf); 915Marshal.FreeHGlobal(buf); 940Marshal.FreeHGlobal(buf); 958Marshal.FreeHGlobal(buf); 980Marshal.FreeHGlobal(buf); 1001Marshal.FreeHGlobal(buf); 1021Marshal.FreeHGlobal(buf); 1043Marshal.FreeHGlobal(buf); 1064Marshal.FreeHGlobal(buf); 1084Marshal.FreeHGlobal(buf); 1105Marshal.FreeHGlobal(buf); 1125Marshal.FreeHGlobal(buf); 1157Marshal.FreeHGlobal(buf); 1191Marshal.FreeHGlobal(buf); 1310Marshal.FreeHGlobal(buf); 1328Marshal.FreeHGlobal(buf); 1663Marshal.FreeHGlobal(buf); 1722int size = (int) Marshal.SizeOf(typeof(GPPOINTF)); 1723IntPtr buf = Marshal.AllocHGlobal(checked(count * size)); 1734Marshal.FreeHGlobal(buf);
commonui\System\Drawing\Advanced\GraphicsPathIterator.cs (6)
270int size = (int)Marshal.SizeOf(typeof(GPPOINTF)); 274IntPtr memoryPts = Marshal.AllocHGlobal(checked(count * size)); 290Marshal.FreeHGlobal(memoryPts); 312int size = (int)Marshal.SizeOf(typeof(GPPOINTF)); 316IntPtr memoryPts = Marshal.AllocHGlobal(checked(count * size)); 332Marshal.FreeHGlobal(memoryPts);
commonui\System\Drawing\Advanced\ImageAttributes.cs (5)
621IntPtr memory = Marshal.AllocHGlobal(checked(mapSize*size*2)); 625Marshal.StructureToPtr(map[index].OldColor.ToArgb(), (IntPtr)((long)memory+index*size*2), false); 626Marshal.StructureToPtr(map[index].NewColor.ToArgb(), (IntPtr)((long)memory+index*size*2+size), false); 641Marshal.FreeHGlobal(memory); 741Marshal.FreeHGlobal(memory);
commonui\System\Drawing\Advanced\ImageCodecInfo.cs (12)
161IntPtr memory = Marshal.AllocHGlobal(size); 173Marshal.FreeHGlobal(memory); 194IntPtr memory = Marshal.AllocHGlobal(size); 206Marshal.FreeHGlobal(memory); 269IntPtr curcodec = (IntPtr)((long)memoryStart + (int)Marshal.SizeOf(typeof(ImageCodecInfoPrivate))*index); 276codecs[index].CodecName = Marshal.PtrToStringUni(codecp.CodecName); 277codecs[index].DllName = Marshal.PtrToStringUni(codecp.DllName); 278codecs[index].FormatDescription = Marshal.PtrToStringUni(codecp.FormatDescription); 279codecs[index].FilenameExtension = Marshal.PtrToStringUni(codecp.FilenameExtension); 280codecs[index].MimeType = Marshal.PtrToStringUni(codecp.MimeType); 293Marshal.Copy((IntPtr)((long)codecp.SigMask + j*codecp.SigSize), codecs[index].SignatureMasks[j], 0, codecp.SigSize); 294Marshal.Copy((IntPtr)((long)codecp.SigPattern + j*codecp.SigSize), codecs[index].SignaturePatterns[j], 0, codecp.SigSize);
commonui\System\Drawing\Advanced\LinearGradientBrush.cs (24)
425factors = Marshal.AllocHGlobal(size); 426positions = Marshal.AllocHGlobal(size); 438Marshal.Copy(factors, blend.Factors, 0, count); 439Marshal.Copy(positions, blend.Positions, 0, count); 443Marshal.FreeHGlobal(factors); 446Marshal.FreeHGlobal(positions); 464factors = Marshal.AllocHGlobal(size); 465positions = Marshal.AllocHGlobal(size); 467Marshal.Copy(blend.Factors, 0, factors, count); 468Marshal.Copy(blend.Positions, 0, positions, count); 480Marshal.FreeHGlobal(factors); 483Marshal.FreeHGlobal(positions); 580colors = Marshal.AllocHGlobal(size); 581positions = Marshal.AllocHGlobal(size); 596Marshal.Copy(colors, argb, 0, count); 597Marshal.Copy(positions, blend.Positions, 0, count); 608Marshal.FreeHGlobal(colors); 611Marshal.FreeHGlobal(positions); 658colors = Marshal.AllocHGlobal(size); 659positions = Marshal.AllocHGlobal(size); 666Marshal.Copy(argbs, 0, colors, count); 667Marshal.Copy(blend.Positions, 0, positions, count); 679Marshal.FreeHGlobal(colors); 682Marshal.FreeHGlobal(positions);
commonui\System\Drawing\Advanced\Matrix.cs (9)
103Marshal.FreeHGlobal(buf); 138Marshal.FreeHGlobal(buf); 193IntPtr buf = Marshal.AllocHGlobal(6 * 8); // 6 elements x 8 bytes (float) 204Marshal.Copy(buf, m, 0, 6); 208Marshal.FreeHGlobal(buf); 456Marshal.FreeHGlobal(buf); 489Marshal.FreeHGlobal(buf); 521Marshal.FreeHGlobal(buf); 562Marshal.FreeHGlobal(buf);
commonui\System\Drawing\Advanced\Metafile.cs (12)
818IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); 829Marshal.Copy(memory, type, 0, 1); 845Marshal.FreeHGlobal(memory); 863IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); 874Marshal.Copy(memory, type, 0, 1); 892Marshal.FreeHGlobal(memory); 910IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); 921Marshal.Copy(memory, type, 0, 1); 939Marshal.FreeHGlobal(memory);
commonui\System\Drawing\Advanced\MetafileHeaderWmf.cs (1)
25public int size = Marshal.SizeOf(typeof(MetafileHeaderWmf));
commonui\System\Drawing\Advanced\PathGradientBrush.cs (26)
84Marshal.FreeHGlobal(pointsBuf); 144Marshal.FreeHGlobal(pointsBuf); 379factors = Marshal.AllocHGlobal(size); 380positions = Marshal.AllocHGlobal(size); 394Marshal.Copy(factors, blend.Factors, 0, count); 395Marshal.Copy(positions, blend.Positions, 0, count); 400Marshal.FreeHGlobal(factors); 403Marshal.FreeHGlobal(positions); 421factors = Marshal.AllocHGlobal(size); 422positions = Marshal.AllocHGlobal(size); 424Marshal.Copy(blend.Factors, 0, factors, count); 425Marshal.Copy(blend.Positions, 0, positions, count); 437Marshal.FreeHGlobal(factors); 440Marshal.FreeHGlobal(positions); 543colors = Marshal.AllocHGlobal(size); 544positions = Marshal.AllocHGlobal(size); 559Marshal.Copy(colors, argb, 0, count); 560Marshal.Copy(positions, blend.Positions, 0, count); 571Marshal.FreeHGlobal(colors); 574Marshal.FreeHGlobal(positions); 592colors = Marshal.AllocHGlobal(size); 593positions = Marshal.AllocHGlobal(size); 600Marshal.Copy(argbs, 0, colors, count); 601Marshal.Copy(blend.Positions, 0, positions, count); 613Marshal.FreeHGlobal(colors); 616Marshal.FreeHGlobal(positions);
commonui\System\Drawing\Bitmap.cs (2)
377IntPtr name = Marshal.StringToHGlobalUni(bitmapName); 382Marshal.FreeHGlobal(name);
commonui\System\Drawing\BufferedGraphicsContext.cs (2)
259pbmi.bmiHeader_biSize = Marshal.SizeOf(typeof(NativeMethods.BITMAPINFOHEADER)); 492ex = new Win32Exception(Marshal.GetLastWin32Error());
commonui\System\Drawing\Graphics.cs (38)
1082Marshal.FreeHGlobal(buf); 1114Marshal.FreeHGlobal(buf); 1191Marshal.FreeHGlobal(buf); 1247Marshal.FreeHGlobal(buf); 1363Marshal.FreeHGlobal(buf); 1399Marshal.FreeHGlobal(buf); 1476Marshal.FreeHGlobal(buf); 1503Marshal.FreeHGlobal(buf); 1651Marshal.FreeHGlobal(buf); 1676Marshal.FreeHGlobal(buf); 1723Marshal.FreeHGlobal(buf); 1749Marshal.FreeHGlobal(buf); 1785Marshal.FreeHGlobal(buf); 1811Marshal.FreeHGlobal(buf); 1836Marshal.FreeHGlobal(buf); 1863Marshal.FreeHGlobal(buf); 1890Marshal.FreeHGlobal(buf); 1916Marshal.FreeHGlobal(buf); 1942Marshal.FreeHGlobal(buf); 1967Marshal.FreeHGlobal(buf); 2066Marshal.FreeHGlobal(buf); 2093Marshal.FreeHGlobal(buf); 2130Marshal.FreeHGlobal(buf); 2166Marshal.FreeHGlobal(buf); 2325Marshal.FreeHGlobal(buf); 2360Marshal.FreeHGlobal(buf); 2386Marshal.FreeHGlobal(buf); 2418Marshal.FreeHGlobal(buf); 2943Marshal.FreeHGlobal(buf); 2976Marshal.FreeHGlobal(buf); 3146Marshal.FreeHGlobal(buf); 3204Marshal.FreeHGlobal(buf); 3270Marshal.FreeHGlobal(buf); 3567Marshal.FreeHGlobal(points); 3613Marshal.FreeHGlobal(points); 3849Marshal.FreeHGlobal(buffer); 3911Marshal.FreeHGlobal(buffer); 4620int error = Marshal.GetLastWin32Error();
commonui\System\Drawing\Icon.cs (8)
331SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); 336SafeNativeMethods.GetObject(new HandleRef(null, info.hbmMask), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); 611int icondirSize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIR)); 658int icondirEntrySize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIRENTRY)); 887Marshal.ReleaseComObject(picture); 979int newOffset = bestImageOffset + Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER)); 986Marshal.Copy(iconData, newOffset + j * width, (IntPtr)pixelPtr, lineLength); 1005SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp);
commonui\System\Drawing\Image.cs (17)
541IntPtr buffer = Marshal.AllocHGlobal(size); 556Marshal.FreeHGlobal(buffer); 636Marshal.FreeHGlobal(encoderParamsMemory); 724Marshal.FreeHGlobal(encoderParamsMemory); 751Marshal.FreeHGlobal(encoder); 780Marshal.FreeHGlobal(encoder); 993IntPtr memory = Marshal.AllocHGlobal(size); 1005Marshal.FreeHGlobal(memory); 1017Marshal.FreeHGlobal(memory); 1084int size = (int) Marshal.SizeOf(typeof(Guid)); 1086IntPtr buffer = Marshal.AllocHGlobal(checked(size*count)); 1094Marshal.FreeHGlobal(buffer); 1106Marshal.FreeHGlobal(buffer); 1213IntPtr propdata = Marshal.AllocHGlobal(size); 1228Marshal.FreeHGlobal(propdata); 1286IntPtr propdata = Marshal.AllocHGlobal(size); 1300Marshal.FreeHGlobal(propdata);
commonui\System\Drawing\ImageConverter.cs (2)
198if (rawData.Length <= sizeof(SafeNativeMethods.OBJECTHEADER) || Marshal.ReadInt16(addr) != 0x1c15) 208SafeNativeMethods.OBJECTHEADER pHeader = (SafeNativeMethods.OBJECTHEADER)Marshal.PtrToStructure(addr, typeof(SafeNativeMethods.OBJECTHEADER));
commonui\System\Drawing\NativeMethods.cs (1)
102public int cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS));
commonui\System\Drawing\Pen.cs (6)
1005IntPtr buf = Marshal.AllocHGlobal(checked(4 * count)); 1015Marshal.Copy(buf, dashArray, 0, count); 1018Marshal.FreeHGlobal(buf); 1036IntPtr buf = Marshal.AllocHGlobal(checked(4 * count)); 1039Marshal.Copy(value, 0, buf, count); 1048Marshal.FreeHGlobal(buf);
commonui\System\Drawing\Printing\DefaultPrintController.cs (1)
72int error = Marshal.GetLastWin32Error();
commonui\System\Drawing\Printing\PageSettings.cs (1)
411Marshal.StructureToPtr(mode, modePointer, false);
commonui\System\Drawing\Printing\PrinterSettings.cs (55)
226sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1) + PADDING_IA64; 229sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1); 235sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 3); 243IntPtr buffer = Marshal.AllocCoTaskMem(bufferSize); 250Marshal.FreeCoTaskMem(buffer); 257IntPtr namePointer = (IntPtr) Marshal.ReadIntPtr((IntPtr)(checked((long)buffer + i * sizeofstruct))); 258array[i] = Marshal.PtrToStringAuto(namePointer); 261Marshal.FreeCoTaskMem(buffer); 534isDirectPrintingSupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0; 577bool querySupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0; 579isDirectPrintingSupported = (SafeNativeMethods.ExtEscape(hdc, nEscape, pvImageLen, pvImage, Marshal.SizeOf(typeof(int)), out outData) > 0) 776data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLGX86)); 804data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLG)); 1015Marshal.Copy(cachedDevmode, 0, pointer, devmodebytes); 1032Marshal.Copy(extrainfo, 0, pointeroffset, extrabytes); 1051Marshal.StructureToPtr(mode, pointer, false); 1108short offset = (short) (8 / Marshal.SystemDefaultCharSize); // Offsets are in characters, not bytes 1109uint namesSize = (uint)checked(Marshal.SystemDefaultCharSize * (offset + namesCharacters)); // always >0 1113Marshal.WriteInt16(namesPointer, offset); // wDriverOffset 1115Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 2)), offset); // wDeviceOffset 1117Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 4)), offset); // wOutputOffset 1119Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 6)), offset); // wDefault 1187int stringSize = Marshal.SystemDefaultCharSize * 64; 1188IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count)); 1193IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count); 1198IntPtr dimensionsBuffer = Marshal.AllocCoTaskMem(8 * count); 1203string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 64); 1208short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + i*2))); 1209int width = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8))); 1210int height = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8 + 4))); 1216Marshal.FreeCoTaskMem(namesBuffer); 1217Marshal.FreeCoTaskMem(kindsBuffer); 1218Marshal.FreeCoTaskMem(dimensionsBuffer); 1233int stringSize = Marshal.SystemDefaultCharSize * 24; 1234IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count)); 1239IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count); 1244string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 24); 1250short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + 2*i))); 1254Marshal.FreeCoTaskMem(namesBuffer); 1255Marshal.FreeCoTaskMem(kindsBuffer); 1283IntPtr buffer = Marshal.AllocCoTaskMem(checked(8 * count)); 1287int x = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i*8))); 1288int y = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i*8 + 4))); 1292Marshal.FreeCoTaskMem(buffer); 1298int offset = checked(Marshal.SystemDefaultCharSize * Marshal.ReadInt16((IntPtr)(checked((long)pDevnames + slot * 2)))); 1299string result = Marshal.PtrToStringAuto((IntPtr)(checked((long)pDevnames + offset))); 1325Marshal.Copy(pointer, cachedDevmode, 0, devmodebytes); 1332Marshal.Copy((IntPtr)(checked((long)pointer + (long)mode.dmSize)), extrainfo, 0, extrabytes); 1401IntPtr address = (IntPtr)(checked((long)bufferStart + index * Marshal.SystemDefaultCharSize)); 1403if (Marshal.SystemDefaultCharSize == 1) { 1405Marshal.Copy(bytes, 0, address, bytes.Length); 1406Marshal.WriteByte(checked((IntPtr)((long)address + bytes.Length)), 0); 1410Marshal.Copy(data, 0, address, data.Length); 1411Marshal.WriteInt16((IntPtr)(checked((long)address + data.Length*2)), 0);
commonui\System\Drawing\PropertyItemInternal.cs (5)
38Marshal.FreeHGlobal(value); 58propItemInternal.value = Marshal.AllocHGlobal(length); 59Marshal.Copy(propItemValue, 0, propItemInternal.value, length); 90 propdata = (IntPtr)((long)propdata + (int)Marshal.SizeOf(typeof(PropertyItemInternal))); 104Marshal.Copy(value,
commonui\System\Drawing\Region.cs (3)
1001int rectsize = (int)Marshal.SizeOf(typeof(GPRECTF)); 1002IntPtr memoryRects = Marshal.AllocHGlobal(checked(rectsize*count)); 1024Marshal.FreeHGlobal(memoryRects);
commonui\System\Drawing\SystemFonts.cs (1)
259bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETICONTITLELOGFONT, Marshal.SizeOf(itfont), itfont, 0);
commonui\System\Drawing\UnsafeNativeMethods.cs (6)
135return Marshal.PtrToStructure(lparam, cls); 144Marshal.PtrToStructure(lparam, data); 255IntPtr buffer = Marshal.AllocHGlobal(bufsize); 271Marshal.FreeHGlobal(buffer); 299Marshal.Copy(buffer, 0, buf, length); 371Marshal.Copy(buf, buffer, 0, length);
misc\DbgUtil.cs (1)
237err = Marshal.GetLastWin32Error();
misc\GDI\NativeMethods.cs (1)
250private int cbSize = Marshal.SizeOf(typeof(DRAWTEXTPARAMS));
misc\GDI\UnsafeNativeMethods.cs (6)
264int retVal = IntGetObject(hBrush, System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntNativeMethods.LOGBRUSH)), lb); 275int retVal = IntGetObject(hFont, System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntNativeMethods.LOGFONT)), lp); 376if( Marshal.SystemDefaultCharSize == 1 ) 415if( Marshal.SystemDefaultCharSize == 1) 458if( Marshal.SystemDefaultCharSize == 1) 599if (Marshal.SystemDefaultCharSize == 1)
System.IdentityModel (113)
System\IdentityModel\Claims\WindowsClaimSet.cs (7)
283int count = Marshal.ReadInt32(safeAllocHandle.DangerousGetHandle()); 284IntPtr pSidAndAttributes = new IntPtr((long)safeAllocHandle.DangerousGetHandle() + (long)Marshal.OffsetOf(typeof(TOKEN_GROUPS), "Groups")); 287SID_AND_ATTRIBUTES group = (SID_AND_ATTRIBUTES)Marshal.PtrToStructure(pSidAndAttributes, typeof(SID_AND_ATTRIBUTES)); 316dwLength = (uint)Marshal.SizeOf(typeof(uint)); 322int dwErrorCode = Marshal.GetLastWin32Error(); 334dwErrorCode = Marshal.GetLastWin32Error(); 358SID_AND_ATTRIBUTES user = (SID_AND_ATTRIBUTES)Marshal.PtrToStructure(safeAllocHandle.DangerousGetHandle(), typeof(SID_AND_ATTRIBUTES));
System\IdentityModel\CryptoApi.cs (1)
166static internal int Size = Marshal.SizeOf(typeof(CRYPTOAPI_BLOB));
System\IdentityModel\NativeMethods.cs (4)
86internal static readonly long SizeOf = (long)Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES)); 105internal static readonly int SizeOf = Marshal.SizeOf(typeof(PLAINTEXTKEYBLOBHEADER)); 128internal static readonly uint Size = (uint)Marshal.SizeOf(typeof(TOKEN_PRIVILEGE)); 157internal static int Size = Marshal.SizeOf(typeof(KERB_CERTIFICATE_S4U_LOGON));
System\IdentityModel\Privilege.cs (8)
78return Marshal.GetLastWin32Error(); 87return Marshal.GetLastWin32Error(); 116int error = Marshal.GetLastWin32Error(); 130error = Marshal.GetLastWin32Error(); 145error = Marshal.GetLastWin32Error(); 189error = Marshal.GetLastWin32Error(); 220error = Marshal.GetLastWin32Error(); 246int error = Marshal.GetLastWin32Error();
System\IdentityModel\RijndaelCryptoServiceProvider.cs (1)
377int err = Marshal.GetLastWin32Error();
System\IdentityModel\SafeCryptHandles.cs (1)
102err = Marshal.GetLastWin32Error();
System\IdentityModel\Selectors\WindowsUserNameSecurityTokenAuthenticator.cs (1)
54int error = Marshal.GetLastWin32Error();
System\IdentityModel\Selectors\X509CertificateChain.cs (15)
113CAPI.CERT_CHAIN_POLICY_PARA PolicyPara = new CAPI.CERT_CHAIN_POLICY_PARA(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_PARA))); 114CAPI.CERT_CHAIN_POLICY_STATUS PolicyStatus = new CAPI.CERT_CHAIN_POLICY_STATUS(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_STATUS))); 125int error = Marshal.GetLastWin32Error(); 154ChainPara.cbSize = (uint)Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_PARA)); 195int error = Marshal.GetLastWin32Error(); 214CAPI.CERT_CONTEXT certContext = (CAPI.CERT_CONTEXT)Marshal.PtrToStructure(pCertContext, typeof(CAPI.CERT_CONTEXT)); 233int error = Marshal.GetLastWin32Error(); 252int error = Marshal.GetLastWin32Error(); 281CAPI.CERT_CONTEXT intermediatesCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure( intermediatesCert.Handle, typeof( CAPI.CERT_CONTEXT ) ); 297int error = Marshal.GetLastWin32Error(); 335int ptrSize = oidStrs.Count * Marshal.SizeOf(typeof(IntPtr)); 345Marshal.WriteIntPtr(new IntPtr((long) safeAllocHandle.DangerousGetHandle() + index * Marshal.SizeOf(typeof(IntPtr))), pOid); 353Marshal.Copy(ansiOid, 0, pOid, ansiOid.Length); 355Marshal.WriteByte(pNullTerminator, 0);
System\IdentityModel\Selectors\X509CertificateStore.cs (2)
97int error = Marshal.GetLastWin32Error(); 149Marshal.StructureToPtr(blob, pvFindPara.DangerousGetHandle(), false);
System\IdentityModel\Selectors\X509SecurityTokenAuthenticator.cs (4)
146Marshal.Copy(NativeMethods.LsaSourceName, 0, pSourceName.DangerousGetHandle(), NativeMethods.LsaSourceName.Length); 202Marshal.Copy(NativeMethods.LsaKerberosName, 0, pPackageName.DangerousGetHandle(), NativeMethods.LsaKerberosName.Length); 216int dwErrorCode = Marshal.GetLastWin32Error(); 237Marshal.Copy(certRawData, 0, pInfo->Certificate, certRawData.Length);
System\IdentityModel\SspiHelper.cs (1)
169Length = Marshal.SizeOf(typeof(AuthIdentityEx));
System\IdentityModel\SspiSafeHandles.cs (10)
246inUnmanagedBuffer[index].token = Marshal.UnsafeAddrOfPinnedArrayElement(securityBuffer.token, securityBuffer.offset); 264outUnmanagedBuffer[0].token = Marshal.UnsafeAddrOfPinnedArrayElement(outSecBuffer.token, outSecBuffer.offset); 300Marshal.Copy(outUnmanagedBuffer[0].token, outSecBuffer.token, 0, outSecBuffer.size); 526inUnmanagedBuffer[index].token = Marshal.UnsafeAddrOfPinnedArrayElement(securityBuffer.token, securityBuffer.offset); 545outUnmanagedBuffer[0].token = Marshal.UnsafeAddrOfPinnedArrayElement(outSecBuffer.token, outSecBuffer.offset); 574Marshal.Copy(outUnmanagedBuffer[0].token, outSecBuffer.token, 0, outSecBuffer.size); 1309IntPtr keyPtr = Marshal.ReadIntPtr(new IntPtr(buffer), SecPkgContext_SessionKey.SessionkeyOffset); 1403Marshal.FreeHGlobal(handle); 1422Marshal.Copy(bytes, 0, result.DangerousGetHandle(), bytes.Length); 1447IntPtr ptr = Marshal.AllocHGlobal(cb);
System\IdentityModel\SspiWrapper.cs (54)
87internal static readonly int Size = Marshal.SizeOf(typeof(SecurityPackageInfo)); 88internal static readonly int NameOffest = (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "Name"); 97internal static readonly int Size = Marshal.SizeOf(typeof(LifeSpan_Struct)); 108internal static readonly int Size = Marshal.SizeOf(typeof(NegotiationInfo)); 109internal static readonly int NegotiationStateOffset = (int)Marshal.OffsetOf(typeof(NegotiationInfo), "NegotiationState"); 119internal static readonly int Size = Marshal.SizeOf(typeof(SecPkgContext_SessionKey)); 120internal static readonly int SessionkeyOffset = (int)Marshal.OffsetOf(typeof(SecPkgContext_SessionKey), "Sessionkey"); 149LifeSpan_Struct lifeSpan = (LifeSpan_Struct)Marshal.PtrToStructure(ptr, typeof(LifeSpan_Struct)); 175Capabilities = Marshal.ReadInt32(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "Capabilities")); 176Version = Marshal.ReadInt16(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "Version")); 177RPCID = Marshal.ReadInt16(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "RPCID")); 178MaxToken = Marshal.ReadInt32(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "MaxToken")); 181unmanagedString = Marshal.ReadIntPtr(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "Name")); 184Name = Marshal.PtrToStringUni(unmanagedString); 187unmanagedString = Marshal.ReadIntPtr(unmanagedAddress, (int)Marshal.OffsetOf(typeof(SecurityPackageInfo), "Comment")); 191Comment = Marshal.PtrToStringUni(unmanagedString); 222IntPtr unmanagedString = Marshal.ReadIntPtr(packageInfo, SecurityPackageInfo.NameOffest); 226name = Marshal.PtrToStringUni(unmanagedString); 252Marshal.Copy(safeHandle.DangerousGetHandle(), sessionKey, 0, sessionKeyLength); 276header = Marshal.ReadInt32(unmanagedAddress); 277trailer = Marshal.ReadInt32(unmanagedAddress, 4); 278maximumMessage = Marshal.ReadInt32(unmanagedAddress, 8); 279buffersCount = Marshal.ReadInt32(unmanagedAddress, 12); 280blockSize = Marshal.ReadInt32(unmanagedAddress, 16); 283public static readonly int SizeOf = Marshal.SizeOf(typeof(StreamSizes)); 554nativeBlockSize = Marshal.SizeOf(typeof(NegotiationInfo)); 563nativeBlockSize = Marshal.SizeOf(typeof(SslConnectionInfo)); 593attribute = (object)Marshal.ReadInt32(new IntPtr(pnativeBuffer)); 603attribute = Marshal.PtrToStringUni(sspiHandle.DangerousGetHandle()); 613attribute = new NegotiationInfoClass(sspiHandle, Marshal.ReadInt32(new IntPtr(ptr), NegotiationInfo.NegotiationStateOffset)); 634attribute = new SecuritySessionKeyClass(sspiHandle, Marshal.ReadInt32(new IntPtr(ptr))); 676specifiedTarget = Marshal.PtrToStringUni(sspiHandle.DangerousGetHandle()) as string; 721unmanagedBuffer[i].token = Marshal.UnsafeAddrOfPinnedArrayElement(iBuffer.token, iBuffer.offset); 748Marshal.Copy(unmanagedBuffer[i].token, iBuffer.token, 0, iBuffer.size); 761byte* bufferAddress = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(buffers[j], 0); 818credui_Info.cbSize = Marshal.SizeOf(typeof(CREDUI_INFO)); 883Protocol = Marshal.ReadInt32(unmanagedAddress); 884DataCipherAlg = Marshal.ReadInt32(unmanagedAddress, 4); 885DataKeySize = Marshal.ReadInt32(unmanagedAddress, 8); 886DataHashAlg = Marshal.ReadInt32(unmanagedAddress, 12); 887DataHashKeySize = Marshal.ReadInt32(unmanagedAddress, 16); 888KeyExchangeAlg = Marshal.ReadInt32(unmanagedAddress, 20); 889KeyExchKeySize = Marshal.ReadInt32(unmanagedAddress, 24); 907MaxToken = Marshal.ReadInt32(unmanagedAddress); 908MaxSignature = Marshal.ReadInt32(unmanagedAddress, 4); 909BlockSize = Marshal.ReadInt32(unmanagedAddress, 8); 910SecurityTrailer = Marshal.ReadInt32(unmanagedAddress, 12); 913public static readonly int SizeOf = Marshal.SizeOf(typeof(SecSizes));
System\IdentityModel\Tokens\RsaSecurityToken.cs (1)
102int error = Marshal.GetLastWin32Error();
System\IdentityModel\Tokens\SessionSecurityToken.cs (2)
1035int errorCode = Marshal.GetLastWin32Error(); 1042errorCode = Marshal.GetLastWin32Error();
System\IdentityModel\Tokens\WindowsUserNameSecurityTokenHandler.cs (1)
97int error = Marshal.GetLastWin32Error();
System.IdentityModel.Selectors (46)
infocard\client\System\IdentityModel\Selectors\CardSpaceSelector.cs (1)
200infocardToken = (RpcGenericXmlToken)Marshal.PtrToStructure(
infocard\client\System\IdentityModel\Selectors\CardSpaceShim.cs (16)
110(CsV2CloseCryptoHandle)Marshal.GetDelegateForFunctionPointer( 116(CsV2Decrypt)Marshal.GetDelegateForFunctionPointer( 121(CsV2Encrypt)Marshal.GetDelegateForFunctionPointer( 126(CsV2FreeToken)Marshal.GetDelegateForFunctionPointer( 131(CsV2GenerateDerivedKey)Marshal.GetDelegateForFunctionPointer( 136(CsV2GetCryptoTransform)Marshal.GetDelegateForFunctionPointer( 141(CsV2GetKeyedHash)Marshal.GetDelegateForFunctionPointer( 146(CsV2GetToken)Marshal.GetDelegateForFunctionPointer( 151(CsV2HashCore)Marshal.GetDelegateForFunctionPointer( 156(CsV2HashFinal)Marshal.GetDelegateForFunctionPointer( 161(CsV2ImportInformationCard)Marshal.GetDelegateForFunctionPointer( 166(CsV2ManageCardSpace)Marshal.GetDelegateForFunctionPointer( 171(CsV2SignHash)Marshal.GetDelegateForFunctionPointer( 176(CsV2TransformBlock)Marshal.GetDelegateForFunctionPointer( 181(CsV2TransformFinalBlock)Marshal.GetDelegateForFunctionPointer( 187(CsV2VerifyHash)Marshal.GetDelegateForFunctionPointer(
infocard\client\System\IdentityModel\Selectors\CryptoHandle.cs (2)
46m_internalHandle.Initialize(expiration, Marshal.PtrToStructure(nativeParameters, paramType)); 140(RpcInfoCardCryptoHandle)Marshal.PtrToStructure(nativeHandle.DangerousGetHandle(),
infocard\client\System\IdentityModel\Selectors\InfoCardKeyedHashAlgorithm.cs (3)
135Marshal.Copy(m_cachedBlock, 0, pInData.DangerousGetHandle(), m_cachedBlock.Length); 192Marshal.Copy(m_cachedBlock, 0, pInData.DangerousGetHandle(), m_cachedBlock.Length); 209Marshal.Copy(pOutData.DangerousGetHandle(), outData, 0, pOutData.Length);
infocard\client\System\IdentityModel\Selectors\InfoCardRSACryptoProvider.cs (8)
88Marshal.Copy(inData, 0, pInData.DangerousGetHandle(), inData.Length); 105Marshal.Copy(pOutData.DangerousGetHandle(), outData, 0, pOutData.Length); 120Marshal.Copy(inData, 0, pInData.DangerousGetHandle(), inData.Length); 136Marshal.Copy(pOutData.DangerousGetHandle(), outData, 0, pOutData.Length); 154Marshal.Copy(hash, 0, pHash.DangerousGetHandle(), hash.Length); 173Marshal.Copy(pSig.DangerousGetHandle(), sig, 0, pSig.Length); 194Marshal.Copy(hash, 0, pHash.DangerousGetHandle(), hash.Length); 198Marshal.Copy(sig, 0, pSig.DangerousGetHandle(), sig.Length);
infocard\client\System\IdentityModel\Selectors\InfoCardSymmetricAlgorithm.cs (5)
167Marshal.Copy(iv, 0, pIV.DangerousGetHandle(), iv.Length); 238Marshal.Copy(inputBuffer, inputOffset, pInData.DangerousGetHandle(), inputCount); 253Marshal.Copy(pOutData.DangerousGetHandle(), outputBuffer, outputOffset, pOutData.Length); 285Marshal.Copy(inputBuffer, inputOffset, pInData.DangerousGetHandle(), inputCount); 302Marshal.Copy(pOutData.DangerousGetHandle(), outData, 0, pOutData.Length);
infocard\client\System\IdentityModel\Selectors\InfoCardSymmetricCrypto.cs (3)
125Marshal.Copy(label, 0, pLabel.DangerousGetHandle(), label.Length); 126Marshal.Copy(nonce, 0, pNonce.DangerousGetHandle(), nonce.Length); 147Marshal.Copy(pDerivedKey.DangerousGetHandle(), derivedKey, 0, pDerivedKey.Length);
infocard\client\System\IdentityModel\Selectors\InternalPolicyElement.cs (3)
51return Marshal.SizeOf(typeof(NativePolicyElement)); 88Marshal.StructureToPtr(m_nativeElement, ptr, false); 108Marshal.DestroyStructure(m_nativePtr, typeof(NativePolicyElement));
infocard\common\managed\HGlobalSafeHandle.cs (3)
33return new HGlobalSafeHandle(Marshal.StringToHGlobalUni(managedString), bytes); 40return new HGlobalSafeHandle(Marshal.AllocHGlobal(bytes), bytes); 83Marshal.FreeHGlobal(base.handle);
infocard\Diagnostics\Managed\Microsoft\InfoCards\Diagnostics\InfocardTrace.cs (2)
131int error = Marshal.GetLastWin32Error(); 531int error = Marshal.GetLastWin32Error();
System.IO.Log (71)
System\IO\Log\AppendHelper.cs (2)
39this.blobs[0].pBlobData = Marshal.UnsafeAddrOfPinnedArrayElement(header.Bits, 0); 45blobs[i + 1].pBlobData = Marshal.UnsafeAddrOfPinnedArrayElement(data[i].Array, data[i].Offset);
System\IO\Log\LogExtentCollection.cs (2)
183infoSize = Marshal.SizeOf(typeof(CLFS_CONTAINER_INFORMATION_WRAPPER)); 187Marshal.PtrToStructure(new IntPtr(containerPointer),
System\IO\Log\LogLogRecord.cs (1)
34Marshal.Copy(new IntPtr(data),
System\IO\Log\LogManagementAsyncResult.cs (1)
278int errorCode = Marshal.GetHRForException(e);
System\IO\Log\LogReserveAndAppendState.cs (2)
479this.writeEntries[entryIndex].Buffer = Marshal.UnsafeAddrOfPinnedArrayElement(this.headerBits, 0); 491this.writeEntries[entryIndex].Buffer = Marshal.UnsafeAddrOfPinnedArrayElement(segment.Array, segment.Offset);
System\IO\Log\LogStore.cs (2)
450int size = Marshal.SizeOf(typeof(CLFS_INFORMATION)); 507secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);
System\IO\Log\SimpleFileLog.cs (2)
68Marshal.FinalReleaseComObject(obj); 230Marshal.Copy(pData.DangerousGetHandle(),
System\IO\Log\SmuggledIUnknown.cs (2)
25base.handle = Marshal.GetIUnknownForObject(unknown); 56Marshal.Release(base.handle);
System\IO\Log\UnsafeNativeMethods.cs (57)
242(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_MAXIMUMSIZE)), 260(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_MINIMUMSIZE)), 278(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_GROWTHRATE)), 296(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_LOGTAIL)), 314(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_AUTOSHRINK)), 332(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_AUTOGROW)), 352(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_NEWCONTAINERPREFIX)), 369(uint)Marshal.SizeOf(typeof(CLFS_MGMT_POLICY_NEXTCONTAINERSUFFIX)), 488uint errorCode = (uint)Marshal.GetLastWin32Error(); 522uint errorCode = (uint)Marshal.GetLastWin32Error(); 548uint errorCode = (uint)Marshal.GetLastWin32Error(); 572uint errorCode = (uint)Marshal.GetLastWin32Error(); 604errorCode = (uint)Marshal.GetLastWin32Error(); 649uint errorCode = (uint)Marshal.GetLastWin32Error(); 680uint errorCode = (uint)Marshal.GetLastWin32Error(); 704uint errorCode = (uint)Marshal.GetLastWin32Error(); 730uint errorCode = (uint)Marshal.GetLastWin32Error(); 762uint errorCode = (uint)Marshal.GetLastWin32Error(); 803uint errorCode = (uint)Marshal.GetLastWin32Error(); 852uint errorCode = (uint)Marshal.GetLastWin32Error(); 904uint errorCode = (uint)Marshal.GetLastWin32Error(); 957errorCode = (uint)Marshal.GetLastWin32Error(); 1005errorCode = (uint)Marshal.GetLastWin32Error(); 1030errorCode = (uint)Marshal.GetLastWin32Error(); 1069uint errorCode = (uint)Marshal.GetLastWin32Error(); 1108uint errorCode = (uint)Marshal.GetLastWin32Error(); 1148uint errorCode = (uint)Marshal.GetLastWin32Error(); 1194uint errorCode = (uint)Marshal.GetLastWin32Error(); 1237uint errorCode = (uint)Marshal.GetLastWin32Error(); 1262uint errorCode = (uint)Marshal.GetLastWin32Error(); 1294uint errorCode = (uint)Marshal.GetLastWin32Error(); 1349uint errorCode = (uint)Marshal.GetLastWin32Error(); 1385uint errorCode = (uint)Marshal.GetLastWin32Error(); 1409uint errorCode = (uint)Marshal.GetLastWin32Error(); 1441uint errorCode = (uint)Marshal.GetLastWin32Error(); 1461uint errorCode = (uint)Marshal.GetLastWin32Error(); 1486uint errorCode = (uint)Marshal.GetLastWin32Error(); 1502uint errorCode = (uint)Marshal.GetLastWin32Error(); 1518uint errorCode = (uint)Marshal.GetLastWin32Error(); 1534uint errorCode = (uint)Marshal.GetLastWin32Error(); 1550uint errorCode = (uint)Marshal.GetLastWin32Error(); 1566uint errorCode = (uint)Marshal.GetLastWin32Error(); 1582uint errorCode = (uint)Marshal.GetLastWin32Error(); 1598uint errorCode = (uint)Marshal.GetLastWin32Error(); 1609uint errorCode = (uint)Marshal.GetLastWin32Error(); 1620uint errorCode = (uint)Marshal.GetLastWin32Error(); 1631uint errorCode = (uint)Marshal.GetLastWin32Error(); 1642uint errorCode = (uint)Marshal.GetLastWin32Error(); 1653uint errorCode = (uint)Marshal.GetLastWin32Error(); 1664uint errorCode = (uint)Marshal.GetLastWin32Error(); 1675uint errorCode = (uint)Marshal.GetLastWin32Error(); 1686uint errorCode = (uint)Marshal.GetLastWin32Error(); 1697uint errorCode = (uint)Marshal.GetLastWin32Error(); 1733uint errorCode = (uint)Marshal.GetLastWin32Error(); 1753uint errorCode = (uint)Marshal.GetLastWin32Error(); 1769uint errorCode = (uint)Marshal.GetLastWin32Error(); 1794uint errorCode = (uint)Marshal.GetLastWin32Error();
System.Management (226)
Instrumentation\EventSource.cs (18)
109Marshal.ThrowExceptionForHR(hr, WmiNetUtilsHelper.GetErrorInfo_f()); 292Marshal.ThrowExceptionForHR(hresult, WmiNetUtilsHelper.GetErrorInfo_f()); 328Marshal.ThrowExceptionForHR(hresult, WmiNetUtilsHelper.GetErrorInfo_f()); 396IntPtr pUnk = Marshal.GetIUnknownForObject(comObject); 397int references = Marshal.ReleaseComObject(comObject); 401comObject = Marshal.GetObjectForIUnknown(pUnk); 402Marshal.Release(pUnk); 436Marshal.ReleaseComObject(pInitSink); 535Marshal.ReleaseComObject(pResponseHandler); 547Marshal.ReleaseComObject(pResponseHandler); 584Marshal.AddRef(objs[0]); 602Marshal.ReleaseComObject(pResponseHandler); 607Marshal.ReleaseComObject(pResponseHandler); 808Marshal.AddRef(objs[count]); 835Marshal.AddRef(objs[count]); 872Marshal.Release(objsClone[i]); 907Marshal.Release(objsClone[i]); 913Marshal.ReleaseComObject(pResponseHandler);
Instrumentation\MetaDataInfo.cs (2)
114Marshal.ReleaseComObject(dispenser); 162Marshal.ReleaseComObject(importInterface);
Instrumentation\SchemaRegistration.cs (1)
341 references.Add(typeof(Marshal));
InteropClasses\WMIInterop.cs (11)
73Marshal.Release(pWbemClassObject); 93hGlobal = Marshal.AllocHGlobal(rg.Length); 94Marshal.Copy(rg, 0, hGlobal, rg.Length); 101Marshal.ReleaseComObject(stream); 103Marshal.FreeHGlobal(hGlobal); 123Marshal.Copy(pData, rg, 0, (int)statstg.cbSize); 130Marshal.ReleaseComObject(stream); 492Marshal.Release(pWbemQualifierSet); 2133if(0 == Marshal.QueryInterface(pComThreadingInfo, ref IID_IObjectContext, out pObjectContext)) 2139Marshal.Release(pComThreadingInfo); 2141Marshal.Release(pObjectContext);
managementbaseobject.cs (8)
339Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 460Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 632Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 650(IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(wbemObject)), 659Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 805Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 831Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 853Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
managementclass.cs (13)
90 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 353 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 493 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 627 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 716 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 785 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 870 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 933 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 966 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1096 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1204 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1303 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1404 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
managementeventwatcher.cs (8)
443cachedObjects[i] = new IWbemClassObjectFreeThreaded(Marshal.GetIUnknownForObject(tempArray[i])); 486Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 517Marshal.ThrowExceptionForHR(sink.Status, WmiNetUtilsHelper.GetErrorInfo_f()); 542Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 562Marshal.ReleaseComObject(enumWbem); 690Marshal.AddRef(pWbemClassObject); 778Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 800System.Runtime.InteropServices.Marshal.ReleaseComObject(stub);
managementobject.cs (34)
712Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 809Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 945Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1081Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1211Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1315Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1437Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1494ppwbemCallResult = Marshal.AllocHGlobal(IntPtr.Size); 1495Marshal.WriteIntPtr(ppwbemCallResult, IntPtr.Zero); // Init to NULL. 1514pwbemCallResult = Marshal.ReadIntPtr(ppwbemCallResult); 1516wbemCallResult = (IWbemCallResult)Marshal.GetObjectForIUnknown(pwbemCallResult); 1529Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1543Marshal.FreeHGlobal(ppwbemCallResult); 1546Marshal.Release(pwbemCallResult); 1549Marshal.ReleaseComObject(wbemCallResult); 1692Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1795ppwbemCallResult = Marshal.AllocHGlobal(IntPtr.Size); 1796Marshal.WriteIntPtr(ppwbemCallResult, IntPtr.Zero); // Init to NULL. 1818pwbemCallResult = Marshal.ReadIntPtr(ppwbemCallResult); 1821wbemCallResult = (IWbemCallResult)Marshal.GetObjectForIUnknown(pwbemCallResult); 1834Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1846Marshal.FreeHGlobal(ppwbemCallResult); 1849Marshal.Release(pwbemCallResult); 1852Marshal.ReleaseComObject(wbemCallResult); 1950Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2012Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2085Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2344Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2422Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2515Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2549Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2701Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2790Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2882Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
managementobjectcollection.cs (8)
123Marshal.ReleaseComObject (enumWbem); 331Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 459Marshal.ReleaseComObject (enumWbem); 568Marshal.GetIUnknownForObject(tempArray[i]) 578Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 649Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 654Marshal.ReleaseComObject((IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(cachedObjects[i])));
managementobjectsearcher.cs (2)
387Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 482Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
managementoptions.cs (1)
1649return System.Runtime.InteropServices.Marshal.SecureStringToBSTR(securePassword);
managementpath.cs (13)
118Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 286Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 342Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 384Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 530Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 626Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 656Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 779Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 829Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 950Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 977Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1006Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1035Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
managementscope.cs (67)
313ResetSecurity_f =(ResetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ResetSecurity)); 318SetSecurity_f =(SetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SetSecurity)); 323BlessIWbemServices_f =(BlessIWbemServices) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServices)); 328BlessIWbemServicesObject_f =(BlessIWbemServicesObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServicesObject)); 333GetPropertyHandle_f27=(GetPropertyHandle) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyHandle)); 338WritePropertyValue_f28=(WritePropertyValue) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(WritePropertyValue)); 343Clone_f12=(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone)); 348VerifyClientKey_f =(VerifyClientKey) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(VerifyClientKey)); 353GetQualifierSet_f =(GetQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetQualifierSet)); 358Get_f =(Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Get)); 363Put_f =(Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Put)); 368Delete_f =(Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Delete)); 373GetNames_f =(GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetNames)); 378BeginEnumeration_f =(BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginEnumeration)); 383Next_f =(Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Next)); 388EndEnumeration_f =(EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndEnumeration)); 393GetPropertyQualifierSet_f =(GetPropertyQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyQualifierSet)); 398Clone_f =(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone)); 403GetObjectText_f =(GetObjectText) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetObjectText)); 408SpawnDerivedClass_f =(SpawnDerivedClass) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnDerivedClass)); 413SpawnInstance_f =(SpawnInstance) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnInstance)); 418CompareTo_f =(CompareTo) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CompareTo)); 423GetPropertyOrigin_f =(GetPropertyOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyOrigin)); 428InheritsFrom_f =(InheritsFrom) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(InheritsFrom)); 433GetMethod_f =(GetMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethod)); 438PutMethod_f =(PutMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutMethod)); 443DeleteMethod_f =(DeleteMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(DeleteMethod)); 448BeginMethodEnumeration_f =(BeginMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginMethodEnumeration)); 453NextMethod_f =(NextMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(NextMethod)); 458EndMethodEnumeration_f =(EndMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndMethodEnumeration)); 463GetMethodQualifierSet_f =(GetMethodQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodQualifierSet)); 468GetMethodOrigin_f =(GetMethodOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodOrigin)); 473QualifierGet_f=(QualifierSet_Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Get)); 478QualifierPut_f=(QualifierSet_Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Put)); 483QualifierDelete_f=(QualifierSet_Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Delete)); 488QualifierGetNames_f=(QualifierSet_GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_GetNames)); 493QualifierBeginEnumeration_f=(QualifierSet_BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_BeginEnumeration)); 498QualifierNext_f=(QualifierSet_Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Next)); 503QualifierEndEnumeration_f=(QualifierSet_EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_EndEnumeration)); 508GetCurrentApartmentType_f =(GetCurrentApartmentType) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetCurrentApartmentType)); 513GetDemultiplexedStub_f =(GetDemultiplexedStub) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetDemultiplexedStub)); 518CreateInstanceEnumWmi_f =(CreateInstanceEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateInstanceEnumWmi)); 523CreateClassEnumWmi_f =(CreateClassEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateClassEnumWmi)); 528ExecQueryWmi_f =(ExecQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecQueryWmi)); 533ExecNotificationQueryWmi_f =(ExecNotificationQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecNotificationQueryWmi)); 538PutInstanceWmi_f =(PutInstanceWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutInstanceWmi)); 543PutClassWmi_f =(PutClassWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutClassWmi)); 548CloneEnumWbemClassObject_f =(CloneEnumWbemClassObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CloneEnumWbemClassObject)); 553ConnectServerWmi_f =(ConnectServerWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ConnectServerWmi)); 558GetErrorInfo_f =(GetErrorInfo) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetErrorInfo)); 563Initialize_f =(Initialize) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Initialize)); 680IntPtr pUnk = Marshal.GetIUnknownForObject(wbemServices); 683Object unknown = Marshal.GetObjectForIUnknown(pUnk); 686Marshal.Release(pUnk); 1169Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1233System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1281System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1356System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1397System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1423System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1465System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1492System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1519System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1595System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1598Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1621System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1624Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
method.cs (2)
133Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 222Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
methodset.cs (4)
110Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 285Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 378Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 445Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
property.cs (9)
112 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 157 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 230 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 331 ((ManagementBaseObject[])val) [i] = new ManagementBaseObject(new IWbemClassObjectFreeThreaded(Marshal.GetIUnknownForObject(wmiValueArray.GetValue(i)))); 368 val = new ManagementBaseObject(new IWbemClassObjectFreeThreaded(Marshal.GetIUnknownForObject(wmiValue))); 525 ((IWbemClassObject_DoNotMarshal[])(wmiValue))[i] = (IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(((ManagementBaseObject)valArray.GetValue(i)).wbemObject)); 600 wmiValue = Marshal.GetObjectForIUnknown(((ManagementBaseObject) val).wbemObject); 759 ((IWbemClassObject_DoNotMarshal[])(wmiValue))[i] = (IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(((ManagementBaseObject)valArray.GetValue(i)).wbemObject)); 846 wmiValue = Marshal.GetObjectForIUnknown(((ManagementBaseObject) val).wbemObject);
propertyset.cs (7)
90 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 160 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 266 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 384 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 427 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 469 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 507 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
qualifier.cs (6)
95 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 197 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 239 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 292 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 328 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 364 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
qualifierset.cs (6)
107 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 147 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 211 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 356Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 444 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 493 Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
wmieventsink.cs (4)
153Marshal.AddRef(pIWbemClassObject); 176Marshal.AddRef(pErrorObj); 251System.Runtime.InteropServices.Marshal.ReleaseComObject(stub); 327Marshal.AddRef(pIWbemClassObject);
wmiutil.cs (2)
56Marshal.QueryInterface(pErrorInfo, ref IWbemClassObjectFreeThreaded.IID_IWbemClassObject, out pIWbemClassObject); 57Marshal.Release(pErrorInfo);
System.Messaging (38)
System\Messaging\AccessControlList.cs (3)
146int errval = Marshal.GetLastWin32Error(); 151entries[i].data = (IntPtr)Marshal.AllocHGlobal(sidSize); 176Marshal.FreeHGlobal(entries[i].data);
System\Messaging\ActiveXMessageFormatter.cs (4)
451IntPtr buffer = Marshal.AllocHGlobal((IntPtr)bufSize); 471Marshal.FreeHGlobal(buffer); 506Marshal.Copy(buffer, 0, buf, length); 594Marshal.Copy(buf, buffer, 0, length);
System\Messaging\Interop\Columns.cs (3)
26this.columnSet.columnIdentifiers = Marshal.AllocHGlobal(maxCount * 4); 59Marshal.FreeHGlobal(this.columnIdentifiers); 66Marshal.WriteInt32((IntPtr)((long)this.columnIdentifiers + (index * 4)), columnId);
System\Messaging\Interop\Restrictions.cs (17)
35IntPtr data = Marshal.AllocHGlobal(16); 36Marshal.Copy(value.ToByteArray(), 0, data, 16); 42IntPtr data = Marshal.AllocHGlobal(16); 48Marshal.WriteInt32(restrictionStructure.GetNextValidPtr(0), op); 49Marshal.WriteInt32(restrictionStructure.GetNextValidPtr(4), id); 50Marshal.WriteInt16(restrictionStructure.GetNextValidPtr(8), vt); 51Marshal.WriteInt16(restrictionStructure.GetNextValidPtr(10), (short)0); 52Marshal.WriteInt16(restrictionStructure.GetNextValidPtr(12), (short)0); 53Marshal.WriteInt16(restrictionStructure.GetNextValidPtr(14), (short)0); 54Marshal.WriteIntPtr(restrictionStructure.GetNextValidPtr(16), data); 55Marshal.WriteIntPtr(restrictionStructure.GetNextValidPtr(16 + IntPtr.Size), (IntPtr)0); 70IntPtr data = Marshal.StringToHGlobalUni(value); 91this.restrinctions = Marshal.AllocHGlobal(maxCount * GetRestrictionSize()); 100short vt = Marshal.ReadInt16((IntPtr)((long)this.restrinctions + (index * GetRestrictionSize()) + 8)); 104IntPtr data = Marshal.ReadIntPtr(dataPtr); 105Marshal.FreeHGlobal(data); 109Marshal.FreeHGlobal(this.restrinctions);
System\Messaging\Message.cs (1)
1659this.machineName = Marshal.PtrToStringUni(memoryHandle);
System\Messaging\MessageQueue.cs (8)
421Marshal.Copy(handle, bytes, 0, 16); 721Marshal.Copy(handle, bytes, 0, 16); 751description = Marshal.PtrToStringUni(handle); 1022address = Marshal.PtrToStringUni(handle); 1188description = Marshal.PtrToStringUni(handle); 1923Marshal.Copy(handle, bytes, 0, 16); 2046IntPtr stringPointer = Marshal.ReadIntPtr((IntPtr)((long)basePointer + index * IntPtr.Size)); 2048string path = Marshal.PtrToStringUni(stringPointer);
System\Messaging\MessageQueueEnumerator.cs (2)
207currentItem = Marshal.PtrToStringUni(array[0].ptr); 208Marshal.Copy(array[1].ptr, currentGuid, 0, 16);
System.Net (126)
net\PeerToPeer\Cloud.cs (3)
227PEER_PNRP_CLOUD_INFO cloudinfo = (PEER_PNRP_CLOUD_INFO)Marshal.PtrToStructure(pPEER_PNRP_CLOUD_INFO, typeof(PEER_PNRP_CLOUD_INFO)); 228string nativeCloudName = Marshal.PtrToStringUni(cloudinfo.pwzCloudName); 229pPEER_PNRP_CLOUD_INFO = (IntPtr)((long)pPEER_PNRP_CLOUD_INFO + Marshal.SizeOf(typeof(PEER_PNRP_CLOUD_INFO)));
net\PeerToPeer\Collaboration\CollaborationHelperFunctions.cs (8)
145Marshal.Copy(pc.credentials.pbData, data, 0, (int)pc.credentials.cbData); 157int win32ErrorCode = Marshal.GetLastWin32Error(); 206int win32ErrorCode = Marshal.GetLastWin32Error(); 286peerNearMe.Nickname = Marshal.PtrToStringUni(ppnm.pwzNickname); ; 308Marshal.Copy(po.data.pbData, data, 0, (int)po.data.cbData); 329Marshal.Copy(pa.data.pbData, data, 0, (int)pa.data.cbData); 333Marshal.PtrToStringUni(pa.pwzDescription), 364return new PeerEndPoint(IPEndPt, Marshal.PtrToStringUni(pe.pwzEndpointName));
net\PeerToPeer\Collaboration\ContactManager.cs (21)
145pc = (PEER_CONTACT)Marshal.PtrToStructure(contact.DangerousGetHandle(), typeof(PEER_CONTACT)); 337PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 346PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(watchlistData.pContact, typeof(PEER_CONTACT)); 537PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 548PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(endpointData.pContact, typeof(PEER_CONTACT)); 553PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(endpointData.pEndPoint, typeof(PEER_ENDPOINT)); 744PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 753PEER_PRESENCE_INFO ppi = (PEER_PRESENCE_INFO)Marshal.PtrToStructure(presenceData.pPresenceInfo, typeof(PEER_PRESENCE_INFO)); 763PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(presenceData.pContact, typeof(PEER_CONTACT)); 768PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(presenceData.pEndPoint, typeof(PEER_ENDPOINT)); 963PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 967PEER_APPLICATION pa = (PEER_APPLICATION)Marshal.PtrToStructure(appData.pApplication, typeof(PEER_APPLICATION)); 975PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(appData.pContact, typeof(PEER_CONTACT)); 980PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(appData.pEndPoint, typeof(PEER_ENDPOINT)); 1175PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1180PEER_OBJECT po = (PEER_OBJECT)Marshal.PtrToStructure(objData.pObject, typeof(PEER_OBJECT)); 1188PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(objData.pContact, typeof(PEER_CONTACT)); 1193PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(objData.pEndPoint, typeof(PEER_ENDPOINT)); 1293PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(pContactPtr, typeof(PEER_CONTACT)); 1356PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(safeContact.DangerousGetHandle(), typeof(PEER_CONTACT)); 1441PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(contact.DangerousGetHandle(), typeof(PEER_CONTACT));
net\PeerToPeer\Collaboration\MyContact.cs (9)
181PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 189PEER_PRESENCE_INFO ppi = (PEER_PRESENCE_INFO)Marshal.PtrToStructure(presenceData.pPresenceInfo, typeof(PEER_PRESENCE_INFO)); 197PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(presenceData.pEndPoint, typeof(PEER_ENDPOINT)); 347PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 352PEER_APPLICATION pa = (PEER_APPLICATION)Marshal.PtrToStructure(appData.pApplication, typeof(PEER_APPLICATION)); 358PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(appData.pEndPoint, typeof(PEER_ENDPOINT)); 515PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 520PEER_OBJECT po = (PEER_OBJECT)Marshal.PtrToStructure(objData.pObject, typeof(PEER_OBJECT)); 526PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(objData.pEndPoint, typeof(PEER_ENDPOINT));
net\PeerToPeer\Collaboration\Peer.cs (6)
402PEER_PRESENCE_INFO ppi = (PEER_PRESENCE_INFO)Marshal.PtrToStructure(ptrPeerPresenceInfo, typeof(PEER_PRESENCE_INFO)); 600Marshal.Copy(pPeerObject->data.pbData, data, 0, (int)pPeerObject->data.cbData); 685Marshal.Copy(invitationData, 0, pi.applicationData.pbData, invitationData.Length); 749PEER_INVITATION_RESPONSE pir = (PEER_INVITATION_RESPONSE)Marshal.PtrToStructure(safeResponse.DangerousGetHandle(), 1108Marshal.Copy(m_inviteData, 0, pi.applicationData.pbData, m_inviteData.Length); 1259pir = (PEER_INVITATION_RESPONSE)Marshal.PtrToStructure(response.DangerousGetHandle(),
net\PeerToPeer\Collaboration\PeerApplication.cs (4)
379PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 383PEER_APPLICATION pa = (PEER_APPLICATION)Marshal.PtrToStructure(appData.pApplication, typeof(PEER_APPLICATION)); 396PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(appData.pContact, typeof(PEER_CONTACT)); 401PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(appData.pEndPoint, typeof(PEER_ENDPOINT));
net\PeerToPeer\Collaboration\PeerCollaboration.cs (22)
50PEER_PRESENCE_INFO ppi = (PEER_PRESENCE_INFO)Marshal.PtrToStructure(ptrPeerPresenceInfo, 256PEER_APP_LAUNCH_INFO pali = (PEER_APP_LAUNCH_INFO)Marshal.PtrToStructure(appLaunchInfoData.DangerousGetHandle(), 262PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(pali.pContact, typeof(PEER_CONTACT)); 266PEER_INVITATION pi = (PEER_INVITATION)Marshal.PtrToStructure(pali.pInvitation, typeof(PEER_INVITATION)); 274Marshal.Copy(pi.applicationData.pbData, data, 0, (int)pi.applicationData.cbData); 279PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(pali.pEndpoint, typeof(PEER_ENDPOINT)); 436PEER_PEOPLE_NEAR_ME pnm = (PEER_PEOPLE_NEAR_ME)Marshal.PtrToStructure(pContactPtr, typeof(PEER_PEOPLE_NEAR_ME)); 440peerNearMe.Nickname = Marshal.PtrToStringUni(pnm.pwzNickname); ; 524Marshal.Copy(application.Data, 0, appRegInfo.application.data.pbData, application.Data.Length); 718string description = Marshal.PtrToStringUni(pPeerApp->pwzDescription); 723Marshal.Copy(pPeerApp->data.pbData, data, 0, (int)pPeerApp->data.cbData); 762Marshal.PtrToStructure(safeAppRegInfo.DangerousGetHandle(), 824Marshal.Copy(peerObject.Data, 0, po.data.pbData, peerObject.Data.Length); 952Marshal.Copy(pPeerObject->data.pbData, data, 0, (int)pPeerObject->data.cbData); 1133PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1292PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1299PEER_PRESENCE_INFO ppi = (PEER_PRESENCE_INFO)Marshal.PtrToStructure(presenceData.pPresenceInfo, typeof(PEER_PRESENCE_INFO)); 1463PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1468PEER_OBJECT po = (PEER_OBJECT)Marshal.PtrToStructure(objData.pObject, typeof(PEER_OBJECT)); 1474PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(objData.pEndPoint, typeof(PEER_ENDPOINT)); 1625PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1631PEER_APPLICATION pa = (PEER_APPLICATION)Marshal.PtrToStructure(appData.pApplication, typeof(PEER_APPLICATION));
net\PeerToPeer\Collaboration\PeerContact.cs (16)
291PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(pEndPointPtr, typeof(PEER_ENDPOINT)); 404PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(contact.DangerousGetHandle(), typeof(PEER_CONTACT)); 1083string description = Marshal.PtrToStringUni(pPeerApp->pwzDescription); 1089Marshal.Copy(pPeerApp->data.pbData, data, 0, (int)pPeerApp->data.cbData); 1354PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1362PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(appData.pContact, typeof(PEER_CONTACT)); 1367PEER_APPLICATION pa = (PEER_APPLICATION)Marshal.PtrToStructure(appData.pApplication, typeof(PEER_APPLICATION)); 1374PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(appData.pEndPoint, typeof(PEER_ENDPOINT)); 1605PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1613PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(objData.pContact, typeof(PEER_CONTACT)); 1622PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(objData.pEndPoint, typeof(PEER_ENDPOINT)); 1626PEER_OBJECT po = (PEER_OBJECT)Marshal.PtrToStructure(objData.pObject, typeof(PEER_OBJECT)); 1856PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 1864PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(presenceData.pContact, typeof(PEER_CONTACT)); 1873PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(presenceData.pEndPoint, typeof(PEER_ENDPOINT)); 1880PEER_PRESENCE_INFO ppi = (PEER_PRESENCE_INFO)Marshal.PtrToStructure(presenceData.pPresenceInfo, typeof(PEER_PRESENCE_INFO));
net\PeerToPeer\Collaboration\PeerEndPoint.cs (3)
315PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 322PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(epData.pEndPoint, typeof(PEER_ENDPOINT)); 330PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(epData.pContact, typeof(PEER_CONTACT));
net\PeerToPeer\Collaboration\PeerNearMe.cs (4)
299PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 308PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(statusData.pEndPoint, typeof(PEER_ENDPOINT)); 650PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 656PEER_PEOPLE_NEAR_ME pnm = (PEER_PEOPLE_NEAR_ME)Marshal.PtrToStructure(pnmData.pPeopleNearMe, typeof(PEER_PEOPLE_NEAR_ME));
net\PeerToPeer\Collaboration\PeerObject.cs (4)
324PEER_COLLAB_EVENT_DATA ped = (PEER_COLLAB_EVENT_DATA)Marshal.PtrToStructure(eventData.DangerousGetHandle(), 328PEER_OBJECT po = (PEER_OBJECT)Marshal.PtrToStructure(objData.pObject, typeof(PEER_OBJECT)); 341PEER_CONTACT pc = (PEER_CONTACT)Marshal.PtrToStructure(objData.pContact, typeof(PEER_CONTACT)); 346PEER_ENDPOINT pe = (PEER_ENDPOINT)Marshal.PtrToStructure(objData.pEndPoint, typeof(PEER_ENDPOINT));
net\PeerToPeer\Collaboration\UnsafeCollabNativeMethods.cs (2)
134handle = Marshal.AllocHGlobal(cb); 145Marshal.FreeHGlobal(handle);
net\PeerToPeer\PeerNameRegistration.cs (6)
390int cbRequriedBytes = numAddresses * Marshal.SizeOf(typeof(IntPtr)); 391IntPtr pSocketAddrList = Marshal.AllocHGlobal(cbRequriedBytes); 419Marshal.FreeHGlobal(pSocketAddrList); 573int cbRequriedBytes = numAddresses * Marshal.SizeOf(typeof(IntPtr)); 574IntPtr pSocketAddrList = Marshal.AllocHGlobal(cbRequriedBytes); 600Marshal.FreeHGlobal(pSocketAddrList);
net\PeerToPeer\PeerNameResolver.cs (14)
309record.PeerName = new PeerName(Marshal.PtrToStringUni(pEndPointInfo->pwszPeerName)); 310string comment = Marshal.PtrToStringUni(pEndPointInfo->pwszComment); 318Marshal.Copy(pEndPointInfo->payLoad.pbPayload, record.Data, 0, (int)pEndPointInfo->payLoad.cbPayload); 324IntPtr pSOCKADDR = Marshal.ReadIntPtr(ppSOCKADDRs); 327Marshal.Copy(pSOCKADDR, AddressFamilyBuffer, 0, 2); 335Marshal.Copy(pSOCKADDR, buffer, 0, buffer.Length); 338ppSOCKADDRs = (IntPtr)((long)ppSOCKADDRs + Marshal.SizeOf(typeof(IntPtr))); 675record.PeerName = new PeerName(Marshal.PtrToStringUni(pEndPointInfo->pwszPeerName)); 676string comment = Marshal.PtrToStringUni(pEndPointInfo->pwszComment); 685Marshal.Copy(pEndPointInfo->payLoad.pbPayload, record.Data, 0, (int)pEndPointInfo->payLoad.cbPayload); 692IntPtr pSOCKADDR = Marshal.ReadIntPtr(ppSOCKADDRs); 695Marshal.Copy(pSOCKADDR, AddressFamilyBuffer, 0, 2); 703Marshal.Copy(pSOCKADDR, buffer, 0, buffer.Length); 706ppSOCKADDRs = (IntPtr)((long)ppSOCKADDRs + Marshal.SizeOf(typeof(IntPtr)));
net\PeerToPeer\PeerToPeerException.cs (2)
112string NativeMessage = Marshal.PtrToStringUni(NativeMessagePtr); 117p2pEx = new PeerToPeerException(message, Marshal.GetExceptionForHR(hr));
net\PeerToPeer\UnsafePeerToPeerMethods.cs (2)
163throw new PeerToPeerException(SR.GetString(SR.Pnrp_StartupFailed), Marshal.GetExceptionForHR(result)); 189return Marshal.PtrToStringUni(handle);
System.Runtime.Caching (1)
System\Caching\UnsafeNativeMethods.cs (1)
56dwLength = Marshal.SizeOf(typeof(MEMORYSTATUSEX));
System.Runtime.Remoting (17)
channels\core\corechannel.cs (6)
924int lastError = Marshal.GetLastWin32Error(); 928Marshal.Copy(sidIdentifierAuthorityPointer, sidIdentifierAuthority, 0, 6); 931lastError = Marshal.GetLastWin32Error(); 934uint subAuthorityCount = (uint)Marshal.ReadByte(subAuthorityCountPointer); 958lastError = Marshal.GetLastWin32Error(); 962uint number = (uint)Marshal.ReadInt32(subAuthorityPointer);
channels\http\httpserverchannel.cs (1)
459Marshal.GetLastWin32Error().ToString(CultureInfo.InvariantCulture)));
channels\ipc\ipcport.cs (9)
74attr.nLength = (int)Marshal.SizeOf(attr); 88attr.lpSecurityDescriptor = Marshal.UnsafeAddrOfPinnedArrayElement(sd, 0); 103int error = Marshal.GetLastWin32Error(); 115return status ? true : (Marshal.GetLastWin32Error() == NativePipe.ERROR_PIPE_CONNECTED); 159int error = Marshal.GetLastWin32Error(); 197int error = Marshal.GetLastWin32Error(); 211int error = Marshal.GetLastWin32Error(); 237int error = Marshal.GetLastWin32Error(); 306int error = Marshal.GetLastWin32Error();
channels\tcp\tcpserverchannel.cs (1)
400Marshal.GetLastWin32Error().ToString(CultureInfo.CurrentCulture)));
System.Security (356)
system\security\cryptography\cryptoapi.cs (12)
2298CAPI.CRYPTOAPI_BLOB blob = (CAPI.CRYPTOAPI_BLOB) Marshal.PtrToStructure(pBlob, typeof(CAPI.CRYPTOAPI_BLOB)); 2309Marshal.Copy(blob.pbData, data, 0, data.Length); 2421Marshal.Copy(pbEncoded.DangerousGetHandle(), encodedData, 0, (int) cbEncoded); 2455Marshal.Copy(pbEncoded.DangerousGetHandle(), encodedData, 0, (int) cbEncoded); 2506if (!rc && Marshal.GetLastWin32Error() == CAPI.NTE_BAD_KEYSET) { 2529container = Marshal.PtrToStringUni(pwszContainer); 2534provider = Marshal.PtrToStringUni(pwszProvider); 2553CRYPT_OID_INFO pOIDInfo = new CRYPT_OID_INFO(Marshal.SizeOf(typeof(CRYPT_OID_INFO))); 2559pOIDInfo = (CRYPT_OID_INFO) Marshal.PtrToStructure(pv, typeof(CAPI.CRYPT_OID_INFO)); 2575CRYPT_OID_INFO pOIDInfo = new CRYPT_OID_INFO(Marshal.SizeOf(typeof(CRYPT_OID_INFO))); 2581pOIDInfo = (CRYPT_OID_INFO) Marshal.PtrToStructure(pv, typeof(CAPI.CRYPT_OID_INFO)); 2697int dwErrorCode = Marshal.GetLastWin32Error();
system\security\cryptography\cryptographicattribute.cs (3)
33internal CryptographicAttributeObject (IntPtr pAttribute) : this((CAPI.CRYPT_ATTRIBUTE) Marshal.PtrToStructure(pAttribute, typeof(CAPI.CRYPT_ATTRIBUTE))) {} 88private CryptographicAttributeObjectCollection (IntPtr pCryptAttributes) : this((CAPI.CRYPT_ATTRIBUTES) Marshal.PtrToStructure(pCryptAttributes, typeof(CAPI.CRYPT_ATTRIBUTES))) {} 97IntPtr pCryptAttribute = new IntPtr((long)cryptAttributes.rgAttr + (index * Marshal.SizeOf(typeof(CAPI.CRYPT_ATTRIBUTE))));
system\security\cryptography\dataprotection.cs (4)
73int lastWin32Error = Marshal.GetLastWin32Error(); 93Marshal.Copy(blob.pbData, encryptedData, 0, encryptedData.Length); 148throw new CryptographicException(Marshal.GetLastWin32Error()); 156Marshal.Copy(userData.pbData, data, 0, data.Length);
system\security\cryptography\pkcs\envelopedpkcs7.cs (144)
284CAPI.CMSG_CTRL_DECRYPT_PARA ctrlDecryptPara = new CAPI.CMSG_CTRL_DECRYPT_PARA(Marshal.SizeOf(typeof(CAPI.CMSG_CTRL_DECRYPT_PARA))); 293hr2 = Marshal.GetHRForLastWin32Error(); 301CAPI.CMSG_CMS_RECIPIENT_INFO cmsRecipientInfo = (CAPI.CMSG_CMS_RECIPIENT_INFO) Marshal.PtrToStructure(keyAgree.pCmsgRecipientInfo.DangerousGetHandle(), typeof(CAPI.CMSG_CMS_RECIPIENT_INFO)); 303CAPI.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA keyAgreeDecryptPara = new CAPI.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA(Marshal.SizeOf(typeof(CAPI.CMSG_CTRL_KEY_AGREE_DECRYPT_PARA))); 325CAPI.CERT_CONTEXT pCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure(pOriginatorCert.DangerousGetHandle(), typeof(CAPI.CERT_CONTEXT)); 326CAPI.CERT_INFO certInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 338hr2 = Marshal.GetHRForLastWin32Error(); 362Marshal.Copy(pbContent.DangerousGetHandle(), content, 0, (int) cbContent); 410CAPI.CMSG_ENVELOPED_ENCODE_INFO encodeInfo = new CAPI.CMSG_ENVELOPED_ENCODE_INFO(Marshal.SizeOf(typeof(CAPI.CMSG_ENVELOPED_ENCODE_INFO))); 411SafeLocalAllocHandle ceei = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CMSG_ENVELOPED_ENCODE_INFO)))); 440Marshal.StructureToPtr(encodeInfo, ceei.DangerousGetHandle(), false); 450throw new CryptographicException(Marshal.GetLastWin32Error()); 459Marshal.DestroyStructure(ceei.DangerousGetHandle(), typeof(CAPI.CMSG_ENVELOPED_ENCODE_INFO)); 471throw new CryptographicException(Marshal.GetLastWin32Error()); 479throw new CryptographicException(Marshal.GetLastWin32Error()); 504throw new CryptographicException(Marshal.GetLastWin32Error()); 508throw new CryptographicException(Marshal.GetLastWin32Error()); 599throw new CryptographicException(Marshal.GetLastWin32Error()); 604CAPI.CMSG_RC2_AUX_INFO auxInfo = new CAPI.CMSG_RC2_AUX_INFO(Marshal.SizeOf(typeof(CAPI.CMSG_RC2_AUX_INFO))); 610SafeLocalAllocHandle pvAuxInfo = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CMSG_RC2_AUX_INFO)))); 611Marshal.StructureToPtr(auxInfo, pvAuxInfo.DangerousGetHandle(), false); 631int reiSize = recipients.Count * Marshal.SizeOf(typeof(CAPI.CMSG_RECIPIENT_ENCODE_INFO)); 638totalSize += Marshal.SizeOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO)); 642totalSize += Marshal.SizeOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO)); 667encryptParam.rgCertEncoded = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(certificates.Count * Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB)))); 669CAPI.CERT_CONTEXT pCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure(X509Utils.GetCertContext(certificates[index]).DangerousGetHandle(), typeof(CAPI.CERT_CONTEXT)); 671(index * Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB)))); 688CAPI.CERT_CONTEXT pCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure(X509Utils.GetCertContext(certificate).DangerousGetHandle(), typeof(CAPI.CERT_CONTEXT)); 689CAPI.CERT_INFO certInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 692(index * Marshal.SizeOf(typeof(CAPI.CMSG_RECIPIENT_ENCODE_INFO)))); 703IntPtr pcbSize = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO), "cbSize")); 704Marshal.WriteInt32(pcbSize, Marshal.SizeOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO))); 707IntPtr pKeyEncryptionAlgorithm = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO), "KeyEncryptionAlgorithm")); 711Marshal.Copy(objId, 0, encryptParam.rgszObjId[index].DangerousGetHandle(), objId.Length); 714IntPtr pszObjId = new IntPtr((long) pKeyEncryptionAlgorithm + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "pszObjId")); 715Marshal.WriteIntPtr(pszObjId, encryptParam.rgszObjId[index].DangerousGetHandle()); 718IntPtr pParameters = new IntPtr((long) pKeyEncryptionAlgorithm + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "Parameters")); 721IntPtr pcbData = new IntPtr((long) pParameters + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 722Marshal.WriteInt32(pcbData, (int) certInfo.SubjectPublicKeyInfo.Algorithm.Parameters.cbData); 725IntPtr ppbData = new IntPtr((long) pParameters + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 726Marshal.WriteIntPtr(ppbData, certInfo.SubjectPublicKeyInfo.Algorithm.Parameters.pbData); 732IntPtr pRecipientPublicKey = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO), "RecipientPublicKey")); 735pcbData = new IntPtr((long) pRecipientPublicKey + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_BIT_BLOB), "cbData")); 736Marshal.WriteInt32(pcbData, (int) certInfo.SubjectPublicKeyInfo.PublicKey.cbData); 739ppbData = new IntPtr((long) pRecipientPublicKey + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_BIT_BLOB), "pbData")); 740Marshal.WriteIntPtr(ppbData, certInfo.SubjectPublicKeyInfo.PublicKey.pbData); 743IntPtr pcUnusedBIts = new IntPtr((long) pRecipientPublicKey + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_BIT_BLOB), "cUnusedBits")); 744Marshal.WriteInt32(pcUnusedBIts, (int) certInfo.SubjectPublicKeyInfo.PublicKey.cUnusedBits); 747IntPtr pRecipientId = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO), "RecipientId")); 755throw new CryptographicException(Marshal.GetLastWin32Error()); 763throw new CryptographicException(Marshal.GetLastWin32Error()); 768IntPtr pdwIdChoice = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "dwIdChoice")); 769Marshal.WriteInt32(pdwIdChoice, (int) CAPI.CERT_ID_KEY_IDENTIFIER); 772IntPtr pKeyId = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "Value")); 775pcbData = new IntPtr((long) pKeyId + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 776Marshal.WriteInt32(pcbData, (int) cbData); 779ppbData = new IntPtr((long) pKeyId + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 780Marshal.WriteIntPtr(ppbData, pbData.DangerousGetHandle()); 784IntPtr pdwIdChoice = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "dwIdChoice")); 785Marshal.WriteInt32(pdwIdChoice, (int) CAPI.CERT_ID_ISSUER_SERIAL_NUMBER); 788IntPtr pIssuerSerialNumber = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "Value")); 791IntPtr pIssuer = new IntPtr((long) pIssuerSerialNumber + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ISSUER_SERIAL_NUMBER), "Issuer")); 794pcbData = new IntPtr((long) pIssuer + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 795Marshal.WriteInt32(pcbData, (int) certInfo.Issuer.cbData); 798ppbData = new IntPtr((long) pIssuer + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 799Marshal.WriteIntPtr(ppbData, certInfo.Issuer.pbData); 802IntPtr pSerialNumber = new IntPtr((long) pIssuerSerialNumber + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ISSUER_SERIAL_NUMBER), "SerialNumber")); 805pcbData = new IntPtr((long) pSerialNumber + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 806Marshal.WriteInt32(pcbData, (int) certInfo.SerialNumber.cbData); 809ppbData = new IntPtr((long) pSerialNumber + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 810Marshal.WriteIntPtr(ppbData, certInfo.SerialNumber.pbData); 812pKeyInfo = new IntPtr((long) pKeyInfo + Marshal.SizeOf(typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO))); 818IntPtr pcbSize = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "cbSize")); 819Marshal.WriteInt32(pcbSize, Marshal.SizeOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO))); 822IntPtr pKeyEncryptionAlgorithm = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "KeyEncryptionAlgorithm")); 826Marshal.Copy(objId, 0, encryptParam.rgszObjId[index].DangerousGetHandle(), objId.Length); 829IntPtr pszObjId = new IntPtr((long) pKeyEncryptionAlgorithm + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "pszObjId")); 830Marshal.WriteIntPtr(pszObjId, encryptParam.rgszObjId[index].DangerousGetHandle()); 836IntPtr pKeyWrapAlgorithm = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "KeyWrapAlgorithm")); 846Marshal.Copy(objId, 0, encryptParam.rgszKeyWrapObjId[cKeyAgree].DangerousGetHandle(), objId.Length); 849pszObjId = new IntPtr((long) pKeyWrapAlgorithm + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "pszObjId")); 850Marshal.WriteIntPtr(pszObjId, encryptParam.rgszKeyWrapObjId[cKeyAgree].DangerousGetHandle()); 856IntPtr pKeyWrapAuxInfo = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "pvKeyWrapAuxInfo")); 857Marshal.WriteIntPtr(pKeyWrapAuxInfo, encryptParam.pvEncryptionAuxInfo.DangerousGetHandle()); 864IntPtr pdwKeyChoice = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "dwKeyChoice")); 865Marshal.WriteInt32(pdwKeyChoice, (int) CAPI.CMSG_KEY_AGREE_EPHEMERAL_KEY_CHOICE); 868IntPtr pEphemeralAlgorithm = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "pEphemeralAlgorithmOrSenderId")); 869encryptParam.rgEphemeralIdentifier[cKeyAgree] = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER)))); 870Marshal.WriteIntPtr(pEphemeralAlgorithm, encryptParam.rgEphemeralIdentifier[cKeyAgree].DangerousGetHandle()); 875Marshal.Copy(objId, 0, encryptParam.rgszEphemeralObjId[cKeyAgree].DangerousGetHandle(), objId.Length); 877pszObjId = new IntPtr((long) encryptParam.rgEphemeralIdentifier[cKeyAgree].DangerousGetHandle() + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "pszObjId")); 878Marshal.WriteIntPtr(pszObjId, encryptParam.rgszEphemeralObjId[cKeyAgree].DangerousGetHandle()); 881IntPtr pParameters = new IntPtr((long) encryptParam.rgEphemeralIdentifier[cKeyAgree].DangerousGetHandle() + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "Parameters")); 884IntPtr pcbData = new IntPtr((long) pParameters + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 885Marshal.WriteInt32(pcbData, (int) certInfo.SubjectPublicKeyInfo.Algorithm.Parameters.cbData); 888IntPtr ppbData = new IntPtr((long) pParameters + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 889Marshal.WriteIntPtr(ppbData, certInfo.SubjectPublicKeyInfo.Algorithm.Parameters.pbData); 894IntPtr pcRecipientEncryptedKeys = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "cRecipientEncryptedKeys")); 895Marshal.WriteInt32(pcRecipientEncryptedKeys, 1); 898encryptParam.prgpEncryptedKey[cKeyAgree] = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(IntPtr)))); 899IntPtr prgpRecipientEncryptedKeys = new IntPtr((long) pKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO), "rgpRecipientEncryptedKeys")); 900Marshal.WriteIntPtr(prgpRecipientEncryptedKeys, encryptParam.prgpEncryptedKey[cKeyAgree].DangerousGetHandle()); 901encryptParam.rgpEncryptedKey[cKeyAgree] = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO)))); 902Marshal.WriteIntPtr(encryptParam.prgpEncryptedKey[cKeyAgree].DangerousGetHandle(), encryptParam.rgpEncryptedKey[cKeyAgree].DangerousGetHandle()); 905pcbSize = new IntPtr((long) encryptParam.rgpEncryptedKey[cKeyAgree].DangerousGetHandle() + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO), "cbSize")); 906Marshal.WriteInt32(pcbSize, Marshal.SizeOf(typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO))); 909IntPtr pRecipientPublicKey = new IntPtr((long) encryptParam.rgpEncryptedKey[cKeyAgree].DangerousGetHandle() + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO), "RecipientPublicKey")); 912pcbData = new IntPtr((long) pRecipientPublicKey + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_BIT_BLOB), "cbData")); 913Marshal.WriteInt32(pcbData, (int) certInfo.SubjectPublicKeyInfo.PublicKey.cbData); 916ppbData = new IntPtr((long) pRecipientPublicKey + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_BIT_BLOB), "pbData")); 917Marshal.WriteIntPtr(ppbData, certInfo.SubjectPublicKeyInfo.PublicKey.pbData); 920IntPtr pcUnusedBits = new IntPtr((long) pRecipientPublicKey + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_BIT_BLOB), "cUnusedBits")); 921Marshal.WriteInt32(pcUnusedBits, (int) certInfo.SubjectPublicKeyInfo.PublicKey.cUnusedBits); 924IntPtr pRecipientId = new IntPtr((long) encryptParam.rgpEncryptedKey[cKeyAgree].DangerousGetHandle() + (long) Marshal.OffsetOf(typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_ENCODE_INFO), "RecipientId")); 927IntPtr pdwIdChoice = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "dwIdChoice")); 930Marshal.WriteInt32(pdwIdChoice, (int) CAPI.CERT_ID_KEY_IDENTIFIER); 933IntPtr pKeyId = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "Value")); 941throw new CryptographicException(Marshal.GetLastWin32Error()); 948throw new CryptographicException(Marshal.GetLastWin32Error()); 953pcbData = new IntPtr((long) pKeyId + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 954Marshal.WriteInt32(pcbData, (int) cbKeyId); 957ppbData = new IntPtr((long) pKeyId + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 958Marshal.WriteIntPtr(ppbData, pbKeyId.DangerousGetHandle()); 961Marshal.WriteInt32(pdwIdChoice, (int) CAPI.CERT_ID_ISSUER_SERIAL_NUMBER); 964IntPtr pIssuerSerial = new IntPtr((long) pRecipientId + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ID), "Value")); 967IntPtr pIssuer = new IntPtr((long) pIssuerSerial + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ISSUER_SERIAL_NUMBER), "Issuer")); 970pcbData = new IntPtr((long) pIssuer + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 971Marshal.WriteInt32(pcbData, (int) certInfo.Issuer.cbData); 974ppbData = new IntPtr((long) pIssuer + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 975Marshal.WriteIntPtr(ppbData, certInfo.Issuer.pbData); 978IntPtr pSerialNumber = new IntPtr((long) pIssuerSerial + (long) Marshal.OffsetOf(typeof(CAPI.CERT_ISSUER_SERIAL_NUMBER), "SerialNumber")); 981pcbData = new IntPtr((long) pSerialNumber + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 982Marshal.WriteInt32(pcbData, (int) certInfo.SerialNumber.cbData); 985ppbData = new IntPtr((long) pSerialNumber + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 986Marshal.WriteIntPtr(ppbData, certInfo.SerialNumber.pbData); 991pKeyInfo = new IntPtr((long) pKeyInfo + Marshal.SizeOf(typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_ENCODE_INFO))); 1022uint totalSize = (uint)numRecipients * (uint)Marshal.SizeOf(typeof(IntPtr)); 1031CAPI.CERT_CONTEXT pCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure(dangerousCertContextHandle, typeof(CAPI.CERT_CONTEXT)); 1033Marshal.WriteIntPtr(pCertInfo, pCertContext.pCertInfo); 1034pCertInfo = new IntPtr((long) pCertInfo + Marshal.SizeOf(typeof(IntPtr))); 1036Debug.Assert(index == totalSize / (uint)Marshal.SizeOf(typeof(IntPtr)));
system\security\cryptography\pkcs\pkcs9attribute.cs (5)
114throw new CryptographicException(Marshal.GetLastWin32Error()); 117long signingTime = Marshal.ReadInt64(pbDecoded.DangerousGetHandle()); 127SafeLocalAllocHandle pbSigningTime = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(Int64)))); 128Marshal.WriteInt64(pbSigningTime.DangerousGetHandle(), ft); 132throw new CryptographicException(Marshal.GetLastWin32Error());
system\security\cryptography\pkcs\pkcsmisc.cs (25)
63Marshal.Copy(issuer.pbData, issuerBytes, 0, issuerBytes.Length); 89CAPI.CERT_NAME_INFO certNameInfo = (CAPI.CERT_NAME_INFO) Marshal.PtrToStructure(pbCertNameInfo.DangerousGetHandle(), typeof(CAPI.CERT_NAME_INFO)); 91CAPI.CERT_RDN certRdn = (CAPI.CERT_RDN) Marshal.PtrToStructure(new IntPtr((long) certNameInfo.rgRDN + (long) (i * Marshal.SizeOf(typeof(CAPI.CERT_RDN)))), typeof(CAPI.CERT_RDN)); 95CAPI.CERT_RDN_ATTR certRdnAttr = (CAPI.CERT_RDN_ATTR)Marshal.PtrToStructure(new IntPtr((long)certRdn.rgRDNAttr + (long)(j * Marshal.SizeOf(typeof(CAPI.CERT_RDN_ATTR)))), typeof(CAPI.CERT_RDN_ATTR)); 102Marshal.Copy(certRdnAttr.Value.pbData, ski, 0, ski.Length); 130Marshal.Copy(certId.Value.KeyId.pbData, ski, 0, ski.Length); 200Marshal.Copy(keyInfo.PublicKey.pbData, m_keyValue, 0, m_keyValue.Length); 237Marshal.Copy(certId.Value.KeyId.pbData, ski, 0, ski.Length); 321SafeLocalAllocHandle pKeyInfo = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CERT_PUBLIC_KEY_INFO)))); 322Marshal.StructureToPtr(keyInfo, pKeyInfo.DangerousGetHandle(), false); 326Marshal.Copy(keyInfo.Algorithm.Parameters.pbData, parameters, 0, parameters.Length); 328Marshal.DestroyStructure(pKeyInfo.DangerousGetHandle(), typeof(CAPI.CERT_PUBLIC_KEY_INFO)); 349throw new CryptographicException(Marshal.GetLastWin32Error()); 351CAPI.CRYPT_RC2_CBC_PARAMETERS rc2Parameters = (CAPI.CRYPT_RC2_CBC_PARAMETERS) Marshal.PtrToStructure(pbParameters.DangerousGetHandle(), typeof(CAPI.CRYPT_RC2_CBC_PARAMETERS)); 379throw new CryptographicException(Marshal.GetLastWin32Error()); 381if (cbParameters > Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB))) { 382CAPI.CRYPTOAPI_BLOB blob = (CAPI.CRYPTOAPI_BLOB)Marshal.PtrToStructure(pbParameters.DangerousGetHandle(), typeof(CAPI.CRYPTOAPI_BLOB)); 387Marshal.Copy(blob.pbData, parameters, 0, parameters.Length); 400Marshal.Copy(pbParameters.DangerousGetHandle(), parameters, 0, parameters.Length); 424Marshal.Copy(algorithmIdentifier.Parameters.pbData, parameters, 0, parameters.Length); 525m_pContent = Marshal.UnsafeAddrOfPinnedArrayElement(m_content, 0); 545throw new CryptographicException(Marshal.GetLastWin32Error()); 548throw new CryptographicException(Marshal.GetLastWin32Error());
system\security\cryptography\pkcs\pkcsutils.cs (58)
58CAPI.CERT_CONTEXT pCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure(X509Utils.GetCertContext(certificate).DangerousGetHandle(), typeof(CAPI.CERT_CONTEXT)); 59CAPI.CERT_INFO certInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pCertContext.pCertInfo, typeof(CAPI.CERT_INFO)); 76uint cbPeex = (uint) Marshal.SizeOf(typeof(CAPI.PROV_ENUMALGS_EX)); 77SafeLocalAllocHandle pPeex = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.PROV_ENUMALGS_EX)))); 81CAPI.PROV_ENUMALGS_EX peex = (CAPI.PROV_ENUMALGS_EX) Marshal.PtrToStructure(pPeex.DangerousGetHandle(), typeof(CAPI.PROV_ENUMALGS_EX)); 96uint cbCount = (uint) Marshal.SizeOf(typeof(uint)); 102checkErr(Marshal.GetLastWin32Error()); 110uint cbMsgType = (uint) Marshal.SizeOf(typeof(uint)); 116checkErr(Marshal.GetLastWin32Error()); 131checkErr(Marshal.GetLastWin32Error()); 140checkErr(Marshal.GetLastWin32Error()); 142CAPI.CRYPT_ALGORITHM_IDENTIFIER cryptAlgorithmIdentifier = (CAPI.CRYPT_ALGORITHM_IDENTIFIER) Marshal.PtrToStructure(pbAlgorithm.DangerousGetHandle(), typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER)); 165checkErr(Marshal.GetLastWin32Error()); 175checkErr(Marshal.GetLastWin32Error()); 195checkErr(Marshal.GetLastWin32Error()); 206checkErr(Marshal.GetLastWin32Error()); 215uint cbCount = (uint) Marshal.SizeOf(typeof(uint)); 223checkErr(Marshal.GetLastWin32Error()); 235throw new CryptographicException(Marshal.GetLastWin32Error()); 281uint cbCount = (uint) Marshal.SizeOf(typeof(uint)); 288checkErr(Marshal.GetLastWin32Error()); 298checkErr(Marshal.GetLastWin32Error()); 308checkErr(Marshal.GetLastWin32Error()); 311CAPI.CMSG_SIGNER_INFO cmsgSignerInfo2 = (CAPI.CMSG_SIGNER_INFO) Marshal.PtrToStructure(pbCmsgSignerInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_INFO)); 342int lastWin32Error = Marshal.GetLastWin32Error(); 344checkErr(Marshal.GetLastWin32Error()); 354checkErr(Marshal.GetLastWin32Error()); 371throw new CryptographicException(Marshal.GetLastWin32Error()); 380throw new CryptographicException(Marshal.GetLastWin32Error()); 383issuerSerial.IssuerName = Marshal.PtrToStringUni(ptr.DangerousGetHandle()); 385Marshal.Copy(pIssuerAndSerial.SerialNumber.pbData, serial, 0, serial.Length); 401throw new CryptographicException(Marshal.GetLastWin32Error()); 406CAPI.CRYPTOAPI_BLOB decodedBlob = (CAPI.CRYPTOAPI_BLOB) Marshal.PtrToStructure(pbDecoded.DangerousGetHandle(), typeof(CAPI.CRYPTOAPI_BLOB)); 409string octetString = Marshal.PtrToStringUni(decodedBlob.pbData); 424throw new CryptographicException(Marshal.GetLastWin32Error()); 453throw new CryptographicException(Marshal.GetLastWin32Error()); 573IntPtr pAttributeBlob = new IntPtr((long)cryptAttribute.rgValue + (index * Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB)))); 626uint cryptAttrSize = AlignedLength((uint) Marshal.SizeOf(typeof(I_CRYPT_ATTRIBUTE))); 627uint cryptBlobSize = AlignedLength((uint) Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB))); 668Marshal.Copy(objId, 0, pCryptAttribute->pszObjId, objId.Length); 684Marshal.Copy(encodedData, 0, pbEncodedData, encodedData.Length); 714CAPI.CMSG_SIGNER_ENCODE_INFO cmsSignerEncodeInfo = new CAPI.CMSG_SIGNER_ENCODE_INFO(Marshal.SizeOf(typeof(CAPI.CMSG_SIGNER_ENCODE_INFO))); 749throw new CryptographicException(Marshal.GetLastWin32Error()); 766Marshal.Copy(dummyName.RawData, 0, pbDataIssuer.DangerousGetHandle(), dummyName.RawData.Length); 805throw new CryptographicException(Marshal.GetLastWin32Error()); 814throw new CryptographicException(Marshal.GetLastWin32Error()); 853throw new CryptographicException(Marshal.GetLastWin32Error()); 897hr = Marshal.GetHRForLastWin32Error(); 959certBlob = CAPI.LocalAlloc(CAPI.LMEM_FIXED, new IntPtr(certificates.Count * Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB)))); 995throw new CryptographicException(Marshal.GetLastWin32Error()); 1062throw new CryptographicException(Marshal.GetLastWin32Error()); 1073new IntPtr(Marshal.SizeOf(typeof(CAPI.CRYPT_KEY_PROV_INFO)))); 1074Marshal.StructureToPtr(KeyProvInfo, pKeyProvInfo.DangerousGetHandle(), false); 1081new IntPtr( Marshal.SizeOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER)))); 1082Marshal.StructureToPtr(SignatureAlgorithm, pSignatureAlgorithm.DangerousGetHandle(), false); 1101Marshal.DestroyStructure(pKeyProvInfo.DangerousGetHandle(), typeof(CAPI.CRYPT_KEY_PROV_INFO)); 1103Marshal.DestroyStructure(pSignatureAlgorithm.DangerousGetHandle(), typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER)); 1107throw new CryptographicException(Marshal.GetLastWin32Error());
system\security\cryptography\pkcs\recipientinfo.cs (18)
182Marshal.Copy(keyTrans.EncryptedKey.pbData, m_encryptedKey, 0, m_encryptedKey.Length); 222IntPtr pEncryptedKeyInfo = Marshal.ReadIntPtr(new IntPtr((long) certIdRecipient.rgpRecipientEncryptedKeys + (long) (subIndex * Marshal.SizeOf(typeof(IntPtr))))); 223CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO encryptedKeyInfo = (CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO) Marshal.PtrToStructure(pEncryptedKeyInfo, typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO)); 231IntPtr pEncryptedKeyInfo = Marshal.ReadIntPtr(new IntPtr((long) publicKeyRecipient.rgpRecipientEncryptedKeys + (long) (subIndex * Marshal.SizeOf(typeof(IntPtr))))); 232CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO encryptedKeyInfo = (CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO) Marshal.PtrToStructure(pEncryptedKeyInfo, typeof(CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO)); 293CAPI.CRYPT_ATTRIBUTE_TYPE_VALUE otherKeyAttribute = (CAPI.CRYPT_ATTRIBUTE_TYPE_VALUE) Marshal.PtrToStructure(m_encryptedKeyInfo.pOtherAttr, typeof(CAPI.CRYPT_ATTRIBUTE_TYPE_VALUE)); 326Marshal.Copy(m_encryptedKeyInfo.EncryptedKey.pbData, m_encryptedKey, 0, m_encryptedKey.Length); 392uint cbCount = (uint) Marshal.SizeOf(typeof(uint)); 402throw new CryptographicException(Marshal.GetLastWin32Error()); 411throw new CryptographicException(Marshal.GetLastWin32Error()); 422CAPI.CMSG_CMS_RECIPIENT_INFO cmsRecipientInfo = (CAPI.CMSG_CMS_RECIPIENT_INFO) Marshal.PtrToStructure(pbCmsRecipientInfo.DangerousGetHandle(), typeof(CAPI.CMSG_CMS_RECIPIENT_INFO)); 426CAPI.CMSG_KEY_TRANS_RECIPIENT_INFO keyTrans = (CAPI.CMSG_KEY_TRANS_RECIPIENT_INFO) Marshal.PtrToStructure(cmsRecipientInfo.pRecipientInfo, typeof(CAPI.CMSG_KEY_TRANS_RECIPIENT_INFO)); 430CAPI.CMSG_KEY_AGREE_RECIPIENT_INFO keyAgree = (CAPI.CMSG_KEY_AGREE_RECIPIENT_INFO) Marshal.PtrToStructure(cmsRecipientInfo.pRecipientInfo, typeof(CAPI.CMSG_KEY_AGREE_RECIPIENT_INFO)); 433CAPI.CMSG_KEY_AGREE_CERT_ID_RECIPIENT_INFO certIdRecipient = (CAPI.CMSG_KEY_AGREE_CERT_ID_RECIPIENT_INFO) Marshal.PtrToStructure(cmsRecipientInfo.pRecipientInfo, typeof(CAPI.CMSG_KEY_AGREE_CERT_ID_RECIPIENT_INFO)); 439CAPI.CMSG_KEY_AGREE_PUBLIC_KEY_RECIPIENT_INFO publicKeyRecipient = (CAPI.CMSG_KEY_AGREE_PUBLIC_KEY_RECIPIENT_INFO) Marshal.PtrToStructure(cmsRecipientInfo.pRecipientInfo, typeof(CAPI.CMSG_KEY_AGREE_PUBLIC_KEY_RECIPIENT_INFO)); 457CAPI.CERT_INFO certInfo = (CAPI.CERT_INFO) Marshal.PtrToStructure(pbCertInfo.DangerousGetHandle(), typeof(CAPI.CERT_INFO));
system\security\cryptography\pkcs\signedpkcs7.cs (17)
162return Marshal.GetLastWin32Error(); 222uint cbCount = (uint) Marshal.SizeOf(typeof(uint)); 229throw new CryptographicException(Marshal.GetLastWin32Error()); 238throw new CryptographicException(Marshal.GetLastWin32Error()); 297CAPI.CMSG_SIGNED_ENCODE_INFO signedEncodeInfo = new CAPI.CMSG_SIGNED_ENCODE_INFO(Marshal.SizeOf(typeof(CAPI.CMSG_SIGNED_ENCODE_INFO))); 303SafeLocalAllocHandle pSignerEncodeInfo = CAPI.LocalAlloc(CAPI.LMEM_FIXED, new IntPtr(Marshal.SizeOf(typeof(CAPI.CMSG_SIGNER_ENCODE_INFO)))); 306Marshal.StructureToPtr(signerEncodeInfo, pSignerEncodeInfo.DangerousGetHandle(), false); 336throw new CryptographicException(Marshal.GetLastWin32Error()); 341throw new CryptographicException(Marshal.GetLastWin32Error()); 351Marshal.DestroyStructure(pSignerEncodeInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_ENCODE_INFO)); 376SafeLocalAllocHandle pSignerEncodeInfo = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CMSG_SIGNER_ENCODE_INFO)))); 380Marshal.StructureToPtr(signerEncodeInfo, pSignerEncodeInfo.DangerousGetHandle(), false); 387throw new CryptographicException(Marshal.GetLastWin32Error()); 390Marshal.DestroyStructure(pSignerEncodeInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_ENCODE_INFO)); 420throw new CryptographicException(Marshal.GetLastWin32Error()); 424throw new CryptographicException(Marshal.GetLastWin32Error()); 436throw new CryptographicException(Marshal.GetLastWin32Error());
system\security\cryptography\pkcs\signerinfo.cs (46)
53m_cmsgSignerInfo = (CAPI.CMSG_SIGNER_INFO) Marshal.PtrToStructure(pbCmsgSignerInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_INFO)); 72throw new CryptographicException(Marshal.GetLastWin32Error()); 79m_cmsgSignerInfo = (CAPI.CMSG_SIGNER_INFO) Marshal.PtrToStructure(pbCmsgSignerInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_INFO)); 242int cvseSize = Marshal.SizeOf(typeof(CAPI.CMSG_CTRL_VERIFY_SIGNATURE_EX_PARA)); 252throw new CryptographicException(Marshal.GetLastWin32Error()); 260Marshal.Copy(m_cmsgSignerInfo.EncryptedHash.pbData, ret, 0, ret.Length); 292throw new CryptographicException(Marshal.GetLastWin32Error()); 303SafeLocalAllocHandle pSignerEncodeInfo = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CMSG_SIGNER_ENCODE_INFO)))); 309Marshal.StructureToPtr(signerEncodeInfo, pSignerEncodeInfo.DangerousGetHandle(), false); 316throw new CryptographicException(Marshal.GetLastWin32Error()); 324Marshal.DestroyStructure(pSignerEncodeInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_ENCODE_INFO)); 349CAPI.CERT_CONTEXT pCertContext = (CAPI.CERT_CONTEXT) Marshal.PtrToStructure(X509Utils.GetCertContext(certificate).DangerousGetHandle(), typeof(CAPI.CERT_CONTEXT)); 352IntPtr pSubjectPublicKeyInfo = new IntPtr((long) pCertContext.pCertInfo + (long) Marshal.OffsetOf(typeof(CAPI.CERT_INFO), "SubjectPublicKeyInfo")); 355IntPtr pAlgorithm = new IntPtr((long) pSubjectPublicKeyInfo + (long) Marshal.OffsetOf(typeof(CAPI.CERT_PUBLIC_KEY_INFO), "Algorithm")); 358IntPtr pParameters = new IntPtr((long) pAlgorithm + (long) Marshal.OffsetOf(typeof(CAPI.CRYPT_ALGORITHM_IDENTIFIER), "Parameters")); 361IntPtr pObjId = Marshal.ReadIntPtr(pAlgorithm); 371IntPtr pcbData = new IntPtr((long) pParameters + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "cbData")); 372IntPtr ppbData = new IntPtr((long) pParameters + (long) Marshal.OffsetOf(typeof(CAPI.CRYPTOAPI_BLOB), "pbData")); 373if (Marshal.ReadInt32(pcbData) == 0) { 378if (Marshal.ReadIntPtr(ppbData) == IntPtr.Zero) { 382IntPtr pbData = Marshal.ReadIntPtr(ppbData); 383if ((uint) Marshal.ReadInt32(pbData) == CAPI.ASN_TAG_NULL) { 414throw new CryptographicException(Marshal.GetLastWin32Error()); 422throw new CryptographicException(Marshal.GetLastWin32Error()); 424Marshal.WriteInt32(pcbData, (int)cbParameters); 425Marshal.WriteIntPtr(ppbData, pbParameters.DangerousGetHandle()); 437throw new CryptographicException(Marshal.GetLastWin32Error()); 489lastWin32Error = Marshal.GetLastWin32Error(); 540CAPI.CMSG_CMS_SIGNER_INFO cmsgCmsSignerInfo = (CAPI.CMSG_CMS_SIGNER_INFO) Marshal.PtrToStructure(pbCmsgCmsSignerInfo.DangerousGetHandle(), typeof(CAPI.CMSG_CMS_SIGNER_INFO)); 551CAPI.CMSG_SIGNER_INFO cmsgSignerInfo = (CAPI.CMSG_SIGNER_INFO) Marshal.PtrToStructure(pbCmsgSignerInfo.DangerousGetHandle(), typeof(CAPI.CMSG_SIGNER_INFO)); 563CAPI.CRYPT_ATTRIBUTE attr = (CAPI.CRYPT_ATTRIBUTE) Marshal.PtrToStructure(pAttr, typeof(CAPI.CRYPT_ATTRIBUTE)); 572CAPI.CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA delPara = new CAPI.CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA(Marshal.SizeOf(typeof(CAPI.CMSG_CTRL_DEL_SIGNER_UNAUTH_ATTR_PARA))); 580throw new CryptographicException(Marshal.GetLastWin32Error()); 588uint cbCounterSignatureValue = (uint) ((attr.cValue - 1) * Marshal.SizeOf(typeof(CAPI.CRYPTOAPI_BLOB))); 608SafeLocalAllocHandle pNewAttr = CAPI.LocalAlloc(CAPI.LPTR, new IntPtr(Marshal.SizeOf(typeof(CAPI.CRYPT_ATTRIBUTE)))); 609Marshal.StructureToPtr(newAttr, pNewAttr.DangerousGetHandle(), false); 615throw new CryptographicException(Marshal.GetLastWin32Error()); 618Marshal.DestroyStructure(pNewAttr.DangerousGetHandle(), typeof(CAPI.CRYPT_ATTRIBUTE)); 624CAPI.CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA addPara = new CAPI.CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA(Marshal.SizeOf(typeof(CAPI.CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA))); 633throw new CryptographicException(Marshal.GetLastWin32Error()); 646CAPI.CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA addPara = new CAPI.CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA(Marshal.SizeOf(typeof(CAPI.CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA))); 664pAttr = new IntPtr((long) pAttr + (long) Marshal.SizeOf(typeof(CAPI.CRYPT_ATTRIBUTE))); 728uint cbCount = (uint) Marshal.SizeOf(typeof(uint)); 736throw new CryptographicException(Marshal.GetLastWin32Error()); 746throw new CryptographicException(Marshal.GetLastWin32Error()); 755throw new CryptographicException(Marshal.GetLastWin32Error());
system\security\cryptography\x509\x509ui.cs (7)
59ViewInfo.dwSize = (uint) Marshal.SizeOf(ViewInfo); 80dwErrorCode = Marshal.GetLastWin32Error(); 85throw new CryptographicException(Marshal.GetLastWin32Error()); 122throw new CryptographicException(Marshal.GetLastWin32Error()); 127csc.dwSize = (uint) Marshal.OffsetOf(typeof(CAPI.CRYPTUI_SELECTCERTIFICATE_STRUCTW), "hSelectedCertStore"); 154dwErrorCode = Marshal.GetLastWin32Error(); 158throw new CryptographicException(Marshal.GetLastWin32Error());
system\security\cryptography\x509\x509utils.cs (17)
131Marshal.Copy(arr, 0, pb.DangerousGetHandle(), arr.Length); 150int dwErrorCode = Marshal.GetLastWin32Error(); 154throw new CryptographicException(Marshal.GetLastWin32Error()); 162int dwErrorCode = Marshal.GetLastWin32Error(); 166throw new CryptographicException(Marshal.GetLastWin32Error()); 169CAPI.CRYPT_KEY_PROV_INFO pKeyProvInfo = (CAPI.CRYPT_KEY_PROV_INFO) Marshal.PtrToStructure(ptr.DangerousGetHandle(), typeof(CAPI.CRYPT_KEY_PROV_INFO)); 204throw new CryptographicException(Marshal.GetLastWin32Error()); 230throw new CryptographicException(Marshal.GetLastWin32Error()); 259int ptrSize = oids.Count * Marshal.SizeOf(typeof(IntPtr)); 267Marshal.WriteIntPtr(new IntPtr((long) safeLocalAllocHandle.DangerousGetHandle() + index * Marshal.SizeOf(typeof(IntPtr))), pOid); 269Marshal.Copy(ansiOid, 0, pOid, ansiOid.Length); 312ChainPara.cbSize = (uint) Marshal.SizeOf(ChainPara); 348return Marshal.GetHRForLastWin32Error(); 377CAPI.CERT_CHAIN_POLICY_PARA PolicyPara = new CAPI.CERT_CHAIN_POLICY_PARA(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_PARA))); 378CAPI.CERT_CHAIN_POLICY_STATUS PolicyStatus = new CAPI.CERT_CHAIN_POLICY_STATUS(Marshal.SizeOf(typeof(CAPI.CERT_CHAIN_POLICY_STATUS))); 404return Marshal.GetHRForLastWin32Error();
System.ServiceModel (255)
System\ServiceModel\Activation\SharedMemory.cs (3)
40errorCode = Marshal.GetLastWin32Error(); 82int errorCode = Marshal.GetLastWin32Error(); 121int errorCode = Marshal.GetLastWin32Error();
System\ServiceModel\Activation\Utility.cs (10)
64int error = Marshal.GetLastWin32Error(); 80int error = Marshal.GetLastWin32Error(); 95int error = Marshal.GetLastWin32Error(); 193int error = Marshal.GetLastWin32Error(); 219int error = Marshal.GetLastWin32Error(); 245int errorCode = Marshal.GetLastWin32Error(); 309error = Marshal.GetLastWin32Error(); 321error = Marshal.GetLastWin32Error(); 415int errorCode = Marshal.GetLastWin32Error(); 430return (ListenerUnsafeNativeMethods.SERVICE_STATUS_PROCESS)Marshal.PtrToStructure((IntPtr)pServiceStatusProcess, typeof(ListenerUnsafeNativeMethods.SERVICE_STATUS_PROCESS));
System\ServiceModel\Administration\WbemProvider.cs (11)
156Marshal.ReleaseComObject(wbemSink); 164IntPtr pUnk = Marshal.GetIUnknownForObject(comObject); 165Marshal.ReleaseComObject(comObject); 166this.wbemServices = (WbemNative.IWbemServices)Marshal.GetObjectForIUnknown(pUnk); 167Marshal.Release(pUnk); 256Marshal.ReleaseComObject(wbemSink); 377Marshal.ReleaseComObject(wbemSink); 439Marshal.ReleaseComObject(wbemSink); 501Marshal.ReleaseComObject(wbemSink); 562Marshal.ReleaseComObject(wbemSink); 654Marshal.ReleaseComObject(wbemSink);
System\ServiceModel\Channels\AppContainerInfo.cs (3)
190errorCode = Marshal.GetLastWin32Error(); 204errorCode = Marshal.GetLastWin32Error(); 255int error = Marshal.GetLastWin32Error();
System\ServiceModel\Channels\ChannelBindingUtility.cs (2)
265base.SetHandle(Marshal.AllocHGlobal(bytesToAllocate)); 271Marshal.FreeHGlobal(this.handle);
System\ServiceModel\Channels\MsmqQueue.cs (4)
346Marshal.ReleaseComObject(dtcTransaction); 508Marshal.ReleaseComObject(dtcTransaction); 562Marshal.ReleaseComObject(dtcTransaction); 668Marshal.ReleaseComObject(dtcTransaction);
System\ServiceModel\Channels\MsmqSubqueueLockingQueue.cs (3)
383retProp = (UnsafeNativeMethods.MQPROPVARIANT)Marshal.PtrToStructure(props.variants, typeof(UnsafeNativeMethods.MQPROPVARIANT)); 386Marshal.Copy(retProp.stringArraysValue.stringArrays, stringArrays, 0, retProp.stringArraysValue.count); 390subqueues.Add(Marshal.PtrToStringUni(stringArrays[i]));
System\ServiceModel\Channels\OverlappedContext.cs (6)
189this.bufferPtr = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); 262this.bufferPtr = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); 294Fx.Assert(this.bufferPtr == null || this.bufferPtr == (byte*)Marshal.UnsafeAddrOfPinnedArrayElement((byte[])holder, 0), 382Fx.Assert(pThis.bufferPtr == null || pThis.bufferPtr == (byte*)Marshal.UnsafeAddrOfPinnedArrayElement((byte[])pThis.bufferHolder[0], 0), 418Fx.Assert(pThis.bufferPtr == null || pThis.bufferPtr == (byte*)Marshal.UnsafeAddrOfPinnedArrayElement((byte[])pThis.bufferHolder[0], 0), 446Fx.Assert(pThis.bufferPtr == null || pThis.bufferPtr == (byte*)Marshal.UnsafeAddrOfPinnedArrayElement((byte[])pThis.bufferHolder[0], 0),
System\ServiceModel\Channels\PeerHelpers.cs (1)
736return new Win32Exception(Marshal.GetLastWin32Error());
System\ServiceModel\Channels\PeerUnsafeNativeCryptMethods.cs (2)
168Marshal.Copy(bytes, 0, (IntPtr)data, bytes.Length); 210Marshal.Copy((IntPtr)data, bytes, 0, cbData);
System\ServiceModel\Channels\PeerUnsafeNativeMethods.cs (18)
99error = Marshal.GetLastWin32Error(); 240int size = Marshal.SizeOf(socketAddressList); 244Marshal.StructureToPtr(socketAddressList, result, false); 251int size = Marshal.SizeOf(socketAddressList); 254Marshal.StructureToPtr(socketAddressList, result, false); 265result.SetHandle(Marshal.AllocHGlobal(size)); 273SocketAddressList socketAddressList = (SocketAddressList)Marshal.PtrToStructure(this, typeof(SocketAddressList)); 277if (!(socketAddressList.Addresses[i].SockAddrLength == Marshal.SizeOf(typeof(sockaddr_in6)))) 281sockaddr_in6 sockAddr = (sockaddr_in6)Marshal.PtrToStructure(socketAddressList.Addresses[i].SockAddr, typeof(sockaddr_in6)); 303int size = Marshal.SizeOf(typeof(sockaddr_in6)); 306Marshal.StructureToPtr(sa, (IntPtr)result, false); 317result.SetHandle(Marshal.AllocHGlobal(size)); 335Marshal.FreeHGlobal(handle); 346result.SetHandle(Marshal.AllocHGlobal(size)); 357int size = Marshal.SizeOf(typeof(T)); 359Marshal.StructureToPtr(id, (IntPtr)result, false); 368int guidSize = Marshal.SizeOf(typeof(Guid)); 370Marshal.Copy(input.ToByteArray(), 0, (IntPtr)result, guidSize);
System\ServiceModel\Channels\PipeConnection.cs (20)
281int error = Marshal.GetLastWin32Error(); 375int error = Marshal.GetLastWin32Error(); 645CreatePipeDuplicationFailedException(Marshal.GetLastWin32Error()), ExceptionEventType); 654CreatePipeDuplicationFailedException(Marshal.GetLastWin32Error()), ExceptionEventType); 661CreatePipeDuplicationFailedException(Marshal.GetLastWin32Error()), ExceptionEventType); 869error = Marshal.GetLastWin32Error(); 937error = Marshal.GetLastWin32Error(); 1378int error = Marshal.GetLastWin32Error(); 1476int error = Marshal.GetLastWin32Error(); 1597int error = Marshal.GetLastWin32Error(); 1613int error = Marshal.GetLastWin32Error(); 1812int error = Marshal.GetLastWin32Error(); 1822error = Marshal.GetLastWin32Error(); 2083error = Marshal.GetLastWin32Error(); 2271int error = Marshal.GetLastWin32Error(); 2363error = Marshal.GetLastWin32Error(); 2559error = Marshal.GetLastWin32Error(); 2613int error = Marshal.GetLastWin32Error(); 2621error = Marshal.GetLastWin32Error(); 2731int error = Marshal.GetLastWin32Error();
System\ServiceModel\Channels\PnrpPeerResolver.cs (48)
1115Marshal.StructureToPtr(native, target, false); 1255socketAddress.iSockaddrLength = Marshal.SizeOf(typeof(sockaddr_in)); 1261Marshal.StructureToPtr(sa, (IntPtr)socketAddress.lpSockAddr, false); 1265socketAddress.iSockaddrLength = Marshal.SizeOf(typeof(sockaddr_in6)); 1272Marshal.StructureToPtr(sa, (IntPtr)socketAddress.lpSockAddr, false); 1353result.dwSize = Marshal.SizeOf(typeof(WsaQuerySetNative)); 1385int blobSize = Marshal.SizeOf(typeof(PnrpInfoNative)); 1386blob.pBlobData = CriticalAllocHandle.FromSize(blobSize + Marshal.SizeOf(typeof(BlobNative))); 1391nativeBlob.pBlobData = (IntPtr)(((IntPtr)blob.pBlobData).ToInt64() + Marshal.SizeOf(typeof(BlobNative))); 1392Marshal.StructureToPtr(nativeBlob, (IntPtr)blob.pBlobData, false); 1397Marshal.StructureToPtr(nativeInfo, (IntPtr)nativeBlob.pBlobData, false); 1402int blobSize = Marshal.SizeOf(input.GetType()); 1403blob.pBlobData = CriticalAllocHandle.FromSize(blobSize + Marshal.SizeOf(typeof(BlobNative))); 1408nativeBlob.pBlobData = (IntPtr)(((IntPtr)blob.pBlobData).ToInt64() + Marshal.SizeOf(typeof(BlobNative))); 1409Marshal.StructureToPtr(nativeBlob, (IntPtr)blob.pBlobData, false); 1411cloudInfo.dwSize = Marshal.SizeOf(typeof(PnrpCloudInfo)); 1412Marshal.StructureToPtr(cloudInfo, (IntPtr)nativeBlob.pBlobData, false); 1434result.SetHandle(Marshal.StringToHGlobalUni(input)); 1444int structSize = Marshal.SizeOf(typeof(WsaQuerySetNative)); 1446structSize += safeQuerySet.addressList.Length * Marshal.SizeOf(typeof(CsAddrInfoNative)); 1535Int64 sockAddressStart = target.ToInt64() + Marshal.SizeOf(typeof(WsaQuerySetNative)); 1538Marshal.StructureToPtr(native, target, false); 1548int sizeOfCsAddrInfo = Marshal.SizeOf(typeof(CsAddrInfoNative)); 1732Marshal.SizeOf(typeof(WsaNamespaceInfo))); 1733WsaNamespaceInfo nsInfo = (WsaNamespaceInfo)Marshal.PtrToStructure(nsInfoPtr, 1776cloudInfo.dwSize = Marshal.SizeOf(typeof(PnrpCloudInfo)); 1800int size = Marshal.SizeOf(typeof(WsaQuerySetSafe)) + 200; 1875pnrpInfo.dwSize = Marshal.SizeOf(pnrpInfo); 1929identityInfo.dwSize = Marshal.SizeOf(typeof(PnrpInfo)); 2010resolveQueryInfo.dwSize = Marshal.SizeOf(typeof(PnrpInfo)); 2057int size = Marshal.SizeOf(typeof(WsaQuerySetSafe)) + 400; 2149nativeQuerySet = (WsaQuerySetNative)Marshal.PtrToStructure(pNativeData, 2152int sizeOfCsAddrInfo = Marshal.SizeOf(typeof(CsAddrInfoNative)); 2155querySet.Context = Marshal.PtrToStringUni(nativeQuerySet.lpszContext); 2157querySet.ServiceInstanceName = Marshal.PtrToStringUni(nativeQuerySet.lpszServiceInstanceName); 2158querySet.Comment = Marshal.PtrToStringUni(nativeQuerySet.lpszComment); 2165nativeCsAddrInfo = (CsAddrInfoNative)Marshal.PtrToStructure(addressPtr, 2175querySet.NSProviderId = (Guid)Marshal.PtrToStructure(nativeQuerySet.lpNSProviderId, 2179querySet.ServiceClassId = (Guid)Marshal.PtrToStructure(nativeQuerySet.lpServiceClassId, 2190BlobNative blob = (BlobNative)Marshal.PtrToStructure(nativeQuerySet.lpBlob, typeof(BlobNative)); 2193querySet.Blob = (PnrpCloudInfo)Marshal.PtrToStructure(blob.pBlobData, 2205BlobSafe blob = (BlobSafe)Marshal.PtrToStructure(nativeQuerySet.lpBlob, typeof(BlobSafe)); 2209PnrpInfo pnrpInfo = (PnrpInfo)Marshal.PtrToStructure(blob.pBlobData, 2224AddressFamily addressFamily = (AddressFamily)Marshal.ReadInt16(socketAddress.lpSockAddr); 2229if (socketAddress.iSockaddrLength == Marshal.SizeOf(typeof(sockaddr_in))) 2231sockaddr_in sa = (sockaddr_in)Marshal.PtrToStructure(socketAddress.lpSockAddr, 2240if (socketAddress.iSockaddrLength == Marshal.SizeOf(typeof(sockaddr_in6))) 2242sockaddr_in6 sa = (sockaddr_in6)Marshal.PtrToStructure(socketAddress.lpSockAddr,
System\ServiceModel\Channels\SelfSignedCertificate.cs (3)
118int error = Marshal.GetLastWin32Error(); 182int error = Marshal.GetLastWin32Error(); 194int error = Marshal.GetLastWin32Error();
System\ServiceModel\Channels\UnsafeNativeMethods.cs (5)
474internal int nLength = Marshal.SizeOf(typeof(SECURITY_ATTRIBUTES)); 825int errorCode = Marshal.GetLastWin32Error(); 851int error = Marshal.GetLastWin32Error(); 875int errorCode = Marshal.GetLastWin32Error(); 893int errorCode = Marshal.GetLastWin32Error();
System\ServiceModel\Channels\WebSocketHelper.cs (2)
44static readonly int PropertyBufferSize = ((2 * Marshal.SizeOf(typeof(uint))) + Marshal.SizeOf(typeof(bool))) + IntPtr.Size;
System\ServiceModel\ComIntegration\ComIntegrationManifestGenerator.cs (1)
143String strClsId = "{" + Marshal.GenerateGuidForType(t).ToString().ToUpperInvariant() + "}";
System\ServiceModel\ComIntegration\ComPlusAuthorization.cs (27)
35int error = Marshal.GetLastWin32Error(); 46int error = Marshal.GetLastWin32Error(); 63int level = Marshal.ReadInt32(buffer.DangerousGetHandle()); 76int level = Marshal.ReadInt32(buffer.DangerousGetHandle()); 87Marshal.PtrToStructure(buffer.DangerousGetHandle(), typeof(TOKEN_STATISTICS)); 107int error = Marshal.GetLastWin32Error(); 115int error = Marshal.GetLastWin32Error(); 120error = Marshal.GetLastWin32Error(); 134int error = Marshal.GetLastWin32Error(); 153int error = Marshal.GetLastWin32Error(); 183int error = Marshal.GetLastWin32Error(); 315int error = Marshal.GetLastWin32Error(); 322uint PrivilegeSetLength = (uint)Marshal.SizeOf(PrivilegeSet); 328int error = Marshal.GetLastWin32Error(); 440IntPtr secCtx = Marshal.GetIUnknownForObject(this); 447Marshal.Release(secCtx); 493Marshal.WriteInt32(authnSvc, (int)tempAuthnSvc); 498Marshal.WriteInt32(authzSvc, (int)RPC_C_AUTHZ_NONE); 503IntPtr str = Marshal.StringToCoTaskMemUni(SecurityUtils.GetProcessIdentity().Name); 505Marshal.WriteIntPtr(serverPrincipalName, str); 513Marshal.WriteInt32(authnLevel, (int)RPC_C_AUTHN_LEVEL_DEFAULT); 518Marshal.WriteInt32(impLevel, 0); 523IntPtr str = Marshal.StringToCoTaskMemUni(clientIdentity.Name); 525Marshal.WriteIntPtr(clientPrincipalName, str); 530Marshal.WriteInt32(Capabilities, 0); 602if (Marshal.GetObjectForIUnknown(secCtx) != this) 607Marshal.Release(secCtx);
System\ServiceModel\ComIntegration\ComPlusInstanceContextInitializer.cs (2)
81Marshal.ReleaseComObject(serviceConfig); 238Marshal.Release(pUnk);
System\ServiceModel\ComIntegration\ComPlusInstanceProvider.cs (1)
143Marshal.ReleaseComObject(instance);
System\ServiceModel\ComIntegration\ComPlusSynchronizationContext.cs (1)
50while (Marshal.ReleaseComObject(this.activity) > 0);
System\ServiceModel\ComIntegration\ComProxy.cs (7)
22inner = Marshal.CreateAggregatedObject(outer, obj); 23int refCount = Marshal.AddRef(inner); 26Marshal.Release(inner); 27Marshal.Release(inner); 43int hr = Marshal.QueryInterface(inner, ref riid, out tearoff); 61Marshal.Release(inner); 75Marshal.AddRef(inner);
System\ServiceModel\ComIntegration\DispatchProxy.cs (21)
63Marshal.Release(inner); 193Marshal.WriteInt32(pDispID, index * sizeof(int), (int)dispID); 285exceptionInfo.scode = Marshal.GetHRForException(e); 286Marshal.StructureToPtr(exceptionInfo, pExcepInfo, false); 323Marshal.GetNativeVariantForObject(result, pVarResult); 329Marshal.GetNativeVariantForObject(arrDest, pVarResult); 341return Marshal.GetHRForException(e); 364uint displacement = (uint)(index * Marshal.SizeOf(typeof(TagVariant))); 366object ret = Marshal.GetObjectForNativeVariant(GetDisp(baseArray, displacement)); 400uint displacement = (uint)(index * Marshal.SizeOf(typeof(TagVariant))); 402TagVariant varBase = (TagVariant)Marshal.PtrToStructure(GetDisp(baseArray, displacement), typeof(TagVariant)); 405TagVariant varActualVariant = (TagVariant)Marshal.PtrToStructure(varBase.ptr, typeof(TagVariant)); 411IntPtr pSafeArray = (IntPtr)Marshal.PtrToStructure(ppArray, typeof(IntPtr)); 418if (sizeofElement != Marshal.SizeOf(typeof(TagVariant))) 430object[] objects = Marshal.GetObjectsForNativeVariants(pRawData, uBound + 1); 507uint displacement = (uint)(index * Marshal.SizeOf(typeof(TagVariant))); 508TagVariant var = (TagVariant)Marshal.PtrToStructure(GetDisp(baseArray, displacement), typeof(TagVariant)); 512Marshal.GetNativeVariantForObject(val, var.ptr); 518Marshal.GetNativeVariantForObject(arrDest, var.ptr); 535uint displacement = (uint)(index * Marshal.SizeOf(typeof(TagVariant))); 536ushort vt = (ushort)Marshal.ReadInt16(GetDisp(baseArray, displacement));
System\ServiceModel\ComIntegration\MonikerBuilder.cs (1)
79Marshal.Release(ppv);
System\ServiceModel\ComIntegration\OuterProxyWrapper.cs (4)
79getCODelegate = (DelegateDllGetClassObject)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(DelegateDllGetClassObject)); 114Marshal.ReleaseComObject(cf); 140Marshal.ReleaseComObject(proxyProvider); 160Marshal.ReleaseComObject(proxyProvider);
System\ServiceModel\ComIntegration\PersistStreamTypeWrapper.cs (15)
58Marshal.Copy(pBuff, byteArray, 0, sizeOfByteArray); 89Marshal.ReleaseComObject(stream); 106Marshal.Copy(byteStream, 0, pBuff, byteStream.Length); 114Marshal.ReleaseComObject(stream); 158if (Marshal.IsComObject(obj)) 160IntPtr punk = Marshal.GetIUnknownForObject(obj); 169int hr = Marshal.QueryInterface(punk, ref iidPersistStream, out persistStream); 186Marshal.ReleaseComObject(persistableObject); 191Marshal.Release(persistStream); 199Marshal.Release(punk); 214IntPtr punk = Marshal.GetIUnknownForObject(obj); 223int hr = Marshal.QueryInterface(punk, ref iidPersistStream, out persistStream); 239Marshal.ReleaseComObject(persistableObject); 244Marshal.Release(persistStream); 252Marshal.Release(punk);
System\ServiceModel\ComIntegration\ProxyBuilder.cs (2)
19Marshal.WriteIntPtr(ppv, IntPtr.Zero); 37Marshal.WriteIntPtr(ppv, OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref riid));
System\ServiceModel\ComIntegration\ProxyManager.cs (5)
114return Marshal.GetHRForException(e); 144Marshal.WriteInt32(pDispID, (int)dispID); 172Marshal.StructureToPtr(variant, pVarResult, true); 186exceptionInfo.scode = Marshal.GetHRForException(e); 187Marshal.StructureToPtr(exceptionInfo, pExcepInfo, false);
System\ServiceModel\ComIntegration\SafeNativeMethods.cs (5)
546IntPtr pUnk = Marshal.GetIUnknownForObject(obj); 553int hr = Marshal.QueryInterface(pUnk, ref iid, out ppv); 555Marshal.Release(pUnk); 851retVal = Marshal.ReadInt32((IntPtr)pBuffer); 862retVal = Marshal.ReadInt64((IntPtr)pBuffer);
System\ServiceModel\ComIntegration\ServiceMoniker.cs (5)
82System.Runtime.InteropServices.Marshal.WriteInt32(pdwHash, 0); 134System.Runtime.InteropServices.Marshal.WriteInt32(pdwMksys, 0); 164System.Runtime.InteropServices.Marshal.WriteIntPtr(ppmkOut, IntPtr.Zero); 177System.Runtime.InteropServices.Marshal.WriteInt32(pchEaten, pszDisplayName.Length); 181System.Runtime.InteropServices.Marshal.WriteIntPtr(ppmkOut, ppv);
System\ServiceModel\ComIntegration\TearOffProxy.cs (2)
45return new ReturnMessage(DiagnosticUtility.ExceptionUtility.ThrowHelperError(new COMException(e.GetBaseException().Message, Marshal.GetHRForException(e.GetBaseException()))), msg); 61return new ReturnMessage(DiagnosticUtility.ExceptionUtility.ThrowHelperError(new COMException(returnMsg.Exception.GetBaseException().Message, Marshal.GetHRForException(returnMsg.Exception.GetBaseException()))), msg);
System\ServiceModel\ComIntegration\TransactionProxy.cs (4)
205Marshal.WriteIntPtr(voterBallot, ppv); 360Marshal.ReleaseComObject(this.notification); 370Marshal.ReleaseComObject(this.notification); 378Marshal.ReleaseComObject(this.notification);
System\ServiceModel\ComIntegration\TypeCacheManager.cs (1)
230Marshal.ReleaseComObject((object)typeLibrary);
System\ServiceModel\ComIntegration\TypeLibraryHelper.cs (1)
85System.Runtime.InteropServices.ComTypes.TYPELIBATTR attr = (System.Runtime.InteropServices.ComTypes.TYPELIBATTR)Marshal.PtrToStructure(ptr, typeof(System.Runtime.InteropServices.ComTypes.TYPELIBATTR));
System\ServiceModel\Dispatcher\SecurityImpersonationBehavior.cs (5)
404int errorCode = Marshal.GetLastWin32Error(); 411errorCode = Marshal.GetLastWin32Error(); 495int error = Marshal.GetLastWin32Error(); 509int error = Marshal.GetLastWin32Error(); 538int error = Marshal.GetLastWin32Error();
System\ServiceModel\Security\TlsSspiNegotiation.cs (1)
736_CERT_CONTEXT context = (_CERT_CONTEXT)Marshal.PtrToStructure(certContext.DangerousGetHandle(), typeof(_CERT_CONTEXT));
System\ServiceModel\Security\Tokens\IssuedSecurityTokenProvider.cs (1)
1074int error = Marshal.GetLastWin32Error();
System\ServiceModel\UpnEndpointIdentity.cs (2)
146int errorCode = Marshal.GetLastWin32Error(); 153errorCode = Marshal.GetLastWin32Error();
System.ServiceModel.Activation (11)
System\ServiceModel\Activation\Interop\SafeHGlobalHandleCritical.cs (3)
35Marshal.FreeHGlobal(handle); 54Marshal.Copy(bytes, 0, result.DangerousGetHandle(), bytes.Length); 79IntPtr ptr = Marshal.AllocHGlobal(cb);
System\ServiceModel\Activation\Interop\SafeNativeMethods.cs (1)
40error = Marshal.GetLastWin32Error();
System\ServiceModel\Activation\MetabaseReader.cs (5)
149return (UInt32)Marshal.ReadInt32(record.pbMDData); 152return Marshal.PtrToStringUni(record.pbMDData); 181while (endPos < record.dwMDDataLen && Marshal.ReadInt16(record.pbMDData, endPos) != 0) 187Marshal.ReadInt16(record.pbMDData, endPos - 2) != 0) 200list.Add(Marshal.PtrToStringUni(new IntPtr(record.pbMDData.ToInt64() + startPos),
System\ServiceModel\Activation\ServiceMemoryGates.cs (2)
68memoryStatus.dwLength = (uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.MEMORYSTATUSEX)); 72int error = Marshal.GetLastWin32Error();
System.ServiceModel.Internals (3)
System\Runtime\Interop\SafeEventLogWriteHandle.cs (1)
29int error = Marshal.GetLastWin32Error();
System\Runtime\Interop\UnsafeNativeMethods.cs (2)
107int error = Marshal.GetLastWin32Error(); 123int error = Marshal.GetLastWin32Error();
System.ServiceModel.WasHosting (2)
System\ServiceModel\WasHosting\MsmqIntegrationProcessProtocolHandler.cs (1)
25listenerChannelCallback.ReportStopped(Marshal.GetHRForException(ex));
System\ServiceModel\WasHosting\MsmqProcessProtocolHandler.cs (1)
25listenerChannelCallback.ReportStopped(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
System.Transactions (5)
System\Transactions\Oletx\DTCTransactionManager.cs (1)
67Marshal.Copy( whereaboutsBuffer.DangerousGetHandle(), this.whereabouts, 0, Convert.ToInt32(this.whereaboutsSize) );
System\Transactions\Oletx\OletxTransactionManager.cs (1)
324Marshal.Copy( prepareInfoBuffer.DangerousGetHandle(), prepareInfo, 0, Convert.ToInt32(prepareInfoSize) );
System\Transactions\SafeIUnknown.cs (1)
53Marshal.Release(ptr);
System\Transactions\TransactionInterop.cs (2)
133Marshal.Copy( cookieBuffer.DangerousGetHandle(), cookie, 0, Convert.ToInt32(cookieSize) ); 349Marshal.Copy( propagationTokenBuffer.DangerousGetHandle(), propagationToken, 0, Convert.ToInt32(tokenSize) );
System.Web (170)
AspNetEventSource.cs (2)
226PtrToNullChar = Marshal.AllocHGlobal(sizeof(char)); 233Marshal.FreeHGlobal(PtrToNullChar);
Configuration\CompilationSection.cs (1)
777int hresult = System.Runtime.InteropServices.Marshal.GetHRForException(e);
Configuration\ExpressServerConfig.cs (7)
125Marshal.FreeBSTR(pBstr); 144Marshal.FreeBSTR(pBstr); 169Marshal.Release(pAppCollection); 173Marshal.FreeBSTR(pBstr); 217Marshal.FreeBSTR(pBstrUserName); 220Marshal.FreeBSTR(pBstrPassword); 360Marshal.FreeBSTR(pBstr);
Configuration\IISVersionHelper.cs (2)
67Marshal.ReleaseComObject(_version); 71Marshal.ReleaseComObject(_versionManager);
Configuration\MachineKeySection.cs (3)
667Marshal.ThrowExceptionForHR(hr); 695Marshal.ThrowExceptionForHR(hr); 1227Marshal.ThrowExceptionForHR(hr);
Configuration\MULTI_QI.cs (4)
41Marshal.Release(pItf); 46Marshal.FreeCoTaskMem(piid); 75Marshal.Release(pItf); 79Marshal.FreeCoTaskMem(piid);
Configuration\NativeConfig.cs (2)
66Marshal.FreeBSTR(pBstr); 85Marshal.FreeBSTR(pBstr);
Configuration\ProcessHostConfigUtils.cs (2)
66Marshal.FreeBSTR(pBstr); 85Marshal.FreeBSTR(pBstr);
Configuration\ProcessHostMapPath.cs (1)
204Marshal.FreeBSTR(pBstr);
Configuration\ProcessHostServerConfig.cs (6)
115Marshal.FreeBSTR(pBstr); 134Marshal.FreeBSTR(pBstr); 159Marshal.Release(pAppCollection); 163Marshal.FreeBSTR(pBstr); 208Marshal.FreeBSTR(pBstrUserName); 211Marshal.FreeBSTR(pBstrPassword);
Configuration\RemoteWebConfigurationHost.cs (39)
93while (Marshal.ReleaseComObject(remoteSrv) > 0) { 226while (Marshal.ReleaseComObject(remoteSrv) > 0) { } // release the COM object 366while (Marshal.ReleaseComObject(remoteSrv) > 0) { } // release the COM object 508guidbuf = Marshal.AllocCoTaskMem(16); 509Marshal.StructureToPtr(typeof(IRemoteWebConfigurationHostServer).GUID, guidbuf, false); 513ciptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(ci)); 514Marshal.StructureToPtr(ci, ciptr, false); 517captr = Marshal.AllocCoTaskMem(Marshal.SizeOf(ca)); 518Marshal.StructureToPtr(ca, captr, false); 525Marshal.ThrowExceptionForHR(hr); 527Marshal.ThrowExceptionForHR(amqi[0].hr); 530Marshal.ThrowExceptionForHR(hr); 531return (IRemoteWebConfigurationHostServer)Marshal.GetObjectForIUnknown(amqi[0].pItf); 535Marshal.Release(amqi[0].pItf); 540Marshal.DestroyStructure(captr, typeof(COAUTHINFO)); 541Marshal.FreeCoTaskMem(captr); 544Marshal.DestroyStructure(ciptr, typeof(COAUTHIDENTITY)); 545Marshal.FreeCoTaskMem(ciptr); 548Marshal.FreeCoTaskMem(guidbuf); 568guidbuf = Marshal.AllocCoTaskMem(16); 569Marshal.StructureToPtr(typeof(IRemoteWebConfigurationHostServer).GUID, guidbuf, false); 573ciptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(ci)); 574Marshal.StructureToPtr(ci, ciptr, false); 577captr = Marshal.AllocCoTaskMem(Marshal.SizeOf(ca)); 578Marshal.StructureToPtr(ca, captr, false); 585Marshal.ThrowExceptionForHR(hr); 587Marshal.ThrowExceptionForHR(amqi[0].hr); 590Marshal.ThrowExceptionForHR(hr); 591return (IRemoteWebConfigurationHostServer)Marshal.GetObjectForIUnknown(amqi[0].pItf); 594Marshal.Release(amqi[0].pItf); 599Marshal.DestroyStructure(captr, typeof(COAUTHINFO_X64)); 600Marshal.FreeCoTaskMem(captr); 603Marshal.DestroyStructure(ciptr, typeof(COAUTHIDENTITY_X64)); 604Marshal.FreeCoTaskMem(ciptr); 607Marshal.FreeCoTaskMem(guidbuf);
Configuration\RemoteWebConfigurationHostServer.cs (2)
139Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
Configuration\RemoteWebConfigurationHostStream.cs (2)
74while (Marshal.ReleaseComObject(remoteSrv) > 0) 216while (Marshal.ReleaseComObject(remoteSrv) > 0)
Configuration\StrongNameUtility.cs (2)
33throw Marshal.GetExceptionForHR(StrongNameHelpers.StrongNameErrorInfo()); 47Marshal.Copy(keyBlob, key, 0, (int)generatedSize);
FileChangesMonitor.cs (1)
177int hr = HttpException.HResultFromLastError(Marshal.GetLastWin32Error());
Hosting\IIS7WorkerRequest.cs (3)
685Marshal.ThrowExceptionForHR(hr); 872Marshal.ThrowExceptionForHR(hr); 1978throw new HttpException(SR.GetString(SR.Server_Support_Function_Error, result.ToString("X8", CultureInfo.InvariantCulture)), Marshal.GetExceptionForHR(result));
Hosting\IPipelineRuntime.cs (7)
123IntPtr p = Marshal.GetFunctionPointerForDelegate(d); 141IntPtr p = Marshal.GetFunctionPointerForDelegate(d); 159IntPtr p = Marshal.GetFunctionPointerForDelegate(d); 179IntPtr p = Marshal.GetFunctionPointerForDelegate(d); 199IntPtr p = Marshal.GetFunctionPointerForDelegate(d); 219IntPtr p = Marshal.GetFunctionPointerForDelegate(d); 434return Marshal.GetHRForException(e);
Hosting\ISAPIWorkerRequest.cs (7)
500return Marshal.UnsafeAddrOfPinnedArrayElement(_arrayData, 0); 563_pinnedAddr = Marshal.UnsafeAddrOfPinnedArrayElement(_charBuffer, 0); 2181_basicServerVars[i] = Marshal.PtrToStringUni(current, serverVarLengths[i]); 2221Marshal.ThrowExceptionForHR(hresult); 2225_additionalServerVars[i] = Marshal.PtrToStringUni(current, serverVarLengths[i]); 2282return Marshal.PtrToStringUni(buffer.PinnedAddress, r); 2298return Marshal.PtrToStringUni(buffer.PinnedAddress, r);
Hosting\ProcessHost.cs (10)
809refCount = Marshal.ReleaseComObject( _functions ); 1236Marshal.ThrowExceptionForHR(hr); 1252Exception ex = Marshal.GetExceptionForHR(hr, (pErrorInfo != IntPtr.Zero) ? pErrorInfo : (IntPtr)(-1)); 1307Marshal.ThrowExceptionForHR(hr); 1340IntPtr pUnk = Marshal.GetIUnknownForObject(defaultDomainCallback); 1352int hresult = Marshal.QueryInterface(pUnk, ref g, out ppv); 1354Marshal.ThrowExceptionForHR(hresult); 1359localProxy = (IListenerChannelCallback)Marshal.GetObjectForIUnknown(ppv); 1364Marshal.Release(ppv); 1367Marshal.Release(pUnk);
HttpApplication.cs (7)
2882Marshal.FreeBSTR(pBstrModuleName); 2885Marshal.FreeBSTR(pBstrModuleType); 2888Marshal.FreeBSTR(pBstrModulePrecondition); 2899Marshal.Release(pModuleCollection); 2903Marshal.FreeBSTR(pBstrModuleName); 2907Marshal.FreeBSTR(pBstrModuleType); 2911Marshal.FreeBSTR(pBstrModulePrecondition);
HttpException.cs (1)
63return new HttpException(message, HResultFromLastError(Marshal.GetLastWin32Error()));
ImpersonationContext.cs (1)
115if (Marshal.GetLastWin32Error() != UnsafeNativeMethods.ERROR_NO_TOKEN) {
Management\regiisutil.cs (12)
77exception = Marshal.StringToBSTR((new Exception(SR.GetString(SR.Unable_To_Register_Assembly, webAssembly.FullName))).ToString()); 82exception = Marshal.StringToBSTR((new Exception(SR.GetString(SR.Unable_To_UnRegister_Assembly, webAssembly.FullName))).ToString()); 86exception = Marshal.StringToBSTR(e.ToString()); 105exception = Marshal.StringToBSTR((new Exception(SR.GetString(SR.Unable_To_Register_Assembly, webAssembly.FullName))).ToString()); 116exception = Marshal.StringToBSTR((new Exception(SR.GetString(SR.Unable_To_UnRegister_Assembly, webAssembly.FullName))).ToString()); 127exception = Marshal.StringToBSTR(e.ToString()); 191exception = Marshal.StringToBSTR(SR.GetString(SR.Command_not_recognized)); 196exception = Marshal.StringToBSTR(sb.ToString()); 342Marshal.ThrowExceptionForHR((int)returnHR); 404Marshal.ThrowExceptionForHR(returnHR); 427Marshal.ThrowExceptionForHR((int)returnHR); 439exception = Marshal.StringToBSTR(e.Message);
MimeMapping.cs (5)
463Marshal.ThrowExceptionForHR(result); 475Marshal.ThrowExceptionForHR(result); 483if (bstrFileExtension != IntPtr.Zero) Marshal.FreeBSTR(bstrFileExtension); 484if (bstrMimeType != IntPtr.Zero) Marshal.FreeBSTR(bstrMimeType); 491Marshal.Release(mimeMapCollection);
Security\ADMembershipProvider.cs (1)
4334Marshal.PtrToStructure(pDomainControllerInfo, domainControllerInfo);
Security\AuthStoreRoleProvider.cs (5)
181Marshal.FinalReleaseComObject(role); 247Marshal.FinalReleaseComObject(role); 300Marshal.FinalReleaseComObject(role); 355Marshal.FinalReleaseComObject(role); 381Marshal.FinalReleaseComObject(role);
StaticFileHandler.cs (1)
402int byteCount = byteRanges.Length * Marshal.SizeOf(byteRanges[0]);
StringResourceManager.cs (5)
48hModule = Marshal.GetHINSTANCE(t.Module); 51"GetModuleHandle", HttpException.HResultFromLastError(Marshal.GetLastWin32Error()).ToString(CultureInfo.InvariantCulture))); 58"FindResource", HttpException.HResultFromLastError(Marshal.GetLastWin32Error()).ToString(CultureInfo.InvariantCulture))); 66"LoadResource", HttpException.HResultFromLastError(Marshal.GetLastWin32Error()).ToString(CultureInfo.InvariantCulture))); 72"LockResource", HttpException.HResultFromLastError(Marshal.GetLastWin32Error()).ToString(CultureInfo.InvariantCulture)));
UnsafeNativeMethods.cs (1)
298dwLength = Marshal.SizeOf(typeof(UnsafeNativeMethods.MEMORYSTATUSEX));
Util\AspCompat.cs (1)
439Marshal.ReleaseComObject(component);
Util\FileUtil.cs (5)
371int hr = Marshal.GetHRForLastWin32Error(); 404int hr = Marshal.GetHRForLastWin32Error(); 445int lastError = Marshal.GetLastWin32Error(); // FXCOP demands that this preceed the == 504int lastError = Marshal.GetLastWin32Error(); // FXCOP demands that this preceed the == 587return HttpException.HResultFromLastError(Marshal.GetLastWin32Error());
Util\Misc.cs (9)
92System.Runtime.InteropServices.Marshal.Copy(new IntPtr(src.ToInt64()+srcOffset), dest, destOffset, size); 97System.Runtime.InteropServices.Marshal.Copy(src, srcOffset, new IntPtr(dest.ToInt64()+destOffset), size); 110Marshal.ThrowExceptionForHR(hresult); 118IntPtr pUnk = Marshal.GetIUnknownForObject(proxyFunctions); 130int hresult = Marshal.QueryInterface(pUnk, ref g, out ppv); 132Marshal.ThrowExceptionForHR(hresult); 137localFunctions = (IProcessHostSupportFunctions)Marshal.GetObjectForIUnknown(ppv); 142Marshal.Release(ppv); 145Marshal.Release(pUnk);
Util\PinnedArraySegment.cs (1)
35_pointer = Marshal.UnsafeAddrOfPinnedArrayElement(segment.Array, segment.Offset);
Util\SmtpMail.cs (7)
239Marshal.ReleaseComObject(newMail); 274Marshal.ReleaseComObject(fields); 340Marshal.ReleaseComObject(body); 377Marshal.ReleaseComObject(bodyPart); 398Marshal.ReleaseComObject(fields); 400Marshal.ReleaseComObject(config); 417Marshal.ReleaseComObject(m);
Util\StopListeningWaitHandle.cs (2)
39int hr = Marshal.GetHRForLastWin32Error(); 40Marshal.ThrowExceptionForHR(hr);
Util\StringUtil.cs (1)
116return Marshal.PtrToStringAnsi(ip, length);
Util\TlsTokenBindingHandle.cs (1)
54Marshal.Copy(blob, retVal, 0, length);
WebSockets\WebSocketPipe.cs (1)
29private static readonly IntPtr _asyncThunkAddress = Marshal.GetFunctionPointerForDelegate(_asyncThunk);
System.Web.ApplicationServices (4)
Hosting\CustomLoaderHelper.cs (4)
134pUnknown = Marshal.GetIUnknownForObject(o); // AddRef 135int hr = Marshal.QueryInterface(pUnknown, ref iid, out pInterface); // AddRef 140Marshal.Release(pUnknown); 143Marshal.Release(pInterface);
System.Web.Extensions (3)
ClientServices\ClientFormsIdentity.cs (3)
86bstr = Marshal.SecureStringToBSTR(securePass); 87return Marshal.PtrToStringBSTR(bstr); 90Marshal.FreeBSTR(bstr);
System.Web.Mobile (1)
UI\MobileControls\Design\Util\MSHTMLHost.cs (1)
201lpFrameInfo.cb = System.Runtime.InteropServices.Marshal.SizeOf(typeof(NativeMethods.tagOIFI));
System.Web.Services (5)
System\Web\Services\Protocols\RemoteDebugger.cs (5)
141Marshal.ReleaseComObject(connection); 200Marshal.Copy(bufferPtr, buffer, 0, bufferSize); 203Marshal.FreeCoTaskMem(bufferPtr); 305Marshal.Copy(bufferPtr, buffer, 0, bufferSize); 308Marshal.FreeCoTaskMem(bufferPtr);
System.Windows.Forms (557)
misc\DbgUtil.cs (1)
237err = Marshal.GetLastWin32Error();
misc\GDI\NativeMethods.cs (1)
250private int cbSize = Marshal.SizeOf(typeof(DRAWTEXTPARAMS));
misc\GDI\UnsafeNativeMethods.cs (6)
264int retVal = IntGetObject(hBrush, System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntNativeMethods.LOGBRUSH)), lb); 275int retVal = IntGetObject(hFont, System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntNativeMethods.LOGFONT)), lp); 376if( Marshal.SystemDefaultCharSize == 1 ) 415if( Marshal.SystemDefaultCharSize == 1) 458if( Marshal.SystemDefaultCharSize == 1) 599if (Marshal.SystemDefaultCharSize == 1)
parent\parent\parent\public\Internal\NDP\Inc\CmsInterop.cs (16)
275Marshal.FreeCoTaskMem(StringIds); 280Marshal.FreeCoTaskMem(IntegerIds); 327Marshal.FreeCoTaskMem(StringIds); 332Marshal.FreeCoTaskMem(IntegerIds); 379Marshal.FreeCoTaskMem(ResourceTypeIdInt); 384Marshal.FreeCoTaskMem(ResourceTypeIdString); 436Marshal.FreeCoTaskMem(TransformMetadata); 441Marshal.FreeCoTaskMem(DigestValue); 507Marshal.FreeCoTaskMem(HashValue); 784Marshal.FreeCoTaskMem(HashValue); 1152Marshal.FreeCoTaskMem(ManifestHash); 1157Marshal.FreeCoTaskMem(MvidValue); 1373Marshal.FreeCoTaskMem(SecurityDescriptor); 1378Marshal.FreeCoTaskMem(Values); 1383Marshal.FreeCoTaskMem(Keys); 1440Marshal.FreeCoTaskMem(SecurityDescriptor);
parent\parent\parent\public\Internal\NDP\Inc\IsolationInterop.cs (57)
27Marshal.FreeCoTaskMem(BlobData); 1234Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationStageComponent)); 1275Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationStageComponentFile)); 1307Size = (UInt32)Marshal.SizeOf(typeof(StoreApplicationReference)); 1317IntPtr Reference = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 1318Marshal.StructureToPtr(this, Reference, false); 1327Marshal.DestroyStructure(ip, typeof(StoreApplicationReference)); 1328Marshal.FreeCoTaskMem(ip); 1359Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationPinDeployment)); 1405Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationUnpinDeployment)); 1449Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationInstallDeployment)); 1493Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationUninstallDeployment)); 1560Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationSetDeploymentMetadata)); 1619ulong iSlotSize = (ulong)Marshal.SizeOf(typeof(StoreOperationMetadataProperty)); 1623Marshal.DestroyStructure( 1628Marshal.FreeCoTaskMem(rgItems); 1638int iSlotSize = Marshal.SizeOf(typeof(StoreOperationMetadataProperty)); 1639IntPtr retval = Marshal.AllocCoTaskMem(iSlotSize * Props.Length); 1643Marshal.StructureToPtr( 1670Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationSetCanonicalizationContext)); 1703Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationScavenge)); 2170Marshal.Copy(b.BlobData, retval, 0, (int)b.Size); 2467Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationStageComponent)); 2470Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationStageComponentFile)); 2473Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationPinDeployment)); 2476Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationUninstallDeployment)); 2479Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationUnpinDeployment)); 2482Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationInstallDeployment)); 2485Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationSetCanonicalizationContext)); 2488Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationSetDeploymentMetadata)); 2491Marshal.DestroyStructure(op.Data.DataPtr, typeof(StoreOperationScavenge)); 2498Marshal.FreeCoTaskMem(op.Data.DataPtr); 2529txnList[i].Data.DataPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(o)); 2530Marshal.StructureToPtr(o, txnList[i].Data.DataPtr, false); 2759IntPtr p = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 2760Marshal.StructureToPtr(this, p, false); 2767Marshal.DestroyStructure(p, typeof(CreateActContextParametersSource)); 2768Marshal.FreeCoTaskMem(p); 2782IntPtr p = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 2783Marshal.StructureToPtr(this, p, false); 2789Marshal.DestroyStructure(p, typeof(CreateActContextParametersSourceReferenceAppid)); 2790Marshal.FreeCoTaskMem(p); 2805IntPtr p = Marshal.AllocCoTaskMem(Marshal.SizeOf(this)); 2806Marshal.StructureToPtr(this, p, false); 2813Marshal.DestroyStructure(p, typeof(CreateActContextParametersSourceDefinitionAppid)); 2814Marshal.FreeCoTaskMem(p); 2825Parameters.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParameters)); 2833SourceInfo.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParametersSource)); 2838DefAppIdSource.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParametersSourceDefinitionAppid)); 2875Parameters.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParameters)); 2883SourceInfo.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParametersSource)); 2888RefAppIdSource.Size = (UInt32)Marshal.SizeOf(typeof(CreateActContextParametersSourceReferenceAppid));
parent\parent\parent\public\Internal\NDP\Inc\mansign.cs (10)
524signerInfo.cbSize = (uint) Marshal.SizeOf(typeof(Win32.AXL_SIGNER_INFO)); 526timestamperInfo.cbSize = (uint) Marshal.SizeOf(typeof(Win32.AXL_TIMESTAMPER_INFO)); 617string issuerKeyHash = Marshal.PtrToStringUni(pIssuerKeyHash); 743computedPublicKeyToken = HexStringToBytes(Marshal.PtrToStringUni(pComputedToken)); 794string issuerKeyHash = Marshal.PtrToStringUni(pIssuerKeyHash); 851string publicKeyToken = Marshal.PtrToStringUni(pPublicKeyToken); 1045Marshal.Copy(timestampBlob.pbData, timestampSignature, 0, timestampSignature.Length); 1337m_hash = Marshal.PtrToStringUni(signerInfo.pwszHash); 1340m_description = Marshal.PtrToStringUni(signerInfo.pwszDescription); 1343m_descriptionUrl = Marshal.PtrToStringUni(signerInfo.pwszDescriptionUrl);
parent\parent\parent\public\Internal\NDP\Inc\mansign2.cs (11)
270signerInfo.cbSize = (uint)Marshal.SizeOf(typeof(Win32.AXL_SIGNER_INFO)); 272timestamperInfo.cbSize = (uint)Marshal.SizeOf(typeof(Win32.AXL_TIMESTAMPER_INFO)); 1028throw new CryptographicException(Marshal.GetLastWin32Error()); 1228string issuerKeyHash = Marshal.PtrToStringUni(pIssuerKeyHash); 1373computedPublicKeyToken = HexStringToBytes(Marshal.PtrToStringUni(pComputedToken)); 1429string issuerKeyHash = Marshal.PtrToStringUni(pIssuerKeyHash); 1542string publicKeyToken = Marshal.PtrToStringUni(pPublicKeyToken); 1810throw new CryptographicException(Marshal.GetLastWin32Error()); 1814var timestampContext = (Win32.CRYPT_TIMESTAMP_CONTEXT)Marshal.PtrToStructure(ppTsContext, typeof(Win32.CRYPT_TIMESTAMP_CONTEXT)); 1816Marshal.Copy(timestampContext.pbEncoded, encodedBytes, 0, (int)timestampContext.cbEncoded); 1876Marshal.Copy(timestampBlob.pbData, timestampSignature, 0, timestampSignature.Length);
winforms\Managed\System\WinForms\AccessibleObject.cs (3)
922ppvObject = Marshal.GetComInterfaceForObject(this, typeof(UnsafeNativeMethods.IAccessibleEx)); 2961Marshal.GetNativeVariantForObject(((object) currentChild), GetAddressOfVariantAtIndex(rgvar, i)); 3338ppvObject = Marshal.GetComInterfaceForObject(this, typeof(UnsafeNativeMethods.IAccessibleEx));
winforms\Managed\System\WinForms\Application.cs (10)
2452object msgFilterObj = Marshal.GetObjectForIUnknown(msgFilterPtr); 2453Marshal.Release(msgFilterPtr); 2478hr = Marshal.QueryInterface(retval, ref IID_IMsoComponentManager, out pmsocm); 2481Marshal.Release(retval); 2492Marshal.Release(pmsocm); 2522if (msgFilterObj != null && Marshal.IsComObject(msgFilterObj)) { 2523Marshal.ReleaseComObject(msgFilterObj); 2545info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MSOCRINFOSTRUCT)); 3731if (Marshal.IsComObject(msocm)) { 3732Marshal.ReleaseComObject(msocm);
winforms\Managed\System\WinForms\AxHost.cs (18)
3295Marshal.FreeCoTaskMem(uuids.pElems); 3306IntPtr pUnk = Marshal.GetIUnknownForObject(GetOcx()); 3391Marshal.FreeCoTaskMem(uuids.pElems); 3738Marshal.ReleaseComObject(connectionPoint); 3755Marshal.ReleaseComObject(connectionPoint); 3793Marshal.ReleaseComObject(connectionPoint); 4273lpFrameInfo.cb = Marshal.SizeOf(typeof(NativeMethods.tagOIFI)); 4562Marshal.FinalReleaseComObject(instance); 5167for (;i < cpBuffer && (ch = Marshal.ReadInt16(pbstr, i * 2)) != 0; i++) { 5168Marshal.WriteInt16(lpBuffer, i * 2, ch); 5171Marshal.WriteInt16(lpBuffer, i * 2, (short) 0); 5204Marshal.WriteInt32(pceltFetched, 0, 0); 5217Marshal.WriteIntPtr(rgelt, Marshal.GetIUnknownForObject(arr[loc])); 5225Marshal.WriteInt32(pceltFetched, 0, fetched); 6016Marshal.ReleaseComObject(siteUIActive.iOleInPlaceActiveObjectExternal); 6697Marshal.Copy(buffer, 0, pointer, length); 6799Marshal.Copy(pointer, buffer, 0, length);
winforms\Managed\System\WinForms\Clipboard.cs (1)
257if (dataObject is IDataObject && !Marshal.IsComObject(dataObject)) {
winforms\Managed\System\WinForms\ColorDialog.cs (4)
282IntPtr custColorPtr = Marshal.AllocCoTaskMem(64); 284Marshal.Copy(customColors, 0, custColorPtr, 16); 299Marshal.Copy(custColorPtr, customColors, 0, 16); 303Marshal.FreeCoTaskMem(custColorPtr);
winforms\Managed\System\WinForms\ComboBox.cs (3)
3645Marshal.StructureToPtr(mis, m.LParam, false); 3979punkAcc = Marshal.GetIUnknownForObject(iacc); 3987Marshal.Release(punkAcc);
winforms\Managed\System\WinForms\CommonDialog.cs (1)
298hookedWndProc = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(ownerProc);
winforms\Managed\System\WinForms\ComponentManagerBroker.cs (2)
171UnsafeNativeMethods.IMsoComponentManager original = (UnsafeNativeMethods.IMsoComponentManager)Marshal.GetObjectForIUnknown((IntPtr)pCM); 273Marshal.ReleaseComObject(_original);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\BaseCAMarshaler.cs (2)
123addr = Marshal.ReadIntPtr(caArrayAddress, i * IntPtr.Size); 135Marshal.FreeCoTaskMem(caArrayAddress);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2AboutBoxPropertyDescriptor.cs (1)
161if (Marshal.IsComObject(component) && component is UnsafeNativeMethods.IDispatch) {
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2ComponentEditor.cs (2)
42Marshal.FreeCoTaskMem(uuids.pElems); 97Marshal.FreeCoTaskMem(uuids.pElems);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2IManagedPerPropertyBrowsingHandler.cs (5)
204bstr = Marshal.ReadIntPtr(ptr, i*4); 206strs[i] = Marshal.PtrToStringUni(bstr); 218Marshal.FreeCoTaskMem(ptr); 239objects[i] = Marshal.GetObjectForNativeVariant(curVariant); 251Marshal.FreeCoTaskMem(ptr);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2Properties.cs (1)
389countOffset = Marshal.SizeOf(typeof(Guid)) + IntPtr.Size + 24;
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2PropertyDescriptor.cs (6)
870if (component == null || !Marshal.IsComObject(component) || !(component is UnsafeNativeMethods.IDispatch)) 1218if (owner == null || !Marshal.IsComObject(owner) || !(owner is UnsafeNativeMethods.IDispatch)) { 1241dp.rgdispidNamedArgs = Marshal.UnsafeAddrOfPinnedArrayElement(namedArgs, 0); 1242IntPtr mem = Marshal.AllocCoTaskMem( 16 /*Marshal.SizeOf(typeof(VARIANT)) */); 1244Marshal.GetNativeVariantForObject(value, mem); 1323Marshal.FreeCoTaskMem(mem);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2PropertyPageUITypeConverter.cs (3)
88IntPtr guidsAddr = Marshal.UnsafeAddrOfPinnedArrayElement(guids, 0); 97objAddrs[i] = Marshal.GetIUnknownForObject(objs[i]); 114Marshal.Release(objAddrs[i]);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\COM2TypeInfoProcessor.cs (7)
205if (obj == null || !Marshal.IsComObject(obj)) { 360refTypeDesc.unionMember = (IntPtr)Marshal.ReadInt32(typeDesc.unionMember); 361refTypeDesc.vt = Marshal.ReadInt16(typeDesc.unionMember, 4); 684Marshal.PtrToStructure(funcDesc.lprgelemdescParam, ed); 798varValue = Marshal.GetObjectForNativeVariant(varDesc.unionMember); 838IntPtr pTypeInfoUnk = Marshal.GetIUnknownForObject(enumTypeInfo); 866Marshal.Release(pTypeInfoUnk);
winforms\Managed\System\WinForms\ComponentModel\COM2Interop\OleStrCAMarshaler.cs (2)
44string item = Marshal.PtrToStringUni(addr); 46Marshal.FreeCoTaskMem(addr);
winforms\Managed\System\WinForms\Control.cs (40)
1849int lastWin32Error = Marshal.GetLastWin32Error(); 4420(!returnValue && Marshal.GetLastWin32Error() == NativeMethods.ERROR_INVALID_HANDLE) || 7864m.Result = (IntPtr)((value.Length + 1) * Marshal.SystemDefaultCharSize); 7879if (Marshal.SystemDefaultCharSize == 1) { 7888Marshal.Copy(bytes, 0, m.LParam, bytes.Length); 7889Marshal.Copy(nullBytes, 0, unchecked((IntPtr)((long)m.LParam + (long)bytes.Length)), nullBytes.Length); 7891m.Result = (IntPtr)((bytes.Length + nullBytes.Length)/Marshal.SystemDefaultCharSize); 8831si.cbSize = Marshal.SizeOf(typeof(NativeMethods.SCROLLINFO)); 10535if (Marshal.SystemDefaultCharSize == 1) { 10584charsToIgnore += (3 - Marshal.SystemDefaultCharSize); 10598if (Marshal.SystemDefaultCharSize == 1) { 10612int sizeOfIntPtr = Marshal.SizeOf(typeof(IntPtr)); 13101punkAcc = Marshal.GetIUnknownForObject(iacc); 13115Marshal.Release(punkAcc); 14354m.Result = (IntPtr)(Marshal.SystemDefaultCharSize == 1 ? NativeMethods.NFR_ANSI : NativeMethods.NFR_UNICODE); 15277pCI.cb = Marshal.SizeOf(typeof(NativeMethods.tagCONTROLINFO)); 16880IntPtr accelBlob = Marshal.AllocHGlobal(accelSize * accelCount * 2); 16901Marshal.StructureToPtr(accel, structAddr, false); 16908Marshal.StructureToPtr(accel, structAddr, false); 16919Marshal.StructureToPtr(accel, structAddr, false); 16941Marshal.FreeHGlobal(accelBlob); 17799Marshal.AddRef(unknown); 17804unknown = Marshal.GetIUnknownForObject(obj); 17816Marshal.Release(oldUnknown); 17830int hresult = Marshal.QueryInterface(pUnk, ref iid, out ppv); 17856Marshal.Release(ptr1); 17865IntPtr vtblptr = Marshal.ReadIntPtr(this.handle, 0); 17866return (V)Marshal.PtrToStructure(vtblptr, typeof(V)); 17898FindConnectionPointD findConnectionPoint = (FindConnectionPointD)Marshal.GetDelegateForFunctionPointer(this.vtbl.FindConnectionPointPtr, typeof(FindConnectionPointD)); 17945AdviseD advise = (AdviseD)Marshal.GetDelegateForFunctionPointer(this.vtbl.AdvisePtr, typeof(AdviseD)); 18164Marshal.FinalReleaseComObject(clientSite); 18932Marshal.Release(pObj); 18972IntPtr pFont = Marshal.GetIUnknownForObject(oleFont); 18975int hr = Marshal.QueryInterface(pFont, ref iid, out pIFont); 18977Marshal.Release(pFont); 18980Marshal.ThrowExceptionForHR(hr); 18987UnsafeNativeMethods.IFont nativeFont = (UnsafeNativeMethods.IFont)Marshal.GetObjectForIUnknown(pObj); 19313if (UnsafeNativeMethods.GetObject(hBitmap, Marshal.SizeOf(bmp), bmp) == 0) { 19318lpbmi.bmiHeader_biSize = Marshal.SizeOf(typeof(NativeMethods.BITMAPINFOHEADER)); 19335byte[] aj = new byte[Marshal.SizeOf(typeof(NativeMethods.PALETTEENTRY)) * 256];
winforms\Managed\System\WinForms\ControlPaint.cs (8)
153header.biSize = Marshal.SizeOf(header); 177IntPtr address = Marshal.AllocCoTaskMem(Marshal.SizeOf(header) + entryCount*4); 178Marshal.StructureToPtr(header, address, false); 179Marshal.Copy(colors, 0, (IntPtr)((long)address + Marshal.SizeOf(header)), entryCount); 208Marshal.FreeCoTaskMem(bitmapInfo); 276int color = Marshal.ReadInt32(scan, x*4);
winforms\Managed\System\WinForms\Cursor.cs (3)
597UnsafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(NativeMethods.BITMAP)), bmp); 602UnsafeNativeMethods.GetObject(new HandleRef(null, info.hbmMask), Marshal.SizeOf(typeof(NativeMethods.BITMAP)), bmp); 654Marshal.ReleaseComObject(picture);
winforms\Managed\System\WinForms\DataFormats.cs (1)
223throw new Win32Exception(Marshal.GetLastWin32Error(), SR.GetString(SR.RegisterCFFailed));
winforms\Managed\System\WinForms\DataGridToolTip.cs (3)
40icc.dwSize = Marshal.SizeOf(icc); 67toolInfo.cbSize = Marshal.SizeOf(toolInfo); 79toolInfo.cbSize = Marshal.SizeOf(toolInfo);
winforms\Managed\System\WinForms\DataGridViewMethods.cs (1)
29947Marshal.StructureToPtr(ttt, m.LParam, false);
winforms\Managed\System\WinForms\DataObject.cs (20)
114if (data is IDataObject && !Marshal.IsComObject(data)) { 606Marshal.ThrowExceptionForHR(hr); 633Marshal.ThrowExceptionForHR (DV_E_TYMED); 637Marshal.ThrowExceptionForHR (DV_E_FORMATETC); 641Marshal.ThrowExceptionForHR (DV_E_TYMED); 678Marshal.ThrowExceptionForHR(NativeMethods.E_NOTIMPL); 783Marshal.ThrowExceptionForHR(DV_E_TYMED); 966Marshal.Copy(bytes, 0, ptr, size); 991bool unicode = (Marshal.SystemDefaultCharSize != 1); 1033Marshal.Copy(structData, 0, currentPtr, structData.Length); 1044Marshal.Copy(new byte[]{0,0}, 0, currentPtr, 2); 1051Marshal.Copy(new byte[]{0}, 0, currentPtr, 1); 1057Marshal.Copy(new char[]{'\0'}, 0, currentPtr, 1); 1061Marshal.Copy(new byte[]{0}, 0, currentPtr, 1); 1121Marshal.Copy(new byte[] {0}, 0, (IntPtr)((long)ptr+pinvokeSize), 1); 1153Marshal.Copy(new byte[] { 0 }, 0, (IntPtr)((long)ptr + bytes.Length), 1); 1418UnsafeNativeMethods.IStream pStream = (UnsafeNativeMethods.IStream)Marshal.GetObjectForIUnknown(medium.unionmember); 1419Marshal.Release(medium.unionmember); 1700Marshal.Copy(ptr, bytes, 0, size); 1898Marshal.Copy(ptr, bytes, 0, size);
winforms\Managed\System\WinForms\Design\EventsTab.cs (1)
64return !Marshal.IsComObject(extendee);
winforms\Managed\System\WinForms\ErrorProvider.cs (4)
918toolInfo.cbSize = Marshal.SizeOf(toolInfo); 960icc.dwSize = Marshal.SizeOf(icc); 1132toolInfo.cbSize = Marshal.SizeOf(toolInfo); 1222toolInfo.cbSize = Marshal.SizeOf(toolInfo);
winforms\Managed\System\WinForms\FileDialog.cs (5)
769Marshal.FreeCoTaskMem(ofn.lpstrFile); 774Marshal.StructureToPtr(ofn, notify.lpOFN, true); 775Marshal.StructureToPtr(notify, lparam, true); 1007ofn.lStructSize = Marshal.SizeOf(typeof(NativeMethods.OPENFILENAME_I)); 1035Marshal.FreeCoTaskMem(ofn.lpstrFile);
winforms\Managed\System\WinForms\FolderBrowserDialog.cs (10)
271pszDisplayName = Marshal.AllocHGlobal(NativeMethods.MAX_PATH * Marshal.SystemDefaultCharSize); 272pszSelectedPath = Marshal.AllocHGlobal((NativeMethods.MAX_PATH + 1) * Marshal.SystemDefaultCharSize); 297selectedPath = Marshal.PtrToStringAuto(pszSelectedPath); 313Marshal.FreeHGlobal(pszSelectedPath); 317Marshal.FreeHGlobal(pszDisplayName); 349IntPtr pszSelectedPath = Marshal.AllocHGlobal((NativeMethods.MAX_PATH + 1) * Marshal.SystemDefaultCharSize); 352Marshal.FreeHGlobal(pszSelectedPath);
winforms\Managed\System\WinForms\FontDialog.cs (5)
577logFontPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(NativeMethods.LOGFONT))); 578Marshal.StructureToPtr(lf, logFontPtr, false); 580cf.lStructSize = Marshal.SizeOf(typeof(NativeMethods.CHOOSEFONT)); 626Marshal.FreeCoTaskMem(logFontPtr);
winforms\Managed\System\WinForms\Form.cs (4)
5513wp.length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT)); 6847wp.length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT)); 7228Marshal.StructureToPtr(mmi, m.LParam, false); 7844toolInfo.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_T));
winforms\Managed\System\WinForms\Help.cs (2)
164IntPtr pszText = Marshal.StringToCoTaskMemAuto(caption); 180Marshal.FreeCoTaskMem(pszText);
winforms\Managed\System\WinForms\HtmlDocument.cs (9)
810private static readonly int VariantSize = (int)Marshal.OffsetOf(typeof(FindSizeOfVariant), "b"); 816IntPtr mem = Marshal.AllocCoTaskMem(len * VariantSize); 820Marshal.GetNativeVariantForObject(args[i], (IntPtr)(a + VariantSize * i)); 834Marshal.FreeCoTaskMem(mem); 984Marshal.FinalReleaseComObject(htmlDocument.NativeHtmlDocument2); 1211leftPtr = Marshal.GetIUnknownForObject(left.NativeHtmlDocument2); 1212rightPtr = Marshal.GetIUnknownForObject(right.NativeHtmlDocument2); 1219Marshal.Release(leftPtr); 1223Marshal.Release(rightPtr);
winforms\Managed\System\WinForms\HtmlElement.cs (5)
1510Marshal.FinalReleaseComObject(htmlElement.NativeHtmlElement); 1544leftPtr = Marshal.GetIUnknownForObject(left.NativeHtmlElement); 1545rightPtr = Marshal.GetIUnknownForObject(right.NativeHtmlElement); 1552Marshal.Release(leftPtr); 1556Marshal.Release(rightPtr);
winforms\Managed\System\WinForms\HtmlWindow.cs (5)
746Marshal.FinalReleaseComObject(htmlWindow.NativeHtmlWindow); 789leftPtr = Marshal.GetIUnknownForObject(left.NativeHtmlWindow); 790rightPtr = Marshal.GetIUnknownForObject(right.NativeHtmlWindow); 797Marshal.Release(leftPtr); 801Marshal.Release(rightPtr);
winforms\Managed\System\WinForms\ImageList.cs (1)
321UnsafeNativeMethods.GetObject(new HandleRef(null, imageInfo.hbmImage), Marshal.SizeOf(bmp), bmp);
winforms\Managed\System\WinForms\ListBox.cs (1)
2378Marshal.StructureToPtr(mis, m.LParam, false);
winforms\Managed\System\WinForms\ListView.cs (24)
2906Marshal.FreeHGlobal(lvgroup.pszHeader); 3464lvgroup.pszHeader = Marshal.StringToHGlobalAuto(header); 3912Marshal.FreeHGlobal(hGlobalColumns); 3914hGlobalColumns = Marshal.AllocHGlobal(lvItem.cColumns * Marshal.SizeOf(typeof(int))); 3925Marshal.Copy(columns, 0, lvItem.puColumns, lvItem.cColumns); 3974Marshal.FreeHGlobal(hGlobalColumns); 4573prc = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.RECT))); 4579pwpos = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.WINDOWPOS))); 4597NativeMethods.WINDOWPOS wpos = (NativeMethods.WINDOWPOS) Marshal.PtrToStructure(pwpos, typeof(NativeMethods.WINDOWPOS)); 4611Marshal.FreeHGlobal(prc); 4614Marshal.FreeHGlobal(pwpos); 4892lvColumn.pszText = Marshal.StringToHGlobalAuto(ch.Text); 4897Marshal.FreeHGlobal(lvColumn.pszText); 6068if (Marshal.SystemDefaultCharSize == 1) { 6071Marshal.Copy(buff, 0, dispInfo.item.pszText, text.Length + 1); 6074Marshal.Copy(buff, 0, dispInfo.item.pszText, text.Length + 1); 6118Marshal.StructureToPtr(dispInfo, (IntPtr) m.LParam, false); 6152if (Marshal.SystemDefaultCharSize == 1) { 6156Marshal.Copy(byteBuf, 0, infoTip.lpszText, Math.Min(byteBuf.Length, infoTip.cchTextMax)); 6161Marshal.Copy(charBuf, 0, infoTip.lpszText, Math.Min(charBuf.Length, infoTip.cchTextMax)); 6163Marshal.StructureToPtr(infoTip, (IntPtr) m.LParam, false);
winforms\Managed\System\WinForms\MDIClient.cs (1)
251wp.length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT));
winforms\Managed\System\WinForms\MenuItem.cs (11)
451info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T)); 476info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T)); 1016MsaaMenuInfoWithId msaaMenuInfo = (MsaaMenuInfoWithId) Marshal.PtrToStructure(itemData, typeof(MsaaMenuInfoWithId)); 1022MsaaMenuInfoWithId msaaMenuInfo = (MsaaMenuInfoWithId) Marshal.PtrToStructure(itemData, typeof(MsaaMenuInfoWithId)); 1049msaaMenuInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MsaaMenuInfoWithId))); 1058Marshal.StructureToPtr(msaaMenuInfoStruct, msaaMenuInfoPtr, false); 1067Marshal.DestroyStructure(msaaMenuInfoPtr, typeof(MsaaMenuInfoWithId)); 1068Marshal.FreeHGlobal(msaaMenuInfoPtr); 1431info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T)); 1539Marshal.StructureToPtr(mis, m.LParam, false);
winforms\Managed\System\WinForms\MessageBox.cs (1)
471int lastWin32Error = Marshal.GetLastWin32Error();
winforms\Managed\System\WinForms\MonthCalendar.cs (6)
1388Marshal.FreeHGlobal(mdsBuffer); 1574mchi.cbSize = Marshal.SizeOf(typeof(NativeMethods.MCHITTESTINFO)); 1930Marshal.FreeHGlobal(mdsBuffer); 1940mdsBuffer = Marshal.AllocHGlobal(mdsBufferSize); 2320Marshal.Copy(boldEvent.DaysToBold, 0, mdsBuffer, boldEvent.Size); 2323Marshal.StructureToPtr(nmmcds, m.LParam, false);
winforms\Managed\System\WinForms\NativeMethods.cs (59)
2437if (Marshal.SystemDefaultCharSize == 1) { 2691public int cbSizeOfStruct = Marshal.SizeOf(typeof(FONTDESC)); 2708internal int cbSizeOfStruct = Marshal.SizeOf(typeof(PICTDESCbmp)); 2725internal int cbSizeOfStruct = Marshal.SizeOf(typeof(PICTDESCicon)); 2741internal int cbSizeOfStruct = Marshal.SizeOf(typeof(PICTDESCemf)); 2783internal int cbStruct=Marshal.SizeOf(typeof(HH_AKLINK)); 2795internal int cbStruct=Marshal.SizeOf(typeof(HH_POPUP)); 2811internal int cbStruct = Marshal.SizeOf(typeof(HH_FTS_QUERY)); 2825internal int cbSize = Marshal.SizeOf(typeof(MONITORINFOEX)); 2835internal int cbSize = Marshal.SizeOf(typeof(MONITORINFO)); 3000public int cbSize = Marshal.SizeOf(typeof(IMAGELISTDRAWPARAMS)); 3034public int cbSize = Marshal.SizeOf(typeof(TRACKMOUSEEVENT)); 3137public int cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)); 3208public int cbSize = Marshal.SizeOf(typeof(SCROLLINFO)); 3230public int cbSize = Marshal.SizeOf(typeof(TPMPARAMS)); 3588public int cbSizeofstruct = Marshal.SizeOf(typeof(tagFONTDESC)); 3614public int lStructSize = Marshal.SizeOf(typeof(CHOOSECOLOR)); //ndirect.DllLib.sizeOf(this); 3758public int cbSize = Marshal.SizeOf(typeof(NOTIFYICONDATA)); 3779public int cbSize = Marshal.SizeOf(typeof(MENUITEMINFO_T)); 3798public int cbSize = Marshal.SizeOf(typeof(MENUITEMINFO_T_RW)); 3833public int lStructSize = Marshal.SizeOf(typeof(OPENFILENAME_I)); //ndirect.DllLib.sizeOf(this); 3860public int lStructSize = Marshal.SizeOf(typeof(CHOOSEFONT)); // ndirect.DllLib.sizeOf(this); 4075public int cbSize = Marshal.SizeOf(typeof(MSOCRINFOSTRUCT)); // size of MSOCRINFO structure in bytes. 4235public int cb = Marshal.SizeOf(typeof(tagCONTROLINFO)); 4277Marshal.Release(this.data1); 4371v.data1 = Marshal.GetIUnknownForObject(var); 4394IntPtr mem = Marshal.AllocCoTaskMem(16); 4395Marshal.WriteInt16(mem, vt); 4396Marshal.WriteInt16(mem, 2, reserved1); 4397Marshal.WriteInt16(mem, 4, reserved2); 4398Marshal.WriteInt16(mem, 6, reserved3); 4399Marshal.WriteInt32(mem, 8, (int) data1); 4400Marshal.WriteInt32(mem, 12, (int) data2); 4418val = (IntPtr) Marshal.ReadByte(val); 4424val = (IntPtr) Marshal.ReadByte(val); 4431val = (IntPtr) Marshal.ReadInt16(val); 4437val = (IntPtr) Marshal.ReadInt16(val); 4444val = (IntPtr) Marshal.ReadInt32(val); 4451val = (IntPtr) Marshal.ReadInt32(val); 4458longVal = Marshal.ReadInt64(val); 4492return Marshal.PtrToStringUni(val); 4495return Marshal.PtrToStringAnsi(val); 4500return Marshal.GetObjectForIUnknown(val); 4556return Marshal.ReadIntPtr(value); 4564public int cbLicInfo = Marshal.SizeOf(typeof(tagLICINFO)); 4761public int cbSize = Marshal.SizeOf(typeof(TOOLINFO_T)); 4775public int cbSize = Marshal.SizeOf(typeof(TOOLINFO_TOOLTIP)); 5048public int cbSize = Marshal.SizeOf(typeof(HELPINFO)); 5244public int cbSize = Marshal.SizeOf(typeof(MCHITTESTINFO)); 5435public uint cbSize = (uint)Marshal.SizeOf(typeof(LVGROUP)); 5453public uint cbSize = (uint)Marshal.SizeOf(typeof(LVINSERTMARK)); 5461public uint cbSize = (uint)Marshal.SizeOf(typeof(LVTILEVIEWINFO)); 5607public int cbSize = Marshal.SizeOf(typeof(CHARFORMATW)); 5622public int cbSize = Marshal.SizeOf(typeof(CHARFORMATA)); 5637public int cbSize = Marshal.SizeOf(typeof(CHARFORMAT2A)); 5683public int cbSize = Marshal.SizeOf(typeof(PARAFORMAT)); 5743public int cbSizeOfStruct = Marshal.SizeOf(typeof(OCPFIPARAMS)); 5760public int cbSize = Marshal.SizeOf(typeof(DOCHOSTUIINFO)); 6057if (Marshal.SystemDefaultCharSize == 2) {
winforms\Managed\System\WinForms\NativeWindow.cs (7)
605string defproc = (Marshal.SystemDefaultCharSize == 1 ? "DefWindowProcA" : "DefWindowProcW"); 767lastWin32Error = Marshal.GetLastWin32Error(); 1573string defproc = (Marshal.SystemDefaultCharSize == 1 ? "DefWindowProcA" : "DefWindowProcW"); 1599int error = Marshal.GetLastWin32Error(); 1609wndclass.lpszMenuName = Marshal.PtrToStringAuto(wcls.lpszMenuName); 1627int err = Marshal.GetLastWin32Error(); 1659} while (atom == 0 && Marshal.GetLastWin32Error() == NativeMethods.ERROR_CLASS_ALREADY_EXISTS);
winforms\Managed\System\WinForms\Printing\PageSetupDialog.cs (1)
360data.lStructSize = Marshal.SizeOf(data);
winforms\Managed\System\WinForms\Printing\PrintDialog.cs (3)
295data.lStructSize = Marshal.SizeOf(data); 322data.lStructSize = Marshal.SizeOf(data); 333data.nMaxPageRanges * Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE)));
winforms\Managed\System\WinForms\Printing\PrintPreviewControl.cs (1)
366si.cbSize = Marshal.SizeOf(typeof(NativeMethods.SCROLLINFO));
winforms\Managed\System\WinForms\PropertyGrid.cs (2)
4644if (!Marshal.IsComObject(obj)) { 4807propName = Marshal.PtrToStringAuto(cds.lpData);
winforms\Managed\System\WinForms\PropertyGridInternal\GridToolTip.cs (1)
129toolInfos[index].cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_T));
winforms\Managed\System\WinForms\RichTextBox.cs (30)
365int lastWin32Error = Marshal.GetLastWin32Error(); 398if (Marshal.SystemDefaultCharSize == 1) { 1509if (Marshal.SystemDefaultCharSize == 1 /*ANSI*/) 1831Marshal.Copy(buf, bytes, 0, cb); 1904Marshal.Copy(bytes, 0, buf, transferred); 2215if (txrg.lpstrText != IntPtr.Zero) Marshal.FreeCoTaskMem(txrg.lpstrText); 2900if (Marshal.SystemDefaultCharSize == 1) 3206l = (long) Marshal.GetFunctionPointerForDelegate(es.pfnCallback); 3276IntPtr punk = Marshal.GetIUnknownForObject(oleCallback); 3280Marshal.QueryInterface(punk, ref iidRichEditOleCallback, out pRichEditOleCallback); 3285Marshal.Release(pRichEditOleCallback); 3288Marshal.Release(punk); 3387Marshal.FreeCoTaskMem(unmanagedBuffer); 3559es.nmhdr.hwndFrom = Marshal.ReadIntPtr((IntPtr)es64p); 3560es.nmhdr.idFrom = Marshal.ReadIntPtr((IntPtr)(es64p + 8)); 3561es.nmhdr.code = Marshal.ReadInt32((IntPtr)(es64p + 16)); 3562es.msg = Marshal.ReadInt32((IntPtr)(es64p + 24)); 3563es.wParam = Marshal.ReadIntPtr((IntPtr)(es64p + 28)); 3564es.lParam = Marshal.ReadIntPtr((IntPtr)(es64p + 36)); 3565es.chrg.cpMin = Marshal.ReadInt32((IntPtr)(es64p + 44)); 3566es.chrg.cpMax = Marshal.ReadInt32((IntPtr)(es64p + 48)); 3579es.nmhdr.hwndFrom = Marshal.ReadIntPtr((IntPtr)es64p); 3580es.nmhdr.idFrom = Marshal.ReadIntPtr((IntPtr)(es64p + 8)); 3581es.nmhdr.code = Marshal.ReadInt32((IntPtr)(es64p + 16)); 3582es.msg = Marshal.ReadInt32((IntPtr)(es64p + 24)); 3583es.wParam = Marshal.ReadIntPtr((IntPtr)(es64p + 28)); 3584es.lParam = Marshal.ReadIntPtr((IntPtr)(es64p + 36)); 3585es.charrange.cpMin = Marshal.ReadInt32((IntPtr)(es64p + 44)); 3586es.charrange.cpMax = Marshal.ReadInt32((IntPtr)(es64p + 48)); 3722m.Result = (IntPtr) ((Marshal.SystemDefaultCharSize == 1) ? (65536+29) : (65536+30));
winforms\Managed\System\WinForms\SafeNativeMethods.cs (1)
364if (Marshal.SystemDefaultCharSize == 1)
winforms\Managed\System\WinForms\ScrollBar.cs (1)
794si.cbSize = Marshal.SizeOf(typeof(NativeMethods.SCROLLINFO));
winforms\Managed\System\WinForms\ScrollProperties.cs (1)
314si.cbSize = Marshal.SizeOf(typeof(NativeMethods.SCROLLINFO));
winforms\Managed\System\WinForms\SendKeys.cs (2)
594int INPUTSize = Marshal.SizeOf(typeof(NativeMethods.INPUT)); 1096Marshal.StructureToPtr(eventmsg, lparam, true);
winforms\Managed\System\WinForms\StatusBar.cs (2)
1855ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_T)); 1877ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_T));
winforms\Managed\System\WinForms\StringSource.cs (2)
89Marshal.ReleaseComObject(autoCompleteObject2); 130Marshal.WriteInt32(pceltFetched, fetched);
winforms\Managed\System\WinForms\SystemInformation.cs (4)
86data.cbSize = Marshal.SizeOf(data); 1135if (UnsafeNativeMethods.GetUserObjectInformation(new HandleRef(null, hwinsta), NativeMethods.UOI_FLAGS, flags, Marshal.SizeOf(flags), ref lengthNeeded)) { 1794dm.dmSize = (short) Marshal.SizeOf(typeof(NativeMethods.DEVMODE)); 1973int error = Marshal.GetLastWin32Error();
winforms\Managed\System\WinForms\TabControl.cs (1)
2045Marshal.StructureToPtr(ttt, m.LParam, false);
winforms\Managed\System\WinForms\TextBoxBase.cs (8)
1023if( this.SelectionUsesDbcsOffsetsInWin9x && Marshal.SystemDefaultCharSize == 1 ) { 1257if (IsHandleCreated && Marshal.SystemDefaultCharSize == 2) { 1838editOlePtr = Marshal.GetIUnknownForObject(editOle); 1845Marshal.QueryInterface(editOlePtr, ref iiTextDocumentGuid, out iTextDocument); 1847UnsafeNativeMethods.ITextDocument textDocument = Marshal.GetObjectForIUnknown(iTextDocument) as UnsafeNativeMethods.ITextDocument; 1883Marshal.Release(iTextDocument); 1890Marshal.Release(editOlePtr); 2047if (this.SelectionUsesDbcsOffsetsInWin9x && Marshal.SystemDefaultCharSize == 1) {
winforms\Managed\System\WinForms\ToolBar.cs (10)
1141tbbi.cbSize = Marshal.SizeOf(typeof(NativeMethods.TBBUTTONINFO)); 1240Marshal.FreeHGlobal(tbbi.pszText); 1290SendMessage(NativeMethods.TB_BUTTONSTRUCTSIZE, Marshal.SizeOf(typeof(NativeMethods.TBBUTTON)), 0); 1375int cb = Marshal.SizeOf(typeof(NativeMethods.TBBUTTON)); 1377ptbbuttons = Marshal.AllocHGlobal(checked(cb * count)); 1382Marshal.StructureToPtr(tbbutton, (IntPtr)(checked((long)ptbbuttons + (cb * x))), true); 1407Marshal.FreeHGlobal(ptbbuttons); 1592Marshal.StructureToPtr(ttt, m.LParam, false); 1614Marshal.StructureToPtr(ttt, m.LParam, false); 1691if (Marshal.SystemDefaultCharSize == 2) {
winforms\Managed\System\WinForms\ToolBarButton.cs (5)
20using Marshal = System.Runtime.InteropServices.Marshal; 556button.cbSize = Marshal.SizeOf(typeof(NativeMethods.TBBUTTONINFO)); 630button.cbSize = Marshal.SizeOf(typeof(NativeMethods.TBBUTTONINFO)); 673button.pszText = Marshal.StringToHGlobalAuto("\0\0"); 678button.pszText = Marshal.StringToHGlobalAuto(textValue);
winforms\Managed\System\WinForms\ToolStripDropDownMenu.cs (3)
290info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T_RW)); 302 info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T_RW)); 313 info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T_RW));
winforms\Managed\System\WinForms\ToolStripMenuItem.cs (5)
708info.cbSize = Marshal.SizeOf(typeof(NativeMethods.MENUITEMINFO_T_RW)); 738IntPtr allocatedStringBuffer = Marshal.AllocCoTaskMem(info.cch * Marshal.SystemDefaultCharSize); 749text = Marshal.PtrToStringAuto(info.dwTypeData, info.cch); 756Marshal.FreeCoTaskMem(allocatedStringBuffer);
winforms\Managed\System\WinForms\ToolTip.cs (18)
989Marshal.FreeHGlobal(tool.lpszText); 1145ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 1163ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 1186ti.lpszText = Marshal.StringToHGlobalAuto(caption); 1192ti.lpszText = Marshal.StringToHGlobalAuto(caption); 1202ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 1482Marshal.FreeHGlobal(toolInfo.lpszText); 2015ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 2025ti.lpszText = Marshal.StringToHGlobalAuto(text); 2044Marshal.FreeHGlobal(ti.lpszText); 2074toolInfo.lpszText = Marshal.StringToHGlobalAuto(text); 2079Marshal.FreeHGlobal(toolInfo.lpszText); 2188ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 2232ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 2288ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 2399ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 2493ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP)); 2609ti.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO_TOOLTIP));
winforms\Managed\System\WinForms\TreeNode.cs (4)
1682tvis.item_pszText = Marshal.StringToHGlobalAuto(text); 1725Marshal.FreeHGlobal(tvis.item_pszText); 1926item.pszText = Marshal.StringToHGlobalAuto(text); 1946Marshal.FreeHGlobal(item.pszText);
winforms\Managed\System\WinForms\TreeView.cs (5)
2609string newText = (nmtvdi.item.pszText == IntPtr.Zero ? null : Marshal.PtrToStringAuto(nmtvdi.item.pszText)); 2716Marshal.StructureToPtr(nmcd, m.LParam, false); 2730si.cbSize = Marshal.SizeOf(typeof(NativeMethods.SCROLLINFO)); 2789Marshal.StructureToPtr(nmcd, m.LParam, false); 2964Marshal.StructureToPtr(ttt, m.LParam, false);
winforms\Managed\System\WinForms\UnsafeNativeMethods.cs (33)
533&& Marshal.GetLastWin32Error() == NativeMethods.ERROR_INSUFFICIENT_BUFFER 673return GetObject(hObject, Marshal.SizeOf(typeof(NativeMethods.LOGPEN)), lp); 680return GetObject(hObject, Marshal.SizeOf(typeof(NativeMethods.LOGBRUSH)), lb); 687return GetObject(hObject, Marshal.SizeOf(typeof(NativeMethods.LOGFONT)), lp); 1670pBytes = Marshal.AllocCoTaskMem(regionDataSize); 1680Debug.Assert(Marshal.SizeOf(typeof(NativeMethods.RECT)) == pRgnDataHeader->nRgnSize || pRgnDataHeader->nRgnSize == 0); 1686regionRects[i] = *((NativeMethods.RECT*)((byte*)pBytes + rectStart + (Marshal.SizeOf(typeof(NativeMethods.RECT)) * i))); 1694Marshal.FreeCoTaskMem(pBytes); 6518if (Marshal.SystemDefaultCharSize == 1) 6544IntPtr result = Marshal.AllocCoTaskMem(buffer.Length); 6545Marshal.Copy(buffer, 0, result, buffer.Length); 6563Marshal.Copy(ptr, buffer, 0, buffer.Length); 6590IntPtr result = Marshal.AllocCoTaskMem(buffer.Length * 2); 6591Marshal.Copy(buffer, 0, result, buffer.Length); 6607Marshal.Copy(ptr, buffer, 0, buffer.Length); 6658IntPtr buffer = Marshal.AllocHGlobal(bufsize); 6674Marshal.FreeHGlobal(buffer); 6704Marshal.Copy(buffer, 0, buf, count); 6776Marshal.Copy(buf, buffer, 0, length); 7333public int cbSize = Marshal.SizeOf(typeof(tagQACONTAINER)); 7385public int cbSize = Marshal.SizeOf(typeof(tagQACONTROL)); 7516return Marshal.IsComObject(o); 7521return Marshal.ReleaseComObject(objToRelease); 7526return Marshal.PtrToStructure(lparam, cls); 7531Marshal.PtrToStructure(lparam, data); 7536return Marshal.SizeOf(t); 7541Marshal.ThrowExceptionForHR(errorCode); 7596int bufferSize = NativeMethods.MAX_PATH * Marshal.SystemDefaultCharSize; 7606string path = Marshal.PtrToStringAuto(pszPath); 7614pszPath = Marshal.ReAllocHGlobal(pszPath, (IntPtr)((length + 1) * Marshal.SystemDefaultCharSize)); 7643pszPath.Append(Marshal.PtrToStringAuto(path)); 8205enableThemingActivationContext.cbSize = Marshal.SizeOf(typeof(ACTCTX));
winforms\Managed\System\WinForms\WebBrowser.cs (1)
510if (!Marshal.IsTypeVisibleFromCom(t))
winforms\Managed\System\WinForms\WebBrowserBase.cs (1)
943Marshal.FinalReleaseComObject(activeXInstance);
winforms\Managed\System\WinForms\WebBrowserSiteBase.cs (1)
313lpFrameInfo.cb = Marshal.SizeOf(typeof(NativeMethods.tagOIFI));
winforms\Managed\System\WinForms\WinFormsUtils.cs (1)
362Debug.Assert(Marshal.SizeOf(typeof(int)) == 4, "The impossible has happened.");
System.Workflow.Activities (4)
Common\CompModHelpers.cs (2)
546int error = Marshal.GetLastWin32Error(); 596int error = Marshal.GetLastWin32Error();
Common\NativeMethods.cs (2)
168if (Marshal.SystemDefaultCharSize == 1) 220Marshal.ThrowExceptionForHR(hr);
System.Workflow.ComponentModel (49)
AuthoringOM\Compiler\CompileXomlTask.cs (2)
77service = Marshal.GetObjectForIUnknown(pUnk); 81Marshal.Release(pUnk);
AuthoringOM\Compiler\PDBReader.cs (5)
36Marshal.ReleaseComObject(metaDataImport); 39Marshal.ReleaseComObject(dispenser); 58Marshal.ReleaseComObject(this.symReader); 128Marshal.ReleaseComObject(documents[i]); 131Marshal.ReleaseComObject(symMethod);
AuthoringOM\Compiler\XomlCompilerHelpers.cs (11)
855typeRefNamePtr = Marshal.AllocCoTaskMem((int)(2 * (typeRefNameLength + 1))); 862typeRefName = Marshal.PtrToStringUni(typeRefNamePtr); 863Marshal.FreeCoTaskMem(typeRefNamePtr); 886assemblyName = Marshal.AllocCoTaskMem((int)(2 * (assemblyNameSize + 1))); 889assemblyMetadata.locale = Marshal.AllocCoTaskMem((int)(2 * (assemblyMetadata.localeSize + 1))); 901publicKeyString += String.Format("{0}", Marshal.ReadByte(publicKeyOrToken, pos).ToString("x2")); 904yield return String.Format("{0}, {1}, Version={2}.{3}.{4}.{5}, Culture={6}, PublicKeyToken={7}", typeRefName, Marshal.PtrToStringUni(assemblyName), assemblyMetadata.majorVersion, assemblyMetadata.minorVersion, assemblyMetadata.buildNumber, assemblyMetadata.revisionNumber, String.IsNullOrEmpty(Marshal.PtrToStringUni(assemblyMetadata.locale)) ? "neutral" : Marshal.PtrToStringUni(assemblyMetadata.locale), String.IsNullOrEmpty(publicKeyString) ? "null" : publicKeyString); 910Marshal.FreeCoTaskMem(assemblyName); 916Marshal.FreeCoTaskMem(assemblyMetadata.locale);
AuthoringOM\Design\DesignerHelpers.cs (21)
922throw new Win32Exception(Marshal.GetLastWin32Error()); 927throw new Win32Exception(Marshal.GetLastWin32Error()); 931throw new Win32Exception(Marshal.GetLastWin32Error()); 937throw new Win32Exception(Marshal.GetLastWin32Error()); 943throw new Win32Exception(Marshal.GetLastWin32Error()); 1032throw new Win32Exception(Marshal.GetLastWin32Error()); 1039throw new Win32Exception(Marshal.GetLastWin32Error()); 1042throw new Win32Exception(Marshal.GetLastWin32Error()); 1049throw new Win32Exception(Marshal.GetLastWin32Error()); 1052throw new Win32Exception(Marshal.GetLastWin32Error()); 1055throw new Win32Exception(Marshal.GetLastWin32Error()); 1059throw new Win32Exception(Marshal.GetLastWin32Error()); 1068throw new Win32Exception(Marshal.GetLastWin32Error()); 1071throw new Win32Exception(Marshal.GetLastWin32Error()); 1078throw new Win32Exception(Marshal.GetLastWin32Error()); 1081throw new Win32Exception(Marshal.GetLastWin32Error()); 1084throw new Win32Exception(Marshal.GetLastWin32Error()); 1088throw new Win32Exception(Marshal.GetLastWin32Error()); 1097throw new Win32Exception(Marshal.GetLastWin32Error()); 1116throw new Win32Exception(Marshal.GetLastWin32Error()); 1407int hr = Marshal.GetLastWin32Error();
AuthoringOM\Design\DesignerWidgets.cs (6)
2258NativeMethods.NMHDR notifyHeader = Marshal.PtrToStructure(msg.LParam, typeof(NativeMethods.NMHDR)) as NativeMethods.NMHDR; 2343titleStr = Marshal.StringToBSTR(title); 2348Marshal.FreeBSTR(titleStr); 2358toolInfo.text = Marshal.StringToBSTR(toolTipText); 2363Marshal.FreeBSTR(toolInfo.text); 2392toolInfo.size = Marshal.SizeOf(toolInfo);
Shared\CompModHelpers.cs (2)
544int error = Marshal.GetLastWin32Error(); 594int error = Marshal.GetLastWin32Error();
Shared\NativeMethods.cs (2)
182if (Marshal.SystemDefaultCharSize == 1) 234Marshal.ThrowExceptionForHR(hr);
System.Workflow.Runtime (32)
DebugEngine\DebugController.cs (31)
104Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 135Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 142int lasterror = Marshal.GetLastWin32Error(); //#pragma warning disable 56523 doesnt recognize 56523 144securityDescriptorPtr = Marshal.AllocCoTaskMem((int)returnLength); 147Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 150Marshal.Copy(securityDescriptorPtr, sdBytes, 0, (int)returnLength); 160Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 164Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 167Marshal.FreeCoTaskMem(securityDescriptorPtr); 180Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 186int lasterror = Marshal.GetLastWin32Error(); //#pragma warning disable 56523 doesnt recognize 56523 188securityDescriptorPtr = Marshal.AllocCoTaskMem((int)returnLength); 191Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 194Marshal.Copy(securityDescriptorPtr, sdBytes, 0, (int)returnLength); 201Marshal.FreeCoTaskMem(securityDescriptorPtr); 202securityDescriptorPtr = Marshal.AllocCoTaskMem(rawSecurityDescriptor.BinaryLength); 203Marshal.Copy(sdBytes, 0, securityDescriptorPtr, rawSecurityDescriptor.BinaryLength); 206Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 212Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 216Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 219Marshal.FreeCoTaskMem(securityDescriptorPtr);
DebugEngine\ProgramPublisher.cs (1)
122Marshal.ReleaseComObject(this.publisher);
UIAutomationClient (56)
MS\Internal\Automation\HwndProxyElementProvider.cs (5)
328wp.length = Marshal.SizeOf(typeof(UnsafeNativeMethods.WINDOWPLACEMENT)); 719wp.length = Marshal.SizeOf(typeof(UnsafeNativeMethods.WINDOWPLACEMENT)); 832wp.length = Marshal.SizeOf(typeof(UnsafeNativeMethods.WINDOWPLACEMENT)); 1920int lastWin32Error = Marshal.GetLastWin32Error(); 1945int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\Automation\Input.cs (2)
73Misc.SendInput(1, ref ki, Marshal.SizeOf(ki)); 90Misc.SendInput(1, ref ki, Marshal.SizeOf(ki));
MS\Internal\Automation\Misc.cs (29)
309int lastWin32Error = Marshal.GetLastWin32Error(); 322int lastWin32Error = Marshal.GetLastWin32Error(); 335int lastWin32Error = Marshal.GetLastWin32Error(); 348int lastWin32Error = Marshal.GetLastWin32Error(); 360guiThreadInfo.cbSize = Marshal.SizeOf(guiThreadInfo); 363int lastWin32Error = Marshal.GetLastWin32Error(); 383int lastWin32Error = Marshal.GetLastWin32Error(); 396int lastWin32Error = Marshal.GetLastWin32Error(); 409int lastWin32Error = Marshal.GetLastWin32Error(); 422int lastWin32Error = Marshal.GetLastWin32Error(); 443error = Marshal.GetLastWin32Error(); 450error = Marshal.GetLastWin32Error(); 465int lastWin32Error = Marshal.GetLastWin32Error(); 478int lastWin32Error = Marshal.GetLastWin32Error(); 491int lastWin32Error = Marshal.GetLastWin32Error(); 504ThrowWin32ExceptionsIfError(Marshal.GetLastWin32Error()); 515lastWin32Error = Marshal.GetLastWin32Error(); 526lastWin32Error = Marshal.GetLastWin32Error(); 553int lastWin32Error = Marshal.GetLastWin32Error(); 564lastWin32Error = Marshal.GetLastWin32Error(); 583int lastWin32Error = Marshal.GetLastWin32Error(); 596int lastWin32Error = Marshal.GetLastWin32Error(); 609int lastWin32Error = Marshal.GetLastWin32Error(); 626int lastWin32Error = Marshal.GetLastWin32Error(); 643int lastWin32Error = Marshal.GetLastWin32Error(); 660int lastWin32Error = Marshal.GetLastWin32Error(); 674int lastWin32Error = Marshal.GetLastWin32Error(); 687int lastWin32Error = Marshal.GetLastWin32Error(); 700int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\Automation\ProxyManager.cs (2)
241int lastWin32Error = Marshal.GetLastWin32Error(); 255int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\Automation\UiaCoreAPI.cs (12)
153IntPtr dataStart = Marshal.AllocCoTaskMem((properties.Length + patterns.Length) * sizeof(int)); 179Marshal.FreeCoTaskMem(_pProperties); 664UiaEventArgs args = (UiaEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaEventArgs)); 682UiaPropertyChangedEventArgs pcargs = (UiaPropertyChangedEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaPropertyChangedEventArgs)); 696UiaStructureChangedEventArgs scargs = (UiaStructureChangedEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaStructureChangedEventArgs)); 703UiaAsyncContentLoadedEventArgs aclargs = (UiaAsyncContentLoadedEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaAsyncContentLoadedEventArgs)); 709UiaWindowClosedEventArgs wcargs = (UiaWindowClosedEventArgs)Marshal.PtrToStructure(argsAddr, typeof(UiaWindowClosedEventArgs)); 1139&& !Marshal.IsComObject(arr[1]) 1152IntPtr errorInfoAsIntPtr = Marshal.GetIUnknownForObject(errorInfo); 1155Marshal.Release(errorInfoAsIntPtr); 1158Marshal.ThrowExceptionForHR(hr); 1217Marshal.ThrowExceptionForHR(hr);
System\Windows\Automation\Condition.cs (6)
45Marshal.FreeCoTaskMem(handle); 54int size = Marshal.SizeOf(uiaCondition); 60IntPtr mem = Marshal.AllocCoTaskMem(size); 63Marshal.StructureToPtr(uiaCondition, sh.handle, false); 74int intPtrSize = Marshal.SizeOf(typeof(IntPtr)); 80IntPtr mem = Marshal.AllocCoTaskMem(conditions.Length * intPtrSize);
UIAutomationClientsideProviders (214)
MS\Internal\AutomationProxies\CommonXSendMessage.cs (69)
163if (Marshal.SizeOf(hwnd) == sizeof(int)) 417return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 424new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), 432return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 446return XSend(hwnd, NativeMethods.LVM_SETITEMSTATE, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType())); 452return XSend(hwnd, NativeMethods.LVM_SETITEMSTATE, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 458return XSend(hwnd, NativeMethods.LVM_SETITEMSTATE, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 474return XSend(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(pItem), Marshal.SizeOf(item.GetType()), XSendMessage.ErrorValue.NoCheck); 481bool result = XSend(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), XSendMessage.ErrorValue.NoCheck); 493bool result = XSend(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), XSendMessage.ErrorValue.NoCheck); 514new IntPtr(group.iGroupID), new IntPtr(&group), Marshal.SizeOf(group.GetType())); 521new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType())); 528new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType())); 547new IntPtr(group.iGroupID), new IntPtr(pGroup), Marshal.SizeOf(group.GetType())); 558new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType())); 569new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType())); 592new IntPtr(group.iGroupID), new IntPtr(pGroup), Marshal.SizeOf(group.GetType())); 603new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType())); 614new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType())); 639return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item.iGroupID), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszHeader), item.cchHeader); 651return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item32.iGroupID), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszHeader), item32.cchHeader); 663return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item64.iGroupID), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszHeader), item64.cchHeader); 698return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item.iGroupID), new IntPtr(&item), Marshal.SizeOf(item.GetType()), textAddress, size, true); 716return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item32.iGroupID), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), textAddress, size, true); 734return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item64.iGroupID), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), textAddress, size, true); 760return XSend(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType())); 767bool result = XSend(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 780bool result = XSend(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 801return GetTextWithinStructure(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 808new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), 816return GetTextWithinStructure(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 842return XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType())); 849bool result = XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 862bool result = XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 883return GetTextWithinStructure(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 891Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), item32.cchTextMax, 898return GetTextWithinStructure(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 924return XSend(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(pItem), Marshal.SizeOf(item.GetType())); 931bool result = XSend(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 944bool result = XSend(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 965return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType())); 971return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 977return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 999Marshal.SizeOf(hitTestInfo.GetType()), XSendMessage.ErrorValue.Zero)) 1008Marshal.SizeOf(hitTestInfo32.GetType()), XSendMessage.ErrorValue.Zero)) 1017Marshal.SizeOf(hitTestInfo64.GetType()), XSendMessage.ErrorValue.Zero)) 1036return GetTextWithinStructure(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 1044Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), item32.cchTextMax, 1051return GetTextWithinStructure(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 1077return XSend(hwnd, NativeMethods.TB_GETBUTTON, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType()), ErrorValue.Zero); 1084bool result = XSend(hwnd, NativeMethods.TB_GETBUTTON, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), ErrorValue.Zero); 1097bool result = XSend(hwnd, NativeMethods.TB_GETBUTTON, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), ErrorValue.Zero); 1135Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), maxTextLength, true); 1143Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), maxTextLength, 1152Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), maxTextLength, true); 1180int cMem = Marshal.SizeOf(rectW32.GetType()); 1522int status = UnsafeNativeMethods.NtQueryInformationProcess(hProcess, UnsafeNativeMethods.ProcessWow64Information, ref infoWOW64, Marshal.SizeOf(typeof(ulong)), null); 1980cbSize = Marshal.SizeOf(typeof(LVGROUP_32)); 1997nativeItem.cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP)); 2045cbSize = Marshal.SizeOf(typeof(LVGROUP_V6_32)); 2078nativeItem.cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6)); 2127cbSize = Marshal.SizeOf(typeof(LVGROUP_64)); 2145nativeItem.cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP)); 2194cbSize = Marshal.SizeOf(typeof(LVGROUP_V6_64)); 2228nativeItem.cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6)); 2521cbSize = Marshal.SizeOf(typeof(TOOLINFO_32)); 2536nativeItem.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO)); 2564cbSize = Marshal.SizeOf(typeof(TOOLINFO_64)); 2579nativeItem.cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO));
MS\Internal\AutomationProxies\Input.cs (5)
127if( UnsafeNativeMethods.SendInput( 1, ref mi, Marshal.SizeOf(mi) ) == 0 ) 128throw new Win32Exception(Marshal.GetLastWin32Error()); 150if( UnsafeNativeMethods.SendInput( 1, ref ki, Marshal.SizeOf(ki) ) == 0 ) 151throw new Win32Exception(Marshal.GetLastWin32Error()); 173Misc.SendInput(1, ref ki, Marshal.SizeOf(ki));
MS\Internal\AutomationProxies\Misc.cs (59)
135int lastWin32Error = Marshal.GetLastWin32Error(); 180int lastWin32Error = Marshal.GetLastWin32Error(); 193int lastWin32Error = Marshal.GetLastWin32Error(); 208int lastWin32Error = Marshal.GetLastWin32Error(); 232int lastWin32Error = Marshal.GetLastWin32Error(); 272int lastWin32Error = Marshal.GetLastWin32Error(); 289int lastWin32Error = Marshal.GetLastWin32Error(); 304int lastWin32Error = Marshal.GetLastWin32Error(); 318int lastWin32Error = Marshal.GetLastWin32Error(); 343tool.Init(Marshal.SizeOf(typeof(NativeMethods.TOOLINFO))); 442int lastWin32Error = Marshal.GetLastWin32Error(); 455int lastWin32Error = Marshal.GetLastWin32Error(); 468int lastWin32Error = Marshal.GetLastWin32Error(); 481int lastWin32Error = Marshal.GetLastWin32Error(); 494int lastWin32Error = Marshal.GetLastWin32Error(); 508int lastWin32Error = Marshal.GetLastWin32Error(); 521int lastWin32Error = Marshal.GetLastWin32Error(); 534int lastWin32Error = Marshal.GetLastWin32Error(); 547int lastWin32Error = Marshal.GetLastWin32Error(); 567int lastWin32Error = Marshal.GetLastWin32Error(); 632int lastWin32Error = Marshal.GetLastWin32Error(); 689int lastWin32Error = Marshal.GetLastWin32Error(); 730int lastWin32Error = Marshal.GetLastWin32Error(); 741ThrowWin32ExceptionsIfError(Marshal.GetLastWin32Error()); 798int lastWin32Error = Marshal.GetLastWin32Error(); 899int lastWin32Error = Marshal.GetLastWin32Error(); 913int lastWin32Error = Marshal.GetLastWin32Error(); 938int lastWin32Error = Marshal.GetLastWin32Error(); 1005lastWin32Error = Marshal.GetLastWin32Error(); 1016lastWin32Error = Marshal.GetLastWin32Error(); 1036int lastWin32Error = Marshal.GetLastWin32Error(); 1047lastWin32Error = Marshal.GetLastWin32Error(); 1068int lastWin32Error = Marshal.GetLastWin32Error(); 1099gui.cbSize = Marshal.SizeOf(gui.GetType()); 1102int lastWin32Error = Marshal.GetLastWin32Error(); 1199ti.cbSize = Marshal.SizeOf(ti.GetType()); 1202int lastWin32Error = Marshal.GetLastWin32Error(); 1215ti.cbSize = Marshal.SizeOf(ti.GetType()); 1218int lastWin32Error = Marshal.GetLastWin32Error(); 1273int lastWin32Error = Marshal.GetLastWin32Error(); 1301int lastWin32Error = Marshal.GetLastWin32Error(); 1327int lastWin32Error = Marshal.GetLastWin32Error(); 1353int lastWin32Error = Marshal.GetLastWin32Error(); 1368int lastWin32Error = Marshal.GetLastWin32Error(); 1404int lastWin32Error = Marshal.GetLastWin32Error(); 1417int lastWin32Error = Marshal.GetLastWin32Error(); 1433int lastWin32Error = Marshal.GetLastWin32Error(); 1447int lastWin32Error = Marshal.GetLastWin32Error(); 1468int lastWin32Error = Marshal.GetLastWin32Error(); 1491int lastWin32Error = Marshal.GetLastWin32Error(); 1636int lastWin32Error = Marshal.GetLastWin32Error(); 1753int lastWin32Error = Marshal.GetLastWin32Error(); 1766int lastWin32Error = Marshal.GetLastWin32Error(); 1779int lastWin32Error = Marshal.GetLastWin32Error(); 1792int lastWin32Error = Marshal.GetLastWin32Error(); 1805int lastWin32Error = Marshal.GetLastWin32Error(); 1818int lastWin32Error = Marshal.GetLastWin32Error(); 1831int lastWin32Error = Marshal.GetLastWin32Error(); 1937tool.Init(Marshal.SizeOf(typeof(NativeMethods.TOOLINFO)));
MS\Internal\AutomationProxies\SafeCoTaskMem.cs (4)
32SetHandle(Marshal.AllocCoTaskMem(length * sizeof (char))); 37return Marshal.PtrToStringAuto(handle); 43return Marshal.PtrToStringUni(handle, length); 52Marshal.FreeCoTaskMem(handle);
MS\Internal\AutomationProxies\WindowsAltTab.cs (2)
256altTabInfo.cbSize = (uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.ALTTABINFO)); 266int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\AutomationProxies\WindowsEditBox.cs (2)
619int cb = Marshal.SizeOf(typeof(NativeMethods.LOGFONT)); 771si.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(NativeMethods.ScrollInfo));
MS\Internal\AutomationProxies\WindowsHyperlink.cs (3)
227bGetItemResult = XSendMessage.XSend(_hwnd, NativeMethods.LM_HITTEST, IntPtr.Zero, new IntPtr(&HitTestInfo), Marshal.SizeOf(HitTestInfo.GetType())); 412return XSendMessage.XSend(_hwnd, NativeMethods.LM_SETITEM, IntPtr.Zero, new IntPtr(&linkItem), Marshal.SizeOf(linkItem.GetType())); 511bGetItemResult = XSendMessage.XSend(_hwnd, NativeMethods.LM_HITTEST, IntPtr.Zero, new IntPtr(&HitTestInfo), Marshal.SizeOf(HitTestInfo.GetType()));
MS\Internal\AutomationProxies\WindowsListView.cs (7)
1284if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETITEMRECT, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(itemRectangle.GetType()))) 1434result = XSendMessage.XSendGetIndex(hwnd, NativeMethods.LVM_SUBITEMHITTEST, IntPtr.Zero, new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); 1442result = XSendMessage.XSendGetIndex(hwnd, NativeMethods.LVM_SUBITEMHITTEST, IntPtr.Zero, new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); 1505if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETSUBITEMRECT, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(itemRectangle.GetType()))) 1678scrollBarInfo.cbSize = Marshal.SizeOf(scrollBarInfo.GetType()); 1689si.cbSize = Marshal.SizeOf (si.GetType ()); 1806if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETITEMPOSITION, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(pt.GetType())))
MS\Internal\AutomationProxies\WindowsListViewGroup.cs (12)
106group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 116group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP))); 162group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 250group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 316XSendMessage.XSendGetIndex(_hwnd, NativeMethods.LVM_HITTEST, new IntPtr(-1), new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); 342groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 347bool lresult = XSendMessage.XSend(_hwnd, NativeMethods.LVM_GETGROUPINFOBYINDEX, new IntPtr(groupIndex), new IntPtr(&groupInfo), Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 434group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP))); 499groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 504bool lresult = XSendMessage.XSend(hwnd, NativeMethods.LVM_GETGROUPINFOBYINDEX, new IntPtr(groupIndex), new IntPtr(&groupInfo), Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 513groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 615group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP)));
MS\Internal\AutomationProxies\WindowsListViewGroupHelper.cs (5)
398while (XSendMessage.XSend (hwnd, NativeMethods.LVM_GETNEXTITEMINDEX, new IntPtr(&ii), flags, Marshal.SizeOf(ii.GetType()))) 402groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 405bool lresult = XSendMessage.XSend(hwnd, NativeMethods.LVM_GETGROUPINFOBYINDEX, new IntPtr(ii.iGroup), new IntPtr(&groupInfo), Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 717new IntPtr(_groupID), new IntPtr(&rect), Marshal.SizeOf(rect.GetType())); 828sbi.cbSize = Marshal.SizeOf(sbi.GetType());
MS\Internal\AutomationProxies\WindowsListViewGroupSubsetLink.cs (3)
79XSendMessage.XSend(_hwnd, NativeMethods.LVM_GETGROUPRECT, new IntPtr(0), new IntPtr(&rect), Marshal.SizeOf(rect.GetType())); 90groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 107group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6)));
MS\Internal\AutomationProxies\WindowsListViewItem.cs (2)
144if (XSendMessage.XSend(_hwnd, NativeMethods.LVM_GETITEMINDEXRECT, new IntPtr(&ii), new IntPtr(&itemRectangle), Marshal.SizeOf(ii.GetType()), Marshal.SizeOf(itemRectangle.GetType())))
MS\Internal\AutomationProxies\WindowsListViewScroll.cs (1)
66si.cbSize = Marshal.SizeOf (si.GetType ());
MS\Internal\AutomationProxies\WindowsMenu.cs (6)
521mbi.cbSize = Marshal.SizeOf(mbi.GetType()); 1907menuItemInfo.cbSize = Marshal.SizeOf(menuItemInfo.GetType()); 1922menuItemInfo.cbSize = Marshal.SizeOf (menuItemInfo.GetType ()); 1966menuItemInfo.cbSize = Marshal.SizeOf(menuItemInfo.GetType()); 2573menuItemInfo.cbSize = Marshal.SizeOf(menuItemInfo.GetType()); 2614int readSize = Marshal.SizeOf(msaaMenuInfo.GetType());
MS\Internal\AutomationProxies\WindowsRebar.cs (3)
223return XSendMessage.XSendGetIndex(_hwnd, NativeMethods.RB_HITTEST, IntPtr.Zero, new IntPtr(&rbHitTestInfo), Marshal.SizeOf(rbHitTestInfo.GetType())); 416if (!XSendMessage.XSend(hwnd, NativeMethods.RB_GETRECT, new IntPtr(item), new IntPtr(&rectW32), Marshal.SizeOf(rectW32.GetType()), XSendMessage.ErrorValue.Zero)) 450if (XSendMessage.XSend(_hwnd, NativeMethods.RB_GETBANDINFOA, new IntPtr(_item), new IntPtr(&rebarBandInfo), Marshal.SizeOf(rebarBandInfo.GetType()), XSendMessage.ErrorValue.Zero))
MS\Internal\AutomationProxies\WindowsRichEditRange.cs (1)
1260Marshal.ThrowExceptionForHR(hr);
MS\Internal\AutomationProxies\WindowsScroll.cs (6)
138sbi.cbSize = Marshal.SizeOf(sbi.GetType()); 154si.cbSize = Marshal.SizeOf (si.GetType ()); 205si.cbSize = Marshal.SizeOf (si.GetType ()); 260si.cbSize = Marshal.SizeOf (si.GetType ()); 299si.cbSize = Marshal.SizeOf(si.GetType ()); 373si.cbSize = Marshal.SizeOf (si.GetType ());
MS\Internal\AutomationProxies\WindowsScrollBar.cs (8)
153sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 450si.cbSize = Marshal.SizeOf (si.GetType ()); 464sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 538sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 589si.cbSize = Marshal.SizeOf (si.GetType ()); 640si.cbSize = Marshal.SizeOf (si.GetType ()); 726sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 741sbi.cbSize = Marshal.SizeOf(sbi.GetType());
MS\Internal\AutomationProxies\WindowsScrollBarBits.cs (3)
215si.cbSize = Marshal.SizeOf (si.GetType ()); 233sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 550si.cbSize = Marshal.SizeOf (si.GetType ());
MS\Internal\AutomationProxies\WindowsSlider.cs (2)
477XSendMessage.XSend(hwnd, NativeMethods.TBM_GETCHANNELRECT, IntPtr.Zero, new IntPtr(&rcChannel), Marshal.SizeOf(rcChannel.GetType()), XSendMessage.ErrorValue.NoCheck); 489XSendMessage.XSend(hwnd, NativeMethods.TBM_GETTHUMBRECT, IntPtr.Zero, new IntPtr(&rcThumb), Marshal.SizeOf(rcThumb.GetType()), XSendMessage.ErrorValue.NoCheck);
MS\Internal\AutomationProxies\WindowsSysHeader.cs (2)
177index = XSendMessage.XSendGetIndex(_hwnd, NativeMethods.HDM_HITTEST, IntPtr.Zero, new IntPtr(&HitTestInfo), Marshal.SizeOf(HitTestInfo.GetType())); 587result = XSendMessage.XSend(_hwnd, NativeMethods.HDM_GETITEMRECT, new IntPtr(index), new IntPtr(&rectW32), Marshal.SizeOf(rectW32.GetType()), XSendMessage.ErrorValue.Zero);
MS\Internal\AutomationProxies\WindowsTab.cs (3)
279index = XSendMessage.XSendGetIndex(_hwnd, NativeMethods.TCM_HITTEST, IntPtr.Zero, new IntPtr(&hti), Marshal.SizeOf(hti.GetType())); 659result = XSendMessage.XSend(hwnd, NativeMethods.TCM_GETITEMRECT, new IntPtr(count - 1), new IntPtr(&rectW32), Marshal.SizeOf(rectW32.GetType()), XSendMessage.ErrorValue.Zero); 1278if (!XSendMessage.XSend(_hwnd, NativeMethods.TCM_GETITEMRECT, new IntPtr(_item), new IntPtr(&rectW32), Marshal.SizeOf(rectW32.GetType()), XSendMessage.ErrorValue.Zero))
MS\Internal\AutomationProxies\WindowsTreeView.cs (3)
571if (!XSendMessage.XSend(hwnd, NativeMethods.TVM_GETITEMRECT, partialDisplay, rectangle, Marshal.SizeOf(rc.GetType()))) 951if (Marshal.SizeOf(_hItem.GetType()) > sizeof(int)) 1608int readSize = Marshal.SizeOf(ent.GetType());
MS\Win32\NativeMethods.cs (1)
1505internal static int comboboxInfoSize = Marshal.SizeOf(typeof(NativeMethods.COMBOBOXINFO));
MS\Win32\UnsafeNativeMethods.cs (2)
393error = Marshal.GetLastWin32Error(); 400error = Marshal.GetLastWin32Error();
WindowsBase (124)
Base\MS\Internal\Interop\ErrorCodes.cs (2)
109return new Win32Error(Marshal.GetLastWin32Error()); 427Exception e = Marshal.GetExceptionForHR((int)_value, new IntPtr(-1));
Base\MS\Internal\Interop\NativeStructs.cs (2)
78return Marshal.PtrToStringUni(pointerVal); 105pointerVal = Marshal.StringToCoTaskMemUni(val);
Base\MS\Internal\IO\Packaging\CompoundFile\ContainerUtilities.cs (3)
306return Marshal.SizeOf(typeof(Int16)); 319return Marshal.SizeOf(typeof(Int32)); 330return Marshal.SizeOf(typeof(Int64));
Base\MS\Internal\IO\Packaging\StorageBasedPackageProperties.cs (9)
583string ansiString = Marshal.PtrToStringAnsi(pszVal); 587Marshal.Copy(pszVal, byteArray, 0, nLen); 721pszVal = Marshal.StringToCoTaskMemAnsi(inputString); 722string convertedString = Marshal.PtrToStringAnsi(pszVal); 738Marshal.FreeCoTaskMem(pszVal); 742pszVal = Marshal.AllocCoTaskMem(checked(nLen + 1)); //The extra one byte is for the string terminator null. 744Marshal.Copy(byteArray, 0, pszVal, nLen); 745Marshal.WriteByte(pszVal, nLen, 0); //Put the string terminator null at the end of the array. 774Marshal.FreeCoTaskMem(pszVal);
Base\MS\Internal\Security\AttachmentService.cs (1)
130Marshal.ReleaseComObject(_native);
Base\MS\Internal\Security\RightsManagement\CallbackHandler.cs (1)
101_callbackData = Marshal.PtrToStringUni(pvParam);
Base\MS\Internal\Security\RightsManagement\Errors.cs (1)
80Marshal.ThrowExceptionForHR(hr);
Base\MS\Internal\SplashScreenNativeMethods.cs (1)
146Marshal.ThrowExceptionForHR(hr, (IntPtr)(-1));
Base\MS\Internal\Utilities.cs (2)
77Debug.Assert(Marshal.IsComObject(t)); 78Marshal.ReleaseComObject(t);
Base\System\Windows\SplashScreen.cs (10)
80_hInstance = Marshal.GetHINSTANCE(resourceAssembly.ManifestModule); 182wndClass.cbSize = Marshal.SizeOf(typeof(MS.Win32.NativeMethods.WNDCLASSEX_D)); 196if (Marshal.GetLastWin32Error() != 0x582) /* class already registered */ 243UnsafeNativeMethods.HRESULT.Check(Marshal.GetHRForLastWin32Error()); 471Marshal.Release(pImagingFactory); 475Marshal.Release(pDecoder); 479Marshal.Release(pIStream); 483Marshal.Release(pDecodedFrame); 487Marshal.Release(pBitmapSourceFormatConverter); 491Marshal.Release(pBitmapFlipRotator);
Base\System\Windows\Threading\Dispatcher.cs (1)
2410if (messagePump != null) Marshal.ReleaseComObject(messagePump);
parent\parent\InternalApis\NDP_FX\inc\ZLibNative.cs (5)
442Int32 hresult = Marshal.GetHRForLastWin32Error(); 443Marshal.ThrowExceptionForHR(hresult, new IntPtr(-1)); 461return (DT) (Object) Marshal.GetDelegateForFunctionPointer(entryPoint, typeof(DT)); 571Marshal.FreeHGlobal((IntPtr)zStreamPtr); 763IntPtr ptr = Marshal.AllocHGlobal(byteCount);
Shared\MS\Internal\SecurityHelper.cs (4)
926return Marshal.GetExceptionForHR(hr, new IntPtr(-1)); 940Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); 961int hr = Marshal.GetHRForException(exception); 965Marshal.GetHRForException(new Exception());
Shared\MS\Win32\HwndSubclass.cs (1)
347Marshal.GetFunctionPointerForDelegate(DefWndProcStub));
Shared\MS\Win32\HwndWrapper.cs (2)
98throw new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error()); 129wc_d.cbSize = Marshal.SizeOf(typeof(NativeMethods.WNDCLASSEX_D));
Shared\MS\Win32\NativeMethodsCLR.cs (33)
2805return Marshal.SizeOf(typeof(MONITORINFOEX)); 3065return Marshal.SizeOf(typeof(TRACKMOUSEEVENT)); 3207return Marshal.SizeOf(typeof(NONCLIENTMETRICS)); 3226return Marshal.SizeOf(typeof(ICONMETRICS)); 3834return Marshal.SizeOf(typeof(MENUITEMINFO_T)); 3934return Marshal.SizeOf(typeof(OPENFILENAME_I)); 4523return Marshal.SizeOf(typeof(tagCONTROLINFO)); 4569Marshal.Release(this.data1.Value); 4702IntPtr mem = Marshal.AllocCoTaskMem(16); 4703Marshal.WriteInt16(mem, vt); 4704Marshal.WriteInt16(mem, 2, reserved1); 4705Marshal.WriteInt16(mem, 4, reserved2); 4706Marshal.WriteInt16(mem, 6, reserved3); 4707Marshal.WriteInt32(mem, 8, (int) data1.Value); 4708Marshal.WriteInt32(mem, 12, (int) data2.Value); 4730val = (IntPtr) Marshal.ReadByte(val); 4736val = (IntPtr) Marshal.ReadByte(val); 4743val = (IntPtr) Marshal.ReadInt16(val); 4749val = (IntPtr) Marshal.ReadInt16(val); 4756val = (IntPtr) Marshal.ReadInt32(val); 4763val = (IntPtr) Marshal.ReadInt32(val); 4770longVal = Marshal.ReadInt64(val); 4804return Marshal.PtrToStringUni(val); 4807return Marshal.PtrToStringAnsi(val); 4812return Marshal.GetObjectForIUnknown(val); 4868return Marshal.ReadIntPtr(value); 6146if (Marshal.SystemDefaultCharSize == 1) 6184IntPtr result = Marshal.AllocCoTaskMem(buffer.Length); 6185Marshal.Copy(buffer, 0, result, buffer.Length); 6208Marshal.Copy(ptr, buffer, 0, buffer.Length); 6248IntPtr result = Marshal.AllocCoTaskMem(buffer.Length * 2); 6249Marshal.Copy(buffer, 0, result, buffer.Length); 6271Marshal.Copy(ptr, buffer, 0, buffer.Length);
Shared\MS\Win32\NativeMethodsOther.cs (5)
116return Marshal.SizeOf(typeof(OSVERSIONINFOEX)); 201return Marshal.SizeOf(typeof(DOCHOSTUIINFO)); 627return Marshal.SizeOf(typeof(BITMAPINFO)); 676return Marshal.SizeOf(typeof(SECURITY_ATTRIBUTES)); 1244return Marshal.SizeOf(typeof(ANIMATIONINFO));
Shared\MS\Win32\SafeNativeMethodsCLR.cs (4)
87int win32Err = Marshal.GetLastWin32Error(); 293int win32Err = Marshal.GetLastWin32Error(); // Dance around FxCop 541var data = Marshal.ReadInt32(buffer); 600Marshal.ThrowExceptionForHR(hr);
Shared\MS\Win32\SafeNativeMethodsOther.cs (3)
183int win32Error = Marshal.GetLastWin32Error(); 251throw new Win32Exception(Marshal.GetLastWin32Error()); 264throw new Win32Exception(Marshal.GetLastWin32Error());
Shared\MS\Win32\UnsafeNativeMethodsCLR.cs (22)
67return Marshal.PtrToStructure(lparam, cls); 83return (T)Marshal.PtrToStructure(lParam, typeof(T)); 94Marshal.StructureToPtr(structure, ptr, fDeleteOld); 275int error = Marshal.GetLastWin32Error(); 598int error = Marshal.GetLastWin32Error(); 674int error = Marshal.GetLastWin32Error(); 694int win32Err = Marshal.GetLastWin32Error(); 832int win32Err = Marshal.GetLastWin32Error(); 850int win32Err = Marshal.GetLastWin32Error(); 1079int errorCode = Marshal.GetLastWin32Error(); 1096int errorCode = Marshal.GetLastWin32Error(); 1789int error = Marshal.GetLastWin32Error(); 1819int error = Marshal.GetLastWin32Error(); 1854int error = Marshal.GetLastWin32Error(); 1878int error = Marshal.GetLastWin32Error(); 1903int error = Marshal.GetLastWin32Error(); 1926int error = Marshal.GetLastWin32Error(); 4036VariantSize = (int)Marshal.OffsetOf(typeof(FindSizeOfVariant), "b"); 4053mem = Marshal.AllocCoTaskMem(len * VariantSize); 4057Marshal.GetNativeVariantForObject(args[i], (IntPtr)(a + VariantSize * i)); 4098Marshal.FreeCoTaskMem(mem); 4102Marshal.ThrowExceptionForHR(hr);
Shared\MS\Win32\UnsafeNativeMethodsOther.cs (12)
425var filterstruct = new CHANGEFILTERSTRUCT { cbSize = (uint)Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)) }; 709errorCode = Marshal.GetLastWin32Error(); 715errorCode = Marshal.GetLastWin32Error(); 742error = Marshal.GetLastWin32Error(); 749error = Marshal.GetLastWin32Error(); 779error = Marshal.GetLastWin32Error(); 786error = Marshal.GetLastWin32Error(); 817error = Marshal.GetLastWin32Error(); 823error = Marshal.GetLastWin32Error(); 965error = Marshal.GetLastWin32Error(); 1450if (Marshal.IsComObject(o)) 1452refCount = Marshal.ReleaseComObject(o);
WsatConfig (9)
Configuration\CertificateManager.cs (1)
56throw new WsatAdminException(WsatAdminErrorCode.CERT_STORE_ACCESS, SR.GetString(SR.ErrorAccessCertStore, Marshal.GetLastWin32Error()));
Configuration\ClusterRegistryConfigurationProvider.cs (1)
38int lastError = Marshal.GetLastWin32Error();
Configuration\SafeIUnknown.cs (1)
53Marshal.Release(ptr);
Configuration\SafeLocalAllocation.cs (1)
45System.Runtime.InteropServices.Marshal.Copy(
Configuration\Utilities.cs (1)
59SafeNativeMethods.WKSTA_INFO_100 workstationInfo = (SafeNativeMethods.WKSTA_INFO_100)Marshal.PtrToStructure(workstationPtr, typeof(SafeNativeMethods.WKSTA_INFO_100));
Configuration\WsatServiceAddress.cs (2)
58int configInformationLength = Marshal.SizeOf(configInformation); 121int configInformationSize = Marshal.SizeOf(configInformation);
Configuration\WsatServiceCertificate.cs (2)
66int configInformationLength = Marshal.SizeOf(sslConf); 143int configInformationLength = System.Runtime.InteropServices.Marshal.SizeOf(sslConf);
WsatUI (18)
Configuration\CertificateManager.cs (2)
56throw new WsatAdminException(WsatAdminErrorCode.CERT_STORE_ACCESS, SR.GetString(SR.ErrorAccessCertStore, Marshal.GetLastWin32Error())); 106throw new WsatAdminException(WsatAdminErrorCode.CERT_STORE_ACCESS, SR.GetString(SR.ErrorAccessCertStore, Marshal.GetLastWin32Error()));
Configuration\ClusterRegistryConfigurationProvider.cs (1)
38int lastError = Marshal.GetLastWin32Error();
Configuration\ETWSafeNativeMethods.cs (2)
138Head.Wnode.BufferSize = (uint)(Marshal.SizeOf(this)); 139Head.LogFileNameOffset = (uint)(Marshal.SizeOf(this) - Tail.LogFileName.Length * sizeof(char));
Configuration\SafeIUnknown.cs (1)
53Marshal.Release(ptr);
Configuration\SafeLocalAllocation.cs (3)
33IntPtr pointer = SafeNativeMethods.LocalAlloc(SafeNativeMethods.LMEM_ZEROINIT, Marshal.SizeOf(source)); 36Marshal.StructureToPtr( 45System.Runtime.InteropServices.Marshal.Copy(
Configuration\Utilities.cs (1)
59SafeNativeMethods.WKSTA_INFO_100 workstationInfo = (SafeNativeMethods.WKSTA_INFO_100)Marshal.PtrToStructure(workstationPtr, typeof(SafeNativeMethods.WKSTA_INFO_100));
Configuration\WsatServiceAddress.cs (2)
58int configInformationLength = Marshal.SizeOf(configInformation); 121int configInformationSize = Marshal.SizeOf(configInformation);
Configuration\WsatServiceCertificate.cs (2)
66int configInformationLength = Marshal.SizeOf(sslConf); 143int configInformationLength = System.Runtime.InteropServices.Marshal.SizeOf(sslConf);
MMCUI\WSATPropertySheet.cs (3)
58propSheet.dwSize = Marshal.SizeOf(typeof(PropSheetPage)); 173value = Marshal.PtrToStringUni(stg.unionmember); 299NMHDR header = (NMHDR)Marshal.PtrToStructure(longParameter, typeof(NMHDR));
MMCUI\WsatSecurityModel.cs (1)
125stringSecurityDescriptor = Marshal.PtrToStringUni(pszSD);