36 writes to handle
Microsoft.AspNetCore.Cryptography.Internal (1)
SafeHandles\SecureLocalAllocHandle.cs (1)
46handle = Marshal.AllocHGlobal(cb); // actually calls LocalAlloc
Microsoft.AspNetCore.Server.HttpSys (1)
NativeInterop\SafeNativeOverlapped.cs (1)
38IntPtr oldHandle = Interlocked.Exchange(ref handle, IntPtr.Zero);
Microsoft.AspNetCore.Server.IIS (2)
Core\NativeSafeHandle.cs (2)
18this.handle = handle; 23handle = IntPtr.Zero;
PresentationCore (3)
System\Windows\Media\safemediahandle.cs (1)
31UnsafeNativeMethods.MILUnknown.ReleaseInterface(ref handle);
System\Windows\Media\SafeMILHandle.cs (1)
63UnsafeNativeMethods.MILUnknown.ReleaseInterface(ref handle);
System\Windows\Media\SafeReversePInvokeHandle.cs (1)
47UnsafeNativeMethods.MILUnknown.ReleaseInterface(ref handle);
PresentationFramework (5)
System\Windows\Standard\NativeMethods.cs (5)
1502handle = hdc, 1539safeHandle.handle = unsafeHandle; 1560handle = IntPtr.Zero; 1572handle = new IntPtr(dwCookie); 1596handle = IntPtr.Zero;
System.Data.Odbc (6)
Common\System\Data\ProviderBase\DbBuffer.cs (2)
26base.handle = SafeNativeMethods.LocalAlloc((IntPtr)initialSize); 375base.handle = IntPtr.Zero;
System\Data\Odbc\OdbcHandle.cs (4)
31retcode = Interop.Odbc.SQLAllocHandle(handleType, IntPtr.Zero, out base.handle); 39retcode = Interop.Odbc.SQLAllocHandle(handleType, parentHandle, out base.handle); 92retcode = parentHandle.GetStatementAttribute(attribute, out base.handle, out cbActual); 139base.handle = IntPtr.Zero;
System.IO.MemoryMappedFiles (1)
Microsoft\Win32\SafeMemoryMappedViewHandle.Unix.cs (1)
19handle = new IntPtr(-1);
System.Net.Security (7)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (2)
108handle = IntPtr.Zero; 123handle = IntPtr.Zero;
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (1)
524handle = validSslPointer;
src\libraries\Common\src\Microsoft\Win32\SafeHandles\GssSafeHandles.cs (3)
57Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out _, ref handle); 145Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out _, ref handle); 170Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out _, ref handle);
System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs (1)
39handle = Marshal.AllocHGlobal(SecChannelBindingSize + _cbtPrefixByteArraySize + CertHashMaxSize);
System.Private.CoreLib (2)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeHandle.cs (2)
66handle = invalidHandleValue; 96protected internal void SetHandle(IntPtr handle) => this.handle = handle;
System.Security.Cryptography (6)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (3)
29handle = Marshal.StringToHGlobalUni(password); 47handle = Marshal.AllocHGlobal(spanLen * sizeof(char)); 68handle = Marshal.SecureStringToGlobalAllocUnicode(password);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (2)
108handle = IntPtr.Zero; 123handle = IntPtr.Zero;
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEvpKdfHandle.Unix.cs (1)
19handle = 0;
System.Windows.Forms.Primitives (1)
Microsoft\Win32\SafeHandles\CoTaskMemSafeHandle.cs (1)
19handle = IntPtr.Zero;
UIAutomationTypes (1)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsOther.cs (1)
251handle = hbitmap,
262 references to handle
Infrastructure.Common (2)
SafeKeychainHandle.cs (2)
41CFRelease(handle); 46public override bool IsInvalid => handle == IntPtr.Zero;
Microsoft.AspNetCore.Cryptography.Internal (7)
SafeHandles\BCryptAlgorithmHandle.cs (1)
156return (UnsafeNativeMethods.BCryptCloseAlgorithmProvider(handle, dwFlags: 0) == 0);
SafeHandles\BCryptHashHandle.cs (1)
56return (UnsafeNativeMethods.BCryptDestroyHash(handle) == 0);
SafeHandles\BCryptKeyHandle.cs (1)
17return (UnsafeNativeMethods.BCryptDestroyKey(handle) == 0);
SafeHandles\LocalAllocHandle.cs (1)
21Marshal.FreeHGlobal(handle); // actually calls LocalFree
SafeHandles\NCryptDescriptorHandle.cs (1)
39return (UnsafeNativeMethods.NCryptCloseProtectionDescriptor(handle) == 0);
SafeHandles\SafeLibraryHandle.cs (1)
124return UnsafeNativeMethods.FreeLibrary(handle);
SafeHandles\SecureLocalAllocHandle.cs (1)
59UnsafeBufferUtil.SecureZeroMemory((byte*)handle, _cb); // compiler won't optimize this away
Microsoft.AspNetCore.Server.HttpSys (2)
NativeInterop\SafeLibraryHandle.cs (1)
69return UnsafeNativeMethods.FreeLibrary(handle);
NativeInterop\SafeNativeOverlapped.cs (1)
31get { return handle == IntPtr.Zero; }
Microsoft.AspNetCore.Server.IIS (1)
Core\NativeSafeHandle.cs (1)
13public override bool IsInvalid => handle == IntPtr.Zero;
Microsoft.Build (2)
InprocTrackingNativeMethods.cs (1)
291{ return IntPtr.Zero == handle; }
SafeFileHandle.cs (1)
26return WindowsNative.FindClose(handle);
Microsoft.Build.Engine.OM.UnitTests (1)
SafeFileHandle.cs (1)
26return WindowsNative.FindClose(handle);
Microsoft.Build.Framework (1)
NativeMethods.cs (1)
279return CloseHandle(handle);
Microsoft.Build.Tasks.Core (1)
SafeFileHandle.cs (1)
26return WindowsNative.FindClose(handle);
Microsoft.Build.Utilities.Core (2)
InprocTrackingNativeMethods.cs (1)
291{ return IntPtr.Zero == handle; }
SafeFileHandle.cs (1)
26return WindowsNative.FindClose(handle);
Microsoft.CodeAnalysis.Workspaces (3)
Storage\SQLite\Interop\SafeSqliteBlobHandle.cs (1)
36public override bool IsInvalid => handle == IntPtr.Zero;
Storage\SQLite\Interop\SafeSqliteHandle.cs (1)
33public override bool IsInvalid => handle == IntPtr.Zero;
Storage\SQLite\Interop\SafeSqliteStatementHandle.cs (1)
36public override bool IsInvalid => handle == IntPtr.Zero;
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Windows\Interop\JobObjectInfo.cs (1)
290return UnsafeNativeMethods.CloseHandle(handle);
Microsoft.ML.LightGbm (2)
WrappedLightGbmInterface.cs (2)
79LightGbmInterfaceUtils.Check(DatasetFree(handle)); 174LightGbmInterfaceUtils.Check(BoosterFree(handle));
Microsoft.ML.Transforms (1)
Text\LdaSingleBox.cs (1)
27DestroyEngine(handle);
Microsoft.VisualBasic.Forms (1)
Microsoft\VisualBasic\Helpers\NativeTypes.vb (1)
39Return NativeMethods.CloseHandle(handle) <> 0
MSBuild (1)
SafeFileHandle.cs (1)
26return WindowsNative.FindClose(handle);
MSBuildTaskHost (1)
NativeMethods.cs (1)
279return CloseHandle(handle);
PresentationCore (12)
MS\Win32\UnsafeNativeMethodsTablet.cs (6)
84return IsClosed || handle == IntPtr.Zero; 90Debug.Assert(handle != IntPtr.Zero); 91return (MS.Internal.HRESULT.Succeeded(MS.Win32.Recognizer.UnsafeNativeMethods.DestroyRecognizer(handle))); 119return IsClosed || handle == IntPtr.Zero; 130Debug.Assert(handle != IntPtr.Zero); 131int hr = MS.Win32.Recognizer.UnsafeNativeMethods.DestroyContext(handle);
System\Windows\Media\ColorContextHelper.cs (1)
36return UnsafeNativeMethodsMilCoreApi.Mscms.CloseColorProfile(handle);
System\Windows\Media\ColorTransformHelper.cs (1)
35return UnsafeNativeMethods.Mscms.DeleteColorTransform(handle);
System\Windows\Media\Imaging\BitmapSourceSafeMILHandle.cs (1)
59UpdateEstimatedSize(ComputeEstimatedSize(handle));
System\Windows\Media\safemediahandle.cs (1)
30HRESULT.Check(MILMedia.Shutdown(handle));
System\Windows\Media\SafeReversePInvokeHandle.cs (2)
43if (handle != IntPtr.Zero) 45UnsafeNativeMethods.MilCoreApi.MilReleasePInvokePtrBlocking(handle);
PresentationFramework (7)
System\Windows\Standard\NativeMethods.cs (7)
1361return NativeMethods.FindClose(handle); 1405return NativeMethods.DeleteDC(handle); 1413return NativeMethods.ReleaseDC(_hwnd.Value, handle) == 1; 1448hPtr = hdc.handle; 1515return NativeMethods.DeleteObject(handle); 1525Status s = NativeMethods.GdiplusShutdown(this.handle); 1595int dwCookie = handle.ToInt32();
ReachFramework (5)
MS\Internal\Printing\Configuration\SafeModuleHandle.cs (1)
27return UnsafeNativeMethods.FreeLibrary(this.handle);
MS\Internal\Printing\Configuration\SafeWinSpoolPrinterHandle.cs (2)
26return (base.handle == IntPtr.Zero); 34return UnsafeNativeMethods.ClosePrinter(base.handle);
PrintConfig\PTProvider.cs (2)
58return (IsClosed || (handle == IntPtr.Zero)); 68return PTUtility.IsSuccessCode(UnsafeNativeMethods.PTCloseProviderImpl(this.handle));
System.Data.Odbc (12)
Common\System\Data\ProviderBase\DbBuffer.cs (3)
28if (IntPtr.Zero == base.handle) 45return (IntPtr.Zero == base.handle); 374IntPtr ptr = base.handle;
System\Data\Odbc\OdbcConnectionHandle.cs (3)
146ODBC32.SQLRETURN retcode = CompleteTransaction(transactionOperation, base.handle); 214CompleteTransaction(ODBC32.SQL_ROLLBACK, handle); 218Interop.Odbc.SQLDisconnect(handle);
System\Data\Odbc\OdbcHandle.cs (6)
55if (IntPtr.Zero != base.handle) 71if ((ADP.PtrZero == base.handle) || (ODBC32.SQLRETURN.SUCCESS != retcode)) 98if (IntPtr.Zero != base.handle) 111if (ADP.PtrZero == base.handle) 131return (IntPtr.Zero == base.handle); 138IntPtr handle = base.handle;
System.IO.Compression (2)
src\libraries\Common\src\System\IO\Compression\ZLibNative.cs (2)
146/// <see cref="ZLibStreamHandle" /> does not actually use its <see cref="SafeHandle.handle" /> field. 177get { return handle == new IntPtr(-1); }
System.IO.Compression.Brotli (4)
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBrotliHandle.cs (4)
15Interop.Brotli.BrotliEncoderDestroyInstance(handle); 19public override bool IsInvalid => handle == IntPtr.Zero; 28Interop.Brotli.BrotliDecoderDestroyInstance(handle); 32public override bool IsInvalid => handle == IntPtr.Zero;
System.IO.MemoryMappedFiles (2)
Microsoft\Win32\SafeMemoryMappedFileHandle.Unix.cs (1)
89public override bool IsInvalid => (long)handle <= 0;
Microsoft\Win32\SafeMemoryMappedViewHandle.Unix.cs (1)
18IntPtr addr = handle;
System.IO.Pipes (4)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (4)
63return (long)handle >= 0 ? 64Interop.Sys.Close(handle) == 0 : 71get { return (long)handle < 0 && _pipeSocket == null; } 84socket = SetPipeSocketInterlocked(new Socket(new SafeSocketHandle(handle, ownsHandle)), ownsHandle);
System.IO.Ports (2)
System\IO\Ports\SafeSerialDeviceHandle.Unix.cs (2)
39Interop.Serial.Shutdown(handle, SocketShutdown.Both); 40int result = Interop.Serial.SerialPortClose(handle);
System.Net.Quic (21)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Stack.cs (2)
73Interop.Crypto.RecursiveFreeX509Stack(handle); 80get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs (2)
86Interop.Crypto.X509StoreCtxDestroy(handle); 93get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs (4)
18Interop.Crypto.Asn1ObjectFree(handle); 25get { return handle == IntPtr.Zero; } 38Interop.Crypto.Asn1OctetStringFree(handle); 45get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs (2)
22IntPtr h = handle; 44return handle == IntPtr.Zero || (_parent != null && _parent.IsInvalid);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs (1)
38return handle == IntPtr.Zero || (_parent != null && _parent.IsInvalid);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeX509Handles.Unix.cs (7)
23Console.WriteLine($"0x{handle.ToInt64():x} {_stacktrace?.ToString() ?? "no stacktrace..."}"); 37Interop.Crypto.X509Destroy(handle); 44get { return handle == IntPtr.Zero; } 57Interop.Crypto.X509CrlDestroy(handle); 64get { return handle == IntPtr.Zero; } 77Interop.Crypto.X509StoreDestroy(handle); 84get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs (2)
19Interop.Crypto.X509ExtensionDestroy(handle); 26get { return handle == IntPtr.Zero; }
System\Net\Quic\Internal\MsQuicSafeHandle.cs (1)
28public override bool IsInvalid => handle == IntPtr.Zero;
System.Net.Security (38)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (2)
107Interop.Crypto.OcspRequestDestroy(handle); 122Interop.Crypto.OcspResponseDestroy(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (5)
460get { return handle == IntPtr.Zero; } 485Interop.Ssl.SslSetData(handle, IntPtr.Zero); 489IntPtr h = handle; 500int retVal = Interop.Ssl.SslShutdown(handle); 508retVal = Interop.Ssl.SslShutdown(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (3)
93get { return handle == IntPtr.Zero; } 135Interop.Ssl.SslCtxSetData(handle, IntPtr.Zero); 151Interop.Ssl.SslCtxDestroy(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Stack.cs (2)
73Interop.Crypto.RecursiveFreeX509Stack(handle); 80get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs (2)
86Interop.Crypto.X509StoreCtxDestroy(handle); 93get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs (4)
18Interop.Crypto.Asn1ObjectFree(handle); 25get { return handle == IntPtr.Zero; } 38Interop.Crypto.Asn1OctetStringFree(handle); 45get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\GssSafeHandles.cs (3)
52get { return handle == IntPtr.Zero; } 140get { return handle == IntPtr.Zero; } 165get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs (2)
22IntPtr h = handle; 44return handle == IntPtr.Zero || (_parent != null && _parent.IsInvalid);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs (1)
38return handle == IntPtr.Zero || (_parent != null && _parent.IsInvalid);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeX509Handles.Unix.cs (7)
23Console.WriteLine($"0x{handle.ToInt64():x} {_stacktrace?.ToString() ?? "no stacktrace..."}"); 37Interop.Crypto.X509Destroy(handle); 44get { return handle == IntPtr.Zero; } 57Interop.Crypto.X509CrlDestroy(handle); 64get { return handle == IntPtr.Zero; } 77Interop.Crypto.X509StoreDestroy(handle); 84get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs (2)
19Interop.Crypto.X509ExtensionDestroy(handle); 26get { return handle == IntPtr.Zero; }
src\libraries\Common\src\System\Net\Security\Unix\SafeDeleteContext.cs (1)
26get { return (IntPtr.Zero == handle); }
System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs (4)
40IntPtr cbtPrefixPtr = handle + SecChannelBindingSize; 56Marshal.StructureToPtr(channelBindings, handle, true); 59public override bool IsInvalid => handle == IntPtr.Zero; 63Marshal.FreeHGlobal(handle);
System.Net.Sockets (17)
System\Net\Sockets\SafeSocketHandle.cs (4)
127Debug.Fail($"handle:{handle}, error:{exception}"); 141if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, $"handle:{handle}"); 158Debug.Assert(ExceptionCheck.IsFatal(exception), $"handle:{handle}, error:{exception}"); 166Debug.Assert(ret, $"ReleaseHandle failed. handle:{handle}");
System\Net\Sockets\SafeSocketHandle.Unix.cs (13)
200int fdFlags = Interop.Sys.Fcntl.GetFD(handle); 209Interop.Error err = Interop.Sys.GetSockOpt(handle, SocketOptionLevel.Socket, SocketOptionName.Type, (byte*)&type, &optLen); 216Interop.Sys.Disconnect(handle); 220Interop.Sys.Shutdown(handle, SocketShutdown.Both); 233return SocketPal.GetSocketErrorForErrorCode(CloseHandle(handle)); 238return SocketPal.GetSocketErrorForErrorCode(CloseHandle(handle)); 246if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, $"handle:{handle} Following 'non-abortive' branch."); 249errorCode = CloseHandle(handle); 257if (Interop.Sys.Fcntl.DangerousSetIsNonBlocking(handle, 0) == 0) 260return SocketPal.GetSocketErrorForErrorCode(CloseHandle(handle)); 273errorCode = Interop.Sys.SetLingerOption(handle, &linger); 277if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, $"handle:{handle}, setsockopt():{errorCode}"); 285errorCode = CloseHandle(handle);
System.Net.WebSockets (2)
src\libraries\Common\src\System\IO\Compression\ZLibNative.cs (2)
146/// <see cref="ZLibStreamHandle" /> does not actually use its <see cref="SafeHandle.handle" /> field. 177get { return handle == new IntPtr(-1); }
System.Private.CoreLib (17)
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs (3)
151Interop.Sys.FLock(handle, Interop.Sys.LockOperations.LOCK_UN); // ignore any errors 158int result = Interop.Sys.Close(handle); 170long h = (long)handle;
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeHandleMinusOneIsInvalid.cs (1)
16public override bool IsInvalid => handle == new IntPtr(-1);
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeHandleZeroOrMinusOneIsInvalid.cs (2)
16public override bool IsInvalid => handle == IntPtr.Zero || handle == new IntPtr(-1);
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeWaitHandle.Windows.cs (1)
8protected override bool ReleaseHandle() => Interop.Kernel32.CloseHandle(handle);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeBuffer.cs (6)
161pointer = (byte*)handle; 187byte* ptr = (byte*)handle + byteOffset; 238byte* ptr = (byte*)handle + byteOffset; 274byte* ptr = (byte*)handle + byteOffset; 327byte* ptr = (byte*)handle + byteOffset; 370if ((ulong)(ptr - (byte*)handle) > (_numBytes - sizeInBytes))
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\SafeHandle.cs (2)
98public IntPtr DangerousGetHandle() => handle; 118Internal.Console.WriteLine($"{Environment.NewLine}*** #{count} {GetType()} (0x{handle.ToInt64():x}) finalized! Ctor stack:{Environment.NewLine}{_ctorStackTrace}{Environment.NewLine}");
src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (2)
464new Span<byte>((void*)handle, _byteLength).Clear(); 465Marshal.FreeHGlobal(handle);
System.Security.Cryptography (53)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (3)
52Span<char> dest = new Span<char>((void*)handle, spanLen); 77Marshal.ZeroFreeGlobalAllocUnicode(handle); 102return new ReadOnlySpan<char>((char*)handle, Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (2)
107Interop.Crypto.OcspRequestDestroy(handle); 122Interop.Crypto.OcspResponseDestroy(handle);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Stack.cs (2)
73Interop.Crypto.RecursiveFreeX509Stack(handle); 80get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs (2)
86Interop.Crypto.X509StoreCtxDestroy(handle); 93get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs (4)
18Interop.Crypto.Asn1ObjectFree(handle); 25get { return handle == IntPtr.Zero; } 38Interop.Crypto.Asn1OctetStringFree(handle); 45get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBignumHandle.Unix.cs (2)
24Interop.Crypto.BigNumDestroy(handle); 31get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs (2)
22IntPtr h = handle; 44return handle == IntPtr.Zero || (_parent != null && _parent.IsInvalid);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeDsaHandle.Unix.cs (2)
20Interop.Crypto.DsaDestroy(handle); 27get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEcKeyHandle.Unix.cs (2)
20Interop.Crypto.EcKeyDestroy(handle); 27get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEvpCipherCtxHandle.Unix.cs (2)
19Interop.Crypto.EvpCipherDestroy(handle); 26get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEvpKdfHandle.Unix.cs (2)
18Interop.Crypto.EvpKdfFree(handle); 23public override bool IsInvalid => handle == 0;
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEvpMacCtxHandle.Unix.cs (2)
18Interop.Crypto.EvpMacCtxFree(handle); 22public override bool IsInvalid => handle == 0;
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEvpMacHandle.Unix.cs (2)
18Interop.Crypto.EvpMacFree(handle); 22public override bool IsInvalid => handle == 0;
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEvpMdCtxHandle.Unix.cs (2)
19Interop.Crypto.EvpMdCtxDestroy(handle); 25get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeHmacCtxHandle.Unix.cs (2)
18Interop.Crypto.HmacDestroy(handle); 25get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs (1)
38return handle == IntPtr.Zero || (_parent != null && _parent.IsInvalid);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafePkcs7Handle.Unix.cs (2)
18Interop.Crypto.Pkcs7Destroy(handle); 25get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeX509ChainHandle.cs (1)
25return ChainPal.ReleaseSafeX509ChainHandle(handle);
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeX509Handles.Unix.cs (7)
23Console.WriteLine($"0x{handle.ToInt64():x} {_stacktrace?.ToString() ?? "no stacktrace..."}"); 37Interop.Crypto.X509Destroy(handle); 44get { return handle == IntPtr.Zero; } 57Interop.Crypto.X509CrlDestroy(handle); 64get { return handle == IntPtr.Zero; } 77Interop.Crypto.X509StoreDestroy(handle); 84get { return handle == IntPtr.Zero; }
src\libraries\Common\src\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs (2)
19Interop.Crypto.X509ExtensionDestroy(handle); 26get { return handle == IntPtr.Zero; }
System\Security\Cryptography\FixedMemoryKeyBox.cs (4)
20internal ReadOnlySpan<byte> DangerousKeySpan => new ReadOnlySpan<byte>((void*)handle, _length); 24CryptographicOperations.ZeroMemory(new Span<byte>((void*)handle, _length)); 25NativeMemory.Free((void*)handle); 29public override bool IsInvalid => handle == IntPtr.Zero;
System\Security\Cryptography\SafeEvpPKeyHandle.OpenSsl.cs (3)
48Interop.Crypto.EvpPkeyDestroy(handle, ExtraHandle); 57get { return handle == IntPtr.Zero; } 86safeHandle.SetHandle(handle);
System.Text.Encoding.CodePages (2)
Microsoft\Win32\SafeHandles\SafeAllocHHandle.cs (2)
26if (handle != IntPtr.Zero) 28Marshal.FreeHGlobal(handle);
System.Windows.Forms.Primitives (2)
Microsoft\Win32\SafeHandles\CoTaskMemSafeHandle.cs (2)
14public override bool IsInvalid => IsClosed || handle == IntPtr.Zero; 18Marshal.FreeCoTaskMem(handle);
UIAutomationClient (14)
MS\Internal\Automation\SafeHandles.cs (6)
28get { return handle == IntPtr.Zero; } 33return UiaCoreApi.UiaNodeRelease(handle); 51get { return handle == IntPtr.Zero; } 56return UiaCoreApi.UiaPatternRelease(handle); 71get { return handle == IntPtr.Zero; } 76UiaCoreApi.UiaRemoveEvent(handle);
MS\Internal\Automation\SafeProcessHandle.cs (1)
33return Misc.CloseHandle(handle);
System\Windows\Automation\Condition.cs (5)
23get { return handle == IntPtr.Zero; } 28Marshal.FreeCoTaskMem(handle); 46Marshal.StructureToPtr(uiaCondition, sh.handle, false); 66IntPtr* pdata = (IntPtr*)sh.handle; 69*pdata++ = conditions[i]._safeHandle.handle;
System\Windows\Automation\Text\TextRange.cs (2)
29get { return handle == IntPtr.Zero; } 34return UiaCoreApi.UiaTextRangeRelease(handle);
UIAutomationClientSideProviders (10)
MS\Internal\AutomationProxies\CommonRemoteMemoryBlock.cs (5)
54return Misc.VirtualFreeEx(_processHandle, handle, UIntPtr.Zero, UnsafeNativeMethods.MEM_RELEASE); 71return handle; 78Misc.WriteProcessMemory(_processHandle, handle, sourceAddress, cbSize, out count); 90Misc.ReadProcessMemory(_processHandle, handle, destAddress, cbSize, out count); 95Misc.ReadProcessMemory(_processHandle, handle, destAddress, cbSize, out count);
MS\Internal\AutomationProxies\SafeCoTaskMem.cs (3)
23return Marshal.PtrToStringAuto(handle); 29return Marshal.PtrToStringUni(handle, length); 34Marshal.FreeCoTaskMem(handle);
MS\Internal\AutomationProxies\SafeProcessHandle.cs (1)
44return Misc.CloseHandle(handle);
MS\Internal\AutomationProxies\SafeThemeHandle.cs (1)
30return !IsInvalid ? CloseThemeData(handle) == (IntPtr)NativeMethods.S_OK : true;
UIAutomationTypes (6)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsOther.cs (6)
239return UnsafeNativeMethods.DeleteObject(handle); 244return new HandleRef(obj, handle); 264return UnsafeNativeMethods.DestroyIcon(handle); 277return handle; 289return UnsafeNativeMethods.DestroyCursor( handle ); 561 return (LocalFree(base.handle) == IntPtr.Zero);
WindowsFormsIntegration (1)
MS\Win32\DCSafeHandle.cs (1)
14return UnsafeNativeMethods.DeleteDC(handle);