226 references to IUnknown
System.Private.Windows.Core (70)
Windows\Win32\Foundation\HRESULT.cs (1)
89
/// aren't actually <see cref="
IUnknown
"/> or <see cref="IDispatch"/> object pointers.
Windows\Win32\System\Com\AgileComPointer.cs (7)
49
/// <see cref="
IUnknown
.Release"/> after the GIT adds a ref to the interface.
88
uint count = ((
IUnknown
*)@interface)->Release();
106
using var currentUnknown = GetInterface<
IUnknown
>();
107
using var otherUnknown = other.GetInterface<
IUnknown
>();
114
using var currentUnknown = GetInterface<
IUnknown
>();
115
using ComScope<
IUnknown
> otherUnknown = ComScope<
IUnknown
>.QueryFrom(other);
Windows\Win32\System\Com\ComHelpers.cs (29)
88
IUnknown
* ccw = null;
92
ccw = (
IUnknown
*)WinFormsComWrappers.Instance.GetOrCreateComInterfaceForObject(@object, CreateComInterfaceFlags.None);
97
ccw = (
IUnknown
*)unknown;
105
ccw = (
IUnknown
*)Marshal.GetIUnknownForObject(@object);
119
if (typeof(T) == typeof(
IUnknown
))
136
IUnknown
* unknown,
156
/// <inheritdoc cref="TryGetObjectForIUnknown{TObject}(
IUnknown
*, bool, out TObject)"/>
163
/// <inheritdoc cref="TryGetObjectForIUnknown{TObject}(
IUnknown
*, bool, out TObject)"/>
176
IUnknown
* unknown = (
IUnknown
*)comPointer;
177
if (typeof(TInterface) == typeof(
IUnknown
))
182
HRESULT hr = unknown->QueryInterface(IID.Get<
IUnknown
>(), (void**)&unknown);
193
/// <inheritdoc cref="TryGetObjectForIUnknown{TObject}(
IUnknown
*, bool, out TObject)"/>
195
IUnknown
* unknown,
206
IUnknown
* unknown,
248
using ComScope<
IUnknown
> unknown = new(null);
249
((
IUnknown
*)comPointer)->QueryInterface(IID.Get<
IUnknown
>(), unknown).ThrowOnFailure();
257
using ComScope<
IUnknown
> ccw = new((
IUnknown
*)(void*)Marshal.GetIUnknownForObject(@object));
261
/// <inheritdoc cref="GetObjectForIUnknown(
IUnknown
*)"/>
270
IUnknown
* unknown = (
IUnknown
*)comPointer;
272
if (typeof(TInterface) == typeof(
IUnknown
))
277
unknown->QueryInterface(IID.Get<
IUnknown
>(), (void**)&unknown).ThrowOnFailure();
281
/// <inheritdoc cref="GetObjectForIUnknown(
IUnknown
*)"/>
289
internal static object GetObjectForIUnknown(
IUnknown
* unknown)
314
/// <see cref="
IUnknown
"/> vtable population hook for CsWin32's generated <see cref="IVTable"/> implementation.
316
static partial void PopulateIUnknownImpl<TComInterface>(
IUnknown
.Vtbl* vtable)
Windows\Win32\System\Com\ComScope.cs (11)
11
/// to ensure <see cref="
IUnknown
.Release"/> is called when going out of scope with the using.
28
/// <see cref="
IUnknown
.Interface"/> or some other interface tag to enforce that this is being used around
36
public
IUnknown
* AsUnknown => (
IUnknown
*)_value;
63
hr = ((
IUnknown
*)Value)->QueryInterface(IID.Get<TTo>(), scope);
73
((
IUnknown
*)Value)->QueryInterface(IID.Get<TTo>(), scope).ThrowOnFailure();
83
hr = from is null ? HRESULT.E_POINTER : ((
IUnknown
*)from)->QueryInterface(IID.Get<T>(), scope);
98
((
IUnknown
*)from)->QueryInterface(IID.Get<T>(), scope).ThrowOnFailure();
113
IUnknown
* unknown;
127
IUnknown
* unknown = (
IUnknown
*)_value;
Windows\Win32\System\Com\GlobalInterfaceTable.cs (1)
41
(
IUnknown
*)@interface,
Windows\Win32\System\Com\GlobalInterfaceTable.UnknownStrategy.cs (1)
21
_cookie = RegisterInterface((
IUnknown
*)unknown);
Windows\Win32\System\Com\IUnknown.CCW.cs (7)
12
/// Manual COM Callable Wrapper for <see cref="
IUnknown
"/>.
21
/// our own <see cref="
IUnknown
.QueryInterface(Guid*, void**)"/> handling for debugging and testing purposes.
43
public static unsafe
IUnknown
* Create(Interface @object) =>
44
(
IUnknown
*)Lifetime<Vtbl, Interface>.Allocate(@object, s_vtable);
47
private static unsafe HRESULT QueryInterface(
IUnknown
* @this, Guid* iid, void* ppObject)
69
private static unsafe uint AddRef(
IUnknown
* @this) => Lifetime<Vtbl, Interface>.AddRef(@this);
72
private static unsafe uint Release(
IUnknown
* @this) => Lifetime<Vtbl, Interface>.Release(@this);
Windows\Win32\System\Com\STGMEDIUM.cs (2)
15
IUnknown
* pUnkForRelease = ComHelpers.TryGetComPointer<
IUnknown
>(comTypeStg.pUnkForRelease, out _);
Windows\Win32\System\Com\WinFormsComWrappers.cs (4)
17
internal static void PopulateIUnknownVTable(
IUnknown
.Vtbl* unknown)
20
unknown->QueryInterface_1 = (delegate* unmanaged[Stdcall]<
IUnknown
*, Guid*, void**, HRESULT>)fpQueryInterface;
21
unknown->AddRef_2 = (delegate* unmanaged[Stdcall]<
IUnknown
*, uint>)fpAddRef;
22
unknown->Release_3 = (delegate* unmanaged[Stdcall]<
IUnknown
*, uint>)fpRelease;
Windows\Win32\System\Variant\VARIANT.cs (6)
164
IUnknown
* pInterface = *(
IUnknown
**)data;
393
result[i] = data[i] == IntPtr.Zero ? null : ComHelpers.GetObjectForIUnknown((
IUnknown
*)data[i]);
603
SetValue(array, ComHelpers.GetObjectForIUnknown((
IUnknown
*)data), indices, lowerBounds);
949
public static explicit operator VARIANT(
IUnknown
* value)
957
public static explicit operator
IUnknown
*(VARIANT value)
Windows\Win32\UI\Controls\Dialogs\PRINTDLGEXW.cs (1)
295
public unsafe
IUnknown
* lpCallback;
System.Private.Windows.Core.Tests (1)
System\Private\Windows\Ole\DataObjectProxy.cs (1)
102
if (iid->Equals(IDataObject.IID_Guid) || iid->Equals(
IUnknown
.IID_Guid))
System.Windows.Forms (42)
System\Windows\Forms\Accessibility\AccessibleObject.cs (3)
990
HRESULT IRawElementProviderSimple.Interface.GetPatternProvider(UIA_PATTERN_ID patternId,
IUnknown
** pRetVal)
1001
*pRetVal = ComHelpers.GetComPointer<
IUnknown
>(this);
3357
HRESULT IDispatchEx.Interface.GetNameSpaceParent(
IUnknown
** ppunk)
System\Windows\Forms\ActiveX\AxHost.AxContainer.cs (1)
72
*result = (VARIANT)ComHelpers.GetComPointer<
IUnknown
>(extender);
System\Windows\Forms\ActiveX\AxHost.AxContainer.ExtenderProxy.cs (4)
189
public
IUnknown
* Parent
197
return extender is null ? null : ComHelpers.GetComPointer<
IUnknown
>(extender);
265
public
IUnknown
* Container
270
return container is null ? null : ComHelpers.GetComPointer<
IUnknown
>(container);
System\Windows\Forms\ActiveX\AxHost.ConnectionPointCookie.cs (2)
104
IUnknown
* ccw = ComHelpers.TryGetComPointer<
IUnknown
>(sink, out HRESULT hr);
System\Windows\Forms\ActiveX\AxHost.cs (8)
2259
using ComScope<
IUnknown
> unknown = new(null);
2262
(
IUnknown
*)null,
2264
IID.Get<
IUnknown
>(),
2286
using ComScope<
IUnknown
> unknown = new(null);
2287
hr = factory.Value->CreateInstanceLic(null, null, IID.Get<
IUnknown
>(), new BSTR(license), unknown);
2959
using ComScope<
IUnknown
> unknown = ComHelpers.TryGetComScope<
IUnknown
>(_instance, out HRESULT hr);
3027
using var unknown = ComHelpers.GetComScope<
IUnknown
>(_instance);
System\Windows\Forms\ActiveX\AxHost.EnumUnknown.cs (2)
28
unsafe HRESULT IEnumUnknown.Interface.Next(uint celt,
IUnknown
** rgelt, uint* pceltFetched)
56
*rgelt = ComHelpers.GetComPointer<
IUnknown
>(_array[_location]);
System\Windows\Forms\ActiveX\Control.ActiveXFontMarshaler.cs (1)
60
using var nativeFont = ComScope<IFont>.TryQueryFrom((
IUnknown
*)pObj, out HRESULT hr);
System\Windows\Forms\Application.ComponentManager.cs (2)
327
IUnknown
* punkOuter,
328
IUnknown
* punkServProv,
System\Windows\Forms\Application.ComponentThreadContext.cs (1)
110
using ComScope<
IUnknown
> serviceHandle = new(null);
System\Windows\Forms\ComponentModel\COM2Interop\COM2ComponentEditor.cs (2)
62
using var unknown = ComHelpers.GetComScope<
IUnknown
>(obj);
96
using var unknown = ComHelpers.GetComScope<
IUnknown
>(obj);
System\Windows\Forms\ComponentModel\COM2Interop\COM2FontConverter.cs (2)
31
using var iFont = ComScope<IFont>.TryQueryFrom((
IUnknown
*)nativeValue, out HRESULT hr);
86
using var font = ComScope<IFont>.TryQueryFrom((
IUnknown
*)nativeValue, out HRESULT hr);
System\Windows\Forms\ComponentModel\COM2Interop\COM2PictureConverter.cs (3)
41
using var picture = ComScope<IPicture>.TryQueryFrom((
IUnknown
*)nativeValue, out HRESULT hr);
124
IUnknown
* unknown;
125
picture.Value->QueryInterface(IID.Get<
IUnknown
>(), (void**)&unknown).ThrowOnFailure();
System\Windows\Forms\ComponentModel\COM2Interop\COM2PropertyPageUITypeConverter.cs (2)
73
addresses[i] = (nint)ComHelpers.GetComPointer<
IUnknown
>(objects[i]);
84
(
IUnknown
**)pObjAddrs,
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxItemAccessibleObject.cs (1)
121
UIA_PROPERTY_ID.UIA_SelectionItemSelectionContainerPropertyId => (VARIANT)ComHelpers.GetComPointer<
IUnknown
>(_owningComboBox.ChildListAccessibleObject),
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.DataGridViewCellAccessibleObject.cs (1)
688
=> (VARIANT)ComHelpers.GetComPointer<
IUnknown
>(_owner?.DataGridView?.AccessibilityObject),
System\Windows\Forms\Controls\WebBrowser\HtmlDocument.cs (1)
39
using var scope = _htmlDocument2.GetInterface<
IUnknown
>();
System\Windows\Forms\Controls\WebBrowser\HtmlElement.cs (1)
53
using var scope = _htmlElement.GetInterface<
IUnknown
>();
System\Windows\Forms\Controls\WebBrowser\HtmlWindow.cs (1)
33
using var scope = _htmlWindow2.GetInterface<
IUnknown
>();
System\Windows\Forms\Controls\WebBrowser\WebBrowserBase.cs (2)
845
IID.GetRef<
IUnknown
>(),
850
_activeXInstance = ComHelpers.GetObjectForIUnknown((
IUnknown
*)unknown);
System\Windows\Forms\OLE\DropTarget.cs (1)
52
using var unknown = ComScope<
IUnknown
>.QueryFrom(nativeDataObject);
System\Windows\Forms\StringSource.cs (1)
49
(
IUnknown
*)ComHelpers.GetComPointer<IEnumString>(this),
System.Windows.Forms.Interop.Tests (2)
PropertyGridTests.cs (2)
131
out
IUnknown
* result);
142
out
IUnknown
* result);
System.Windows.Forms.Primitives (52)
Interop\UiaCore\Interop.StubFragmentRoot.cs (1)
112
HRESULT IRawElementProviderSimple.Interface.GetPatternProvider(UIA_PATTERN_ID patternId,
IUnknown
** pRetVal)
Microsoft\Office\IMsoComponent.cs (3)
124
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
131
/// <inheritdoc cref="
IUnknown
.AddRef"/>
138
/// <inheritdoc cref="
IUnknown
.Release"/>
Microsoft\Office\IMsoComponentManager.cs (11)
36
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
43
/// <inheritdoc cref="
IUnknown
.AddRef"/>
50
/// <inheritdoc cref="
IUnknown
.Release"/>
163
/// <inheritdoc cref="Interface.FCreateSubComponentManager(
IUnknown
*,
IUnknown
*, Guid*, void**)"/>
164
public BOOL FCreateSubComponentManager(
IUnknown
* punkOuter,
IUnknown
* punkServProv, Guid* riid, void** ppvObj)
167
return ((delegate* unmanaged[Stdcall]<IMsoComponentManager*,
IUnknown
*,
IUnknown
*, Guid*, void**, BOOL>)_lpVtbl[15])
494
IUnknown
* punkOuter,
495
IUnknown
* punkServProv,
Microsoft\Office\IMsoComponentManager.NativeAdapter.cs (2)
105
BOOL Interface.FCreateSubComponentManager(
IUnknown
* punkOuter,
IUnknown
* punkServProv, Guid* riid, void** ppvObj)
Microsoft\VisualStudio\Shell\ICategorizeProperties.cs (3)
34
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
41
/// <inheritdoc cref="
IUnknown
.AddRef"/>
48
/// <inheritdoc cref="
IUnknown
.Release"/>
Microsoft\VisualStudio\Shell\IProvidePropertyBuilder.cs (3)
34
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
41
/// <inheritdoc cref="
IUnknown
.AddRef"/>
48
/// <inheritdoc cref="
IUnknown
.Release"/>
Microsoft\VisualStudio\Shell\IVSMDPerPropertyBrowsing.cs (3)
35
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
42
/// <inheritdoc cref="
IUnknown
.AddRef"/>
49
/// <inheritdoc cref="
IUnknown
.Release"/>
Microsoft\VisualStudio\Shell\IVsPerPropertyBrowsing.cs (3)
34
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
41
/// <inheritdoc cref="
IUnknown
.AddRef"/>
48
/// <inheritdoc cref="
IUnknown
.Release"/>
System\DisposeHelper.cs (2)
30
IUnknown
* localComPointer = (
IUnknown
*)comPointer;
System\Windows\Forms\AccessibilityExtensions.cs (2)
11
/// <inheritdoc cref="PInvoke.LresultFromObject(Guid*, WPARAM,
IUnknown
*)"/>
16
using var unknown = ComHelpers.TryGetComScope<
IUnknown
>(accessible, out _);
System\Windows\Forms\Automation\UiaTextRange.cs (4)
140
*pRetVal = ComHelpers.TryGetObjectForIUnknown((
IUnknown
*)range, out UiaTextRange? editRange) && editRange.Start == Start && editRange.End == End;
156
if (!ComHelpers.TryGetObjectForIUnknown((
IUnknown
*)targetRange, out UiaTextRange? editRange))
560
if (!ComHelpers.TryGetObjectForIUnknown((
IUnknown
*)targetRange, out UiaTextRange? textRange))
915
IUnknown
* unknown;
System\Windows\Forms\IExtender.cs (9)
31
/// <inheritdoc cref="
IUnknown
.QueryInterface(Guid*, void**)"/>
38
/// <inheritdoc cref="
IUnknown
.AddRef()"/>
45
/// <inheritdoc cref="
IUnknown
.Release()"/>
75
internal delegate* unmanaged[Stdcall]<IExtender*,
IUnknown
**, HRESULT> get_Parent_21;
77
internal delegate* unmanaged[Stdcall]<IExtender*,
IUnknown
**, HRESULT> get_Container_23;
197
private static HRESULT get_Parent(IExtender* @this,
IUnknown
** value)
205
private static HRESULT get_Container(IExtender* @this,
IUnknown
** value)
235
IUnknown
* Parent { get; }
239
IUnknown
* Container { get; }
Windows\Win32\System\Com\ComSafeArrayScope.cs (2)
54
using ComScope<
IUnknown
> unknown = new((
IUnknown
*)_value[i]);
Windows\Win32\System\Com\StandardDispatch.cs (1)
240
HRESULT IDispatchEx.Interface.GetNameSpaceParent(
IUnknown
** ppunk)
Windows\Win32\System\Com\UnknownDispatch.cs (3)
7
/// Base <see cref="IDispatch"/> class for <see cref="
IUnknown
"/>.
9
internal abstract unsafe class UnknownDispatch : StandardDispatch<
IUnknown
>
15
private static ITypeInfo* TypeInfo { get; } = ComHelpers.GetRegisteredTypeInfo(s_stdole, 2, 0,
IUnknown
.IID_Guid);
System.Windows.Forms.Primitives.Tests (33)
Interop\Oleaut32\VARIANTTests.cs (24)
321
using VARIANT variant = Create((VARENUM)vt, (
IUnknown
*)data);
329
using VARIANT variant = Create((VARENUM)vt | VT_BYREF, (
IUnknown
*)&data);
414
using VARIANT variant = Create(VT_I8, (
IUnknown
*)data);
437
using VARIANT variant = Create(VT_I8 | VT_BYREF, (
IUnknown
*)&data);
463
using VARIANT variant = Create(VT_UI8, (
IUnknown
*)data);
481
using VARIANT variant = Create(VT_UI8 | VT_BYREF, (
IUnknown
*)&data);
503
using VARIANT variant = Create(VT_CY, (
IUnknown
*)data);
522
using VARIANT variant = Create(VT_CY | VT_BYREF, (
IUnknown
*)&data);
541
using VARIANT variant = Create(VT_R4, (
IUnknown
*)data);
584
using VARIANT variant = Create(VT_R8, (
IUnknown
*)data);
600
using VARIANT variant = Create(VT_R8 | VT_BYREF, (
IUnknown
*)&data);
614
using VARIANT variant = Create(VT_BYREF | VT_NULL, (
IUnknown
*)data);
622
using VARIANT variant = Create(VT_BYREF | VT_NULL, (
IUnknown
*)&data);
643
using VARIANT variant = Create(VT_EMPTY, (
IUnknown
*)data);
651
using VARIANT variant = Create(VT_BYREF | VT_EMPTY, (
IUnknown
*)&data);
704
using VARIANT variant = Create(VT_HRESULT, (
IUnknown
*)data);
712
using VARIANT variant = Create(VT_HRESULT | VT_BYREF, (
IUnknown
*)&data);
860
using VARIANT variant = Create(VT_LPWSTR, (
IUnknown
*)(void*)Marshal.StringToCoTaskMemUni(text));
938
using ComScope<
IUnknown
> unknown = new((
IUnknown
*)(void*)Marshal.GetIUnknownForObject(o));
946
IUnknown
* unknown = null;
970
using ComScope<
IUnknown
> unknown = new((
IUnknown
*)(void*)Marshal.GetIUnknownForObject(o));
978
IUnknown
* unknown = null;
System\Windows\Forms\Automation\UiaTextRangeTests.cs (2)
465
IUnknown
* unknown;
1335
public HRESULT GetPatternProvider(UIA_PATTERN_ID patternId,
IUnknown
** pRetVal) => HRESULT.E_NOTIMPL;
Windows\Win32\AgileComPointerTests.cs (3)
44
using var proxyUnknownPtr = proxyAgileStream.GetInterface<
IUnknown
>();
45
using ComScope<
IUnknown
> originalUnknownPtr = new(null);
46
((IStream*)originalPtr)->QueryInterface(IID.Get<
IUnknown
>(), originalUnknownPtr);
Windows\Win32\System\Com\ComSafeArrayScopeTests.cs (2)
17
Assert.Throws<ArgumentException>(() => new ComSafeArrayScope<
IUnknown
>(array));
39
public HRESULT GetPatternProvider(UIA_PATTERN_ID patternId,
IUnknown
** pRetVal) => throw new NotImplementedException();
Windows\Win32\System\Com\SafeArrayScopeTests.cs (2)
73
ArgumentException e = Assert.Throws<ArgumentException>(() => new SafeArrayScope<
IUnknown
>(size: 1));
78
e = Assert.Throws<ArgumentException>(() => new SafeArrayScope<
IUnknown
>(array));
System.Windows.Forms.Primitives.TestUtilities (4)
Windows\Win32\System\Com\ComClassFactory.cs (4)
49
internal HRESULT CreateInstance(out
IUnknown
* unknown)
52
fixed (
IUnknown
** u = &unknown)
54
return _classFactory->CreateInstance(null, IID.Get<
IUnknown
>(), (void**)u);
60
HRESULT result = CreateInstance(out
IUnknown
* punk);
System.Windows.Forms.Tests (22)
System\Windows\Forms\AxHostTests.cs (1)
3083
using var ocx = ComHelpers.GetComScope<
IUnknown
>(control.GetOcx());
System\Windows\Forms\ClipboardTests.cs (9)
472
using var dataUnknown = dataScope.Query<
IUnknown
>();
473
using var proxyUnknown = proxy.Query<
IUnknown
>();
478
using var realDataPointerUnknown = realDataPointer.Query<
IUnknown
>();
1330
using ComScope<
IUnknown
> originalUnknown = iDataObject.Query<
IUnknown
>();
1343
using ComScope<
IUnknown
> unknown = receivedIDataObject.Query<
IUnknown
>();
1354
using ComScope<
IUnknown
> wrapperUnknown = wrapper.Query<
IUnknown
>();
System\Windows\Forms\ComponentModel\Com2Interop\COM2FontConverterTests.cs (3)
40
using Font? font = (Font?)converter.ConvertNativeToManaged((VARIANT)(
IUnknown
*)iFont, s_stubDescriptor);
72
using Font? font = (Font?)converter.ConvertNativeToManaged((VARIANT)(
IUnknown
*)iFont, s_stubDescriptor);
84
new CustomGetNativeValueDescriptor((VARIANT)(
IUnknown
*)iFont.Value),
System\Windows\Forms\ComponentModel\Com2Interop\COM2PictureConverterTests.cs (6)
70
using var unknown = ComHelpers.GetComScope<
IUnknown
>(nullIPicture);
80
using var unknown = ComHelpers.GetComScope<
IUnknown
>(iconIPicture);
101
using var unknown = ComHelpers.GetComScope<
IUnknown
>(bitmapIPicture);
123
using var unknown = ComHelpers.GetComScope<
IUnknown
>(new TestIPicture(1, PICTYPE.PICTYPE_METAFILE));
143
using ComScope<IPicture> picture = ComScope<IPicture>.QueryFrom((
IUnknown
*)native);
164
using ComScope<IPicture> picture = ComScope<IPicture>.QueryFrom((
IUnknown
*)native);
System\Windows\Forms\ComponentModel\Com2Interop\ComNativeDescriptorTests.cs (3)
100
out
IUnknown
* mediaPlayerPtr);
113
ComScope<
IUnknown
> unknown = new(null);
118
IID.Get<
IUnknown
>(),