142 references to DangerousGetHandle
Infrastructure.Common (2)
CertificateManager.cs (2)
140using (X509Store store = new X509Store(keychain.DangerousGetHandle())) 194using (X509Store store = new X509Store(handle.DangerousGetHandle()))
Microsoft.AspNetCore.Cryptography.Internal (8)
SafeHandles\NCryptDescriptorHandle.cs (1)
32return new String((char*)ruleStringHandle.DangerousGetHandle());
SafeHandles\SafeLibraryHandle.cs (1)
75return new string((char*)messageHandle.DangerousGetHandle(), 0, numCharsOutput).Trim();
UnsafeBufferUtil.cs (6)
44BlockCopy((void*)from.DangerousGetHandle(), to, byteCount); 64BlockCopy(from, (void*)to.DangerousGetHandle(), byteCount); 93BlockCopyCore(from: (byte*)from.DangerousGetHandle(), to: (byte*)to.DangerousGetHandle(), byteCount: (uint)length.ToInt32()); 97BlockCopyCore(from: (byte*)from.DangerousGetHandle(), to: (byte*)to.DangerousGetHandle(), byteCount: (ulong)length.ToInt64());
Microsoft.AspNetCore.Cryptography.Internal.Tests (8)
SafeHandles\SecureLocalAllocHandleTests.cs (4)
20((char*)controlHandle.DangerousGetHandle())[i] = expected[i]; 27Assert.Equal(expected, new string((char*)duplicateHandle.DangerousGetHandle(), 0, expected.Length)); // contents the same data 28Assert.NotEqual(controlHandle.DangerousGetHandle(), duplicateHandle.DangerousGetHandle()); // shouldn't just point to the same memory location
UnsafeBufferUtilTests.cs (4)
49((char*)controlHandle.DangerousGetHandle())[i] = expected[i]; 57string actual = new string((char*)testHandle.DangerousGetHandle(), 0, expected.Length); 71((char*)controlHandle.DangerousGetHandle())[i] = expected[i]; 98string actual = new string((char*)testHandle.DangerousGetHandle(), 0, expected.Length);
Microsoft.AspNetCore.DataProtection (3)
Cng\DpapiSecretSerializerHelper.cs (3)
181UnsafeBufferUtil.BlockCopy(from: (void*)protectedData.DangerousGetHandle(), to: pbRetVal, byteCount: cbProtectedData); 307return new Secret((byte*)unencryptedPayloadHandle.DangerousGetHandle(), checked((int)cbUnencryptedPayload)); 313UnsafeBufferUtil.SecureZeroMemory((byte*)unencryptedPayloadHandle.DangerousGetHandle(), cbUnencryptedPayload);
Microsoft.AspNetCore.Server.HttpSys (5)
NativeInterop\UrlGroup.cs (3)
71RequestQueueHandle = (HANDLE)destination.Handle.DangerousGetHandle() 81RequestQueueHandle = (HANDLE)destination.Handle.DangerousGetHandle() 114RequestQueueHandle = (HANDLE)_requestQueue.Handle.DangerousGetHandle()
RequestProcessing\ResponseStreamAsyncResult.cs (2)
129_dataChunks[1].Anonymous.FromFileHandle.FileHandle = (HANDLE)_fileStream.SafeFileHandle.DangerousGetHandle(); 142_dataChunks[0].Anonymous.FromFileHandle.FileHandle = (HANDLE)_fileStream.SafeFileHandle.DangerousGetHandle();
Microsoft.CodeAnalysis.Workspaces (4)
Storage\SQLite\Interop\SafeSqliteBlobHandle.cs (1)
25SetHandle(wrapper.DangerousGetHandle());
Storage\SQLite\Interop\SafeSqliteHandle.cs (1)
24SetHandle(wrapper.DangerousGetHandle());
Storage\SQLite\Interop\SafeSqliteStatementHandle.cs (1)
25SetHandle(wrapper.DangerousGetHandle());
TemporaryStorage\TemporaryStorageService.MemoryMappedInfo.cs (1)
145(byte*)accessor.Target.SafeMemoryMappedViewHandle.DangerousGetHandle() + accessor.Target.PointerOffset,
PresentationCore (10)
MS\Internal\DpiUtil\DpiUtil+ProcessDpiAwarenessHelper.cs (1)
105return SafeNativeMethods.GetProcessDpiAwareness(new HandleRef(null, hProcess.DangerousGetHandle()));
System\Windows\InterOp\D3DImage.cs (2)
781data.pInteropDeviceBitmap = (ulong)_pInteropDeviceBitmap.DangerousGetHandle().ToPointer(); 798data.pSoftwareBitmap = (ulong)_softwareCopy.WicSourceHandle.DangerousGetHandle().ToPointer();
System\Windows\Media\ColorContext.cs (1)
371colorContextPtrs[i] = colorContextHandles[i].DangerousGetHandle();
System\Windows\Media\ColorTransformHelper.cs (2)
77handles[0] = sourceProfile.DangerousGetHandle(); 78handles[1] = destinationProfile.DangerousGetHandle();
System\Windows\Media\Imaging\BitmapEncoder.cs (2)
638IntPtr[] colorContextPtrs = new IntPtr[1] { colorContext.ColorContextHandle.DangerousGetHandle() }; 666colorContextPtrs[i] = colorContexts[i].ColorContextHandle.DangerousGetHandle();
System\Windows\Media\Imaging\BitmapSource.cs (1)
877_convertedDUCEPtr = new BitmapSourceSafeMILHandle(pCWICWrapperBitmap.DangerousGetHandle(), pIWICSource);
System\Windows\Media\Imaging\WriteableBitmap.cs (1)
1215command.SwDoubleBufferedBitmap = (UInt64) _pDoubleBufferedBitmap.DangerousGetHandle().ToPointer();
ReachFramework (7)
MS\Internal\Printing\Configuration\WinSpoolPrinterCapabilities.cs (5)
446IntPtr baseAddr = buffer.Handle.DangerousGetHandle(); 472IntPtr baseAddr = buffer.Handle.DangerousGetHandle(); 498IntPtr baseAddr = buffer.Handle.DangerousGetHandle(); 526IntPtr baseAddr = buffer.Handle.DangerousGetHandle(); 554IntPtr baseAddr = buffer.Handle.DangerousGetHandle();
PrintConfig\FallbackPTProvider.cs (2)
748IntPtr ptr = pPrinterBuffer.Handle.DangerousGetHandle(); 817IntPtr pDevMode = Marshal.ReadIntPtr(pPrinterBuffer.Handle.DangerousGetHandle());
Security.TransportSecurity.IntegrationTests (1)
Tcp\ClientCredentialTypeTests.OSX.cs (1)
143using (store = new X509Store(keychain.DangerousGetHandle()))
System.Console (1)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.Poll.cs (1)
40FileDescriptor = fd.DangerousGetHandle().ToInt32(),
System.Data.Odbc (25)
Common\System\Data\ProviderBase\DbBuffer.cs (22)
70IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 98IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 124IntPtr ptr = DangerousGetHandle(); 157IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 190IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 222IntPtr ptr = DangerousGetHandle(); 249IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 274IntPtr ptr = DangerousGetHandle(); 301IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 326IntPtr ptr = DangerousGetHandle(); 352IntPtr ptr = DangerousGetHandle(); 396IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 420IntPtr ptr = DangerousGetHandle(); 446IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 472IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 501IntPtr ptr = DangerousGetHandle(); 527IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 551IntPtr ptr = DangerousGetHandle(); 577IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset); 601IntPtr ptr = DangerousGetHandle(); 625IntPtr ptr = DangerousGetHandle(); 650IntPtr ptr = DangerousGetHandle();
System\Data\Odbc\OdbcDataReader.cs (2)
2394buffer.DangerousGetHandle()); // SQLLEN * StrLen_or_Ind 2444buffer.DangerousGetHandle());
System\Data\Odbc\OdbcUtils.cs (1)
329IntPtr ptr = ADP.IntPtrOffset(DangerousGetHandle(), offset);
System.Diagnostics.Process (2)
Microsoft\Win32\SafeHandles\SafeProcessHandle.Unix.cs (1)
31this(handle.DangerousGetHandle(), ownsHandle: true)
System\Diagnostics\Process.cs (1)
130public IntPtr Handle => SafeHandle.DangerousGetHandle();
System.IO.FileSystem.Watcher (1)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.Poll.cs (1)
40FileDescriptor = fd.DangerousGetHandle().ToInt32(),
System.IO.IsolatedStorage (1)
System\IO\IsolatedStorage\IsolatedStorageFileStream.cs (1)
68: base(new SafeFileHandle(initializationData.NestedStream.SafeFileHandle.DangerousGetHandle(), ownsHandle: false), access, bufferSize)
System.IO.MemoryMappedFiles (1)
Microsoft\Win32\SafeMemoryMappedFileHandle.Unix.cs (1)
60handlePtr = fileHandle.DangerousGetHandle();
System.IO.Pipes (2)
Microsoft\Win32\SafeHandles\SafePipeHandle.Unix.cs (1)
32base.SetHandle(_pipeSocketHandle!.DangerousGetHandle());
System\IO\Pipes\AnonymousPipeServerStream.cs (1)
90return _clientHandle.DangerousGetHandle().ToString();
System.IO.Ports (1)
src\libraries\Common\src\Interop\Unix\System.IO.Ports.Native\Interop.Serial.cs (1)
75FileDescriptor = fd.DangerousGetHandle().ToInt32(),
System.Net.Http (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Net.HttpListener (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Net.Mail (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Net.NameResolution (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Net.Primitives (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Net.Quic (3)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System\Net\Quic\Internal\MsQuicSafeHandle.cs (2)
30public QUIC_HANDLE* QuicHandle => (QUIC_HANDLE*)DangerousGetHandle(); 73public override string ToString() => _traceId ??= $"[{s_typeName[(int)_type]}][0x{DangerousGetHandle():X11}]";
System.Net.Requests (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Net.Security (3)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (1)
434IntPtr cbtData = (nint)_channelBinding.DangerousGetHandle() + appDataOffset;
System\Net\NegotiateAuthenticationPal.Unix.cs (1)
594IntPtr cbtAppData = channelBinding.DangerousGetHandle() + appDataOffset;
System.Net.Sockets (6)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.Poll.cs (1)
40FileDescriptor = fd.DangerousGetHandle().ToInt32(),
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System\Net\Sockets\Socket.cs (1)
391public IntPtr Handle => SafeHandle.DangerousGetHandle();
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
1297IntPtr handle = _socket.DangerousGetHandle();
System\Net\Sockets\SocketPal.Unix.cs (2)
1910buffer[i] = (int)socket.InternalSafeHandle.DangerousGetHandle(); 2012int fd = (int)socket.InternalSafeHandle.DangerousGetHandle();
System.Net.WebSockets (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (1)
149return $"{handle.GetType().Name}:{handle.GetHashCode()}(0x{handle.DangerousGetHandle():X})";
System.Private.CoreLib (16)
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\FileStreamStrategy.cs (1)
18internal IntPtr Handle => SafeFileHandle.DangerousGetHandle();
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SafeHandleMarshaller.cs (2)
39public IntPtr ToUnmanaged() => _handle!.DangerousGetHandle(); 87_originalHandleValue = handle.DangerousGetHandle();
src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (1)
290return new Span<char>((byte*)buffer.DangerousGetHandle(), (int)(buffer.ByteLength / 2));
src\libraries\System.Private.CoreLib\src\System\Threading\Lock.cs (1)
664return _waitEvent.SafeWaitHandle.DangerousGetHandle();
src\libraries\System.Private.CoreLib\src\System\Threading\RegisteredWaitHandle.Portable.cs (2)
113UserUnregisterWaitHandleValue = UserUnregisterWaitHandle?.DangerousGetHandle() ?? IntPtr.Zero; 175Debug.Assert(handleValue == handle!.DangerousGetHandle());
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (8)
48get => _waitHandle == null ? InvalidHandle : _waitHandle.DangerousGetHandle(); 140waitResult = context.Wait([waitHandle.DangerousGetHandle()], false, millisecondsTimeout); 183waitResult = WaitOneCore(waitHandle.DangerousGetHandle(), millisecondsTimeout, useTrivialWaits); 259unsafeWaitHandles[i] = safeWaitHandle.DangerousGetHandle(); 381unsafeWaitHandles[i] = safeWaitHandles[i].DangerousGetHandle(); 391unsafeWaitHandles[i] = safeWaitHandles[i].DangerousGetHandle(); 471safeWaitHandleToSignal.DangerousGetHandle(), 472safeWaitHandleToWaitOn.DangerousGetHandle(),
src\System\StubHelpers.cs (1)
1432return pHandle.DangerousGetHandle();
System.Reflection.Metadata (1)
System\Reflection\Metadata\MetadataReader.netstandard.cs (1)
85peReader = new PEReader((byte*)safeBuffer.DangerousGetHandle(), (int)safeBuffer.ByteLength);
System.Security.Cryptography (8)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.cs (2)
146IntPtr handle = pkey.DangerousGetHandle(); 197IntPtr handle = pkey.DangerousGetHandle();
src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeEcKeyHandle.Unix.cs (1)
49internal SafeEcKeyHandle DuplicateHandle() => DuplicateHandle(DangerousGetHandle());
System\Security\Cryptography\X509Certificates\OpenSslX509CertificateReader.cs (2)
257get { return _cert == null ? IntPtr.Zero : _cert.DangerousGetHandle(); } 537return Interop.Crypto.RentAsn1StringBytes(data.DangerousGetHandle());
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (1)
228IntPtr currentHandle = currentCert.DangerousGetHandle();
System\Security\Cryptography\X509Certificates\X509Chain.cs (1)
73return handle.DangerousGetHandle();
System\Security\Cryptography\X509Certificates\X509Store.cs (1)
96return _storePal.SafeHandle.DangerousGetHandle();
System.Text.Encoding.CodePages (3)
System\Text\BaseCodePageEncoding.cs (2)
375return (byte*)safeNativeMemoryHandle.DangerousGetHandle(); 408if (safeNativeMemoryHandle != null && safeNativeMemoryHandle.DangerousGetHandle() == IntPtr.Zero)
System\Text\GB18030Encoding.cs (1)
133byte* pNativeMemory = (byte*)safeNativeMemoryHandle!.DangerousGetHandle();
System.Windows.Forms.Primitives (1)
Windows\Win32\Pinvoke.RegLoadMUIString.cs (1)
23(System.Registry.HKEY)key.Handle.DangerousGetHandle(),
UIAutomationClient (11)
MS\Internal\Automation\Misc.cs (1)
484IntPtr[] handles = { handle.DangerousGetHandle() };
MS\Internal\Automation\UiaCoreApi.cs (7)
361UiaMiniCacheRequest miniCR = new UiaMiniCacheRequest(request, request._condition._safeHandle.DangerousGetHandle()); 373UiaMiniCacheRequest miniCR = new UiaMiniCacheRequest(request, request._condition._safeHandle.DangerousGetHandle()); 385UiaMiniCacheRequest miniCR = new UiaMiniCacheRequest(request, request._condition._safeHandle.DangerousGetHandle()); 427UiaMiniCacheRequest miniCR = new UiaMiniCacheRequest(request, request._condition._safeHandle.DangerousGetHandle()); 443UiaMiniCacheRequest miniCR = new UiaMiniCacheRequest(request, request._condition._safeHandle.DangerousGetHandle()); 444findParams.pFindCondition = findCondition._safeHandle.DangerousGetHandle(); 585UiaMiniCacheRequest miniCR = new UiaMiniCacheRequest(request, request._condition._safeHandle.DangerousGetHandle());
System\Windows\Automation\AndCondition.cs (1)
44SetMarshalData(new UiaCoreApi.UiaAndOrCondition(UiaCoreApi.ConditionType.And, _conditionArrayHandle.DangerousGetHandle(), _conditions.Length));
System\Windows\Automation\NotCondition.cs (1)
39SetMarshalData(new UiaCoreApi.UiaNotCondition(_condition._safeHandle.DangerousGetHandle()));
System\Windows\Automation\OrCondition.cs (1)
44SetMarshalData(new UiaCoreApi.UiaAndOrCondition(UiaCoreApi.ConditionType.Or, _conditionArrayHandle.DangerousGetHandle(), _conditions.Length));
UIAutomationClientSideProviders (1)
MS\Internal\AutomationProxies\Misc.cs (1)
992IntPtr[] handles = { handle.DangerousGetHandle() };