12 writes to hGlobal
System.Private.Windows.Core (11)
System\Private\Windows\Ole\Composition.ManagedToNativeAdapter.cs (5)
78pmedium->hGlobal = PInvokeCore.GlobalAlloc(GLOBAL_ALLOC_FLAGS.GMEM_MOVEABLE | GLOBAL_ALLOC_FLAGS.GMEM_ZEROINIT, 1); 89pmedium->hGlobal = HGLOBAL.Null; 144pmedium->hGlobal = HGLOBAL.Null; 274=> dataStream.SaveStreamToHGLOBAL(ref medium.hGlobal), 290=> SaveObjectToHGLOBAL(ref medium.hGlobal, data, format),
System\Private\Windows\Ole\DragDropFormat.cs (4)
69mediumDestination.hGlobal = (HGLOBAL)(nint)PInvokeCore.OleDuplicateData( 85mediumDestination.hGlobal = mediumSource.hGlobal; 92mediumDestination.hGlobal = HGLOBAL.Null; 121_medium.hGlobal = HGLOBAL.Null;
System\Private\Windows\Ole\DragDropHelper.cs (2)
203hGlobal = PInvokeCore.GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (nuint)sizeof(BOOL)) 361hGlobal = PInvokeCore.GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (nuint)sizeof(DROPDESCRIPTION))
System.Private.Windows.Core.Tests (1)
System\Private\Windows\Ole\HGlobalNativeDataObject.cs (1)
63result = _stream.SaveStreamToHGLOBAL(ref pmedium->hGlobal);
52 references to hGlobal
PresentationCore (2)
System\Windows\Ole\WpfOleServices.cs (2)
123(HBITMAP)(nint)medium.hGlobal, 137object metafile = SystemDrawingHelper.GetMetafileFromHemf((HENHMETAFILE)(nint)medium.hGlobal);
System.Private.Windows.Core (28)
System\Private\Windows\Ole\Composition.ManagedToNativeAdapter.cs (10)
80if (pmedium->hGlobal.IsNull) 88PInvokeCore.GlobalFree(pmedium->hGlobal); 141catch (Exception) when (!pmedium->hGlobal.IsNull) 143PInvokeCore.GlobalFree(pmedium->hGlobal); 276=> SaveDbcsToHGLOBAL(medium.hGlobal, data.ToString() ?? ""), 278=> SaveUtf8ToHGLOBAL(medium.hGlobal, data.ToString() ?? ""), 280=> SaveUtf16ToHGLOBAL(medium.hGlobal, data.ToString() ?? ""), 282=> SaveFileListToHGLOBAL(medium.hGlobal, (string[])data), 284=> SaveDbcsToHGLOBAL(medium.hGlobal, ((string[])data)[0]), 286=> SaveUtf16ToHGLOBAL(medium.hGlobal, ((string[])data)[0]),
System\Private\Windows\Ole\Composition.NativeToManagedAdapter.cs (4)
322if (medium.tymed == Com.TYMED.TYMED_HGLOBAL && !medium.hGlobal.IsNull && hr != HRESULT.COR_E_SERIALIZATION) 324result = TryGetDataFromHGLOBAL(medium.hGlobal, in request, out data); 369if (medium.tymed != Com.TYMED.TYMED_ISTREAM || medium.hGlobal.IsNull) 374using ComScope<Com.IStream> pStream = new((Com.IStream*)medium.hGlobal);
System\Private\Windows\Ole\DragDropFormat.cs (4)
70(HANDLE)(nint)mediumSource.hGlobal, 75if (mediumDestination.hGlobal.IsNull) 85mediumDestination.hGlobal = mediumSource.hGlobal; 86Marshal.AddRef(mediumSource.hGlobal);
System\Private\Windows\Ole\DragDropHelper.cs (10)
134void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 139PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 206if (medium.hGlobal.IsNull) 211void* basePtr = PInvokeCore.GlobalLock(medium.hGlobal); 214PInvokeCore.GlobalFree(medium.hGlobal); 219PInvokeCore.GlobalUnlock(medium.hGlobal); 364if (medium.hGlobal.IsNull) 369void* basePtr = PInvokeCore.GlobalLock(medium.hGlobal); 372PInvokeCore.GlobalFree(medium.hGlobal); 380PInvokeCore.GlobalUnlock(medium.hGlobal);
System.Windows.Forms (2)
System\Windows\Forms\OLE\WinFormsOleServices.cs (2)
108&& !medium.hGlobal.IsNull 109&& Image.FromHbitmap(medium.hGlobal) is Bitmap clipboardBitmap)
System.Windows.Forms.Tests (20)
System\Windows\Forms\DataObjectTests.cs (1)
2928medium.hGlobal.IsNull.Should().BeTrue();
System\Windows\Forms\DragDropFormatTests.cs (6)
76int handleSize = (int)PInvokeCore.GlobalSize(dragDropFormat.Medium.hGlobal); 80Assert.True(dragDropFormat.Medium.hGlobal.IsNull); 109Assert.NotEqual(medium.unionmember, data.hGlobal); 117Assert.Equal(medium.unionmember, (nint)data.hGlobal); 146(HANDLE)(nint)dragDropFormat.Medium.hGlobal, 149_ => dragDropFormat.Medium.hGlobal,
System\Windows\Forms\DragDropHelperTests.cs (13)
121void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 126PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 148void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 153PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 217void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 222PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 285Assert.Equal(nint.Zero, (nint)dragDropFormat.Medium.hGlobal); 298void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 303PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 325void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 330PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 356void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 358PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal);