12c7984eaSAndrew Rist /************************************************************** 22c7984eaSAndrew Rist * 32c7984eaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42c7984eaSAndrew Rist * or more contributor license agreements. See the NOTICE file 52c7984eaSAndrew Rist * distributed with this work for additional information 62c7984eaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 72c7984eaSAndrew Rist * to you under the Apache License, Version 2.0 (the 82c7984eaSAndrew Rist * "License"); you may not use this file except in compliance 92c7984eaSAndrew Rist * with the License. You may obtain a copy of the License at 102c7984eaSAndrew Rist * 112c7984eaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 122c7984eaSAndrew Rist * 132c7984eaSAndrew Rist * Unless required by applicable law or agreed to in writing, 142c7984eaSAndrew Rist * software distributed under the License is distributed on an 152c7984eaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162c7984eaSAndrew Rist * KIND, either express or implied. See the License for the 172c7984eaSAndrew Rist * specific language governing permissions and limitations 182c7984eaSAndrew Rist * under the License. 192c7984eaSAndrew Rist * 202c7984eaSAndrew Rist *************************************************************/ 212c7984eaSAndrew Rist 22*102561b7Smseidel 23*102561b7Smseidel 24cdf0e10cSrcweir #ifndef INCLUDED_MSIHELPER_HXX 25cdf0e10cSrcweir #define INCLUDED_MSIHELPER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifdef _MSC_VER 28cdf0e10cSrcweir #pragma warning(push, 1) /* disable warnings within system headers */ 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir #define WIN32_LEAN_AND_MEAN 31cdf0e10cSrcweir #include <windows.h> 32cdf0e10cSrcweir #include <msiquery.h> 33cdf0e10cSrcweir #ifdef _MSC_VER 34cdf0e10cSrcweir #pragma warning(pop) 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <string> 38cdf0e10cSrcweir 39cdf0e10cSrcweir /** 40cdf0e10cSrcweir Get the value of the named property 41cdf0e10cSrcweir 42cdf0e10cSrcweir @param handle 43cdf0e10cSrcweir [in] a valid msi handle. 44cdf0e10cSrcweir 45cdf0e10cSrcweir @param name 46cdf0e10cSrcweir [in] the name of the property. 47cdf0e10cSrcweir 48cdf0e10cSrcweir @param value 49*102561b7Smseidel [out] receives this value of the property. 50cdf0e10cSrcweir 51cdf0e10cSrcweir @returns 52cdf0e10cSrcweir <TRUE/>if the property was found. 53cdf0e10cSrcweir */ 54cdf0e10cSrcweir bool GetMsiProp(MSIHANDLE handle, LPCTSTR name, /*out*/std::wstring& value); 55cdf0e10cSrcweir 56cdf0e10cSrcweir /** 57cdf0e10cSrcweir Set the value of a binary property which can only 58cdf0e10cSrcweir have the values "0" or "1" to "1". 59cdf0e10cSrcweir 60cdf0e10cSrcweir @param handle 61cdf0e10cSrcweir [in] a valid msi handle. 62cdf0e10cSrcweir 63cdf0e10cSrcweir @param name 64cdf0e10cSrcweir [in] the name of the property. 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir void SetMsiProp(MSIHANDLE handle, LPCTSTR name); 67cdf0e10cSrcweir 68cdf0e10cSrcweir /** 69cdf0e10cSrcweir Set the value of a binary property which can only 70cdf0e10cSrcweir have the values "0" or "1" to "0". 71cdf0e10cSrcweir 72cdf0e10cSrcweir @param handle 73cdf0e10cSrcweir [in] a valid msi handle. 74cdf0e10cSrcweir 75cdf0e10cSrcweir @param name 76cdf0e10cSrcweir [in] the name of the property. 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir void UnsetMsiProp(MSIHANDLE handle, LPCTSTR name); 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** 81cdf0e10cSrcweir Returns whether a certain property is set meaning 82cdf0e10cSrcweir its value is "1". This method should be used for 83cdf0e10cSrcweir binary properties whose value can be "0" or "1". 84cdf0e10cSrcweir 85cdf0e10cSrcweir @returns 86cdf0e10cSrcweir <TRUE/>if the value of the specified property is 87cdf0e10cSrcweir "1" else if the property is not defined or its 88cdf0e10cSrcweir value is other than "1" <FALSE/> will be returned. 89cdf0e10cSrcweir */ 90cdf0e10cSrcweir bool IsSetMsiProp(MSIHANDLE handle, LPCTSTR name); 91cdf0e10cSrcweir 92cdf0e10cSrcweir /** 93cdf0e10cSrcweir Returns whether a certain property is set meaning 94cdf0e10cSrcweir its value is not empty. This method should be used for 95cdf0e10cSrcweir properties, that can have different values. 96cdf0e10cSrcweir 97cdf0e10cSrcweir @returns 98cdf0e10cSrcweir <TRUE/>if the value of the specified property is 99cdf0e10cSrcweir not empty. If it is empty <FALSE/> will be returned. 100cdf0e10cSrcweir */ 101cdf0e10cSrcweir bool IsMsiPropNotEmpty(MSIHANDLE handle, LPCTSTR name); 102cdf0e10cSrcweir 103cdf0e10cSrcweir /** 104cdf0e10cSrcweir Query if this is an installation for all user or not. 105cdf0e10cSrcweir 106cdf0e10cSrcweir @param handle 107cdf0e10cSrcweir [in] a valid msi handle. 108cdf0e10cSrcweir 109cdf0e10cSrcweir @returns 110cdf0e10cSrcweir <TRUE/>if this is an all user installation 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir bool IsAllUserInstallation(MSIHANDLE handle); 113cdf0e10cSrcweir 114cdf0e10cSrcweir /** 115cdf0e10cSrcweir Returns the destination folder of the office installation 116cdf0e10cSrcweir as system path. The returned path contains a final '\'. 117cdf0e10cSrcweir 118cdf0e10cSrcweir @param handle 119cdf0e10cSrcweir [in] a valid msi handle. 120cdf0e10cSrcweir 121cdf0e10cSrcweir @returns 122cdf0e10cSrcweir the destination path of the office installation finalized 123cdf0e10cSrcweir with a '\'. 124cdf0e10cSrcweir */ 125cdf0e10cSrcweir std::wstring GetOfficeInstallationPath(MSIHANDLE handle); 126cdf0e10cSrcweir 127cdf0e10cSrcweir /** 128cdf0e10cSrcweir Returns the absolute path of the office executable that 129cdf0e10cSrcweir will be installed as system path. 130cdf0e10cSrcweir 131cdf0e10cSrcweir @param handle 132cdf0e10cSrcweir [in] a valid msi handle. 133cdf0e10cSrcweir 134cdf0e10cSrcweir @returns 135cdf0e10cSrcweir the absolute system path of the office executable (e.g. 136*102561b7Smseidel "C:\Program Files (x86)\OpenOffice 4\program\soffice.exe"). 137cdf0e10cSrcweir */ 138cdf0e10cSrcweir std::wstring GetOfficeExecutablePath(MSIHANDLE handle); 139cdf0e10cSrcweir 140cdf0e10cSrcweir /** 141cdf0e10cSrcweir Get the name of the office that will be installed 142cdf0e10cSrcweir 143cdf0e10cSrcweir @param handle 144cdf0e10cSrcweir [in] a valid msi handle. 145cdf0e10cSrcweir 146cdf0e10cSrcweir @returns 147cdf0e10cSrcweir the name of the office product that will be installed. 148cdf0e10cSrcweir */ 149cdf0e10cSrcweir std::wstring GetProductName(MSIHANDLE handle); 150cdf0e10cSrcweir 151cdf0e10cSrcweir /** 152cdf0e10cSrcweir Determine if the specified module is installed locally. 153cdf0e10cSrcweir 154cdf0e10cSrcweir @param handle 155cdf0e10cSrcweir [in] a valid msi handle. 156cdf0e10cSrcweir 157cdf0e10cSrcweir @param name 158cdf0e10cSrcweir [in] the name of the module. 159cdf0e10cSrcweir 160cdf0e10cSrcweir @returns 161cdf0e10cSrcweir <TRUE/>if the specified module is installed locally. 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir bool IsModuleInstalled(MSIHANDLE handle, LPCTSTR name); 164cdf0e10cSrcweir 165cdf0e10cSrcweir /** 166cdf0e10cSrcweir Determine if the specified module is selected to be installed 167cdf0e10cSrcweir locally. 168cdf0e10cSrcweir 169cdf0e10cSrcweir @param handle 170cdf0e10cSrcweir [in] a valid msi handle. 171cdf0e10cSrcweir 172cdf0e10cSrcweir @param name 173cdf0e10cSrcweir [in] the name of the module. 174cdf0e10cSrcweir 175cdf0e10cSrcweir @returns 176cdf0e10cSrcweir <TRUE/>if the specified module is about to be installed locally. 177cdf0e10cSrcweir */ 178cdf0e10cSrcweir bool IsModuleSelectedForInstallation(MSIHANDLE handle, LPCTSTR name); 179cdf0e10cSrcweir 180cdf0e10cSrcweir /** 181cdf0e10cSrcweir Determine if the specified module which is locally installed is 182cdf0e10cSrcweir selected for deinstallation. 183cdf0e10cSrcweir 184cdf0e10cSrcweir @param handle 185cdf0e10cSrcweir [in] a valid msi handle. 186cdf0e10cSrcweir 187cdf0e10cSrcweir @param name 188cdf0e10cSrcweir [in] the name of the module. 189cdf0e10cSrcweir 190cdf0e10cSrcweir @returns 191cdf0e10cSrcweir <TRUE/>if the specified module is about to be deinstalled. 192cdf0e10cSrcweir */ 193cdf0e10cSrcweir bool IsModuleSelectedForDeinstallation(MSIHANDLE handle, LPCTSTR name); 194cdf0e10cSrcweir 195cdf0e10cSrcweir /** 196*102561b7Smseidel Determine whether this is a complete deinstallation or not. 197cdf0e10cSrcweir 198cdf0e10cSrcweir @param handle 199cdf0e10cSrcweir [in] a valid msi handle. 200cdf0e10cSrcweir 201cdf0e10cSrcweir @returns 202cdf0e10cSrcweir <TRUE/>if this is a complete deinstallation. 203cdf0e10cSrcweir */ 204cdf0e10cSrcweir bool IsCompleteDeinstallation(MSIHANDLE handle); 205cdf0e10cSrcweir 206cdf0e10cSrcweir #endif 207