1 #ifndef INCLUDED_MSIHELPER_HXX
2 #define INCLUDED_MSIHELPER_HXX
3 
4 #ifdef _MSC_VER
5 #pragma warning(push, 1) /* disable warnings within system headers */
6 #endif
7 #define WIN32_LEAN_AND_MEAN
8 #include <windows.h>
9 #include <msiquery.h>
10 #ifdef _MSC_VER
11 #pragma warning(pop)
12 #endif
13 
14 #include <string>
15 
16 /**
17     Get the value of the named property
18 
19     @param handle
20     [in] a valid msi handle.
21 
22     @param name
23     [in] the name of the property.
24 
25     @param value
26     [out] receives thes value of the property.
27 
28     @returns
29     <TRUE/>if the property was found.
30 */
31 bool GetMsiProp(MSIHANDLE handle, LPCTSTR name, /*out*/std::wstring& value);
32 
33 /**
34     Set the value of a binary property which can only
35     have the values "0" or "1" to "1".
36 
37     @param handle
38     [in] a valid msi handle.
39 
40     @param name
41     [in] the name of the property.
42 */
43 void SetMsiProp(MSIHANDLE handle, LPCTSTR name);
44 
45 /**
46     Set the value of a binary property which can only
47     have the values "0" or "1" to "0".
48 
49     @param handle
50     [in] a valid msi handle.
51 
52     @param name
53     [in] the name of the property.
54 */
55 void UnsetMsiProp(MSIHANDLE handle, LPCTSTR name);
56 
57 /**
58     Returns whether a certain property is set meaning
59     its value is "1". This method should be used for
60     binary properties whose value can be "0" or "1".
61 
62     @returns
63     <TRUE/>if the value of the specified property is
64     "1" else if the property is not defined or its
65     value is other than "1" <FALSE/> will be returned.
66 */
67 bool IsSetMsiProp(MSIHANDLE handle, LPCTSTR name);
68 
69 /**
70     Returns whether a certain property is set meaning
71     its value is not empty. This method should be used for
72     properties, that can have different values.
73 
74     @returns
75     <TRUE/>if the value of the specified property is
76     not empty. If it is empty <FALSE/> will be returned.
77 */
78 bool IsMsiPropNotEmpty(MSIHANDLE handle, LPCTSTR name);
79 
80 /**
81     Query if this is an installation for all user or not.
82 
83     @param handle
84     [in] a valid msi handle.
85 
86     @returns
87     <TRUE/>if this is an all user installation
88 */
89 bool IsAllUserInstallation(MSIHANDLE handle);
90 
91 /**
92     Returns the destination folder of the office installation
93     as system path. The returned path contains a final '\'.
94 
95     @param handle
96     [in] a valid msi handle.
97 
98     @returns
99     the destination path of the office installation finalized
100     with a '\'.
101 */
102 std::wstring GetOfficeInstallationPath(MSIHANDLE handle);
103 
104 /**
105     Returns the absolute path of the office executable that
106     will be installed as system path.
107 
108     @param handle
109     [in] a valid msi handle.
110 
111     @returns
112     the absolute system path of the office executable (e.g.
113     (C:\Program Files\StarOffice 8\program\soffice.exe").
114 */
115 std::wstring GetOfficeExecutablePath(MSIHANDLE handle);
116 
117 /**
118     Get the name of the office that will be installed
119     (e.g. StarOffice 8, StarSuite 8, ...).
120 
121     @param handle
122     [in] a valid msi handle.
123 
124     @returns
125     the name of the office product that will be installed.
126 */
127 std::wstring GetProductName(MSIHANDLE handle);
128 
129 /**
130     Determine if the specified module is installed locally.
131 
132     @param handle
133     [in] a valid msi handle.
134 
135     @param name
136     [in] the name of the module.
137 
138     @returns
139     <TRUE/>if the specified module is installed locally.
140 */
141 bool IsModuleInstalled(MSIHANDLE handle, LPCTSTR name);
142 
143 /**
144     Determine if the specified module is selected to be installed
145     locally.
146 
147     @param handle
148     [in] a valid msi handle.
149 
150     @param name
151     [in] the name of the module.
152 
153     @returns
154     <TRUE/>if the specified module is about to be installed locally.
155 */
156 bool IsModuleSelectedForInstallation(MSIHANDLE handle, LPCTSTR name);
157 
158 /**
159     Determine if the specified module which is locally installed is
160     selected for deinstallation.
161 
162     @param handle
163     [in] a valid msi handle.
164 
165     @param name
166     [in] the name of the module.
167 
168     @returns
169     <TRUE/>if the specified module is about to be deinstalled.
170 */
171 bool IsModuleSelectedForDeinstallation(MSIHANDLE handle, LPCTSTR name);
172 
173 /**
174     Determine whether this is a complete uninstallation or not.
175 
176     @param handle
177     [in] a valid msi handle.
178 
179     @returns
180     <TRUE/>if this is a complete deinstallation.
181 */
182 bool IsCompleteDeinstallation(MSIHANDLE handle);
183 
184 #endif
185