#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke; public static partial class WscApi { public enum SECURITY_PRODUCT_TYPE { SECURITY_PRODUCT_TYPE_ANTIVIRUS = 0, SECURITY_PRODUCT_TYPE_FIREWALL = 1, SECURITY_PRODUCT_TYPE_ANTISPYWARE = 2 } /// Defines the current state of the security product that is made available to Windows Security Center. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/ne-iwscapi-wsc_security_product_state typedef enum // WSC_SECURITY_PRODUCT_STATE { WSC_SECURITY_PRODUCT_STATE_ON = 0, WSC_SECURITY_PRODUCT_STATE_OFF = 1, WSC_SECURITY_PRODUCT_STATE_SNOOZED // = 2, WSC_SECURITY_PRODUCT_STATE_EXPIRED = 3 } ; [PInvokeData("iwscapi.h", MSDNShortId = "NE:iwscapi.WSC_SECURITY_PRODUCT_STATE")] public enum WSC_SECURITY_PRODUCT_STATE { /// /// Value: /// 0 /// The security product software is turned on and protecting the user. /// WSC_SECURITY_PRODUCT_STATE_ON, /// /// Value: /// 1 /// The security product software is turned off and protection is disabled. /// WSC_SECURITY_PRODUCT_STATE_OFF, /// /// Value: /// 2 /// The security product software is in the snoozed state, temporarily off, and not actively protecting the computer. /// WSC_SECURITY_PRODUCT_STATE_SNOOZED, /// /// Value: /// 3 /// The security product software has expired and is no longer actively protecting the computer. /// WSC_SECURITY_PRODUCT_STATE_EXPIRED, } public enum WSC_SECURITY_PRODUCT_SUBSTATUS { WSC_SECURITY_PRODUCT_SUBSTATUS_NOT_SET = 0, WSC_SECURITY_PRODUCT_SUBSTATUS_NO_ACTION = 1, WSC_SECURITY_PRODUCT_SUBSTATUS_ACTION_RECOMMENDED = 2, WSC_SECURITY_PRODUCT_SUBSTATUS_ACTION_NEEDED = 3 } /// Reports the current version status of the security product to Windows Security Center. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/ne-iwscapi-wsc_security_signature_status typedef enum // _WSC_SECURITY_SIGNATURE_STATUS { WSC_SECURITY_PRODUCT_OUT_OF_DATE = 0, WSC_SECURITY_PRODUCT_UP_TO_DATE = 1 } WSC_SECURITY_SIGNATURE_STATUS; [PInvokeData("iwscapi.h", MSDNShortId = "NE:iwscapi._WSC_SECURITY_SIGNATURE_STATUS")] public enum WSC_SECURITY_SIGNATURE_STATUS { /// /// Value: /// 0 /// The security software reports that it is not the most recent version. /// WSC_SECURITY_PRODUCT_OUT_OF_DATE, /// /// Value: /// 1 /// The security software reports that it is the most recent version. /// WSC_SECURITY_PRODUCT_UP_TO_DATE, } [PInvokeData("iwscapi.h")] [ComImport, Guid("0476d69c-f21a-11e5-9ce9-5e5517507c66"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(WSCDefaultProduct))] public interface IWSCDefaultProduct { [PreserveSig] HRESULT SetDefaultProduct(SECURITY_PRODUCT_TYPE eType, [MarshalAs(UnmanagedType.BStr)] string pGuid); } /// Provides methods for getting product information for an individual provider to interact with Windows Security Center. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nn-iwscapi-iwscproduct [PInvokeData("iwscapi.h", MSDNShortId = "NN:iwscapi.IWscProduct")] [ComImport, Guid("8C38232E-3A45-4A27-92B0-1A16A975F669"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IWscProduct { /// Returns the current product information for the security product. /// A pointer to the name of the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productname HRESULT get_ProductName( [out] // BSTR *pVal ); string ProductName { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Returns the current state of the signature data for the security product. /// A pointer to the state value of the signature of the security product. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productstate HRESULT get_ProductState( // [out] WSC_SECURITY_PRODUCT_STATE *pVal ); WSC_SECURITY_PRODUCT_STATE ProductState { get; } /// Returns the current status of the signature data for the security product. /// /// A pointer to the status value of the signature of the security product. If the security product is a Firewall product, the return /// value is always WSC_SECURITY_PRODUCT_UP_TO_DATE because firewalls do not contain signature data. /// // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_signaturestatus HRESULT // get_SignatureStatus( [out] WSC_SECURITY_SIGNATURE_STATUS *pVal ); WSC_SECURITY_SIGNATURE_STATUS SignatureStatus { get; } /// Returns the current remediation path for the security product. /// A pointer to the remediation path for the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_remediationpath HRESULT // get_RemediationPath( [out] BSTR *pVal ); string RemediationPath { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Returns the current time stamp for the security product. /// A pointer to the time stamp of the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productstatetimestamp HRESULT // get_ProductStateTimestamp( [out] BSTR *pVal ); string ProductStateTimestamp { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets the product unique identifier. /// The product unique identifier. string ProductGuid { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets a value indicating whether [product is default]. /// if [product is default]; otherwise, . bool ProductIsDefault { [return: MarshalAs(UnmanagedType.Bool)] get; } } [PInvokeData("iwscapi.h")] [ComImport, Guid("F896CA54-FE09-4403-86D4-23CB488D81D8"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IWscProduct2 : IWscProduct { /// Returns the current product information for the security product. /// A pointer to the name of the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productname HRESULT get_ProductName( [out] // BSTR *pVal ); new string ProductName { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Returns the current state of the signature data for the security product. /// A pointer to the state value of the signature of the security product. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productstate HRESULT get_ProductState( // [out] WSC_SECURITY_PRODUCT_STATE *pVal ); new WSC_SECURITY_PRODUCT_STATE ProductState { get; } /// Returns the current status of the signature data for the security product. /// /// A pointer to the status value of the signature of the security product. If the security product is a Firewall product, the return /// value is always WSC_SECURITY_PRODUCT_UP_TO_DATE because firewalls do not contain signature data. /// // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_signaturestatus HRESULT // get_SignatureStatus( [out] WSC_SECURITY_SIGNATURE_STATUS *pVal ); new WSC_SECURITY_SIGNATURE_STATUS SignatureStatus { get; } /// Returns the current remediation path for the security product. /// A pointer to the remediation path for the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_remediationpath HRESULT // get_RemediationPath( [out] BSTR *pVal ); new string RemediationPath { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Returns the current time stamp for the security product. /// A pointer to the time stamp of the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productstatetimestamp HRESULT // get_ProductStateTimestamp( [out] BSTR *pVal ); new string ProductStateTimestamp { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets the product unique identifier. /// The product unique identifier. new string ProductGuid { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets a value indicating whether [product is default]. /// if [product is default]; otherwise, . new bool ProductIsDefault { [return: MarshalAs(UnmanagedType.Bool)] get; } WSC_SECURITY_PRODUCT_SUBSTATUS AntivirusScanSubstatus { get; } WSC_SECURITY_PRODUCT_SUBSTATUS AntivirusSettingsSubstatus { get; } WSC_SECURITY_PRODUCT_SUBSTATUS AntivirusProtectionUpdateSubstatus { get; } WSC_SECURITY_PRODUCT_SUBSTATUS FirewallDomainProfileSubstatus { get; } WSC_SECURITY_PRODUCT_SUBSTATUS FirewallPrivateProfileSubstatus { get; } WSC_SECURITY_PRODUCT_SUBSTATUS FirewallPublicProfileSubstatus { get; } } [PInvokeData("iwscapi.h")] [ComImport, Guid("55536524-D1D1-4726-8C7C-04996A1904E7"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IWscProduct3 : IWscProduct2 { /// Returns the current product information for the security product. /// A pointer to the name of the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productname HRESULT get_ProductName( [out] // BSTR *pVal ); new string ProductName { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Returns the current state of the signature data for the security product. /// A pointer to the state value of the signature of the security product. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productstate HRESULT get_ProductState( // [out] WSC_SECURITY_PRODUCT_STATE *pVal ); new WSC_SECURITY_PRODUCT_STATE ProductState { get; } /// Returns the current status of the signature data for the security product. /// /// A pointer to the status value of the signature of the security product. If the security product is a Firewall product, the return /// value is always WSC_SECURITY_PRODUCT_UP_TO_DATE because firewalls do not contain signature data. /// // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_signaturestatus HRESULT // get_SignatureStatus( [out] WSC_SECURITY_SIGNATURE_STATUS *pVal ); new WSC_SECURITY_SIGNATURE_STATUS SignatureStatus { get; } /// Returns the current remediation path for the security product. /// A pointer to the remediation path for the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_remediationpath HRESULT // get_RemediationPath( [out] BSTR *pVal ); new string RemediationPath { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Returns the current time stamp for the security product. /// A pointer to the time stamp of the security product. This is displayed in the Windows Security Center user interface. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproduct-get_productstatetimestamp HRESULT // get_ProductStateTimestamp( [out] BSTR *pVal ); new string ProductStateTimestamp { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets the product unique identifier. /// The product unique identifier. new string ProductGuid { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets a value indicating whether [product is default]. /// if [product is default]; otherwise, . new bool ProductIsDefault { [return: MarshalAs(UnmanagedType.Bool)] get; } new WSC_SECURITY_PRODUCT_SUBSTATUS AntivirusScanSubstatus { get; } new WSC_SECURITY_PRODUCT_SUBSTATUS AntivirusSettingsSubstatus { get; } new WSC_SECURITY_PRODUCT_SUBSTATUS AntivirusProtectionUpdateSubstatus { get; } new WSC_SECURITY_PRODUCT_SUBSTATUS FirewallDomainProfileSubstatus { get; } new WSC_SECURITY_PRODUCT_SUBSTATUS FirewallPrivateProfileSubstatus { get; } new WSC_SECURITY_PRODUCT_SUBSTATUS FirewallPublicProfileSubstatus { get; } uint AntivirusDaysUntilExpired { get; } } /// Provides methods to collect product information for the selected type of providers installed on the computer. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nn-iwscapi-iwscproductlist [PInvokeData("iwscapi.h", MSDNShortId = "NN:iwscapi.IWSCProductList")] [ComImport, Guid("722A338C-6E8E-4E72-AC27-1417FB0C81C2"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(WSCProductList))] public interface IWscProductList { /// Gathers information on all of the providers of the specified type on the computer. /// /// /// A value from the WSC_SECURITY_PROVIDER enumeration with the name of the provider as one of the following values. Note that the /// possible values can't be combined in a logical OR as they can when used with the WscGetSecurityProviderHealth function. /// /// /// /// Value /// Meaning /// /// /// WSC_SECURITY_PROVIDER_ANTIVIRUS /// Antivirus products. /// /// /// WSC_SECURITY_PROVIDER_ANTISPYWARE /// Anti-spyware products. /// /// /// WSC_SECURITY_PROVIDER_FIREWALL /// Firewall products. /// /// /// /// /// If the method succeeds, returns S_OK. /// If the method fails, returns a Win32 error code. /// /// /// Once the client gets an IWSCProductList pointer, they must call Initialize with a provider type, which gathers information /// on all the providers of that type installed on the system. Only one type of provider can be specified when calling /// Initialize, and the Initialize method may only be called once for each instance of an IWSCProductList /// pointer. After the list has been initialized, the user is free to call Count to obtain the number of providers in the list and /// Item to retrieve an individual provider. /// // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproductlist-initialize HRESULT Initialize( [in] ULONG // provider ); void Initialize(WSC_SECURITY_PROVIDER provider); /// Gathers the total number of all security product providers of the specified type on the computer. /// The number of providers in the list of security products on the computer. // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproductlist-get_count HRESULT get_Count( [out] LONG // *pVal ); int Count { get; } /// Returns one of the types of providers on the computer. /// The list of the providers. /// A pointer to the IWscProduct product information. /// /// A provider is obtained by calling the Item method, which returns an interface pointer to an initialized IWscProduct /// object. The user is then able to retrieve the name, product state, and signature status through the methods of the /// IWscProduct interface. /// // https://learn.microsoft.com/en-us/windows/win32/api/iwscapi/nf-iwscapi-iwscproductlist-get_item HRESULT get_Item( [in] ULONG // index, [out] IWscProduct **pVal ); IWscProduct this[uint index] { get; } } /// CLSID_WSCDefaultProduct [ComImport, Guid("2981a36e-f22d-11e5-9ce9-5e5517507c66"), ClassInterface(ClassInterfaceType.None)] public class WSCDefaultProduct { } /// CLSID_WSCProductList [ComImport, Guid("17072F7B-9ABE-4A74-A261-1EB76B55107A"), ClassInterface(ClassInterfaceType.None)] public class WSCProductList { } }