mirror of https://github.com/dahall/Vanara.git
WIP on WUApi parts -- NOT COMPLETE
parent
4b398b3f73
commit
fe637c0ec3
|
@ -1,7 +1,6 @@
|
|||
global using System.Collections;
|
||||
global using System.Reflection;
|
||||
global using System.Runtime.CompilerServices;
|
||||
using System.Net;
|
||||
|
||||
namespace Vanara.PInvoke;
|
||||
|
||||
|
@ -899,7 +898,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iautomaticupdates
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IAutomaticUpdates")]
|
||||
[ComImport, Guid("673425BF-C082-4C7C-BDFD-569464B8E0CE"), CoClass(typeof(AutomaticUpdates))]
|
||||
[ComImport, Guid("673425BF-C082-4C7C-BDFD-569464B8E0CE"), CoClass(typeof(AutomaticUpdatesClass))]
|
||||
public interface IAutomaticUpdates
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -992,7 +991,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iautomaticupdates2
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IAutomaticUpdates2")]
|
||||
[ComImport, Guid("4A2F5C31-CFD9-410E-B7FB-29A653973A0F"), CoClass(typeof(AutomaticUpdates))]
|
||||
[ComImport, Guid("4A2F5C31-CFD9-410E-B7FB-29A653973A0F"), CoClass(typeof(AutomaticUpdatesClass))]
|
||||
public interface IAutomaticUpdates2 : IAutomaticUpdates
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -1104,7 +1103,7 @@ public static partial class WUApi
|
|||
/// </value>
|
||||
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-uamg/edb37e74-f222-4983-b1fc-4d9694386619
|
||||
[DispId(1610743809)]
|
||||
object LastSearchSuccessDate
|
||||
object? LastSearchSuccessDate
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[return: MarshalAs(UnmanagedType.Struct)]
|
||||
|
@ -1121,7 +1120,7 @@ public static partial class WUApi
|
|||
/// this property.
|
||||
/// </remarks>
|
||||
[DispId(1610743810)]
|
||||
object LastInstallationSuccessDate
|
||||
object? LastInstallationSuccessDate
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[return: MarshalAs(UnmanagedType.Struct)]
|
||||
|
@ -1663,7 +1662,7 @@ public static partial class WUApi
|
|||
// CheckPermission( [in] AutomaticUpdatesUserType userType, [in] AutomaticUpdatesPermissionType permissionType, VARIANT_BOOL
|
||||
// *userHasPermission );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809346)]
|
||||
bool CheckPermission([In][ComAliasName("WUApiLib.AutomaticUpdatesUserType")] AutomaticUpdatesUserType userType, [In][ComAliasName("WUApiLib.AutomaticUpdatesPermissionType")] AutomaticUpdatesPermissionType permissionType);
|
||||
bool CheckPermission([In, ComAliasName("WUApiLib.AutomaticUpdatesUserType")] AutomaticUpdatesUserType userType, [In, ComAliasName("WUApiLib.AutomaticUpdatesPermissionType")] AutomaticUpdatesPermissionType permissionType);
|
||||
}
|
||||
|
||||
/// <summary>Contains the settings that are available in Automatic Updates.</summary>
|
||||
|
@ -1946,7 +1945,7 @@ public static partial class WUApi
|
|||
// CheckPermission( [in] AutomaticUpdatesUserType userType, [in] AutomaticUpdatesPermissionType permissionType, VARIANT_BOOL
|
||||
// *userHasPermission );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809346)]
|
||||
new bool CheckPermission([In][ComAliasName("WUApiLib.AutomaticUpdatesUserType")] AutomaticUpdatesUserType userType, [In][ComAliasName("WUApiLib.AutomaticUpdatesPermissionType")] AutomaticUpdatesPermissionType permissionType);
|
||||
new bool CheckPermission([In, ComAliasName("WUApiLib.AutomaticUpdatesUserType")] AutomaticUpdatesUserType userType, [In, ComAliasName("WUApiLib.AutomaticUpdatesPermissionType")] AutomaticUpdatesPermissionType permissionType);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
@ -2041,7 +2040,7 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-icategory-get_categoryid HRESULT get_CategoryID( BSTR *retval );
|
||||
[DispId(1610743809)]
|
||||
string CategoryID
|
||||
string? CategoryID
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -2055,7 +2054,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-icategory-get_children HRESULT get_Children(
|
||||
// ICategoryCollection **retval );
|
||||
[DispId(1610743810)]
|
||||
ICategoryCollection Children
|
||||
ICategoryCollection? Children
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
|
@ -2095,7 +2094,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-icategory-get_description HRESULT get_Description( BSTR *retval );
|
||||
[DispId(1610743811)]
|
||||
string Description
|
||||
string? Description
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -2136,7 +2135,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-icategory-get_image HRESULT get_Image( IImageInformation
|
||||
// **retval );
|
||||
[DispId(1610743812)]
|
||||
IImageInformation Image
|
||||
IImageInformation? Image
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743812)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
|
@ -2161,7 +2160,7 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-icategory-get_parent HRESULT get_Parent( ICategory **retval );
|
||||
[DispId(1610743814)]
|
||||
ICategory Parent
|
||||
ICategory? Parent
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743814)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
|
@ -2190,7 +2189,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-icategory-get_updates HRESULT get_Updates( IUpdateCollection
|
||||
// **retval );
|
||||
[DispId(1610743816)]
|
||||
IUpdateCollection Updates
|
||||
IUpdateCollection? Updates
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743816)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
|
@ -2259,7 +2258,7 @@ public static partial class WUApi
|
|||
// HRESULT Invoke( [in] IDownloadJob *downloadJob, [in] IDownloadCompletedCallbackArgs *callbackArgs );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
HRESULT Invoke([In][MarshalAs(UnmanagedType.Interface)] IDownloadJob downloadJob, [In][MarshalAs(UnmanagedType.Interface)] IDownloadCompletedCallbackArgs callbackArgs);
|
||||
HRESULT Invoke([In, MarshalAs(UnmanagedType.Interface)] IDownloadJob downloadJob, [In, MarshalAs(UnmanagedType.Interface)] IDownloadCompletedCallbackArgs callbackArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2504,7 +2503,7 @@ public static partial class WUApi
|
|||
// HRESULT Invoke( [in] IDownloadJob *downloadJob, [in] IDownloadProgressChangedCallbackArgs *callbackArgs );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
HRESULT Invoke([In][MarshalAs(UnmanagedType.Interface)] IDownloadJob downloadJob, [In][MarshalAs(UnmanagedType.Interface)] IDownloadProgressChangedCallbackArgs callbackArgs);
|
||||
HRESULT Invoke([In, MarshalAs(UnmanagedType.Interface)] IDownloadJob downloadJob, [In, MarshalAs(UnmanagedType.Interface)] IDownloadProgressChangedCallbackArgs callbackArgs);
|
||||
}
|
||||
|
||||
/// <summary>Contains information about the change in the progress of an asynchronous download operation.</summary>
|
||||
|
@ -2531,7 +2530,7 @@ public static partial class WUApi
|
|||
/// <summary>The <c>IDownloadResult</c> interface represents the result of a download operation.</summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-idownloadresult
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IDownloadResult")]
|
||||
[ComImport, Guid("DAA4FDD0-4727-4DBE-A1E7-745DCA317144")]
|
||||
[ComImport, Guid("daa4fdd0-4727-4dbe-a1e7-745dca317144")]
|
||||
public interface IDownloadResult
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -2539,10 +2538,10 @@ public static partial class WUApi
|
|||
/// <para>This property is read-only.</para>
|
||||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-idownloadresult-get_hresult HRESULT get_HResult( LONG *retval );
|
||||
[DispId(1610743809)]
|
||||
HRESULT HResult
|
||||
[DispId(0x60020001)]
|
||||
int HResult
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020001)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2552,10 +2551,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-idownloadresult-get_resultcode HRESULT get_ResultCode(
|
||||
// OperationResultCode *retval );
|
||||
[ComAliasName("WUApiLib.OperationResultCode"), DispId(1610743810)]
|
||||
[ComAliasName("WUApiLib.OperationResultCode"), DispId(0x60020002)]
|
||||
OperationResultCode ResultCode
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020002)]
|
||||
[return: ComAliasName("WUApiLib.OperationResultCode")]
|
||||
get;
|
||||
}
|
||||
|
@ -2565,7 +2564,7 @@ public static partial class WUApi
|
|||
/// <returns>An IUpdateDownloadResult interface that contains the results for the specified update.</returns>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-idownloadresult-getupdateresult HRESULT GetUpdateResult( [in]
|
||||
// LONG updateIndex, [out] IUpdateDownloadResult **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020003)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IUpdateDownloadResult GetUpdateResult([In] int updateIndex);
|
||||
}
|
||||
|
@ -2630,7 +2629,7 @@ public static partial class WUApi
|
|||
/// <summary>Records the result for an update.</summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iinstallationagent
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IInstallationAgent")]
|
||||
[ComImport, Guid("925CBC18-A2EA-4648-BF1C-EC8BADCFE20A"), CoClass(typeof(InstallationAgent))]
|
||||
[ComImport, Guid("925CBC18-A2EA-4648-BF1C-EC8BADCFE20A"), CoClass(typeof(InstallationAgentClass))]
|
||||
public interface IInstallationAgent
|
||||
{
|
||||
/// <summary>Records the result for an update. The result is specified by an IStringCollection object.</summary>
|
||||
|
@ -2642,7 +2641,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationagent-recordinstallationresult HRESULT
|
||||
// RecordInstallationResult( [in] BSTR installationResultCookie, [in] LONG hresult, [in] IStringCollection *extendedReportingData );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
void RecordInstallationResult([In][MarshalAs(UnmanagedType.BStr)] string installationResultCookie, [In] HRESULT hresult, [In][MarshalAs(UnmanagedType.Interface)] IStringCollection extendedReportingData);
|
||||
void RecordInstallationResult([In, MarshalAs(UnmanagedType.BStr)] string installationResultCookie, [In] HRESULT hresult, [In, MarshalAs(UnmanagedType.Interface)] IStringCollection extendedReportingData);
|
||||
}
|
||||
|
||||
/// <summary>Represents the installation and uninstallation options of an update.</summary>
|
||||
|
@ -2730,7 +2729,7 @@ public static partial class WUApi
|
|||
// IInstallationJob *installationJob, [in] IInstallationCompletedCallbackArgs *callbackArgs );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
HRESULT Invoke([In][MarshalAs(UnmanagedType.Interface)] IInstallationJob installationJob, [In][MarshalAs(UnmanagedType.Interface)] IInstallationCompletedCallbackArgs? callbackArgs);
|
||||
HRESULT Invoke([In, MarshalAs(UnmanagedType.Interface)] IInstallationJob installationJob, [In, MarshalAs(UnmanagedType.Interface)] IInstallationCompletedCallbackArgs? callbackArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2766,10 +2765,10 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationjob-get_asyncstate HRESULT get_AsyncState( VARIANT
|
||||
// *retval );
|
||||
[DispId(1610743809)]
|
||||
object AsyncState
|
||||
[DispId(0x60020001)]
|
||||
object? AsyncState
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020001)]
|
||||
[return: MarshalAs(UnmanagedType.Struct)]
|
||||
get;
|
||||
}
|
||||
|
@ -2783,10 +2782,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationjob-get_iscompleted HRESULT get_IsCompleted(
|
||||
// VARIANT_BOOL *retval );
|
||||
[DispId(1610743810)]
|
||||
[DispId(0x60020002)]
|
||||
bool IsCompleted
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020002)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2796,10 +2795,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationjob-get_updates HRESULT get_Updates(
|
||||
// IUpdateCollection **retval );
|
||||
[DispId(1610743811)]
|
||||
[DispId(0x60020003)]
|
||||
IUpdateCollection Updates
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020003)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
get;
|
||||
}
|
||||
|
@ -2810,7 +2809,7 @@ public static partial class WUApi
|
|||
/// perform asynchronous WUA operations, see Guidelines for Asynchronous WUA Operations.
|
||||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationjob-cleanup HRESULT CleanUp();
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743812)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020004)]
|
||||
void CleanUp();
|
||||
|
||||
/// <summary>Returns an IInstallationProgress interface that describes the current progress of an installation or uninstallation.</summary>
|
||||
|
@ -2821,13 +2820,13 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationjob-getprogress HRESULT GetProgress( [out]
|
||||
// IInstallationProgress **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743813)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020005)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IInstallationProgress GetProgress();
|
||||
|
||||
/// <summary>Makes a request to cancel the installation or uninstallation.</summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationjob-requestabort HRESULT RequestAbort();
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743814)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020006)]
|
||||
void RequestAbort();
|
||||
}
|
||||
|
||||
|
@ -2846,10 +2845,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationprogress-get_currentupdateindex HRESULT
|
||||
// get_CurrentUpdateIndex( LONG *retval );
|
||||
[DispId(1610743809)]
|
||||
[DispId(0x60020001)]
|
||||
int CurrentUpdateIndex
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020001)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2859,10 +2858,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationprogress-get_currentupdatepercentcomplete HRESULT
|
||||
// get_CurrentUpdatePercentComplete( LONG *retval );
|
||||
[DispId(1610743810)]
|
||||
[DispId(0x60020002)]
|
||||
int CurrentUpdatePercentComplete
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020002)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2872,10 +2871,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationprogress-get_percentcomplete HRESULT
|
||||
// get_PercentComplete( LONG *retval );
|
||||
[DispId(1610743811)]
|
||||
[DispId(0x60020003)]
|
||||
int PercentComplete
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020003)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2888,7 +2887,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationprogress-getupdateresult HRESULT GetUpdateResult(
|
||||
// [in] LONG updateIndex, [out] IUpdateInstallationResult **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743812)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020004)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IUpdateInstallationResult GetUpdateResult([In] int updateIndex);
|
||||
}
|
||||
|
@ -2913,7 +2912,7 @@ public static partial class WUApi
|
|||
// [in] IInstallationJob *installationJob, [in] IInstallationProgressChangedCallbackArgs *callbackArgs );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
HRESULT Invoke([In][MarshalAs(UnmanagedType.Interface)] IInstallationJob installationJob, [In][MarshalAs(UnmanagedType.Interface)] IInstallationProgressChangedCallbackArgs callbackArgs);
|
||||
HRESULT Invoke([In, MarshalAs(UnmanagedType.Interface)] IInstallationJob installationJob, [In, MarshalAs(UnmanagedType.Interface)] IInstallationProgressChangedCallbackArgs callbackArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2932,10 +2931,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationprogresschangedcallbackargs-get_progress HRESULT
|
||||
// get_Progress( IInstallationProgress **retval );
|
||||
[DispId(1610743809)]
|
||||
[DispId(0x60020001)]
|
||||
IInstallationProgress Progress
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020001)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
get;
|
||||
}
|
||||
|
@ -2953,10 +2952,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationresult-get_hresult HRESULT get_HResult( LONG
|
||||
// *retval );
|
||||
[DispId(1610743809)]
|
||||
HRESULT HResult
|
||||
[DispId(0x60020001)]
|
||||
int HResult
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020001)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2968,10 +2967,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationresult-get_rebootrequired HRESULT
|
||||
// get_RebootRequired( VARIANT_BOOL *retval );
|
||||
[DispId(1610743810)]
|
||||
[DispId(0x60020002)]
|
||||
bool RebootRequired
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020002)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -2981,10 +2980,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationresult-get_resultcode HRESULT get_ResultCode(
|
||||
// OperationResultCode *retval );
|
||||
[DispId(1610743811), ComAliasName("WUApiLib.OperationResultCode")]
|
||||
[DispId(0x60020003), ComAliasName("WUApiLib.OperationResultCode")]
|
||||
OperationResultCode ResultCode
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020003)]
|
||||
[return: ComAliasName("WUApiLib.OperationResultCode")]
|
||||
get;
|
||||
}
|
||||
|
@ -2994,7 +2993,7 @@ public static partial class WUApi
|
|||
/// <returns>An interface that contains results for a specified update.</returns>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iinstallationresult-getupdateresult HRESULT GetUpdateResult(
|
||||
// [in] LONG updateIndex, [out] IUpdateInstallationResult **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743812)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020004)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IUpdateInstallationResult GetUpdateResult([In] int updateIndex);
|
||||
}
|
||||
|
@ -3024,7 +3023,7 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdateexception-get_hresult HRESULT get_HResult( LONG *retval );
|
||||
[DispId(1610743809)]
|
||||
new HRESULT HResult
|
||||
new int HResult
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
get;
|
||||
|
@ -3080,7 +3079,7 @@ public static partial class WUApi
|
|||
// *searchJob, [in] ISearchCompletedCallbackArgs *callbackArgs );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
HRESULT Invoke([In][MarshalAs(UnmanagedType.Interface)] ISearchJob searchJob, [In][MarshalAs(UnmanagedType.Interface)] ISearchCompletedCallbackArgs callbackArgs);
|
||||
HRESULT Invoke([In] ISearchJob searchJob, [In] ISearchCompletedCallbackArgs callbackArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3107,7 +3106,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-isearchjob-get_asyncstate HRESULT get_AsyncState( VARIANT
|
||||
// *retval );
|
||||
[DispId(1610743809)]
|
||||
object AsyncState
|
||||
object? AsyncState
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[return: MarshalAs(UnmanagedType.Struct)]
|
||||
|
@ -3212,7 +3211,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-istringcollection
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IStringCollection")]
|
||||
[ComImport, Guid("EFF90582-2DDC-480F-A06D-60F3FBC362C3"), CoClass(typeof(StringCollection))]
|
||||
[ComImport, Guid("EFF90582-2DDC-480F-A06D-60F3FBC362C3"), CoClass(typeof(StringCollectionClass))]
|
||||
public interface IStringCollection : IEnumerable
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -3274,7 +3273,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-istringcollection-add HRESULT Add( [in] BSTR value, [out] LONG
|
||||
// *retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
int Add([In][MarshalAs(UnmanagedType.BStr)] string value);
|
||||
int Add([In, MarshalAs(UnmanagedType.BStr)] string value);
|
||||
|
||||
/// <summary>Removes all the elements from the collection.</summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-istringcollection-clear HRESULT Clear();
|
||||
|
@ -3295,7 +3294,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-istringcollection-insert HRESULT Insert( [in] LONG index, [in]
|
||||
// BSTR value );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743814)]
|
||||
void Insert([In] int index, [In][MarshalAs(UnmanagedType.BStr)] string value);
|
||||
void Insert([In] int index, [In, MarshalAs(UnmanagedType.BStr)] string value);
|
||||
|
||||
/// <summary>Removes the item at the specified index from the collection.</summary>
|
||||
/// <param name="index">The index of the string to be removed.</param>
|
||||
|
@ -3311,7 +3310,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-isysteminformation
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.ISystemInformation")]
|
||||
[ComImport, Guid("ADE87BF7-7B56-4275-8FAB-B9B0E591844B"), CoClass(typeof(SystemInformation))]
|
||||
[ComImport, Guid("ADE87BF7-7B56-4275-8FAB-B9B0E591844B"), CoClass(typeof(SystemInformationClass))]
|
||||
public interface ISystemInformation
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -262,7 +262,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-get_handlerid HRESULT get_HandlerID( BSTR *retval );
|
||||
[DispId(1610743819)]
|
||||
string HandlerID
|
||||
string? HandlerID
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743819)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -868,7 +868,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -1154,7 +1154,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-get_handlerid HRESULT get_HandlerID( BSTR *retval );
|
||||
[DispId(1610743819)]
|
||||
new string HandlerID
|
||||
new string? HandlerID
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743819)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -1760,7 +1760,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -1874,7 +1874,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate2-copytocache HRESULT CopyToCache( [in]
|
||||
// IStringCollection *pFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809346)]
|
||||
void CopyToCache([In][MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
void CopyToCache([In, MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
}
|
||||
|
||||
/// <summary>Contains the properties and methods that are available to an update.</summary>
|
||||
|
@ -2132,7 +2132,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-get_handlerid HRESULT get_HandlerID( BSTR *retval );
|
||||
[DispId(1610743819)]
|
||||
new string HandlerID
|
||||
new string? HandlerID
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743819)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -2738,7 +2738,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -2852,7 +2852,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate2-copytocache HRESULT CopyToCache( [in]
|
||||
// IStringCollection *pFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809346)]
|
||||
new void CopyToCache([In][MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
new void CopyToCache([In, MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets a Boolean value that indicates whether an update can be discovered only by browsing through the available updates.</para>
|
||||
|
@ -3123,7 +3123,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-get_handlerid HRESULT get_HandlerID( BSTR *retval );
|
||||
[DispId(1610743819)]
|
||||
new string HandlerID
|
||||
new string? HandlerID
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743819)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -3729,7 +3729,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -3843,7 +3843,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate2-copytocache HRESULT CopyToCache( [in]
|
||||
// IStringCollection *pFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809346)]
|
||||
new void CopyToCache([In][MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
new void CopyToCache([In, MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets a Boolean value that indicates whether an update can be discovered only by browsing through the available updates.</para>
|
||||
|
@ -4135,7 +4135,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-get_handlerid HRESULT get_HandlerID( BSTR *retval );
|
||||
[DispId(1610743819)]
|
||||
new string HandlerID
|
||||
new string? HandlerID
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743819)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
|
@ -4741,7 +4741,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -4855,7 +4855,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate2-copytocache HRESULT CopyToCache( [in]
|
||||
// IStringCollection *pFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809346)]
|
||||
new void CopyToCache([In][MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
new void CopyToCache([In, MarshalAs(UnmanagedType.Interface)] IStringCollection pFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets a Boolean value that indicates whether an update can be discovered only by browsing through the available updates.</para>
|
||||
|
@ -4932,7 +4932,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdatecollection
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IUpdateCollection")]
|
||||
[ComImport, Guid("07F7438C-7709-4CA5-B518-91279288134E"), CoClass(typeof(UpdateCollection))]
|
||||
[ComImport, Guid("07f7438c-7709-4ca5-b518-91279288134e"), CoClass(typeof(UpdateCollectionClass))/*, TypeLibType(TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FHidden | TypeLibTypeFlags.FDual | TypeLibTypeFlags.FNonExtensible)*/]
|
||||
public interface IUpdateCollection : IEnumerable
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -4968,10 +4968,10 @@ public static partial class WUApi
|
|||
/// <para>This property is read-only.</para>
|
||||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-get_count HRESULT get_Count( LONG *retval );
|
||||
[DispId(1610743809)]
|
||||
[DispId(0x60020001)]
|
||||
int Count
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743809)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020001)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -4981,10 +4981,10 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-get_readonly HRESULT get_ReadOnly(
|
||||
// VARIANT_BOOL *retval );
|
||||
[DispId(1610743810)]
|
||||
[DispId(0x60020002)]
|
||||
bool ReadOnly
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020002)]
|
||||
get;
|
||||
}
|
||||
|
||||
|
@ -4993,19 +4993,19 @@ public static partial class WUApi
|
|||
/// <returns>The index of the added interface in the collection.</returns>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-add HRESULT Add( [in] IUpdate *value, [out]
|
||||
// LONG *retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743811)]
|
||||
int Add([In][MarshalAs(UnmanagedType.Interface)] IUpdate value);
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020003)]
|
||||
int Add([In, MarshalAs(UnmanagedType.Interface)] IUpdate value);
|
||||
|
||||
/// <summary>Removes all the elements from the collection.</summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-clear HRESULT Clear();
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743812)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020004)]
|
||||
void Clear();
|
||||
|
||||
/// <summary>Creates a shallow read/write copy of the collection.</summary>
|
||||
/// <returns>A shallow read/write copy of the collection.</returns>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-copy HRESULT Copy( [out] IUpdateCollection
|
||||
// **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743813)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020005)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IUpdateCollection Copy();
|
||||
|
||||
|
@ -5014,13 +5014,13 @@ public static partial class WUApi
|
|||
/// <param name="value">The IUpdate interface that will be inserted.</param>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-insert HRESULT Insert( [in] LONG index, [in]
|
||||
// IUpdate *value );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743814)]
|
||||
void Insert([In] int index, [In][MarshalAs(UnmanagedType.Interface)] IUpdate value);
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020006)]
|
||||
void Insert([In] int index, [In, MarshalAs(UnmanagedType.Interface)] IUpdate value);
|
||||
|
||||
/// <summary>Removes the item at the specified index from the collection.</summary>
|
||||
/// <param name="index">The index of the interface to be removed.</param>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdatecollection-removeat HRESULT RemoveAt( [in] LONG index );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743815)]
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x60020007)]
|
||||
void RemoveAt([In] int index);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -10,7 +10,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdateservicemanager
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IUpdateServiceManager")]
|
||||
[ComImport, Guid("23857E3C-02BA-44A3-9423-B1C900805F37"), CoClass(typeof(UpdateServiceManager))]
|
||||
[ComImport, Guid("23857E3C-02BA-44A3-9423-B1C900805F37"), CoClass(typeof(UpdateServiceManagerClass))]
|
||||
public interface IUpdateServiceManager
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -41,7 +41,7 @@ public static partial class WUApi
|
|||
// serviceID, [in] BSTR authorizationCabPath, [out] IUpdateService **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IUpdateService AddService([In, MarshalAs(UnmanagedType.BStr)] string serviceID, [In, MarshalAs(UnmanagedType.BStr)] string authorizationCabPath);
|
||||
IUpdateService AddService([In, MarshalAs(UnmanagedType.BStr)] string serviceID, [In, MarshalAs(UnmanagedType.BStr)] string authorizationCabPath = "");
|
||||
|
||||
/// <summary>Registers a service with Automatic Updates.</summary>
|
||||
/// <param name="serviceID">An identifier for the service to be registered.</param>
|
||||
|
@ -146,7 +146,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdateservicemanager2
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IUpdateServiceManager2")]
|
||||
[ComImport, Guid("0BB8531D-7E8D-424F-986C-A0B8F60A3E7B"), CoClass(typeof(UpdateServiceManager))]
|
||||
[ComImport, Guid("0BB8531D-7E8D-424F-986C-A0B8F60A3E7B"), CoClass(typeof(UpdateServiceManagerClass))]
|
||||
public interface IUpdateServiceManager2 : IUpdateServiceManager
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -177,7 +177,7 @@ public static partial class WUApi
|
|||
// serviceID, [in] BSTR authorizationCabPath, [out] IUpdateService **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743810)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
new IUpdateService AddService([In, MarshalAs(UnmanagedType.BStr)] string serviceID, [In, MarshalAs(UnmanagedType.BStr)] string authorizationCabPath);
|
||||
new IUpdateService AddService([In, MarshalAs(UnmanagedType.BStr)] string serviceID, [In, MarshalAs(UnmanagedType.BStr)] string authorizationCabPath = "");
|
||||
|
||||
/// <summary>Registers a service with Automatic Updates.</summary>
|
||||
/// <param name="serviceID">An identifier for the service to be registered.</param>
|
||||
|
@ -382,12 +382,12 @@ public static partial class WUApi
|
|||
/// </item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdateservicemanager2-addservice2 HRESULT AddService2( [in]
|
||||
// BSTR serviceID, [in] LONG flags, [in] BSTR authorizationCabPath, [out] IUpdateServiceRegistration **retval );
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdateservicemanager2-addservice2
|
||||
// HRESULT AddService2( [in] BSTR serviceID, [in] LONG flags, [in] BSTR authorizationCabPath, [out] IUpdateServiceRegistration **retval );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610809347)]
|
||||
[return: MarshalAs(UnmanagedType.Interface)]
|
||||
IUpdateServiceRegistration AddService2([In, MarshalAs(UnmanagedType.BStr)] string serviceID, [In] AddServiceFlag flags,
|
||||
[In, MarshalAs(UnmanagedType.BStr)] string authorizationCabPath);
|
||||
IUpdateServiceRegistration AddService2([In, MarshalAs(UnmanagedType.BStr)] string serviceID,
|
||||
[In] AddServiceFlag flags, [In, MarshalAs(UnmanagedType.BStr)] string authorizationCabPath);
|
||||
}
|
||||
|
||||
/// <summary>Contains information about the registration state of a service.</summary>
|
||||
|
@ -470,7 +470,7 @@ public static partial class WUApi
|
|||
/// to create the object.
|
||||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdatesession
|
||||
[ComImport, Guid("816858A4-260D-4260-933A-2585F1ABC76B"), CoClass(typeof(UpdateSession))]
|
||||
[ComImport, Guid("816858A4-260D-4260-933A-2585F1ABC76B"), CoClass(typeof(UpdateSessionClass))]
|
||||
public interface IUpdateSession
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -559,7 +559,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdatesession2
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IUpdateSession2")]
|
||||
[ComImport, Guid("91CAF7B0-EB23-49ED-9937-C52D817F46F7"), CoClass(typeof(UpdateSession))]
|
||||
[ComImport, Guid("91CAF7B0-EB23-49ED-9937-C52D817F46F7"), CoClass(typeof(UpdateSessionClass))]
|
||||
public interface IUpdateSession2 : IUpdateSession
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -679,7 +679,7 @@ public static partial class WUApi
|
|||
/// </summary>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdatesession3
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IUpdateSession3")]
|
||||
[ComImport, Guid("918EFD1E-B5D8-4C90-8540-AEB9BDC56F9D"), CoClass(typeof(UpdateSession))]
|
||||
[ComImport, Guid("918EFD1E-B5D8-4C90-8540-AEB9BDC56F9D"), CoClass(typeof(UpdateSessionClass))]
|
||||
public interface IUpdateSession3 : IUpdateSession2
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -868,7 +868,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iwebproxy
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IWebProxy")]
|
||||
[ComImport, Guid("174C81FE-AECD-4DAE-B8A0-2C6318DD86A8"), CoClass(typeof(WebProxy))]
|
||||
[ComImport, Guid("174C81FE-AECD-4DAE-B8A0-2C6318DD86A8"), CoClass(typeof(WebProxyClass))]
|
||||
public interface IWebProxy
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -1880,7 +1880,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -2882,7 +2882,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -3931,7 +3931,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -4993,7 +4993,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
@ -6082,7 +6082,7 @@ public static partial class WUApi
|
|||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nf-wuapi-iupdate-copyfromcache HRESULT CopyFromCache( [in] BSTR path,
|
||||
// [in] VARIANT_BOOL toExtractCabFiles );
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1610743850)]
|
||||
new void CopyFromCache([In][MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
new void CopyFromCache([In, MarshalAs(UnmanagedType.BStr)] string path, [In] bool toExtractCabFiles);
|
||||
|
||||
/// <summary>
|
||||
/// <para>Gets the suggested download priority of the update.</para>
|
||||
|
|
|
@ -172,7 +172,7 @@ public static partial class WUApi
|
|||
/// </remarks>
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iwindowsupdateagentinfo
|
||||
[PInvokeData("wuapi.h", MSDNShortId = "NN:wuapi.IWindowsUpdateAgentInfo")]
|
||||
[ComImport, Guid("85713FA1-7796-4FA2-BE3B-E2D6124DD373"), CoClass(typeof(WindowsUpdateAgentInfo))]
|
||||
[ComImport, Guid("85713FA1-7796-4FA2-BE3B-E2D6124DD373"), CoClass(typeof(WindowsUpdateAgentInfoClass))]
|
||||
public interface IWindowsUpdateAgentInfo
|
||||
{
|
||||
/// <summary>Retrieves version information about Windows Update Agent (WUA).</summary>
|
||||
|
@ -222,71 +222,71 @@ public static partial class WUApi
|
|||
/// CLSID_AutomaticUpdates
|
||||
/// </summary>
|
||||
[ComImport, Guid("BFE18E9C-6D87-4450-B37C-E02F0B373803"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class AutomaticUpdates { }
|
||||
public class AutomaticUpdatesClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_InstallationAgent
|
||||
/// </summary>
|
||||
[ComImport, Guid("317E92FC-1679-46FD-A0B5-F08914DD8623"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class InstallationAgent { }
|
||||
public class InstallationAgentClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_StringCollection
|
||||
/// </summary>
|
||||
[ComImport, Guid("72C97D74-7C3B-40AE-B77D-ABDB22EBA6FB"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class StringCollection { }
|
||||
public class StringCollectionClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_SystemInformation
|
||||
/// </summary>
|
||||
[ComImport, Guid("C01B9BA0-BEA7-41BA-B604-D0A36F469133"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class SystemInformation { }
|
||||
public class SystemInformationClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_UpdateCollection
|
||||
/// </summary>
|
||||
[ComImport, Guid("13639463-00DB-4646-803D-528026140D88"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class UpdateCollection { }
|
||||
public class UpdateCollectionClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_UpdateDownloader
|
||||
/// </summary>
|
||||
[ComImport, Guid("5BAF654A-5A07-4264-A255-9FF54C7151E7"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class UpdateDownloader { }
|
||||
public class UpdateDownloaderClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_UpdateInstaller
|
||||
/// </summary>
|
||||
[ComImport, Guid("D2E0FE7F-D23E-48E1-93C0-6FA8CC346474"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class UpdateInstaller { }
|
||||
public class UpdateInstallerClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_UpdateSearcher
|
||||
/// </summary>
|
||||
[ComImport, Guid("B699E5E8-67FF-4177-88B0-3684A3388BFB"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class UpdateSearcher { }
|
||||
public class UpdateSearcherClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_UpdateServiceManager
|
||||
/// </summary>
|
||||
[ComImport, Guid("F8D253D9-89A4-4DAA-87B6-1168369F0B21"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class UpdateServiceManager { }
|
||||
public class UpdateServiceManagerClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_UpdateSession
|
||||
/// </summary>
|
||||
[ComImport, Guid("4CB43D7F-7EEE-4906-8698-60DA1C38F2FE"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class UpdateSession { }
|
||||
public class UpdateSessionClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_WebProxy
|
||||
/// </summary>
|
||||
[ComImport, Guid("650503CF-9108-4DDC-A2CE-6C2341E1C582"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class WebProxy { }
|
||||
public class WebProxyClass { }
|
||||
|
||||
/// <summary>
|
||||
/// CLSID_WindowsUpdateAgentInfo
|
||||
/// </summary>
|
||||
[ComImport, Guid("C2E88C2F-6F5B-4AAA-894B-55C847AD3A2D"), ClassInterface(ClassInterfaceType.None)]
|
||||
public class WindowsUpdateAgentInfo { }
|
||||
public class WindowsUpdateAgentInfoClass { }
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,17 @@
|
|||
<AssemblyName>UnitTest.PInvoke.WUApi</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\PInvoke\WUApi\Vanara.PInvoke.WUApi.csproj" />
|
||||
<COMReference Include="WUApiLib">
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<VersionMajor>2</VersionMajor>
|
||||
<Guid>b596cc9f-56e5-419e-a622-e01bb457431e</Guid>
|
||||
<Lcid>0</Lcid>
|
||||
<Isolated>false</Isolated>
|
||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\WindowsUpdate\Vanara.WindowsUpdate.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,65 +1,306 @@
|
|||
using NUnit.Framework;
|
||||
//#define WUTYPELIB
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Internal;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Vanara.Extensions.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#if !WUTYPELIB
|
||||
using Vanara.WindowsUpdate;
|
||||
using static Vanara.PInvoke.WUApi;
|
||||
#else
|
||||
using WUApiLib;
|
||||
#endif
|
||||
|
||||
namespace Vanara.PInvoke.Tests;
|
||||
|
||||
[TestFixture]
|
||||
public class WUApiTests
|
||||
{
|
||||
private static readonly string[] UpdProps = [ "AutoSelectOnWebSites", "BundledUpdates", "CanRequireSource", "Categories", "Deadline", "DeltaCompressedContentAvailable",
|
||||
"DeltaCompressedContentPreferred", "DeploymentAction", "Description", "DownloadContents", "DownloadPriority", "EulaAccepted", "EulaText", "HandlerID",
|
||||
"Identity", "Image", "InstallationBehavior", "IsBeta", "IsDownloaded", "IsHidden", "IsInstalled", "IsMandatory", "IsUninstallable", "KBArticleIDs",
|
||||
"Languages", "LastDeploymentChangeTime", "MaxDownloadSize", "MinDownloadSize", "MoreInfoUrls", "MsrcSeverity", "RecommendedCpuSpeed",
|
||||
"RecommendedHardDiskSpace", "RecommendedMemory", "ReleaseNotes", "SecurityBulletinIDs", "SupersededUpdateIDs", "SupportUrl", "Title", "Type",
|
||||
"UninstallationBehavior", "UninstallationNotes", "UninstallationSteps", "KBArticleIDs", "DeploymentAction", "DownloadPriority", "DownloadContents",
|
||||
"RebootRequired", "IsPresent", "CveIDs", "BrowseOnly", "PerUser", "AutoSelection", "AutoDownload" ];
|
||||
[Test]
|
||||
public void TestAgent()
|
||||
{
|
||||
WindowsUpdateAgentInfo agent = new();
|
||||
Version? pv = null, ver = null;
|
||||
#if !WUTYPELIB
|
||||
Assert.That(() => pv = agent.ProductVersion, Throws.Nothing);
|
||||
Assert.That(() => ver = agent.ApiVersion, Throws.Nothing);
|
||||
#endif
|
||||
TestContext.WriteLine($"Version: {pv}, Api: {ver}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAuto()
|
||||
{
|
||||
AutomaticUpdates auto = new();
|
||||
auto.WriteValues();
|
||||
//auto.EnableService();
|
||||
auto.DetectNow();
|
||||
auto.Resume();
|
||||
//auto.ShowSettingsDialog();
|
||||
|
||||
//var t = auto.Settings.ScheduledInstallationTime;
|
||||
//auto.Settings.ScheduledInstallationTime = t + 1;
|
||||
//try { auto.Settings.Save(); Assert.That(auto.Settings.ScheduledInstallationTime, Is.EqualTo(t + 1)); }
|
||||
//finally { auto.Settings.ScheduledInstallationTime = t; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDownloader()
|
||||
{
|
||||
UpdateDownloader downloader = new();
|
||||
downloader.WriteValues();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInstaller()
|
||||
{
|
||||
AutomaticUpdates auto = new();
|
||||
if (!auto.ServiceEnabled)
|
||||
{
|
||||
for (int i = 0; i <= 5 && !auto.ServiceEnabled; i++)
|
||||
{
|
||||
auto.EnableService();
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
Assert.That(auto.ServiceEnabled, Is.True);
|
||||
}
|
||||
|
||||
var autoUpd = new UpdateSearcher().Search("IsInstalled=0").Updates.Where(u => u.AutoSelectOnWebSites).ToList();
|
||||
var dnld = autoUpd.Where(u => !u.IsDownloaded).ToList();
|
||||
if (dnld.Count > 0)
|
||||
new UpdateDownloader(dnld).DownloadAsync(p => p.WriteValues()).Result.WriteValues();
|
||||
|
||||
var res = new UpdateInstaller(autoUpd) { AllowSourcePrompts = false, ForceQuiet = true }.InstallAsync(p => p.WriteValues()).Result;
|
||||
Assert.That(res.HResult, Is.EqualTo((HRESULT)0));
|
||||
res.WriteValues();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSysInfo()
|
||||
{
|
||||
SystemInformation info = new();
|
||||
info.WriteValues();
|
||||
}
|
||||
|
||||
#if !WUTYPELIB
|
||||
[Test]
|
||||
public void TestUpdateHistory()
|
||||
{
|
||||
foreach (UpdateHistoryEntry e in new UpdateHistory())
|
||||
{
|
||||
TestContext.WriteLine(new string('=', 50));
|
||||
e.WriteValues(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void TestUpdateSearch()
|
||||
{
|
||||
IUpdateSession2 sess = new();
|
||||
var searcher = sess.CreateUpdateSearcher();
|
||||
searcher.IncludePotentiallySupersededUpdates = true;
|
||||
var res = searcher.Search("IsInstalled=0");
|
||||
foreach (var upd in res.Updates.Cast<IUpdate5>())
|
||||
UpdateSearcher searcher = new();
|
||||
var res = searcher.Search("");
|
||||
foreach (var upd in res.Updates)
|
||||
{
|
||||
TestContext.WriteLine(new string('=', 50));
|
||||
foreach (var prop in UpdProps)
|
||||
{
|
||||
try
|
||||
{
|
||||
var val = upd.GetPropertyValue<object>(prop);
|
||||
if (val is null)
|
||||
continue;
|
||||
if (val is not string and IEnumerable ie)
|
||||
try { TestContext.WriteLine($"{prop}: {string.Join(',', ie.Cast<object>().Select(o => o is string s ? s : o.GetPropertyValue<string>("Name")))}"); }
|
||||
catch { TestContext.WriteLine($"{prop}: {val.GetPropertyValue<int>("Count")} objects"); }
|
||||
else
|
||||
TestContext.WriteLine($"{prop}: {val}");
|
||||
}
|
||||
catch (COMException ce)
|
||||
{
|
||||
if (ce.ErrorCode == HRESULT.E_NOTIMPL)
|
||||
continue;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
TestContext.WriteLine(upd.Title);
|
||||
//upd.WriteValues(false);
|
||||
}
|
||||
}
|
||||
|
||||
#if !WUTYPELIB
|
||||
[Test]
|
||||
public void TestFLuentUpdateSearch()
|
||||
{
|
||||
UpdateSearcher searcher = new();
|
||||
var res = searcher.Where.Not.Installed.And.Not.Hidden.Search();
|
||||
foreach (var upd in res.Updates)
|
||||
{
|
||||
TestContext.WriteLine(new string('=', 50));
|
||||
upd.WriteValues(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public async Task TestUpdateSearchAsync()
|
||||
{
|
||||
UpdateSearcher searcher = new();
|
||||
var res = await searcher.SearchAsync("IsInstalled=1");
|
||||
foreach (var upd in res.Updates)
|
||||
{
|
||||
TestContext.WriteLine(new string('=', 50));
|
||||
TestContext.WriteLine(upd.Title);
|
||||
//upd.WriteValues(false);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSession()
|
||||
{
|
||||
#if WUTYPELIB
|
||||
UpdateSession UpdateSession = new();
|
||||
#endif
|
||||
TestContext.WriteLine($"ClientID: {UpdateSession.ClientApplicationID}, R/O: {UpdateSession.ReadOnly}, Locale: {UpdateSession.UserLocale}, ");
|
||||
UpdateSession.ClientApplicationID = "Test";
|
||||
Assert.That(UpdateSession.ClientApplicationID, Is.EqualTo("Test"));
|
||||
UpdateSession.UserLocale = (uint)LCID.LOCALE_INVARIANT;
|
||||
Assert.That(UpdateSession.UserLocale, Is.EqualTo(LCID.LOCALE_INVARIANT));
|
||||
var wp = UpdateSession.WebProxy;
|
||||
wp.WriteValues(false);
|
||||
wp.UserName = "test";
|
||||
wp.BypassList.Add("168.0.0.1");
|
||||
UpdateSession.WebProxy = wp;
|
||||
wp = UpdateSession.WebProxy;
|
||||
Assert.That(wp.UserName, Is.EqualTo("test"));
|
||||
Assert.That(wp.BypassList, Contains.Item("168.0.0.1"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUpdateServiceManager()
|
||||
{
|
||||
IUpdateServiceManager2 mgr = new()
|
||||
{
|
||||
ClientApplicationID = "Test"
|
||||
};
|
||||
var svcid = Guid.NewGuid().ToString("D");
|
||||
mgr.AddService2(svcid, AddServiceFlag.asfRegisterServiceWithAU | AddServiceFlag.asfAllowPendingRegistration | AddServiceFlag.asfAllowOnlineRegistration, "");
|
||||
UpdateServiceManager mgr = new() { ClientApplicationID = "Test" };
|
||||
foreach (var up in mgr)
|
||||
up.WriteValues();
|
||||
|
||||
var svcid = "7971f918-a847-4430-9279-4a52d1efe18d"; // Guid.NewGuid().ToString("D");
|
||||
var us = mgr.AddService(svcid, AddServiceFlag.asfAllowOnlineRegistration | AddServiceFlag.asfAllowPendingRegistration);
|
||||
Assert.That(us?.ServiceID, Is.EqualTo(svcid));
|
||||
us?.WriteValues();
|
||||
mgr.RemoveService(svcid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if WUTYPELIB
|
||||
internal static class Ext
|
||||
{
|
||||
/*public static UpdateCollection ToCollection(this IEnumerable<IUpdate> items)
|
||||
{
|
||||
if (items is UpdateCollection iuc) return iuc;
|
||||
UpdateCollection c = new();
|
||||
foreach (var i in items)
|
||||
c.Add(i);
|
||||
return c;
|
||||
}*/
|
||||
|
||||
public static Task<IInstallationResult> InstallAsync(this IUpdateInstaller installer, Action<IInstallationProgress> progress, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var task = new TaskCompletionSource<IInstallationResult>();
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
return task.Task;
|
||||
}
|
||||
IInstallationJob? job = null;
|
||||
CancellationTokenRegistration? reg = null;
|
||||
job = installer.BeginInstall(new InstallationProgressChangeCallback(progress), new InstallationCompletedCallback(OnComplete), null);
|
||||
reg = cancellationToken.Register(() =>
|
||||
{
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
job?.RequestAbort();
|
||||
});
|
||||
return task.Task;
|
||||
|
||||
void OnComplete(IInstallationJob _job2, IInstallationCompletedCallbackArgs _)
|
||||
{
|
||||
try
|
||||
{
|
||||
try { task.TrySetResult(installer.EndInstall(_job2)); }
|
||||
catch (Exception e) { task.TrySetException(e); }
|
||||
}
|
||||
finally
|
||||
{
|
||||
job = null;
|
||||
reg?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Task<ISearchResult> SearchAsync(this IUpdateSearcher searcher, string criteria, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var task = new TaskCompletionSource<ISearchResult>();
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
return task.Task;
|
||||
}
|
||||
ISearchJob? job = null;
|
||||
CancellationTokenRegistration? reg = null;
|
||||
job = searcher.BeginSearch(criteria, new SearchCompletedCallback(OnComplete), null);
|
||||
reg = cancellationToken.Register(() =>
|
||||
{
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
job?.RequestAbort();
|
||||
});
|
||||
return task.Task;
|
||||
|
||||
void OnComplete(ISearchJob _job, ISearchCompletedCallbackArgs _)
|
||||
{
|
||||
try
|
||||
{
|
||||
try { task.TrySetResult(searcher.EndSearch(_job)); }
|
||||
catch (Exception e) { task.TrySetException(e); }
|
||||
}
|
||||
finally
|
||||
{
|
||||
job = null;
|
||||
reg?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Task<IDownloadResult> DownloadAsync(this IUpdateDownloader downloader, Action<IDownloadProgress> progress, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
var task = new TaskCompletionSource<IDownloadResult>();
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
return task.Task;
|
||||
}
|
||||
IDownloadJob? job = null;
|
||||
CancellationTokenRegistration? reg = null;
|
||||
job = downloader.BeginDownload(new DownloadProgressChangedCallback(progress), new DownloadCompletedCallback(OnComplete), null);
|
||||
reg = cancellationToken.Register(() =>
|
||||
{
|
||||
task.TrySetCanceled(cancellationToken);
|
||||
job?.RequestAbort();
|
||||
});
|
||||
return task.Task;
|
||||
|
||||
void OnComplete(IDownloadJob _job, IDownloadCompletedCallbackArgs _)
|
||||
{
|
||||
try
|
||||
{
|
||||
try { task.TrySetResult(downloader.EndDownload(_job)); }
|
||||
catch (Exception e) { task.TrySetException(e); }
|
||||
}
|
||||
finally
|
||||
{
|
||||
job = null;
|
||||
reg?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class DownloadProgressChangedCallback(Action<WUApiLib.IDownloadProgress> Action) : WUApiLib.IDownloadProgressChangedCallback
|
||||
{
|
||||
void WUApiLib.IDownloadProgressChangedCallback.Invoke(WUApiLib.IDownloadJob downloadJob, WUApiLib.IDownloadProgressChangedCallbackArgs callbackArgs) => Action?.Invoke(callbackArgs.Progress);
|
||||
}
|
||||
internal class DownloadCompletedCallback(Action<WUApiLib.IDownloadJob, WUApiLib.IDownloadCompletedCallbackArgs> Action) : WUApiLib.IDownloadCompletedCallback
|
||||
{
|
||||
void WUApiLib.IDownloadCompletedCallback.Invoke(WUApiLib.IDownloadJob downloadJob, WUApiLib.IDownloadCompletedCallbackArgs callbackArgs) => Action?.Invoke(downloadJob, callbackArgs);
|
||||
}
|
||||
internal class SearchCompletedCallback(Action<WUApiLib.ISearchJob, WUApiLib.ISearchCompletedCallbackArgs> Action) : WUApiLib.ISearchCompletedCallback
|
||||
{
|
||||
void WUApiLib.ISearchCompletedCallback.Invoke(WUApiLib.ISearchJob searchJob, WUApiLib.ISearchCompletedCallbackArgs callbackArgs) => Action?.Invoke(searchJob, callbackArgs);
|
||||
}
|
||||
internal class InstallationProgressChangeCallback(Action<WUApiLib.IInstallationProgress> Action) : WUApiLib.IInstallationProgressChangedCallback
|
||||
{
|
||||
void WUApiLib.IInstallationProgressChangedCallback.Invoke(WUApiLib.IInstallationJob installationJob, WUApiLib.IInstallationProgressChangedCallbackArgs callbackArgs) => Action?.Invoke(callbackArgs.Progress);
|
||||
}
|
||||
internal class InstallationCompletedCallback(Action<WUApiLib.IInstallationJob, WUApiLib.IInstallationCompletedCallbackArgs> Action) : WUApiLib.IInstallationCompletedCallback
|
||||
{
|
||||
void WUApiLib.IInstallationCompletedCallback.Invoke(WUApiLib.IInstallationJob installationJob, WUApiLib.IInstallationCompletedCallbackArgs callbackArgs) => Action?.Invoke(installationJob, callbackArgs);
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ProjectExtensions>
|
||||
<SupportedDlls>WindowsUpdate.dll</SupportedDlls>
|
||||
</ProjectExtensions>
|
||||
<PropertyGroup>
|
||||
<Description>PInvoke API (methods, structures and constants) imported from Windows WindowsUpdate.dll.</Description>
|
||||
<AssemblyName>Vanara.PInvoke.WindowsUpdate</AssemblyName>
|
||||
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
|
||||
<PackageId>$(AssemblyName)</PackageId>
|
||||
<PackageTags>pinvoke;vanara;net-extensions;interop;WindowsUpdate</PackageTags>
|
||||
<PackageReleaseNotes />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Vanara.Core.csproj" />
|
||||
<ProjectReference Include="..\PInvoke\WUApi\Vanara.PInvoke.WUApi.csproj" />
|
||||
<ProjectReference Include="..\PInvoke\Shared\Vanara.PInvoke.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue