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. 6 use shared::guiddef::GUID; 7 use shared::minwindef::{BOOL, DWORD, LPDWORD}; 8 use um::winnt::{LANGID, LCID, LPWSTR, WCHAR}; 9 ENUM!{enum INSTALLSPECTYPE { 10 APPNAME = 1, 11 FILEEXT, 12 PROGID, 13 COMCLASS, 14 }} 15 STRUCT!{struct INSTALLSPEC_APPNAME { 16 Name: *mut WCHAR, 17 GPOId: GUID, 18 }} 19 STRUCT!{struct INSTALLSPEC_COMCLASS { 20 Clsid: GUID, 21 ClsCtx: DWORD, 22 }} 23 UNION!{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 }} 30 STRUCT!{struct INSTALLDATA { 31 Type: INSTALLSPECTYPE, 32 Spec: INSTALLSPEC, 33 }} 34 pub type PINSTALLDATA = *mut INSTALLDATA; 35 ENUM!{enum APPSTATE { 36 ABSENT, 37 ASSIGNED, 38 PUBLISHED, 39 }} 40 pub const LOCALSTATE_ASSIGNED: DWORD = 0x1; 41 pub const LOCALSTATE_PUBLISHED: DWORD = 0x2; 42 pub const LOCALSTATE_UNINSTALL_UNMANAGED: DWORD = 0x4; 43 pub const LOCALSTATE_POLICYREMOVE_ORPHAN: DWORD = 0x8; 44 pub const LOCALSTATE_POLICYREMOVE_UNINSTALL: DWORD = 0x10; 45 pub const LOCALSTATE_ORPHANED: DWORD = 0x20; 46 pub const LOCALSTATE_UNINSTALLED: DWORD = 0x40; 47 STRUCT!{struct LOCALMANAGEDAPPLICATION { 48 pszDeploymentName: LPWSTR, 49 pszPolicyName: LPWSTR, 50 pszProductId: LPWSTR, 51 dwState: DWORD, 52 }} 53 pub type PLOCALMANAGEDAPPLICATION = *mut LOCALMANAGEDAPPLICATION; 54 pub const MANAGED_APPS_USERAPPLICATIONS: DWORD = 0x1; 55 pub const MANAGED_APPS_FROMCATEGORY: DWORD = 0x2; 56 pub const MANAGED_APPS_INFOLEVEL_DEFAULT: DWORD = 0x10000; 57 pub const MANAGED_APPTYPE_WINDOWSINSTALLER: DWORD = 0x1; 58 pub const MANAGED_APPTYPE_SETUPEXE: DWORD = 0x2; 59 pub const MANAGED_APPTYPE_UNSUPPORTED: DWORD = 0x3; 60 STRUCT!{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 }} 78 pub type PMANAGEDAPPLICATION = *mut MANAGEDAPPLICATION; 79 STRUCT!{struct APPCATEGORYINFO { 80 Locale: LCID, 81 pszDescription: LPWSTR, 82 AppCategoryId: GUID, 83 }} 84 STRUCT!{struct APPCATEGORYINFOLIST { 85 cCategory: DWORD, 86 pCategoryInfo: *mut APPCATEGORYINFO, 87 }} 88 extern "system" { InstallApplication( pInstallInfo: PINSTALLDATA, ) -> DWORD89 pub fn InstallApplication( 90 pInstallInfo: PINSTALLDATA, 91 ) -> DWORD; UninstallApplication( ProductCode: LPWSTR, dwStatus: DWORD, ) -> DWORD92 pub fn UninstallApplication( 93 ProductCode: LPWSTR, 94 dwStatus: DWORD, 95 ) -> DWORD; CommandLineFromMsiDescriptor( Descriptor: LPWSTR, CommandLine: LPWSTR, CommandLineLength: *mut DWORD, ) -> DWORD96 pub fn CommandLineFromMsiDescriptor( 97 Descriptor: LPWSTR, 98 CommandLine: LPWSTR, 99 CommandLineLength: *mut DWORD, 100 ) -> DWORD; GetManagedApplications( pCategory: *mut GUID, dwQueryFlags: DWORD, dwInfoLevel: DWORD, pdwApps: LPDWORD, prgManagedApps: *mut PMANAGEDAPPLICATION, ) -> DWORD101 pub fn GetManagedApplications( 102 pCategory: *mut GUID, 103 dwQueryFlags: DWORD, 104 dwInfoLevel: DWORD, 105 pdwApps: LPDWORD, 106 prgManagedApps: *mut PMANAGEDAPPLICATION, 107 ) -> DWORD; GetLocalManagedApplications( bUserApps: BOOL, pdwApps: LPDWORD, prgManagedApps: *mut PMANAGEDAPPLICATION, ) -> DWORD108 pub fn GetLocalManagedApplications( 109 bUserApps: BOOL, 110 pdwApps: LPDWORD, 111 prgManagedApps: *mut PMANAGEDAPPLICATION, 112 ) -> DWORD; GetLocalManagedApplicationData( ProductCode: LPWSTR, DisplayName: *mut LPWSTR, SupportUrl: *mut LPWSTR, )113 pub fn GetLocalManagedApplicationData( 114 ProductCode: LPWSTR, 115 DisplayName: *mut LPWSTR, 116 SupportUrl: *mut LPWSTR, 117 ); GetManagedApplicationCategories( dwReserved: DWORD, pAppCategory: *mut APPCATEGORYINFOLIST, ) -> DWORD118 pub fn GetManagedApplicationCategories( 119 dwReserved: DWORD, 120 pAppCategory: *mut APPCATEGORYINFOLIST, 121 ) -> DWORD; 122 } 123