// ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981,SYSLIB1092,CS3021,CS3019 using global::System; using global::System.Diagnostics; using global::System.Diagnostics.CodeAnalysis; using global::System.Runtime.CompilerServices; using global::System.Runtime.InteropServices; using global::System.Runtime.Versioning; using winmdroot = global::Windows.Win32; namespace Windows.Win32 { namespace System.Ole { [Guid("B196B28F-BAB4-101A-B69C-00AA00341D07")] [CLSCompliant(false)] [SupportedOSPlatform("windows5.0")] [global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.287+85e3fa26dd.RR")] internal unsafe partial struct IClassFactory2 :winmdroot.IVTable<IClassFactory2,IClassFactory2.Vtbl>,IComIID { /// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/> [OverloadResolutionPriority(1)] internal unsafe winmdroot.Foundation.HRESULT QueryInterface(in global::System.Guid riid, out void* ppvObject) { fixed (void** ppvObjectLocal = &ppvObject) { fixed (global::System.Guid* riidLocal = &riid) { winmdroot.Foundation.HRESULT __result = this.QueryInterface(riidLocal, ppvObjectLocal); return __result; } } } public unsafe winmdroot.Foundation.HRESULT QueryInterface(global::System.Guid* riid, void** ppvObject) { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IClassFactory2*)Unsafe.AsPointer(ref this), riid, ppvObject); } public uint AddRef() { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,uint>)lpVtbl[1])((IClassFactory2*)Unsafe.AsPointer(ref this)); } public uint Release() { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,uint>)lpVtbl[2])((IClassFactory2*)Unsafe.AsPointer(ref this)); } /// <inheritdoc cref="CreateInstance(winmdroot.System.Com.IUnknown*, global::System.Guid*, void**)"/> [OverloadResolutionPriority(1)] internal unsafe winmdroot.Foundation.HRESULT CreateInstance([Optional] winmdroot.System.Com.IUnknown* pUnkOuter, in global::System.Guid riid, out void* ppvObject) { fixed (void** ppvObjectLocal = &ppvObject) { fixed (global::System.Guid* riidLocal = &riid) { winmdroot.Foundation.HRESULT __result = this.CreateInstance(pUnkOuter, riidLocal, ppvObjectLocal); return __result; } } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT CreateInstance(IClassFactory2* pThis, [Optional] winmdroot.System.Com.IUnknown* pUnkOuter, global::System.Guid* riid, void** ppvObject) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.CreateInstance(pUnkOuter, riid, ppvObject); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } public unsafe winmdroot.Foundation.HRESULT CreateInstance([Optional] winmdroot.System.Com.IUnknown* pUnkOuter, global::System.Guid* riid, void** ppvObject) { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.System.Com.IUnknown* ,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IClassFactory2*)Unsafe.AsPointer(ref this), pUnkOuter, riid, ppvObject); } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT LockServer(IClassFactory2* pThis, winmdroot.Foundation.BOOL fLock) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.LockServer(fLock); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } public winmdroot.Foundation.HRESULT LockServer(winmdroot.Foundation.BOOL fLock) { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.Foundation.BOOL ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IClassFactory2*)Unsafe.AsPointer(ref this), fLock); } /// <inheritdoc cref="GetLicInfo(winmdroot.System.Ole.LICINFO*)"/> [OverloadResolutionPriority(1)] internal unsafe winmdroot.Foundation.HRESULT GetLicInfo(ref winmdroot.System.Ole.LICINFO pLicInfo) { fixed (winmdroot.System.Ole.LICINFO* pLicInfoLocal = &pLicInfo) { winmdroot.Foundation.HRESULT __result = this.GetLicInfo(pLicInfoLocal); return __result; } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT GetLicInfo(IClassFactory2* pThis, winmdroot.System.Ole.LICINFO* pLicInfo) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.GetLicInfo(pLicInfo); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>Retrieves information about the licensing capabilities of this class factory.</summary> /// <param name="pLicInfo">A pointer to the caller-allocated <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/ns-ocidl-licinfo">LICINFO</a> structure to be filled on output.</param> /// <returns> /// <para>This method can return the standard return values E_UNEXPECTED, as well as the following values. </para> /// <para>This doc was truncated.</para> /// </returns> /// <remarks> /// <para><h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> E_NOTIMPL is not allowed as a return value because this method provides critical information for the client of a licensed class factory.</para> /// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iclassfactory2-getlicinfo#">Read more on learn.microsoft.com</see>.</para> /// </remarks> public unsafe winmdroot.Foundation.HRESULT GetLicInfo(winmdroot.System.Ole.LICINFO* pLicInfo) { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.System.Ole.LICINFO* ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IClassFactory2*)Unsafe.AsPointer(ref this), pLicInfo); } /// <inheritdoc cref="RequestLicKey(uint, winmdroot.Foundation.BSTR*)"/> [OverloadResolutionPriority(1)] internal unsafe winmdroot.Foundation.HRESULT RequestLicKey(uint dwReserved, out winmdroot.Foundation.BSTR pBstrKey) { fixed (winmdroot.Foundation.BSTR* pBstrKeyLocal = &pBstrKey) { winmdroot.Foundation.HRESULT __result = this.RequestLicKey(dwReserved, pBstrKeyLocal); return __result; } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT RequestLicKey(IClassFactory2* pThis, uint dwReserved, winmdroot.Foundation.BSTR* pBstrKey) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.RequestLicKey(dwReserved, pBstrKey); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>Creates a license key that the caller can save and use later to create an instance of the licensed object.</summary> /// <param name="dwReserved">This parameter is reserved and must be zero.</param> /// <param name="pBstrKey">A pointer to the caller-allocated variable that receives the callee-allocated license key on successful return from this method. This parameter is set to <b>NULL</b> on any failure.</param> /// <returns> /// <para>This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values. </para> /// <para>This doc was truncated.</para> /// </returns> /// <remarks> /// <para>The caller can save the license key for subsequent calls to <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-createinstancelic">IClassFactory2::CreateInstanceLic</a> to create objects on an otherwise unlicensed machine. <h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> The caller must free the <b>BSTR</b> with the <a href="https://docs.microsoft.com/previous-versions/windows/desktop/api/oleauto/nf-oleauto-sysfreestring">SysFreeString</a> function when the key is no longer needed. The value of <i>fRuntimeKeyAvail</i> is returned through a previous call to <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-getlicinfo">IClassFactory2::GetLicInfo</a>. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> This method allocates the <b>BSTR</b> key with <a href="https://docs.microsoft.com/previous-versions/windows/desktop/api/oleauto/nf-oleauto-sysallocstring">SysAllocString</a> or <a href="https://docs.microsoft.com/previous-versions/windows/desktop/api/oleauto/nf-oleauto-sysallocstringlen">SysAllocStringLen</a>, and the caller becomes responsible for this <b>BSTR</b> after this method returns successfully. This method need not be implemented when a class factory does not support run-time license keys.</para> /// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iclassfactory2-requestlickey#">Read more on learn.microsoft.com</see>.</para> /// </remarks> public unsafe winmdroot.Foundation.HRESULT RequestLicKey(uint dwReserved, winmdroot.Foundation.BSTR* pBstrKey) { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,uint ,winmdroot.Foundation.BSTR* ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IClassFactory2*)Unsafe.AsPointer(ref this), dwReserved, pBstrKey); } /// <inheritdoc cref="CreateInstanceLic(winmdroot.System.Com.IUnknown*, winmdroot.System.Com.IUnknown*, global::System.Guid*, winmdroot.Foundation.BSTR, void**)"/> internal unsafe winmdroot.Foundation.HRESULT CreateInstanceLic([Optional] winmdroot.System.Com.IUnknown* pUnkOuter, in global::System.Guid riid, winmdroot.Foundation.BSTR bstrKey, out void* ppvObj) { fixed (void** ppvObjLocal = &ppvObj) { fixed (global::System.Guid* riidLocal = &riid) { winmdroot.Foundation.HRESULT __result = this.CreateInstanceLic(pUnkOuter, default, riidLocal, bstrKey, ppvObjLocal); return __result; } } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT CreateInstanceLic(IClassFactory2* pThis, [Optional] winmdroot.System.Com.IUnknown* pUnkOuter, [Optional] winmdroot.System.Com.IUnknown* pUnkReserved, global::System.Guid* riid, winmdroot.Foundation.BSTR bstrKey, void** ppvObj) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.CreateInstanceLic(pUnkOuter, pUnkReserved, riid, bstrKey, ppvObj); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>Creates an instance of the licensed object for the specified license key. This method is the only possible means to create an object on an otherwise unlicensed machine.</summary> /// <param name="pUnkOuter">A pointer to the controlling <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nn-unknwn-iunknown">IUnknown</a> interface on the outer unknown if this object is being created as part of an aggregate. If the object is not part of an aggregate, this parameter must be <b>NULL</b>.</param> /// <param name="pUnkReserved">This parameter is unused and must be <b>NULL</b>.</param> /// <param name="riid">A reference to the identifier of the interface to be used to communicate with the newly created object.</param> /// <param name="bstrKey">Run-time license key previously obtained from <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-requestlickey">IClassFactory2::RequestLicKey</a> that is required to create an object.</param> /// <param name="ppvObj">Address of pointer variable that receives the interface pointer requested in <i>riid</i>. Upon successful return, *<i>ppvObj</i> contains the requested interface pointer. If an error occurs, the implementation must set *<i>ppvObj</i> to <b>NULL</b>.</param> /// <returns> /// <para>This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values. </para> /// <para>This doc was truncated.</para> /// </returns> /// <remarks> /// <para><h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> If the class factory does not provide a license key (that is, <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-requestlickey">IClassFactory2::RequestLicKey</a> returns E_NOTIMPL and the <b>fRuntimeKeyAvail</b> member in <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/ns-ocidl-licinfo">LICINFO</a> is set to <b>FALSE</b> in <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iclassfactory2-getlicinfo">IClassFactory2::GetLicInfo</a>), then this method can also return E_NOTIMPL. In such cases, the class factory is implementing <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nn-ocidl-iclassfactory2">IClassFactory2</a> simply to specify whether the machine is licensed at all through the <b>fLicVerified</b> member of <b>LICINFO</b>.</para> /// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iclassfactory2-createinstancelic#">Read more on learn.microsoft.com</see>.</para> /// </remarks> public unsafe winmdroot.Foundation.HRESULT CreateInstanceLic([Optional] winmdroot.System.Com.IUnknown* pUnkOuter, [Optional] winmdroot.System.Com.IUnknown* pUnkReserved, global::System.Guid* riid, winmdroot.Foundation.BSTR bstrKey, void** ppvObj) { return ((delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.System.Com.IUnknown* ,winmdroot.System.Com.IUnknown* ,global::System.Guid* ,winmdroot.Foundation.BSTR ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IClassFactory2*)Unsafe.AsPointer(ref this), pUnkOuter, pUnkReserved, riid, bstrKey, ppvObj); } internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv) where T : unmanaged { Guid guid = typeof(T).GUID; void* pv; var hr = this.QueryInterface(&guid, &pv); if (hr.Succeeded) { ppv = (T*)pv; } else { ppv = null; } return hr; } internal struct Vtbl { internal delegate *unmanaged [Stdcall]<IClassFactory2*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1; internal delegate *unmanaged [Stdcall]<IClassFactory2*,uint> AddRef_2; internal delegate *unmanaged [Stdcall]<IClassFactory2*,uint> Release_3; internal delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.System.Com.IUnknown* ,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> CreateInstance_4; internal delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.Foundation.BOOL ,winmdroot.Foundation.HRESULT> LockServer_5; internal delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.System.Ole.LICINFO* ,winmdroot.Foundation.HRESULT> GetLicInfo_6; internal delegate *unmanaged [Stdcall]<IClassFactory2*,uint ,winmdroot.Foundation.BSTR* ,winmdroot.Foundation.HRESULT> RequestLicKey_7; internal delegate *unmanaged [Stdcall]<IClassFactory2*,winmdroot.System.Com.IUnknown* ,winmdroot.System.Com.IUnknown* ,global::System.Guid* ,winmdroot.Foundation.BSTR ,void** ,winmdroot.Foundation.HRESULT> CreateInstanceLic_8; } public static void PopulateVTable(Vtbl* vtable) { vtable->CreateInstance_4 = &CreateInstance; vtable->LockServer_5 = &LockServer; vtable->GetLicInfo_6 = &GetLicInfo; vtable->RequestLicKey_7 = &RequestLicKey; vtable->CreateInstanceLic_8 = &CreateInstanceLic; } private void** lpVtbl; /// <summary>The IID guid for this interface.</summary> /// <value>{b196b28f-bab4-101a-b69c-00aa00341d07}</value> internal static readonly Guid IID_Guid = new Guid(0xB196B28F, 0xBAB4, 0x101A, 0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07); static ref readonly Guid IComIID.Guid { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { ReadOnlySpan<byte> data = new byte[] { 0x8F,0xB2,0x96,0xB1,0xB4,0xBA,0x1A,0x10,0xB6,0x9C,0x00,0xAA,0x00,0x34,0x1D,0x07 }; return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data)); } } [Guid("B196B28F-BAB4-101A-B69C-00AA00341D07"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()] [SupportedOSPlatform("windows5.0")] internal interface Interface :winmdroot.System.Com.IClassFactory.Interface { [PreserveSig()] unsafe new winmdroot.Foundation.HRESULT CreateInstance([Optional] winmdroot.System.Com.IUnknown* pUnkOuter, global::System.Guid* riid, void** ppvObject); [PreserveSig()] new winmdroot.Foundation.HRESULT LockServer(winmdroot.Foundation.BOOL fLock); [PreserveSig()] unsafe winmdroot.Foundation.HRESULT GetLicInfo(winmdroot.System.Ole.LICINFO* pLicInfo); [PreserveSig()] unsafe winmdroot.Foundation.HRESULT RequestLicKey(uint dwReserved, winmdroot.Foundation.BSTR* pBstrKey); [PreserveSig()] unsafe winmdroot.Foundation.HRESULT CreateInstanceLic([Optional] winmdroot.System.Com.IUnknown* pUnkOuter, [Optional] winmdroot.System.Com.IUnknown* pUnkReserved, global::System.Guid* riid, winmdroot.Foundation.BSTR bstrKey, void** ppvObj); } } } }