winapi_ui_automation/um/
appmgmt.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6use shared::guiddef::GUID;
7use shared::minwindef::{BOOL, DWORD, LPDWORD};
8use um::winnt::{LANGID, LCID, LPWSTR, WCHAR};
9ENUM!{enum INSTALLSPECTYPE {
10    APPNAME = 1,
11    FILEEXT,
12    PROGID,
13    COMCLASS,
14}}
15STRUCT!{struct INSTALLSPEC_APPNAME {
16    Name: *mut WCHAR,
17    GPOId: GUID,
18}}
19STRUCT!{struct INSTALLSPEC_COMCLASS {
20    Clsid: GUID,
21    ClsCtx: DWORD,
22}}
23UNION!{union INSTALLSPEC {
24    [u32; 5] [u64; 3],
25    AppName AppName_mut: INSTALLSPEC_APPNAME,
26    FileExt FileExt_mut: *mut WCHAR,
27    ProgId ProgId_mut: *mut WCHAR,
28    COMClass COMClass_mut: INSTALLSPEC_COMCLASS,
29}}
30STRUCT!{struct INSTALLDATA {
31    Type: INSTALLSPECTYPE,
32    Spec: INSTALLSPEC,
33}}
34pub type PINSTALLDATA = *mut INSTALLDATA;
35ENUM!{enum APPSTATE {
36    ABSENT,
37    ASSIGNED,
38    PUBLISHED,
39}}
40pub const LOCALSTATE_ASSIGNED: DWORD = 0x1;
41pub const LOCALSTATE_PUBLISHED: DWORD = 0x2;
42pub const LOCALSTATE_UNINSTALL_UNMANAGED: DWORD = 0x4;
43pub const LOCALSTATE_POLICYREMOVE_ORPHAN: DWORD = 0x8;
44pub const LOCALSTATE_POLICYREMOVE_UNINSTALL: DWORD = 0x10;
45pub const LOCALSTATE_ORPHANED: DWORD = 0x20;
46pub const LOCALSTATE_UNINSTALLED: DWORD = 0x40;
47STRUCT!{struct LOCALMANAGEDAPPLICATION {
48    pszDeploymentName: LPWSTR,
49    pszPolicyName: LPWSTR,
50    pszProductId: LPWSTR,
51    dwState: DWORD,
52}}
53pub type PLOCALMANAGEDAPPLICATION = *mut LOCALMANAGEDAPPLICATION;
54pub const MANAGED_APPS_USERAPPLICATIONS: DWORD = 0x1;
55pub const MANAGED_APPS_FROMCATEGORY: DWORD = 0x2;
56pub const MANAGED_APPS_INFOLEVEL_DEFAULT: DWORD = 0x10000;
57pub const MANAGED_APPTYPE_WINDOWSINSTALLER: DWORD = 0x1;
58pub const MANAGED_APPTYPE_SETUPEXE: DWORD = 0x2;
59pub const MANAGED_APPTYPE_UNSUPPORTED: DWORD = 0x3;
60STRUCT!{struct MANAGEDAPPLICATION {
61    pszPackageName: LPWSTR,
62    pszPublisher: LPWSTR,
63    dwVersionHi: DWORD,
64    dwVersionLo: DWORD,
65    dwRevision: DWORD,
66    GpoId: GUID,
67    pszPolicyName: LPWSTR,
68    ProductId: GUID,
69    Language: LANGID,
70    pszOwner: LPWSTR,
71    pszCompany: LPWSTR,
72    pszComments: LPWSTR,
73    pszContact: LPWSTR,
74    pszSupportUrl: LPWSTR,
75    dwPathType: DWORD,
76    bInstalled: BOOL,
77}}
78pub type PMANAGEDAPPLICATION = *mut MANAGEDAPPLICATION;
79STRUCT!{struct APPCATEGORYINFO {
80    Locale: LCID,
81    pszDescription: LPWSTR,
82    AppCategoryId: GUID,
83}}
84STRUCT!{struct APPCATEGORYINFOLIST {
85    cCategory: DWORD,
86    pCategoryInfo: *mut APPCATEGORYINFO,
87}}
88extern "system" {
89    pub fn InstallApplication(
90        pInstallInfo: PINSTALLDATA,
91    ) -> DWORD;
92    pub fn UninstallApplication(
93        ProductCode: LPWSTR,
94        dwStatus: DWORD,
95    ) -> DWORD;
96    pub fn CommandLineFromMsiDescriptor(
97        Descriptor: LPWSTR,
98        CommandLine: LPWSTR,
99        CommandLineLength: *mut DWORD,
100    ) -> DWORD;
101    pub fn GetManagedApplications(
102        pCategory: *mut GUID,
103        dwQueryFlags: DWORD,
104        dwInfoLevel: DWORD,
105        pdwApps: LPDWORD,
106        prgManagedApps: *mut PMANAGEDAPPLICATION,
107    ) -> DWORD;
108    pub fn GetLocalManagedApplications(
109        bUserApps: BOOL,
110        pdwApps: LPDWORD,
111        prgManagedApps: *mut PMANAGEDAPPLICATION,
112    ) -> DWORD;
113    pub fn GetLocalManagedApplicationData(
114        ProductCode: LPWSTR,
115        DisplayName: *mut LPWSTR,
116        SupportUrl: *mut LPWSTR,
117    );
118    pub fn GetManagedApplicationCategories(
119        dwReserved: DWORD,
120        pAppCategory: *mut APPCATEGORYINFOLIST,
121    ) -> DWORD;
122}