5871 references to Marshal
aspire (8)
Processes\DetachedProcessLauncher.Windows.cs (8)
34throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to open NUL device"); 40throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to set NUL handle inheritance"); 47var attrList = Marshal.AllocHGlobal(attrListSize); 52throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to initialize process thread attribute list"); 73throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to update process thread attribute list"); 79si.cb = Marshal.SizeOf<STARTUPINFOEX>(); 103throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to create detached process"); 132Marshal.FreeHGlobal(attrList);
csc (6)
src\roslyn\src\Compilers\Shared\BuildClient.cs (1)
363var commandLine = Marshal.PtrToStringUni(ptr)!;
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (5)
469/// <returns>Pointer to environment block that must be freed with <see cref="Marshal.FreeHGlobal"/></returns> 491return Marshal.StringToHGlobalUni(envBlock.ToString()); 572startInfo.cb = Marshal.SizeOf(startInfo); 614logger.LogError("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error()); 622Marshal.FreeHGlobal(environmentBlockPtr);
dotnet (7)
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.10.0-1.26374.120\contentFiles\cs\net11.0\BuildServerConnection.cs (5)
469/// <returns>Pointer to environment block that must be freed with <see cref="Marshal.FreeHGlobal"/></returns> 491return Marshal.StringToHGlobalUni(envBlock.ToString()); 572startInfo.cb = Marshal.SizeOf(startInfo); 614logger.LogError("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error()); 622Marshal.FreeHGlobal(environmentBlockPtr);
Telemetry\ExternalTelemetryProperties.cs (2)
94return Marshal.PtrToStringUTF8(gnu_get_libc_release()); 118return Marshal.PtrToStringUTF8(gnu_get_libc_version());
dotnet-aot (3)
SdkRootLocator.cs (1)
143return Marshal.PtrToStringUTF8(info.dli_fname);
src\sdk\src\Cli\dotnet\Telemetry\ExternalTelemetryProperties.cs (2)
94return Marshal.PtrToStringUTF8(gnu_get_libc_release()); 118return Marshal.PtrToStringUTF8(gnu_get_libc_version());
dotnet-svcutil-lib (1)
FrameworkFork\Microsoft.CodeDom\Compiler\TempFiles.cs (1)
228if (retryCount == 0 || Marshal.GetHRForException(e) != HR_ERROR_FILE_EXISTS)
dotnet-svcutil.xmlserializer (1)
Microsoft\Tools\ServiceModel\SvcUtil\InputModule.cs (1)
142&& Marshal.GetHRForException(ie) == ToolInputException.COR_E_ASSEMBLYEXPECTED)
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
ILCompiler.Compiler (6)
Compiler\Disassembler.cs (1)
110instruction = Marshal.PtrToStringUTF8(GetOutputBuffer());
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (5)
220/// <see cref="System.Runtime.InteropServices.Marshal.SizeOf(System.Type)"/> 224/// <see cref="System.Runtime.InteropServices.Marshal.OffsetOf(System.Type, string)"/> 228/// <see cref="System.Runtime.InteropServices.Marshal.PtrToStructure(nint, System.Type)"/> 232/// <see cref="System.Runtime.InteropServices.Marshal.DestroyStructure(nint, System.Type)"/> 236/// <see cref="System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(nint, System.Type)"/>
ILCompiler.Diagnostics (10)
_generated\0\Microsoft.DiaSymReader.ISymNGenWriter.cs (2)
59global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([18, 253, 130, 214, 222, 67, 28, 65, 129, 27, 190, 132, 4, 206, 161, 38]), (global::System.IntPtr)__this); 106global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([18, 253, 130, 214, 222, 67, 28, 65, 129, 27, 190, 132, 4, 206, 161, 38]), (global::System.IntPtr)__this);
_generated\1\Microsoft.DiaSymReader.ISymNGenWriter2.cs (7)
63global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this); 110global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this); 151global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this); 197global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this); 238global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this); 293global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this); 317global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([27, 229, 41, 176, 85, 76, 226, 79, 185, 147, 159, 123, 193, 241, 13, 180]), (global::System.IntPtr)__this);
PdbWriter.cs (1)
199Marshal.Release(pdbWriterInst);
ILCompiler.ReadyToRun (4)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (2)
4297Logger.LogMessage(Marshal.PtrToStringUTF8((IntPtr)szFile) + ":" + iLine); 4298Logger.LogMessage(Marshal.PtrToStringUTF8((IntPtr)szExpr));
src\runtime\src\coreclr\tools\Common\JitInterface\JitConfigProvider.cs (2)
184return s_instance.GetIntConfigValue(Marshal.PtrToStringUTF8((IntPtr)name), defaultValue); 190string result = s_instance.GetStringConfigValue(Marshal.PtrToStringUTF8((IntPtr)name));
ILCompiler.RyuJit (4)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (2)
4297Logger.LogMessage(Marshal.PtrToStringUTF8((IntPtr)szFile) + ":" + iLine); 4298Logger.LogMessage(Marshal.PtrToStringUTF8((IntPtr)szExpr));
src\runtime\src\coreclr\tools\Common\JitInterface\JitConfigProvider.cs (2)
184return s_instance.GetIntConfigValue(Marshal.PtrToStringUTF8((IntPtr)name), defaultValue); 190string result = s_instance.GetStringConfigValue(Marshal.PtrToStringUTF8((IntPtr)name));
illink (5)
ILLink.RoslynAnalyzer (5)
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (5)
220/// <see cref="System.Runtime.InteropServices.Marshal.SizeOf(System.Type)"/> 224/// <see cref="System.Runtime.InteropServices.Marshal.OffsetOf(System.Type, string)"/> 228/// <see cref="System.Runtime.InteropServices.Marshal.PtrToStructure(nint, System.Type)"/> 232/// <see cref="System.Runtime.InteropServices.Marshal.DestroyStructure(nint, System.Type)"/> 236/// <see cref="System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(nint, System.Type)"/>
libmscordaccore_universal (1)
Entrypoints.cs (1)
427Marshal.QueryInterface((nint)ccw, *pIID, out nint ptrToIface);
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\EndpointHtmlRenderer.Streaming.cs (1)
132var bufSizeRequired = count * Marshal.SizeOf<ComponentIdAndDepth>();
Microsoft.AspNetCore.Components.Server (1)
BlazorPack\SequenceOfT.cs (1)
23private static readonly int DefaultLengthFromArrayPool = 1 + (4095 / Marshal.SizeOf<T>());
Microsoft.AspNetCore.Cryptography.Internal (33)
_generated\0\LibraryImports.g.cs (27)
30global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 32__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 53global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 120global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 122__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 134global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 172global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 174__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 184global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 217global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 219__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 237global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 822global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 824__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 829global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 861global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 863__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 875global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 898global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 900__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 905global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 928global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 930__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 935global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 967global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 969__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 981global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
SafeHandles\LocalAllocHandle.cs (1)
21Marshal.FreeHGlobal(handle); // actually calls LocalFree
SafeHandles\SafeLibraryHandle.cs (3)
103return Marshal.GetDelegateForFunctionPointer<TDelegate>(pfnProc); 201int hr = Marshal.GetHRForLastWin32Error(); 202Marshal.ThrowExceptionForHR(hr);
SafeHandles\SecureLocalAllocHandle.cs (1)
46handle = Marshal.AllocHGlobal(cb); // actually calls LocalAlloc
UnsafeNativeMethods.cs (1)
478var lastError = Marshal.GetLastWin32Error();
Microsoft.AspNetCore.DataProtection (5)
Cng\DpapiSecretSerializerHelper.cs (5)
98var errorCode = Marshal.GetLastWin32Error(); 104Marshal.Copy((IntPtr)dataOut.pbData, retVal, 0, dataLength); 113Marshal.FreeHGlobal((IntPtr)dataOut.pbData); 241var errorCode = Marshal.GetLastWin32Error(); 254Marshal.FreeHGlobal((IntPtr)dataOut.pbData);
Microsoft.AspNetCore.InternalTesting (2)
DumpCollector\DumpCollector.Windows.cs (2)
25var err = Marshal.GetHRForLastWin32Error(); 26Marshal.ThrowExceptionForHR(err);
Microsoft.AspNetCore.Server.HttpSys (62)
_generated\10\Windows.Win32.HRESULT.g.cs (4)
65 /// <inheritdoc cref="Marshal.ThrowExceptionForHR(int, IntPtr)" /> 73 /// <seealso cref="Marshal.ThrowExceptionForHR(int, IntPtr)"/> 77 Marshal.ThrowExceptionForHR(this.Value, errorInfo); 87 return string.Format("{0} {1}", ToString(), global::System.Runtime.InteropServices.Marshal.GetPInvokeErrorMessage((int)this.Value));
_generated\78\Windows.Win32.PInvoke.HTTPAPI.dll.g.cs (1)
137 global::System.Runtime.InteropServices.Marshal.InitHandle(RequestQueueHandle, RequestQueueHandleLocal);
_generated\79\Windows.Win32.PInvoke.KERNEL32.dll.g.cs (1)
93 global::System.Runtime.InteropServices.Marshal.InitHandle(__resultSafeHandle, __result);
_generated\93\LibraryImports.g.cs (27)
31global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 33__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 43global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 78global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 80__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 90global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 121global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 123__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 132global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 167global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 169__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 179global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 210global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 212__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 221global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 256global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 258__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 268global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 303global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 305__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 315global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 381global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 383__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 393global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 426global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 428__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 446global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
AuthenticationManager.cs (1)
23Marshal.SizeOf<HTTP_SERVER_AUTHENTICATION_INFO>();
HttpSysException.cs (1)
17: base(Marshal.GetLastWin32Error())
NativeInterop\RequestQueue.cs (5)
58pSecurityDescriptor = Marshal.AllocHGlobal(securityDescriptorBytes.Length); 59Marshal.Copy(securityDescriptorBytes, 0, pSecurityDescriptor.Value, securityDescriptorBytes.Length); 65nLength = (uint)Marshal.SizeOf<SECURITY_ATTRIBUTES>(), 113throw new HttpSysException(Marshal.GetLastWin32Error()); 129Marshal.FreeHGlobal(pSecurityDescriptor.Value);
NativeInterop\SafeLibraryHandle.cs (3)
48return Marshal.GetDelegateForFunctionPointer<TDelegate>(pfnProc); 95int hr = Marshal.GetHRForLastWin32Error(); 96Marshal.ThrowExceptionForHR(hr);
NativeInterop\UrlGroup.cs (4)
18private static readonly int BindingInfoSize = Marshal.SizeOf<HTTP_BINDING_INFO>(); 19private static readonly int QosInfoSize = Marshal.SizeOf<HTTP_QOS_SETTING_INFO>(); 20private static readonly int RequestPropertyInfoSize = Marshal.SizeOf<HTTP_BINDING_INFO>(); 21private static readonly int ChannelBindInfoSize = Marshal.SizeOf<HTTP_CHANNEL_BIND_INFO>();
RequestProcessing\ClientCertLoader.cs (2)
130_memoryBlob = (HTTP_SSL_CLIENT_CERT_INFO*)Marshal.UnsafeAddrOfPinnedArrayElement(_backingBuffer, 0); 279Marshal.Copy((IntPtr)pClientCertInfo->pCertEncoded, certEncoded, 0, certEncoded.Length);
RequestProcessing\RequestContext.cs (1)
394return Marshal.PtrToStructure<HTTP_REQUEST_PROPERTY_SNI>((IntPtr)pBuffer);
RequestProcessing\RequestStreamAsyncResult.cs (1)
31_pinnedBuffer = (Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset));
RequestProcessing\ResponseStreamAsyncResult.cs (4)
80_dataChunks[currentChunk].Anonymous.FromMemory.pBuffer = (void*)Marshal.UnsafeAddrOfPinnedArrayElement(chunkHeaderBuffer.Array!, chunkHeaderBuffer.Offset); 84_dataChunks[currentChunk].Anonymous.FromMemory.pBuffer = (void*)Marshal.UnsafeAddrOfPinnedArrayElement(data.Array!, data.Offset); 152_dataChunks[0].Anonymous.FromMemory.pBuffer = (void*)Marshal.UnsafeAddrOfPinnedArrayElement(chunkHeaderBuffer.Array!, chunkHeaderBuffer.Offset); 219return (HTTP_DATA_CHUNK*)(Marshal.UnsafeAddrOfPinnedArrayElement(_dataChunks, 0));
src\aspnetcore\src\Shared\HttpSys\NativeInterop\CookedUrl.cs (4)
23return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pFullUrl.Value, _nativeCookedUrl.FullUrlLength / 2); 32return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pHost.Value, _nativeCookedUrl.HostLength / 2); 41return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pAbsPath.Value, _nativeCookedUrl.AbsPathLength / 2); 50return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pQueryString.Value, _nativeCookedUrl.QueryStringLength / 2);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (2)
278return Marshal.PtrToStringAnsi((IntPtr)NativeRequest->pRawUrl.Value, NativeRequest->RawUrlLength); 898Marshal.Copy((IntPtr)clientCert, certEncoded, 0, certEncoded.Length);
TimeoutManager.cs (1)
19Marshal.SizeOf<HTTP_TIMEOUT_LIMIT_INFO>();
Microsoft.AspNetCore.Server.IIS (26)
_generated\51\LibraryImports.g.cs (3)
16global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 18__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 23global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
_generated\8\Windows.Win32.HRESULT.g.cs (4)
65 /// <inheritdoc cref="Marshal.ThrowExceptionForHR(int, IntPtr)" /> 73 /// <seealso cref="Marshal.ThrowExceptionForHR(int, IntPtr)"/> 77 Marshal.ThrowExceptionForHR(this.Value, errorInfo); 87 return string.Format("{0} {1}", ToString(), global::System.Runtime.InteropServices.Marshal.GetPInvokeErrorMessage((int)this.Value));
Core\IISConfigurationData.cs (9)
41native.pwzFullApplicationPath = managed.pwzFullApplicationPath is null ? IntPtr.Zero : Marshal.StringToBSTR(managed.pwzFullApplicationPath); 42native.pwzVirtualApplicationPath = managed.pwzVirtualApplicationPath is null ? IntPtr.Zero : Marshal.StringToBSTR(managed.pwzVirtualApplicationPath); 46native.pwzBindings = managed.pwzBindings is null ? IntPtr.Zero : Marshal.StringToBSTR(managed.pwzBindings); 55Marshal.FreeBSTR(native.pwzFullApplicationPath); 59Marshal.FreeBSTR(native.pwzVirtualApplicationPath); 63Marshal.FreeBSTR(native.pwzBindings); 72pwzFullApplicationPath = native.pwzFullApplicationPath == IntPtr.Zero ? string.Empty : Marshal.PtrToStringBSTR(native.pwzFullApplicationPath), 73pwzVirtualApplicationPath = native.pwzVirtualApplicationPath == IntPtr.Zero ? string.Empty : Marshal.PtrToStringBSTR(native.pwzVirtualApplicationPath), 77pwzBindings = native.pwzBindings == IntPtr.Zero ? string.Empty : Marshal.PtrToStringBSTR(native.pwzBindings),
Core\IISHttpContext.cs (1)
486return statusCode == NativeMethods.HR_OK ? Marshal.PtrToStructure<HTTP_REQUEST_PROPERTY_SNI>((IntPtr)pBuffer) : default;
Core\IISHttpContext.FeatureCollection.cs (1)
398Marshal.Copy((IntPtr)NativeRequest->pSslInfo->pClientCertInfo->pCertEncoded, rawCertificateCopy, 0, rawCertificateCopy.Length);
Core\IO\AsyncIOOperation.cs (1)
104_exception = new ConnectionResetException("The client has disconnected", Marshal.GetExceptionForHR(hr)!);
NativeMethods.cs (1)
366throw Marshal.GetExceptionForHR(hr)!;
src\aspnetcore\src\Shared\HttpSys\NativeInterop\CookedUrl.cs (4)
23return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pFullUrl.Value, _nativeCookedUrl.FullUrlLength / 2); 32return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pHost.Value, _nativeCookedUrl.HostLength / 2); 41return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pAbsPath.Value, _nativeCookedUrl.AbsPathLength / 2); 50return Marshal.PtrToStringUni((IntPtr)_nativeCookedUrl.pQueryString.Value, _nativeCookedUrl.QueryStringLength / 2);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (2)
278return Marshal.PtrToStringAnsi((IntPtr)NativeRequest->pRawUrl.Value, NativeRequest->RawUrlLength); 898Marshal.Copy((IntPtr)clientCert, certEncoded, 0, certEncoded.Length);
Microsoft.AspNetCore.Server.IISIntegration (3)
_generated\0\LibraryImports.g.cs (3)
16global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 18__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 23global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\TlsConnectionFeature.cs (1)
223Marshal.Copy(binding.DangerousGetHandle(), buffer, 0, size);
Microsoft.Build.Framework (7)
_generated\0\LibraryImports.g.cs (3)
22global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 24__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 27global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
FileSystem\NativeWin32Exception.cs (1)
15/// associated recent error code (<see cref="System.Runtime.InteropServices.Marshal.GetLastWin32Error" />). The <see cref="Exception.Message" />
NativeMethods.cs (3)
847errorMessage = symbolicLinkCreated ? null : Marshal.GetLastWin32Error().ToString(); 993Marshal.ThrowExceptionForHR(errorCode); 1336return Marshal.PtrToStringUTF8(ptr);
Microsoft.Build.Tasks.CodeAnalysis (10)
src\roslyn\src\Compilers\Core\MSBuildTask\RCWForCurrentContext.cs (5)
40IntPtr iunknownPtr = Marshal.GetIUnknownForObject(rcw); 45objInCurrentCtx = Marshal.GetObjectForIUnknown(iunknownPtr); 49Marshal.Release(iunknownPtr); 116Marshal.IsComObject(_rcwForCurrentCtx)) 121Marshal.ReleaseComObject(_rcwForCurrentCtx);
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (5)
469/// <returns>Pointer to environment block that must be freed with <see cref="Marshal.FreeHGlobal"/></returns> 491return Marshal.StringToHGlobalUni(envBlock.ToString()); 572startInfo.cb = Marshal.SizeOf(startInfo); 614logger.LogError("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error()); 622Marshal.FreeHGlobal(environmentBlockPtr);
Microsoft.Build.Tasks.Core (14)
Copy.cs (1)
1031int code = Marshal.GetHRForException(e);
ManifestUtil\mansign2.cs (9)
444string issuerKeyHash = Marshal.PtrToStringUni(pIssuerKeyHash); 560string publicKeyToken = Marshal.PtrToStringUni(pPublicKeyToken); 832throw new CryptographicException(Marshal.GetLastWin32Error()); 836var timestampContext = Marshal.PtrToStructure<Win32.CRYPT_TIMESTAMP_CONTEXT>(ppTsContext); 838Marshal.Copy(timestampContext.pbEncoded, encodedBytes, 0, (int)timestampContext.cbEncoded); 910Marshal.Copy(timestampBlob.pbData, timestampSignature, 0, timestampSignature.Length); 1289_hash = Marshal.PtrToStringUni(signerInfo.pwszHash); 1293_description = Marshal.PtrToStringUni(signerInfo.pwszDescription); 1297_descriptionUrl = Marshal.PtrToStringUni(signerInfo.pwszDescriptionUrl);
ManifestUtil\SecurityUtil.cs (1)
764int exceptionHR = Marshal.GetHRForException(ex);
Move.cs (2)
269Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
NativeMethods.cs (1)
90errorMessage = hardLinkCreated ? null : log.FormatResourceString("Copy.NonWindowsLinkErrorMessage", "link()", Marshal.GetLastWin32Error());
Microsoft.CodeAnalysis (14)
DiaSymReader\SymUnmanagedFactory.cs (8)
123Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 132Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 138var creator = Marshal.GetDelegateForFunctionPointer<NativeFactory>(createAddress); 146Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 160lazyType = Marshal.GetTypeFromCLSID(clsid);
DiaSymReader\Utilities\ComMemoryStream.cs (2)
129Marshal.Copy(_chunks[chunkIndex], chunkOffset, (IntPtr)(pv + destinationIndex), bytesToCopy); 226Marshal.Copy((IntPtr)(pv + bytesWritten), _chunks[chunkIndex], chunkOffset, bytesToCopy);
DiaSymReader\Utilities\InteropUtilities.cs (1)
30Marshal.ThrowExceptionForHR(hr, s_ignoreIErrorInfo);
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (1)
370Marshal.GetNativeVariantForObject(value, new IntPtr(&variant));
InternalUtilities\ReadOnlyUnmanagedMemoryStream.cs (1)
38Marshal.Copy(_data + _position, buffer, offset, bytesRead);
StrongName\DesktopStrongNameProvider.cs (1)
218Marshal.Copy(keyBlob, pubKey, 0, keyBlobByteCount);
Microsoft.CodeAnalysis.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
Microsoft.CodeAnalysis.CodeStyle (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
Microsoft.CodeAnalysis.Features (3)
Debugging\DebugInformationReaderProvider.cs (2)
90if (symReader != null && Marshal.IsComObject(symReader)) 95Marshal.ReleaseComObject(symReader);
EditAndContinue\EditAndContinueDebugInfoReader.cs (1)
223Marshal.ThrowExceptionForHR(hr);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
282Marshal.Copy(new IntPtr(contentPtr), content, 0, length);
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
Microsoft.CodeAnalysis.Scripting (15)
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\ClrGlobalAssemblyCache.cs (4)
152Exception e = Marshal.GetExceptionForHR(hr); 182Marshal.ThrowExceptionForHR(hr); 241cbAssemblyInfo = (uint)Marshal.SizeOf<ASSEMBLY_INFO>(), 252var result = Marshal.PtrToStringUni((IntPtr)info.pszCurrentAssemblyPathBuf, (int)info.cchBuf - 1);
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs (8)
142throw Marshal.GetExceptionForHR(hr); 151throw Marshal.GetExceptionForHR(hr); 154return Marshal.PtrToStringUni((IntPtr)p, (int)characterCountIncludingTerminator - 1); 171throw Marshal.GetExceptionForHR(hr); 180throw Marshal.GetExceptionForHR(hr); 197return Marshal.PtrToStringUni((IntPtr)p, (data.Length / 2) - 1); 293throw Marshal.GetExceptionForHR(hr); 437Marshal.ThrowExceptionForHR(CreateAssemblyNameObject(out result, null, 0, IntPtr.Zero));
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\GlobalAssemblyCacheLocation.cs (3)
53throw Marshal.GetExceptionForHR(hr); 62throw Marshal.GetExceptionForHR(hr); 65return Marshal.PtrToStringUni((IntPtr)p);
Microsoft.CodeAnalysis.Workspaces (4)
Serialization\SerializerService_Reference.cs (2)
490var unmanagedMemory = Marshal.AllocHGlobal(length); 501() => Marshal.FreeHGlobal(unmanagedMemory));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
TemporaryStorage\TemporaryStorageService.DirectMemoryAccessStreamReader.cs (1)
69Marshal.Copy((IntPtr)_position, buffer, index, count);
Microsoft.CodeAnalysis.Workspaces.MSBuild (3)
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\GlobalAssemblyCacheLocation.cs (3)
53throw Marshal.GetExceptionForHR(hr); 62throw Marshal.GetExceptionForHR(hr); 65return Marshal.PtrToStringUni((IntPtr)p);
Microsoft.CodeAnalysis.Workspaces.MSBuild.Contracts (1)
MonoMSBuildDiscovery.cs (1)
61var result = Marshal.PtrToStringAnsi(ptr); // uses UTF8 on Unix
Microsoft.CSharp (58)
Microsoft\CSharp\RuntimeBinder\BinderHelper.cs (1)
181return obj != null && Marshal.IsComObject(obj);
Microsoft\CSharp\RuntimeBinder\ComInterop\ComBinder.cs (1)
24return value != null && Marshal.IsComObject(value);
Microsoft\CSharp\RuntimeBinder\ComInterop\ComEventSinksContainer.cs (3)
27object data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey); 35data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey); 42if (!Marshal.SetComObjectData(rcw, s_comObjectEventSinksKey, comEventSinks))
Microsoft\CSharp\RuntimeBinder\ComInterop\ComInvokeBinder.cs (2)
501typeof(Marshal).GetMethod(nameof(Marshal.GetIDispatchForObject)),
Microsoft\CSharp\RuntimeBinder\ComInterop\ComObject.cs (3)
40object data = Marshal.GetComObjectData(rcw, s_comObjectInfoKey); 48data = Marshal.GetComObjectData(rcw, s_comObjectInfoKey); 55if (!Marshal.SetComObjectData(rcw, s_comObjectInfoKey, comObjectInfo))
Microsoft\CSharp\RuntimeBinder\ComInterop\ComRuntimeHelpers.cs (11)
81Marshal.ThrowExceptionForHR(hresult); 130Marshal.ThrowExceptionForHR(hresult); 149Marshal.ThrowExceptionForHR(hresult); 154Marshal.ThrowExceptionForHR(ComHresults.E_FAIL); 160typeInfo = Marshal.GetObjectForIUnknown(typeInfoPtr) as ComTypes.ITypeInfo; 164Marshal.Release(typeInfoPtr); 259variant = ComVariant.CreateRaw(VarEnum.VT_DISPATCH, obj is not null ? Marshal.GetIDispatchForObject(obj) : 0); 263Marshal.GetNativeVariantForObject(obj, ConvertVariantByrefToPtr(ref variant)); 270return Marshal.GetObjectForNativeVariant(ptr); 333Marshal.ThrowExceptionForHR(hresult); 344return Marshal.UnsafeAddrOfPinnedArrayElement(keywordArgDispIds, 0);
Microsoft\CSharp\RuntimeBinder\ComInterop\ComTypeEnumDesc.cs (2)
39varDesc = Marshal.PtrToStructure<ComTypes.VARDESC>(p); 43memberValues[i] = Marshal.GetObjectForNativeVariant(varDesc.desc.lpvarValue);
Microsoft\CSharp\RuntimeBinder\ComInterop\DispatchArgBuilder.cs (4)
48typeof(Marshal).GetMethod(nameof(System.Runtime.InteropServices.Marshal.GetIDispatchForObject)), 61typeof(Marshal).GetMethod(nameof(System.Runtime.InteropServices.Marshal.GetObjectForIUnknown)),
Microsoft\CSharp\RuntimeBinder\ComInterop\DynamicVariantExtensions.cs (3)
58case TypeCode.Object: variant = ComVariant.CreateRaw(VarEnum.VT_UNKNOWN, Marshal.GetIUnknownForObject(value)); break; 382variant = ComVariant.CreateRaw(VarEnum.VT_UNKNOWN, value is null ? IntPtr.Zero : Marshal.GetIUnknownForObject(value)); 387variant = ComVariant.CreateRaw(VarEnum.VT_DISPATCH, value is null ? IntPtr.Zero : Marshal.GetIDispatchForObject(value));
Microsoft\CSharp\RuntimeBinder\ComInterop\ExcepInfo.cs (5)
32Debug.Assert(Marshal.SizeOf<ExcepInfo>() == Marshal.SizeOf<ComTypes.EXCEPINFO>()); 43string result = Marshal.PtrToStringBSTR(bstr); 44Marshal.FreeBSTR(bstr); 65Exception exception = Marshal.GetExceptionForHR(errorCode) ?? new COMException(null, errorCode);
Microsoft\CSharp\RuntimeBinder\ComInterop\IDispatchComObject.cs (2)
484return Marshal.GetObjectForIUnknown(typeInfoPtr) as ComTypes.ITypeInfo; 491Marshal.Release(typeInfoPtr);
Microsoft\CSharp\RuntimeBinder\ComInterop\StringArgBuilder.cs (4)
47typeof(Marshal).GetMethod(nameof(System.Runtime.InteropServices.Marshal.StringToBSTR)), 59typeof(Marshal).GetMethod(nameof(System.Runtime.InteropServices.Marshal.PtrToStringBSTR)),
Microsoft\CSharp\RuntimeBinder\ComInterop\UnknownArgBuilder.cs (4)
48typeof(Marshal).GetMethod(nameof(System.Runtime.InteropServices.Marshal.GetIUnknownForObject)), 61typeof(Marshal).GetMethod(nameof(System.Runtime.InteropServices.Marshal.GetObjectForIUnknown)),
Microsoft\CSharp\RuntimeBinder\ComInterop\VariantBuilder.cs (2)
115return Expression.Call(typeof(Marshal).GetMethod(nameof(Marshal.FreeBSTR)), TempVariable);
src\runtime\src\libraries\Common\src\System\Runtime\InteropServices\BuiltInVariantExtensions.cs (8)
40Marshal.GetNativeVariantForObject(value, (IntPtr)(void*)&vArray); 102variant.GetByRefDataRef<IntPtr>() = Marshal.GetIUnknownForObject(value); 106variant.GetByRefDataRef<IntPtr>() = Marshal.GetIDispatchForObject(value); 110variant.GetByRefDataRef<IntPtr>() = Marshal.StringToBSTR((string)value); 122Marshal.GetNativeVariantForObject(value, variant.GetRawDataRef<IntPtr>()); 157VarEnum.VT_BSTR => variant.GetRawDataRef<nint>() is 0 ? null : Marshal.PtrToStringBSTR(variant.GetRawDataRef<nint>()), 158VarEnum.VT_UNKNOWN or VarEnum.VT_DISPATCH => variant.GetRawDataRef<nint>() is 0 ? null : Marshal.GetObjectForIUnknown(variant.GetRawDataRef<nint>()), 167return Marshal.GetObjectForNativeVariant((nint)pVariant);
src\runtime\src\libraries\Common\src\System\Runtime\InteropServices\ComEventsSink.cs (3)
216Marshal.GetNativeVariantForObject(result, pVarResult); 238ppv = Marshal.GetComInterfaceForObject(this, typeof(IDispatch), CustomQueryInterfaceMode.Ignore); 268Marshal.ReleaseComObject(_connectionPoint);
Microsoft.Diagnostics.DataContractReader (1)
ContractDescriptorTarget.cs (1)
565throw Marshal.GetExceptionForHR(hr) ?? new InvalidOperationException($"Failed to allocate {size} bytes in the target process (HRESULT: 0x{hr:x8}).");
Microsoft.Diagnostics.DataContractReader.Contracts (40)
Contracts\Debugger\Debugger_1.cs (1)
219throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_NOTREADY)!;
Contracts\EcmaMetadata_1.cs (1)
475throw Marshal.GetExceptionForHR(CorDbgHResults.CLDB_E_FILE_CORRUPT)!;
Contracts\StackWalk\Context\ARM64\ARM64Unwinder.cs (10)
922TargetPointer sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.X0)); 929sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.V)); 940sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Cpsr)); 943sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Fp)); 946sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Lr)); 949sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Sp)); 952sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Pc)); 955sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Fpcr)); 958sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.Fpsr)); 964sourceAddress = startingSp + (uint)Marshal.OffsetOf<ARM64Context>(nameof(ARM64Context.ContextFlags));
Contracts\StackWalk\Context\LoongArch64\LoongArch64Unwinder.cs (14)
591TargetPointer sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.R0)); 594sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Ra)); 597sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Tp)); 600sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Sp)); 603sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.A0)); 620sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.T0)); 639sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.X0)); 642sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Fp)); 645sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.S0)); 667sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Pc)); 670sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.F)); 677sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Fcc)); 680sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.Fcsr)); 686sourceAddress = startingSp + (uint)Marshal.OffsetOf<LoongArch64Context>(nameof(LoongArch64Context.ContextFlags));
Contracts\StackWalk\Context\RISCV64\RISCV64Unwinder.cs (14)
605TargetPointer sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Ra)); 608sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Sp)); 611sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Gp)); 614sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Tp)); 617sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.T0)); 624sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Fp)); 627sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.S1)); 630sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.A0)); 647sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.S2)); 668sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.T3)); 680sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Pc)); 683sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.F)); 690sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.Fcsr)); 696sourceAddress = startingSp + (uint)Marshal.OffsetOf<RISCV64Context>(nameof(RISCV64Context.ContextFlags));
Microsoft.Diagnostics.DataContractReader.Legacy (88)
_generated\42\Microsoft.Diagnostics.DataContractReader.Legacy.ISOSDacInterface9.cs (1)
49global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([216, 66, 202, 78, 123, 126, 138, 76, 161, 22, 123, 251, 246, 146, 146, 103]), (global::System.IntPtr)__this);
ClrDataFrame.cs (6)
144throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 198throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 203throw Marshal.GetExceptionForHR(HResults.E_INVALIDARG)!; 320throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 327throw Marshal.GetExceptionForHR(HResults.E_INVALIDARG)!; 552throw Marshal.GetExceptionForHR(HResults.E_FAIL)!;
ClrDataMethodInstance.cs (2)
212throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 308throw Marshal.GetExceptionForHR(HResults.E_FAIL)!;
ClrDataModule.cs (4)
50Marshal.Release(_legacyModulePointer); 94if (_legacyModulePointer != 0 && Marshal.QueryInterface(_legacyModulePointer, iidMetaDataImport, out nint ppMdi) >= 0) 97Marshal.Release(ppMdi); 471throw Marshal.GetExceptionForHR(E_INSUFFICIENT_BUFFER)!;
ClrDataTask.cs (2)
112throw Marshal.GetExceptionForHR(/*E_NOINTERFACE*/ HResults.COR_E_INVALIDCAST)!; 154throw Marshal.GetExceptionForHR(/*E_NOINTERFACE*/ HResults.COR_E_INVALIDCAST)!;
ClrDataValue.cs (1)
159throw Marshal.GetExceptionForHR(/*ERROR_BUFFER_OVERFLOW*/ CorDbgHResults.ERROR_BUFFER_OVERFLOW)!;
Dbi\DacDbiImpl.cs (39)
371throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_MISSING_METADATA)!; 768throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_NOTREADY)!; 799throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_NOTREADY)!; 843throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 849throw Marshal.GetExceptionForHR(HResults.E_INVALIDARG)!; 873throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 1000throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_BAD_THREAD_STATE)!; 1124throw Marshal.GetExceptionForHR(hr)!; 2340throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_TARGET_INCONSISTENT)!; 2377throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_FUNCTION_NOT_IL)!; 2386throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_FUNCTION_NOT_IL)!; 2389throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_FUNCTION_NOT_IL)!; 2882throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 2885throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 2916throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 2922throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 2976throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3009throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3021throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3044?? throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3054?? throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3072?? throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3085?? throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3318throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_ENC_HANGING_FIELD)!; 3334throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_ENC_HANGING_FIELD)!; 3399throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 3523throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_TARGET_INCONSISTENT)!; 3794throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_TARGET_INCONSISTENT)!; 4164throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 4750throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 4901throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 4958throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_CLASS_NOT_LOADED)!; 4979throw Marshal.GetExceptionForHR(HResults.E_INVALIDARG)!; 5128throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_NOTREADY)!; 5157throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_NOTREADY)!; 5418throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_UNSUPPORTED_DELEGATE)!; 5426throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_UNSUPPORTED_DELEGATE)!; 5476throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_UNSUPPORTED_DELEGATE)!; 5481throw Marshal.GetExceptionForHR(CorDbgHResults.CORDBG_E_UNSUPPORTED_DELEGATE)!;
Dbi\DacDbiImpl.NativeCodeInfo.cs (1)
23throw Marshal.GetExceptionForHR(HResults.E_FAIL)!;
Dbi\Helpers\StackWalkHandleData.cs (1)
39throw Marshal.GetExceptionForHR(HResults.E_FAIL)!;
MetaDataImportImpl.cs (4)
1410throw Marshal.GetExceptionForHR(CldbHResults.CLDB_E_FILE_CORRUPT)!; 1417throw Marshal.GetExceptionForHR(CldbHResults.CLDB_E_FILE_CORRUPT)!; 1421throw Marshal.GetExceptionForHR(CldbHResults.CLDB_E_FILE_CORRUPT)!; 1663throw Marshal.GetExceptionForHR(CldbHResults.CLDB_E_RECORD_NOTFOUND)!;
NativeStringHolder.cs (8)
36IntPtr fnPtr = Marshal.GetFunctionPointerForDelegate(assignCopy); 39_vtablePtr = Marshal.AllocHGlobal(IntPtr.Size); 40Marshal.WriteIntPtr(_vtablePtr, fnPtr); 43_objectPtr = Marshal.AllocHGlobal(IntPtr.Size); 44Marshal.WriteIntPtr(_objectPtr, _vtablePtr); 54Value = Marshal.PtrToStringUni(psz); 62Marshal.FreeHGlobal(_objectPtr); 63Marshal.FreeHGlobal(_vtablePtr);
SOSDacImpl.cs (19)
724throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 1897throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 1942throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 2102throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 2208throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 2727throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 3483throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 3534throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 4678throw Marshal.GetExceptionForHR(E_ABORT)!; 5049throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 5091throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 5248throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 5739throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 5808throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 5870throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 5939throw Marshal.GetExceptionForHR(HResults.E_FAIL)!; 6491entries[i] = (heapTypes[i], Marshal.StringToHGlobalAnsi(heapTypes[i].ToString())); 6560string cdacName = Marshal.PtrToStringAnsi((nint)ppNames[i])!; 6561string dacName = Marshal.PtrToStringAnsi((nint)ppNamesLocal[i])!;
Microsoft.DiaSymReader (156)
_generated\32\Microsoft.DiaSymReader.IUnsafeComStream.cs (11)
68global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 107global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 146global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 185global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 224global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 263global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 302global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 341global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 380global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 421global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this); 468global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([12, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70]), (global::System.IntPtr)__this);
_generated\33\Microsoft.DiaSymReader.ISymUnmanagedAsyncMethodPropertiesWriter.cs (3)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([116, 55, 7, 252, 57, 23, 50, 66, 189, 86, 160, 39, 41, 75, 236, 21]), (global::System.IntPtr)__this); 91global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([116, 55, 7, 252, 57, 23, 50, 66, 189, 86, 160, 39, 41, 75, 236, 21]), (global::System.IntPtr)__this); 134global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([116, 55, 7, 252, 57, 23, 50, 66, 189, 86, 160, 39, 41, 75, 236, 21]), (global::System.IntPtr)__this);
_generated\35\Microsoft.DiaSymReader.ISymUnmanagedDocumentWriter.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([235, 175, 31, 176, 80, 196, 77, 58, 190, 236, 180, 206, 236, 1, 224, 6]), (global::System.IntPtr)__this); 100global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([235, 175, 31, 176, 80, 196, 77, 58, 190, 236, 180, 206, 236, 1, 224, 6]), (global::System.IntPtr)__this);
_generated\36\Microsoft.DiaSymReader.IPdbWriter.cs (5)
57global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([30, 238, 236, 152, 45, 117, 211, 17, 141, 86, 0, 192, 79, 104, 11, 43]), (global::System.IntPtr)__this); 102global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([30, 238, 236, 152, 45, 117, 211, 17, 141, 86, 0, 192, 79, 104, 11, 43]), (global::System.IntPtr)__this); 147global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([30, 238, 236, 152, 45, 117, 211, 17, 141, 86, 0, 192, 79, 104, 11, 43]), (global::System.IntPtr)__this); 192global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([30, 238, 236, 152, 45, 117, 211, 17, 141, 86, 0, 192, 79, 104, 11, 43]), (global::System.IntPtr)__this); 241global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([30, 238, 236, 152, 45, 117, 211, 17, 141, 86, 0, 192, 79, 104, 11, 43]), (global::System.IntPtr)__this);
_generated\37\Microsoft.DiaSymReader.ISymUnmanagedWriter5.cs (33)
122global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 193global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 232global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 271global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 311global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 355global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 394global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 435global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 478global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 521global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 564global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 605global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 646global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 689global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 730global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 771global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 819global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 880global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 938global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 996global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1074global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1125global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1188global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1237global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1278global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1321global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1364global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1405global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1444global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1487global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1534global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1573global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this); 1617global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([13, 120, 247, 220, 233, 189, 223, 69, 172, 254, 33, 115, 26, 50, 0, 12]), (global::System.IntPtr)__this);
_generated\38\Microsoft.DiaSymReader.ISymUnmanagedWriter8.cs (38)
96global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 146global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 185global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 224global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 263global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 312global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 344global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 362global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 380global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 399global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 418global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 436global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 456global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 476global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 496global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 516global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 534global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 554global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 574global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 592global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 612global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 637global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 673global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 702global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 731global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 755global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 785global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 817global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 841global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 861global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 881global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 901global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 919global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 937global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 959global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 977global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 995global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this); 1018global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([59, 47, 165, 91, 248, 107, 252, 64, 180, 118, 211, 156, 82, 155, 51, 30]), (global::System.IntPtr)__this);
_generated\6\Microsoft.DiaSymReader.IMetadataEmit.cs (49)
144global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 183global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 222global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 261global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 300global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 339global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 378global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 417global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 456global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 495global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 534global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 573global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 612global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 651global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 690global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 729global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 768global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 807global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 846global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 885global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 925global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 969global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1008global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1047global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1086global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1125global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1164global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1203global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1242global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1281global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1320global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1359global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1398global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1437global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1476global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1515global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1554global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1593global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1632global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1671global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1710global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1749global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1788global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1827global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1866global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1905global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1944global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 1983global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this); 2022global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([76, 238, 63, 186, 185, 236, 65, 78, 131, 183, 24, 63, 164, 28, 216, 89]), (global::System.IntPtr)__this);
_generated\8\Microsoft.DiaSymReader.IMetadataImportProvider.cs (1)
53global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([147, 162, 243, 237, 13, 161, 74, 79, 166, 9, 56, 213, 237, 227, 95, 137]), (global::System.IntPtr)__this);
Extensions\SymUnmanagedExtensions.Document.cs (2)
100Marshal.ThrowExceptionForHR(document.GetSourceLength(out int length)); 112Marshal.ThrowExceptionForHR(document.GetSourceRange(0, 0, int.MaxValue, int.MaxValue, length, out int bytesRead, blob));
Reader\ISymUnmanagedSourceServerModule.cs (1)
22/// Caller must free using <see cref="Marshal.FreeCoTaskMem(IntPtr)"/>.
SymUnmanagedFactory.cs (7)
138Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 148Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 167Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 178Marshal.ThrowExceptionForHR(hr);
Utilities\ComMemoryStream.cs (2)
135Marshal.Copy(_chunks[chunkIndex], chunkOffset, (IntPtr)(pv + destinationIndex), bytesToCopy); 230Marshal.Copy((IntPtr)(pv + bytesWritten), _chunks[chunkIndex], chunkOffset, bytesToCopy);
Utilities\ComStreamWrapper.cs (1)
226Marshal.Release(unmanaged);
Utilities\InteropUtilities.cs (1)
23Marshal.ThrowExceptionForHR(hr, s_ignoreIErrorInfo);
Microsoft.DotNet.Build.Tasks.Feed (9)
_generated\0\LibraryImports.g.cs (6)
17global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 19__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 24global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 46global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 48__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 51global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\common\NativeMethods.cs (3)
25errorMessage = hardLinkCreated ? null : Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()).Message; 30errorMessage = hardLinkCreated ? null : $"The link() library call failed with the following error code: {Marshal.GetLastWin32Error()}.";
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\GetPkgDefAssemblyDependencyGuid.cs (1)
57int targetBlockSize = Marshal.SizeOf(typeof(Guid));
Microsoft.DotNet.HotReload.Watch (2)
Utilities\ProcessUtilities.cs (2)
30var error = Marshal.GetLastPInvokeError(); 32return $"{Marshal.GetPInvokeErrorMessage(error)} (code {error})";
Microsoft.DotNet.NativeWrapper (6)
_generated\0\LibraryImports.g.cs (3)
18__result_native = result != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(result) : default; 67__result_native = result != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(result) : default; 109__result_native = result != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(result) : default;
NETCoreSdkResolverNativeWrapper.cs (1)
31nint errorWriter = Marshal.GetFunctionPointerForDelegate(swallowErrors);
PlatformString.cs (2)
32return Marshal.PtrToStringUTF8(Value) ?? string.Empty; 36return Marshal.PtrToStringUni(Value) ?? string.Empty;
Microsoft.Extensions.Diagnostics.ResourceMonitoring (18)
Windows\Interop\JobObjectInfo.cs (2)
318Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
Windows\Interop\MemoryInfo.cs (2)
25Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
Windows\Network\WindowsTcpStateInfo.cs (14)
120Marshal.FreeHGlobal(tcpTable); 121tcpTable = Marshal.AllocHGlobal((int)size); 126Marshal.FreeHGlobal(tcpTable); 133Marshal.FreeHGlobal(tcpTable); 155var rawTcpTable = Marshal.PtrToStructure<MIB_TCPTABLE>(tcpTable); 158var offset = Marshal.OffsetOf<MIB_TCPTABLE>(nameof(MIB_TCPTABLE.Table)).ToInt32(); 162var row = Marshal.PtrToStructure<MIB_TCPROW>(rowPtr); 163rowPtr = IntPtr.Add(rowPtr, Marshal.SizeOf<MIB_TCPROW>()); 173Marshal.FreeHGlobal(tcpTable); 180var rawtcpTable = Marshal.PtrToStructure<MIB_TCP6TABLE>(tcpTable); 183var offset = Marshal.OffsetOf<MIB_TCP6TABLE>(nameof(MIB_TCP6TABLE.Table)).ToInt32(); 187var row = Marshal.PtrToStructure<MIB_TCP6ROW>(rowPtr); 188rowPtr = IntPtr.Add(rowPtr, Marshal.SizeOf<MIB_TCP6ROW>()); 198Marshal.FreeHGlobal(tcpTable);
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (14)
Windows\Tcp6TableInfoTests.cs (8)
123Marshal.StructureToPtr(fakeTcp6Table, pTcp6Table, false); 124var offset = Marshal.OffsetOf<MIB_TCP6TABLE>(nameof(MIB_TCP6TABLE.Table)).ToInt32(); 129Marshal.StructureToPtr(fakeRows[i], fakePtr, false); 130fakePtr = IntPtr.Add(fakePtr, Marshal.SizeOf<MIB_TCP6ROW>()); 215Marshal.StructureToPtr(fakeTcp6Table, pTcp6Table, false); 216var offset = Marshal.OffsetOf<MIB_TCP6TABLE>(nameof(MIB_TCP6TABLE.Table)).ToInt32(); 221Marshal.StructureToPtr(fakeRows[i], fakePtr, false); 222fakePtr = IntPtr.Add(fakePtr, Marshal.SizeOf<MIB_TCP6ROW>());
Windows\TcpTableInfoTests.cs (6)
89Marshal.StructureToPtr(fakeTcpTable, pTcpTable, false); 90var offset = Marshal.OffsetOf<MIB_TCPTABLE>(nameof(MIB_TCPTABLE.Table)).ToInt32(); 95Marshal.StructureToPtr(fakeRows[i], fakePtr, false); 158Marshal.StructureToPtr(fakeTcpTable, pTcpTable, false); 159var offset = Marshal.OffsetOf<MIB_TCPTABLE>(nameof(MIB_TCPTABLE.Table)).ToInt32(); 164Marshal.StructureToPtr(fakeRows[i], fakePtr, false);
Microsoft.Extensions.DotNetDeltaApplier (2)
src\sdk\src\Dotnet.Watch\HotReloadAgent.Host\StartupHook.cs (2)
154var error = Marshal.GetLastPInvokeError(); 156return $"{Marshal.GetPInvokeErrorMessage(error)} (code {error})";
Microsoft.Extensions.Hosting.WindowsServices (12)
_generated\0\LibraryImports.g.cs (12)
16global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 18__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 23global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 46global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 48__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 51global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 75global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 77__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 82global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 106global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 108__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 113global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Microsoft.Extensions.Logging.Console (6)
_generated\1\LibraryImports.g.cs (6)
19global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 21__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 26global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 50global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 52__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 57global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Microsoft.Maui.Resizetizer (1)
SkiaSharpTools.cs (1)
223 var code = Marshal.GetHRForException(ex);
Microsoft.ML.Core (3)
Data\ModelHeader.cs (3)
109Contracts.Assert(Marshal.SizeOf(typeof(ModelHeader)) == Size); 311Marshal.Copy((IntPtr)pheader, bytes, 0, Size); 378Marshal.Copy(bytes, 0, (IntPtr)pheader, Size);
Microsoft.ML.Data (10)
Data\Conversion.cs (2)
442if (Marshal.SizeOf(keySrc.RawType) > Marshal.SizeOf(typeDst.RawType))
DataLoadSave\Binary\BinaryLoader.cs (1)
1041Marshal.Copy(headerBytes, 0, (IntPtr)(&header), Header.HeaderSize);
DataLoadSave\Binary\BinarySaver.cs (2)
557Marshal.Copy(new IntPtr(&header), headerBytes, 0, Marshal.SizeOf(typeof(Header)));
DataLoadSave\Binary\Codecs.cs (2)
213Marshal.Copy(ptr, _buffer, 0, sublen); 274Marshal.Copy(_buffer, 0, ptr, sublen);
DataLoadSave\Transpose\TransposeLoader.cs (1)
569Marshal.Copy(headerBytes, 0, (IntPtr)(&header), Header.HeaderSize);
DataLoadSave\Transpose\TransposeSaver.cs (2)
179Marshal.Copy(new IntPtr(&header), headerBytes, 0, Marshal.SizeOf(typeof(Header)));
Microsoft.ML.FastTree (1)
Utils\BufferPoolManager.cs (1)
81if (buffer != null && buffer.Length * Marshal.SizeOf(typeof(T)) >= MinBufferSizeInBytes)
Microsoft.ML.LightGbm (2)
WrappedLightGbmInterface.cs (2)
242string mes = Marshal.PtrToStringAnsi(charPtr); 291return Marshal.PtrToStringAnsi(src);
Microsoft.ML.Mkl.Components (1)
SymSgdClassificationTrainer.cs (1)
388_sizeofT = Marshal.SizeOf(typeof(T));
Microsoft.ML.Recommender (2)
SafeTrainingAndModelBuffer.cs (2)
398Marshal.Copy((IntPtr)_pMFModel->P, p, 0, p.Length); 399Marshal.Copy((IntPtr)_pMFModel->Q, q, 0, q.Length);
Microsoft.ML.TestFrameworkCommon (2)
Attributes\AttributeHelpers.cs (1)
23version = Version.Parse(Marshal.PtrToStringUTF8(gnu_get_libc_version()));
Utility\NativeLibrary.cs (1)
144return Marshal.GetDelegateForFunctionPointer<T>(functionPtr);
Microsoft.ML.TimeSeries (1)
FftUtils.cs (1)
208throw Contracts.Except(Marshal.PtrToStringAnsi(ErrorMessage(status)));
Microsoft.ML.Vision (3)
ImageClassificationTrainer.cs (3)
1546Marshal.FreeHGlobal(data); 1551int sizeOfTString = Marshal.SizeOf<TF_TString>(); 1554IntPtr tstringPtr = Marshal.AllocHGlobal(sizeOfTString);
Microsoft.NET.Sdk.Razor.Tasks (2)
src\sdk\src\RazorSdk\Tool\ServerProtocol\ServerConnection.cs (2)
347startInfo.cb = Marshal.SizeOf(startInfo); 379ServerLogger.Log("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error());
Microsoft.Private.Windows.Core (28)
_generated\10\Windows.Win32.BSTR.g.cs (1)
50 public override string ToString() => this.Value != null ? Marshal.PtrToStringBSTR(new IntPtr(this.Value)) : null;
_generated\119\Windows.Win32.HRESULT.g.cs (3)
65 /// <inheritdoc cref="Marshal.ThrowExceptionForHR(int, IntPtr)" /> 73 /// <seealso cref="Marshal.ThrowExceptionForHR(int, IntPtr)"/> 77 Marshal.ThrowExceptionForHR(this.Value, errorInfo);
System\Private\Windows\Ole\ClipboardCore.cs (1)
206originalObject = Marshal.GetObjectForIUnknown((nint)unknown.Value);
System\Private\Windows\Ole\Composition.NativeToManagedAdapter.cs (1)
168Marshal.Copy((nint)buffer, bytes, 0, size);
System\Private\Windows\Ole\DragDropFormat.cs (1)
85Marshal.AddRef(mediumSource.hGlobal);
System\Private\Windows\Ole\DragDropHelper.cs (4)
216throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException); 223throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException); 374throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException); 381throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException);
Windows\Win32\Foundation\BSTR.cs (2)
10public BSTR(string? value) : this((char*)Marshal.StringToBSTR(value)) 18Marshal.FreeBSTR((nint)Value);
Windows\Win32\Foundation\PWSTR.cs (1)
16Marshal.FreeCoTaskMem((IntPtr)Value);
Windows\Win32\PInvokeCore.EnumChildWindows.cs (1)
14(delegate* unmanaged[Stdcall]<HWND, LPARAM, BOOL>)Marshal.GetFunctionPointerForDelegate(s_enumChildWindowsNativeCallback);
Windows\Win32\PInvokeCore.EnumDisplayMonitors.cs (1)
14(delegate* unmanaged[Stdcall]<HMONITOR, HDC, RECT*, LPARAM, BOOL>)Marshal.GetFunctionPointerForDelegate(s_enumDisplayMonitorsNativeCallback);
Windows\Win32\PInvokeCore.EnumThreadWindows.cs (1)
14(delegate* unmanaged[Stdcall]<HWND, LPARAM, BOOL>)Marshal.GetFunctionPointerForDelegate(s_enumThreadWindowsNativeCallback);
Windows\Win32\PInvokeCore.EnumWindows.cs (1)
14(delegate* unmanaged[Stdcall]<HWND, LPARAM, BOOL>)Marshal.GetFunctionPointerForDelegate(s_enumWindowsNativeCallback);
Windows\Win32\PInvokeCore.GetWindowText.cs (1)
28int error = Marshal.GetLastWin32Error();
Windows\Win32\PInvokeCore.SetWindowLong.cs (1)
36IntPtr pointer = Marshal.GetFunctionPointerForDelegate(dwNewLong);
Windows\Win32\System\Com\ComHelpers.cs (2)
109ccw = (ComUnknown*)Marshal.GetIUnknownForObject(@object); 308return Marshal.GetObjectForIUnknown((nint)unknown);
Windows\Win32\System\Com\ComManagedStream.cs (1)
217pstatstg->pwcsName = (char*)Marshal.StringToCoTaskMemUni(_dataStream is FileStream fs ? fs.Name : _dataStream.ToString());
Windows\Win32\System\Com\Lifetime.cs (2)
32Marshal.FreeCoTaskMem((nint)lifetime); 54var wrapper = (Lifetime<TVTable, TObject>*)Marshal.AllocCoTaskMem(sizeof(Lifetime<TVTable, TObject>));
Windows\Win32\System\Variant\VARIANT.cs (2)
84return Marshal.GetObjectForNativeVariant((nint)thisVariant); 1023Marshal.GetNativeVariantForObject(value, (nint)(void*)&variant);
Windows\Win32\System\Variant\VARIANTVector.cs (1)
23Marshal.GetNativeVariantForObject(values[i], (IntPtr)(&pVariants[i]));
Microsoft.TestPlatform.CrossPlatEngine (1)
PostProcessing\ArtifactProcessingManager.cs (1)
277int error = Marshal.GetLastWin32Error();
Microsoft.TestPlatform.Extensions.BlameDataCollector (3)
MiniDumpWriteDump.cs (2)
60int err = Marshal.GetHRForLastWin32Error(); 63Marshal.ThrowExceptionForHR(err);
ProcessCodeMethods.cs (1)
95var res = NtQueryInformationProcess(handle, 0, out var pbi, Marshal.SizeOf<ProcessBasicInformation>(), out int size);
Microsoft.VisualBasic.Core (2)
Microsoft\VisualBasic\ErrObject.vb (1)
326Return Marshal.GetLastWin32Error()
Microsoft\VisualBasic\Interaction.vb (1)
551Return Marshal.BindToMoniker([PathName])
Microsoft.VisualBasic.Forms (4)
Microsoft\VisualBasic\CompilerServices\ExceptionUtils.vb (1)
135Return New ComponentModel.Win32Exception(Marshal.GetLastWin32Error(), GetResourceString(resourceKey, placeHolders))
Microsoft\VisualBasic\Helpers\NativeMethods.vb (1)
130dwLength = CType(Marshal.SizeOf(Of MEMORYSTATUSEX)(), UInt32)
Microsoft\VisualBasic\Helpers\NativeTypes.SECURITY_ATTRIBUTES.vb (1)
17nLength = Marshal.SizeOf(Of SECURITY_ATTRIBUTES)()
Microsoft\VisualBasic\Interaction.vb (1)
330errorCode = Marshal.GetLastWin32Error()
Microsoft.VisualStudio.TestPlatform.ObjectModel (2)
Navigation\FullSymbolReader.cs (2)
159Marshal.FinalReleaseComObject(_source); 474Marshal.FinalReleaseComObject(obj);
Microsoft.Win32.Registry (5)
_generated\0\LibraryImports.g.cs (3)
14global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 16__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 19global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
Microsoft.Win32.SystemEvents (32)
_generated\0\LibraryImports.g.cs (25)
18global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 20__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 23global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 174global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 176__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 181global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 292global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 294__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 297global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 425global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 427__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 430global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 463global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 465__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 468global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 576global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 578__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 581global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 605global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 607__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 612global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 639__handler_native = handler != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler) : default; 641global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 643__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 650global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Microsoft\Win32\SystemEvents.cs (7)
525if (lParam != 0 && Marshal.PtrToStringUni(lParam)!.Equals("Policy")) 529else if (lParam != 0 && Marshal.PtrToStringUni(lParam)!.Equals("intl")) 674lpfnWndProc = Marshal.GetFunctionPointerForDelegate(_windowProc), 682Debug.WriteLine("Unable to register broadcast window class: {0}", Marshal.GetLastPInvokeError()); 1083newString = Marshal.PtrToStringUni(lParam); 1086newStringPtr = Marshal.StringToHGlobalUni(newString); 1123Marshal.FreeHGlobal(lParam);
Mono.Cecil.Pdb (2)
Mono.Cecil.Pdb\SymWriter.cs (2)
83 Marshal.ReleaseComObject (writer); 86 Marshal.ReleaseComObject (document);
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
707[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.Marshal))]
netstandard (1)
netstandard.cs (1)
1713[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.Marshal))]
NuGet.Common (1)
PathUtil\NuGetEnvironment.cs (1)
77var errno = Marshal.GetLastWin32Error(); // fetch the errno before running any other operation
NuGet.Configuration (1)
Utility\FileSystemUtility.cs (1)
45var errno = Marshal.GetLastWin32Error(); // fetch the errno before running any other operation
NuGet.Packaging (75)
Signing\Cms\HeapBlockRetainer.cs (2)
24var hBlock = new SafeLocalAllocHandle(Marshal.AllocHGlobal(cbSize)); 33Marshal.Copy(b, 0, pb, b.Length);
Signing\Cms\NativeCms.cs (55)
71Marshal.Copy( 108var unsignedAttributes = Marshal.PtrToStructure<CRYPT_ATTRIBUTES>(pointer); 109int sizeOfCryptAttributeString = Marshal.SizeOf<CRYPT_ATTRIBUTE_STRING>(); 110int sizeOfCryptIntegerBlob = Marshal.SizeOf<CRYPT_INTEGER_BLOB>(); 117var attribute = Marshal.PtrToStructure<CRYPT_ATTRIBUTE_STRING>(attributePointer); 128var attributeValue = Marshal.PtrToStructure<CRYPT_INTEGER_BLOB>(attributeValuePointer); 151var counterSignerInfo = Marshal.PtrToStructure<CMSG_SIGNER_INFO>(counterSignerInfoPointer); 171int sizeOfCryptAttributeString = Marshal.SizeOf<CRYPT_ATTRIBUTE_STRING>(); 176var signedAttribute = Marshal.PtrToStructure<CRYPT_ATTRIBUTE_STRING>(signedAttributePointer); 189int sizeOfCryptIntegerBlob = Marshal.SizeOf<CRYPT_INTEGER_BLOB>(); 195var attributeValue = Marshal.PtrToStructure<CRYPT_INTEGER_BLOB>(attributeValuePointer); 198Marshal.Copy(attributeValue.pbData, bytes, startIndex: 0, length: bytes.Length); 226Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 231Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 245Marshal.Copy(encodedCert, 0, unmanagedCert, encodedCert.Length); 252var unmanagedBlob = hb.Alloc(Marshal.SizeOf(blob)); 253Marshal.StructureToPtr(blob, unmanagedBlob, fDeleteOld: false); 261Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 300countersignatureDelAttr.cbSize = (uint)Marshal.SizeOf(countersignatureDelAttr); 301var unmanagedCountersignatureDelAttr = hb.Alloc(Marshal.SizeOf(countersignatureDelAttr)); 302Marshal.StructureToPtr(countersignatureDelAttr, unmanagedCountersignatureDelAttr, fDeleteOld: false); 310Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 317var sizeOfCryptAttribute = Marshal.SizeOf<CRYPT_ATTRIBUTE>(); 326var existingAttribute = Marshal.PtrToStructure<CRYPT_ATTRIBUTE>(existingAttributePointer); 345var unmanagedSignerInfo = hb.Alloc(Marshal.SizeOf(signerInfo)); 346Marshal.StructureToPtr(signerInfo, unmanagedSignerInfo, fDeleteOld: false); 358var err = Marshal.GetLastWin32Error(); 361Marshal.ThrowExceptionForHR(NativeMethods.GetHRForWin32Error(err)); 375Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 384var unmanagedBlob = hb.Alloc(Marshal.SizeOf(encondedSignerBlob)); 385Marshal.StructureToPtr(encondedSignerBlob, unmanagedBlob, fDeleteOld: false); 398signerInfoAddAttr.cbSize = (uint)Marshal.SizeOf(signerInfoAddAttr); 399var unmanagedSignerInfoAddAttr = hb.Alloc(Marshal.SizeOf(signerInfoAddAttr)); 401Marshal.StructureToPtr(signerInfoAddAttr, unmanagedSignerInfoAddAttr, fDeleteOld: false); 409Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 421timestampAddAttr.cbSize = (uint)Marshal.SizeOf(timestampAddAttr); 422var unmanagedTimestampAddAttr = hb.Alloc(Marshal.SizeOf(timestampAddAttr)); 423Marshal.StructureToPtr(timestampAddAttr, unmanagedTimestampAddAttr, fDeleteOld: false); 431Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 439Marshal.Copy(data, 0, unmanagedData, data.Length); 446var unmanagedBlob = hb.Alloc(Marshal.SizeOf(blob)); 447Marshal.StructureToPtr(blob, unmanagedBlob, fDeleteOld: false); 461var unmanagedAttr = hb.Alloc(Marshal.SizeOf(attr)); 462Marshal.StructureToPtr(attr, unmanagedAttr, fDeleteOld: false); 474var err = Marshal.GetLastWin32Error(); 477Marshal.ThrowExceptionForHR(NativeMethods.GetHRForWin32Error(err)); 491Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
Signing\Cms\NativeMethods.cs (1)
170Marshal.FreeHGlobal(handle);
Signing\Cms\NativeUtility.cs (17)
17Marshal.FreeHGlobal(ptr); 25Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 38var context = Marshal.PtrToStructure<CERT_CONTEXT>(cert.Handle); 47signedInfo.cbSize = Marshal.SizeOf(signedInfo); 50using (var signerInfoHandle = new SafeLocalAllocHandle(Marshal.AllocHGlobal(Marshal.SizeOf(signerInfo)))) 52Marshal.StructureToPtr(signerInfo, signerInfoHandle.DangerousGetHandle(), fDeleteOld: false); 57using (var certificatesHandle = new SafeLocalAllocHandle(Marshal.AllocHGlobal(Marshal.SizeOf(certificateBlobs[0]) * certificateBlobs.Length))) 61Marshal.StructureToPtr(certificateBlobs[i], new IntPtr(certificatesHandle.DangerousGetHandle().ToInt64() + Marshal.SizeOf(certificateBlobs[i]) * i), fDeleteOld: false); 117signerInfo.cbSize = (uint)Marshal.SizeOf(signerInfo); 118signerInfo.pCertInfo = Marshal.PtrToStructure<CERT_CONTEXT>(cmsSigner.Certificate!.Handle).pCertInfo; 169int sizeOfCryptAttribute = Marshal.SizeOf<CRYPT_ATTRIBUTE>(); 170int sizeOfCryptIntegerBlob = Marshal.SizeOf<CRYPT_INTEGER_BLOB>(); 191Marshal.Copy(attrData, 0, blob->pbData, attrData.Length);
PresentationCore (150)
MS\Internal\AppModel\CookieHandler.cs (1)
118if (!throwIfNoCookie && Marshal.GetLastWin32Error() == NativeMethods.ERROR_NO_MORE_ITEMS)
MS\Internal\DpiUtil\DpiUtil+WindowDpiScaleHelper.cs (1)
98Marshal.ThrowExceptionForHR(hr);
MS\Internal\FontCache\FontCacheUtil.cs (2)
75Marshal.Copy((IntPtr)_pointer, b, 0, Size); 828Util.ThrowWin32Exception(Marshal.GetLastWin32Error(), fileName);
MS\Internal\FontFace\FontDriver.cs (1)
250Marshal.Copy((IntPtr)fontData, fontCopy, 0, fileSize);
MS\Internal\Ink\GestureRecognizer\NativeRecognizer.cs (9)
520int allocationSize = (int)(Marshal.SizeOf(typeof(MS.Win32.Recognizer.PACKET_PROPERTY)) * packetDescription.cPacketProperties); 521packetDescription.pPacketProperties = Marshal.AllocCoTaskMem(allocationSize); 527Marshal.StructureToPtr(packetProperties[i], new IntPtr(pElement), false); 538packets = Marshal.AllocCoTaskMem(countOfBytes); 539Marshal.Copy(rawPackets, 0, packets, packetCount); 559Marshal.DestroyStructure(new IntPtr(pElement), typeof(MS.Win32.Recognizer.PACKET_PROPERTY)); 563Marshal.FreeCoTaskMem(pd.pPacketProperties); 569Marshal.FreeCoTaskMem(pd.pguidButtons); 575Marshal.FreeCoTaskMem(packets);
MS\Internal\IO\Packaging\ByteRangeDownloader.cs (1)
478throw new Win32Exception(Marshal.GetLastWin32Error());
MS\Internal\Text\TextInterface\DWriteUtil.cs (2)
39System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hr, new System.IntPtr(-1)); 55System.Exception e = System.Runtime.InteropServices.Marshal.GetExceptionForHR(hr);
MS\Internal\Text\TextInterface\Factory.cs (10)
61IntPtr pIDWriteFontFileLoaderMirror = Marshal.GetComInterfaceForObject( 77Marshal.Release(pIDWriteFontFileLoaderMirror); 81IntPtr pIDWriteFontCollectionLoaderMirror = Marshal.GetComInterfaceForObject( 88Marshal.Release(pIDWriteFontCollectionLoaderMirror); 300IntPtr pIDWriteFontCollectionLoaderMirror = Marshal.GetComInterfaceForObject( 315Marshal.Release(pIDWriteFontCollectionLoaderMirror); 353IntPtr pIDWriteFontCollectionLoaderMirror = Marshal.GetComInterfaceForObject( 358Marshal.Release(pIDWriteFontCollectionLoaderMirror); 365IntPtr pIDWriteFontFileLoaderMirror = Marshal.GetComInterfaceForObject( 370Marshal.Release(pIDWriteFontFileLoaderMirror);
MS\Internal\Text\TextInterface\FontCollectionLoader.cs (2)
68IntPtr pIDWriteFontFileEnumeratorMirror = Marshal.GetComInterfaceForObject( 76hr = Marshal.GetHRForException(exception);
MS\Internal\TextFormatting\LineServicesCallbacks.cs (1)
2311Marshal.StructureToPtr(inlineInit, (System.IntPtr)objectInfo, false);
MS\Internal\WindowsRuntime\Windows\UI\ViewManagement\InputPane.cs (1)
247Marshal.ReleaseComObject(_inputPane);
MS\Internal\WindowsRuntime\Windows\UI\ViewManagement\InputPaneRcw.cs (3)
25Marshal.ThrowExceptionForHR(NativeMethods.WindowsCreateString(typeName, typeName.Length, out hstring)); 29Marshal.ThrowExceptionForHR(NativeMethods.RoGetActivationFactory(hstring, ref iid, out object factory)); 34Marshal.ThrowExceptionForHR(NativeMethods.WindowsDeleteString(hstring));
MS\Internal\WindowsRuntime\Windows\UI\ViewManagement\UISettings.cs (1)
167Marshal.ReleaseComObject(_uisettings);
MS\Internal\WindowsRuntime\Windows\UI\ViewManagement\UISettingsRcw.cs (3)
21Marshal.ThrowExceptionForHR(hr); 25Marshal.ThrowExceptionForHR(hr); 31Marshal.ThrowExceptionForHR(hr);
src\wpf\src\Microsoft.DotNet.Wpf\src\Common\Graphics\wgx_render.cs (1)
775Exception exceptionForHR = Marshal.GetExceptionForHR(hr, (IntPtr)(-1));
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\SafeSecurityHelper.cs (1)
52int win32Err = Marshal.GetLastWin32Error();
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\SecurityHelper.cs (4)
133return Marshal.GetExceptionForHR(hr, new IntPtr(-1)); 140Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); 150int hr = Marshal.GetHRForException(exception); 154Marshal.GetHRForException(new Exception());
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\WinInet.cs (3)
28UInt32 size = (UInt32)Marshal.SizeOf(icci); 38int hr = Marshal.GetHRForLastWin32Error(); 42Marshal.ThrowExceptionForHR(hr);
System\Windows\DpiChangedEventArgs.cs (1)
48NativeMethods.RECT suggestedRect = Marshal.PtrToStructure<NativeMethods.RECT>(lParam);
System\Windows\Input\Cursor.cs (1)
171int errorCode = Marshal.GetLastWin32Error();
System\Windows\Input\DefaultTextStore.cs (1)
283Marshal.ReleaseComObject(compartment);
System\Windows\Input\DefaultTextStoreTextComposition.cs (4)
65Marshal.ReleaseComObject(composition); 68Marshal.ReleaseComObject(context); 88Marshal.ReleaseComObject(doc); 107Marshal.ReleaseComObject(enumCompositionView);
System\Windows\Input\InputMethod.cs (5)
1510Marshal.ReleaseComObject(fnConfigure); 1513Marshal.ReleaseComObject(funcPrv); 1563Marshal.ReleaseComObject(fnConfigure); 1566Marshal.ReleaseComObject(funcPrv); 1674Marshal.ReleaseComObject(enumIpp);
System\Windows\Input\InputProcessorProfiles.cs (2)
58Marshal.ReleaseComObject(_ipp); 119Marshal.FreeCoTaskMem(ptrLanguageIDs);
System\Windows\Input\Stylus\Wisp\PenThreadWorker.cs (2)
791Marshal.Copy(pPackets, data, 0, cItems); 1120Marshal.ReleaseComObject(penContext._pimcContext);
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (1)
342Marshal.ReleaseComObject(tablet);
System\Windows\Input\Stylus\Wisp\WispTabletDeviceCollection.cs (3)
123int result = (int)MS.Win32.UnsafeNativeMethods.GetRawInputDeviceList(null, ref deviceCount, (uint)Marshal.SizeOf(typeof(NativeMethods.RAWINPUTDEVICELIST))); 128int count = (int)MS.Win32.UnsafeNativeMethods.GetRawInputDeviceList(ridl, ref deviceCount, (uint)Marshal.SizeOf(typeof(NativeMethods.RAWINPUTDEVICELIST))); 138cbSize = (uint)Marshal.SizeOf(typeof(NativeMethods.RID_DEVICE_INFO))
System\Windows\Input\TextServicesCompartment.cs (6)
98Marshal.ReleaseComObject(compartment); 99Marshal.ReleaseComObject(source); 117Marshal.ReleaseComObject(compartment); 118Marshal.ReleaseComObject(source); 198Marshal.ReleaseComObject(compartment); 210Marshal.ReleaseComObject(compartment);
System\Windows\Input\TextServicesContext.cs (6)
81Marshal.ReleaseComObject(_defaultTextStore.DocumentManager); 120Marshal.ReleaseComObject(_dimEmpty); 129Marshal.ReleaseComObject(_threadManager); 218Marshal.ReleaseComObject(context); 359Marshal.ReleaseComObject(comp); 391Marshal.ReleaseComObject(comp);
System\Windows\InterOp\HwndMouseInputProvider.cs (1)
231int n = UnsafeNativeMethods.GetMouseMovePointsEx((uint)(Marshal.SizeOf(mp_in)), ref mp_in, mp_out, 64, mode);
System\Windows\InterOp\HwndSource.cs (2)
1347NativeMethods.WINDOWPOS windowPos = Marshal.PtrToStructure<NativeMethods.WINDOWPOS>(lParam); 1396Marshal.StructureToPtr(windowPos, lParam, true);
System\Windows\InterOp\HwndTarget.cs (3)
877Marshal.PtrToStructure<NativeMethods.RECT>(lParam); 1462return new IntPtr(Marshal.GetHRForException(e)); 1865NativeMethods.WINDOWPOS windowPos = Marshal.PtrToStructure<NativeMethods.WINDOWPOS>(lParam);
System\Windows\Media\ByteStreamGeometryContext.cs (2)
493Marshal.Copy(_chunkList[currentChunk], bufferOffset, (IntPtr)pbData, cbDataForThisChunk); 497Marshal.Copy((IntPtr)pbData, _chunkList[currentChunk], bufferOffset, cbDataForThisChunk);
System\Windows\Media\ColorContext.cs (2)
646HRESULT.Check(Marshal.GetHRForLastWin32Error()); 660HRESULT.Check(Marshal.GetHRForLastWin32Error());
System\Windows\Media\ColorContextHelper.cs (1)
93HRESULT.Check(Marshal.GetHRForLastWin32Error());
System\Windows\Media\ColorTransformHelper.cs (1)
100HRESULT.Check(Marshal.GetHRForLastWin32Error());
System\Windows\Media\EventProxy.cs (1)
93return Marshal.GetHRForException(e);
System\Windows\Media\GlyphTypeface.cs (1)
1280Marshal.Copy(new IntPtr(pMilPathGeometry), data, 0, checked((int)size));
System\Windows\Media\ImageSourceConverter.cs (2)
228if (Marshal.ReadInt16(addr) != 0x1c15) 239OBJECTHEADER pHeader = Marshal.PtrToStructure<OBJECTHEADER>(addr);
System\Windows\Media\Imaging\BitmapEncoder.cs (2)
28pstrName = Marshal.StringToCoTaskMemUni(name); 33Marshal.FreeCoTaskMem(pstrName);
System\Windows\Media\Imaging\BitmapMetadata.cs (3)
233pIEnumMetadata = Marshal.GetComInterfaceForObject( 683blockWriter = Marshal.GetComInterfaceForObject( 732blockWriter = Marshal.GetComInterfaceForObject(
System\Windows\Media\Imaging\BitmapMetadataEnumerator.cs (2)
82_current = Marshal.PtrToStringUni(ppStr); 89Marshal.FreeCoTaskMem(ppStr);
System\Windows\Media\Imaging\BitmapSource.cs (3)
571_wicSource = new BitmapSourceSafeMILHandle(Marshal.GetComInterfaceForObject( 1791rc = Marshal.PtrToStructure<Int32Rect>(prc); 1833Marshal.Copy(managedArray, y * rectRowSize, new IntPtr(rowPtr), rectRowSize);
System\Windows\Media\Imaging\PropVariant.cs (40)
132long size = Marshal.SizeOf(type) * length; 137destPtr = Marshal.AllocCoTaskMem((int)size); 154Marshal.FreeCoTaskMem(destPtr); 184destPtr = Marshal.AllocCoTaskMem((int)size); 190pString = Marshal.StringToCoTaskMemAnsi(value[index]); 194pString = Marshal.StringToCoTaskMemUni(value[index]); 196Marshal.WriteIntPtr(destPtr, (int)index*sizeIntPtr, pString); 209IntPtr pString = Marshal.ReadIntPtr(destPtr, i*sizeIntPtr); 210Marshal.FreeCoTaskMem(pString); 213Marshal.FreeCoTaskMem(destPtr); 240pszVal = Marshal.StringToCoTaskMemAnsi(new String(value as char[])); 319pwszVal = Marshal.StringToCoTaskMemUni(value as String); 339pszVal = Marshal.StringToCoTaskMemAnsi(new String(stackalloc char[] { (char)value })); 385pclsidVal = Marshal.AllocCoTaskMem(guid.Length); 386Marshal.Copy(guid, 0, pclsidVal, guid.Length); 447UnsafeNativeMethods.MILUnknown.Release(Marshal.ReadIntPtr(punkPtr, (int) (i*sizeIntPtr))); 461Marshal.FreeCoTaskMem(Marshal.ReadIntPtr(strPtr, (int) (i*sizeIntPtr))); 465Marshal.FreeCoTaskMem(ca.pElems); 472Marshal.FreeCoTaskMem(pwszVal); 498array[i] = (sbyte) Marshal.ReadByte(ca.pElems, i); 505Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 512Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 520array[i] = (ushort) Marshal.ReadInt16(ca.pElems, i*sizeof(ushort)); 527Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 535array[i] = (uint) Marshal.ReadInt32(ca.pElems, i*sizeof(uint)); 542Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 550array[i] = (UInt64) Marshal.ReadInt64(ca.pElems, i*sizeof(UInt64)); 557Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 564Marshal.Copy(ca.pElems, array, 0, (int)ca.cElems); 572array[i] = (bool) (Marshal.ReadInt16(ca.pElems, i*sizeof(ushort)) != 0); 582Marshal.Copy(ca.pElems, guid, i*16, 16); 599IntPtr ptr = Marshal.ReadIntPtr(ca.pElems, i*sizeIntPtr); 600array[i] = Marshal.PtrToStringAnsi(ptr); 616IntPtr ptr = Marshal.ReadIntPtr(ca.pElems, i*sizeIntPtr); 617array[i] = Marshal.PtrToStringUni(ptr); 672Marshal.Copy(pclsidVal, guid, 0, 16); 676return Marshal.PtrToStringAnsi(pszVal); 679return Marshal.PtrToStringUni(pwszVal); 684Marshal.Copy(ca.pElems, blob, 0, (int)ca.cElems);
System\Windows\Media\Imaging\WriteableBitmap.cs (2)
1072elementSize = Marshal.SizeOf(exemplar); 1100elementSize = Marshal.SizeOf(exemplar);
System\Windows\Media\MediaContextNotificationWindow.cs (1)
187ChangeWindowMessageFilterNative function = Marshal.GetDelegateForFunctionPointer(
System\Windows\Media\RenderData.cs (2)
108Marshal.Copy((IntPtr)(&header), this._buffer, _curOffset, sizeof(RecordHeader)); 109Marshal.Copy((IntPtr)pbRecord, this._buffer, _curOffset + sizeof(RecordHeader), cbRecordSize);
PresentationFramework (350)
MS\Internal\AppModel\AppSecurityManager.cs (1)
119sei.cbSize = Marshal.SizeOf(sei);
MS\Internal\AppModel\IconHelper.cs (1)
234Marshal.Copy(colorArray, 0, bits, colorArray.Length);
MS\Internal\Controls\ActiveXSite.cs (1)
259lpFrameInfo.cb = (uint)Marshal.SizeOf(typeof(NativeMethods.OLEINPLACEFRAMEINFO));
MS\Internal\Controls\ConnectionPointCookie.cs (4)
47else if (sink == null || !eventInterface.IsInstanceOfType(sink) && !Marshal.IsComObject(sink)) 57Marshal.FinalReleaseComObject(connectionPoint); 73Marshal.FinalReleaseComObject(connectionPoint); 114System.Runtime.InteropServices.Marshal.FinalReleaseComObject(connectionPoint);
MS\Internal\Controls\EnumUnknown.cs (4)
40Marshal.WriteInt32(pceltFetched, 0, 0); 58Marshal.WriteIntPtr(rgelt, Marshal.GetIUnknownForObject(this.arr[this.loc])); 66Marshal.WriteInt32(pceltFetched, 0, fetched);
MS\Internal\IO\Packaging\indexingfiltermarshaler.cs (9)
104Marshal.Copy(s.ToCharArray(), 0, p, s.Length); 107Marshal.WriteInt16(p, s.Length * _int16Size, 0); 125native.union.name = Marshal.StringToCoTaskMemUni(propSpec.PropName); 187pszVal = Marshal.StringToCoTaskMemAnsi((string)obj); 212pNative = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(PROPVARIANT))); 218Marshal.StructureToPtr(v, pNative, false); 224Marshal.FreeCoTaskMem(pszVal); 229Marshal.FreeCoTaskMem(pNative);
MS\Internal\IO\Packaging\ManagedFilter.cs (1)
121PropName = Marshal.PtrToStringUni(propSpec.union.name);
MS\Internal\IO\Packaging\ManagedIStream.cs (3)
46Marshal.WriteInt32(bytesReadPtr, bytesRead); 85Marshal.WriteInt64(newPositionPtr, position); 150Marshal.WriteInt32(bytesWrittenPtr, bufferSize);
MS\Internal\IO\Packaging\XpsFilter.cs (4)
125Marshal.WriteInt16(pBuffer, 0); 180short shCharacter = Marshal.ReadInt16(pBuffer); 199shCharacter = Marshal.ReadInt16(pBuffer, _int16Size); 257Marshal.WriteInt16(pBuffer, (int)bufCharacterCount * _int16Size, 0);
MS\Internal\Printing\NativeMethods.cs (2)
28public int lStructSize = Marshal.SizeOf(typeof(PRINTDLGEX32)); 54public int lStructSize = Marshal.SizeOf(typeof(PRINTDLGEX64));
MS\Internal\Printing\PrintDlgExMarshaler.cs (37)
235NativeMethods.PRINTDLGEX32 pdex = Marshal.PtrToStructure<NativeMethods.PRINTDLGEX32>(unmanagedBuffer); 243NativeMethods.PRINTDLGEX64 pdex = Marshal.PtrToStructure<NativeMethods.PRINTDLGEX64>(unmanagedBuffer); 257NativeMethods.PRINTPAGERANGE pageRangeStruct = Marshal.PtrToStructure<NativeMethods.PRINTPAGERANGE>(pageRangePtr); 276NativeMethods.DEVNAMES devNames = Marshal.PtrToStructure<NativeMethods.DEVNAMES>(pDevNames); 277int devNamesOffset = checked(devNames.wDeviceOffset * Marshal.SystemDefaultCharSize); 278printerName = Marshal.PtrToStringAuto(pDevNames + devNamesOffset); 369NativeMethods.DEVMODE devMode = Marshal.PtrToStructure<NativeMethods.DEVMODE>(pDevMode); 371Marshal.Copy(pDevMode, devModeData, 0, devModeData.Length); 415NativeMethods.PRINTDLGEX32 pdex = Marshal.PtrToStructure<NativeMethods.PRINTDLGEX32>(unmanagedBuffer); 420NativeMethods.PRINTDLGEX64 pdex = Marshal.PtrToStructure<NativeMethods.PRINTDLGEX64>(unmanagedBuffer); 490pdex.lpPageRanges = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE))); 496Marshal.StructureToPtr(range, pdex.lpPageRanges, false); 529int cbBufferSize = Marshal.SizeOf(typeof(NativeMethods.PRINTDLGEX32)); 530unmanagedBuffer = Marshal.AllocHGlobal(cbBufferSize); 531Marshal.StructureToPtr(pdex, unmanagedBuffer, false); 569pdex.lpPageRanges = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NativeMethods.PRINTPAGERANGE))); 575Marshal.StructureToPtr(range, pdex.lpPageRanges, false); 608int cbBufferSize = Marshal.SizeOf(typeof(NativeMethods.PRINTDLGEX64)); 609unmanagedBuffer = Marshal.AllocHGlobal(cbBufferSize); 610Marshal.StructureToPtr(pdex, unmanagedBuffer, false); 655NativeMethods.PRINTDLGEX32 pdex = Marshal.PtrToStructure<NativeMethods.PRINTDLGEX32>(unmanagedBuffer); 662NativeMethods.PRINTDLGEX64 pdex = Marshal.PtrToStructure<NativeMethods.PRINTDLGEX64>(unmanagedBuffer); 683Marshal.FreeHGlobal(unmanagedBuffer); 722int cbDevNames = checked(((printer.Length + 3) * Marshal.SystemDefaultCharSize) + 723Marshal.SizeOf(typeof(NativeMethods.DEVNAMES))); 724hDevNames = Marshal.AllocHGlobal(cbDevNames); 726ushort baseOffset = (ushort)Marshal.SizeOf(typeof(NativeMethods.DEVNAMES)); 736devNames.wDeviceOffset = (ushort)(baseOffset / Marshal.SystemDefaultCharSize); 740Marshal.StructureToPtr(devNames, hDevNames, false); 750checked((IntPtr)((long)offsetName + (printer.Length * Marshal.SystemDefaultCharSize))); 760byte[] nulls = new byte[3 * Marshal.SystemDefaultCharSize]; 762Marshal.Copy( 767Marshal.Copy( 815IntPtr hDevMode = Marshal.AllocHGlobal(devModeData.Length); 816Marshal.Copy(devModeData, 0, hDevMode, devModeData.Length);
MS\Internal\WindowsRuntime\Generated\Windows.Data.Text.cs (14)
458var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 3); 459Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 630var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 17); 631Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 1142var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 3); 1143Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 1294var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 4); 1295Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 1482var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 1); 1483Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 1574Invoke = Marshal.GetFunctionPointerForDelegate(AbiInvokeDelegate) 1576var nativeVftbl = ComWrappersSupport.AllocateVtableMemory(typeof(WordSegmentsTokenizingHandler), Marshal.SizeOf<global::WinRT.Interop.IDelegateVftbl>()); 1577Marshal.StructureToPtr(AbiToProjectionVftable, nativeVftbl, false); 1607var abiInvoke = Marshal.GetDelegateForFunctionPointer<Abi_Invoke>(_nativeDelegate.Vftbl.Invoke);
MS\Internal\WindowsRuntime\Generated\Windows.Globalization.cs (12)
233var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 4); 234Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 417var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 1); 418Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 491var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 1); 492Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 572var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 1); 573Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 655var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 2); 656Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 771var nativeVftbl = (IntPtr*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 1); 772Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false);
MS\Internal\WindowsRuntime\Generated\WinRT.cs (15)
17Marshal.ThrowExceptionForHR((int)del.DynamicInvoke(invoke_params)); 22return Marshal.GetDelegateForFunctionPointer<T>( 23Marshal.GetFunctionPointerForDelegate(del)); 47Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 49return Marshal.GetDelegateForFunctionPointer<T>(functionPtr); 137Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 145_CanUnloadNow = Marshal.GetDelegateForFunctionPointer<DllCanUnloadNow>(canUnloadNow); 166Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); 201Marshal.ThrowExceptionForHR(Platform.CoIncrementMTAUsage(&mtaCookie)); 217Marshal.ThrowExceptionForHR(Platform.CoDecrementMTAUsage(_mtaCookie)); 247Marshal.ThrowExceptionForHR(hr); 255Marshal.ThrowExceptionForHR(_IActivationFactory.Vftbl.ActivateInstance(_IActivationFactory.ThisPtr, out IntPtr instancePtr));
MS\Internal\WindowsRuntime\Generated\WinRT\ComWrappersSupport.net5.cs (5)
65QueryInterface = Marshal.GetDelegateForFunctionPointer<IUnknownVftbl._QueryInterface>(qi), 66AddRef = Marshal.GetDelegateForFunctionPointer<IUnknownVftbl._AddRef>(addRef), 67Release = Marshal.GetDelegateForFunctionPointer<IUnknownVftbl._Release>(release), 91ComInterfaceEntry* nativeEntries = (ComInterfaceEntry*)Marshal.AllocCoTaskMem(sizeof(ComInterfaceEntry) * count); 151Marshal.FreeCoTaskMem((IntPtr)_data);
MS\Internal\WindowsRuntime\Generated\WinRT\Context.cs (1)
17Marshal.ThrowExceptionForHR(CoGetObjectContext(ref riid, out IntPtr contextCallbackPtr));
MS\Internal\WindowsRuntime\Generated\WinRT\ExceptionHelpers.cs (4)
96Marshal.ThrowExceptionForHR(getRestrictedErrorInfo(out IntPtr restrictedErrorInfoPtr)); 148ex = Marshal.GetExceptionForHR(hr, iErrorInfo?.ThisPtr ?? (IntPtr)(-1)); 208Marshal.ThrowExceptionForHR(getRestrictedErrorInfo(out IntPtr ppRestrictedErrorInfo)); 311Marshal.ThrowExceptionForHR(getRestrictedErrorInfo(out IntPtr restrictedErrorInfoPtr));
MS\Internal\WindowsRuntime\Generated\WinRT\IInspectable.cs (4)
45AbiToProjectionVftablePtr = Marshal.AllocHGlobal(Marshal.SizeOf<Vftbl>()); 46Marshal.StructureToPtr(AbiToProjectionVftable, AbiToProjectionVftablePtr, false); 112Marshal.ThrowExceptionForHR(hr);
MS\Internal\WindowsRuntime\Generated\WinRT\Interop\ExceptionErrorInfo.cs (38)
107var nativeVftbl = (IntPtr*)Marshal.AllocCoTaskMem(Marshal.SizeOf<Vftbl>()); 108Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 134source = Marshal.StringToBSTR(_source); 138Marshal.FreeBSTR(source); 152description = Marshal.StringToBSTR(_description); 156Marshal.FreeBSTR(description); 170helpFile = Marshal.StringToBSTR(_helpFile); 174Marshal.FreeBSTR(helpFile); 188helpFileContent = Marshal.StringToBSTR(_helpFileContent); 192Marshal.FreeBSTR(helpFileContent); 217Marshal.ThrowExceptionForHR(_obj.Vftbl.GetGuid_0(ThisPtr, out __return_value__)); 226Marshal.ThrowExceptionForHR(_obj.Vftbl.GetSource_1(ThisPtr, out __retval)); 227return __retval != IntPtr.Zero ? Marshal.PtrToStringBSTR(__retval) : string.Empty; 231Marshal.FreeBSTR(__retval); 240Marshal.ThrowExceptionForHR(_obj.Vftbl.GetDescription_2(ThisPtr, out __retval)); 241return __retval != IntPtr.Zero ? Marshal.PtrToStringBSTR(__retval) : string.Empty; 245Marshal.FreeBSTR(__retval); 254Marshal.ThrowExceptionForHR(_obj.Vftbl.GetHelpFile_3(ThisPtr, out __retval)); 255return __retval != IntPtr.Zero ? Marshal.PtrToStringBSTR(__retval) : string.Empty; 259Marshal.FreeBSTR(__retval); 268Marshal.ThrowExceptionForHR(_obj.Vftbl.GetHelpFileContent_4(ThisPtr, out __retval)); 269return __retval != IntPtr.Zero ? Marshal.PtrToStringBSTR(__retval) : string.Empty; 273Marshal.FreeBSTR(__retval); 309Marshal.ThrowExceptionForHR(_obj.Vftbl.GetLanguageException_0(ThisPtr, out __return_value__)); 341var nativeVftbl = (IntPtr*)Marshal.AllocCoTaskMem(Marshal.SizeOf<Vftbl>()); 342Marshal.StructureToPtr(AbiToProjectionVftable, (IntPtr)nativeVftbl, false); 419Marshal.ThrowExceptionForHR(_obj.Vftbl.GetErrorDetails_0(ThisPtr, out _description, out error, out _restrictedDescription, out _capabilitySid)); 420description = _description != IntPtr.Zero ? Marshal.PtrToStringBSTR(_description) : string.Empty; 421restrictedDescription = _restrictedDescription != IntPtr.Zero ? Marshal.PtrToStringBSTR(_restrictedDescription) : string.Empty; 422capabilitySid = _capabilitySid != IntPtr.Zero ? Marshal.PtrToStringBSTR(_capabilitySid) : string.Empty; 426Marshal.FreeBSTR(_description); 427Marshal.FreeBSTR(_restrictedDescription); 428Marshal.FreeBSTR(_capabilitySid); 437Marshal.ThrowExceptionForHR(_obj.Vftbl.GetReference_1(ThisPtr, out __retval)); 438return __retval != IntPtr.Zero ? Marshal.PtrToStringBSTR(__retval) : string.Empty; 442Marshal.FreeBSTR(__retval);
MS\Internal\WindowsRuntime\Generated\WinRT\Interop\IContextCallback.cs (1)
77Marshal.ThrowExceptionForHR(_obj.Vftbl.ContextCallback_4(ThisPtr, pfnCallback, pParam, ref riid, iMethod, IntPtr.Zero));
MS\Internal\WindowsRuntime\Generated\WinRT\Interop\IUnknownVftbl.cs (3)
25AbiToProjectionVftblPtr = Marshal.AllocHGlobal(Marshal.SizeOf<IUnknownVftbl>()); 26Marshal.StructureToPtr(AbiToProjectionVftbl, AbiToProjectionVftblPtr, false);
MS\Internal\WindowsRuntime\Generated\WinRT\Marshalers.cs (27)
54Marshal.ThrowExceptionForHR(Platform.WindowsCreateStringReference( 106Marshal.ThrowExceptionForHR( 124Marshal.FreeCoTaskMem(_array); 143m._array = Marshal.AllocCoTaskMem(length * IntPtr.Size); 210data = Marshal.AllocCoTaskMem(length * IntPtr.Size); 268Marshal.FreeCoTaskMem(abi.data); 308var byte_length = length * Marshal.SizeOf<T>(); 309var data = Marshal.AllocCoTaskMem(byte_length); 319int byte_length = array.Length * Marshal.SizeOf<T>(); 335Marshal.FreeCoTaskMem(abi.data); 439Marshal.FreeCoTaskMem(_array); 458var abi_element_size = Marshal.SizeOf(HelperType); 460m._array = Marshal.AllocCoTaskMem(byte_length); 493var abi_element_size = Marshal.SizeOf(HelperType); 496var abi_element = Marshal.PtrToStructure((IntPtr)data, HelperType); 511var abi_element_size = Marshal.SizeOf(HelperType); 514var abi_element = Marshal.PtrToStructure((IntPtr)data, HelperType); 538var abi_element_size = Marshal.SizeOf(HelperType); 540data = Marshal.AllocCoTaskMem(byte_length); 568var abi_element_size = Marshal.SizeOf(HelperType); 587var abi_element_size = Marshal.SizeOf(HelperType); 590var abi_element = Marshal.PtrToStructure((IntPtr)data, HelperType); 602Marshal.FreeCoTaskMem(abi.data); 621Marshal.FreeCoTaskMem(_array); 641m._array = Marshal.AllocCoTaskMem(byte_length); 699data = Marshal.AllocCoTaskMem(byte_length); 756Marshal.FreeCoTaskMem(abi.data);
MS\Internal\WindowsRuntime\Generated\WinRT\ObjectReference.cs (6)
55Marshal.ThrowExceptionForHR(VftblIUnknown.QueryInterface(ThisPtr, ref iid, out IntPtr thatPtr)); 130releaseDelegate = Marshal.PtrToStructure<IUnknownVftbl>(Marshal.PtrToStructure<VftblPtr>(ThisPtr).Vftbl).Release; 206var vftblPtr = Marshal.PtrToStructure<VftblPtr>(thisPtr); 207var vftblIUnknown = Marshal.PtrToStructure<IUnknownVftbl>(vftblPtr.Vftbl); 215vftblT = Marshal.PtrToStructure<T>(vftblPtr.Vftbl);
MS\Internal\WindowsRuntime\Generated\WinRT\Projections\IEnumerable.cs (21)
102var vftblPtr = Marshal.PtrToStructure<VftblPtr>(thisPtr); 104IInspectableVftbl = Marshal.PtrToStructure<IInspectable.Vftbl>(vftblPtr.Vftbl); 105First_0 = Marshal.GetDelegateForFunctionPointer<IEnumerable_Delegates.First_0>(vftbl[6]); 117var nativeVftbl = (IntPtr*)Marshal.AllocCoTaskMem(Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 1); 118Marshal.StructureToPtr(AbiToProjectionVftable.IInspectableVftbl, (IntPtr)nativeVftbl, false); 119nativeVftbl[6] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.First_0); 301if (Marshal.GetHRForException(e) == ExceptionHelpers.E_CHANGED_STATE) 428var vftblPtr = Marshal.PtrToStructure<VftblPtr>(thisPtr); 430IInspectableVftbl = Marshal.PtrToStructure<IInspectable.Vftbl>(vftblPtr.Vftbl); 431get_Current_0 = Marshal.GetDelegateForFunctionPointer(vftbl[6], get_Current_0_Type); 432get_HasCurrent_1 = Marshal.GetDelegateForFunctionPointer<_get_PropertyAsBoolean>(vftbl[7]); 433MoveNext_2 = Marshal.GetDelegateForFunctionPointer<IEnumerator_Delegates.MoveNext_2>(vftbl[8]); 434GetMany_3 = Marshal.GetDelegateForFunctionPointer<IEnumerator_Delegates.GetMany_3>(vftbl[9]); 449var nativeVftbl = (IntPtr*)Marshal.AllocCoTaskMem(Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 4); 450Marshal.StructureToPtr(AbiToProjectionVftable.IInspectableVftbl, (IntPtr)nativeVftbl, false); 451nativeVftbl[6] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.get_Current_0); 452nativeVftbl[7] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.get_HasCurrent_1); 453nativeVftbl[8] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.MoveNext_2); 454nativeVftbl[9] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.GetMany_3);
MS\Internal\WindowsRuntime\Generated\WinRT\Projections\IReadOnlyList.cs (13)
218var vftblPtr = Marshal.PtrToStructure<VftblPtr>(thisPtr); 220IInspectableVftbl = Marshal.PtrToStructure<IInspectable.Vftbl>(vftblPtr.Vftbl); 221GetAt_0 = Marshal.GetDelegateForFunctionPointer(vftbl[6], GetAt_0_Type); 222get_Size_1 = Marshal.GetDelegateForFunctionPointer<_get_PropertyAsUInt32>(vftbl[7]); 223IndexOf_2 = Marshal.GetDelegateForFunctionPointer(vftbl[8], IndexOf_2_Type); 224GetMany_3 = Marshal.GetDelegateForFunctionPointer<IReadOnlyList_Delegates.GetMany_3>(vftbl[9]); 239var nativeVftbl = (IntPtr*)Marshal.AllocCoTaskMem(Marshal.SizeOf<global::WinRT.IInspectable.Vftbl>() + sizeof(IntPtr) * 4); 240Marshal.StructureToPtr(AbiToProjectionVftable.IInspectableVftbl, (IntPtr)nativeVftbl, false); 241nativeVftbl[6] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.GetAt_0); 242nativeVftbl[7] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.get_Size_1); 243nativeVftbl[8] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.IndexOf_2); 244nativeVftbl[9] = Marshal.GetFunctionPointerForDelegate(AbiToProjectionVftable.GetMany_3);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\SecurityHelper.cs (1)
133return Marshal.GetExceptionForHR(hr, new IntPtr(-1));
System\Windows\Controls\PasswordBox.cs (2)
154IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(securePassword); 165System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(ptr);
System\Windows\Controls\Primitives\Popup.cs (2)
2672cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX)) 2770int resultOfGetObject = UnsafeNativeMethods.GetObject(iconInfo.hbmMask.MakeHandleRef(null), Marshal.SizeOf(typeof(NativeMethods.BITMAP)), bm);
System\Windows\Controls\WebBrowser.cs (1)
430if (!Marshal.IsTypeVisibleFromCom(t))
System\windows\Documents\CaretElement.cs (4)
988int win32Error = Marshal.GetLastWin32Error(); 1020int win32Error = Marshal.GetLastWin32Error(); 1074int win32Error = Marshal.GetLastWin32Error(); 1086win32Error = Marshal.GetLastWin32Error();
System\Windows\Documents\FrameworkTextComposition.cs (4)
163Marshal.ReleaseComObject(composition); 166Marshal.ReleaseComObject(context); 177Marshal.ReleaseComObject(context); 325Marshal.ReleaseComObject(enumCompositionView);
System\Windows\Documents\ImmComposition.cs (7)
1324int requestSize = Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)) + (target.Length * sizeof(short)) + ((_maxSrounding + 1) * sizeof(short) * 2); 1333NativeMethods.RECONVERTSTRING reconv = Marshal.PtrToStructure<NativeMethods.RECONVERTSTRING>(lParam); 1338reconv.dwStrOffset = Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)); // in byte count 1355Marshal.StructureToPtr(reconv, lParam, true); 1368p += Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)); 1369Marshal.Copy(surrounding.ToCharArray(), 0, new IntPtr((void*)p), surrounding.Length); 1495NativeMethods.RECONVERTSTRING reconv = Marshal.PtrToStructure<NativeMethods.RECONVERTSTRING>(lParam);
System\Windows\Documents\InputScopeAttribute.cs (9)
56ppinputscopes = Marshal.AllocCoTaskMem(sizeof(Int32) * count); 65Marshal.WriteInt32(ppinputscopes, offset, (Int32)((InputScopeName)_inputScope.Names[i]).NameValue); 71ppinputscopes = Marshal.AllocCoTaskMem(sizeof(Int32) * 1); 72Marshal.WriteInt32(ppinputscopes, (Int32)InputScopeNameValue.Default); 84ppbstrPhrases = Marshal.AllocCoTaskMem(IntPtr.Size * count); 97pbstr = Marshal.StringToBSTR(((InputScopePhrase)_inputScope.PhraseList[i]).Name); 104Marshal.FreeBSTR(Marshal.ReadIntPtr(ppbstrPhrases, offset)); 110Marshal.WriteIntPtr(ppbstrPhrases , offset, pbstr);
System\Windows\Documents\MsSpellCheckLib\SpellChecker\OptionDescription.cs (1)
76Marshal.ReleaseComObject(optionDescription);
System\Windows\Documents\MsSpellCheckLib\SpellChecker\SpellChecker.cs (1)
615Marshal.ReleaseComObject(_speller.Value);
System\Windows\Documents\MsSpellCheckLib\SpellChecker\SpellingError.cs (1)
104Marshal.ReleaseComObject(error);
System\Windows\Documents\MsSpellCheckLib\SpellCheckerFactory\SpellCheckerFactory.cs (1)
122Marshal.ReleaseComObject(Singleton.ComFactory);
System\Windows\Documents\MsSpellCheckLib\Utils\Extensions.cs (4)
59Marshal.ReleaseComObject(enumString); 106Marshal.ReleaseComObject(spellingErrors); 164Marshal.ReleaseComObject(iSpellingError); 176Marshal.ReleaseComObject(spellingErrors);
System\Windows\Documents\NLGSpellerInterop.cs (19)
58Marshal.ReleaseComObject(textContext); 80Marshal.ReleaseComObject(_textChunk); 120Marshal.ReleaseComObject(_textChunk); 167Marshal.ReleaseComObject(options); 173Marshal.ReleaseComObject(textContext); 189IntPtr inputArray = Marshal.AllocHGlobal(count * 2); 194Marshal.Copy(text, 0, inputArray, count); 253Marshal.ReleaseComObject(sentenceEnumerator); 258Marshal.FreeHGlobal(inputArray); 281Marshal.ReleaseComObject(lexicon); 285Marshal.ReleaseComObject(textContext); 340Marshal.ReleaseComObject(lexicon); 348Marshal.ReleaseComObject(textContext); 604suggestions.Add(Marshal.PtrToStringUni(variant.data1)); 609Marshal.ReleaseComObject(variantEnumerator); 759Marshal.ReleaseComObject(_textSegment); 848Marshal.ReleaseComObject(sentence); 988Marshal.ReleaseComObject(lexicon); 992Marshal.ReleaseComObject(textContext);
System\windows\Documents\TextEditor.cs (1)
1540Marshal.ReleaseComObject(threadManager);
System\windows\Documents\TextEditorContextMenu.cs (2)
587Marshal.ReleaseComObject(candString); 653Marshal.ReleaseComObject(CandidateList);
System\Windows\Documents\TextFindEngine.cs (1)
579int win32Error = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
System\Windows\Documents\TextServicesDisplayAttributePropertyRanges.cs (6)
157Marshal.ReleaseComObject(attributeRanges[0]); 176Marshal.ReleaseComObject(attributeRangeEnumerator); 179Marshal.ReleaseComObject(displayAttributeProperty); 229Marshal.ReleaseComObject(catmgr); 253Marshal.ReleaseComObject(dai); 261Marshal.ReleaseComObject(dam);
System\Windows\Documents\TextServicesHost.cs (6)
142Marshal.ReleaseComObject(comp); 171Marshal.ReleaseComObject(comp); 240Marshal.ReleaseComObject(context); 244Marshal.ReleaseComObject(textstore.DocumentManager); 339Marshal.ReleaseComObject(context); 377Marshal.ReleaseComObject(_threadManager);
System\Windows\Documents\TextServicesPropertyRanges.cs (5)
88Marshal.ReleaseComObject(outRangesProp[0]); 90Marshal.ReleaseComObject(rangesProp); 93Marshal.ReleaseComObject(outRanges[0]); 95Marshal.ReleaseComObject(ranges); 97Marshal.ReleaseComObject(prop);
System\Windows\Documents\TextStore.cs (17)
90Marshal.ReleaseComObject(_sink); 109Marshal.ReleaseComObject(_sink); 1449Marshal.ReleaseComObject(editRecord); 1778Marshal.ReleaseComObject(funcReconv); 1783Marshal.ReleaseComObject(range); 1801Marshal.ReleaseComObject(funcReconv); 1806Marshal.ReleaseComObject(range); 1856Marshal.ReleaseComObject(functionPrv); 1860Marshal.ReleaseComObject(funcReconv); 1864Marshal.ReleaseComObject(range); 1865Marshal.ReleaseComObject(context); 2791attrval.val.data1 = Marshal.GetIUnknownForObject(obj); 2806attrval.val.data1 = Marshal.StringToBSTR(familyName); 2922Marshal.ReleaseComObject(range); 2923Marshal.ReleaseComObject(view); 4250Marshal.ReleaseComObject(_range); 4256Marshal.ReleaseComObject(_sink);
System\Windows\Interop\ActiveXHost.cs (1)
588Marshal.FinalReleaseComObject(_axInstance);
System\Windows\Shell\WindowChromeWorker.cs (3)
403var rcClientArea = Marshal.PtrToStructure<RECT>(lParam); 421Marshal.StructureToPtr(rcClientArea, lParam, false); 566var wp = Marshal.PtrToStructure<WINDOWPOS>(lParam);
System\Windows\Standard\ErrorCodes.cs (1)
105return new Win32Error(Marshal.GetLastWin32Error());
System\Windows\Standard\MessageWindow.cs (2)
45cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)), 148var createStruct = Marshal.PtrToStructure<CREATESTRUCT>(lParam);
System\Windows\Standard\NativeMethods.cs (9)
1877cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) 1890cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)) - sizeof(int) 1936public int cbSize = Marshal.SizeOf(typeof(MONITORINFO)); 2155public int length = Marshal.SizeOf(typeof(WINDOWPLACEMENT)); 2330var filterstruct = new CHANGEFILTERSTRUCT { cbSize = (uint)Marshal.SizeOf(typeof(CHANGEFILTERSTRUCT)) }; 2363IntPtr currArg = Marshal.ReadIntPtr(argv, i * IntPtr.Size); 2364result[i] = Marshal.PtrToStringUni(currArg); 3045var hc = new HIGHCONTRAST { cbSize = Marshal.SizeOf(typeof(HIGHCONTRAST)) }; 3207var dti = new DWM_TIMING_INFO { cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO)) };
System\Windows\Standard\Utilities.cs (2)
213Assert.IsTrue(Marshal.IsComObject(t)); 214Marshal.ReleaseComObject(t);
System\Windows\SystemParameters.cs (1)
170cbSize = Marshal.SizeOf(typeof(NativeMethods.HIGHCONTRAST_I))
System\Windows\Window.cs (5)
3949length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT)) 5210placement.length = Marshal.SizeOf(placement); 5900length = Marshal.SizeOf(typeof(NativeMethods.WINDOWPLACEMENT)) 5988cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX)) 7392cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX))
PresentationUI (13)
MS\Internal\Documents\PeoplePickerWrapper.cs (13)
133(uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.QueryInitParams)), 144IntPtr queryInitParamsPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(queryInitParams)); 154Marshal.StructureToPtr(queryInitParams, queryInitParamsPtr, false /*fDeleteOld*/); 168(uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.OpenQueryWindowParams)), 194Marshal.FreeCoTaskMem(queryInitParamsPtr); 325_ptrToDsObjectNames = Marshal.AllocHGlobal(data.Length); 329Marshal.Copy(data, 0, _ptrToDsObjectNames, data.Length); 333_dsObjectNames = Marshal.PtrToStructure<UnsafeNativeMethods.DsObjectNames>(_ptrToDsObjectNames); 422return Marshal.PtrToStringAuto(nameOffset); 455UnsafeNativeMethods.DsObject dsObject = Marshal.PtrToStructure<UnsafeNativeMethods.DsObject>(offset); 479Marshal.FreeHGlobal(_ptrToDsObjectNames); 524Marshal.SizeOf(typeof(UnsafeNativeMethods.DsObject));
ReachFramework (27)
MS\Internal\Printing\Configuration\DevMode.cs (3)
460short dmSize = Marshal.ReadInt16(devModeWPointer, DevMode.DEVMODEW_dmSizeByteOffset); 461short dmExtraSize = Marshal.ReadInt16(devModeWPointer, DevMode.DEVMODEW_dmDriverExtraByteOffset); 465Marshal.Copy(devModeWPointer, devModeWBytes, 0, devModeWByteSize);
MS\Internal\Printing\Configuration\WinSpoolPrinterCapabilities.cs (8)
391return GetArrayCapability<T>(capability, readItem, Marshal.SizeOf(typeof(T))); 446result[i] = (uint)Marshal.ReadInt32(baseAddr, offset); 472result[i] = Marshal.ReadInt16(baseAddr, offset); 498int x = Marshal.ReadInt32(baseAddr, offset); 499int y = Marshal.ReadInt32(baseAddr, offset + (itemByteSize / 2)); 526int w = Marshal.ReadInt32(baseAddr, offset); 527int h = Marshal.ReadInt32(baseAddr, offset + (itemByteSize / 2)); 555string str = Marshal.PtrToStringUni(strAddr, itemByteSize / 2);
PrintConfig\FallbackPTProvider.cs (9)
57throw new PrintQueueException(Marshal.GetLastWin32Error(), "PrintConfig.Provider.BindFail", deviceName); 748IntPtr pPrinterName = Marshal.ReadIntPtr(ptr, 1 * IntPtr.Size); 751PRINTER_INFO_2.pPrinterName = Marshal.PtrToStringUni(pPrinterName); 755IntPtr pPortName = Marshal.ReadIntPtr(ptr, 3 * IntPtr.Size); 758PRINTER_INFO_2.pPortName = Marshal.PtrToStringUni(pPortName); 762IntPtr pDriverName = Marshal.ReadIntPtr(ptr, 4 * IntPtr.Size); 765PRINTER_INFO_2.pDriverName = Marshal.PtrToStringUni(pDriverName); 769IntPtr pDevMode = Marshal.ReadIntPtr(ptr, 7 * IntPtr.Size); 814IntPtr pDevMode = Marshal.ReadIntPtr(pPrinterBuffer.Handle.DangerousGetHandle());
PrintConfig\PTProvider.cs (7)
390IntPtr umDevMode = Marshal.AllocCoTaskMem(devMode.Length); 394Marshal.Copy(devMode, 0, umDevMode, devMode.Length); 424Marshal.FreeCoTaskMem(umDevMode); 476Marshal.Copy(umDevMode, devMode, 0, (int)umDevModeLen); 598Marshal.ReleaseComObject(result); 791Marshal.ThrowExceptionForHR((int)hResult); 801Marshal.ReleaseComObject(stream);
Roslyn.Diagnostics.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
507Marshal.Copy((IntPtr)valuePtr, bytes, 0, bytes.Length);
rzc (2)
ServerProtocol\ServerConnection.cs (2)
347startInfo.cb = Marshal.SizeOf(startInfo); 379ServerLogger.Log("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error());
System.ComponentModel.TypeConverter (2)
System\ComponentModel\ReferenceConverter.cs (1)
101if (!Marshal.IsComObject(value) && value is IComponent comp)
System\ComponentModel\TypeDescriptor.cs (1)
1773Marshal.Release(unknown);
System.Console (53)
_generated\0\LibraryImports.g.cs (51)
38global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 40__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 43global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 73global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 75__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 84global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 105global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 107__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 110global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 232global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 234__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 255global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 394global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 396__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 406global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 436global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 438__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 447global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 480global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 482__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 491global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 524global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 526__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 535global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 568global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 570__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 579global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 609global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 611__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 620global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 650global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 652__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 661global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 691global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 693__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 702global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 723global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 725__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 728global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 758global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 760__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 769global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 802global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 804__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 813global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 835global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 837__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 842global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 911global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 913__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 916global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.Data.Odbc (27)
Common\System\Data\Common\SafeNativeMethods.cs (3)
12var handle = Marshal.AllocHGlobal(initialSize); 19Marshal.FreeHGlobal(ptr); 25Marshal.Copy(zeroes, 0, ptr, length);
Common\System\Data\ProviderBase\DbBuffer.cs (22)
71value = Marshal.PtrToStringUni(ptr); 99value = Marshal.PtrToStringUni(ptr, length); 125value = Marshal.ReadByte(ptr, offset); 158Marshal.Copy(ptr, destination, startIndex, length); 191Marshal.Copy(ptr, destination, startIndex, length); 223value = Marshal.ReadInt16(ptr, offset); 250Marshal.Copy(ptr, destination, startIndex, length); 275value = Marshal.ReadInt32(ptr, offset); 302Marshal.Copy(ptr, destination, startIndex, length); 327value = Marshal.ReadInt64(ptr, offset); 353value = Marshal.ReadIntPtr(ptr, offset); 387ValidateCheck(offset, Marshal.SizeOf(structure.GetType())); 397Marshal.StructureToPtr(structure, ptr, false/*fDeleteOld*/); 421Marshal.WriteByte(ptr, offset, value); 447Marshal.Copy(source, startIndex, ptr, length); 473Marshal.Copy(source, startIndex, ptr, length); 502Marshal.WriteInt16(ptr, offset, value); 528Marshal.Copy(source, startIndex, ptr, length); 552Marshal.WriteInt32(ptr, offset, value); 578Marshal.Copy(source, startIndex, ptr, length); 602Marshal.WriteInt64(ptr, offset, value); 626Marshal.WriteIntPtr(ptr, offset, value);
System\Data\Odbc\OdbcStatementHandle.cs (2)
292IntPtr pwszTableName = Marshal.StringToCoTaskMemUni(tableName); 307Marshal.FreeCoTaskMem(pwszTableName);
System.Data.OleDb (184)
_generated\0\System.Data.Common.UnsafeNativeMethods.ISQLErrorInfo.cs (1)
54global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([116, 58, 115, 12, 28, 42, 206, 17, 173, 229, 0, 170, 0, 68, 119, 61]), (global::System.IntPtr)__this);
_generated\1\System.Data.Common.UnsafeNativeMethods.IErrorInfo.cs (1)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([32, 177, 242, 28, 125, 84, 27, 16, 142, 101, 8, 0, 43, 43, 209, 25]), (global::System.IntPtr)__this);
_generated\2\System.Data.Common.UnsafeNativeMethods.IErrorRecords.cs (5)
58global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([103, 58, 115, 12, 28, 42, 206, 17, 173, 229, 0, 170, 0, 68, 119, 61]), (global::System.IntPtr)__this); 97global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([103, 58, 115, 12, 28, 42, 206, 17, 173, 229, 0, 170, 0, 68, 119, 61]), (global::System.IntPtr)__this); 205global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([103, 58, 115, 12, 28, 42, 206, 17, 173, 229, 0, 170, 0, 68, 119, 61]), (global::System.IntPtr)__this); 262global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([103, 58, 115, 12, 28, 42, 206, 17, 173, 229, 0, 170, 0, 68, 119, 61]), (global::System.IntPtr)__this); 302global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([103, 58, 115, 12, 28, 42, 206, 17, 173, 229, 0, 170, 0, 68, 119, 61]), (global::System.IntPtr)__this);
_generated\3\LibraryImports.g.cs (15)
58global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 60__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 78global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 109global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 111__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 129global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 165global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 167__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 179global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 211global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 213__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 222global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 248global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 250__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 253global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
ColumnBinding.cs (7)
638value = Marshal.PtrToStringBSTR(ptr); 674Marshal.Copy(ptr, value, 0, value.Length); 722value = Marshal.PtrToStringUni(ptr, charCount); 1020value = Marshal.GetObjectForIUnknown(ptr); 1043MethodInfo? mi = typeof(Marshal).GetMethod("GetIDispatchForObject", BindingFlags.Public | BindingFlags.Static); 1067value = Marshal.GetObjectForIUnknown(ptr); 1084IntPtr ptr = Marshal.GetIUnknownForObject(value);
DbPropSet.cs (6)
139IntPtr rgProperties = Marshal.ReadIntPtr(ptr, offset); 142int cProperties = Marshal.ReadInt32(ptr, offset + IntPtr.Size); 190Marshal.PtrToStructure(propertySetPtr, propset); 198Marshal.PtrToStructure(ptr, properties[i]); 254Marshal.StructureToPtr(propset, propsetPtr, false/*deleteold*/); 266Marshal.StructureToPtr(properties[i], propertyPtr, false/*deleteold*/);
OleDb_Util.cs (22)
565internal static readonly int SizeOf_tagDBBINDING = Marshal.SizeOf<tagDBBINDING>(); 566internal static readonly int SizeOf_tagDBCOLUMNINFO = Marshal.SizeOf<tagDBCOLUMNINFO>(); 567internal static readonly int SizeOf_tagDBLITERALINFO = Marshal.SizeOf<tagDBLITERALINFO>(); 568internal static readonly int SizeOf_tagDBPROPSET = Marshal.SizeOf<tagDBPROPSET>(); 569internal static readonly int SizeOf_tagDBPROP = IsRunningOnX86 ? Marshal.SizeOf<tagDBPROP_x86>() : Marshal.SizeOf<tagDBPROP>(); 570internal static readonly int SizeOf_tagDBPROPINFOSET = Marshal.SizeOf<tagDBPROPINFOSET>(); 571internal static readonly int SizeOf_tagDBPROPINFO = IsRunningOnX86 ? Marshal.SizeOf<tagDBPROPINFO_x86>() : Marshal.SizeOf<tagDBPROPINFO>(); 572internal static readonly int SizeOf_tagDBPROPIDSET = Marshal.SizeOf<tagDBPROPIDSET>(); 573internal static readonly int SizeOf_Guid = Marshal.SizeOf<Guid>(); 576internal static readonly int OffsetOf_tagDBPROP_Status = IsRunningOnX86 ? Marshal.OffsetOf(typeof(tagDBPROP_x86), "dwStatus").ToInt32() : Marshal.OffsetOf(typeof(tagDBPROP), "dwStatus").ToInt32(); 577internal static readonly int OffsetOf_tagDBPROP_Value = IsRunningOnX86 ? Marshal.OffsetOf(typeof(tagDBPROP_x86), "vValue").ToInt32() : Marshal.OffsetOf(typeof(tagDBPROP), "vValue").ToInt32(); 578internal static readonly int OffsetOf_tagDBPROPSET_Properties = Marshal.OffsetOf(typeof(tagDBPROPSET), "rgProperties").ToInt32(); 579internal static readonly int OffsetOf_tagDBPROPINFO_Value = IsRunningOnX86 ? Marshal.OffsetOf(typeof(tagDBPROPINFO_x86), "vValue").ToInt32() : Marshal.OffsetOf(typeof(tagDBPROPINFO), "vValue").ToInt32(); 580internal static readonly int OffsetOf_tagDBPROPIDSET_PropertySet = Marshal.OffsetOf(typeof(tagDBPROPIDSET), "guidPropertySet").ToInt32(); 581internal static readonly int OffsetOf_tagDBLITERALINFO_it = Marshal.OffsetOf(typeof(tagDBLITERALINFO), "it").ToInt32(); 582internal static readonly int OffsetOf_tagDBBINDING_obValue = Marshal.OffsetOf(typeof(tagDBBINDING), "obValue").ToInt32(); 583internal static readonly int OffsetOf_tagDBBINDING_wType = Marshal.OffsetOf(typeof(tagDBBINDING), "wType").ToInt32();
OleDbCommand.cs (2)
558Marshal.ReleaseComObject(ict); 733Marshal.ReleaseComObject(executeResult);
OleDbConnectionInternal.cs (7)
281Marshal.ReleaseComObject(unknown); 425tag = Marshal.PtrToStructure<tagDBLITERALINFO>((IntPtr)offset)!; 549if ((1 == literalCount) && Marshal.ReadInt32(literalInfo, ODB.OffsetOf_tagDBLITERALINFO_it) == literal) 551literalValue = Marshal.PtrToStringUni(Marshal.ReadIntPtr(literalInfo, 0)); 602supportedSchemas[i]._schemaRowset = Marshal.PtrToStructure<Guid>(ptr)!; 609supportedSchemas[i]._restrictions = Marshal.ReadInt32(schemaRestrictions, i * 4);
OleDbDataReader.cs (7)
505Marshal.PtrToStructure(ADP.IntPtrOffset(columnInfos, offset), dbColumnInfo); 566info.idname = Marshal.PtrToStringUni(dbColumnInfo.columnid.ulPropid); 629Marshal.ReleaseComObject(rowset); 692Marshal.ReleaseComObject(multipleResults); 777Marshal.ReleaseComObject(imultipleResults); 796Marshal.ReleaseComObject(irowset); 807Marshal.ReleaseComObject(irow);
OleDbStruct.cs (2)
52builder.Append("pwszDataSourceType =").Append(Marshal.PtrToStringUni(pwszDataSourceType)).Append(Environment.NewLine); 80builder.AppendLine($"pwszDataSourceType ={Marshal.PtrToStringUni(pwszDataSourceType)}");
OleDbTransaction.cs (1)
202Marshal.ReleaseComObject(wrapper);
OleDbWrapper.cs (39)
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 = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IDataInitializeGetDataSource>(method); 82Marshal.InitHandle(newWrapper, handle); 138IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 139IntPtr method = Marshal.ReadIntPtr(vtable, 0); 146if ((null == QueryInterface) || (method != Marshal.GetFunctionPointerForDelegate(QueryInterface))) 148QueryInterface = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IUnknownQueryInterface>(method); 155vtable = Marshal.ReadIntPtr(base.handle, 0); 156method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); // Initialize is the 4'th vtable entry 163if ((null == Initialize) || (method != Marshal.GetFunctionPointerForDelegate(Initialize))) 165Initialize = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IDBInitializeInitialize>(method); 185vtable = Marshal.ReadIntPtr(idbCreateSession, 0); 186method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); // CreateSession is the 4'th vtable entry 192if ((null == CreateSession) || (method != Marshal.GetFunctionPointerForDelegate(CreateSession))) 194CreateSession = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IDBCreateSessionCreateSession>(method); 221Marshal.InitHandle(newWrapper, handle); 254Marshal.InitHandle(newWrapper, handle); 273Marshal.Release(idbCreateSession); 338IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 339IntPtr method = Marshal.ReadIntPtr(vtable, 0); 340UnsafeNativeMethods.IUnknownQueryInterface QueryInterface = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IUnknownQueryInterface>(method); 349vtable = Marshal.ReadIntPtr(idbCreateCommand, 0); 350method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); 352DangerousIDBCreateCommandCreateCommand = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IDBCreateCommandCreateCommand>(method); 365Marshal.Release(ptr); 383IntPtr vtable = Marshal.ReadIntPtr(base.handle, 0); 384IntPtr method = Marshal.ReadIntPtr(vtable, 3 * IntPtr.Size); 391if ((null == CreateCommand) || (method != Marshal.GetFunctionPointerForDelegate(CreateCommand))) 393CreateCommand = Marshal.GetDelegateForFunctionPointer<UnsafeNativeMethods.IDBCreateCommandCreateCommand>(method); 417nativeICommandText = Marshal.GetIUnknownForObject(icommandText); 426icommandText = Marshal.GetObjectForIUnknown(nativeICommandText); 434Marshal.Release(nativeICommandText); 485Marshal.ReleaseComObject(unknown); 518Marshal.ReleaseComObject(unknown); 549Marshal.ReleaseComObject(unknown); 582Marshal.ReleaseComObject(unknown); 613Marshal.ReleaseComObject(unknown);
PropertyIDSet.cs (5)
26Marshal.WriteIntPtr(base.handle, 0, ptr); 28Marshal.WriteInt32(base.handle, IntPtr.Size, /*propertyid count*/1); 31Marshal.StructureToPtr(propertySet, ptr, false/*deleteold*/); 34Marshal.WriteInt32(base.handle, PropertyIDSetSize, propertyID); 44Marshal.StructureToPtr(propertySets[i], ptr, false/*deleteold*/);
PropertyInfoSet.cs (4)
76Marshal.PtrToStructure(setPtr, propinfoset); 82Marshal.PtrToStructure(infoPtr, propinfo); 120IntPtr infoPtr = Marshal.ReadIntPtr(ptr, offset); 123int infoCount = Marshal.ReadInt32(ptr, offset + IntPtr.Size);
RowBinding.cs (17)
138Marshal.StructureToPtr(dbbindings[i], ptr, false/*deleteold*/); 183value = Marshal.GetObjectForNativeVariant(buffer); 217Marshal.GetNativeVariantForObject(value, buffer); 260Marshal.WriteIntPtr(base.handle, offset, ptr); 261Marshal.WriteIntPtr(base.handle, offset + IntPtr.Size, ptr); 299Marshal.WriteIntPtr(base.handle, offset, pinnedValue); // parameter input value 300Marshal.WriteIntPtr(base.handle, offset + IntPtr.Size, pinnedValue); // original parameter value 401int valueOffset = _headerLength + Marshal.ReadIntPtr(ptr, ODB.OffsetOf_tagDBBINDING_obValue).ToInt32(); 402short wtype = Marshal.ReadInt16(ptr, ODB.OffsetOf_tagDBBINDING_wType); 490IntPtr currentValue = Marshal.ReadIntPtr(buffer, valueOffset); 491IntPtr originalValue = Marshal.ReadIntPtr(buffer, valueOffset + IntPtr.Size); 503Marshal.WriteIntPtr(buffer, valueOffset, IntPtr.Zero); 504Marshal.WriteIntPtr(buffer, valueOffset + IntPtr.Size, IntPtr.Zero); 519IntPtr currentValue = Marshal.ReadIntPtr(buffer, valueOffset); 520IntPtr originalValue = Marshal.ReadIntPtr(buffer, valueOffset + IntPtr.Size); 529Marshal.WriteIntPtr(buffer, valueOffset, IntPtr.Zero); 530Marshal.WriteIntPtr(buffer, valueOffset + IntPtr.Size, IntPtr.Zero);
SafeHandles.cs (12)
196hr = (OleDbHResult)Marshal.QueryInterface(ptr, ref IID_IChapteredRowset, out var pChapteredRowset); 200var chapteredRowset = (System.Data.Common.UnsafeNativeMethods.IChapteredRowset)Marshal.GetObjectForIUnknown(pChapteredRowset); 202Marshal.ReleaseComObject(chapteredRowset); 203Marshal.Release(pChapteredRowset); 219hr = (OleDbHResult)Marshal.QueryInterface(ptr, ref IID_ITransactionLocal, out var pTransaction); 223ITransactionLocal transactionLocal = (ITransactionLocal)Marshal.GetObjectForIUnknown(pTransaction); 225Marshal.ReleaseComObject(transactionLocal); 226Marshal.Release(pTransaction); 242hr = (OleDbHResult)Marshal.QueryInterface(ptr, ref IID_ITransactionLocal, out var pTransaction); 246ITransactionLocal transactionLocal = (ITransactionLocal)Marshal.GetObjectForIUnknown(pTransaction); 248Marshal.ReleaseComObject(transactionLocal); 249Marshal.Release(pTransaction);
SafeNativeMethods.cs (1)
18Marshal.Copy(zeroes, 0, ptr, length);
System\Data\ProviderBase\DbBuffer.cs (21)
72value = Marshal.PtrToStringUni(ptr, length); 98value = Marshal.ReadByte(ptr, offset); 131Marshal.Copy(ptr, destination, startIndex, length); 164Marshal.Copy(ptr, destination, startIndex, length); 196value = Marshal.ReadInt16(ptr, offset); 223Marshal.Copy(ptr, destination, startIndex, length); 248value = Marshal.ReadInt32(ptr, offset); 275Marshal.Copy(ptr, destination, startIndex, length); 300value = Marshal.ReadInt64(ptr, offset); 326value = Marshal.ReadIntPtr(ptr, offset); 360ValidateCheck(offset, Marshal.SizeOf<T>()); 370Marshal.StructureToPtr<T>(structure, ptr, false/*fDeleteOld*/); 394Marshal.WriteByte(ptr, offset, value); 420Marshal.Copy(source, startIndex, ptr, length); 446Marshal.Copy(source, startIndex, ptr, length); 475Marshal.WriteInt16(ptr, offset, value); 501Marshal.Copy(source, startIndex, ptr, length); 525Marshal.WriteInt32(ptr, offset, value); 551Marshal.Copy(source, startIndex, ptr, length); 575Marshal.WriteInt64(ptr, offset, value); 599Marshal.WriteIntPtr(ptr, offset, value);
System\Data\ProviderBase\DbConnectionPool.cs (4)
1133waitForMultipleObjectsExHR = Marshal.GetHRForLastWin32Error(); 1239Marshal.ThrowExceptionForHR(waitForMultipleObjectsExHR); 1262releaseSemaphoreResult = Marshal.GetHRForLastWin32Error(); 1272Marshal.ThrowExceptionForHR(releaseSemaphoreResult); // will only throw if (hresult < 0)
System\Data\ProviderBase\DbConnectionPoolIdentity.cs (2)
68int lastError = Marshal.GetHRForLastWin32Error(); 71Marshal.ThrowExceptionForHR(lastError); // will only throw if (hresult < 0)
System\Data\ProviderBase\WrappedIUnknown.cs (3)
30base.handle = Marshal.GetIUnknownForObject(unknown); 55value = Marshal.GetObjectForIUnknown(handle); 74Marshal.Release(ptr);
System.Diagnostics.EventLog (283)
_generated\0\LibraryImports.g.cs (153)
30global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 32__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 53global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 89global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 91__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 104global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 149global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 151__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 174global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 209global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 211__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 223global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 255global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 257__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 269global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 330global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 332__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 344global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 378global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 380__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 392global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 429global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 431__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 452global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 487global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 489__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 501global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 536global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 538__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 550global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 585global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 587__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 599global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 633global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 635__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 656global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 690global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 692__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 713global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 748global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 750__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 762global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 796global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 798__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 819global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 855global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 857__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 869global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 903global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 905__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 926global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 962global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 964__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 976global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1012global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1014__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1035global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1067global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1069__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1081global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1115global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1117__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1129global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1164global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1166__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1178global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1214global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1216__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1237global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1272global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1274__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1286global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1322global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1324__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1336global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1370global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1372__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1384global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1419global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1421__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1433global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1481global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1483__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1514global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1556global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1558__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1571global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1612global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1614__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1627global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1683global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1685__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1714global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1753global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1755__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1768global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1802global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1804__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1827global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1857global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1859__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1877global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1913global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1915__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1928global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1951global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1953__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1958global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1993global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1995__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2007global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2031global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2033__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2038global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2062global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2064__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2069global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2105global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2107__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2119global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2155global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2157__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2169global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2199global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2201__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2204global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2241global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2243__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2256global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2288global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2290__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2308global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2347global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2349__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2361global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2393global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2395__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2413global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2449global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2451__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2463global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2498global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2500__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2509global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2533global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2535__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2540global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2571global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2573__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2591global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2623global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2625__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2634global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
System\Diagnostics\EventLog.cs (2)
660else if (Marshal.GetLastWin32Error() != Interop.Errors.ERROR_INVALID_PARAMETER) 918lastError = Marshal.GetLastWin32Error();
System\Diagnostics\EventLogInternal.cs (5)
469int error = Marshal.GetLastWin32Error(); 731error = Marshal.GetLastWin32Error(); 907int error = Marshal.GetLastWin32Error(); 1078if (Marshal.GetLastWin32Error() != 0) 1103if (Marshal.GetLastWin32Error() != 0)
System\Diagnostics\Reader\CoTaskMemSafeHandle.cs (1)
38Marshal.FreeCoTaskMem(handle);
System\Diagnostics\Reader\CoTaskMemUnicodeSafeHandle.cs (1)
44Marshal.ZeroFreeCoTaskMemUnicode(handle);
System\Diagnostics\Reader\NativeWrapper.cs (109)
59int win32Error = Marshal.GetLastWin32Error(); 77int win32Error = Marshal.GetLastWin32Error(); 91int win32Error = Marshal.GetLastWin32Error(); 101int win32Error = Marshal.GetLastWin32Error(); 126int win32Error = Marshal.GetLastWin32Error(); 140int win32Error = Marshal.GetLastWin32Error(); 149int win32Error = Marshal.GetLastWin32Error(); 163int win32Error = Marshal.GetLastWin32Error(); 179int win32Error = Marshal.GetLastWin32Error(); 192int win32Error = Marshal.GetLastWin32Error(); 205int win32Error = Marshal.GetLastWin32Error(); 218int win32Error = Marshal.GetLastWin32Error(); 226int win32Error = Marshal.GetLastWin32Error(); 245int win32Error = Marshal.GetLastWin32Error(); 258int win32Error = Marshal.GetLastWin32Error(); 271int win32Error = Marshal.GetLastWin32Error(); 282int win32Error = Marshal.GetLastWin32Error(); 300int win32Error = Marshal.GetLastWin32Error(); 308win32Error = Marshal.GetLastWin32Error(); 326int win32Error = Marshal.GetLastWin32Error(); 335int win32Error = Marshal.GetLastWin32Error(); 348int win32Error = Marshal.GetLastWin32Error(); 361int error = Marshal.GetLastWin32Error(); 370buffer = Marshal.AllocHGlobal((int)bufferNeeded); 372error = Marshal.GetLastWin32Error(); 376UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 382Marshal.FreeHGlobal(buffer); 393int error = Marshal.GetLastWin32Error(); 399buffer = Marshal.AllocHGlobal((int)bufferNeeded); 401error = Marshal.GetLastWin32Error(); 405UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 411Marshal.FreeHGlobal(buffer); 423int error = Marshal.GetLastWin32Error(); 429buffer = Marshal.AllocHGlobal((int)bufferNeeded); 431error = Marshal.GetLastWin32Error(); 435UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 441Marshal.FreeHGlobal(buffer); 452int error = Marshal.GetLastWin32Error(); 458buffer = Marshal.AllocHGlobal((int)bufferNeeded); 460error = Marshal.GetLastWin32Error(); 471UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 477Marshal.FreeHGlobal(buffer); 487int error = Marshal.GetLastWin32Error(); 504error = Marshal.GetLastWin32Error(); 532int error = Marshal.GetLastWin32Error(); 539buffer = Marshal.AllocHGlobal((int)bufferNeeded); 541error = Marshal.GetLastWin32Error(); 545UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 551Marshal.FreeHGlobal(buffer); 563int win32Error = Marshal.GetLastWin32Error(); 569buffer = Marshal.AllocHGlobal((int)bufferNeeded); 571win32Error = Marshal.GetLastWin32Error(); 575UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 581Marshal.FreeHGlobal(buffer); 593int win32Error = Marshal.GetLastWin32Error(); 599buffer = Marshal.AllocHGlobal((int)bufferNeeded); 601win32Error = Marshal.GetLastWin32Error(); 612UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 618Marshal.FreeHGlobal(buffer); 643taskMem.SetMemory(Marshal.StringToCoTaskMemUni((string)val)); 650taskMem.SetMemory(Marshal.StringToCoTaskMemUni((string)val)); 693int win32Error = Marshal.GetLastWin32Error(); 703int win32Error = Marshal.GetLastWin32Error(); 718win32Error = Marshal.GetLastWin32Error(); 734int win32Error = Marshal.GetLastWin32Error(); 749win32Error = Marshal.GetLastWin32Error(); 768int win32Error = Marshal.GetLastWin32Error(); 774buffer = Marshal.AllocHGlobal((int)bufferNeeded); 776win32Error = Marshal.GetLastWin32Error(); 780UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(buffer); 786Marshal.FreeHGlobal(buffer); 802int error = Marshal.GetLastWin32Error(); 807buffer = Marshal.AllocHGlobal((int)bufferNeeded); 809int win32Error = Marshal.GetLastWin32Error(); 817UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(pointer); 878pointer = new IntPtr(((long)pointer + Marshal.SizeOf(varVal))); 884Marshal.FreeHGlobal(buffer); 903int error = Marshal.GetLastWin32Error(); 908buffer = Marshal.AllocHGlobal((int)bufferNeeded); 910int win32Error = Marshal.GetLastWin32Error(); 920UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(pointer); 922pointer = new IntPtr(((long)pointer + Marshal.SizeOf(varVal))); 930Marshal.FreeHGlobal(buffer); 939int error = Marshal.GetLastWin32Error(); 960error = Marshal.GetLastWin32Error(); 996int error = Marshal.GetLastWin32Error(); 1008buffer = Marshal.AllocHGlobal(bufferNeeded * 2); 1010error = Marshal.GetLastWin32Error(); 1024string? s = Marshal.PtrToStringUni(pointer); 1037Marshal.FreeHGlobal(buffer); 1051int error = Marshal.GetLastWin32Error(); 1058buffer = Marshal.AllocHGlobal((int)bufferNeeded); 1060error = Marshal.GetLastWin32Error(); 1064return Marshal.PtrToStringUni(buffer)!; 1069Marshal.FreeHGlobal(buffer); 1087int error = Marshal.GetLastWin32Error(); 1108error = Marshal.GetLastWin32Error(); 1164return (val.GuidReference == IntPtr.Zero) ? Guid.Empty : Marshal.PtrToStructure<Guid>(val.GuidReference); 1170UnsafeNativeMethods.SystemTime sysTime = Marshal.PtrToStructure<UnsafeNativeMethods.SystemTime>(val.SystemTime); 1184Marshal.Copy(val.Reference, arByte, 0, (int)val.Count); 1190Marshal.Copy(val.Reference, arInt16, 0, (int)val.Count); 1196Marshal.Copy(val.Reference, arInt32, 0, (int)val.Count); 1202Marshal.Copy(val.Reference, arInt64, 0, (int)val.Count); 1208Marshal.Copy(val.Reference, arSingle, 0, (int)val.Count); 1214Marshal.Copy(val.Reference, arDouble, 0, (int)val.Count); 1261return Marshal.PtrToStringUni(val.StringVal); 1269return Marshal.PtrToStringAnsi(val.AnsiString); 1367stringArray[i] = ansi ? Marshal.PtrToStringAnsi(ptr[i]) : Marshal.PtrToStringUni(ptr[i]);
System\Diagnostics\Reader\UnsafeNativeMethods.cs (12)
391_value.Server = Marshal.StringToCoTaskMemUni(managed.Server); 392_value.User = Marshal.StringToCoTaskMemUni(managed.User); 393_value.Domain = Marshal.StringToCoTaskMemUni(managed.Domain); 418server: Marshal.PtrToStringUni(_value.Server)!, 419user: Marshal.PtrToStringUni(_value.User), 420domain: Marshal.PtrToStringUni(_value.Domain), 428Marshal.FreeCoTaskMem(_value.Server); 429Marshal.FreeCoTaskMem(_value.User); 430Marshal.FreeCoTaskMem(_value.Domain); 741StringVal = Marshal.StringToCoTaskMemUni(managed.StringVal); 750StringVal = Marshal.PtrToStringUni(StringVal), 758Marshal.FreeCoTaskMem(StringVal);
System.Diagnostics.FileVersionInfo (11)
_generated\0\LibraryImports.g.cs (9)
50global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 52__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 61global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 94global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 96__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 105global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 138global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 140__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 149global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.Diagnostics.PerformanceCounter (68)
_generated\0\LibraryImports.g.cs (49)
15global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 17__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 20global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 142global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 144__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 149global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 176global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 178__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 183global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 269global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 271__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 292global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 324global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 326__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 344global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 383global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 385__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 407global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 431global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 433__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 438global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 504global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 506__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 518global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 543global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 545__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 548global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 583global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 585__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 606global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 640global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 642__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 660global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 692global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 694__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 712global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 736global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 738__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 743global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 777global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 779__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 788global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 820global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 822__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 831global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 898__ControlCallback_native = ControlCallback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(ControlCallback) : default; 956global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 958__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 967global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.PERF_INFO.cs (5)
18internal static readonly int SizeOf = Marshal.SizeOf<PERF_COUNTER_BLOCK>(); 44internal static readonly int SizeOf = Marshal.SizeOf<PERF_COUNTER_DEFINITION>(); 81internal static readonly int SizeOf = Marshal.SizeOf<PERF_DATA_BLOCK>(); 107internal static readonly int SizeOf = Marshal.SizeOf<PERF_INSTANCE_DEFINITION>(); 144internal static readonly int SizeOf = Marshal.SizeOf<PERF_OBJECT_TYPE>();
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.ProcessWaitHandle.cs (2)
29int error = Marshal.GetHRForLastWin32Error(); 31Marshal.ThrowExceptionForHR(error);
System\Diagnostics\PerformanceCounterLib.cs (2)
1274throw new Win32Exception(Marshal.GetHRForException(e)); 1309error = Marshal.GetHRForException(e);
System\Diagnostics\PerformanceData\CounterSetInstance.cs (1)
37int Status = (int)((_nativeInst != null) ? Interop.Errors.ERROR_SUCCESS : Marshal.GetLastWin32Error());
System\Diagnostics\PerformanceData\CounterSetInstanceCounterDataSet.cs (2)
125_dataBlock = (byte*)Marshal.AllocHGlobal(_instance._counterSet._idToCounter.Count * sizeof(long)); 183Marshal.FreeHGlobal((IntPtr)_dataBlock);
System\Diagnostics\SharedPerformanceCounter.cs (5)
1305int error = Marshal.GetLastWin32Error(); 1717if ((Marshal.GetLastWin32Error() != Interop.Errors.ERROR_ACCESS_DENIED) || !_fileMappingHandle.IsInvalid) 1727if ((Marshal.GetLastWin32Error() != Interop.Errors.ERROR_FILE_NOT_FOUND) || !_fileMappingHandle.IsInvalid) 1764Marshal.FreeHGlobal((IntPtr)pSecurityDescriptor); 1781Marshal.Copy(tmp, 0, (nint)nativePointer, tmp.Length);
System.Diagnostics.Process (98)
_generated\0\LibraryImports.g.cs (90)
48global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 50__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 53global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 86global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 88__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 97global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 132global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 134__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 146global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 179global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 181__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 190global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 223global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 225__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 234global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 258global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 260__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 263global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 294global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 296__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 305global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 335global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 337__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 346global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 367global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 369__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 372global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 393global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 395__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 398global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 419global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 421__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 424global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 461global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 463__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 473global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 503global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 505__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 514global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 600global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 602__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 605global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 626global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 628__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 631global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 661global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 663__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 668global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 737global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 739__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 742global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 772global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 774__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 779global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 843global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 845__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 854global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 894global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 896__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 899global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 922global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 924__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 927global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 957global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 959__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 968global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 989global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 991__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 994global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1020global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1022__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1025global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1055global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1057__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1066global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1213global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1215__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1224global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1254global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1256__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1265global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1297global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1299__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1318global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1349global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1351__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1354global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1378global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1380__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1383global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.ForkAndExecProcess.cs (1)
83return result == 0 ? 0 : Marshal.GetLastPInvokeError();
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetSetPriority.cs (1)
35return Marshal.GetLastPInvokeError();
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
48error = Marshal.GetLastPInvokeError(); 66Marshal.SetLastPInvokeError(error);
System\Diagnostics\ProcessWaitState.Unix.cs (2)
602int errorCode = Marshal.GetLastWin32Error(); 648int errorCode = Marshal.GetLastWin32Error();
System.DirectoryServices (348)
_generated\0\LibraryImports.g.cs (57)
161global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 163__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 179global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 206global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 208__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 211global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 235global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 237__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 242global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 332global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 334__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 339global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 363global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 365__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 370global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 393global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 395__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 398global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 422global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 424__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 429global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 457global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 459__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 462global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 485global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 487__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 490global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 596global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 598__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 601global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 642global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 644__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 662global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 892global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 894__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 913global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 944global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 946__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 965global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 989global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 991__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 996global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1020global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1022__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1027global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1053global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1055__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1058global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1082global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1084__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1089global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1229global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1231__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1234global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1268global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1270__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1273global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Interop\AdsValueHelper2.cs (10)
134Marshal.PtrToStructure(adsvalue.pointer.value, dnb); 137Marshal.Copy(dnb.lpBinaryValue, bytes, 0, dnb.dwLength); 157strb.Append(Marshal.PtrToStringUni(dnb.pszDNString)); 165Marshal.PtrToStructure(adsvalue.pointer.value, dns); 166string strValue = Marshal.PtrToStringUni(dns.pszStringValue) ?? string.Empty; 168return $"S:{strValue.Length}:{strValue}:{Marshal.PtrToStringUni(dns.pszDNString)}"; 178return Marshal.PtrToStringUni(adsvalue.pointer.value)!; 194Marshal.Copy(adsvalue.octetString.value, value, 0, len); 228Marshal.PtrToStructure(adsvalue.octetString.value, vlv); 234Marshal.Copy(vlv.contextID, bytes, 0, vlv.contextIDlength);
Interop\EnumVariant.cs (1)
74_currentValue = Marshal.GetObjectForNativeVariant((IntPtr)(&variant))!;
Interop\UnsafeNativeMethods.cs (2)
22ppObject = ppObjectNative != IntPtr.Zero ? Marshal.GetObjectForIUnknown(ppObjectNative) : null!; 29Marshal.Release(ppObjectNative);
System\DirectoryServices\ActiveDirectory\ActiveDirectoryReplicationMetaData.cs (2)
67addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf<DS_REPL_ATTR_META_DATA_2>()); 74addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf<DS_REPL_ATTR_META_DATA>());
System\DirectoryServices\ActiveDirectory\ActiveDirectorySite.cs (8)
210string siteName = Marshal.PtrToStringUni(ptr)!; 224Marshal.FreeHGlobal(ptr); 1312throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1325Marshal.PtrToStructure((IntPtr)pDomains, names); 1334tmpPtr = IntPtr.Add(val, Marshal.SizeOf<DS_NAME_RESULT_ITEM>() * i); 1336Marshal.PtrToStructure(tmpPtr, nameResult); 1339string? domainName = Marshal.PtrToStringUni(nameResult.pName); 1356throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError());
System\DirectoryServices\ActiveDirectory\AttributeMetaData.cs (5)
24Marshal.PtrToStructure(info, attrMetaData); 27Name = Marshal.PtrToStringUni(attrMetaData.pszAttributeName)!; 34_pszLastOriginatingDsaDN = Marshal.PtrToStringUni(attrMetaData.pszLastOriginatingDsaDN); 39Marshal.PtrToStructure(info, attrMetaData); 42Name = Marshal.PtrToStringUni(attrMetaData.pszAttributeName)!;
System\DirectoryServices\ActiveDirectory\DirectoryContext.cs (2)
580Marshal.PtrToStructure(pResponseBuffer, responseBuffer); 689throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError());
System\DirectoryServices\ActiveDirectory\DirectoryServer.cs (21)
288throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 312throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 336throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 401Marshal.PtrToStructure(info, cursors); 435Marshal.PtrToStructure(info, cursors); 461Marshal.PtrToStructure(info, operations); 488Marshal.PtrToStructure(info, neighbors); 512Marshal.PtrToStructure(info, failures); 537Marshal.PtrToStructure(info, objMetaData); 556Marshal.PtrToStructure(info, objMetadata); 587Marshal.PtrToStructure(update, syncAllUpdate); 614Marshal.PtrToStructure(temp, sync); 616targetName = Marshal.PtrToStringUni(sync.pszDstId); 617sourceName = Marshal.PtrToStringUni(sync.pszSrcId); 639throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 645IntPtr syncAllFunctionPointer = Marshal.GetFunctionPointerForDelegate(syncAllCallback); 684throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 698unmanagedGuid = Marshal.AllocHGlobal(structSize); 715Marshal.StructureToPtr(guid, unmanagedGuid, false); 722throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 750Marshal.FreeHGlobal(unmanagedGuid);
System\DirectoryServices\ActiveDirectory\Domain.cs (3)
1304obj.DnsDomainName = Marshal.PtrToStringUni(unmanagedTrust.DnsDomainName); 1306obj.NetbiosDomainName = Marshal.PtrToStringUni(unmanagedTrust.NetbiosDomainName); 1339localDomainParent = Marshal.PtrToStringUni(parentTrust.DnsDomainName);
System\DirectoryServices\ActiveDirectory\DomainController.cs (11)
1063throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1090Marshal.PtrToStructure(currentDc, domainControllerInfo3); 1107currentDc = IntPtr.Add(currentDc, Marshal.SizeOf(domainControllerInfo3)); 1112Marshal.PtrToStructure(currentDc, domainControllerInfo2); 1129currentDc = IntPtr.Add(currentDc, Marshal.SizeOf(domainControllerInfo2)); 1147throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1235throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1244Marshal.PtrToStructure(rolesPtr, dsNameResult); 1249Marshal.PtrToStructure(currentItem, dsNameResultItem); 1262currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(dsNameResultItem)); 1274throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError());
System\DirectoryServices\ActiveDirectory\Exception.cs (12)
423Marshal.PtrToStructure(errorInfo, error); 425string? source = Marshal.PtrToStringUni(error.pszSrcId); 426string? target = Marshal.PtrToStringUni(error.pszSvrId); 442IntPtr tempPtr = Marshal.ReadIntPtr(errorInfo); 448Marshal.PtrToStructure(tempPtr, error); 453string? source = Marshal.PtrToStringUni(error.pszSrcId); 454string? target = Marshal.PtrToStringUni(error.pszSvrId); 461tempPtr = Marshal.ReadIntPtr(errorInfo, i * IntPtr.Size); 482Marshal.PtrToStructure(collisionInfo, collision); 488addr = Marshal.ReadIntPtr(collision.Entries, i * IntPtr.Size); 490Marshal.PtrToStructure(addr, record); 493string recordName = Marshal.PtrToStringUni(record.Name.Buffer, record.Name.Length / 2);
System\DirectoryServices\ActiveDirectory\Forest.cs (7)
855throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 864Marshal.PtrToStructure(sitesPtr, dsNameResult); 871Marshal.PtrToStructure(currentItem, dsNameResultItem); 879currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(dsNameResultItem)); 891throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1118tmpDNSName = Marshal.PtrToStringUni(unmanagedTrust.DnsDomainName); 1120tmpNetBIOSName = Marshal.PtrToStringUni(unmanagedTrust.NetbiosDomainName);
System\DirectoryServices\ActiveDirectory\ForestTrustDomainInformation.cs (3)
26DnsName = Marshal.PtrToStringUni(domainInfo.DNSNameBuffer, domainInfo.DNSNameLength / 2); 27NetBiosName = Marshal.PtrToStringUni(domainInfo.NetBIOSNameBuffer, domainInfo.NetBIOSNameLength / 2); 33throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError());
System\DirectoryServices\ActiveDirectory\ForestTrustRelationshipInformation.cs (45)
33tmpDNSName = Marshal.PtrToStringUni(unmanagedTrust.DnsDomainName); 35tmpNetBIOSName = Marshal.PtrToStringUni(unmanagedTrust.NetbiosDomainName); 110records = Marshal.AllocHGlobal(count * IntPtr.Size); 118fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 123Marshal.PtrToStructure(fileTime, currentTime); 133ptr = Marshal.StringToHGlobalUni(TLN.Name); 137tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 139Marshal.StructureToPtr(record, tmpPtr, false); 141Marshal.WriteIntPtr(records, IntPtr.Size * currentCount, tmpPtr); 163ptr = Marshal.StringToHGlobalUni(_excludedNames[i]); 166tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 168Marshal.StructureToPtr(record, tmpPtr, false); 170Marshal.WriteIntPtr(records, IntPtr.Size * currentCount, tmpPtr); 187throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 191record.DomainInfo.DNSNameBuffer = Marshal.StringToHGlobalUni(tmp.DnsName); 195record.DomainInfo.NetBIOSNameBuffer = Marshal.StringToHGlobalUni(tmp.NetBiosName); 199tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 201Marshal.StructureToPtr(record, tmpPtr, false); 203Marshal.WriteIntPtr(records, IntPtr.Size * currentCount, tmpPtr); 221record.Data.Buffer = Marshal.AllocHGlobal(record.Data.Length); 223Marshal.Copy((byte[])_binaryData[i]!, 0, record.Data.Buffer, record.Data.Length); 225tmpPtr = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_RECORD>()); 227Marshal.StructureToPtr(record, tmpPtr, false); 229Marshal.WriteIntPtr(records, IntPtr.Size * currentCount, tmpPtr); 238forestInfo = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_FOREST_TRUST_INFORMATION>()); 239Marshal.StructureToPtr(trustInformation, forestInfo, false); 252target = Marshal.StringToHGlobalUni(TargetName); 286Marshal.FreeHGlobal((IntPtr)ptrList[i]!); 296Marshal.FreeHGlobal(records); 301Marshal.FreeHGlobal(forestInfo); 308Marshal.FreeHGlobal(target); 311Marshal.FreeHGlobal(fileTime); 341targetPtr = Marshal.StringToHGlobalUni(TargetName); 368Marshal.PtrToStructure(forestTrustInfo, trustInfo); 374addr = Marshal.ReadIntPtr(trustInfo.Entries, i * IntPtr.Size); 376Marshal.PtrToStructure(addr, record); 390string excludedName = Marshal.PtrToStringUni(record.TopLevelName.Buffer, record.TopLevelName.Length / 2); 409Marshal.Copy(record.Data.Buffer, byteArray, 0, length); 442Marshal.FreeHGlobal(targetPtr);
System\DirectoryServices\ActiveDirectory\Locator.cs (3)
52Marshal.PtrToStructure(pDomainControllerInfo, domainControllerInfo); 159dcDnsHostName = Marshal.PtrToStringUni(dcDnsHostNamePtr)!; 171Marshal.FreeHGlobal(sockAddressList);
System\DirectoryServices\ActiveDirectory\NativeMethods.cs (1)
166osVersionInfoSize = (int)Marshal.SizeOf(this);
System\DirectoryServices\ActiveDirectory\ReplicationCursor.cs (1)
29_serverDN = Marshal.PtrToStringUni(dn);
System\DirectoryServices\ActiveDirectory\ReplicationCursorCollection.cs (4)
58addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf<DS_REPL_CURSOR_3>()); 60Marshal.PtrToStructure(addr, cursor); 72addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf<DS_REPL_CURSOR>()); 74Marshal.PtrToStructure(addr, cursor);
System\DirectoryServices\ActiveDirectory\ReplicationFailure.cs (2)
21Marshal.PtrToStructure(addr, failure); 23_sourceDsaDN = Marshal.PtrToStringUni(failure.pszDsaDN);
System\DirectoryServices\ActiveDirectory\ReplicationFailureCollection.cs (1)
55addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf<DS_REPL_KCC_DSA_FAILURE>());
System\DirectoryServices\ActiveDirectory\ReplicationNeighbor.cs (4)
46Marshal.PtrToStructure(addr, neighbor); 48PartitionName = Marshal.PtrToStringUni(neighbor.pszNamingContext); 49_sourceServerDN = Marshal.PtrToStringUni(neighbor.pszSourceDsaDN); 51string? transportDN = Marshal.PtrToStringUni(neighbor.pszAsyncIntersiteTransportDN);
System\DirectoryServices\ActiveDirectory\ReplicationNeighborCollection.cs (1)
55addr = IntPtr.Add(info, sizeof(int) * 2 + i * Marshal.SizeOf<DS_REPL_NEIGHBOR>());
System\DirectoryServices\ActiveDirectory\ReplicationOperation.cs (3)
20Marshal.PtrToStructure(addr, operation); 35PartitionName = Marshal.PtrToStringUni(operation.pszNamingContext); 38_dsaDN = Marshal.PtrToStringUni(operation.pszDsaDN);
System\DirectoryServices\ActiveDirectory\ReplicationOperationCollection.cs (2)
55addr = IntPtr.Add(info, Marshal.SizeOf<DS_REPL_PENDING_OPS>() + i * Marshal.SizeOf<DS_REPL_OP>());
System\DirectoryServices\ActiveDirectory\TopLevelName.cs (1)
25Name = Marshal.PtrToStringUni(val.Buffer, val.Length / 2);
System\DirectoryServices\ActiveDirectory\TrustHelper.cs (59)
50target = Marshal.StringToHGlobalUni(targetName); 114Marshal.FreeHGlobal(target); 144target = Marshal.StringToHGlobalUni(targetName); 221newInfo = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX)); 222Marshal.StructureToPtr(domainInfo, newInfo, false); 238Marshal.FreeHGlobal(target); 244Marshal.FreeHGlobal(newInfo); 270target = Marshal.StringToHGlobalUni(targetName); 319Marshal.FreeHGlobal(target); 349target = Marshal.StringToHGlobalUni(targetName); 356data = Marshal.StringToHGlobalUni(targetName); 359data = Marshal.StringToHGlobalUni(targetName + "\\" + preferredTargetServer); 360ptr = Marshal.AllocHGlobal(IntPtr.Size); 361Marshal.WriteIntPtr(ptr, data); 370Marshal.PtrToStructure(buffer1, info); 420Marshal.FreeHGlobal(target); 423Marshal.FreeHGlobal(ptr); 426Marshal.FreeHGlobal(data); 457Marshal.PtrToStructure(info, domainInfo); 460fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 465Marshal.PtrToStructure(fileTime, tmp); 471unmanagedPassword = Marshal.StringToHGlobalUni(password); 475unmanagedAuthData = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_AUTH_INFORMATION>()); 476Marshal.StructureToPtr(AuthData, unmanagedAuthData, false); 538Marshal.FreeHGlobal(fileTime); 547Marshal.FreeHGlobal(unmanagedPassword); 550Marshal.FreeHGlobal(unmanagedAuthData); 582target = Marshal.StringToHGlobalUni(targetName); 613fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 618Marshal.PtrToStructure(fileTime, tmp); 624unmanagedPassword = Marshal.StringToHGlobalUni(password); 628unmanagedAuthData = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_AUTH_INFORMATION>()); 629Marshal.StructureToPtr(AuthData, unmanagedAuthData, false); 648newBuffer = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION)); 649Marshal.StructureToPtr(domainInfo, newBuffer, false); 665Marshal.FreeHGlobal(target); 671Marshal.FreeHGlobal(newBuffer); 674Marshal.FreeHGlobal(fileTime); 677Marshal.FreeHGlobal(unmanagedPassword); 680Marshal.FreeHGlobal(unmanagedAuthData); 711target = Marshal.StringToHGlobalUni(targetName); 739fileTime = Marshal.AllocHGlobal(Marshal.SizeOf<FileTime>()); 744Marshal.PtrToStructure(fileTime, tmp); 750unmanagedPassword = Marshal.StringToHGlobalUni(password); 754unmanagedAuthData = Marshal.AllocHGlobal(Marshal.SizeOf<LSA_AUTH_INFORMATION>()); 755Marshal.StructureToPtr(AuthData, unmanagedAuthData, false); 789newBuffer = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION)); 790Marshal.StructureToPtr(domainInfo, newBuffer, false); 806Marshal.FreeHGlobal(target); 812Marshal.FreeHGlobal(newBuffer); 815Marshal.FreeHGlobal(fileTime); 818Marshal.FreeHGlobal(unmanagedPassword); 821Marshal.FreeHGlobal(unmanagedAuthData);
System\DirectoryServices\ActiveDirectory\Utils.cs (51)
119throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 122IntPtr name = Marshal.StringToHGlobalUni(distinguishedName); 123IntPtr ptr = Marshal.AllocHGlobal(IntPtr.Size); 124Marshal.WriteIntPtr(ptr, name); 132Marshal.PtrToStructure(results, dsNameResult); 136Marshal.PtrToStructure(dsNameResult.items, dsNameResultItem); 162Marshal.FreeHGlobal(ptr); 165Marshal.FreeHGlobal(name); 174throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 214throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 216IntPtr name = Marshal.StringToHGlobalUni(dnsName + "/"); 217IntPtr ptr = Marshal.AllocHGlobal(IntPtr.Size); 218Marshal.WriteIntPtr(ptr, name); 226Marshal.PtrToStructure(results, dsNameResult); 231Marshal.PtrToStructure(dsNameResult.items, dsNameResultItem); 238Marshal.FreeHGlobal(ptr); 241Marshal.FreeHGlobal(name); 249throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 643throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 672throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 694throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 721throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 879stringGuid = Marshal.PtrToStringUni(ptr); 966throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 973result = Marshal.GetLastPInvokeError(); 990throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 996throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1009throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 1866throw ExceptionHelper.GetExceptionFromErrorCode(Marshal.GetLastPInvokeError()); 2021Marshal.FreeHGlobal(pCopyOfUserSid); 2024Marshal.FreeHGlobal(pMachineDomainSid); 2049if ((error = Marshal.GetLastPInvokeError()) == 1008) // ERROR_NO_TOKEN 2061int lastError = Marshal.GetLastPInvokeError(); 2085if ((getTokenInfoError = Marshal.GetLastPInvokeError()) != 122) // ERROR_INSUFFICIENT_BUFFER 2093pBuffer = Marshal.AllocHGlobal((int)neededBufferSize); 2105int lastError = Marshal.GetLastPInvokeError(); 2118IntPtr pCopyOfUserSid = Marshal.AllocHGlobal(userSidLength); 2122int lastError = Marshal.GetLastPInvokeError(); 2134Marshal.FreeHGlobal(pBuffer); 2175IntPtr pCopyOfSid = Marshal.AllocHGlobal(sidLength); 2179int lastError = Marshal.GetLastPInvokeError(); 2216Marshal.PtrToStructure<DSROLE_PRIMARY_DOMAIN_INFO_BASIC>(dsRoleInfoPtr)!; 2238int rid = Marshal.ReadInt32(pRid); 2275int ridCount = Marshal.ReadByte(pRidCount); 2277int lastRid = Marshal.ReadInt32(pLastRid); 2296Marshal.FreeHGlobal(pSid); 2306pBytes = Marshal.AllocHGlobal(bytes.Length); 2310Marshal.Copy(bytes, 0, pBytes, bytes.Length); 2314Marshal.FreeHGlobal(pBytes); 2333int subAuthorityCount = Marshal.ReadByte(psubAuthorityCount); 2358int currentSubauthority = Marshal.ReadInt32(pcurrentSubauthority);
System\DirectoryServices\DirectoryEntry.cs (2)
910System.Runtime.InteropServices.Marshal.ReleaseComObject(_adsObject); // release old handle 1021System.Runtime.InteropServices.Marshal.ReleaseComObject(_adsObject);
System\DirectoryServices\DirectorySearcher.cs (19)
810sortKey.pszAttrType = Marshal.StringToCoTaskMemUni(Sort.PropertyName); 814byte[] sortKeyBytes = new byte[Marshal.SizeOf(sortKey)]; 815Marshal.Copy((INTPTR_INTPTRCAST)(&sortKey), sortKeyBytes, 0, sortKeyBytes.Length); 831vlvValue.target = Marshal.StringToCoTaskMemUni(_vlv.Target); 843vlvValue.contextID = Marshal.AllocCoTaskMem(vlvValue.contextIDlength); 845Marshal.Copy(_vlv.DirectoryVirtualListViewContext._context, 0, vlvValue.contextID, vlvValue.contextIDlength); 847IntPtr vlvPtr = Marshal.AllocHGlobal(Marshal.SizeOf<AdsVLV>()); 848byte[] vlvBytes = new byte[Marshal.SizeOf(vlvValue)]; 851Marshal.StructureToPtr(vlvValue, vlvPtr, false); 852Marshal.Copy(vlvPtr, vlvBytes, 0, vlvBytes.Length); 856Marshal.FreeHGlobal(vlvPtr); 885Marshal.FreeCoTaskMem(ptrToFree); 888Marshal.FreeCoTaskMem(ptrVLVToFree); 891Marshal.FreeCoTaskMem(ptrVLVContexToFree); 898IntPtr ptr = Marshal.AllocHGlobal(structSize * prefs.Length); 904Marshal.StructureToPtr(prefs[i], tempPtr, false); 914int status = Marshal.ReadInt32(tempPtr, 32); 948Marshal.FreeHGlobal(ptr);
System\DirectoryServices\SearchResultCollection.cs (5)
24private readonly IntPtr _adsDirsynCookieName = Marshal.StringToCoTaskMemUni(ADS_DIRSYNC_COOKIE); 26private readonly IntPtr _adsVLVResponseName = Marshal.StringToCoTaskMemUni(ADS_VLV_RESPONSE); 180Marshal.FreeCoTaskMem(_adsDirsynCookieName); 183Marshal.FreeCoTaskMem(_adsVLVResponseName); 321entry.Properties.Add(Marshal.PtrToStringUni(pszColumnName)!, new ResultPropertyValueCollection(values));
System.DirectoryServices.AccountManagement (113)
_generated\0\LibraryImports.g.cs (60)
51global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 53__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 69global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 96global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 98__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 101global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 125global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 127__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 132global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 222global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 224__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 229global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 252global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 254__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 257global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 281global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 283__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 288global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 316global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 318__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 321global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 351global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 353__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 356global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 379global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 381__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 384global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 407global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 409__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 412global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 453global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 455__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 479global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 520global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 522__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 540global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 600global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 602__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 621global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 652global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 654__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 673global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 697global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 699__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 704global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 731global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 733__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 738global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 765global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 767__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 772global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 827global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 829__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 834global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 886global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 888__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 891global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 951global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 953__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 958global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaLookupSids.cs (1)
31referencedDomains.Initialize((uint)Marshal.SizeOf<Interop.LSA_REFERENCED_DOMAIN_LIST>());
System\DirectoryServices\AccountManagement\AD\ADStoreCtx_LoadStore.cs (2)
542Marshal.FreeHGlobal(pSid); 597Marshal.FreeHGlobal(pSid);
System\DirectoryServices\AccountManagement\AD\SidList.cs (4)
136namesHandle.Initialize((uint)sidCount, (uint)Marshal.SizeOf<Interop.LSA_TRANSLATED_NAME>()); 180entry.name = Marshal.PtrToStringUni(name.Name.Buffer, name.Name.Length / 2); 188entry.sidIssuerName = Marshal.PtrToStringUni(domain.Name.Buffer, domain.Name.Length / 2); 256Marshal.FreeHGlobal(pSid);
System\DirectoryServices\AccountManagement\AuthZSet.cs (8)
103if (!f && (bufferSize > 0) && (Marshal.GetLastPInvokeError() == 122) /*ERROR_INSUFFICIENT_BUFFER*/) 110pBuffer = Marshal.AllocHGlobal(bufferSize); 157lastError = Marshal.GetLastPInvokeError(); 162lastError = Marshal.GetLastPInvokeError(); 168lastError = Marshal.GetLastPInvokeError(); 173lastError = Marshal.GetLastPInvokeError(); 216Marshal.FreeHGlobal(pBuffer); 540Marshal.FreeHGlobal(handle);
System\DirectoryServices\AccountManagement\Context.cs (1)
141System.Runtime.InteropServices.Marshal.ReleaseComObject(value);
System\DirectoryServices\AccountManagement\interopt.cs (2)
26ppObject = Marshal.GetObjectForIUnknown(ppObjPtr); 37Marshal.Release(ppObjPtr);
System\DirectoryServices\AccountManagement\SAM\SAMStoreCtx_LoadStore.cs (2)
369Marshal.FreeHGlobal(pSid); 434Marshal.FreeHGlobal(pSid);
System\DirectoryServices\AccountManagement\SAM\SAMStoreCtx.cs (1)
1057Marshal.PtrToStructure<UnsafeNativeMethods.WKSTA_INFO_100>(buffer);
System\DirectoryServices\AccountManagement\User.cs (1)
210System.Runtime.InteropServices.Marshal.FreeHGlobal(pSid);
System\DirectoryServices\AccountManagement\Utils.cs (31)
131int lastErrorCode = Marshal.GetLastPInvokeError(); 143Marshal.FreeHGlobal(pSid); 153pBytes = Marshal.AllocHGlobal(bytes.Length); 157Marshal.Copy(bytes, 0, pBytes, bytes.Length); 165Marshal.FreeHGlobal(pBytes); 178Marshal.Copy(pSid, sid, 0, sidLength); 196Marshal.FreeHGlobal(pSid); 211int rid = Marshal.ReadInt32(pRid); 248int ridCount = Marshal.ReadByte(pRidCount); 250int lastRid = Marshal.ReadInt32(pLastRid); 269Marshal.FreeHGlobal(pSid); 333Marshal.FreeHGlobal(pCopyOfUserSid); 336Marshal.FreeHGlobal(pMachineDomainSid); 361if ((error = Marshal.GetLastPInvokeError()) == 1008) // ERROR_NO_TOKEN 373int lastError = Marshal.GetLastPInvokeError(); 401if ((getTokenInfoError = Marshal.GetLastPInvokeError()) != 122) // ERROR_INSUFFICIENT_BUFFER 411pBuffer = Marshal.AllocHGlobal((int)neededBufferSize); 423int lastError = Marshal.GetLastPInvokeError(); 440IntPtr pCopyOfUserSid = Marshal.AllocHGlobal(userSidLength); 444int lastError = Marshal.GetLastPInvokeError(); 460Marshal.FreeHGlobal(pBuffer); 510IntPtr pCopyOfSid = Marshal.AllocHGlobal(sidLength); 514int lastError = Marshal.GetLastPInvokeError(); 577Marshal.PtrToStructure<UnsafeNativeMethods.DomainControllerInfo>(domainControllerInfoPtr); 609int lastErr = Marshal.GetLastPInvokeError(); 628lastErr = Marshal.GetLastPInvokeError(); 758int lastError = Marshal.GetLastPInvokeError(); 768int lastError = Marshal.GetLastPInvokeError(); 809Marshal.PtrToStructure<UnsafeNativeMethods.DSROLE_PRIMARY_DOMAIN_INFO_BASIC>(dsRoleInfoPtr); 832int subAuthorityCount = Marshal.ReadByte(psubAuthorityCount); 857int currentSubauthority = Marshal.ReadInt32(pcurrentSubauthority);
System.DirectoryServices.Protocols (146)
_generated\0\LibraryImports.g.cs (15)
27global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 29__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 38global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 405global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 407__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 416global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 540global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 542__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 551global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 578__outValue_native = outValue != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(outValue) : default; 621__outValue_native = outValue != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(outValue) : default; 670global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 672__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 681global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1138__proc_native = proc != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(proc) : default;
src\runtime\src\libraries\Common\src\Interop\Interop.Ldap.cs (16)
61n.user = Marshal.StringToCoTaskMemUni(managed.user); 63n.domain = Marshal.StringToCoTaskMemUni(managed.domain); 65n.password = Marshal.StringToCoTaskMemUni(managed.password); 68n.packageList = Marshal.StringToCoTaskMemUni(managed.packageList); 75Marshal.FreeCoTaskMem(native.user); 76Marshal.FreeCoTaskMem(native.domain); 77Marshal.FreeCoTaskMem(native.password); 78Marshal.FreeCoTaskMem(native.packageList); 248_native.query = managed.query is not null ? Marshal.GetFunctionPointerForDelegate(managed.query) : IntPtr.Zero; 249_native.notify = managed.notify is not null ? Marshal.GetFunctionPointerForDelegate(managed.notify) : IntPtr.Zero; 250_native.dereference = managed.dereference is not null ? Marshal.GetFunctionPointerForDelegate(managed.dereference) : IntPtr.Zero; 262query = _native.query != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer<QUERYFORCONNECTIONInternal>(_native.query) : null, 263notify = _native.notify != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer<NOTIFYOFNEWCONNECTIONInternal>(_native.notify) : null, 264dereference = _native.dereference != IntPtr.Zero ? Marshal.GetDelegateForFunctionPointer<DEREFERENCECONNECTIONInternal>(_native.dereference) : null 303Marshal.FreeHGlobal(attribute); 308Marshal.FreeHGlobal(values);
System\DirectoryServices\Protocols\common\BerConverter.cs (22)
269Marshal.PtrToStructure(flattenptr, binaryValue); 280Marshal.Copy(binaryValue.bv_val, encodingResult, 0, (int)binaryValue.bv_len.Value); 324berValue.bv_val = Marshal.AllocHGlobal(value.Length); 325Marshal.Copy(value, 0, berValue.bv_val, value.Length); 448Marshal.FreeHGlobal(berValue.bv_val); 469IntPtr tmp = Marshal.AllocHGlobal(tempValue.Length); 470Marshal.Copy(tempValue, 0, tmp, tempValue.Length); 499Marshal.PtrToStructure(result, binaryValue); 502Marshal.Copy(binaryValue.bv_val, byteArray, 0, (int)binaryValue.bv_len.Value); 529int structSize = Marshal.SizeOf<BerVal>(); 543managedBervalArray[i].bv_val = Marshal.AllocHGlobal(byteArray.Length); 544Marshal.Copy(byteArray, 0, managedBervalArray[i].bv_val, byteArray.Length); 548IntPtr valPtr = Marshal.AllocHGlobal(structSize); 549Marshal.StructureToPtr(managedBervalArray[i], valPtr, false); 565IntPtr ptr = Marshal.ReadIntPtr(berValArray, IntPtr.Size * i); 567Marshal.FreeHGlobal(ptr); 569Marshal.FreeHGlobal(berValArray); 577Marshal.FreeHGlobal(managedBerval.bv_val); 603tempPtr = Marshal.ReadIntPtr(ptrResult); 607Marshal.PtrToStructure(tempPtr, ber); 610Marshal.Copy(ber.bv_val, berArray, 0, (int)ber.bv_len.Value); 615tempPtr = Marshal.ReadIntPtr(ptrResult, i * IntPtr.Size);
System\DirectoryServices\Protocols\common\utils.cs (2)
44IntPtr intPtrArray = Marshal.AllocHGlobal(IntPtr.Size * size); 48Marshal.WriteIntPtr(tempPtr, IntPtr.Zero);
System\DirectoryServices\Protocols\Interop\LdapPal.Linux.cs (9)
139Marshal.FreeHGlobal(passwordPtr); 176internal static string PtrToString(IntPtr requestName) => Marshal.PtrToStringAnsi(requestName); 178internal static IntPtr StringToPtr(string s) => Marshal.StringToHGlobalAnsi(s); 198SaslInteractiveChallenge interactChallenge = Marshal.PtrToStructure<SaslInteractiveChallenge>(currentInteractPtr); 199SaslDefaultCredentials defaults = Marshal.PtrToStructure<SaslDefaultCredentials>(defaultsPtr); 223interactChallenge.result = Marshal.StringToHGlobalAnsi(interactChallenge.defresult); 228Marshal.StructureToPtr(interactChallenge, currentInteractPtr, false); 229currentInteractPtr = IntPtr.Add(currentInteractPtr, Marshal.SizeOf<SaslInteractiveChallenge>()); 230interactChallenge = Marshal.PtrToStructure<SaslInteractiveChallenge>(currentInteractPtr);
System\DirectoryServices\Protocols\Interop\SafeHandles.cs (1)
22Marshal.FreeHGlobal(handle);
System\DirectoryServices\Protocols\ldap\LdapConnection.cs (51)
526int structSize = Marshal.SizeOf<LdapControl>(); 534IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 535Marshal.StructureToPtr(managedServerControls[i], controlPtr, false); 550IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 551Marshal.StructureToPtr(managedClientControls[i], controlPtr, false); 612bv_val = Marshal.AllocHGlobal(byteArray.Length) 614Marshal.Copy(byteArray, 0, berValuePtr.bv_val, byteArray.Length); 640int modStructSize = Marshal.SizeOf<LdapMod>(); 644IntPtr controlPtr = Marshal.AllocHGlobal(modStructSize); 645Marshal.StructureToPtr(modifications[i], controlPtr, false); 678bv_val = Marshal.AllocHGlobal(val.Length) 680Marshal.Copy(val, 0, berValuePtr.bv_val, val.Length); 776IntPtr tempPtr = Marshal.ReadIntPtr(serverControlArray, IntPtr.Size * i); 779Marshal.FreeHGlobal(tempPtr); 782Marshal.FreeHGlobal(serverControlArray); 791Marshal.FreeHGlobal(managedServerControls[i].ldctl_oid); 798Marshal.FreeHGlobal(managedServerControls[i].ldctl_value.bv_val); 809IntPtr tempPtr = Marshal.ReadIntPtr(clientControlArray, IntPtr.Size * i); 812Marshal.FreeHGlobal(tempPtr); 816Marshal.FreeHGlobal(clientControlArray); 825Marshal.FreeHGlobal(managedClientControls[i].ldctl_oid); 832Marshal.FreeHGlobal(managedClientControls[i].ldctl_value.bv_val); 843IntPtr tempPtr = Marshal.ReadIntPtr(modArray, IntPtr.Size * i); 846Marshal.FreeHGlobal(tempPtr); 850Marshal.FreeHGlobal(modArray); 857Marshal.FreeHGlobal(tempPtr); 862Marshal.FreeHGlobal(berValuePtr.bv_val); 869IntPtr tempPtr = Marshal.ReadIntPtr(searchAttributes, IntPtr.Size * i); 872Marshal.FreeHGlobal(tempPtr); 876Marshal.FreeHGlobal(searchAttributes); 909Marshal.Copy(info.pbData, context, 0, dataLength); 1059length = Marshal.SizeOf<SEC_WINNT_AUTH_IDENTITY_EX>(), 1225bv_val = Marshal.AllocHGlobal(sizeof(byte) * byteControlValue.Length) 1227Marshal.Copy(byteControlValue, 0, managedControls[i].ldctl_value.bv_val, (int)managedControls[i].ldctl_value.bv_len.Value); 1313bv_val = Marshal.AllocHGlobal(byteArray.Length) 1318Marshal.Copy(byteArray, 0, berValues[j].bv_val, (int)berValues[j].bv_len.Value); 1324int structSize = Marshal.SizeOf<BerVal>(); 1330controlPtr = Marshal.AllocHGlobal(structSize); 1334Marshal.StructureToPtr(berValues[m], controlPtr, false); 1466Marshal.PtrToStructure(requestValue, val); 1470Marshal.Copy(val.bv_val, requestValueArray, 0, (int)val.bv_len.Value); 1651IntPtr singleControl = Marshal.ReadIntPtr(tempControlPtr, 0); 1659singleControl = Marshal.ReadIntPtr(tempControlPtr, i * IntPtr.Size); 1782IntPtr tempPtr = Marshal.ReadIntPtr(valuesArray, IntPtr.Size * count); 1786Marshal.PtrToStructure(tempPtr, bervalue); 1791Marshal.Copy(bervalue.bv_val, byteArray, 0, (int)bervalue.bv_len.Value); 1796tempPtr = Marshal.ReadIntPtr(valuesArray, IntPtr.Size * count); 1825tempPtr = Marshal.ReadIntPtr(referenceArray, IntPtr.Size * count); 1832tempPtr = Marshal.ReadIntPtr(referenceArray, IntPtr.Size * count); 1921Marshal.PtrToStructure(controlPtr, control); 1927Marshal.Copy(control.ldctl_value.bv_val, bytes, 0, (int)control.ldctl_value.bv_len.Value);
System\DirectoryServices\Protocols\ldap\LdapConnection.Linux.cs (7)
140IntPtr ptrToDefaults = Marshal.AllocHGlobal(Marshal.SizeOf(defaults)); 141Marshal.StructureToPtr(defaults, ptrToDefaults, false); 151Marshal.FreeHGlobal(ptrToDefaults); 162defaults.realm = Marshal.PtrToStringAnsi(outValue); 167defaults.authcid = Marshal.PtrToStringAnsi(outValue); 172defaults.authzid = Marshal.PtrToStringAnsi(outValue);
System\DirectoryServices\Protocols\ldap\LdapSessionOptions.cs (23)
574int structSize = Marshal.SizeOf<LdapControl>(); 581IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 582Marshal.StructureToPtr(managedServerControls[i], controlPtr, false); 597IntPtr controlPtr = Marshal.AllocHGlobal(structSize); 598Marshal.StructureToPtr(managedClientControls[i], controlPtr, false); 676IntPtr tempPtr = Marshal.ReadIntPtr(serverControlArray, IntPtr.Size * i); 679Marshal.FreeHGlobal(tempPtr); 682Marshal.FreeHGlobal(serverControlArray); 691Marshal.FreeHGlobal(managedServerControls[i].ldctl_oid); 698Marshal.FreeHGlobal(managedServerControls[i].ldctl_value.bv_val); 709IntPtr tempPtr = Marshal.ReadIntPtr(clientControlArray, IntPtr.Size * i); 712Marshal.FreeHGlobal(tempPtr); 716Marshal.FreeHGlobal(clientControlArray); 725Marshal.FreeHGlobal(managedClientControls[i].ldctl_oid); 731Marshal.FreeHGlobal(managedClientControls[i].ldctl_value.bv_val); 864Marshal.FreeHGlobal(inValue); 873sizeofcallback = Marshal.SizeOf<LdapReferralCallback>(), 898string target = $"{Marshal.PtrToStringUni(HostNamePtr)}:{PortNumber}"; 962string target = $"{Marshal.PtrToStringUni(hostNamePtr)}:{portNumber}"; 1081string user = Marshal.PtrToStringUni(SecAuthIdentit->user); 1082string domain = Marshal.PtrToStringUni(SecAuthIdentit->domain); 1083string password = Marshal.PtrToStringUni(SecAuthIdentit->password); 1099certPtr = Marshal.ReadIntPtr(serverCert);
System.Drawing.Common (56)
_generated\19\Windows.Win32.PInvoke.USER32.dll.g.cs (3)
62 Marshal.SetLastSystemError(0); 64 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\20\Windows.Win32.PInvoke.winspool.drv.g.cs (6)
56 Marshal.SetLastSystemError(0); 58 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 123 Marshal.SetLastSystemError(0); 125 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
System\Drawing\BufferedGraphicsContext.cs (1)
412throw new Win32Exception(Marshal.GetLastWin32Error());
System\Drawing\Font.cs (4)
277if (Marshal.SizeOf(type) != nativeSize) 289Marshal.PtrToStructure(new IntPtr(&nativeLogFont), logFont); 634if (Marshal.SizeOf(type) != nativeSize) 644Marshal.StructureToPtr(lf, new IntPtr(&logFont), fDeleteOld: false);
System\Drawing\Graphics.cs (4)
2191callback is null ? 0 : Marshal.GetFunctionPointerForDelegate(callback), 2244callback is null ? 0 : Marshal.GetFunctionPointerForDelegate(callback), 2306callback is null ? 0 : Marshal.GetFunctionPointerForDelegate(callback), 3562WIN32_ERROR error = (WIN32_ERROR)Marshal.GetLastWin32Error();
System\Drawing\Graphics.EnumerateMetafileDataAdapter.cs (1)
28NativeCallback = Marshal.GetFunctionPointerForDelegate(_nativeCallback);
System\Drawing\Icon.cs (2)
650Marshal.Copy(_iconData, newOffset + j * width, (IntPtr)pixelPtr, lineLength); 893Marshal.ThrowExceptionForHR((int)result);
System\Drawing\Image.cs (4)
282Marshal.FreeHGlobal((nint)nativeParameters); 323Marshal.FreeHGlobal((nint)nativeParameters); 352Marshal.FreeHGlobal((nint)nativeParameters); 384Marshal.FreeHGlobal((nint)nativeParameters);
System\Drawing\Imaging\EncoderParameter.cs (21)
52Marshal.FreeHGlobal(_parameterValue); 69_parameterValue = Marshal.AllocHGlobal(sizeof(byte)); 84_parameterValue = Marshal.AllocHGlobal(sizeof(byte)); 96_parameterValue = Marshal.AllocHGlobal(sizeof(short)); 108_parameterValue = Marshal.AllocHGlobal(sizeof(int)); 120_parameterValue = Marshal.AllocHGlobal(2 * sizeof(int)); 133_parameterValue = Marshal.AllocHGlobal(2 * sizeof(int)); 151_parameterValue = Marshal.AllocHGlobal(4 * sizeof(int)); 166_parameterValue = Marshal.StringToHGlobalAnsi(value); 177_parameterValue = Marshal.AllocHGlobal(_numberOfValues); 179Marshal.Copy(value, 0, _parameterValue, _numberOfValues); 190_parameterValue = Marshal.AllocHGlobal(_numberOfValues); 192Marshal.Copy(value, 0, _parameterValue, _numberOfValues); 202_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * sizeof(short))); 204Marshal.Copy(value, 0, _parameterValue, _numberOfValues); 214_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * sizeof(int))); 234_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 2 * sizeof(int))); 254_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 2 * sizeof(int))); 281_parameterValue = Marshal.AllocHGlobal(checked(_numberOfValues * 4 * sizeof(int))); 310_parameterValue = Marshal.AllocHGlobal(bytes); 336_parameterValue = Marshal.AllocHGlobal(bytes);
System\Drawing\Imaging\EncoderParameters.cs (1)
21GdiPlus.EncoderParameters* native = (GdiPlus.EncoderParameters*)Marshal.AllocHGlobal(
System\Drawing\Printing\DefaultPrintController.cs (1)
51WIN32_ERROR error = (WIN32_ERROR)Marshal.GetLastPInvokeError();
System\Drawing\Printing\PrinterSettings.cs (5)
144WIN32_ERROR error = (WIN32_ERROR)Marshal.GetLastPInvokeError(); 640Marshal.Copy(_cachedDevmode, 0, (nint)devmode, _devmodeBytes); 664Marshal.Copy(_extraInfo, 0, (nint)((byte*)devmode + devmode->dmSize), _extraBytes); 996Marshal.Copy((nint)devmode, _cachedDevmode, 0, _devmodeBytes); 1004Marshal.Copy((nint)((byte*)devmode + devmode->dmSize), _extraInfo, 0, _extraBytes);
System\Drawing\SystemIcons.cs (3)
76Marshal.ThrowExceptionForHR((int)result); 102Marshal.ThrowExceptionForHR((int)result); 113Marshal.ThrowExceptionForHR((int)result);
System.Formats.Tar (26)
_generated\0\LibraryImports.g.cs (24)
47global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 49__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 58global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 78global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 80__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 83global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 180global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 182__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 198global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 232global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 234__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 244global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 274global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 276__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 285global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 318global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 320__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 329global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 362global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 364__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 373global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 406global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 408__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 417global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.IO.Compression (13)
_generated\0\LibraryImports.g.cs (12)
95global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 97__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 106global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 139global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 141__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 150global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 183global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 185__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 194global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 227global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 229__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 238global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
System\IO\Compression\Zstandard\ZstandardUtils.cs (1)
45return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(errorNamePtr) ?? $"Unknown error {error}";
System.IO.FileSystem.AccessControl (37)
_generated\0\LibraryImports.g.cs (27)
22global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 24__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 42global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 65global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 67__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 72global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 103global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 105__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 123global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 145global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 147__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 150global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 176global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 178__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 183global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 208global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 210__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 213global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 238global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 240__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 243global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 269global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 271__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 276global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 301global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 303__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 308global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
src\runtime\src\libraries\Common\src\System\IO\FileSystem.Attributes.Windows.cs (2)
61errorCode = Marshal.GetLastPInvokeError(); 87errorCode = Marshal.GetLastPInvokeError();
src\runtime\src\libraries\Common\src\System\IO\FileSystem.DirectoryCreation.Windows.cs (1)
90int currentError = Marshal.GetLastPInvokeError();
src\runtime\src\libraries\Common\src\System\IO\Win32Marshal.cs (2)
19=> GetExceptionForWin32Error(Marshal.GetLastPInvokeError(), path); 85return Marshal.GetPInvokeErrorMessage(errorCode);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\PathHelper.Windows.cs (2)
87int errorCode = Marshal.GetLastPInvokeError(); 190int error = Marshal.GetLastPInvokeError();
System\IO\FileSystemAclExtensions.cs (1)
312int errorCode = Marshal.GetLastPInvokeError();
System.IO.FileSystem.DriveInfo (14)
_generated\0\LibraryImports.g.cs (12)
47global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 49__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 58global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 99global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 101__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 110global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 140global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 142__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 151global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 183global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 185__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 204global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.IO.FileSystem.Watcher (29)
_generated\0\LibraryImports.g.cs (27)
23global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 25__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 34global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 64global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 66__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 75global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 129global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 131__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 140global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 167global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 169__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 187global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 221global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 223__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 233global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 263global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 265__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 274global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 315global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 317__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 326global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 359global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 361__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 370global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 403global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 405__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 414global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.IO.MemoryMappedFiles (62)
_generated\0\LibraryImports.g.cs (60)
38global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 40__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 43global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 66global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 68__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 71global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 104global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 106__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 115global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 150global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 152__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 164global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 197global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 199__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 208global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 241global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 243__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 252global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 276global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 278__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 281global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 312global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 314__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 323global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 344global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 346__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 349global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 370global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 372__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 375global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 396global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 398__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 401global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 434global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 436__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 457global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 478global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 480__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 483global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 513global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 515__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 524global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 545global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 547__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 550global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 583global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 585__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 606global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 636global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 638__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 647global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 680global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 682__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 703global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 724global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 726__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 729global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 759global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 761__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 770global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.IO.Pipes (68)
_generated\0\LibraryImports.g.cs (66)
38global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 40__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 43global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 75global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 77__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 86global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 119global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 121__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 130global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 165global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 167__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 170global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 203global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 205__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 214global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 249global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 251__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 263global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 296global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 298__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 307global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 340global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 342__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 351global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 375global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 377__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 380global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 411global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 413__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 422global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 443global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 445__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 448global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 469global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 471__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 474global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 507global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 509__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 530global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 551global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 553__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 556global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 651global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 653__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 662global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 692global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 694__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 703global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 733global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 735__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 744global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 777global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 779__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 788global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 821global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 823__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 832global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 865global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 867__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 876global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 909global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 911__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 920global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 953global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 955__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 964global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System.IO.Ports (42)
_generated\0\LibraryImports.g.cs (39)
24global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 26__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 35global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 66global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 68__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 77global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 108global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 110__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 119global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 188global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 190__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 199global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 230global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 232__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 241global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 274global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 276__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 285global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 316global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 318__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 327global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 358global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 360__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 369global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 400global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 402__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 411global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 445global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 447__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 468global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 490global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 492__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 495global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 534global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 536__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 545global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 576global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 578__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 587global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System\IO\Ports\InternalResources.cs (1)
5using Marshal = System.Runtime.InteropServices.Marshal;
System.Management (156)
_generated\0\LibraryImports.g.cs (6)
16global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 18__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 23global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 131global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 133__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 136global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
System\Management\InteropClasses\WMIInterop.cs (5)
61Marshal.Release(pWbemClassObject); 390Marshal.Release(pWbemQualifierSet); 1351if (0 == Marshal.QueryInterface(pComThreadingInfo, ref Unsafe.AsRef(in IID_IObjectContext), out pObjectContext)) 1358Marshal.Release(pComThreadingInfo); 1360Marshal.Release(pObjectContext);
System\Management\ManagementBaseObject.cs (8)
323Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 430Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 601Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 619(IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(wbemObject)), 628Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 755Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 776Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 798Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\ManagementClass.cs (13)
91Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 356Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 489Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 619Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 705Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 771Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 849Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 905Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 932Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1061Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1164Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1258Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1350Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\ManagementEventWatcher.cs (8)
440cachedObjects[i] = new IWbemClassObjectFreeThreaded(Marshal.GetIUnknownForObject(tempArray[i])); 461Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 492Marshal.ThrowExceptionForHR(sink.Status, WmiNetUtilsHelper.GetErrorInfo_f()); 517Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 537Marshal.ReleaseComObject(enumWbem); 660Marshal.AddRef(pWbemClassObject); 734Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 756System.Runtime.InteropServices.Marshal.ReleaseComObject(stub);
System\Management\ManagementObject.cs (34)
700Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 796Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 930Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1066Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1195Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1298Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1418Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1475ppwbemCallResult = Marshal.AllocHGlobal(IntPtr.Size); 1476Marshal.WriteIntPtr(ppwbemCallResult, IntPtr.Zero); // Init to NULL. 1495pwbemCallResult = Marshal.ReadIntPtr(ppwbemCallResult); 1497wbemCallResult = (IWbemCallResult)Marshal.GetObjectForIUnknown(pwbemCallResult); 1510Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1520Marshal.FreeHGlobal(ppwbemCallResult); 1523Marshal.Release(pwbemCallResult); 1526Marshal.ReleaseComObject(wbemCallResult); 1665Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1768ppwbemCallResult = Marshal.AllocHGlobal(IntPtr.Size); 1769Marshal.WriteIntPtr(ppwbemCallResult, IntPtr.Zero); // Init to NULL. 1791pwbemCallResult = Marshal.ReadIntPtr(ppwbemCallResult); 1794wbemCallResult = (IWbemCallResult)Marshal.GetObjectForIUnknown(pwbemCallResult); 1807Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1818Marshal.FreeHGlobal(ppwbemCallResult); 1821Marshal.Release(pwbemCallResult); 1824Marshal.ReleaseComObject(wbemCallResult); 1921Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1983Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2054Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2311Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2387Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2480Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2508Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2660Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2748Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 2840Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\ManagementObjectCollection.cs (8)
115Marshal.ReleaseComObject(enumWbem); 317Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 445Marshal.ReleaseComObject(enumWbem); 552Marshal.GetIUnknownForObject(tempArray[i]) 562Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 631Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 636Marshal.ReleaseComObject((IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(cachedObjects[i])));
System\Management\ManagementObjectSearcher.cs (2)
387Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 481Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\ManagementOptions.cs (1)
1671return System.Runtime.InteropServices.Marshal.SecureStringToBSTR(securePassword);
System\Management\ManagementPath.cs (13)
116Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 286Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 342Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 384Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 531Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 628Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 658Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 785Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 835Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 959Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 986Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1015Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1044Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\ManagementScope.cs (18)
316throw new Win32Exception(Marshal.GetLastPInvokeError(), SR.Format(SR.LoadLibraryFailed, wminet_utilsPath)); 383(delegate_f = Marshal.GetDelegateForFunctionPointer<TDelegate>(procAddr)) != null; 547IntPtr pUnk = Marshal.GetIUnknownForObject(wbemServices); 550object unknown = Marshal.GetObjectForIUnknown(pUnk); 553Marshal.Release(pUnk); 1010Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1074System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1122System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1194System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1232System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1258System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1297System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1324System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1351System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1423System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1426Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 1449System.Runtime.InteropServices.Marshal.ZeroFreeBSTR(password); 1452Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\Method.cs (2)
134Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 225Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\MethodSet.cs (4)
111Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 290Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 383Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 450Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\Property.cs (9)
111Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 158Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 238Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 334((ManagementBaseObject[])val)[i] = new ManagementBaseObject(new IWbemClassObjectFreeThreaded(Marshal.GetIUnknownForObject(wmiValueArray.GetValue(i)))); 352CimType.Object => new ManagementBaseObject(new IWbemClassObjectFreeThreaded(Marshal.GetIUnknownForObject(wmiValue))), 500((IWbemClassObject_DoNotMarshal[])(wmiValue))[i] = (IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(((ManagementBaseObject)valArray.GetValue(i)).wbemObject)); 570wmiValue = Marshal.GetObjectForIUnknown(((ManagementBaseObject)val).wbemObject); 723((IWbemClassObject_DoNotMarshal[])(wmiValue))[i] = (IWbemClassObject_DoNotMarshal)(Marshal.GetObjectForIUnknown(((ManagementBaseObject)valArray.GetValue(i)).wbemObject)); 805wmiValue = Marshal.GetObjectForIUnknown(((ManagementBaseObject)val).wbemObject);
System\Management\PropertySet.cs (7)
91Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 165Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 271Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 391Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 434Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 476Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 514Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\Qualifier.cs (6)
87Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 188Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 231Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 287Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 325Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 363Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\QualifierSet.cs (6)
99Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 140Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 208Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 343Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 433Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); 482Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f());
System\Management\WmiEventSink.cs (4)
126Marshal.AddRef(pIWbemClassObject); 146Marshal.AddRef(pErrorObj); 227System.Runtime.InteropServices.Marshal.ReleaseComObject(stub); 289Marshal.AddRef(pIWbemClassObject);
System\Management\wmiutil.cs (2)
37Marshal.QueryInterface(pErrorInfo, ref IWbemClassObjectFreeThreaded.IID_IWbemClassObject, out pIWbemClassObject); 39Marshal.Release(pErrorInfo);
System.Net.Http.WinHttpHandler (130)
_generated\0\LibraryImports.g.cs (88)
15global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 17__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 20global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 44global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 46__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 51global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 87global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 89__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 101global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 124global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 126__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 129global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 154global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 156__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 159global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 191global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 193__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 211global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 235global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 237__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 242global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 279global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 281__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 302global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 343global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 345__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 366global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 401global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 403__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 416global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 451global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 453__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 465global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 498global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 500__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 512global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 545global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 547__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 559global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 592global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 594__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 606global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 639global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 641__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 653global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 690global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 692__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 704global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 741global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 743__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 755global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 791global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 793__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 805global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 840global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 842__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 854global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 890global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 892__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 904global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 937global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 939__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 951global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 986global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 988__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1000global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1033global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1035__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1047global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1083global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1085__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1097global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1137global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1139__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1151global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1184global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1186__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1198global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1225global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1227__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1232global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1271global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1273__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1287global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1316__callback_native = callback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback) : default; 1321global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1323__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1335global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.CRYPT_BIT_BLOB.cs (1)
22Marshal.Copy(pbData, data, 0, numBytes);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.DATA_BLOB.cs (1)
31Marshal.Copy(pbData, array, 0, (int)cbData);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
src\runtime\src\libraries\Common\src\Interop\Windows\WinHttp\Interop.winhttp_types.cs (3)
288AutoConfigUrl = managed.AutoConfigUrl is not null ? Marshal.StringToCoTaskMemUni(managed.AutoConfigUrl) : IntPtr.Zero; 300AutoConfigUrl = AutoConfigUrl != IntPtr.Zero ? Marshal.PtrToStringUni(AutoConfigUrl) : null, 309Marshal.FreeCoTaskMem(AutoConfigUrl);
src\runtime\src\libraries\Common\src\System\Net\Security\CertificateValidation.Windows.cs (1)
32throw new CryptographicException(Marshal.GetLastPInvokeError());
System\Net\Http\WinHttpChannelBinding.cs (5)
23if (Marshal.GetLastWin32Error() == Interop.WinHttp.ERROR_INSUFFICIENT_BUFFER) 25IntPtr data = Marshal.AllocHGlobal((int)dataSize); 34Marshal.FreeHGlobal(data); 61Marshal.Copy(this.handle, bytes, 0, _size); 70Marshal.FreeHGlobal(this.handle);
System\Net\Http\WinHttpCookieContainerAdapter.cs (1)
65int lastError = Marshal.GetLastWin32Error();
System\Net\Http\WinHttpException.cs (1)
55int lastError = Marshal.GetLastWin32Error();
System\Net\Http\WinHttpHandler.cs (10)
843int lastError = Marshal.GetLastWin32Error(); 1061int lastError = Marshal.GetLastWin32Error(); 1152NetEventSource.Info(this, "Failed to enable WINHTTP_OPTION_REQUIRE_STREAM_END error code: " + Marshal.GetLastWin32Error()); 1304proxyInfo.Proxy = Marshal.StringToHGlobalUni(proxyString); 1318(uint)Marshal.SizeOf(proxyInfo)); 1328Marshal.FreeHGlobal(proxyInfo.Proxy); 1329Marshal.FreeHGlobal(proxyInfo.ProxyBypass); 1429(uint)Marshal.SizeOf<Interop.Crypt32.CERT_CONTEXT>()); 1631int lastError = Marshal.GetLastWin32Error(); 1643int lastError = Marshal.GetLastWin32Error();
System\Net\Http\WinHttpRequestCallback.cs (9)
69IPAddress connectedToIPAddress = IPAddress.Parse(Marshal.PtrToStringUni(statusInformation)!); 84int bytesAvailable = Marshal.ReadInt32(statusInformation); 101var redirectUri = new Uri(Marshal.PtrToStringUni(statusInformation)!); 111statusInformationLength == Marshal.SizeOf<Interop.WinHttp.WINHTTP_ASYNC_RESULT>(), 113" must be sizeof(WINHTTP_ASYNC_RESULT)=" + Marshal.SizeOf<Interop.WinHttp.WINHTTP_ASYNC_RESULT>()); 115var asyncResult = Marshal.PtrToStructure<Interop.WinHttp.WINHTTP_ASYNC_RESULT>(statusInformation); 290int lastError = Marshal.GetLastWin32Error(); 351int lastError = Marshal.GetLastWin32Error(); 540int lastError = Marshal.GetLastWin32Error();
System\Net\Http\WinHttpRequestStream.cs (1)
232Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset),
System\Net\Http\WinHttpResponseParser.cs (4)
141int lastError = Marshal.GetLastWin32Error(); 166lastError = Marshal.GetLastWin32Error(); 187int lastError = Marshal.GetLastWin32Error(); 220int lastError = Marshal.GetLastWin32Error();
System\Net\Http\WinHttpResponseStream.cs (2)
141if (!Interop.WinHttp.WinHttpReadData(_requestHandle, Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0), (uint)Math.Min(bytesAvailable, buffer.Length), IntPtr.Zero)) 238Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset),
System\Net\Http\WinHttpTrailersHelper.cs (1)
57int lastError = Marshal.GetLastWin32Error();
System.Net.HttpListener (1)
System\Net\HttpListenerException.cs (1)
14public HttpListenerException() : base(Marshal.GetLastPInvokeError())
System.Net.NameResolution (9)
_generated\0\LibraryImports.g.cs (6)
54global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 56__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 59global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 80global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 82__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 85global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
152uint addr = (uint)System.Runtime.InteropServices.Marshal.ReadInt32((IntPtr)address);
System.Net.NetworkInformation (14)
_generated\0\LibraryImports.g.cs (9)
30global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 32__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 35global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 64global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 66__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 69global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 122global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 124__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 127global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\System\Net\NetworkInformation\NetworkInformationException.cs (1)
25public NetworkInformationException() : base(Marshal.GetLastPInvokeError())
System\Net\NetworkInformation\LinuxNetworkInterface.cs (1)
136Marshal.FreeHGlobal(globalMemory);
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (1)
168Marshal.InitHandle(sh, newSocket);
System.Net.Ping (8)
_generated\0\LibraryImports.g.cs (3)
75global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 77__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 80global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
152uint addr = (uint)System.Runtime.InteropServices.Marshal.ReadInt32((IntPtr)address);
System\Net\NetworkInformation\Ping.RawSocket.cs (2)
394Debug.Assert(Marshal.SizeOf<IcmpHeader>() == 8, "The size of an ICMP Header must be 8 bytes."); 467Marshal.Copy(new IntPtr(&icmpHeader), result, offset, icmpHeaderSize);
System.Net.Primitives (12)
_generated\0\LibraryImports.g.cs (6)
118global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 120__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 123global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 199global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 201__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 204global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
152uint addr = (uint)System.Runtime.InteropServices.Marshal.ReadInt32((IntPtr)address);
System\Net\NetworkCredential.cs (3)
165ptr = Marshal.SecureStringToGlobalAllocUnicode(sstr); 166result = Marshal.PtrToStringUni(ptr)!; 172Marshal.ZeroFreeGlobalAllocUnicode(ptr);
System.Net.Quic (4)
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
152uint addr = (uint)System.Runtime.InteropServices.Marshal.ReadInt32((IntPtr)address);
System\Net\Quic\Interop\msquic_generated.cs (1)
3136internal static readonly uint QUIC_EXECUTION_CONFIG_MIN_SIZE = unchecked((uint)((int)(Marshal.OffsetOf<QUIC_EXECUTION_CONFIG>("ProcessorList"))));
System.Net.Security (21)
_generated\0\LibraryImports.g.cs (15)
2938global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2940__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2949global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2983global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2985__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2994global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3311global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3313__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3322global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3359global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3361__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3370global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3409global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3411__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3420global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs (4)
27Marshal.Copy(certHashBytes, 0, CertHashPtr, length); 39handle = Marshal.AllocHGlobal(SecChannelBindingSize + _cbtPrefixByteArraySize + CertHashMaxSize); 56Marshal.StructureToPtr(channelBindings, handle, true); 63Marshal.FreeHGlobal(handle);
System.Net.Sockets (57)
_generated\0\LibraryImports.g.cs (51)
199global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 201__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 204global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 303global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 305__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 308global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 341global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 343__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 352global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 387global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 389__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 401global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 434global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 436__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 445global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 478global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 480__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 489global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 513global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 515__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 518global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1014global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1016__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1026global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1133global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1135__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1144global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1177global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1179__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1188global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1221global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1223__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1232global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1463global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1465__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1474global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1504global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1506__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1515global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1919global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1921__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1924global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1954global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1956__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1965global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1986global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1988__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1991global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2021global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2023__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2032global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
152uint addr = (uint)System.Runtime.InteropServices.Marshal.ReadInt32((IntPtr)address);
src\runtime\src\libraries\Common\src\System\Net\Sockets\SocketExceptionFactory.cs (1)
12return Marshal.GetPInvokeErrorMessage(nativeSocketError) + " " + endPoint.ToString();
System\Net\Sockets\SocketPal.Unix.cs (2)
94Marshal.InitHandle(socket, fd); 1151Marshal.InitHandle(socket, acceptedFd);
System.Net.WebSockets (1)
System\Net\WebSockets\WebSocketException.cs (1)
18: this(Marshal.GetLastPInvokeError())
System.Private.CoreLib (397)
_generated\2\LibraryImports.g.cs (240)
240global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 242__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 245global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1136global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1138__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1141global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1479global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1481__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1484global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1509global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1511__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1514global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1536global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1538__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1541global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1563global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1565__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1568global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2001global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2003__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2012global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2042global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2044__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2053global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2083global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2085__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2094global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2124global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2126__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2135global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2156global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2158__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2161global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2184global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2186__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2189global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2222global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2224__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2233global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2268global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2270__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2282global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2315global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2317__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2326global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2359global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2361__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2370global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2394global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2396__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2399global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2434global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2436__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2446global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2565global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2567__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2570global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2659global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2661__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2670global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2691global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2693__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2696global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2726global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2728__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2737global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2767global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2769__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2778global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2864global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2866__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2869global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2890global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2892__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2895global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2969global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2971__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2974global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3007global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3009__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3025global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3089global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3091__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3094global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3119global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3121__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3137global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3167global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3169__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3178global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3208global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3210__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3219global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3269global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3271__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3281global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3311global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3313__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3322global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3441global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3443__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3452global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3538global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3540__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3549global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3570global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3572__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3575global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3596global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3598__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3601global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3631global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3633__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3642global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3663global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3665__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3668global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3689global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3691__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3694global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3735global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3737__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3758global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3788global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3790__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3799global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3866global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3868__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3877global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3907global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3909__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3918global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3948global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3950__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3959global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3989global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3991__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4000global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4030global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4032__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4041global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4071global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4073__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4082global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4112global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4114__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4123global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4153global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4155__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4164global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4194global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4196__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4205global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4235global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4237__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4246global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4275global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4277__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4280global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4312global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4314__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4323global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4357global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4359__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4369global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4399global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4401__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4410global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4451global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4453__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4462global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4495global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4497__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4506global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4539global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4541__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4550global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4583global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4585__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4594global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4627global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4629__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4638global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4672global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4674__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4684global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4705global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4707__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4710global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4813global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4815__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4824global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4854global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4856__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4865global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4895global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4897__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4906global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4936global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4938__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4947global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4968global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4970__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4973global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5003global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5005__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5014global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5051global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5053__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5056global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5159global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5161__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5166global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5244global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5246__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5251global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5312global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5314__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5317global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5338global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5340__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5343global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5364global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5366__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5369global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5390global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5392__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5395global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5428global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5430__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5433global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5453global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5455__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5458global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5480global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5482__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5487global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5511global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5513__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5516global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Internal\Runtime\CompilerHelpers\InteropHelpers.cs (14)
92return (char*)Marshal.StringToCoTaskMemUni(str); 101return (byte*)CoTaskMemAllocAndZeroMemory(checked((sb.Capacity + 2) * Marshal.SystemMaxDBCSCharSize)); 119return (byte*)CoTaskMemAllocAndZeroMemory(checked((chArray.Length + 2) * Marshal.SystemMaxDBCSCharSize)); 220return Marshal.PtrToStringBSTR((IntPtr)buffer); 234byte* bstr = (byte*)Marshal.AllocBSTRByteLen((uint)nativeLength); 245return Marshal.PtrToStringAnsi((IntPtr)buffer, (int)Marshal.SysStringByteLen((IntPtr)buffer)); 259int lastSystemError = Marshal.GetLastSystemError(); 271Marshal.SetLastSystemError(lastSystemError); 436byte* ptr = (byte*)Marshal.AllocCoTaskMem(size); 522return Marshal.SizeOf(o.GetType()); 537Marshal.StructureToPtr(o, address, fDeleteOld: false); 550Marshal.PtrToStructureImpl(address, o); 565Marshal.DestroyStructure(address, o.GetType());
src\runtime\src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (2)
159return ConvertErrorPlatformToPal(Marshal.GetLastPInvokeError()); 164return new ErrorInfo(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.ReadLink.cs (2)
48error = Marshal.GetLastPInvokeError(); 66Marshal.SetLastPInvokeError(error);
src\runtime\src\libraries\System.Private.CoreLib\src\Internal\Runtime\InteropServices\ComponentActivator.cs (2)
39string? result = Marshal.PtrToStringAuto(arg); 351functionPtr = Marshal.GetFunctionPointerForDelegate(d);
src\runtime\src\libraries\System.Private.CoreLib\src\System\ComAwareWeakReference.cs (2)
57Marshal.Release(pComWeakRef); 71Marshal.Release(_pComWeakRef);
src\runtime\src\libraries\System.Private.CoreLib\src\System\ComponentModel\Win32Exception.cs (4)
26public Win32Exception() : this(Marshal.GetLastPInvokeError()) 33public Win32Exception(int error) : this(error, Marshal.GetPInvokeErrorMessage(error)) 48public Win32Exception(string? message) : this(Marshal.GetLastPInvokeError(), message) 58NativeErrorCode = Marshal.GetLastPInvokeError();
src\runtime\src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (2)
235if (Marshal.IsBuiltInComSupported && argTypes[index].IsCOMObject) 271if (Marshal.IsBuiltInComSupported && argTypes[j].IsCOMObject)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipe.cs (6)
96native.m_pProviderName = (char*)Marshal.StringToCoTaskMemUni(managed.ProviderName); 99native.m_pFilterData = (char*)Marshal.StringToCoTaskMemUni(managed.FilterData); 106Marshal.FreeCoTaskMem((IntPtr)m_pProviderName); 110Marshal.FreeCoTaskMem((IntPtr)m_pFilterData); 121Span<EventPipeProviderConfigurationNative> providersNative = new Span<EventPipeProviderConfigurationNative>((void*)Marshal.AllocCoTaskMem(sizeof(EventPipeProviderConfigurationNative) * providers.Length), providers.Length); 146Marshal.FreeCoTaskMem((IntPtr)providersNativePointer);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (1)
1344Marshal.Copy((IntPtr)(void*)filterData->Ptr, data, 0, data.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (1)
1942Marshal.Copy(data->DataPointer, blob, 0, blob.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\DataCollector.cs (2)
138Marshal.Copy((IntPtr)p, buffer, oldPos, size); 177Marshal.Copy((IntPtr)p, buffer, oldPos, size);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (3)
72Debug.Assert(ret >= 0 || Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_SUCCESS); 291Debug.Assert(result >= 0 || Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_SUCCESS); 460if (Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_INSUFFICIENT_BUFFER)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Nls.cs (1)
174int lastError = Marshal.GetLastPInvokeError();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (4)
67int lastError = Marshal.GetLastPInvokeError(); 139int lastError = Marshal.GetLastPInvokeError(); 182int lastError = Marshal.GetLastPInvokeError(); 205int lastError = Marshal.GetLastPInvokeError();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ArrayWithOffset.cs (1)
23if (array is not Array arrayObj || (arrayObj.Rank != 1) || !Marshal.IsPinnable(arrayObj))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ComWrappers.cs (20)
85return Marshal.QueryInterface(wrapper.ExternalComObject, iid, out unknown) == HResults.S_OK; 97return Marshal.QueryInterface(wrapper.ExternalComObject, IID_IUnknown, out unknown) == HResults.S_OK; 332return Marshal.GetHRForException(ex); 581Marshal.QueryInterface(externalComObject, IID_IReferenceTracker, out trackerObject) == HResults.S_OK) 613Marshal.Release(externalComObject); 644Marshal.Release(_inner); 700Marshal.Release(_trackerObject); 737Marshal.Release(_trackerObject); 998if (0 != Marshal.QueryInterface(comObject, IID_TaggedImpl, out nint implMaybe)) 1005Marshal.Release(implMaybe); 1033Marshal.QueryInterface(externalComObject, IID_IReferenceTracker, out IntPtr referenceTrackerPtr) == HResults.S_OK) 1046Marshal.ThrowExceptionForHR(Marshal.QueryInterface(checkForIdentity, IID_IUnknown, out identity)); 1051Marshal.ThrowExceptionForHR(Marshal.QueryInterface(externalComObject, IID_IUnknown, out identity)); 1174Marshal.Release(identity); 1178Marshal.Release(referenceTrackerMaybe); 1567Marshal.Release(unknownPtr); 1631if (Marshal.QueryInterface(target.Ptr, IID_IUnknown, out IntPtr targetIdentityPtr) == HResults.S_OK) 1891Marshal.Release(_ptr);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\CriticalHandle.cs (2)
149int lastError = Marshal.GetLastPInvokeError(); 153Marshal.SetLastPInvokeError(lastError);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\DispatchWrapper.cs (2)
19IntPtr pdisp = Marshal.GetIDispatchForObject(obj); 22Marshal.Release(pdisp);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ErrorWrapper.cs (1)
26ErrorCode = Marshal.GetHRForException(e);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\GCHandle.cs (2)
42if (type == GCHandleType.Pinned && !Marshal.IsPinnable(value)) 98if (IsPinned(handle) && !Marshal.IsPinnable(value))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\IReferenceTracker.cs (5)
11Marshal.ThrowExceptionForHR((*(delegate* unmanaged<IntPtr, int>**)pThis)[3](pThis)); 29Marshal.ThrowExceptionForHR((*(delegate* unmanaged<IntPtr, IntPtr*, int>**)pThis)[6](pThis, ptr)); 34Marshal.ThrowExceptionForHR((*(delegate* unmanaged<IntPtr, int>**)pThis)[7](pThis)); 39Marshal.ThrowExceptionForHR((*(delegate* unmanaged<IntPtr, int>**)pThis)[8](pThis)); 44Marshal.ThrowExceptionForHR((*(delegate* unmanaged<IntPtr, int>**)pThis)[9](pThis));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\AnsiStringMarshaller.cs (8)
27int exactByteCount = Marshal.GetAnsiStringByteCount(managed); // Includes null terminator 28byte* mem = (byte*)Marshal.AllocCoTaskMem(exactByteCount); 31Marshal.GetAnsiStringBytes(managed, buffer); // Includes null terminator 41=> Marshal.PtrToStringAnsi((IntPtr)unmanaged); 48=> Marshal.FreeCoTaskMem((IntPtr)unmanaged); 80if ((long)Marshal.SystemMaxDBCSCharSize * managed.Length >= buffer.Length) 83int exactByteCount = Marshal.GetAnsiStringByteCount(managed); // Includes null terminator 94Marshal.GetAnsiStringBytes(managed, buffer); // Includes null terminator
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ArrayMarshaller.cs (2)
44return (TUnmanagedElement*)Marshal.AllocCoTaskMem(spaceToAllocate); 110=> Marshal.FreeCoTaskMem((IntPtr)unmanaged);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\BStrStringMarshaller.cs (5)
25=> (ushort*)Marshal.StringToBSTR(managed); 37return Marshal.PtrToStringBSTR((IntPtr)unmanaged); 45=> Marshal.FreeBSTR((IntPtr)unmanaged); 84ptrToFirstChar = (ushort*)Marshal.AllocBSTRByteLen((uint)lengthInBytes); 97Debug.Assert(lengthInBytes == Marshal.SysStringByteLen((IntPtr)ptrToFirstChar));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ComVariant.cs (19)
150Marshal.FreeBSTR(_typeUnion._unionTypes._bstr); 160Marshal.Release(_typeUnion._unionTypes._unknown); 170Marshal.ThrowExceptionForHR(((delegate* unmanaged<IntPtr, IntPtr, int>)(*(*(void***)_typeUnion._unionTypes._record._recordInfo + 4 /* IRecordInfo.RecordClear slot */)))(_typeUnion._unionTypes._record._recordInfo, _typeUnion._unionTypes._record._record)); 172Marshal.Release(_typeUnion._unionTypes._record._recordInfo); 177Marshal.FreeCoTaskMem(_typeUnion._unionTypes._byref); 181Marshal.FreeCoTaskMem(_typeUnion._unionTypes._blob._data); 187Marshal.Release(_typeUnion._unionTypes._unknown); 195Marshal.Release(versionedStream->_stream); 197Marshal.FreeCoTaskMem((nint)versionedStream); 204Marshal.FreeCoTaskMem(clipboardData->_data); 205Marshal.FreeCoTaskMem((nint)clipboardData); 215Marshal.FreeBSTR(str); 222Marshal.FreeCoTaskMem(str); 228Marshal.FreeCoTaskMem(cf._data); 240Marshal.FreeCoTaskMem((nint)GetRawDataRef<Vector<byte>>()._data); 297variant._typeUnion._unionTypes._bstr = Marshal.StringToBSTR(((BStrWrapper)(object)value).WrappedObject); 307variant._typeUnion._unionTypes._bstr = Marshal.StringToBSTR((string)(object)value); 485return (T)(object)new BStrWrapper(Marshal.PtrToStringBSTR(_typeUnion._unionTypes._bstr)); 496return (T)(object)Marshal.PtrToStringBSTR(_typeUnion._unionTypes._bstr);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (2)
45return (TUnmanagedElement*)Marshal.AllocCoTaskMem(spaceToAllocate); 111=> Marshal.FreeCoTaskMem((IntPtr)unmanaged);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (2)
55return (TUnmanagedElement*)Marshal.AllocCoTaskMem(spaceToAllocate); 232Marshal.FreeCoTaskMem((IntPtr)_unmanagedArray);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SafeHandleMarshaller.cs (2)
108Marshal.InitHandle(_newHandle, value); 175Marshal.InitHandle(_newHandle, value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (2)
49return (TUnmanagedElement*)Marshal.AllocCoTaskMem(spaceToAllocate); 115=> Marshal.FreeCoTaskMem((IntPtr)unmanaged);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf16StringMarshaller.cs (3)
22=> (ushort*)Marshal.StringToCoTaskMemUni(managed); 30=> Marshal.PtrToStringUni((IntPtr)unmanaged); 37=> Marshal.FreeCoTaskMem((IntPtr)unmanaged);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf8StringMarshaller.cs (3)
29byte* mem = (byte*)Marshal.AllocCoTaskMem(exactByteCount); 43=> Marshal.PtrToStringUTF8((IntPtr)unmanaged); 50=> Marshal.FreeCoTaskMem((IntPtr)unmanaged);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeLibrary.cs (1)
263throw new Win32Exception(Marshal.GetLastPInvokeError());
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeLibrary.Unix.cs (1)
17string? message = Marshal.PtrToStringUTF8(Interop.Sys.GetLoadLibraryError());
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ReferenceTrackerHost.cs (9)
53return Marshal.GetHRForException(e); 80return Marshal.GetHRForException(e); 94if (Marshal.QueryInterface(punk, ComWrappers.IID_IUnknown, out IntPtr ppv) != HResults.S_OK) 103return Marshal.QueryInterface(trackerTarget.Ptr, ComWrappers.IID_IReferenceTrackerTarget, out *ppNewReference); 107return Marshal.GetHRForException(e); 123return Marshal.GetHRForException(e); 139return Marshal.GetHRForException(e); 151Marshal.AddRef(pThis); 215Marshal.ThrowExceptionForHR((*(delegate* unmanaged<IntPtr, IntPtr, int>**)pThis)[6](pThis, referenceTrackerHost));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeHandle.cs (2)
259int lastError = Marshal.GetLastPInvokeError(); 261Marshal.SetLastPInvokeError(lastError);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\TrackerObjectManager.cs (1)
36Marshal.Release(referenceTrackerManager);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (10)
323ptr = Marshal.AllocBSTR(length); 336Marshal.FreeBSTR(ptr); 366byteLength = Marshal.GetAnsiStringByteCount(span); 371ptr = Marshal.AllocHGlobal(byteLength); 375ptr = Marshal.AllocCoTaskMem(byteLength); 386Marshal.GetAnsiStringBytes(span, new Span<byte>((void*)ptr, byteLength)); 402Marshal.FreeHGlobal(ptr); 406Marshal.FreeCoTaskMem(ptr); 430buffer.SetHandle(Marshal.AllocHGlobal(byteLength)); 468Marshal.FreeHGlobal(handle);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\WaitSubsystem.Unix.cs (1)
165Marshal.InitHandle(safeWaitHandle, handle);
src\runtime\src\libraries\System.Private.CoreLib\src\System\ThrowHelper.cs (1)
651Exception? ex = Marshal.GetExceptionForHR(hr);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Type.cs (2)
565public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError) => Marshal.GetTypeFromCLSID(clsid, server, throwOnError); 574public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) => Marshal.GetTypeFromProgID(progID, server, throwOnError);
System\Runtime\InteropServices\PInvokeMarshal.cs (2)
486Marshal.FreeCoTaskMem(new IntPtr(nativeArray)); 519pNative = (byte*)Marshal.AllocCoTaskMem(checked(length + 1));
System.Private.Windows.Core (121)
_generated\10\Windows.Win32.BSTR.g.cs (1)
50 public override string ToString() => this.Value != null ? Marshal.PtrToStringBSTR(new IntPtr(this.Value)) : null;
_generated\120\Windows.Win32.HRESULT.g.cs (4)
65 /// <inheritdoc cref="Marshal.ThrowExceptionForHR(int, IntPtr)" /> 73 /// <seealso cref="Marshal.ThrowExceptionForHR(int, IntPtr)"/> 77 Marshal.ThrowExceptionForHR(this.Value, errorInfo); 87 return string.Format("{0} {1}", ToString(), global::System.Runtime.InteropServices.Marshal.GetPInvokeErrorMessage((int)this.Value));
_generated\195\Windows.Win32.PInvokeCore.GDI32.dll.g.cs (6)
50 Marshal.SetLastSystemError(0); 52 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 240 Marshal.SetLastSystemError(0); 242 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\197\Windows.Win32.PInvokeCore.KERNEL32.dll.g.cs (30)
40 Marshal.SetLastSystemError(0); 42 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 64 Marshal.SetLastSystemError(0); 66 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 112 Marshal.SetLastSystemError(0); 114 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 136 Marshal.SetLastSystemError(0); 138 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 166 Marshal.SetLastSystemError(0); 168 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 190 Marshal.SetLastSystemError(0); 192 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 214 Marshal.SetLastSystemError(0); 216 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 238 Marshal.SetLastSystemError(0); 240 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 287 Marshal.SetLastSystemError(0); 289 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 362 Marshal.SetLastSystemError(0); 364 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\201\Windows.Win32.PInvokeCore.USER32.dll.g.cs (54)
112 Marshal.SetLastSystemError(0); 114 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 165 Marshal.SetLastSystemError(0); 167 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 219 Marshal.SetLastSystemError(0); 221 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 351 Marshal.SetLastSystemError(0); 353 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 388 Marshal.SetLastSystemError(0); 390 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 431 Marshal.SetLastSystemError(0); 433 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 506 Marshal.SetLastSystemError(0); 508 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 543 Marshal.SetLastSystemError(0); 545 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 651 Marshal.SetLastSystemError(0); 653 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 694 Marshal.SetLastSystemError(0); 696 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 719 Marshal.SetLastSystemError(0); 721 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 783 Marshal.SetLastSystemError(0); 785 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 824 Marshal.SetLastSystemError(0); 826 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 982 Marshal.SetLastSystemError(0); 984 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1018 Marshal.SetLastSystemError(0); 1020 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1068 Marshal.SetLastSystemError(0); 1070 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1113 Marshal.SetLastSystemError(0); 1115 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1146 Marshal.SetLastSystemError(0); 1148 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
System\Private\Windows\Ole\Composition.NativeToManagedAdapter.cs (1)
168Marshal.Copy((nint)buffer, bytes, 0, size);
System\Private\Windows\Ole\DragDropFormat.cs (1)
85Marshal.AddRef(mediumSource.hGlobal);
System\Private\Windows\Ole\DragDropHelper.cs (4)
216throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException); 223throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException); 374throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException); 381throw new Win32Exception(Marshal.GetLastWin32Error(), SR.ExternalException);
Windows\Win32\Foundation\BSTR.cs (2)
10public BSTR(string? value) : this((char*)Marshal.StringToBSTR(value)) 18Marshal.FreeBSTR((nint)Value);
Windows\Win32\Foundation\PWSTR.cs (1)
16Marshal.FreeCoTaskMem((IntPtr)Value);
Windows\Win32\PInvokeCore.GetWindowText.cs (1)
28int error = Marshal.GetLastWin32Error();
Windows\Win32\PInvokeCore.SetWindowLong.cs (1)
36IntPtr pointer = Marshal.GetFunctionPointerForDelegate(dwNewLong);
Windows\Win32\System\Com\ComHelpers.cs (3)
109ccw = (ComUnknown*)Marshal.GetIUnknownForObject(@object); 267using ComScope<ComUnknown> ccw = new((ComUnknown*)(void*)Marshal.GetIUnknownForObject(@object)); 318return Marshal.GetObjectForIUnknown((nint)unknown);
Windows\Win32\System\Com\ComManagedStream.cs (1)
217pstatstg->pwcsName = (char*)Marshal.StringToCoTaskMemUni(_dataStream is FileStream fs ? fs.Name : _dataStream.ToString());
Windows\Win32\System\Com\Lifetime.cs (2)
32Marshal.FreeCoTaskMem((nint)lifetime); 54var wrapper = (Lifetime<TVTable, TObject>*)Marshal.AllocCoTaskMem(sizeof(Lifetime<TVTable, TObject>));
Windows\Win32\System\Variant\VARIANT.cs (8)
167return Marshal.PtrToStringUni(*(IntPtr*)data); 169return Marshal.PtrToStringAnsi(*(IntPtr*)data); 388result[i] = Marshal.PtrToStringUni(data[i]); 597SetValue(array, Marshal.PtrToStringUni(data), indices, lowerBounds); 838result[i] = Marshal.PtrToStringUni(data[i]); 850result[i] = Marshal.PtrToStringAnsi(data[i]); 876=> MemoryMarshal.CreateSpan(ref Unsafe.AsRef<T>(Marshal.UnsafeAddrOfPinnedArrayElement(array, 0).ToPointer()), array.Length); 1023Marshal.GetNativeVariantForObject(value, (nint)(void*)&variant);
Windows\Win32\System\Variant\VARIANTVector.cs (1)
23Marshal.GetNativeVariantForObject(values[i], (IntPtr)(&pVariants[i]));
System.Private.Windows.GdiPlus (3)
System\Drawing\IIconExtensions.cs (1)
37return Marshal.GetObjectForIUnknown(picture);
Windows\Win32\System\Ole\IPicture.cs (2)
16return Marshal.GetObjectForIUnknown(picture); 31return Marshal.GetObjectForIUnknown(picture);
System.Reflection.Metadata (5)
System\Reflection\Internal\MemoryBlocks\NativeHeapMemoryBlock.cs (2)
32_pointer = Marshal.AllocHGlobal(size); 49Marshal.FreeHGlobal(ptr);
System\Reflection\Internal\Utilities\EncodingHelper.cs (1)
48Marshal.Copy((IntPtr)bytes, buffer, prefix.Length, byteCount);
System\Reflection\Metadata\BlobReader.cs (1)
437Marshal.Copy((IntPtr)GetCurrentPointerAndAdvance(byteCount), buffer, bufferOffset, byteCount);
System\Reflection\Metadata\Internal\StringHeap.cs (1)
188Marshal.Copy((IntPtr)block.Pointer, bytes, prefix.Length, block.Length);
System.Runtime.InteropServices (32)
src\runtime\artifacts\obj\System.Runtime.InteropServices\Release\net11.0\System.Runtime.InteropServices.Forwards.cs (1)
110[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.Marshal))]
System\Runtime\InteropServices\ComAwareEventInfo.cs (2)
32if (Marshal.IsComObject(target)) 50if (Marshal.IsComObject(target))
System\Runtime\InteropServices\Marshalling\ComImportInteropInterfaceDetailsStrategy.cs (1)
194/// <remarks>The returned object must be an object such that a call to <see cref="Marshal.IsComObject(object)"/> would return true.</remarks>
System\Runtime\InteropServices\Marshalling\ComInterfaceMarshaller.cs (4)
68Marshal.Release((nint)unmanaged); 79if (Marshal.QueryInterface(unknown, in Nullable.GetValueRefOrDefaultRef(in TargetInterfaceIID), out nint interfacePointer) != 0) 81Marshal.Release(unknown); 84Marshal.Release(unknown);
System\Runtime\InteropServices\Marshalling\ComObject.cs (5)
46_runtimeCallableWrapper = Marshal.GetObjectForIUnknown((nint)thisPointer); 47Debug.Assert(Marshal.IsComObject(_runtimeCallableWrapper)); 99Marshal.ThrowExceptionForHR(qiResult); 111Marshal.ThrowExceptionForHR(qiResult); 157Marshal.ThrowExceptionForHR(qiHResult);
System\Runtime\InteropServices\Marshalling\ComVariantMarshaller.cs (5)
195return Marshal.PtrToStringBSTR(*(IntPtr*)unmanaged.GetRawDataRef<nint>()); 306Marshal.FreeBSTR(bstrStorage); 307bstrStorage = Marshal.StringToBSTR(str); 313Marshal.FreeBSTR(bstrStorage); 314bstrStorage = Marshal.StringToBSTR(str.WrappedObject);
System\Runtime\InteropServices\Marshalling\ExceptionAsDefaultMarshaller.cs (1)
23_ = Marshal.GetHRForException(e);
System\Runtime\InteropServices\Marshalling\ExceptionAsHResultMarshaller.cs (1)
38return T.CreateTruncating(Marshal.GetHRForException(e));
System\Runtime\InteropServices\Marshalling\ExceptionAsNaNMarshaller.cs (1)
25_ = Marshal.GetHRForException(e);
System\Runtime\InteropServices\Marshalling\ExceptionAsVoidMarshaller.cs (1)
25_ = Marshal.GetHRForException(e);
System\Runtime\InteropServices\Marshalling\FreeThreadedStrategy.cs (3)
19Marshal.AddRef((nint)unknown); 25int hr = Marshal.QueryInterface((nint)thisPtr, handle, out nint ppv); 38=> Marshal.Release((nint)thisPtr);
System\Runtime\InteropServices\Marshalling\IIUnknownStrategy.cs (2)
35/// <seealso cref="Marshal.QueryInterface(nint, in Guid, out nint)"/> 43/// <seealso cref="Marshal.Release(nint)"/>
System\Runtime\InteropServices\Marshalling\UniqueComInterfaceMarshaller.cs (1)
70Marshal.Release((nint)unmanaged);
System\Security\SecureStringMarshal.cs (4)
10public static IntPtr SecureStringToCoTaskMemAnsi(SecureString s) => Marshal.SecureStringToCoTaskMemAnsi(s); 11public static IntPtr SecureStringToGlobalAllocAnsi(SecureString s) => Marshal.SecureStringToGlobalAllocAnsi(s); 12public static IntPtr SecureStringToCoTaskMemUnicode(SecureString s) => Marshal.SecureStringToCoTaskMemUnicode(s); 13public static IntPtr SecureStringToGlobalAllocUnicode(SecureString s) => Marshal.SecureStringToGlobalAllocUnicode(s);
System.Runtime.InteropServices.JavaScript (11)
System\Runtime\InteropServices\JavaScript\JSFunctionBinding.cs (1)
442var message = Marshal.PtrToStringUni(exceptionPtr)!;
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Byte.cs (2)
94Marshal.Copy(slot.IntPtrValue, value, 0, slot.Length); 114Marshal.Copy(value, 0, slot.IntPtrValue, slot.Length);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Double.cs (2)
97Marshal.Copy(slot.IntPtrValue, value, 0, slot.Length); 120Marshal.Copy(value, 0, slot.IntPtrValue, slot.Length);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Int32.cs (2)
94Marshal.Copy(slot.IntPtrValue, value, 0, slot.Length); 114Marshal.Copy(value, 0, slot.IntPtrValue, slot.Length);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.Single.cs (2)
97Marshal.Copy(slot.IntPtrValue, value, 0, slot.Length); 120Marshal.Copy(value, 0, slot.IntPtrValue, slot.Length);
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.String.cs (2)
26value = Marshal.PtrToStringUni(slot.IntPtrValue, slot.Length); 54slot.IntPtrValue = Marshal.StringToHGlobalUni(value); // alloc, JS side will free
System.Security.AccessControl (56)
_generated\0\LibraryImports.g.cs (39)
20global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 22__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 27global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 50global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 52__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 57global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 85global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 87__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 92global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 120global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 122__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 127global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 201global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 203__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 212global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 246global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 248__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 251global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 279global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 281__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 284global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 315global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 317__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 322global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 355global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 357__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 376global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 406global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 408__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 427global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 467global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 469__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 481global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 523global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 525__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 537global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 574global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 576__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 600global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
System\Security\AccessControl\Privilege.cs (6)
94int error = Marshal.GetLastPInvokeError(); 169cachingError = Marshal.GetLastPInvokeError(); 212error = Marshal.GetLastPInvokeError(); 414error = Marshal.GetLastPInvokeError(); 416else if (Interop.Errors.ERROR_NOT_ALL_ASSIGNED == Marshal.GetLastPInvokeError()) 497error = Marshal.GetLastPInvokeError();
System\Security\AccessControl\SecurityDescriptor.cs (3)
461error = Marshal.GetLastPInvokeError(); 492Marshal.Copy(byteArray, binaryForm, 0, (int)byteArraySize); 499Marshal.FreeHGlobal(byteArray);
System\Security\AccessControl\Win32.cs (5)
32errorCode = Marshal.GetLastPInvokeError(); 37resultSddl = Marshal.PtrToStringUni(ByteArray)!; 40Marshal.FreeHGlobal(ByteArray); 170Marshal.Copy(ByteArray, BinaryForm, 0, (int)Length); 172Marshal.FreeHGlobal(ByteArray);
System\Security\Principal\Win32.cs (3)
33hr = Marshal.GetHRForLastWin32Error(); 37hr = Marshal.GetHRForLastWin32Error(); 54hr = Marshal.GetHRForLastWin32Error();
System.Security.Cryptography (372)
_generated\0\LibraryImports.g.cs (249)
25global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 27__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 46global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 72global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 74__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 79global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 119global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 121__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 144global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 185global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 187__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 200global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 240global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 242__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 265global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 288global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 290__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 295global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 318global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 320__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 325global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 366global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 368__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 381global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 420global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 422__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 435global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 471global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 473__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 495global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 521global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 523__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 528global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 564global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 566__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 578global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 612global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 614__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 626global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 661global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 663__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 675global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 707global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 709__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 721global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 755global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 757__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 769global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 803global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 805__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 817global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 853global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 855__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 877global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 911global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 913__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 925global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 965global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 967__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 990global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1013global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1015__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1020global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1054global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1056__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1068global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1102global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1104__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1116global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1152global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1154__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1166global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1205global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1207__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1220global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2726global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2728__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2741global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2777global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2779__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2792global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2815global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2817__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2822global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2854global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2856__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2868global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2900global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2902__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2921global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2944global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2946__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2951global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 2979global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 2981__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 2999global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3027global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3029__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3047global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3075global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3077__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3095global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3123global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3125__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3143global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3174global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3176__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3185global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3219global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3221__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3242global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3273global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3275__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3284global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3305global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3307__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3310global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3359global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3361__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3384global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3419global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3421__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3433global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3467global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3469__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3481global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3517global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3519__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3531global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3567global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3569__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3581global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3615global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3617__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3629global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3655global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3657__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3662global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3695global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3697__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3706global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3743global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3745__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3768global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3791global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3793__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3798global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3833global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3835__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3847global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3869global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3871__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3874global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3904global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3906__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3924global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 3958global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 3960__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 3972global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4007global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4009__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4021global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4053global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4055__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4067global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4090global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4092__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4097global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4129global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4131__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4143global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4179global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4181__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4194global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4226global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4228__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4240global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4267global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4269__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4274global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4298global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4300__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4303global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4344global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4346__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4369global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4396global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4398__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4403global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4429global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4431__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4436global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4461global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4463__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4468global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4503global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4505__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4517global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4543global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4545__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4550global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4585global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4587__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4599global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4625global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4627__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4632global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4662global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4664__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4683global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4706global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4708__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4713global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4749global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4751__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4763global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4797global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4799__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4811global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4847global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4849__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4861global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4895global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4897__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4909global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 4952global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 4954__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 4979global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5005global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5007__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5012global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5045global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5047__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5066global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5099global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5101__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5120global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5174global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5176__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5189global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5225global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5227__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5248global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5278global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5280__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5298global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 5320global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 5322__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 5325global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (4)
29handle = Marshal.StringToHGlobalUni(password); 47handle = Marshal.AllocHGlobal(spanLen * sizeof(char)); 68handle = Marshal.SecureStringToGlobalAllocUnicode(password); 77Marshal.ZeroFreeGlobalAllocUnicode(handle);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.CRYPT_BIT_BLOB.cs (1)
22Marshal.Copy(pbData, data, 0, numBytes);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.DATA_BLOB.cs (1)
31Marshal.Copy(pbData, array, 0, (int)cbData);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.FindOidInfo.cs (5)
28return Marshal.PtrToStringAnsi(pszOID); 36return Marshal.PtrToStringUni(pwszName); 62rawKey = Marshal.StringToCoTaskMemAnsi(key); 66rawKey = Marshal.StringToCoTaskMemUni(key); 110Marshal.FreeCoTaskMem(rawKey);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptDeriveKeyMaterial.cs (2)
58hashAlgorithmString = Marshal.StringToCoTaskMemUni(hashAlgorithm); 124Marshal.FreeCoTaskMem(hashAlgorithmString);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeCertContextHandleWithKeyContainerDeletion.cs (2)
51string providerName = Marshal.PtrToStringUni((IntPtr)(pProvInfo->pwszProvName))!; 52string keyContainerName = Marshal.PtrToStringUni((IntPtr)(pProvInfo->pwszContainerName))!;
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeUnicodeStringHandle.cs (3)
21handle = Marshal.StringToHGlobalUni(s); 36handle = Marshal.AllocHGlobal(cb); 54Marshal.FreeHGlobal(handle);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.cs (1)
138string valueAsString = Marshal.PtrToStringUni((IntPtr)pValue)!;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (4)
93IntPtr namePtr = Marshal.StringToHGlobalUni(padding.OaepHashAlgorithm.Name); 108Marshal.FreeHGlobal(namePtr); 175IntPtr namePtr = Marshal.StringToHGlobalUni(padding.OaepHashAlgorithm.Name); 188Marshal.FreeHGlobal(namePtr);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.SignVerify.cs (6)
56IntPtr namePtr = Marshal.StringToHGlobalUni(hashAlgorithmName); 79Marshal.FreeHGlobal(namePtr); 97IntPtr namePtr = Marshal.StringToHGlobalUni(hashAlgorithmName); 116Marshal.FreeHGlobal(namePtr); 145IntPtr namePtr = Marshal.StringToHGlobalUni(hashAlgorithmName); 164Marshal.FreeHGlobal(namePtr);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\CertificateHelpers.Windows.cs (3)
223int dwErrorCode = Marshal.GetLastPInvokeError(); 241ProviderName = Marshal.PtrToStringUni((IntPtr)(pKeyProvInfo->pwszProvName)), 242KeyContainerName = Marshal.PtrToStringUni((IntPtr)(pKeyProvInfo->pwszContainerName)),
System\Security\Cryptography\CapiHelper.Windows.cs (17)
302IntPtr password = Marshal.SecureStringToCoTaskMemAnsi(parameters.KeyPassword); 319Marshal.ZeroFreeCoTaskMemAnsi(password); 767return Marshal.GetLastPInvokeError(); 989int hr = Marshal.GetHRForLastWin32Error(); 1163int hr = Marshal.GetHRForLastWin32Error(); 1170int hr = Marshal.GetHRForLastWin32Error(); 1243int hr = Marshal.GetHRForLastWin32Error(); 1250int hr = Marshal.GetHRForLastWin32Error(); 1257int hr = Marshal.GetHRForLastWin32Error(); 1270int hr = Marshal.GetHRForLastWin32Error(); 1278int hr = Marshal.GetHRForLastWin32Error(); 1310int hr = Marshal.GetHRForLastWin32Error(); 1318int hr = Marshal.GetHRForLastWin32Error(); 1326int hr = Marshal.GetHRForLastWin32Error(); 1378int hr = Marshal.GetHRForLastWin32Error(); 1391int hr = Marshal.GetHRForLastWin32Error(); 1407int hr = Marshal.GetHRForLastWin32Error();
System\Security\Cryptography\CngAsnFormatter.cs (2)
26IntPtr oidValuePtr = Marshal.StringToHGlobalAnsi(oidValue); 47Marshal.FreeHGlobal(oidValuePtr);
System\Security\Cryptography\CngKey.OpenHandle.cs (1)
38Marshal.InitHandle(providerHandle, rawProviderHandle);
System\Security\Cryptography\CngKey.StandardProperties.cs (3)
368friendlyName = Marshal.PtrToStringUni(pNcryptUiPolicy->pszFriendlyName); 369description = Marshal.PtrToStringUni(pNcryptUiPolicy->pszDescription); 370creationTitle = Marshal.PtrToStringUni(pNcryptUiPolicy->pszCreationTitle);
System\Security\Cryptography\X509Certificates\CertificateHelpers.Windows.cs (1)
14Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.cs (13)
69throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 73throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 86return Marshal.PtrToStringAnsi(certContext->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId)!; 100string keyAlgorithmOid = Marshal.PtrToStringAnsi(pCertContext->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId)!; 158throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 160throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 165throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 214return Marshal.PtrToStringAnsi(pCertContext->pCertInfo->SignatureAlgorithm.pszObjId)!; 283throw Marshal.GetLastPInvokeError().ToCryptographicException(); 317IntPtr pFriendlyName = Marshal.StringToHGlobalUni(friendlyName); 322throw Marshal.GetLastPInvokeError().ToCryptographicException(); 326Marshal.FreeHGlobal(pFriendlyName); 384string oidValue = Marshal.PtrToStringAnsi(pCertExtension->pszObjId)!;
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.Import.cs (5)
64int hr = Marshal.GetHRForLastWin32Error(); 127throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 134throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 139throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 152Exception e = Marshal.GetHRForLastWin32Error().ToCryptographicException();
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.PrivateKey.cs (1)
276Exception e = Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\ChainPal.Windows.cs (2)
55int errorCode = Marshal.GetLastPInvokeError(); 79string information = Marshal.PtrToStringUni(pChainElement->pwszExtendedErrorInfo)!;
System\Security\Cryptography\X509Certificates\FindPal.Windows.cs (5)
144string? actual = Marshal.PtrToStringAnsi(pTemplateExt->pszObjId); 243string actual = Marshal.PtrToStringAnsi(pOids[i])!; 265string actual = Marshal.PtrToStringAnsi(pCertPolicyInfo->pszPolicyIdentifier)!; 402Exception e = Marshal.GetHRForLastWin32Error().ToCryptographicException(); 426throw Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\LegacyBasicConstraintsDecoder.Windows.cs (1)
28return ((Marshal.ReadByte(pBasicConstraints->SubjectType.pbData) & CERT_BASIC_CONSTRAINTS_INFO.CERT_CA_SUBJECT_FLAG) != 0,
System\Security\Cryptography\X509Certificates\SafeLocalAllocHandle.cs (2)
17h.SetHandle(Marshal.AllocHGlobal(cb)); 23Marshal.FreeHGlobal(handle);
System\Security\Cryptography\X509Certificates\StorePal.Windows.cs (2)
55throw Marshal.GetLastPInvokeError().ToCryptographicException(); 74throw Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\StorePal.Windows.Export.cs (7)
42Marshal.Copy((IntPtr)(pCertContext.DangerousCertContext->pbCertEncoded), rawData, 0, rawData.Length); 63throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 67throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 145throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 156throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 257throw Marshal.GetLastPInvokeError().ToCryptographicException(); 264throw Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\StorePal.Windows.Import.cs (5)
54Exception e = Marshal.GetLastPInvokeError().ToCryptographicException(); 136Exception e = Marshal.GetHRForLastWin32Error().ToCryptographicException(); 164throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 178throw Marshal.GetLastPInvokeError().ToCryptographicException(); 199Exception e = Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\WindowsHelpers.cs (4)
94throw Marshal.GetLastPInvokeError().ToCryptographicException(); 116throw Marshal.GetLastPInvokeError().ToCryptographicException(); 140throw Marshal.GetLastPInvokeError().ToCryptographicException(); 162throw Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\WindowsInterop.crypt32.cs (8)
29throw Marshal.GetLastPInvokeError().ToCryptographicException(); 37throw Marshal.GetLastPInvokeError().ToCryptographicException(); 70Marshal.InitHandle(pCertContext, (IntPtr)Crypt32.CertEnumCertificatesInStore(hCertStore, pPrevCertContext)); 108throw Marshal.GetLastPInvokeError().ToCryptographicException(); 112throw Marshal.GetLastPInvokeError().ToCryptographicException(); 121throw Marshal.GetLastPInvokeError().ToCryptographicException(); 125throw Marshal.GetLastPInvokeError().ToCryptographicException(); 134Exception e = Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\X509CertificateLoader.Windows.cs (2)
204throw Marshal.GetHRForLastWin32Error().ToCryptographicException(); 272Exception e = Marshal.GetHRForLastWin32Error().ToCryptographicException();
System\Security\Cryptography\X509Certificates\X509Pal.Windows.GetCertContentType.cs (2)
37throw Marshal.GetLastPInvokeError().ToCryptographicException(); 66throw Marshal.GetLastPInvokeError().ToCryptographicException();
System\Security\Cryptography\X509Certificates\X509Pal.Windows.PublicKey.cs (4)
145Exception e = Marshal.GetHRForLastWin32Error().ToCryptographicException(); 205throw Marshal.GetLastPInvokeError().ToCryptographicException(); 209throw Marshal.GetLastPInvokeError().ToCryptographicException(); 341string? valueAsString = Marshal.PtrToStringUni((IntPtr)pValue);
System\Security\Cryptography\X509Certificates\X509Pal.Windows.X500DistinguishedName.cs (2)
51throw Marshal.GetLastPInvokeError().ToCryptographicException(); 55throw Marshal.GetLastPInvokeError().ToCryptographicException();
System.Security.Cryptography.Pkcs (140)
_generated\0\LibraryImports.g.cs (93)
26global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 28__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 47global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 71global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 73__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 78global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 102global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 104__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 109global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 142global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 144__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 156global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 191global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 193__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 205global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 240global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 242__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 254global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 278global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 280__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 285global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 308global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 310__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 313global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 337global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 339__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 344global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 380global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 382__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 394global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 429global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 431__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 443global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 480global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 482__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 494global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 531global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 533__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 545global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 570global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 572__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 575global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 598global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 600__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 603global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 643global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 645__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 658global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 684global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 686__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 691global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 718global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 720__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 725global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 749global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 751__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 756global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 791global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 793__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 805global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 840global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 842__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 854global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 891global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 893__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 905global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 940global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 942__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 954global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 991global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 993__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1005global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1040global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1042__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1054global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1083global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1085__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1103global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1138global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1140__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1161global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1198global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1200__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1212global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1247global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1249__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1261global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1298global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1300__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1312global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1343global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1345__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1348global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.Decode.cs (2)
33throw Marshal.GetLastPInvokeError().ToCryptographicException(); 41throw Marshal.GetLastPInvokeError().ToCryptographicException();
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.DecodeRecipients.cs (1)
22throw Marshal.GetLastPInvokeError().ToCryptographicException();
Internal\Cryptography\Pal\Windows\DecryptorPalWindows.Decrypt.cs (4)
140ErrorCode errorCode = (ErrorCode)(Marshal.GetLastPInvokeError()); 152ErrorCode errorCode = (ErrorCode)(Marshal.GetLastPInvokeError()); 182return Marshal.GetHRForLastWin32Error().ToCryptographicException(); 264ErrorCode errorCode = (ErrorCode)(Marshal.GetHRForLastWin32Error());
Internal\Cryptography\Pal\Windows\HeapBlockRetainer.cs (1)
61Marshal.Copy(data, 0, pData, data.Length);
Internal\Cryptography\Pal\Windows\HelpersWindows.cs (20)
29return Marshal.PtrToStringAnsi(psz)!; 37throw Marshal.GetLastPInvokeError().ToCryptographicException(); 43throw Marshal.GetLastPInvokeError().ToCryptographicException(); 55throw Marshal.GetLastPInvokeError().ToCryptographicException(); 61Exception e = Marshal.GetLastPInvokeError().ToCryptographicException(); 76Marshal.Copy(blob.pbData, data, 0, length); 85throw Marshal.GetLastPInvokeError().ToCryptographicException(); 94throw Marshal.GetLastPInvokeError().ToCryptographicException(); 129throw Marshal.GetLastPInvokeError().ToCryptographicException(); 162throw Marshal.GetLastPInvokeError().ToCryptographicException(); 166throw Marshal.GetLastPInvokeError().ToCryptographicException(); 187throw Marshal.GetLastPInvokeError().ToCryptographicException(); 196throw Marshal.GetLastPInvokeError().ToCryptographicException(); 273throw Marshal.GetLastPInvokeError().ToCryptographicException(); 342int lastError = Marshal.GetLastPInvokeError(); 379throw Marshal.GetLastPInvokeError().ToCryptographicException(); 393throw Marshal.GetLastPInvokeError().ToCryptographicException(); 455throw Marshal.GetLastPInvokeError().ToCryptographicException(); 460throw Marshal.GetLastPInvokeError().ToCryptographicException(); 468return Marshal.PtrToStringAnsi((IntPtr)asciiPtr, len);
Internal\Cryptography\Pal\Windows\PkcsPalWindows.cs (4)
34throw Marshal.GetLastPInvokeError().ToCryptographicException(); 37throw Marshal.GetLastPInvokeError().ToCryptographicException(); 42throw Marshal.GetLastPInvokeError().ToCryptographicException(); 241exception = Marshal.GetHRForLastWin32Error().ToCryptographicException();
Internal\Cryptography\Pal\Windows\PkcsPalWindows.Encrypt.cs (2)
48throw Marshal.GetLastPInvokeError().ToCryptographicException(); 123Exception e = Marshal.GetLastPInvokeError().ToCryptographicException();
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.CRYPT_BIT_BLOB.cs (1)
22Marshal.Copy(pbData, data, 0, numBytes);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.CryptEncodeDecodeWrappers.cs (4)
33throw Marshal.GetLastPInvokeError().ToCryptographicException(); 39Exception e = Marshal.GetLastPInvokeError().ToCryptographicException(); 52throw Marshal.GetLastPInvokeError().ToCryptographicException(); 58throw Marshal.GetLastPInvokeError().ToCryptographicException();
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.DATA_BLOB.cs (1)
31Marshal.Copy(pbData, array, 0, (int)cbData);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.FindOidInfo.cs (5)
28return Marshal.PtrToStringAnsi(pszOID); 36return Marshal.PtrToStringUni(pwszName); 62rawKey = Marshal.StringToCoTaskMemAnsi(key); 66rawKey = Marshal.StringToCoTaskMemUni(key); 110Marshal.FreeCoTaskMem(rawKey);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
System.Security.Cryptography.ProtectedData (14)
_generated\0\LibraryImports.g.cs (9)
22global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 24__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 29global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 58global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 60__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 65global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 88global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 90__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 93global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.DATA_BLOB.cs (1)
31Marshal.Copy(pbData, array, 0, (int)cbData);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
System\Security\Cryptography\ProtectedData.cs (2)
363int lastWin32Error = Marshal.GetLastPInvokeError(); 405Marshal.FreeHGlobal(outputBlob.pbData);
System.Security.Principal.Windows (114)
_generated\0\LibraryImports.g.cs (72)
38global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 40__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 59global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 85global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 87__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 92global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 131global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 133__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 146global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 181global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 183__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 195global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 232global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 234__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 258global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 291global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 293__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 312global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 335global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 337__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 342global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 373global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 375__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 393global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 415global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 417__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 420global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 474global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 476__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 510global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 550global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 552__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 576global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 598global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 600__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 603global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 625global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 627__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 630global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 662global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 664__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 682global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 708global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 710__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 713global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 739global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 741__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 744global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 769global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 771__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 776global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 802global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 804__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 807global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 831global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 833__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 836global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 863global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 865__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 870global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 903global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 905__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 924global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 947global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 949__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 954global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 986global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 988__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1000global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 1236global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 1238__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 1251global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaLookupNames2.cs (3)
40m.Buffer = Marshal.PtrToStringUni(unmanaged.Buffer)!; 49n.Buffer = Marshal.StringToCoTaskMemUni(managed.Buffer); 55Marshal.FreeCoTaskMem(native.Buffer);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaLookupSids.cs (1)
31referencedDomains.Initialize((uint)Marshal.SizeOf<Interop.LSA_REFERENCED_DOMAIN_LIST>());
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs (2)
18h.SetHandle(Marshal.AllocHGlobal(cb)); 39Marshal.FreeHGlobal(handle);
System\Security\Principal\SID.cs (3)
612throw new ArgumentException(Marshal.GetPInvokeErrorMessage(error), "sidType/domainSid"); 1038ReferencedDomains[i] = Marshal.PtrToStringUni(ti->Name.Buffer, ti->Name.Length / sizeof(char)); 1055string account = Marshal.PtrToStringUni(Ltn.Name.Buffer, Ltn.Name.Length / sizeof(char));
System\Security\Principal\Win32.cs (7)
60byte Revision = Marshal.ReadByte(binaryForm, 0); 71byte SubAuthorityCount = Marshal.ReadByte(binaryForm, 1); 90Marshal.Copy(binaryForm, ResultSid, 0, BinaryLength); 112ErrorCode = Marshal.GetLastPInvokeError(); 124Marshal.FreeHGlobal((IntPtr)pSid); 166return Marshal.GetLastPInvokeError(); 221return Marshal.GetLastPInvokeError();
System\Security\Principal\WindowsIdentity.cs (24)
147throw new SecurityException(Marshal.GetLastPInvokeErrorMessage()); 180Marshal.Copy(upnBytes, 0, pKerbS4uLogin->ClientUpn.Buffer, upnBytes.Length); 272Marshal.GetLastPInvokeError() == Interop.Errors.ERROR_INVALID_HANDLE) 288throw new SecurityException(Marshal.GetLastPInvokeErrorMessage()); 401return Marshal.PtrToStringUni(logonSessionData.AuthenticationPackage.Buffer); 491throw new SecurityException(Marshal.GetLastPInvokeErrorMessage()); 499throw new SecurityException(Marshal.GetLastPInvokeErrorMessage()); 759throw new SecurityException(Marshal.GetPInvokeErrorMessage(hr)); 780Environment.FailFast(Marshal.GetLastPInvokeErrorMessage()); 800Environment.FailFast(Marshal.GetLastPInvokeErrorMessage()); 805Environment.FailFast(Marshal.GetLastPInvokeErrorMessage()); 823throw new SecurityException(Marshal.GetPInvokeErrorMessage(hr)); 849return new SecurityException(Marshal.GetPInvokeErrorMessage((int)win32ErrorCode)); 859hr = Marshal.GetHRForLastWin32Error(); 879hr = GetHRForWin32Error(Marshal.GetLastPInvokeError()); 919int dwErrorCode = Marshal.GetLastPInvokeError(); 934throw new SecurityException(Marshal.GetLastPInvokeErrorMessage()); 951throw new SecurityException(Marshal.GetPInvokeErrorMessage(dwErrorCode)); 1259string name = Marshal.PtrToStringUni(windowsClaim.Name)!; 1266Marshal.Copy(windowsClaim.Values.ppString, stringPointers, 0, (int)windowsClaim.ValueCount); 1270Claim c = new Claim(name, Marshal.PtrToStringUni(stringPointers[item])!, ClaimValueTypes.String, _issuerName, _issuerName, this); 1278Marshal.Copy(windowsClaim.Values.pInt64, intValues, 0, (int)windowsClaim.ValueCount); 1291Marshal.Copy(windowsClaim.Values.pUint64, uintValues, 0, (int)windowsClaim.ValueCount); 1303Marshal.Copy(windowsClaim.Values.pUint64, boolValues, 0, (int)windowsClaim.ValueCount);
System\Security\Principal\WindowsPrincipal.cs (2)
160throw new SecurityException(Marshal.GetLastPInvokeErrorMessage()); 171throw new SecurityException(Marshal.GetLastPInvokeErrorMessage());
System.ServiceProcess.ServiceController (75)
_generated\0\LibraryImports.g.cs (43)
16global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 18__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 23global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 56global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 58__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 70global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 106global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 108__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 120global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 160global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 162__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 174global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 210global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 212__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 224global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 260global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 262__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 274global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 300global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 302__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 305global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 339global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 341__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 350global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 386global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 388__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 400global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 433global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 435__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 447global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 480global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 482__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 494global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 518global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 520__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 525global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 549__callback_native = callback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback) : default; 553global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 555__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 560global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 584global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 586__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 591global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
System\ServiceProcess\ServiceBase.cs (8)
584IntPtr entriesPointer = Marshal.AllocHGlobal(checked((services.Length + 1) * sizeof(SERVICE_TABLE_ENTRY))); 637Marshal.FreeHGlobal(entries[i].name); 641Marshal.FreeHGlobal(entriesPointer); 702callback = Marshal.GetFunctionPointerForDelegate(_mainCallback!), 703name = Marshal.StringToHGlobalUni(_serviceName) 722Marshal.PtrToStructure(eventData, sessionNotification); 867_serviceName = Marshal.PtrToStringUni((IntPtr)(*argsAsPtr))!; 876args[index] = Marshal.PtrToStringUni((IntPtr)(*argsAsPtr))!;
System\ServiceProcess\ServiceController.cs (24)
198int lastError = Marshal.GetLastPInvokeError(); 203IntPtr enumBuffer = Marshal.AllocHGlobal((IntPtr)bytesNeeded); 219IntPtr structPtr = (IntPtr)(pEnumBuffer + ((nint)i * Marshal.SizeOf<Interop.Advapi32.ENUM_SERVICE_STATUS>())); 220Marshal.PtrToStructure(structPtr, status); 226Marshal.FreeHGlobal(enumBuffer); 312int lastError = Marshal.GetLastPInvokeError(); 317IntPtr bufPtr = Marshal.AllocHGlobal((IntPtr)bytesNeeded); 325Marshal.PtrToStructure(bufPtr, config); 376Marshal.FreeHGlobal(bufPtr); 391int lastError = Marshal.GetLastPInvokeError(); 396IntPtr bufPtr = Marshal.AllocHGlobal((IntPtr)bytesNeeded); 404Marshal.PtrToStructure(bufPtr, config); 411Marshal.FreeHGlobal(bufPtr); 581int lastError = Marshal.GetLastPInvokeError(); 612int lastError = Marshal.GetLastPInvokeError(); 632Marshal.InitHandle(databaseHandle, machineName.Equals(DefaultMachineName) || machineName.Length == 0 ? 686Marshal.InitHandle(serviceHandle, Interop.Advapi32.OpenService(_serviceManagerHandle, ServiceName, desiredAccess)); 761IntPtr memory = Marshal.AllocHGlobal((IntPtr)bytesNeeded); 786IntPtr structPtr = (IntPtr)(pMemory + ((nint)i * Marshal.SizeOf<Interop.Advapi32.ENUM_SERVICE_STATUS_PROCESS>())); 788Marshal.PtrToStructure(structPtr, status); 794Marshal.FreeHGlobal(memory); 883argPtrs[i] = Marshal.StringToHGlobalUni(args[i]); 889Marshal.FreeHGlobal(argPtrs[i]); 907Marshal.FreeHGlobal(argPtrs[i]);
System.Speech (133)
_generated\0\LibraryImports.g.cs (1)
60__dwCallback_native = dwCallback != null ? global::System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(dwCallback) : default;
AudioFormat\AudioFormatConverter.cs (3)
17WaveFormatEx waveFormatEx = Marshal.PtrToStructure<WaveFormatEx>(waveFormatPtr)!; 20IntPtr extraDataPtr = new(waveFormatPtr.ToInt64() + Marshal.SizeOf<WaveFormatEx>()); 23extraData[i] = Marshal.ReadByte(extraDataPtr, i);
Internal\HGlobalSafeHandle.cs (3)
42SetHandle(Marshal.AllocHGlobal(size)); 46SetHandle(Marshal.ReAllocHGlobal(handle, (IntPtr)size)); 85Marshal.FreeHGlobal(handle);
Internal\ObjectToken\ObjectToken.cs (3)
54Marshal.ReleaseComObject(sapiObjectToken); 69Marshal.ReleaseComObject(_sapiObjectToken); 223ppszCoMemTokenId = Marshal.StringToCoTaskMemUni(Id);
Internal\ObjectToken\ObjectTokenCategory.cs (2)
76Marshal.ReleaseComObject(enumTokens); 80Marshal.ReleaseComObject(category);
Internal\ObjectToken\RegistryDataKey.cs (3)
131tokenId = Marshal.PtrToStringUni(sapiTokenId); 136Marshal.FreeCoTaskMem(sapiTokenId); 435Marshal.ReleaseComObject(_sapiRegKey);
Internal\SapiInterop\SapiGrammar.cs (1)
22Marshal.ReleaseComObject(_sapiGrammar);
Internal\SapiInterop\SapiProxy.cs (2)
103Marshal.ReleaseComObject(_recognizer); 199Invoke2(delegate { Marshal.ReleaseComObject(_recognizer); });
Internal\SapiInterop\SapiRecoContext.cs (1)
24_proxy.Invoke2(delegate { Marshal.ReleaseComObject(_recoContext); });
Internal\SapiInterop\SapiRecognizer.cs (4)
39Marshal.ReleaseComObject(recognizer); 109string tokenId = Marshal.PtrToStringUni(sapiTokenId)!; 115Marshal.FreeCoTaskMem(sapiTokenId); 119Marshal.ReleaseComObject(sapiObjectToken);
Internal\SapiInterop\SapiRecoInterop.cs (4)
453int size = Marshal.SizeOf<SPPHRASEELEMENT>(); 456coMem = Marshal.AllocCoTaskMem(size * elements.Length); 499Marshal.StructureToPtr<SPPHRASEELEMENT>(elements[i], new IntPtr((long)coMem + size * i), false); 508spPhrase.cbSize = (uint)Marshal.SizeOf<SPPHRASE>();
Internal\SapiInterop\SpAudioStreamWrapper.cs (2)
63format = Marshal.AllocCoTaskMem(_wfx.Length); 64Marshal.Copy(_wfx, 0, format, _wfx.Length);
Internal\SapiInterop\SpeechEvent.cs (2)
63Marshal.Release((IntPtr)_lParam); 69Marshal.FreeCoTaskMem((IntPtr)_lParam);
Internal\SapiInterop\SpStreamWrapper.cs (2)
52Marshal.WriteIntPtr(pcbRead, new IntPtr(read)); 67Marshal.WriteIntPtr(plibNewPosition, new IntPtr(_stream.Position));
Internal\SrgsCompiler\BackEnd.cs (5)
1013uint ulOffset = (uint)Marshal.SizeOf<CfgGrammar.CfgSerializedHeader>(); 1040ulOffset += (uint)(_rules.Count * Marshal.SizeOf<CfgRule>()); 1045ulOffset += (uint)(cArcs * Marshal.SizeOf<CfgArc>()); 1075ulOffset += (uint)(cSemanticTags * Marshal.SizeOf<CfgSemanticTag>()); 1078ulOffset += (uint)(_scriptRefs.Count * Marshal.SizeOf<CfgScriptRef>());
Internal\SrgsCompiler\CFGGrammar.cs (7)
281if (cfgSerializedHeader.pszWords < Marshal.SizeOf<CfgSerializedHeader>()) 303streamHelper.Stream.Position = (int)cfgSerializedHeader.pRules + (header.rules.Length * Marshal.SizeOf<CfgRule>()); 328if (pFH.pszWords < Marshal.SizeOf<CfgSerializedHeader>()) 420CheckSetOffsets(pFH.pRules, pFH.cRules * Marshal.SizeOf<CfgRule>(), ref ullStartOffset, pFH.ulTotalSerializedSize); 426CheckSetOffsets(pFH.pArcs, pFH.cArcs * Marshal.SizeOf<CfgArc>(), ref ullStartOffset, pFH.ulTotalSerializedSize); 438CheckSetOffsets(pFH.tags, pFH.cTags * Marshal.SizeOf<CfgSemanticTag>(), ref ullStartOffset, pFH.ulTotalSerializedSize); 475CheckSetOffsets(pFH.pScripts, pFH.cScripts * Marshal.SizeOf<CfgScriptRef>(), ref ullStartOffset, pFH.ulTotalSerializedSize);
Internal\StreamMarshaler.cs (16)
30int sizeOfOne = Marshal.SizeOf<T>(); 36Marshal.Copy(ab, 0, buffer, sizeObject); 39ao[i] = Marshal.PtrToStructure<T>((nint)buffer + (nint)i * sizeOfOne); 46int sizeOfOne = Marshal.SizeOf<T>(); 53Marshal.StructureToPtr<T>(ao[i], (nint)buffer + (nint)i * sizeOfOne, false); 56Marshal.Copy(buffer, ab, 0, sizeObject); 70Marshal.Copy(ab, 0, buffer, sizeObject); 71Marshal.Copy(buffer, ach, 0, c); 109Marshal.Copy(ach, 0, buffer, c); 110Marshal.Copy(buffer, ab, 0, sizeObject); 118int sizeObject = Marshal.SizeOf<T>(); 123Marshal.Copy(ab, 0, buffer, sizeObject); 124Marshal.PtrToStructure<T>(buffer, o); 130int sizeObject = Marshal.SizeOf<T>(); 134Marshal.StructureToPtr<T>(o, buffer, false); 135Marshal.Copy(buffer, ab, 0, sizeObject);
Internal\Synthesis\AudioBase.cs (15)
46Marshal.Copy(pBuff, buffer, 0, cb); 239int cRiff = Marshal.SizeOf<RIFFHDR>(); 240int cBlock = Marshal.SizeOf<BLOCKHDR>(); 242int cDataHdr = Marshal.SizeOf<DATAHDR>(); 383wfx.wFormatTag = Marshal.ReadInt16(ptr); 384wfx.nChannels = Marshal.ReadInt16(ptr, 2); 385wfx.nSamplesPerSec = Marshal.ReadInt32(ptr, 4); 386wfx.nAvgBytesPerSec = Marshal.ReadInt32(ptr, 8); 387wfx.nBlockAlign = Marshal.ReadInt16(ptr, 12); 388wfx.wBitsPerSample = Marshal.ReadInt16(ptr, 14); 389wfx.cbSize = Marshal.ReadInt16(ptr, 16); 405avgBytesPerSec = Marshal.ReadInt32(ptr, 8); 406nBlockAlign = Marshal.ReadInt16(ptr, 12); 424int cbSize = Marshal.ReadInt16(waveHeader, 16); 426Marshal.Copy(waveHeader, ab, 0, 18 + cbSize);
Internal\Synthesis\AudioDeviceOut.cs (1)
314Interop.WinMM.MMSYSERR result = Interop.WinMM.waveOutGetDevCaps((IntPtr)deviceId, ref caps, Marshal.SizeOf<Interop.WinMM.WAVEOUTCAPS>());
Internal\Synthesis\EngineSite.cs (1)
295string? bookmark = Marshal.PtrToStringUni(sapiEvent.Param2);
Internal\Synthesis\TTSEngineProxy.cs (1)
198Marshal.ReleaseComObject(_sapiEngine);
Internal\Synthesis\TTSVoice.cs (1)
117Marshal.FreeCoTaskMem(waveFormat);
Internal\Synthesis\VoiceSynthesis.cs (2)
1620Marshal.Release(_iSite); 1696_iSite = Marshal.GetComInterfaceForObject(_siteSapi, typeof(ISpEngineSite));
Internal\Synthesis\WaveHeader.cs (1)
89return Marshal.SizeOf<Interop.WinMM.WAVEHDR>();
Recognition\RecognizerBase.cs (9)
809Marshal.ReleaseComObject(token); 818Marshal.ReleaseComObject(category); 907Marshal.ThrowExceptionForHR((int)errorCode); 1920Marshal.FreeCoTaskMem(data); 2524ISpRecoResult sapiResult = (ISpRecoResult)Marshal.GetObjectForIUnknown((IntPtr)speechEvent.LParam); 2535uint sizeOfSerializedBlob = (uint)Marshal.ReadInt32(coMemSerializeBlob); 2537Marshal.Copy(coMemSerializeBlob, serializedBlob, 0, (int)sizeOfSerializedBlob); 2541Marshal.FreeCoTaskMem(coMemSerializeBlob); 2605Marshal.FreeCoTaskMem(waveFormatPtr);
Result\RecognitionResult.cs (12)
161SPWAVEFORMATEX audioHeader = Marshal.PtrToStructure<SPWAVEFORMATEX>(audioBuffer)!; 165Marshal.Copy(rawDataBuffer, rawAudioData, 0, audioLength - (int)audioHeader.cbUsed); 171Marshal.Copy(codecDataBuffer, formatSpecificData, 0, audioHeader.cbSize); 301int headerSize = Marshal.ReadInt32(buffer, 4); // Read header size directly from buffer - 4 is the offset of cbHeaderSize. 303if (headerSize == Marshal.SizeOf<SPRESULTHEADER_Sapi51>()) // SAPI 5.1 size 305SPRESULTHEADER_Sapi51 legacyHeader = Marshal.PtrToStructure<SPRESULTHEADER_Sapi51>(buffer)!; 311_header = Marshal.PtrToStructure<SPRESULTHEADER>(buffer)!; 362int sizeOfSpSerializedPhraseAlt = Marshal.SizeOf<SPSERIALIZEDPHRASEALT>(); 367SPSERIALIZEDPHRASEALT alt = Marshal.PtrToStructure<SPSERIALIZEDPHRASEALT>(altBuffer)!; 437ISpPhraseAlt phraseAlt = (ISpPhraseAlt)Marshal.GetObjectForIUnknown(sapiAlternates[i]); 461Marshal.FreeCoTaskMem(coMemSerializedPhrase); 466Marshal.Release(sapiAlternates[i]);
Result\RecognizedPhrase.cs (29)
164int sizeofPhraseElement = Marshal.SizeOf<SPSERIALIZEDPHRASEELEMENT>(); 173SPSERIALIZEDPHRASEELEMENT element = Marshal.PtrToStructure<SPSERIALIZEDPHRASEELEMENT>(elementBuffer)!; 179displayForm = Marshal.PtrToStringUni(displayFormBuffer); 184lexicalForm = Marshal.PtrToStringUni(lexicalFormBuffer); 190pronunciation = Marshal.PtrToStringUni(pronunciationBuffer)!; 297for (int i = 0; i < _serializedPhrase.cReplacements; i++, itnBuffer = (nint)itnBuffer + Marshal.SizeOf<SPPHRASEREPLACEMENT>()) 299SPPHRASEREPLACEMENT replacement = Marshal.PtrToStructure<SPPHRASEREPLACEMENT>(itnBuffer)!; 300string text = Marshal.PtrToStringUni(new IntPtr((long)buffer + replacement.pszReplacementText))!; 330serializedPhrase = Marshal.PtrToStructure<SPSERIALIZEDPHRASE>(phraseBuffer); 334SPSERIALIZEDPHRASE_Sapi51? legacyPhrase = Marshal.PtrToStructure<SPSERIALIZEDPHRASE_Sapi51>(phraseBuffer); 360Marshal.Copy(phraseBuffer, _phraseBuffer, 0, phraseLength); 546SPSERIALIZEDPHRASEPROPERTY property = Marshal.PtrToStructure<SPSERIALIZEDPHRASEPROPERTY>(propertyBuffer)!; 579Marshal.PtrToStructure<SPSERIALIZEDPHRASEPROPERTY>(propertyBuffer)!; 668propertyName = Marshal.PtrToStringUni(nameBuffer)!; 679propertyValue = Marshal.PtrToStringUni(valueStringBuffer)!; 696propertyValue = Marshal.ReadInt32(valueBuffer); 700propertyValue = Marshal.PtrToStructure<uint>(valueBuffer); 704propertyValue = Marshal.ReadInt64(valueBuffer); 708propertyValue = Marshal.PtrToStructure<ulong>(valueBuffer); 712propertyValue = Marshal.PtrToStructure<float>(valueBuffer); 716propertyValue = Marshal.PtrToStructure<double>(valueBuffer); 720propertyValue = (Marshal.ReadByte(valueBuffer) != 0); 745string name = Marshal.PtrToStringUni(nameBuffer)!; 759SPSERIALIZEDPHRASERULE ruleNext = Marshal.PtrToStructure<SPSERIALIZEDPHRASERULE>(elementBuffer)!; 767SPSERIALIZEDPHRASERULE ruleFirst = Marshal.PtrToStructure<SPSERIALIZEDPHRASERULE>(elementBuffer)!; 787SPSEMANTICERRORINFO semanticError = Marshal.PtrToStructure<SPSEMANTICERRORINFO>((nint)smlBuffer + (nint)_serializedPhrase.SemanticErrorInfoOffset)!; 789string? source = Marshal.PtrToStringUni((nint)smlBuffer + (nint)semanticError.pszSourceOffset); 790string? description = Marshal.PtrToStringUni((nint)smlBuffer + (nint)semanticError.pszDescriptionOffset); 791string? script = Marshal.PtrToStringUni((nint)smlBuffer + (nint)semanticError.pszScriptLineOffset);
System.Text.Encoding.CodePages (2)
Microsoft\Win32\SafeHandles\SafeAllocHHandle.cs (1)
28Marshal.FreeHGlobal(handle);
System\Text\BaseCodePageEncoding.cs (1)
369byte* pNativeMemory = (byte*)Marshal.AllocHGlobal(iSize);
System.Threading.AccessControl (43)
_generated\0\LibraryImports.g.cs (33)
24global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 26__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 38global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 70global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 72__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 84global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 114global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 116__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 134global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 167global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 169__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 187global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 209global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 211__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 214global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 247global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 249__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 267global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 297global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 299__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 317global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 349global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 351__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 363global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 396global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 398__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 416global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 446global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 448__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 466global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 501global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 503__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 515global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (2)
57if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) 70Marshal.FreeHGlobal(nativeMsgPtr);
src\runtime\src\libraries\Common\src\System\IO\Win32Marshal.cs (2)
19=> GetExceptionForWin32Error(Marshal.GetLastPInvokeError(), path); 85return Marshal.GetPInvokeErrorMessage(errorCode);
System\Threading\EventWaitHandleAcl.cs (2)
57int errorCode = Marshal.GetLastPInvokeError(); 135int errorCode = Marshal.GetLastPInvokeError();
System\Threading\MutexAcl.cs (2)
43int errorCode = Marshal.GetLastPInvokeError(); 126int errorCode = Marshal.GetLastPInvokeError();
System\Threading\SemaphoreAcl.cs (2)
62int errorCode = Marshal.GetLastPInvokeError(); 141int errorCode = Marshal.GetLastPInvokeError();
System.Transactions.Local (76)
_generated\10\System.Transactions.DtcProxyShim.DtcInterfaces.ITransaction.cs (3)
54global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([132, 80, 177, 15, 65, 175, 206, 17, 189, 43, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this); 99global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([132, 80, 177, 15, 65, 175, 206, 17, 189, 43, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this); 144global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([132, 80, 177, 15, 65, 175, 206, 17, 189, 43, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this);
_generated\11\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionCloner.cs (4)
56global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([80, 105, 101, 2, 82, 33, 208, 17, 148, 76, 0, 160, 201, 5, 65, 110]), (global::System.IntPtr)__this); 101global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([80, 105, 101, 2, 82, 33, 208, 17, 148, 76, 0, 160, 201, 5, 65, 110]), (global::System.IntPtr)__this); 146global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([80, 105, 101, 2, 82, 33, 208, 17, 148, 76, 0, 160, 201, 5, 65, 110]), (global::System.IntPtr)__this); 193global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([80, 105, 101, 2, 82, 33, 208, 17, 148, 76, 0, 160, 201, 5, 65, 110]), (global::System.IntPtr)__this);
_generated\12\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionExport.cs (2)
57global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([165, 253, 65, 1, 192, 143, 206, 17, 189, 24, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this); 116global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([165, 253, 65, 1, 192, 143, 206, 17, 189, 24, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this);
_generated\13\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionExportFactory.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([83, 155, 207, 225, 69, 135, 206, 17, 169, 186, 0, 170, 0, 108, 55, 6]), (global::System.IntPtr)__this); 101global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([83, 155, 207, 225, 69, 135, 206, 17, 169, 186, 0, 170, 0, 108, 55, 6]), (global::System.IntPtr)__this);
_generated\14\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionOptions.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([224, 217, 106, 58, 185, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this); 92global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([224, 217, 106, 58, 185, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this);
_generated\15\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionDispenser.cs (2)
54global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 217, 106, 58, 185, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this); 116global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 217, 106, 58, 185, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this);
_generated\16\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionEnlistmentAsync.cs (3)
51global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([129, 80, 177, 15, 65, 175, 206, 17, 189, 43, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this); 89global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([129, 80, 177, 15, 65, 175, 206, 17, 189, 43, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this); 127global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([129, 80, 177, 15, 65, 175, 206, 17, 189, 43, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this);
_generated\17\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionImport.cs (1)
55global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([90, 155, 207, 225, 69, 135, 206, 17, 169, 186, 0, 170, 0, 108, 55, 6]), (global::System.IntPtr)__this);
_generated\18\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionImportWhereabouts.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([164, 253, 65, 1, 192, 143, 206, 17, 189, 24, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this); 98global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([164, 253, 65, 1, 192, 143, 206, 17, 189, 24, 32, 76, 79, 79, 80, 32]), (global::System.IntPtr)__this);
_generated\19\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionPhase0EnlistmentAsync.cs (5)
55global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 136, 220, 130, 84, 169, 209, 17, 143, 136, 0, 96, 8, 149, 231, 213]), (global::System.IntPtr)__this); 93global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 136, 220, 130, 84, 169, 209, 17, 143, 136, 0, 96, 8, 149, 231, 213]), (global::System.IntPtr)__this); 131global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 136, 220, 130, 84, 169, 209, 17, 143, 136, 0, 96, 8, 149, 231, 213]), (global::System.IntPtr)__this); 169global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 136, 220, 130, 84, 169, 209, 17, 143, 136, 0, 96, 8, 149, 231, 213]), (global::System.IntPtr)__this); 212global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([225, 136, 220, 130, 84, 169, 209, 17, 143, 136, 0, 96, 8, 149, 231, 213]), (global::System.IntPtr)__this);
_generated\20\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionPhase0Factory.cs (1)
55global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([224, 136, 220, 130, 84, 169, 209, 17, 143, 136, 0, 96, 8, 149, 231, 213]), (global::System.IntPtr)__this);
_generated\21\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionPhase0NotifyAsync.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([9, 24, 8, 239, 118, 12, 210, 17, 135, 166, 0, 192, 79, 153, 15, 52]), (global::System.IntPtr)__this); 92global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([9, 24, 8, 239, 118, 12, 210, 17, 135, 166, 0, 192, 79, 153, 15, 52]), (global::System.IntPtr)__this);
_generated\22\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionReceiver.cs (4)
60global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([3, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 124global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([3, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 177global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([3, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 240global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([3, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this);
_generated\23\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionReceiverFactory.cs (1)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([2, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this);
_generated\24\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionResourceAsync.cs (4)
60global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([240, 113, 233, 105, 206, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this); 104global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([240, 113, 233, 105, 206, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this); 145global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([240, 113, 233, 105, 206, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this); 185global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([240, 113, 233, 105, 206, 35, 207, 17, 173, 96, 0, 170, 0, 167, 76, 205]), (global::System.IntPtr)__this);
_generated\25\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionTransmitter.cs (5)
60global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([1, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 109global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([1, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 155global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([1, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 206global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([1, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this); 251global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([1, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this);
_generated\26\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionTransmitterFactory.cs (1)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([0, 62, 49, 89, 108, 179, 207, 17, 165, 57, 0, 170, 0, 104, 135, 195]), (global::System.IntPtr)__this);
_generated\27\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionVoterBallotAsync2.cs (1)
47global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([108, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this);
_generated\28\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionVoterFactory2.cs (1)
57global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([106, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this);
_generated\29\System.Transactions.DtcProxyShim.DtcInterfaces.ITransactionVoterNotifyAsync2.cs (5)
58global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([107, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this); 101global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([107, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this); 141global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([107, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this); 179global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([107, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this); 217global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([107, 55, 51, 84, 77, 65, 211, 17, 178, 6, 0, 192, 79, 194, 243, 239]), (global::System.IntPtr)__this);
_generated\5\System.Transactions.DtcProxyShim.DtcInterfaces.IPrepareInfo.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([208, 191, 199, 128, 238, 135, 206, 17, 128, 129, 0, 128, 199, 88, 82, 126]), (global::System.IntPtr)__this); 96global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([208, 191, 199, 128, 238, 135, 206, 17, 128, 129, 0, 128, 199, 88, 82, 126]), (global::System.IntPtr)__this);
_generated\6\System.Transactions.DtcProxyShim.DtcInterfaces.IResourceManagerFactory2.cs (2)
65global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([33, 156, 54, 107, 210, 251, 209, 17, 143, 71, 0, 192, 79, 142, 229, 125]), (global::System.IntPtr)__this); 147global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([33, 156, 54, 107, 210, 251, 209, 17, 143, 71, 0, 192, 79, 142, 229, 125]), (global::System.IntPtr)__this);
_generated\7\System.Transactions.DtcProxyShim.DtcInterfaces.IResourceManager.cs (4)
68global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([33, 29, 116, 19, 235, 135, 206, 17, 128, 129, 0, 128, 199, 88, 82, 126]), (global::System.IntPtr)__this); 140global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([33, 29, 116, 19, 235, 135, 206, 17, 128, 129, 0, 128, 199, 88, 82, 126]), (global::System.IntPtr)__this); 189global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([33, 29, 116, 19, 235, 135, 206, 17, 128, 129, 0, 128, 199, 88, 82, 126]), (global::System.IntPtr)__this); 234global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([33, 29, 116, 19, 235, 135, 206, 17, 128, 129, 0, 128, 199, 88, 82, 126]), (global::System.IntPtr)__this);
_generated\8\System.Transactions.DtcProxyShim.DtcInterfaces.IResourceManagerSink.cs (1)
47global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([129, 49, 86, 13, 251, 222, 206, 17, 174, 209, 0, 170, 0, 81, 226, 196]), (global::System.IntPtr)__this);
_generated\9\System.Transactions.DtcProxyShim.DtcInterfaces.ITmNodeName.cs (2)
52global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([136, 79, 39, 48, 228, 110, 78, 71, 155, 149, 120, 7, 188, 158, 248, 207]), (global::System.IntPtr)__this); 99global::System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(__invokeRetVal, new([136, 79, 39, 48, 228, 110, 78, 71, 155, 149, 120, 7, 188, 158, 248, 207]), (global::System.IntPtr)__this);
System\Transactions\DtcProxyShim\DtcProxyShimFactory.cs (1)
59private static unsafe void DtcGetTransactionManager(string? nodeName, out ITransactionDispenser localDispenser) => Marshal.ThrowExceptionForHR(DtcGetTransactionManagerExW(nodeName, null, Guids.IID_ITransactionDispenser_Guid, 0, null, out localDispenser));
System\Transactions\TransactionInterop.cs (13)
293transactionComObject = (IDtcTransaction)Marshal.GetObjectForIUnknown(transactionNativePtr); 294Marshal.SetComObjectData(transactionComObject, typeof(ITransaction), transactionNative); 296Marshal.Release(transactionNativePtr); 316var transactionNative = (IDtcTransaction)Marshal.GetObjectForIUnknown(transactionNativePtr); 317Marshal.SetComObjectData(transactionNative, typeof(ITransaction), transaction); 319Marshal.Release(transactionNativePtr); 440if (Marshal.GetComObjectData(transactionNative, typeof(ITransaction)) is not ITransaction myTransactionNative) 444nint unknown = Marshal.GetIUnknownForObject(transactionNative); 445if (Marshal.QueryInterface(unknown, Guids.IID_ITransaction_Guid, out IntPtr transactionNativePtr) == 0) 447Marshal.Release(unknown); 449Marshal.SetComObjectData(transactionNative, typeof(ITransaction), myTransactionNative); 450Marshal.Release(transactionNativePtr); 454Marshal.Release(unknown);
System.Windows.Controls.Ribbon (2)
Microsoft\Windows\Controls\Ribbon\NativeMethods.cs (1)
285internal int cbSize = Marshal.SizeOf(typeof(MONITORINFOEX));
Microsoft\Windows\Controls\Ribbon\RibbonDropDownHelper.cs (1)
172cbSize = Marshal.SizeOf(typeof(NativeMethods.MONITORINFOEX))
System.Windows.Extensions (46)
_generated\0\LibraryImports.g.cs (27)
33global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 35__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 49global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 73global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 75__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 80global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 109global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 111__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 129global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 161global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 163__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 172global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 196global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 198__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 203global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 239global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 241__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 253global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 282global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 284__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 302global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 331global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 333__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 345global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError); 377global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0); 379__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError(); 401global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.CRYPT_BIT_BLOB.cs (1)
22Marshal.Copy(pbData, data, 0, numBytes);
src\runtime\src\libraries\Common\src\Interop\Windows\Crypt32\Interop.DATA_BLOB.cs (1)
31Marshal.Copy(pbData, array, 0, (int)cbData);
src\runtime\src\libraries\Common\src\Interop\Windows\CryptUI\Interop.CryptUIDlgCertificate.cs (9)
78szTitle = Marshal.StringToCoTaskMemUni(managed.szTitle); 98Marshal.FreeCoTaskMem(szTitle); 108szTitle = Marshal.PtrToStringUni(szTitle), 188szTitle = Marshal.StringToCoTaskMemUni(managed.szTitle); 190szDisplayString = Marshal.StringToCoTaskMemUni(managed.szDisplayString); 205Marshal.FreeCoTaskMem(szTitle); 206Marshal.FreeCoTaskMem(szDisplayString); 216szTitle = Marshal.PtrToStringUni(szTitle), 218szDisplayString = Marshal.PtrToStringUni(szDisplayString),
System\Media\SoundPlayer.cs (3)
572if (dw < Marshal.SizeOf<Interop.WinMM.WAVEFORMATEX>()) 574dw = Marshal.SizeOf<Interop.WinMM.WAVEFORMATEX>(); 586Marshal.PtrToStructure((IntPtr)pdata, waveFormat);
System\Security\Cryptography\X509Certificates\X509Certificate2UI.cs (3)
81dwErrorCode = Marshal.GetLastPInvokeError(); 117Exception e = new CryptographicException(Marshal.GetLastPInvokeError()); 162dwErrorCode = Marshal.GetLastPInvokeError();
System\Security\Cryptography\X509Certificates\X509Utils.cs (2)
36Exception e = new CryptographicException(Marshal.GetLastPInvokeError()); 53throw new CryptographicException(Marshal.GetLastPInvokeError());
System.Windows.Forms (73)
System\Windows\Forms\Accessibility\AccessibleObject.cs (1)
1167*ppAccessible = (UIA.IAccessible*)Marshal.GetComInterfaceForObject<AccessibleObject, IAccessible>(this);
System\Windows\Forms\Accessibility\LabelEditNativeWindow.cs (1)
46(void*)Marshal.GetFunctionPointerForDelegate(_winEventProcCallback);
System\Windows\Forms\ActiveX\AxHost.cs (4)
2949Marshal.FreeCoTaskMem((IntPtr)uuids.pElems); 3049Marshal.FreeCoTaskMem((IntPtr)uuids.pElems); 3435Marshal.ReleaseComObject(_instance); 3759using ComScope<IDispatch> dispatch = new((IDispatch*)Marshal.GetIDispatchForObject(oleFont));
System\Windows\Forms\ActiveX\AxHost.OleInterfaces.cs (1)
134Marshal.GetNativeVariantForObject(ambient, (nint)result);
System\Windows\Forms\ActiveX\AxHost.State.cs (2)
146Marshal.Copy(_buffer, 0, (nint)pointer, _length); 284Marshal.Copy((nint)pointer, _buffer, 0, _length);
System\Windows\Forms\ActiveX\Control_ActiveXControlInterfaces.cs (1)
259*pszUserType = (char*)Marshal.StringToCoTaskMemUni(
System\Windows\Forms\ActiveX\Control.ActiveXFontMarshaler.cs (1)
24public void CleanUpNativeData(IntPtr pObj) => Marshal.Release(pObj);
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (2)
857throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Win32SetParentFailed); 1320Marshal.ThrowExceptionForHR((int)hr);
System\Windows\Forms\ComponentModel\COM2Interop\COM2ComponentEditor.cs (2)
41Marshal.FreeCoTaskMem((IntPtr)uuids.pElems); 121Marshal.FreeCoTaskMem((nint)uuids.pElems);
System\Windows\Forms\ComponentModel\COM2Interop\COM2IManagedPerPropertyBrowsingHandler.cs (2)
212Marshal.FreeCoTaskMem((nint)(void*)values); 240Marshal.FreeCoTaskMem((IntPtr)values);
System\Windows\Forms\ComponentModel\COM2Interop\COM2PropertyPageUITypeConverter.cs (1)
96Marshal.Release(addresses[i]);
System\Windows\Forms\Control.cs (10)
1387int lastWin32Error = Marshal.GetLastWin32Error(); 3580|| (!returnValue && Marshal.GetLastWin32Error() == (int)WIN32_ERROR.ERROR_INVALID_HANDLE) 6594Marshal.Copy(bytes, 0, m.LParamInternal, bytes.Length); 6595Marshal.Copy(nullBytes, 0, m.LParamInternal + (nint)bytes.Length, nullBytes.Length); 7086throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Win32SetParentFailed); 9358throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Win32SetParentFailed); 9576throw Marshal.GetExceptionForHR((int)hr)!; 9585throw Marshal.GetExceptionForHR((int)hr)!; 10309throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Win32SetParentFailed); 10325throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Win32SetParentFailed);
System\Windows\Forms\Controls\ListView\ListView.cs (6)
4157Marshal.FreeHGlobal(hGlobalColumns); 4160hGlobalColumns = Marshal.AllocHGlobal((int)(lvItem.cColumns * sizeof(int))); 4172Marshal.Copy(columns, 0, (nint)lvItem.puColumns, (int)lvItem.cColumns); 4235Marshal.FreeHGlobal(hGlobalColumns); 5582IntPtr callbackPointer = Marshal.GetFunctionPointerForDelegate(callback); 6889Marshal.Copy(charBuf, 0, destPtr, Math.Min(charBuf.Length, infoTip->cchTextMax));
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.CalendarButtonAccessibleObject.cs (1)
135PInvoke.SendInput(1, &mouseInput, Marshal.SizeOf(mouseInput));
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (2)
4074if (obj is not null && !Marshal.IsComObject(obj)) 4308_propertyName = Marshal.PtrToStringAuto((nint)cds->lpData);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.MouseHook.cs (1)
94IntPtr hook = Marshal.GetFunctionPointerForDelegate(_callBack);
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (7)
261int lastWin32Error = Marshal.GetLastWin32Error(); 1629Marshal.Copy(buf, bytes, 0, cb); 1717Marshal.Copy(bytes, 0, buf, transferred); 2087Marshal.FreeCoTaskMem(txrg.lpstrText); 2891es.pfnCallback = Marshal.GetFunctionPointerForDelegate(callback); 2995es.pfnCallback = Marshal.GetFunctionPointerForDelegate(callback); 3192Marshal.FreeCoTaskMem(unmanagedBuffer);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropTargetManager.cs (1)
179throw Marshal.GetExceptionForHR((int)hr)!;
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs (1)
65IntPtr hook = Marshal.GetFunctionPointerForDelegate(_callBack);
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.cs (2)
628nint allocatedStringBuffer = Marshal.AllocCoTaskMem((int)info.cch * sizeof(char)); 647Marshal.FreeCoTaskMem(allocatedStringBuffer);
System\Windows\Forms\Controls\TreeView\TreeNode.cs (4)
1841tvis.item.pszText = (char*)Marshal.StringToHGlobalUni(_text); 1891Marshal.FreeCoTaskMem((nint)tvis.item.pszText.Value); 2145item.pszText = (char*)Marshal.StringToHGlobalUni(_text); 2183Marshal.FreeCoTaskMem((nint)item.pszText.Value);
System\Windows\Forms\Controls\WebBrowser\WebBrowser.cs (1)
479if (!Marshal.IsTypeVisibleFromCom(value.GetType()))
System\Windows\Forms\Controls\WebBrowser\WebBrowserBase.cs (1)
871Marshal.FinalReleaseComObject(_activeXInstance);
System\Windows\Forms\Controls\WebBrowser\WebBrowserSiteBase.cs (1)
267lpFrameInfo->cb = (uint)Marshal.SizeOf<OLEINPLACEFRAMEINFO>();
System\Windows\Forms\Design\EventsTab.cs (1)
28public override bool CanExtend(object? extendee) => extendee is null || !Marshal.IsComObject(extendee);
System\Windows\Forms\Dialogs\CommonDialogs\CommonDialog.cs (2)
33_functionPointer = (delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, nuint>)(void*)Marshal.GetFunctionPointerForDelegate(_hookProc); 221nint hookedWndProc = Marshal.GetFunctionPointerForDelegate(ownerWindowProcedure);
System\Windows\Forms\Dialogs\CommonDialogs\FolderBrowserDialog.cs (1)
314throw Marshal.GetExceptionForHR((int)hr)!;
System\Windows\Forms\Dialogs\MessageBox.cs (1)
469int lastWin32Error = Marshal.GetLastWin32Error();
System\Windows\Forms\Dialogs\TaskDialog\TaskDialog.cs (4)
263private static void FreeConfig(IntPtr ptrToFree) => Marshal.FreeHGlobal(ptrToFree); 1166string? linkHref = Marshal.PtrToStringUni(lParam); 1427ptrToFree = Marshal.AllocHGlobal((nint)(sizeToAllocate + (IntPtr.Size - 1))); 1544Marshal.FreeHGlobal(ptrToFree);
System\Windows\Forms\Input\Cursor.cs (2)
41throw new Win32Exception(string.Format(SR.FailedToLoadCursor, Marshal.GetLastWin32Error())); 430throw new Win32Exception(string.Format(SR.FailedToLoadCursor, Marshal.GetLastWin32Error()));
System\Windows\Forms\NativeWindow.cs (1)
453lastWin32Error = Marshal.GetLastWin32Error();
System\Windows\Forms\NativeWindow.WindowClass.cs (2)
147throw new Win32Exception(Marshal.GetLastWin32Error(), SR.InvalidWndClsName); 157nint callback = Marshal.GetFunctionPointerForDelegate(_windProc);
System\Windows\Forms\StringSource.cs (1)
96rgelt[fetched] = (char*)Marshal.StringToCoTaskMemUni(_strings[_current]);
System\Windows\Forms\SystemInformation.cs (1)
805return Marshal.GetLastWin32Error() == (int)WIN32_ERROR.ERROR_ACCESS_DENIED;
System\Windows\Forms\WindowSubclassHandler.cs (1)
72_windowProcDelegatePtr = (void*)Marshal.GetFunctionPointerForDelegate(_windowProcDelegate);
System.Windows.Forms.Design (6)
System\Drawing\Design\ColorEditor.CustomColorDialog.cs (3)
28_hInstance = Marshal.AllocHGlobal(size); 29Marshal.Copy(buffer, 0, _hInstance, size); 49Marshal.FreeHGlobal(_hInstance);
System\Windows\Forms\Design\Behavior\BehaviorService.AdornerWindow.MouseHook.cs (1)
78IntPtr hook = Marshal.GetFunctionPointerForDelegate(_callBack);
System\Windows\Forms\Design\Behavior\BehaviorService.cs (2)
779Marshal.Copy(bytes, 0, m.LParamInternal, bytes.Length); 780Marshal.Copy(nullBytes, 0, m.LParamInternal + (nint)bytes.Length, nullBytes.Length);
System.Windows.Forms.Primitives (300)
_generated\417\Windows.Win32.PInvoke.KERNEL32.dll.g.cs (45)
66 Marshal.SetLastSystemError(0); 68 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 88 Marshal.SetLastSystemError(0); 90 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 125 Marshal.SetLastSystemError(0); 127 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 152 Marshal.SetLastSystemError(0); 154 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 208 Marshal.SetLastSystemError(0); 210 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 274 Marshal.SetLastSystemError(0); 276 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 307 Marshal.SetLastSystemError(0); 309 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 372 Marshal.SetLastSystemError(0); 374 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 420 Marshal.SetLastSystemError(0); 422 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 460 Marshal.SetLastSystemError(0); 462 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 497 Marshal.SetLastSystemError(0); 499 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 536 Marshal.SetLastSystemError(0); 538 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 583 Marshal.SetLastSystemError(0); 585 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 640 Marshal.SetLastSystemError(0); 642 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 691 Marshal.SetLastSystemError(0); 693 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\421\Windows.Win32.PInvoke.POWRPROF.dll.g.cs (3)
46 Marshal.SetLastSystemError(0); 48 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\425\Windows.Win32.PInvoke.USER32.dll.g.cs (228)
42 Marshal.SetLastSystemError(0); 44 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 67 Marshal.SetLastSystemError(0); 69 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 115 Marshal.SetLastSystemError(0); 117 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 149 Marshal.SetLastSystemError(0); 151 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 183 Marshal.SetLastSystemError(0); 185 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 204 Marshal.SetLastSystemError(0); 206 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 317 Marshal.SetLastSystemError(0); 319 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 341 Marshal.SetLastSystemError(0); 343 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 392 Marshal.SetLastSystemError(0); 394 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 416 Marshal.SetLastSystemError(0); 418 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 433 Marshal.SetLastSystemError(0); 435 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 519 Marshal.SetLastSystemError(0); 521 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 608 Marshal.SetLastSystemError(0); 610 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 632 Marshal.SetLastSystemError(0); 634 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 738 Marshal.SetLastSystemError(0); 740 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 858 Marshal.SetLastSystemError(0); 860 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 906 Marshal.SetLastSystemError(0); 908 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1013 Marshal.SetLastSystemError(0); 1015 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1099 Marshal.SetLastSystemError(0); 1101 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1136 Marshal.SetLastSystemError(0); 1138 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1183 Marshal.SetLastSystemError(0); 1185 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1226 Marshal.SetLastSystemError(0); 1228 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1262 Marshal.SetLastSystemError(0); 1264 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1299 Marshal.SetLastSystemError(0); 1301 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1346 Marshal.SetLastSystemError(0); 1348 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1371 Marshal.SetLastSystemError(0); 1373 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1427 Marshal.SetLastSystemError(0); 1429 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1527 Marshal.SetLastSystemError(0); 1529 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1565 Marshal.SetLastSystemError(0); 1567 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1618 Marshal.SetLastSystemError(0); 1620 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1666 Marshal.SetLastSystemError(0); 1668 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1720 Marshal.SetLastSystemError(0); 1722 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1767 Marshal.SetLastSystemError(0); 1769 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1801 Marshal.SetLastSystemError(0); 1803 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1825 Marshal.SetLastSystemError(0); 1827 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1845 Marshal.SetLastSystemError(0); 1847 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1888 Marshal.SetLastSystemError(0); 1890 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 1927 Marshal.SetLastSystemError(0); 1929 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2046 Marshal.SetLastSystemError(0); 2048 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2068 Marshal.SetLastSystemError(0); 2070 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2109 Marshal.SetLastSystemError(0); 2111 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2160 Marshal.SetLastSystemError(0); 2162 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2199 Marshal.SetLastSystemError(0); 2201 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2409 Marshal.SetLastSystemError(0); 2411 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2450 Marshal.SetLastSystemError(0); 2452 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2494 Marshal.SetLastSystemError(0); 2496 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2547 Marshal.SetLastSystemError(0); 2549 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2592 Marshal.SetLastSystemError(0); 2594 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2660 Marshal.SetLastSystemError(0); 2662 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2711 Marshal.SetLastSystemError(0); 2713 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2774 Marshal.SetLastSystemError(0); 2776 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2810 Marshal.SetLastSystemError(0); 2812 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2827 Marshal.SetLastSystemError(0); 2829 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2918 Marshal.SetLastSystemError(0); 2920 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 2991 Marshal.SetLastSystemError(0); 2993 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3066 Marshal.SetLastSystemError(0); 3068 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3112 Marshal.SetLastSystemError(0); 3114 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3178 Marshal.SetLastSystemError(0); 3180 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3202 Marshal.SetLastSystemError(0); 3204 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3262 Marshal.SetLastSystemError(0); 3264 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3286 Marshal.SetLastSystemError(0); 3288 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3336 Marshal.SetLastSystemError(0); 3338 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3370 Marshal.SetLastSystemError(0); 3372 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3398 Marshal.SetLastSystemError(0); 3400 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3427 Marshal.SetLastSystemError(0); 3429 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3457 Marshal.SetLastSystemError(0); 3459 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3528 Marshal.SetLastSystemError(0); 3530 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3583 Marshal.SetLastSystemError(0); 3585 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3611 Marshal.SetLastSystemError(0); 3613 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3651 Marshal.SetLastSystemError(0); 3653 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3694 Marshal.SetLastSystemError(0); 3696 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3753 Marshal.SetLastSystemError(0); 3755 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3793 Marshal.SetLastSystemError(0); 3795 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3878 Marshal.SetLastSystemError(0); 3880 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 3949 Marshal.SetLastSystemError(0); 3951 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError()); 4080 Marshal.SetLastSystemError(0); 4082 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\427\Windows.Win32.PInvoke.winspool.drv.g.cs (3)
38 Marshal.SetLastSystemError(0); 40 Marshal.SetLastPInvokeError(Marshal.GetLastSystemError());
_generated\62\Windows.Win32.FARPROC.g.cs (1)
49 internal TDelegate CreateDelegate<TDelegate>()where TDelegate : Delegate => Marshal.GetDelegateForFunctionPointer<TDelegate>(this.Value);
Microsoft\Win32\SafeHandles\CoTaskMemSafeHandle.cs (1)
18Marshal.FreeCoTaskMem(handle);
System\Windows\Forms\Automation\UiaTextRange.cs (1)
708Runtime.InteropServices.Marshal.GetNativeVariantForObject(value, (nint)(void*)&variant);
System\Windows\Forms\Internals\ScaleHelper.DpiAwarenessScope.cs (4)
49throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Win32GetThreadsDpiContextFailed); 64throw new Win32Exception(Marshal.GetLastWin32Error(), string.Format(SR.Win32SetThreadsDpiHostingBehaviorFailed, behavior)); 79throw new Win32Exception(Marshal.GetLastWin32Error(), string.Format(SR.Win32SetThreadsDpiHostingBehaviorFailed, _originalDpiHostingBehavior)); 85throw new Win32Exception(Marshal.GetLastWin32Error(), string.Format(SR.Win32SetThreadsDpiContextFailed, _originalDpiAwarenessContext));
System\Windows\Forms\Internals\UnicodeCharBuffer.cs (3)
20IntPtr result = Marshal.AllocCoTaskMem(_buffer.Length * 2); 21Marshal.Copy(_buffer, 0, result, _buffer.Length); 45Marshal.Copy(ptr, _buffer, 0, _buffer.Length);
System\Windows\Forms\Message.cs (1)
89Type cls) => Marshal.PtrToStructure(LParamInternal, cls);
Windows\Win32\PInvoke.CreateWindowEx.cs (5)
56int size = Marshal.SizeOf(lpParam); 57nint native = Marshal.AllocCoTaskMem(size); 61Marshal.StructureToPtr(lpParam, native, fDeleteOld: false); 68Marshal.DestroyStructure(native, lpParam.GetType()); 69Marshal.FreeCoTaskMem(native);
Windows\Win32\PInvoke.LoadLibrary.cs (1)
57if (Marshal.GetLastWin32Error() != (int)WIN32_ERROR.ERROR_INVALID_PARAMETER)
Windows\Win32\System\Ole\CADWORD.cs (1)
20Marshal.FreeCoTaskMem((nint)pElems);
Windows\Win32\UI\Accessibility\UIAHelper.cs (1)
20/// Although <see cref="global::System.Runtime.InteropServices.Marshal.GetNativeVariantForObject"/>
Windows\Win32\UI\Shell\FolderBrowserHelper.cs (2)
54Marshal.FreeCoTaskMem((nint)rootFolderId); 65Marshal.FreeCoTaskMem((nint)resultId);
UIAutomationClient (59)
MS\Internal\Automation\HwndProxyElementProvider.cs (5)
310length = Marshal.SizeOf(typeof(UnsafeNativeMethods.WINDOWPLACEMENT)) 696length = Marshal.SizeOf(typeof(UnsafeNativeMethods.WINDOWPLACEMENT)) 810length = Marshal.SizeOf(typeof(UnsafeNativeMethods.WINDOWPLACEMENT)) 1908int lastWin32Error = Marshal.GetLastWin32Error(); 1933int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\Automation\input.cs (2)
64Misc.SendInput(1, ref ki, Marshal.SizeOf(ki)); 83Misc.SendInput(1, ref ki, Marshal.SizeOf(ki));
MS\Internal\Automation\Misc.cs (29)
272int lastWin32Error = Marshal.GetLastWin32Error(); 285int lastWin32Error = Marshal.GetLastWin32Error(); 298int lastWin32Error = Marshal.GetLastWin32Error(); 311int lastWin32Error = Marshal.GetLastWin32Error(); 323guiThreadInfo.cbSize = Marshal.SizeOf(guiThreadInfo); 326int lastWin32Error = Marshal.GetLastWin32Error(); 346int lastWin32Error = Marshal.GetLastWin32Error(); 359int lastWin32Error = Marshal.GetLastWin32Error(); 372int lastWin32Error = Marshal.GetLastWin32Error(); 385int lastWin32Error = Marshal.GetLastWin32Error(); 405error = Marshal.GetLastWin32Error(); 412error = Marshal.GetLastWin32Error(); 427int lastWin32Error = Marshal.GetLastWin32Error(); 440int lastWin32Error = Marshal.GetLastWin32Error(); 453int lastWin32Error = Marshal.GetLastWin32Error(); 466ThrowWin32ExceptionsIfError(Marshal.GetLastWin32Error()); 476lastWin32Error = Marshal.GetLastWin32Error(); 486lastWin32Error = Marshal.GetLastWin32Error(); 513int lastWin32Error = Marshal.GetLastWin32Error(); 524lastWin32Error = Marshal.GetLastWin32Error(); 543int lastWin32Error = Marshal.GetLastWin32Error(); 556int lastWin32Error = Marshal.GetLastWin32Error(); 569int lastWin32Error = Marshal.GetLastWin32Error(); 586int lastWin32Error = Marshal.GetLastWin32Error(); 603int lastWin32Error = Marshal.GetLastWin32Error(); 620int lastWin32Error = Marshal.GetLastWin32Error(); 634int lastWin32Error = Marshal.GetLastWin32Error(); 647int lastWin32Error = Marshal.GetLastWin32Error(); 660int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\Automation\ProxyManager.cs (2)
224int lastWin32Error = Marshal.GetLastWin32Error(); 238int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\Automation\UiaCoreApi.cs (16)
139IntPtr dataStart = Marshal.AllocCoTaskMem((properties.Length + patterns.Length) * sizeof(int)); 165Marshal.FreeCoTaskMem(_pProperties); 638UiaEventArgs args = Marshal.PtrToStructure<UiaEventArgs>(argsAddr); 656UiaPropertyChangedEventArgs pcargs = Marshal.PtrToStructure<UiaPropertyChangedEventArgs>(argsAddr); 670UiaStructureChangedEventArgs scargs = Marshal.PtrToStructure<UiaStructureChangedEventArgs>(argsAddr); 677UiaAsyncContentLoadedEventArgs aclargs = Marshal.PtrToStructure<UiaAsyncContentLoadedEventArgs>(argsAddr); 683UiaWindowClosedEventArgs wcargs = Marshal.PtrToStructure<UiaWindowClosedEventArgs>(argsAddr); 690UiaNotificationEventArgs nargs = Marshal.PtrToStructure<UiaNotificationEventArgs>(argsAddr); 692Marshal.PtrToStringUni(nargs._displayString), Marshal.PtrToStringUni(nargs._activityId)); 697UiaActiveTextPositionChangedEventArgs atpcargs = Marshal.PtrToStructure<UiaActiveTextPositionChangedEventArgs>(argsAddr); 1126&& !Marshal.IsComObject(arr[1]) 1139IntPtr errorInfoAsIntPtr = Marshal.GetIUnknownForObject(errorInfo); 1142Marshal.Release(errorInfoAsIntPtr); 1145Marshal.ThrowExceptionForHR(hr); 1204Marshal.ThrowExceptionForHR(hr);
System\Windows\Automation\Condition.cs (5)
28Marshal.FreeCoTaskMem(handle); 38int size = Marshal.SizeOf(uiaCondition); 43IntPtr mem = Marshal.AllocCoTaskMem(size); 46Marshal.StructureToPtr(uiaCondition, sh.handle, false); 60IntPtr mem = Marshal.AllocCoTaskMem(conditions.Length * IntPtr.Size);
UIAutomationClientSideProviders (212)
MS\Internal\AutomationProxies\CommonXSendMessage.cs (67)
408return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 415new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), 423return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 437return XSend(hwnd, NativeMethods.LVM_SETITEMSTATE, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType())); 443return XSend(hwnd, NativeMethods.LVM_SETITEMSTATE, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 449return XSend(hwnd, NativeMethods.LVM_SETITEMSTATE, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 465return XSend(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(pItem), Marshal.SizeOf(item.GetType()), XSendMessage.ErrorValue.NoCheck); 472bool result = XSend(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), XSendMessage.ErrorValue.NoCheck); 484bool result = XSend(hwnd, NativeMethods.LVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), XSendMessage.ErrorValue.NoCheck); 505new IntPtr(group.iGroupID), new IntPtr(&group), Marshal.SizeOf(group.GetType())); 512new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType())); 519new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType())); 538new IntPtr(group.iGroupID), new IntPtr(pGroup), Marshal.SizeOf(group.GetType())); 549new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType())); 560new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType())); 583new IntPtr(group.iGroupID), new IntPtr(pGroup), Marshal.SizeOf(group.GetType())); 594new IntPtr(group.iGroupID), new IntPtr(&group32), Marshal.SizeOf(group32.GetType())); 605new IntPtr(group.iGroupID), new IntPtr(&group64), Marshal.SizeOf(group64.GetType())); 630return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item.iGroupID), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszHeader), item.cchHeader); 642return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item32.iGroupID), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszHeader), item32.cchHeader); 654return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item64.iGroupID), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszHeader), item64.cchHeader); 689return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item.iGroupID), new IntPtr(&item), Marshal.SizeOf(item.GetType()), textAddress, size, true); 707return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item32.iGroupID), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), textAddress, size, true); 725return GetTextWithinStructure(hwnd, NativeMethods.LVM_GETGROUPINFO, new IntPtr(item64.iGroupID), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), textAddress, size, true); 751return XSend(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType())); 758bool result = XSend(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 771bool result = XSend(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 792return GetTextWithinStructure(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 799new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), 807return GetTextWithinStructure(hwnd, NativeMethods.TCM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 833return XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType())); 840bool result = XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 853bool result = XSend(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 874return GetTextWithinStructure(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 882Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), item32.cchTextMax, 889return GetTextWithinStructure(hwnd, NativeMethods.HDM_GETITEMW, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 915return XSend(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(pItem), Marshal.SizeOf(item.GetType())); 922bool result = XSend(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 935bool result = XSend(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 956return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType())); 962return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item32), Marshal.SizeOf(item32.GetType())); 968return XSend(hwnd, NativeMethods.TVM_SETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType())); 990Marshal.SizeOf(hitTestInfo.GetType()), XSendMessage.ErrorValue.Zero)) 999Marshal.SizeOf(hitTestInfo32.GetType()), XSendMessage.ErrorValue.Zero)) 1008Marshal.SizeOf(hitTestInfo64.GetType()), XSendMessage.ErrorValue.Zero)) 1027return GetTextWithinStructure(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item), Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), item.cchTextMax); 1035Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), item32.cchTextMax, 1042return GetTextWithinStructure(hwnd, NativeMethods.TVM_GETITEMW, IntPtr.Zero, new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), item64.cchTextMax); 1068return XSend(hwnd, NativeMethods.TB_GETBUTTON, new IntPtr(index), new IntPtr(pItem), Marshal.SizeOf(item.GetType()), ErrorValue.Zero); 1075bool result = XSend(hwnd, NativeMethods.TB_GETBUTTON, new IntPtr(index), new IntPtr(&item32), Marshal.SizeOf(item32.GetType()), ErrorValue.Zero); 1088bool result = XSend(hwnd, NativeMethods.TB_GETBUTTON, new IntPtr(index), new IntPtr(&item64), Marshal.SizeOf(item64.GetType()), ErrorValue.Zero); 1126Marshal.SizeOf(item.GetType()), new IntPtr(&item.pszText), maxTextLength, true); 1134Marshal.SizeOf(item32.GetType()), new IntPtr(&item32.pszText), maxTextLength, 1143Marshal.SizeOf(item64.GetType()), new IntPtr(&item64.pszText), maxTextLength, true); 1171int cMem = Marshal.SizeOf(rectW32.GetType()); 1979cbSize = Marshal.SizeOf(typeof(LVGROUP_32)); 1996cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP)), 2045cbSize = Marshal.SizeOf(typeof(LVGROUP_V6_32)); 2078cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6)), 2128cbSize = Marshal.SizeOf(typeof(LVGROUP_64)); 2146cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP)), 2196cbSize = Marshal.SizeOf(typeof(LVGROUP_V6_64)); 2230cbSize = Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6)), 2532cbSize = Marshal.SizeOf(typeof(TOOLINFO_32)); 2547cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO)), 2576cbSize = Marshal.SizeOf(typeof(TOOLINFO_64)); 2591cbSize = Marshal.SizeOf(typeof(NativeMethods.TOOLINFO)),
MS\Internal\AutomationProxies\Input.cs (5)
119if( UnsafeNativeMethods.SendInput( 1, ref mi, Marshal.SizeOf(mi) ) == 0 ) 120throw new Win32Exception(Marshal.GetLastWin32Error()); 144if( UnsafeNativeMethods.SendInput( 1, ref ki, Marshal.SizeOf(ki) ) == 0 ) 145throw new Win32Exception(Marshal.GetLastWin32Error()); 168Misc.SendInput(1, ref ki, Marshal.SizeOf(ki));
MS\Internal\AutomationProxies\Misc.cs (59)
119int lastWin32Error = Marshal.GetLastWin32Error(); 163int lastWin32Error = Marshal.GetLastWin32Error(); 176int lastWin32Error = Marshal.GetLastWin32Error(); 191int lastWin32Error = Marshal.GetLastWin32Error(); 215int lastWin32Error = Marshal.GetLastWin32Error(); 255int lastWin32Error = Marshal.GetLastWin32Error(); 272int lastWin32Error = Marshal.GetLastWin32Error(); 287int lastWin32Error = Marshal.GetLastWin32Error(); 301int lastWin32Error = Marshal.GetLastWin32Error(); 326tool.Init(Marshal.SizeOf(typeof(NativeMethods.TOOLINFO))); 425int lastWin32Error = Marshal.GetLastWin32Error(); 438int lastWin32Error = Marshal.GetLastWin32Error(); 451int lastWin32Error = Marshal.GetLastWin32Error(); 464int lastWin32Error = Marshal.GetLastWin32Error(); 477int lastWin32Error = Marshal.GetLastWin32Error(); 491int lastWin32Error = Marshal.GetLastWin32Error(); 504int lastWin32Error = Marshal.GetLastWin32Error(); 517int lastWin32Error = Marshal.GetLastWin32Error(); 530int lastWin32Error = Marshal.GetLastWin32Error(); 550int lastWin32Error = Marshal.GetLastWin32Error(); 615int lastWin32Error = Marshal.GetLastWin32Error(); 672int lastWin32Error = Marshal.GetLastWin32Error(); 711int lastWin32Error = Marshal.GetLastWin32Error(); 722ThrowWin32ExceptionsIfError(Marshal.GetLastWin32Error()); 778int lastWin32Error = Marshal.GetLastWin32Error(); 879int lastWin32Error = Marshal.GetLastWin32Error(); 893int lastWin32Error = Marshal.GetLastWin32Error(); 918int lastWin32Error = Marshal.GetLastWin32Error(); 984lastWin32Error = Marshal.GetLastWin32Error(); 994lastWin32Error = Marshal.GetLastWin32Error(); 1014int lastWin32Error = Marshal.GetLastWin32Error(); 1025lastWin32Error = Marshal.GetLastWin32Error(); 1046int lastWin32Error = Marshal.GetLastWin32Error(); 1078gui.cbSize = Marshal.SizeOf(gui.GetType()); 1081int lastWin32Error = Marshal.GetLastWin32Error(); 1178ti.cbSize = Marshal.SizeOf(ti.GetType()); 1181int lastWin32Error = Marshal.GetLastWin32Error(); 1194ti.cbSize = Marshal.SizeOf(ti.GetType()); 1197int lastWin32Error = Marshal.GetLastWin32Error(); 1252int lastWin32Error = Marshal.GetLastWin32Error(); 1280int lastWin32Error = Marshal.GetLastWin32Error(); 1306int lastWin32Error = Marshal.GetLastWin32Error(); 1332int lastWin32Error = Marshal.GetLastWin32Error(); 1347int lastWin32Error = Marshal.GetLastWin32Error(); 1383int lastWin32Error = Marshal.GetLastWin32Error(); 1396int lastWin32Error = Marshal.GetLastWin32Error(); 1412int lastWin32Error = Marshal.GetLastWin32Error(); 1426int lastWin32Error = Marshal.GetLastWin32Error(); 1445int lastWin32Error = Marshal.GetLastWin32Error(); 1465int lastWin32Error = Marshal.GetLastWin32Error(); 1606int lastWin32Error = Marshal.GetLastWin32Error(); 1719int lastWin32Error = Marshal.GetLastWin32Error(); 1732int lastWin32Error = Marshal.GetLastWin32Error(); 1745int lastWin32Error = Marshal.GetLastWin32Error(); 1758int lastWin32Error = Marshal.GetLastWin32Error(); 1771int lastWin32Error = Marshal.GetLastWin32Error(); 1784int lastWin32Error = Marshal.GetLastWin32Error(); 1797int lastWin32Error = Marshal.GetLastWin32Error(); 1903tool.Init(Marshal.SizeOf(typeof(NativeMethods.TOOLINFO)));
MS\Internal\AutomationProxies\SafeCoTaskMem.cs (4)
18SetHandle(Marshal.AllocCoTaskMem(length * sizeof (char))); 23return Marshal.PtrToStringAuto(handle); 29return Marshal.PtrToStringUni(handle, length); 34Marshal.FreeCoTaskMem(handle);
MS\Internal\AutomationProxies\WindowsAltTab.cs (2)
236altTabInfo.cbSize = (uint)Marshal.SizeOf(typeof(UnsafeNativeMethods.ALTTABINFO)); 246int lastWin32Error = Marshal.GetLastWin32Error();
MS\Internal\AutomationProxies\WindowsEditBox.cs (2)
553int cb = Marshal.SizeOf(typeof(NativeMethods.LOGFONT)); 706cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(NativeMethods.ScrollInfo)),
MS\Internal\AutomationProxies\WindowsHyperlink.cs (3)
211bGetItemResult = XSendMessage.XSend(_hwnd, NativeMethods.LM_HITTEST, IntPtr.Zero, new IntPtr(&HitTestInfo), Marshal.SizeOf(HitTestInfo.GetType())); 395return XSendMessage.XSend(_hwnd, NativeMethods.LM_SETITEM, IntPtr.Zero, new IntPtr(&linkItem), Marshal.SizeOf(linkItem.GetType())); 492bGetItemResult = XSendMessage.XSend(_hwnd, NativeMethods.LM_HITTEST, IntPtr.Zero, new IntPtr(&HitTestInfo), Marshal.SizeOf(HitTestInfo.GetType()));
MS\Internal\AutomationProxies\WindowsListView.cs (7)
1269if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETITEMRECT, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(itemRectangle.GetType()))) 1420result = XSendMessage.XSendGetIndex(hwnd, NativeMethods.LVM_SUBITEMHITTEST, IntPtr.Zero, new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); 1429result = XSendMessage.XSendGetIndex(hwnd, NativeMethods.LVM_SUBITEMHITTEST, IntPtr.Zero, new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); 1493if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETSUBITEMRECT, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(itemRectangle.GetType()))) 1664scrollBarInfo.cbSize = Marshal.SizeOf(scrollBarInfo.GetType()); 1675si.cbSize = Marshal.SizeOf (si.GetType ()); 1792if (XSendMessage.XSend(hwnd, NativeMethods.LVM_GETITEMPOSITION, new IntPtr(item), new IntPtr(location), Marshal.SizeOf(pt.GetType())))
MS\Internal\AutomationProxies\WindowsListViewGroup.cs (12)
96group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 106group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP))); 152group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 240group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 306XSendMessage.XSendGetIndex(_hwnd, NativeMethods.LVM_HITTEST, new IntPtr(-1), new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); 332groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 337bool lresult = XSendMessage.XSend(_hwnd, NativeMethods.LVM_GETGROUPINFOBYINDEX, new IntPtr(groupIndex), new IntPtr(&groupInfo), Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 424group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP))); 490groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 495bool lresult = XSendMessage.XSend(hwnd, NativeMethods.LVM_GETGROUPINFOBYINDEX, new IntPtr(groupIndex), new IntPtr(&groupInfo), Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 504groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 606group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP)));
MS\Internal\AutomationProxies\WindowsListViewGroupHelper.cs (5)
386while (XSendMessage.XSend (hwnd, NativeMethods.LVM_GETNEXTITEMINDEX, new IntPtr(&ii), flags, Marshal.SizeOf(ii.GetType()))) 390groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 393bool lresult = XSendMessage.XSend(hwnd, NativeMethods.LVM_GETGROUPINFOBYINDEX, new IntPtr(ii.iGroup), new IntPtr(&groupInfo), Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 703new IntPtr(_groupID), new IntPtr(&rect), Marshal.SizeOf(rect.GetType())); 814sbi.cbSize = Marshal.SizeOf(sbi.GetType());
MS\Internal\AutomationProxies\WindowsListViewGroupSubsetLink.cs (3)
77XSendMessage.XSend(_hwnd, NativeMethods.LVM_GETGROUPRECT, new IntPtr(0), new IntPtr(&rect), Marshal.SizeOf(rect.GetType())); 88groupInfo.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6))); 105group.Init(Marshal.SizeOf(typeof(NativeMethods.LVGROUP_V6)));
MS\Internal\AutomationProxies\WindowsListViewItem.cs (2)
133if (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)
56si.cbSize = Marshal.SizeOf (si.GetType ());
MS\Internal\AutomationProxies\WindowsMenu.cs (6)
504mbi.cbSize = Marshal.SizeOf(mbi.GetType()); 1886menuItemInfo.cbSize = Marshal.SizeOf(menuItemInfo.GetType()); 1901menuItemInfo.cbSize = Marshal.SizeOf (menuItemInfo.GetType ()); 1945menuItemInfo.cbSize = Marshal.SizeOf(menuItemInfo.GetType()); 2552menuItemInfo.cbSize = Marshal.SizeOf(menuItemInfo.GetType()); 2593int readSize = Marshal.SizeOf(msaaMenuInfo.GetType());
MS\Internal\AutomationProxies\WindowsRebar.cs (3)
206return XSendMessage.XSendGetIndex(_hwnd, NativeMethods.RB_HITTEST, IntPtr.Zero, new IntPtr(&rbHitTestInfo), Marshal.SizeOf(rbHitTestInfo.GetType())); 399if (!XSendMessage.XSend(hwnd, NativeMethods.RB_GETRECT, new IntPtr(item), new IntPtr(&rectW32), Marshal.SizeOf(rectW32.GetType()), XSendMessage.ErrorValue.Zero)) 435if (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)
1233Marshal.ThrowExceptionForHR(hr);
MS\Internal\AutomationProxies\WindowsScroll.cs (6)
127sbi.cbSize = Marshal.SizeOf(sbi.GetType()); 143si.cbSize = Marshal.SizeOf (si.GetType ()); 195si.cbSize = Marshal.SizeOf (si.GetType ()); 250si.cbSize = Marshal.SizeOf (si.GetType ()); 291si.cbSize = Marshal.SizeOf(si.GetType ()); 367si.cbSize = Marshal.SizeOf (si.GetType ());
MS\Internal\AutomationProxies\WindowsScrollBar.cs (8)
135sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 431si.cbSize = Marshal.SizeOf (si.GetType ()); 445sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 519sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 572si.cbSize = Marshal.SizeOf (si.GetType ()); 625si.cbSize = Marshal.SizeOf (si.GetType ()); 711sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 726sbi.cbSize = Marshal.SizeOf(sbi.GetType());
MS\Internal\AutomationProxies\WindowsScrollBarBits.cs (3)
205si.cbSize = Marshal.SizeOf (si.GetType ()); 223sbi.cbSize = Marshal.SizeOf (sbi.GetType ()); 542si.cbSize = Marshal.SizeOf (si.GetType ());
MS\Internal\AutomationProxies\WindowsSlider.cs (2)
460XSendMessage.XSend(hwnd, NativeMethods.TBM_GETCHANNELRECT, IntPtr.Zero, new IntPtr(&rcChannel), Marshal.SizeOf(rcChannel.GetType()), XSendMessage.ErrorValue.NoCheck); 472XSendMessage.XSend(hwnd, NativeMethods.TBM_GETTHUMBRECT, IntPtr.Zero, new IntPtr(&rcThumb), Marshal.SizeOf(rcThumb.GetType()), XSendMessage.ErrorValue.NoCheck);
MS\Internal\AutomationProxies\WindowsSysHeader.cs (2)
161index = XSendMessage.XSendGetIndex(_hwnd, NativeMethods.HDM_HITTEST, IntPtr.Zero, new IntPtr(&HitTestInfo), Marshal.SizeOf(HitTestInfo.GetType())); 568result = 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)
276index = XSendMessage.XSendGetIndex(_hwnd, NativeMethods.TCM_HITTEST, IntPtr.Zero, new IntPtr(&hti), Marshal.SizeOf(hti.GetType())); 653result = XSendMessage.XSend(hwnd, NativeMethods.TCM_GETITEMRECT, new IntPtr(count - 1), new IntPtr(&rectW32), Marshal.SizeOf(rectW32.GetType()), XSendMessage.ErrorValue.Zero); 1272if (!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)
555if (!XSendMessage.XSend(hwnd, NativeMethods.TVM_GETITEMRECT, partialDisplay, rectangle, Marshal.SizeOf(rc.GetType()))) 935if (Marshal.SizeOf(_hItem.GetType()) > sizeof(int)) 1592int readSize = Marshal.SizeOf(ent.GetType());
MS\Win32\NativeMethods.cs (1)
1486internal static int comboboxInfoSize = Marshal.SizeOf(typeof(NativeMethods.COMBOBOXINFO));
MS\Win32\UnsafeNativeMethods.cs (2)
378error = Marshal.GetLastWin32Error(); 385error = Marshal.GetLastWin32Error();
UIAutomationProvider (1)
MS\Internal\Automation\UiaCoreProviderApi.cs (1)
105Marshal.ThrowExceptionForHR(hr, (IntPtr)(-1));
UIAutomationTypes (57)
MS\Internal\Automation\UiaCoreTypesApi.cs (1)
102Marshal.ThrowExceptionForHR(hr, (IntPtr)(-1));
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (35)
1525return Marshal.SizeOf(typeof(MONITORINFOEX)); 1538return Marshal.SizeOf(typeof(TRACKMOUSEEVENT)); 1593return Marshal.SizeOf(typeof(NONCLIENTMETRICS)); 1608return Marshal.SizeOf(typeof(ICONMETRICS)); 1738return Marshal.SizeOf(typeof(MENUITEMINFO_T)); 1785return Marshal.SizeOf(typeof(OPENFILENAME_I)); 1964return Marshal.SizeOf(typeof(tagCONTROLINFO)); 1991Marshal.Release(this.data1); 2025IntPtr mem = Marshal.AllocCoTaskMem(16); 2026Marshal.WriteInt16(mem, vt); 2027Marshal.WriteInt16(mem, 2, reserved1); 2028Marshal.WriteInt16(mem, 4, reserved2); 2029Marshal.WriteInt16(mem, 6, reserved3); 2030Marshal.WriteInt32(mem, 8, (int) data1); 2031Marshal.WriteInt32(mem, 12, (int) data2); 2049val = (IntPtr) Marshal.ReadByte(val); 2055val = (IntPtr) Marshal.ReadByte(val); 2062val = (IntPtr) Marshal.ReadInt16(val); 2068val = (IntPtr) Marshal.ReadInt16(val); 2075val = (IntPtr) Marshal.ReadInt32(val); 2082val = (IntPtr) Marshal.ReadInt32(val); 2089longVal = Marshal.ReadInt64(val); 2123return Marshal.PtrToStringUni(val); 2126return Marshal.PtrToStringAnsi(val); 2131return Marshal.GetObjectForIUnknown(val); 2145VARIANT varStruct = Marshal.PtrToStructure<VARIANT>(val); 2149Guid guid = Marshal.PtrToStructure<Guid>(val); 2183return Marshal.ReadIntPtr(value); 2305if (Marshal.SystemDefaultCharSize == 1) 2336IntPtr result = Marshal.AllocCoTaskMem(buffer.Length); 2337Marshal.Copy(buffer, 0, result, buffer.Length); 2360Marshal.Copy(ptr, buffer, 0, buffer.Length); 2394IntPtr result = Marshal.AllocCoTaskMem(buffer.Length * 2); 2395Marshal.Copy(buffer, 0, result, buffer.Length); 2417Marshal.Copy(ptr, buffer, 0, buffer.Length);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsOther.cs (5)
86return Marshal.SizeOf(typeof(OSVERSIONINFOEX)); 157return Marshal.SizeOf(typeof(DOCHOSTUIINFO)); 513return Marshal.SizeOf(typeof(BITMAPINFO)); 544return Marshal.SizeOf(typeof(SECURITY_ATTRIBUTES)); 1083return Marshal.SizeOf(typeof(ANIMATIONINFO));
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\UnsafeNativeMethodsCLR.cs (16)
246int error = Marshal.GetLastWin32Error(); 269int error = Marshal.GetLastWin32Error(); 285int win32Err = Marshal.GetLastWin32Error(); 362int win32Err = Marshal.GetLastWin32Error(); 376int win32Err = Marshal.GetLastWin32Error(); 466int errorCode = Marshal.GetLastWin32Error(); 479int errorCode = Marshal.GetLastWin32Error(); 895int error = Marshal.GetLastWin32Error(); 916int error = Marshal.GetLastWin32Error(); 959int error = Marshal.GetLastWin32Error(); 974int error = Marshal.GetLastWin32Error(); 2551VariantSize = (int)Marshal.OffsetOf(typeof(FindSizeOfVariant), "b"); 2564mem = Marshal.AllocCoTaskMem(len * VariantSize); 2568Marshal.GetNativeVariantForObject(args[i], (IntPtr)(a + VariantSize * i)); 2605Marshal.FreeCoTaskMem(mem); 2609Marshal.ThrowExceptionForHR(hr);
vbc (6)
src\roslyn\src\Compilers\Shared\BuildClient.cs (1)
363var commandLine = Marshal.PtrToStringUni(ptr)!;
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (5)
469/// <returns>Pointer to environment block that must be freed with <see cref="Marshal.FreeHGlobal"/></returns> 491return Marshal.StringToHGlobalUni(envBlock.ToString()); 572startInfo.cb = Marshal.SizeOf(startInfo); 614logger.LogError("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error()); 622Marshal.FreeHGlobal(environmentBlockPtr);
VBCSCompiler (7)
src\roslyn\src\Compilers\Server\VBCSCompiler\MemoryHelper.cs (1)
21this.Length = (int)Marshal.SizeOf(this);
src\roslyn\src\Compilers\Shared\BuildClient.cs (1)
363var commandLine = Marshal.PtrToStringUni(ptr)!;
src\roslyn\src\Compilers\Shared\BuildServerConnection.cs (5)
469/// <returns>Pointer to environment block that must be freed with <see cref="Marshal.FreeHGlobal"/></returns> 491return Marshal.StringToHGlobalUni(envBlock.ToString()); 572startInfo.cb = Marshal.SizeOf(startInfo); 614logger.LogError("Failed to create process. GetLastError={0}", Marshal.GetLastWin32Error()); 622Marshal.FreeHGlobal(environmentBlockPtr);
WindowsFormsIntegration (1)
System\Windows\Integration\WindowsFormsHost.cs (1)
967throw new Win32Exception(Marshal.GetLastWin32Error());