13 writes to hGlobal
System.Private.Windows.Core (11)
System\Private\Windows\Ole\Composition.ManagedToNativeAdapter.cs (5)
83pmedium->hGlobal = PInvokeCore.GlobalAlloc(GLOBAL_ALLOC_FLAGS.GMEM_MOVEABLE | GLOBAL_ALLOC_FLAGS.GMEM_ZEROINIT, 1); 94pmedium->hGlobal = HGLOBAL.Null; 149pmedium->hGlobal = HGLOBAL.Null; 283=> dataStream.SaveStreamToHGLOBAL(ref medium.hGlobal), 299=> SaveObjectToHGLOBAL(ref medium.hGlobal, data, format),
System\Private\Windows\Ole\DragDropFormat.cs (4)
68mediumDestination.hGlobal = (HGLOBAL)(nint)PInvokeCore.OleDuplicateData( 84mediumDestination.hGlobal = mediumSource.hGlobal; 91mediumDestination.hGlobal = HGLOBAL.Null; 120_medium.hGlobal = HGLOBAL.Null;
System\Private\Windows\Ole\DragDropHelper.cs (2)
211hGlobal = PInvokeCore.GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (nuint)sizeof(BOOL)) 369hGlobal = PInvokeCore.GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, (nuint)sizeof(DROPDESCRIPTION))
System.Private.Windows.Core.Tests (2)
System\Private\Windows\Ole\HGlobalNativeDataObject.cs (1)
63result = _stream.SaveStreamToHGLOBAL(ref pmedium->hGlobal);
System\Private\Windows\Ole\IStreamNativeDataObject.cs (1)
75pmedium->hGlobal = (HGLOBAL)(nint)ComHelpers.GetComPointer<IStream>(comStream);
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)
85if (pmedium->hGlobal.IsNull) 93PInvokeCore.GlobalFree(pmedium->hGlobal); 146catch (Exception) when (!pmedium->hGlobal.IsNull) 148PInvokeCore.GlobalFree(pmedium->hGlobal); 285=> SaveDbcsToHGLOBAL(medium.hGlobal, data.ToString() ?? ""), 287=> SaveUtf8ToHGLOBAL(medium.hGlobal, data.ToString() ?? ""), 289=> SaveUtf16ToHGLOBAL(medium.hGlobal, data.ToString() ?? ""), 291=> SaveFileListToHGLOBAL(medium.hGlobal, (string[])data), 293=> SaveDbcsToHGLOBAL(medium.hGlobal, ((string[])data)[0]), 295=> SaveUtf16ToHGLOBAL(medium.hGlobal, ((string[])data)[0]),
System\Private\Windows\Ole\Composition.NativeToManagedAdapter.cs (4)
399if (medium.tymed == Com.TYMED.TYMED_HGLOBAL && !medium.hGlobal.IsNull) 401result = TryGetDataFromHGLOBAL(medium.hGlobal, in request, out data); 446if (medium.tymed != Com.TYMED.TYMED_ISTREAM || medium.hGlobal.IsNull) 452Com.IStream* pStream = (Com.IStream*)medium.hGlobal;
System\Private\Windows\Ole\DragDropFormat.cs (4)
69(HANDLE)(nint)mediumSource.hGlobal, 74if (mediumDestination.hGlobal.IsNull) 84mediumDestination.hGlobal = mediumSource.hGlobal; 85Marshal.AddRef(mediumSource.hGlobal);
System\Private\Windows\Ole\DragDropHelper.cs (10)
142void* basePtr = PInvokeCore.GlobalLock(dragDropFormat.Medium.hGlobal); 147PInvokeCore.GlobalUnlock(dragDropFormat.Medium.hGlobal); 214if (medium.hGlobal.IsNull) 219void* basePtr = PInvokeCore.GlobalLock(medium.hGlobal); 222PInvokeCore.GlobalFree(medium.hGlobal); 227PInvokeCore.GlobalUnlock(medium.hGlobal); 372if (medium.hGlobal.IsNull) 377void* basePtr = PInvokeCore.GlobalLock(medium.hGlobal); 380PInvokeCore.GlobalFree(medium.hGlobal); 388PInvokeCore.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);