diff options
Diffstat (limited to '')
-rw-r--r-- | src/engine/variable.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/engine/variable.cpp b/src/engine/variable.cpp index ea84752d..51dbdff4 100644 --- a/src/engine/variable.cpp +++ b/src/engine/variable.cpp | |||
@@ -157,10 +157,6 @@ static HRESULT InitializeVariableNumeric( | |||
157 | __in DWORD_PTR dwpData, | 157 | __in DWORD_PTR dwpData, |
158 | __inout BURN_VARIANT* pValue | 158 | __inout BURN_VARIANT* pValue |
159 | ); | 159 | ); |
160 | static HRESULT InitializeVariableRegistryFolder( | ||
161 | __in DWORD_PTR dwpData, | ||
162 | __inout BURN_VARIANT* pValue | ||
163 | ); | ||
164 | static HRESULT InitializeVariable6432Folder( | 160 | static HRESULT InitializeVariable6432Folder( |
165 | __in DWORD_PTR dwpData, | 161 | __in DWORD_PTR dwpData, |
166 | __inout BURN_VARIANT* pValue | 162 | __inout BURN_VARIANT* pValue |
@@ -190,6 +186,13 @@ static HRESULT Get64bitFolderFromRegistry( | |||
190 | __deref_out_z LPWSTR* psczPath | 186 | __deref_out_z LPWSTR* psczPath |
191 | ); | 187 | ); |
192 | 188 | ||
189 | #if !defined(_WIN64) | ||
190 | static HRESULT InitializeVariableRegistryFolder( | ||
191 | __in DWORD_PTR dwpData, | ||
192 | __inout BURN_VARIANT* pValue | ||
193 | ); | ||
194 | #endif | ||
195 | |||
193 | 196 | ||
194 | // function definitions | 197 | // function definitions |
195 | 198 | ||
@@ -1101,13 +1104,17 @@ static HRESULT FormatString( | |||
1101 | LPWSTR* rgVariables = NULL; | 1104 | LPWSTR* rgVariables = NULL; |
1102 | DWORD cVariables = 0; | 1105 | DWORD cVariables = 0; |
1103 | DWORD cch = 0; | 1106 | DWORD cch = 0; |
1107 | size_t cchIn = 0; | ||
1104 | BOOL fHidden = FALSE; | 1108 | BOOL fHidden = FALSE; |
1105 | MSIHANDLE hRecord = NULL; | 1109 | MSIHANDLE hRecord = NULL; |
1106 | 1110 | ||
1107 | ::EnterCriticalSection(&pVariables->csAccess); | 1111 | ::EnterCriticalSection(&pVariables->csAccess); |
1108 | 1112 | ||
1109 | // allocate buffer for format string | 1113 | // allocate buffer for format string |
1110 | hr = StrAlloc(&sczFormat, lstrlenW(wzIn) + 1); | 1114 | hr = ::StringCchLengthW(wzIn, STRSAFE_MAX_CCH - 1, &cchIn); |
1115 | ExitOnFailure(hr, "Failed to length of format string."); | ||
1116 | |||
1117 | hr = StrAlloc(&sczFormat, cchIn + 1); | ||
1111 | ExitOnFailure(hr, "Failed to allocate buffer for format string."); | 1118 | ExitOnFailure(hr, "Failed to allocate buffer for format string."); |
1112 | 1119 | ||
1113 | // read out variables from the unformatted string and build a format string | 1120 | // read out variables from the unformatted string and build a format string |
@@ -1133,7 +1140,7 @@ static HRESULT FormatString( | |||
1133 | ExitOnFailure(hr, "Failed to append string."); | 1140 | ExitOnFailure(hr, "Failed to append string."); |
1134 | break; | 1141 | break; |
1135 | } | 1142 | } |
1136 | cch = wzClose - wzOpen - 1; | 1143 | cch = (DWORD)(wzClose - wzOpen - 1); |
1137 | 1144 | ||
1138 | if (0 == cch) | 1145 | if (0 == cch) |
1139 | { | 1146 | { |
@@ -2170,6 +2177,7 @@ LExit: | |||
2170 | return hr; | 2177 | return hr; |
2171 | } | 2178 | } |
2172 | 2179 | ||
2180 | #if !defined(_WIN64) | ||
2173 | static HRESULT InitializeVariableRegistryFolder( | 2181 | static HRESULT InitializeVariableRegistryFolder( |
2174 | __in DWORD_PTR dwpData, | 2182 | __in DWORD_PTR dwpData, |
2175 | __inout BURN_VARIANT* pValue | 2183 | __inout BURN_VARIANT* pValue |
@@ -2179,7 +2187,6 @@ static HRESULT InitializeVariableRegistryFolder( | |||
2179 | int nFolder = (int)dwpData; | 2187 | int nFolder = (int)dwpData; |
2180 | LPWSTR sczPath = NULL; | 2188 | LPWSTR sczPath = NULL; |
2181 | 2189 | ||
2182 | #if !defined(_WIN64) | ||
2183 | BOOL fIsWow64 = FALSE; | 2190 | BOOL fIsWow64 = FALSE; |
2184 | 2191 | ||
2185 | ProcWow64(::GetCurrentProcess(), &fIsWow64); | 2192 | ProcWow64(::GetCurrentProcess(), &fIsWow64); |
@@ -2187,7 +2194,6 @@ static HRESULT InitializeVariableRegistryFolder( | |||
2187 | { | 2194 | { |
2188 | ExitFunction(); | 2195 | ExitFunction(); |
2189 | } | 2196 | } |
2190 | #endif | ||
2191 | 2197 | ||
2192 | hr = Get64bitFolderFromRegistry(nFolder, &sczPath); | 2198 | hr = Get64bitFolderFromRegistry(nFolder, &sczPath); |
2193 | ExitOnFailure(hr, "Failed to get 64-bit folder."); | 2199 | ExitOnFailure(hr, "Failed to get 64-bit folder."); |
@@ -2201,6 +2207,7 @@ LExit: | |||
2201 | 2207 | ||
2202 | return hr; | 2208 | return hr; |
2203 | } | 2209 | } |
2210 | #endif | ||
2204 | 2211 | ||
2205 | static HRESULT InitializeVariable6432Folder( | 2212 | static HRESULT InitializeVariable6432Folder( |
2206 | __in DWORD_PTR dwpData, | 2213 | __in DWORD_PTR dwpData, |