20template<
class _Traits,
class _Ax>
21static UINT
MsiGetPropertyA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szName, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
26 DWORD dwSize = _countof(szStackBuffer);
31 if (uiResult == ERROR_SUCCESS) {
33 sValue.assign(szStackBuffer, dwSize);
35 }
else if (uiResult == ERROR_MORE_DATA) {
37 sValue.resize(dwSize++);
38 return ::MsiGetPropertyA(hInstall, szName, &sValue[0], &dwSize);
50template<
class _Traits,
class _Ax>
51static UINT
MsiGetPropertyW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szName, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
54 DWORD dwSize = _countof(szStackBuffer);
59 if (uiResult == ERROR_SUCCESS) {
61 sValue.assign(szStackBuffer, dwSize);
63 }
else if (uiResult == ERROR_MORE_DATA) {
65 sValue.resize(dwSize++);
66 return ::MsiGetPropertyW(hInstall, szName, &sValue[0], &dwSize);
74template<
class _Traits,
class _Ax>
75static UINT
MsiRecordGetStringA(_In_ MSIHANDLE hRecord, _In_
unsigned int iField, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
80 DWORD dwSize = _countof(szStackBuffer);
85 if (uiResult == ERROR_SUCCESS) {
87 sValue.assign(szStackBuffer, dwSize);
89 }
else if (uiResult == ERROR_MORE_DATA) {
91 sValue.resize(dwSize++);
92 return ::MsiRecordGetStringA(hRecord, iField, &sValue[0], &dwSize);
104template<
class _Traits,
class _Ax>
105static UINT
MsiRecordGetStringW(_In_ MSIHANDLE hRecord, _In_
unsigned int iField, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
108 DWORD dwSize = _countof(szStackBuffer);
113 if (uiResult == ERROR_SUCCESS) {
115 sValue.assign(szStackBuffer, dwSize);
116 return ERROR_SUCCESS;
117 }
else if (uiResult == ERROR_MORE_DATA) {
119 sValue.resize(dwSize++);
120 return ::MsiRecordGetStringW(hRecord, iField, &sValue[0], &dwSize);
128template<
class _Traits,
class _Ax>
129static UINT
MsiFormatRecordA(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
134 DWORD dwSize = _countof(szStackBuffer);
139 if (uiResult == ERROR_SUCCESS) {
141 sValue.assign(szStackBuffer, dwSize);
142 return ERROR_SUCCESS;
143 }
else if (uiResult == ERROR_MORE_DATA) {
145 sValue.resize(dwSize++);
146 return ::MsiFormatRecordA(hInstall, hRecord, &sValue[0], &dwSize);
158template<
class _Traits,
class _Ax>
159static UINT
MsiFormatRecordW(_In_opt_ MSIHANDLE hInstall, _In_ MSIHANDLE hRecord, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
162 DWORD dwSize = _countof(szStackBuffer);
167 if (uiResult == ERROR_SUCCESS) {
169 sValue.assign(szStackBuffer, dwSize);
170 return ERROR_SUCCESS;
171 }
else if (uiResult == ERROR_MORE_DATA) {
173 sValue.resize(dwSize++);
174 return ::MsiFormatRecordW(hInstall, hRecord, &sValue[0], &dwSize);
186template<
class _Ty,
class _Ax>
187static UINT
MsiRecordReadStream(_In_ MSIHANDLE hRecord, _In_
unsigned int iField, _Inout_ std::vector<_Ty, _Ax> &binData)
196 if (uiResult == ERROR_SUCCESS) {
197 binData.resize((dwSize +
sizeof(_Ty) - 1) /
sizeof(_Ty));
198 return ::MsiRecordReadStream(hRecord, iField,
reinterpret_cast<char*
>(binData.data()), &dwSize);
206template<
class _Traits,
class _Ax>
207static UINT
MsiGetTargetPathA(_In_ MSIHANDLE hInstall, _In_z_ LPCSTR szFolder, _Out_ std::basic_string<char, _Traits, _Ax> &sValue)
212 DWORD dwSize = _countof(szStackBuffer);
217 if (uiResult == ERROR_SUCCESS) {
219 sValue.assign(szStackBuffer, dwSize);
220 return ERROR_SUCCESS;
221 }
else if (uiResult == ERROR_MORE_DATA) {
223 sValue.resize(dwSize++);
224 return ::MsiGetTargetPathA(hInstall, szFolder, &sValue[0], &dwSize);
236template<
class _Traits,
class _Ax>
237static UINT
MsiGetTargetPathW(_In_ MSIHANDLE hInstall, _In_z_ LPCWSTR szFolder, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
240 DWORD dwSize = _countof(szStackBuffer);
245 if (uiResult == ERROR_SUCCESS) {
247 sValue.assign(szStackBuffer, dwSize);
248 return ERROR_SUCCESS;
249 }
else if (uiResult == ERROR_MORE_DATA) {
251 sValue.resize(dwSize++);
252 return ::MsiGetTargetPathW(hInstall, szFolder, &sValue[0], &dwSize);
260template<
class _Traits,
class _Ax>
261static INSTALLSTATE
MsiGetComponentPathA(_In_z_ LPCSTR szProduct, _In_z_ LPCSTR szComponent, _Inout_ std::basic_string<char, _Traits, _Ax> &sValue)
264 DWORD dwSize = _countof(szStackBuffer);
269 if (state >= INSTALLSTATE_BROKEN) {
271 sValue.assign(szStackBuffer, dwSize);
273 }
else if (state == INSTALLSTATE_MOREDATA) {
275 sValue.resize(dwSize++);
276 return ::MsiGetComponentPathA(szProduct, szComponent, &sValue[0], &dwSize);
288template<
class _Traits,
class _Ax>
289static INSTALLSTATE
MsiGetComponentPathW(_In_z_ LPCWSTR szProduct, _In_z_ LPCWSTR szComponent, _Inout_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
292 DWORD dwSize = _countof(szStackBuffer);
297 if (state >= INSTALLSTATE_BROKEN) {
299 sValue.assign(szStackBuffer, dwSize);
301 }
else if (state == INSTALLSTATE_MOREDATA) {
303 sValue.resize(dwSize++);
304 return ::MsiGetComponentPathW(szProduct, szComponent, &sValue[0], &dwSize);
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition Common.h:94
static UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Formats record field data and properties using a format string and stores it in a std::wstring string...
Definition MSI.h:159
static UINT MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Gets the value for an installer property and stores it in a std::wstring string.
Definition MSI.h:51
static UINT MsiGetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the full target path for a folder in the Directory table and stores it in a std::wstring stri...
Definition MSI.h:207
static INSTALLSTATE MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the full path to an installed component. If the key path for the component is a registry key ...
Definition MSI.h:261
static UINT MsiRecordGetStringW(MSIHANDLE hRecord, unsigned int iField, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the string value of a record field and stores it in a std::wstring string.
Definition MSI.h:105
static UINT MsiGetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the full target path for a folder in the Directory table and stores it in a std::wstring stri...
Definition MSI.h:237
static UINT MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, std::basic_string< char, _Traits, _Ax > &sValue)
Gets the value for an installer property and stores it in a std::wstring string.
Definition MSI.h:21
static UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, std::basic_string< char, _Traits, _Ax > &sValue)
Formats record field data and properties using a format string and stores it in a std::wstring string...
Definition MSI.h:129
static UINT MsiRecordReadStream(MSIHANDLE hRecord, unsigned int iField, std::vector< _Ty, _Ax > &binData)
Reads bytes from a record stream field into a std::vector buffer.
Definition MSI.h:187
static INSTALLSTATE MsiGetComponentPathW(LPCWSTR szProduct, LPCWSTR szComponent, std::basic_string< wchar_t, _Traits, _Ax > &sValue)
Returns the full path to an installed component. If the key path for the component is a registry key ...
Definition MSI.h:289
static UINT MsiRecordGetStringA(MSIHANDLE hRecord, unsigned int iField, std::basic_string< char, _Traits, _Ax > &sValue)
Returns the string value of a record field and stores it in a std::wstring string.
Definition MSI.h:75