using System;
using System.Runtime.InteropServices;
using Vanara.Extensions;
using Vanara.InteropServices;
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;
namespace Vanara.PInvoke;
public static partial class Shell32
{
/// Specifies application management actions supported by an application publisher. These flags are bitmasks passed to IShellApp::GetPossibleActions.
///
/// The Add or Remove Programs application in Control Panel uses only APPACTION_INSTALL and
/// APPACTION_ADDLATER for published applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/ne-shappmgr-appactionflags typedef enum _tagAppActionFlags {
// APPACTION_INSTALL = 0x1, APPACTION_UNINSTALL = 0x2, APPACTION_MODIFY = 0x4, APPACTION_REPAIR = 0x8, APPACTION_UPGRADE = 0x10,
// APPACTION_CANGETSIZE = 0x20, APPACTION_MODIFYREMOVE = 0x80, APPACTION_ADDLATER = 0x100, APPACTION_UNSCHEDULE = 0x200 } APPACTIONFLAGS;
[PInvokeData("shappmgr.h", MSDNShortId = "NE:shappmgr._tagAppActionFlags")]
[Flags]
public enum APPACTIONFLAGS : uint
{
///
/// Value:
/// 0x1
/// Indicates that the application can be installed. Published applications always set this bit.
///
APPACTION_INSTALL = 0x1,
///
/// Value:
/// 0x2
/// Not applicable to published applications.
///
APPACTION_UNINSTALL = 0x2,
///
/// Value:
/// 0x4
/// Not applicable to published applications.
///
APPACTION_MODIFY = 0x4,
///
/// Value:
/// 0x8
/// Not applicable to published applications.
///
APPACTION_REPAIR = 0x8,
///
/// Value:
/// 0x10
/// Not applicable to published applications.
///
APPACTION_UPGRADE = 0x10,
///
/// Value:
/// 0x20
/// Not applicable to published applications.
///
APPACTION_CANGETSIZE = 0x20,
///
/// Value:
/// 0x80
/// Not applicable to published applications.
///
APPACTION_MODIFYREMOVE = 0x80,
///
/// Value:
/// 0x100
///
/// Indicates that the application supports scheduled installation. If this bit is set, then the Control Panel's Add or Remove
/// Programs application presents the user an
///
/// Add Later
/// button. If you select
/// Add Later
/// , you are prompted to select the desired time of installation. The
/// IPublishedApp::Install
/// method is then called with the installation time.
///
APPACTION_ADDLATER = 0x100,
///
/// Value:
/// 0x200
/// Obsolete.
///
APPACTION_UNSCHEDULE = 0x200,
}
///
/// Specifies application information to return from IShellApp::GetAppInfo. These flags are bitmasks used in the dwMask member of the
/// APPINFODATA structure.
///
/// Add/Remove Programs in Control Panel uses only AIM_DISPLAYNAME and AIM_SUPPORTURL.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/ne-shappmgr-appinfodataflags typedef enum _tagAppInfoFlags {
// AIM_DISPLAYNAME = 0x1, AIM_VERSION = 0x2, AIM_PUBLISHER = 0x4, AIM_PRODUCTID = 0x8, AIM_REGISTEREDOWNER = 0x10, AIM_REGISTEREDCOMPANY
// = 0x20, AIM_LANGUAGE = 0x40, AIM_SUPPORTURL = 0x80, AIM_SUPPORTTELEPHONE = 0x100, AIM_HELPLINK = 0x200, AIM_INSTALLLOCATION = 0x400,
// AIM_INSTALLSOURCE = 0x800, AIM_INSTALLDATE = 0x1000, AIM_CONTACT = 0x4000, AIM_COMMENTS = 0x8000, AIM_IMAGE = 0x20000, AIM_READMEURL =
// 0x40000, AIM_UPDATEINFOURL = 0x80000 } APPINFODATAFLAGS;
[PInvokeData("shappmgr.h", MSDNShortId = "NE:shappmgr._tagAppInfoFlags")]
[Flags]
public enum APPINFODATAFLAGS : uint
{
///
/// Value:
/// 0x1
/// Returns the display name.
///
AIM_DISPLAYNAME = 0x1,
///
/// Value:
/// 0x2
/// Returns the version.
///
AIM_VERSION = 0x2,
///
/// Value:
/// 0x4
/// Returns the application publisher.
///
AIM_PUBLISHER = 0x4,
///
/// Value:
/// 0x8
/// Returns the application's product ID.
///
AIM_PRODUCTID = 0x8,
///
/// Value:
/// 0x10
/// Returns the application's registered owner.
///
AIM_REGISTEREDOWNER = 0x10,
///
/// Value:
/// 0x20
/// Returns the application's registered company.
///
AIM_REGISTEREDCOMPANY = 0x20,
///
/// Value:
/// 0x40
/// Returns the language.
///
AIM_LANGUAGE = 0x40,
///
/// Value:
/// 0x80
/// Returns the support URL.
///
AIM_SUPPORTURL = 0x80,
///
/// Value:
/// 0x100
/// Returns the support telephone number.
///
AIM_SUPPORTTELEPHONE = 0x100,
///
/// Value:
/// 0x200
/// Returns the Help link.
///
AIM_HELPLINK = 0x200,
///
/// Value:
/// 0x400
/// Returns the application's install location.
///
AIM_INSTALLLOCATION = 0x400,
///
/// Value:
/// 0x800
/// Returns the install source.
///
AIM_INSTALLSOURCE = 0x800,
///
/// Value:
/// 0x1000
/// Returns the application's install date.
///
AIM_INSTALLDATE = 0x1000,
///
/// Value:
/// 0x4000
/// Returns the application's contact information.
///
AIM_CONTACT = 0x4000,
///
/// Value:
/// 0x8000
/// Returns application comments.
///
AIM_COMMENTS = 0x8000,
///
/// Value:
/// 0x20000
/// Returns the application image.
///
AIM_IMAGE = 0x20000,
///
/// Value:
/// 0x40000
/// Returns the URL of the application's ReadMe file.
///
AIM_READMEURL = 0x40000,
///
/// Value:
/// 0x80000
/// Returns the URL of the application's update information.
///
AIM_UPDATEINFOURL = 0x80000,
}
///
/// Specifies which members in the PUBAPPINFO structure are valid. These flags are bitmasks set in the dwMask member and passed to IPublishedApp::GetPublishedAppInfo.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/ne-shappmgr-pubappinfoflags typedef enum _tagPublishedAppInfoFlags {
// PAI_SOURCE = 0x1, PAI_ASSIGNEDTIME = 0x2, PAI_PUBLISHEDTIME = 0x4, PAI_SCHEDULEDTIME = 0x8, PAI_EXPIRETIME = 0x10 } PUBAPPINFOFLAGS;
[PInvokeData("shappmgr.h", MSDNShortId = "NE:shappmgr._tagPublishedAppInfoFlags")]
[Flags]
public enum PUBAPPINFOFLAGS : uint
{
///
/// Value:
/// 0x1
/// The
/// pszSource
///
/// string is valid and contains the display name of the publishing source. If multiple sources publish an application of the same
/// name, Add/Remove Programs identifies them by "<application name> : <publishing source>".
///
///
PAI_SOURCE = 0x1,
///
/// Value:
/// 0x2
/// The
/// stAssigned
/// member is valid and contains the time that the application should be installed as assigned by an application administrator.
///
PAI_ASSIGNEDTIME = 0x2,
///
/// Value:
/// 0x4
/// Not used.
///
PAI_PUBLISHEDTIME = 0x4,
///
/// Value:
/// 0x8
/// The
/// stScheduled
/// member is valid and contains the time that the application should be installed as assigned by the user.
///
PAI_SCHEDULEDTIME = 0x8,
///
/// Value:
/// 0x10
/// The
/// stExpired
/// member is valid and contains the time after which Add/Remove Programs should no longer install the program.
///
PAI_EXPIRETIME = 0x10,
}
///
/// Exposes methods for publishing applications through Add/Remove Programs in Control Panel. This is the principal interface
/// implemented for this purpose.
///
///
///
/// Add/Remove Programs in Control Panel creates a registered publisher object and requests its IAppPublisher interface.
/// You can create published application objects using the application enumerator, which you create using IAppPublisher.
///
///
/// Add/Remove Programs gathers a list of published applications from publishers and then uses a publisher to display these
/// applications with Microsoft Active Directory. When the user clicks Add New Programs in Add/Remove Programs, a list of
/// published applications appears.
///
/// You can publish applications in Add/Remove Programs using the following Component Object Model (COM) interfaces.
///
/// -
/// IAppPublisher
///
/// -
/// IEnumPublishedApps
///
/// -
/// IPublishedApp
///
///
///
/// When you implement these interfaces, you must register your COM object in the registry. To register your publisher, add your object's
/// class identifier (CLSID) under the following registry key.
///
/// HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\AppManagement\Publishers
///
/// For example, if your publisher is named "My Publisher", you create a new key under "Publishers" named "My Publisher" with its default
/// REG_SZ value as the publisher's CLSID:
///
/// HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\AppManagement\Publishers\My Publisher (Default) = {4D05CD3D-FFED-46bb-B9F1-321C26BE6362}
/// You can also create the typical COM server registration entries as follows:
///
/// HKEY_CLASSES_ROOT\CLSID\{469EE8CE-1B86-4524-9042-AAA44FD9C8F2} (Default) = Sample Applications Publisher
/// InProcServer32 (Default) = pubdemo.dll ThreadingModel = Apartment
///
///
/// With the publisher registered in this way, Add/Remove Programs creates an instance of your object by calling CoCreateInstance
/// for your object and requesting the appropriate IAppPublisher interface when the Add New Programs view is populated.
/// Using IAppPublisher, Add/Remove Programs retrieves the application enumerator (IEnumPublishedApps) and information that
/// describes the published applications. Your implementation of IPublishedApp is responsible for installing the associated application
/// in its IPublishedApp::Install method. Add/Remove Programs calls this method when the user clicks the Add or the Add
/// Later button in the user interface.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nn-shappmgr-iapppublisher
[PInvokeData("shappmgr.h", MSDNShortId = "NN:shappmgr.IAppPublisher")]
[ComImport, Guid("07250A10-9CF9-11D1-9076-006008059382"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAppPublisher
{
/// Obsolete. Clients of the Add/Remove Programs Control Panel Application may return E_NOTIMPL.
/// This parameter is unused.
/// This method does not return a value.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-iapppublisher-getnumberofcategories HRESULT
// GetNumberOfCategories( DWORD *pdwCat );
[PreserveSig, Obsolete]
HRESULT GetNumberOfCategories(out uint pdwCat);
/// Retrieves a structure listing the categories provided by an application publisher.
///
/// Type: APPCATEGORYINFOLIST*
///
/// A pointer to an APPCATEGORYINFOLIST structure. This structure's cCategory member returns the count of supported
/// categories. The pCategoryInfo member returns a pointer to an array of APPCATEGORYINFO structures. This array contains all
/// the categories an application publisher supports and must be allocated using CoTaskMemAlloc and freed using CoTaskMemFree.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
///
/// The Add/Remove Programs Control Panel Application passes the ID returned for a category to the IAppPublisher::EnumApps method to
/// identify which category is to be enumerated.
///
/// Examples
/// The following example shows how to calculate the size of the array of APPCATEGORYINFO structures that is returned by IAppPublisher::GetCategories.
///
/// size_t CategoryListArraySize = sizeof(APPCATEGORYINFO) * pInfoList->cCategory;
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-iapppublisher-getcategories HRESULT GetCategories( [out]
// APPCATEGORYINFOLIST *pAppCategoryList );
[PreserveSig]
HRESULT GetCategories(out APPCATEGORYINFOLIST pAppCategoryList);
/// Obsolete. Clients of Add/Remove Programs Control Panel Application can return E_NOTIMPL.
/// This parameter is unused.
/// This method does not return a value.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-iapppublisher-getnumberofapps HRESULT GetNumberOfApps(
// DWORD *pdwApps );
[PreserveSig, Obsolete]
HRESULT GetNumberOfApps(out uint pdwApps);
/// Creates an enumerator for enumerating all applications published by an application publisher for a given category.
///
/// Type: GUID*
///
/// A pointer to a GUID that specifies the application category to be enumerated. This must be one of the categories provided through
/// IAppPublisher::GetCategories. If pAppCategoryID identifies a category not provided through
/// IAppPublisher::GetCategories, creation of the enumerator succeeds with the enumerator returning zero items. If this
/// parameter value is NULL, the enumerator returns applications published for all categories.
///
///
///
/// Type: IEnumPublishedApps**
///
/// The address of a pointer to an IEnumPublishedApps reference variable that points to a IEnumPublishedApps interface.
/// Application publishers must create an enumeration object that supports the IEnumPublishedApps interface, and return its
/// pointer value through this parameter.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Note IEnumPublishedApps is not a standard enumeration interface. It does not support a Skip method nor does its Next
/// method support retrieval of multiple items.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-iapppublisher-enumapps HRESULT EnumApps( [in] GUID
// *pAppCategoryId, [out] IEnumPublishedApps **ppepa );
[PreserveSig]
unsafe HRESULT EnumApps([In, Optional] Guid* pAppCategoryId, out IEnumPublishedApps ppepa);
}
///
/// Exposes methods that enumerate published applications to Add/Remove Programs in the Control Panel. The object exposing this interface
/// is requested through IAppPublisher::EnumApps.
///
///
/// To publish applications to Add/Remove Programs in the Control Panel, you must support IEnumPublishedApps, IAppPublisher and IPublishedApp.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nn-shappmgr-ienumpublishedapps
[PInvokeData("shappmgr.h", MSDNShortId = "NN:shappmgr.IEnumPublishedApps")]
[ComImport, Guid("0B124F8C-91F0-11D1-B8B5-006008059382"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IEnumPublishedApps
{
/// Gets the next IPublishedApp object in the enumeration.
///
/// Type: IPublishedApp**
///
/// A pointer to an IPublishedApp interface reference variable that returns the next application object. Note that the category of
/// the application object returned must match that passed into EnumApps.
///
///
///
/// Type: HRESULT
/// Returns S_OK if an item is returned, S_FALSE if there are no more items to enumerate, a COM-defined error value otherwise.
///
///
/// Note IEnumPublishedApps is not a standard enumeration interface. It does not support a Skip method, nor does its Next
/// method support retrieval of multiple items.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ienumpublishedapps-next HRESULT Next( [out] IPublishedApp
// **pia );
[PreserveSig]
HRESULT Next(out IPublishedApp pia);
/// Resets the enumeration of IPublishedApp objects to the first item.
///
/// Type: HRESULT
/// Returns the following value.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// This method only returns S_OK.
///
///
///
///
/// Note IEnumPublishedApps is not a standard enumeration interface.
/// It does not support a Skip method nor does its Next method support retrieval of multiple items.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ienumpublishedapps-reset HRESULT Reset();
[PreserveSig]
HRESULT Reset();
}
/// Exposes methods that represent applications to Add/Remove Programs in Control Panel.
///
/// To publish applications to Add/Remove Programs in Control Panel, you must support IEnumPublishedApps, IAppPublisher and IPublishedApp.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nn-shappmgr-ipublishedapp
[PInvokeData("shappmgr.h", MSDNShortId = "NN:shappmgr.IPublishedApp")]
[ComImport, Guid("1BC752E0-9046-11D1-B8B3-006008059382"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPublishedApp : IShellApp
{
/// Gets general information about an application.
///
/// Type: APPINFODATA*
/// A pointer to an APPINFODATA structure that returns the application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Note Add/Remove Programs in the Control Panel sets the cbSize and dwMask members of the APPINFODATA structure.
///
/// Your implementation should validate cbSize by comparing it with the size of APPINFODATA. If cbSize does not equal the size of
/// APPINFODATA, this method should return a COM error value like E_FAIL.
///
///
/// Add/Remove Programs in the Control Panel will set the dwMask member of the APPINFODATA structure to indicate that you should
/// return AIM_DISPLAYNAME and AIM_SUPPORTURL. For each value that you return in APPINFODATA, you must set the corresponding bit in
/// dwMask. All other bits should be cleared.
///
/// Examples
/// Here is a sample of how to use the dwMask bits::
///
/// HRESULT CPubApp::GetAppInfo(APPINFODATA *pData) { if (sizeof(APPINFODATA) != pData->cbSize) return E_FAIL; // First save off the mask of requested data items. const DWORD dwMask = pData->dwMask; // Zero-out the mask. Bits will be set as items are obtained. pData->dwMask = 0; // Call an internal function that obtains data and sets // bits in pData->dwMask for each item obtained. return get_app_info_data(pData, dwMask); }
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getappinfo HRESULT GetAppInfo( [out]
// PAPPINFODATA pai );
[PreserveSig]
new HRESULT GetAppInfo(ref APPINFODATA pai);
/// Gets a bitmask of management actions allowed for an application.
///
/// Type: DWORD*
///
/// A pointer to a variable of type DWORD that returns the bitmask of supported actions. The bit flags are described in APPACTIONFLAGS.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// Of the set of APPACTIONFLAGS bitmasks, Add/Remove Programs only recognizes APPACTION_INSTALL and APPACTION_ADDLATER.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getpossibleactions HRESULT GetPossibleActions(
// [out] DWORD *pdwActions );
[PreserveSig]
new HRESULT GetPossibleActions(out APPACTIONFLAGS pdwActions);
///
/// Returns information to the application that originates from a slow source. This method is not applicable to published applications.
///
///
/// Type: PSLOWAPPINFO
/// A pointer to a SLOWAPPINFO structure in which to return application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Implementations of IPublishedApp should return E_NOTIMPL. This method is used internally by Add/Remove Programs for installed applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getslowappinfo HRESULT GetSlowAppInfo( [out]
// PSLOWAPPINFO psaid );
[PreserveSig]
new HRESULT GetSlowAppInfo(out SLOWAPPINFO psaid);
///
/// Returns information to the application that originates from a slow source. Unlike IShellApp::GetSlowAppInfo, this method can
/// return information that has been cached. This method is not applicable to published applications.
///
///
/// Type: PSLOWAPPINFO
/// A pointer to a SLOWAPPINFO structure in which to return application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Implementations of IPublishedApp return E_NOTIMPL. This method is used internally by Add/Remove Programs for installed applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getcachedslowappinfo HRESULT
// GetCachedSlowAppInfo( [out] PSLOWAPPINFO psaid );
[PreserveSig]
new HRESULT GetCachedSlowAppInfo(out SLOWAPPINFO psaid);
/// Gets a value indicating whether a specified application is currently installed.
///
/// Type: HRESULT
/// This method can return one of these values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The application is installed.
///
/// -
/// S_FALSE
/// The application is not installed.
///
///
///
///
/// Application publishers should determine if the application is currently installed and return S_OK if so, or S_FALSE if not.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-isinstalled HRESULT IsInstalled();
[PreserveSig]
new HRESULT IsInstalled();
///
/// Installs an application published by an application publisher. This method is invoked when the user selects Add or Add
/// Later in Add/Remove Programs in Control Panel.
///
///
/// Type: LPSYSTEMTIME
///
/// A pointer to a SYSTEMTIME structure that specifies the time the user elected to schedule installation through the Add
/// Later button in Add/Remove Programs. This option is only available if the application supports scheduled installation
/// (compare GetPossibleActions). If this parameter is NULL, the application should be installed immediately.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp-install HRESULT Install( [in] LPSYSTEMTIME
// pstInstall );
[PreserveSig]
unsafe HRESULT Install([In, Optional] SYSTEMTIME* pstInstall);
/// Gets publishing-related information about an application published by an application publisher.
///
/// Type: PUBAPPINFO*
/// A pointer to an PUBAPPINFO structure that returns the application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
///
/// The dwMask member of the PUBAPPINFO structure indicates which members have been requested. Note that Add/Remove Programs will not
/// set the PAI_SCHEDULEDTIME and PAI_EXPIREDTIME bits. However, the corresponding values stScheduled and stExpired will be used when
/// applicable if the implementation provides them. A publisher should provide this data if it is available.
///
/// Examples
/// The example shows a sample implementation:
///
/// HRESULT CPubApp::GetPublishedAppInfo(PUBAPPINFO *pInfo) { if (sizeof(PUBAPPINFO) != pInfo->cbSize) return E_FAIL; // Add/Remove Programs will use these items but will not ask for them. pInfo->dwMask |= (PAI_EXPIRETIME | PAI_SCHEDULEDTIME); // First save off the mask of requested data items. const DWORD dwMask = pInfo->dwMask; // Zero-out the mask. The bits should be set as items are retrieved. pInfo->dwMask = 0; // Call an internal function that obtains data and sets // bits in pInfo->dwMask for each item obtained. return get_pub_app_info(pInfo, dwMask); }
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp-getpublishedappinfo HRESULT
// GetPublishedAppInfo( [out] PPUBAPPINFO ppai );
[PreserveSig]
HRESULT GetPublishedAppInfo(ref PUBAPPINFO ppai);
/// Cancels the installation of an application published by an application publisher.
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// This method is called in each of the following circumstances.
///
/// -
///
/// The user selected the Do Not Add Program option in the Add Later dialog box in Add/Remove Programs in
/// Control Panel.
///
///
/// -
///
/// The user has selected an installation time later than either the expiration time or the assigned time as specified in the
/// published application information. In these circumstances, implementations are expected to cancel any scheduled installation for
/// the application.
///
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp-unschedule HRESULT Unschedule();
[PreserveSig]
HRESULT Unschedule();
}
/// Extends the IPublishedApp interface by providing an additional installation method.
/// This interface also provides the methods of the IPublishedApp interface, from which it inherits.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nn-shappmgr-ipublishedapp2
[PInvokeData("shappmgr.h", MSDNShortId = "NN:shappmgr.IPublishedApp2")]
[ComImport, Guid("12B81347-1B3A-4A04-AA61-3F768B67FD7E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPublishedApp2 : IPublishedApp
{
/// Gets general information about an application.
///
/// Type: APPINFODATA*
/// A pointer to an APPINFODATA structure that returns the application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Note Add/Remove Programs in the Control Panel sets the cbSize and dwMask members of the APPINFODATA structure.
///
/// Your implementation should validate cbSize by comparing it with the size of APPINFODATA. If cbSize does not equal the size of
/// APPINFODATA, this method should return a COM error value like E_FAIL.
///
///
/// Add/Remove Programs in the Control Panel will set the dwMask member of the APPINFODATA structure to indicate that you should
/// return AIM_DISPLAYNAME and AIM_SUPPORTURL. For each value that you return in APPINFODATA, you must set the corresponding bit in
/// dwMask. All other bits should be cleared.
///
/// Examples
/// Here is a sample of how to use the dwMask bits::
///
/// HRESULT CPubApp::GetAppInfo(APPINFODATA *pData) { if (sizeof(APPINFODATA) != pData->cbSize) return E_FAIL; // First save off the mask of requested data items. const DWORD dwMask = pData->dwMask; // Zero-out the mask. Bits will be set as items are obtained. pData->dwMask = 0; // Call an internal function that obtains data and sets // bits in pData->dwMask for each item obtained. return get_app_info_data(pData, dwMask); }
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getappinfo HRESULT GetAppInfo( [out]
// PAPPINFODATA pai );
[PreserveSig]
new HRESULT GetAppInfo(ref APPINFODATA pai);
/// Gets a bitmask of management actions allowed for an application.
///
/// Type: DWORD*
///
/// A pointer to a variable of type DWORD that returns the bitmask of supported actions. The bit flags are described in APPACTIONFLAGS.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// Of the set of APPACTIONFLAGS bitmasks, Add/Remove Programs only recognizes APPACTION_INSTALL and APPACTION_ADDLATER.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getpossibleactions HRESULT GetPossibleActions(
// [out] DWORD *pdwActions );
[PreserveSig]
new HRESULT GetPossibleActions(out APPACTIONFLAGS pdwActions);
///
/// Returns information to the application that originates from a slow source. This method is not applicable to published applications.
///
///
/// Type: PSLOWAPPINFO
/// A pointer to a SLOWAPPINFO structure in which to return application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Implementations of IPublishedApp should return E_NOTIMPL. This method is used internally by Add/Remove Programs for installed applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getslowappinfo HRESULT GetSlowAppInfo( [out]
// PSLOWAPPINFO psaid );
[PreserveSig]
new HRESULT GetSlowAppInfo(out SLOWAPPINFO psaid);
///
/// Returns information to the application that originates from a slow source. Unlike IShellApp::GetSlowAppInfo, this method can
/// return information that has been cached. This method is not applicable to published applications.
///
///
/// Type: PSLOWAPPINFO
/// A pointer to a SLOWAPPINFO structure in which to return application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Implementations of IPublishedApp return E_NOTIMPL. This method is used internally by Add/Remove Programs for installed applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getcachedslowappinfo HRESULT
// GetCachedSlowAppInfo( [out] PSLOWAPPINFO psaid );
[PreserveSig]
new HRESULT GetCachedSlowAppInfo(out SLOWAPPINFO psaid);
/// Gets a value indicating whether a specified application is currently installed.
///
/// Type: HRESULT
/// This method can return one of these values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The application is installed.
///
/// -
/// S_FALSE
/// The application is not installed.
///
///
///
///
/// Application publishers should determine if the application is currently installed and return S_OK if so, or S_FALSE if not.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-isinstalled HRESULT IsInstalled();
[PreserveSig]
new HRESULT IsInstalled();
///
/// Installs an application published by an application publisher. This method is invoked when the user selects Add or Add
/// Later in Add/Remove Programs in Control Panel.
///
///
/// Type: LPSYSTEMTIME
///
/// A pointer to a SYSTEMTIME structure that specifies the time the user elected to schedule installation through the Add
/// Later button in Add/Remove Programs. This option is only available if the application supports scheduled installation
/// (compare GetPossibleActions). If this parameter is NULL, the application should be installed immediately.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp-install HRESULT Install( [in] LPSYSTEMTIME
// pstInstall );
[PreserveSig]
new unsafe HRESULT Install([In, Optional] SYSTEMTIME* pstInstall);
/// Gets publishing-related information about an application published by an application publisher.
///
/// Type: PUBAPPINFO*
/// A pointer to an PUBAPPINFO structure that returns the application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
///
/// The dwMask member of the PUBAPPINFO structure indicates which members have been requested. Note that Add/Remove Programs will not
/// set the PAI_SCHEDULEDTIME and PAI_EXPIREDTIME bits. However, the corresponding values stScheduled and stExpired will be used when
/// applicable if the implementation provides them. A publisher should provide this data if it is available.
///
/// Examples
/// The example shows a sample implementation:
///
/// HRESULT CPubApp::GetPublishedAppInfo(PUBAPPINFO *pInfo) { if (sizeof(PUBAPPINFO) != pInfo->cbSize) return E_FAIL; // Add/Remove Programs will use these items but will not ask for them. pInfo->dwMask |= (PAI_EXPIRETIME | PAI_SCHEDULEDTIME); // First save off the mask of requested data items. const DWORD dwMask = pInfo->dwMask; // Zero-out the mask. The bits should be set as items are retrieved. pInfo->dwMask = 0; // Call an internal function that obtains data and sets // bits in pInfo->dwMask for each item obtained. return get_pub_app_info(pInfo, dwMask); }
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp-getpublishedappinfo HRESULT
// GetPublishedAppInfo( [out] PPUBAPPINFO ppai );
[PreserveSig]
new HRESULT GetPublishedAppInfo(ref PUBAPPINFO ppai);
/// Cancels the installation of an application published by an application publisher.
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// This method is called in each of the following circumstances.
///
/// -
///
/// The user selected the Do Not Add Program option in the Add Later dialog box in Add/Remove Programs in
/// Control Panel.
///
///
/// -
///
/// The user has selected an installation time later than either the expiration time or the assigned time as specified in the
/// published application information. In these circumstances, implementations are expected to cancel any scheduled installation for
/// the application.
///
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp-unschedule HRESULT Unschedule();
[PreserveSig]
new HRESULT Unschedule();
///
/// Installs an application published by an application publisher, while preventing multiple windows from being active on the same thread.
///
///
/// Type: LPSYSTEMTIME
/// A pointer to a SYSTEMTIME structure.
///
///
/// Type: HWND
/// A handle to the parent window.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ipublishedapp2-install2 HRESULT Install2( [in]
// LPSYSTEMTIME pstInstall, [in] HWND hwndParent );
[PreserveSig]
unsafe HRESULT Install2([In, Optional] SYSTEMTIME* pstInstall, [In, Optional] HWND* hwndParent);
}
///
/// Exposes methods that provide general information about an application to the Add/Remove Programs Application. You cannot use it
/// outside the Add/Remove Programs application. The information given by this interface includes a list of supported management actions
/// and whether the application is currently installed.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nn-shappmgr-ishellapp
[PInvokeData("shappmgr.h", MSDNShortId = "NN:shappmgr.IShellApp")]
[ComImport, Guid("A3E14960-935F-11D1-B8B8-006008059382"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IShellApp
{
/// Gets general information about an application.
/// A pointer to an APPINFODATA structure that returns the application information.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// Note Add/Remove Programs in the Control Panel sets the cbSize and dwMask members of the APPINFODATA structure.
///
/// Your implementation should validate cbSize by comparing it with the size of APPINFODATA. If cbSize does not equal the size of
/// APPINFODATA, this method should return a COM error value like E_FAIL.
///
///
/// Add/Remove Programs in the Control Panel will set the dwMask member of the APPINFODATA structure to indicate that you should
/// return AIM_DISPLAYNAME and AIM_SUPPORTURL. For each value that you return in APPINFODATA, you must set the corresponding bit in
/// dwMask. All other bits should be cleared.
///
/// Examples
/// Here is a sample of how to use the dwMask bits::
///
/// HRESULT CPubApp::GetAppInfo(APPINFODATA *pData)
/// {
/// if (sizeof(APPINFODATA) != pData->cbSize)
/// return E_FAIL;
/// // First save off the mask of requested data items.
/// const DWORD dwMask = pData->dwMask;
/// // Zero-out the mask. Bits will be set as items are obtained.
/// pData->dwMask = 0;
/// // Call an internal function that obtains data and sets
/// // bits in pData->dwMask for each item obtained.
/// return get_app_info_data(pData, dwMask);
/// }
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getappinfo HRESULT GetAppInfo( [out]
// PAPPINFODATA pai );
[PreserveSig]
HRESULT GetAppInfo(ref APPINFODATA pai);
/// Gets a bitmask of management actions allowed for an application.
///
/// Type: DWORD*
///
/// A pointer to a variable of type DWORD that returns the bitmask of supported actions. The bit flags are described in APPACTIONFLAGS.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// Of the set of APPACTIONFLAGS bitmasks, Add/Remove Programs only recognizes APPACTION_INSTALL and APPACTION_ADDLATER.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getpossibleactions HRESULT GetPossibleActions(
// [out] DWORD *pdwActions );
[PreserveSig]
HRESULT GetPossibleActions(out APPACTIONFLAGS pdwActions);
///
/// Returns information to the application that originates from a slow source. This method is not applicable to published applications.
///
///
/// Type: PSLOWAPPINFO
/// A pointer to a SLOWAPPINFO structure in which to return application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Implementations of IPublishedApp should return E_NOTIMPL. This method is used internally by Add/Remove Programs for installed applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getslowappinfo HRESULT GetSlowAppInfo( [out]
// PSLOWAPPINFO psaid );
[PreserveSig]
HRESULT GetSlowAppInfo(out SLOWAPPINFO psaid);
///
/// Returns information to the application that originates from a slow source. Unlike IShellApp::GetSlowAppInfo, this method can
/// return information that has been cached. This method is not applicable to published applications.
///
///
/// Type: PSLOWAPPINFO
/// A pointer to a SLOWAPPINFO structure in which to return application information.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Implementations of IPublishedApp return E_NOTIMPL. This method is used internally by Add/Remove Programs for installed applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-getcachedslowappinfo HRESULT
// GetCachedSlowAppInfo( [out] PSLOWAPPINFO psaid );
[PreserveSig]
HRESULT GetCachedSlowAppInfo(out SLOWAPPINFO psaid);
/// Gets a value indicating whether a specified application is currently installed.
///
/// Type: HRESULT
/// This method can return one of these values.
///
///
/// Return code
/// Description
///
/// -
/// S_OK
/// The application is installed.
///
/// -
/// S_FALSE
/// The application is not installed.
///
///
///
///
/// Application publishers should determine if the application is currently installed and return S_OK if so, or S_FALSE if not.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/nf-shappmgr-ishellapp-isinstalled HRESULT IsInstalled();
[PreserveSig]
HRESULT IsInstalled();
}
///
/// Provides application category information to Add/Remove Programs in Control Panel. The APPCATEGORYINFOLIST structure is used create a
/// complete list of categories for an application publisher.
///
// https://docs.microsoft.com/en-us/windows/win32/api/appmgmt/ns-appmgmt-appcategoryinfo typedef struct _APPCATEGORYINFO { LCID Locale;
// LPWSTR pszDescription; GUID AppCategoryId; } APPCATEGORYINFO;
[PInvokeData("appmgmt.h", MSDNShortId = "NS:appmgmt._APPCATEGORYINFO")]
[StructLayout(LayoutKind.Sequential)]
public struct APPCATEGORYINFO
{
///
/// Type: LCID
/// Unused.
///
public LCID Locale;
internal StrPtrUni pszDescription;
///
/// A string containing the display name of the category. This string displays in the Category list in Add/Remove
/// Programs.
///
public string Description
{
get => pszDescription.ToString();
set => pszDescription.Assign(value);
}
///
/// Type: GUID
/// A GUID identifying the application category.
///
public Guid AppCategoryId;
}
/// Provides a list of supported application categories from an application publisher to Add/Remove Programs in Control Panel.
// https://docs.microsoft.com/en-us/windows/win32/api/appmgmt/ns-appmgmt-appcategoryinfolist typedef struct _APPCATEGORYINFOLIST { DWORD
// cCategory; APPCATEGORYINFO *pCategoryInfo; } APPCATEGORYINFOLIST;
[PInvokeData("appmgmt.h", MSDNShortId = "NS:appmgmt._APPCATEGORYINFOLIST")]
[StructLayout(LayoutKind.Sequential)]
public struct APPCATEGORYINFOLIST
{
///
/// Type: DWORD
/// A value of type DWORD that specifies the count of APPCATEGORYINFO elements in the array pointed to by pCategoryInfo.
///
public int cCategory;
private IntPtr pCategoryInfo;
/// An array of APPCATEGORYINFO structures. This array contains all the categories an application publisher supports.
public APPCATEGORYINFO[] CategoryInfo
{
get => pCategoryInfo.ToArray(cCategory);
set { Free(); pCategoryInfo = value is null ? default : value.MarshalToPtr(Marshal.AllocCoTaskMem, out _); cCategory = value?.Length ?? 0; }
}
/// Releases the memory allocated for .
public void Free()
{
if (pCategoryInfo == default) return;
foreach (var i in CategoryInfo)
i.pszDescription.Free();
Marshal.FreeCoTaskMem(pCategoryInfo);
pCategoryInfo = default;
}
}
/// Provides information about a published application to the Add/Remove Programs Control Panel utility.
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/ns-shappmgr-appinfodata typedef struct _AppInfoData { DWORD cbSize; DWORD
// dwMask; LPWSTR pszDisplayName; LPWSTR pszVersion; LPWSTR pszPublisher; LPWSTR pszProductID; LPWSTR pszRegisteredOwner; LPWSTR
// pszRegisteredCompany; LPWSTR pszLanguage; LPWSTR pszSupportUrl; LPWSTR pszSupportTelephone; LPWSTR pszHelpLink; LPWSTR
// pszInstallLocation; LPWSTR pszInstallSource; LPWSTR pszInstallDate; LPWSTR pszContact; LPWSTR pszComments; LPWSTR pszImage; LPWSTR
// pszReadmeUrl; LPWSTR pszUpdateInfoUrl; } APPINFODATA, *PAPPINFODATA;
[PInvokeData("shappmgr.h", MSDNShortId = "NS:shappmgr._AppInfoData")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct APPINFODATA
{
///
/// Type: DWORD
///
/// A value of type DWORD that specifies the size of the APPINFODATA data structure. This field is set by the
/// Add/Remove Program executable code.
///
///
public uint cbSize;
///
/// Type: DWORD
///
/// A value of type DWORD that specifies the bitmask that indicates which items in the structure are desired or valid.
/// Implementations of GetAppInfo should inspect this value for bits that are set and attempt to provide values corresponding to
/// those bits. Implementations should also return with bits set for only those members that are being returned.
///
///
public APPINFODATAFLAGS dwMask;
///
/// Type: LPWSTR
///
/// A pointer to a string that contains the application display name. Memory for this string must be allocated using CoTaskMemAlloc
/// and freed using CoTaskMemFree.
///
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszDisplayName;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszVersion;
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszPublisher;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszProductID;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszRegisteredOwner;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszRegisteredCompany;
///
/// Type: LPWSTR
/// Not applicable to published applications.
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszLanguage;
///
/// Type: LPWSTR
///
/// A URL to support information. This string is displayed as a link with the application name in Control Panel Add/Remove Programs.
/// Memory for this string must be allocated using CoTaskMemAlloc and freed using CoTaskMemFree.
///
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszSupportUrl;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszSupportTelephone;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszHelpLink;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszInstallLocation;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszInstallSource;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszInstallDate;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszContact;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszComments;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszImage;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszReadmeUrl;
///
/// Type: LPWSTR
/// Not applicable to published applications.
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszUpdateInfoUrl;
}
///
/// Provides information about a published application from an application publisher to Add/Remove Programs in Control Panel.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/ns-shappmgr-pubappinfo typedef struct _PubAppInfo { DWORD cbSize; DWORD
// dwMask; LPWSTR pszSource; SYSTEMTIME stAssigned; SYSTEMTIME stPublished; SYSTEMTIME stScheduled; SYSTEMTIME stExpire; } PUBAPPINFO, *PPUBAPPINFO;
[PInvokeData("shappmgr.h", MSDNShortId = "NS:shappmgr._PubAppInfo")]
[StructLayout(LayoutKind.Sequential)]
public struct PUBAPPINFO
{
///
/// Type: DWORD
///
/// A value of type DWORD that specifies the size of the structure. This member is set by the Add/Remove Programs utility.
///
///
public uint cbSize;
///
/// Type: DWORD
/// A bitmask that indicates which items in the structure are valid. This member can contain one or more PUBAPPINFOFLAGS.
///
public PUBAPPINFOFLAGS dwMask;
///
/// Type: LPWSTR
///
/// A pointer to a string containing the display name of the publisher. This name appears in Add/Remove Programs if duplicate
/// application names are encountered. The string buffer must be allocated using the Shell task allocator.
///
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszSource;
///
/// Type: SYSTEMTIME
///
/// The time when an application manager schedules the application installation. Add/Remove Programs does not allow the user
/// to schedule an installation time later than the value in this member. This member is ignored if it describes a time prior to the
/// current time.
///
///
public SYSTEMTIME stAssigned;
/// Type: SYSTEMTIME
public SYSTEMTIME stPublished;
///
/// Type: SYSTEMTIME
///
/// The installation time that the user sets by clicking Add Later. Add/Remove Programs calls the
/// IPublishedApp::Install method with the pInstallTime parameter pointing to a SYSTEMTIME structure that contains the time
/// the user entered. The application publisher maintains this value for installation scheduling. IPublishedApp::GetPublishedAppInfo
/// returns the scheduled installation time in this member if the scheduled time has not been canceled using IPublishedApp::Unschedule.
///
///
public SYSTEMTIME stScheduled;
///
/// Type: SYSTEMTIME
/// The time after which you cannot install the published application using Add/Remove Programs.
///
public SYSTEMTIME stExpire;
}
///
/// Provides specialized application information to Add/Remove Programs in Control Panel. This structure is not applicable to
/// published applications.
///
///
/// This structure is used by the IShellApp::GetSlowAppInfo and IShellApp::GetCachedSlowAppInfo interfaces, neither of which are
/// applicable to published applications. Therefore, this structure is also not applicable to published applications.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shappmgr/ns-shappmgr-slowappinfo typedef struct _tagSlowAppInfo { ULONGLONG
// ullSize; FILETIME ftLastUsed; int iTimesUsed; LPWSTR pszImage; } SLOWAPPINFO, *PSLOWAPPINFO;
[PInvokeData("shappmgr.h", MSDNShortId = "NS:shappmgr._tagSlowAppInfo")]
[StructLayout(LayoutKind.Sequential)]
public struct SLOWAPPINFO
{
///
/// Type: ULONGLONG
/// The size of the application in bytes.
///
public ulong ullSize;
///
/// Type: FILETIME
/// The time the application was last used.
///
public FILETIME ftLastUsed;
///
/// Type: int
/// The count of times the application has been used.
///
public int iTimesUsed;
///
/// Type: LPWSTR
///
/// A pointer to a string containing the path to the image that represents the application. The string buffer must be allocated using
/// CoTaskMemAlloc and freed using CoTaskMemFree.
///
///
[MarshalAs(UnmanagedType.LPWStr)]
public string pszImage;
}
}