diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/regutil.h')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/regutil.h | 161 |
1 files changed, 154 insertions, 7 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/regutil.h b/src/libs/dutil/WixToolset.DUtil/inc/regutil.h index fcf13054..ae47f75e 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/regutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/regutil.h | |||
@@ -99,9 +99,23 @@ typedef LSTATUS (APIENTRY *PFN_REGDELETEVALUEW)( | |||
99 | __in_opt LPCWSTR lpValueName | 99 | __in_opt LPCWSTR lpValueName |
100 | ); | 100 | ); |
101 | 101 | ||
102 | /******************************************************************** | ||
103 | RegInitialize - initializes regutil | ||
104 | |||
105 | *********************************************************************/ | ||
102 | HRESULT DAPI RegInitialize(); | 106 | HRESULT DAPI RegInitialize(); |
107 | |||
108 | /******************************************************************** | ||
109 | RegUninitialize - uninitializes regutil | ||
110 | |||
111 | *********************************************************************/ | ||
103 | void DAPI RegUninitialize(); | 112 | void DAPI RegUninitialize(); |
104 | 113 | ||
114 | /******************************************************************** | ||
115 | RegFunctionOverride - overrides the registry functions. Typically used | ||
116 | for unit testing. | ||
117 | |||
118 | *********************************************************************/ | ||
105 | void DAPI RegFunctionOverride( | 119 | void DAPI RegFunctionOverride( |
106 | __in_opt PFN_REGCREATEKEYEXW pfnRegCreateKeyExW, | 120 | __in_opt PFN_REGCREATEKEYEXW pfnRegCreateKeyExW, |
107 | __in_opt PFN_REGOPENKEYEXW pfnRegOpenKeyExW, | 121 | __in_opt PFN_REGOPENKEYEXW pfnRegOpenKeyExW, |
@@ -113,12 +127,22 @@ void DAPI RegFunctionOverride( | |||
113 | __in_opt PFN_REGSETVALUEEXW pfnRegSetValueExW, | 127 | __in_opt PFN_REGSETVALUEEXW pfnRegSetValueExW, |
114 | __in_opt PFN_REGDELETEVALUEW pfnRegDeleteValueW | 128 | __in_opt PFN_REGDELETEVALUEW pfnRegDeleteValueW |
115 | ); | 129 | ); |
130 | |||
131 | /******************************************************************** | ||
132 | RegCreate - creates a registry key. | ||
133 | |||
134 | *********************************************************************/ | ||
116 | HRESULT DAPI RegCreate( | 135 | HRESULT DAPI RegCreate( |
117 | __in HKEY hkRoot, | 136 | __in HKEY hkRoot, |
118 | __in_z LPCWSTR wzSubKey, | 137 | __in_z LPCWSTR wzSubKey, |
119 | __in DWORD dwAccess, | 138 | __in DWORD dwAccess, |
120 | __out HKEY* phk | 139 | __out HKEY* phk |
121 | ); | 140 | ); |
141 | |||
142 | /******************************************************************** | ||
143 | RegCreateEx - creates a registry key with extra options. | ||
144 | |||
145 | *********************************************************************/ | ||
122 | HRESULT DAPI RegCreateEx( | 146 | HRESULT DAPI RegCreateEx( |
123 | __in HKEY hkRoot, | 147 | __in HKEY hkRoot, |
124 | __in_z LPCWSTR wzSubKey, | 148 | __in_z LPCWSTR wzSubKey, |
@@ -128,112 +152,229 @@ HRESULT DAPI RegCreateEx( | |||
128 | __out HKEY* phk, | 152 | __out HKEY* phk, |
129 | __out_opt BOOL* pfCreated | 153 | __out_opt BOOL* pfCreated |
130 | ); | 154 | ); |
155 | |||
156 | /******************************************************************** | ||
157 | RegOpen - opens a registry key. | ||
158 | |||
159 | *********************************************************************/ | ||
131 | HRESULT DAPI RegOpen( | 160 | HRESULT DAPI RegOpen( |
132 | __in HKEY hkRoot, | 161 | __in HKEY hkRoot, |
133 | __in_z LPCWSTR wzSubKey, | 162 | __in_z LPCWSTR wzSubKey, |
134 | __in DWORD dwAccess, | 163 | __in DWORD dwAccess, |
135 | __out HKEY* phk | 164 | __out HKEY* phk |
136 | ); | 165 | ); |
166 | |||
167 | /******************************************************************** | ||
168 | RegDelete - deletes a registry key (and optionally it's whole tree). | ||
169 | |||
170 | *********************************************************************/ | ||
137 | HRESULT DAPI RegDelete( | 171 | HRESULT DAPI RegDelete( |
138 | __in HKEY hkRoot, | 172 | __in HKEY hkRoot, |
139 | __in_z LPCWSTR wzSubKey, | 173 | __in_z LPCWSTR wzSubKey, |
140 | __in REG_KEY_BITNESS kbKeyBitness, | 174 | __in REG_KEY_BITNESS kbKeyBitness, |
141 | __in BOOL fDeleteTree | 175 | __in BOOL fDeleteTree |
142 | ); | 176 | ); |
177 | |||
178 | /******************************************************************** | ||
179 | RegKeyEnum - enumerates child registry keys. | ||
180 | |||
181 | *********************************************************************/ | ||
143 | HRESULT DAPI RegKeyEnum( | 182 | HRESULT DAPI RegKeyEnum( |
144 | __in HKEY hk, | 183 | __in HKEY hk, |
145 | __in DWORD dwIndex, | 184 | __in DWORD dwIndex, |
146 | __deref_out_z LPWSTR* psczKey | 185 | __deref_out_z LPWSTR* psczKey |
147 | ); | 186 | ); |
187 | |||
188 | /******************************************************************** | ||
189 | RegValueEnum - enumerates registry values. | ||
190 | |||
191 | *********************************************************************/ | ||
148 | HRESULT DAPI RegValueEnum( | 192 | HRESULT DAPI RegValueEnum( |
149 | __in HKEY hk, | 193 | __in HKEY hk, |
150 | __in DWORD dwIndex, | 194 | __in DWORD dwIndex, |
151 | __deref_out_z LPWSTR* psczName, | 195 | __deref_out_z LPWSTR* psczName, |
152 | __out_opt DWORD *pdwType | 196 | __out_opt DWORD *pdwType |
153 | ); | 197 | ); |
198 | |||
199 | /******************************************************************** | ||
200 | RegGetType - reads a registry key value type. | ||
201 | *********************************************************************/ | ||
154 | HRESULT DAPI RegGetType( | 202 | HRESULT DAPI RegGetType( |
155 | __in HKEY hk, | 203 | __in HKEY hk, |
156 | __in_z_opt LPCWSTR wzName, | 204 | __in_z_opt LPCWSTR wzName, |
157 | __out DWORD *pdwType | 205 | __out DWORD *pdwType |
158 | ); | 206 | ); |
207 | |||
208 | /******************************************************************** | ||
209 | RegReadBinary - reads a registry key binary value. | ||
210 | NOTE: caller is responsible for freeing *ppbBuffer | ||
211 | *********************************************************************/ | ||
159 | HRESULT DAPI RegReadBinary( | 212 | HRESULT DAPI RegReadBinary( |
160 | __in HKEY hk, | 213 | __in HKEY hk, |
161 | __in_z_opt LPCWSTR wzName, | 214 | __in_z_opt LPCWSTR wzName, |
162 | __deref_out_bcount_opt(*pcbBuffer) BYTE** ppbBuffer, | 215 | __deref_out_bcount_opt(*pcbBuffer) BYTE** ppbBuffer, |
163 | __out SIZE_T *pcbBuffer | 216 | __out SIZE_T *pcbBuffer |
164 | ); | 217 | ); |
218 | |||
219 | /******************************************************************** | ||
220 | RegReadString - reads a registry key value as a string. | ||
221 | |||
222 | *********************************************************************/ | ||
165 | HRESULT DAPI RegReadString( | 223 | HRESULT DAPI RegReadString( |
166 | __in HKEY hk, | 224 | __in HKEY hk, |
167 | __in_z_opt LPCWSTR wzName, | 225 | __in_z_opt LPCWSTR wzName, |
168 | __deref_out_z LPWSTR* psczValue | 226 | __deref_out_z LPWSTR* psczValue |
169 | ); | 227 | ); |
228 | |||
229 | /******************************************************************** | ||
230 | RegReadStringArray - reads a registry key value REG_MULTI_SZ value as a string array. | ||
231 | |||
232 | *********************************************************************/ | ||
170 | HRESULT DAPI RegReadStringArray( | 233 | HRESULT DAPI RegReadStringArray( |
171 | __in HKEY hk, | 234 | __in HKEY hk, |
172 | __in_z_opt LPCWSTR wzName, | 235 | __in_z_opt LPCWSTR wzName, |
173 | __deref_out_ecount_opt(*pcStrings) LPWSTR** prgsczStrings, | 236 | __deref_out_ecount_opt(*pcStrings) LPWSTR** prgsczStrings, |
174 | __out DWORD *pcStrings | 237 | __out DWORD *pcStrings |
175 | ); | 238 | ); |
239 | |||
240 | /******************************************************************** | ||
241 | RegReadVersion - reads a registry key value as a version. | ||
242 | |||
243 | *********************************************************************/ | ||
176 | HRESULT DAPI RegReadVersion( | 244 | HRESULT DAPI RegReadVersion( |
177 | __in HKEY hk, | 245 | __in HKEY hk, |
178 | __in_z_opt LPCWSTR wzName, | 246 | __in_z_opt LPCWSTR wzName, |
179 | __out DWORD64* pdw64Version | 247 | __out DWORD64* pdw64Version |
180 | ); | 248 | ); |
249 | |||
250 | /******************************************************************** | ||
251 | RegReadNone - reads a NONE registry key value. | ||
252 | |||
253 | *********************************************************************/ | ||
181 | HRESULT DAPI RegReadNone( | 254 | HRESULT DAPI RegReadNone( |
182 | __in HKEY hk, | 255 | __in HKEY hk, |
183 | __in_z_opt LPCWSTR wzName | 256 | __in_z_opt LPCWSTR wzName |
184 | ); | 257 | ); |
258 | |||
259 | /******************************************************************** | ||
260 | RegReadNumber - reads a DWORD registry key value as a number. | ||
261 | |||
262 | *********************************************************************/ | ||
185 | HRESULT DAPI RegReadNumber( | 263 | HRESULT DAPI RegReadNumber( |
186 | __in HKEY hk, | 264 | __in HKEY hk, |
187 | __in_z_opt LPCWSTR wzName, | 265 | __in_z_opt LPCWSTR wzName, |
188 | __out DWORD* pdwValue | 266 | __out DWORD* pdwValue |
189 | ); | 267 | ); |
268 | |||
269 | /******************************************************************** | ||
270 | RegReadQword - reads a QWORD registry key value as a number. | ||
271 | |||
272 | *********************************************************************/ | ||
190 | HRESULT DAPI RegReadQword( | 273 | HRESULT DAPI RegReadQword( |
191 | __in HKEY hk, | 274 | __in HKEY hk, |
192 | __in_z_opt LPCWSTR wzName, | 275 | __in_z_opt LPCWSTR wzName, |
193 | __out DWORD64* pqwValue | 276 | __out DWORD64* pqwValue |
194 | ); | 277 | ); |
278 | |||
279 | /******************************************************************** | ||
280 | RegWriteBinary - writes a registry key value as a binary. | ||
281 | |||
282 | *********************************************************************/ | ||
195 | HRESULT DAPI RegWriteBinary( | 283 | HRESULT DAPI RegWriteBinary( |
196 | __in HKEY hk, | 284 | __in HKEY hk, |
197 | __in_z_opt LPCWSTR wzName, | 285 | __in_z_opt LPCWSTR wzName, |
198 | __in_bcount(cbBuffer) const BYTE *pbBuffer, | 286 | __in_bcount(cbBuffer) const BYTE *pbBuffer, |
199 | __in DWORD cbBuffer | 287 | __in DWORD cbBuffer |
200 | ); | 288 | ); |
201 | HRESULT DAPI RegWriteString( | 289 | |
290 | /******************************************************************** | ||
291 | RegWriteExpandString - writes a registry key value as an expand string. | ||
292 | |||
293 | Note: if wzValue is NULL the value will be removed. | ||
294 | *********************************************************************/ | ||
295 | HRESULT DAPI RegWriteExpandString( | ||
202 | __in HKEY hk, | 296 | __in HKEY hk, |
203 | __in_z_opt LPCWSTR wzName, | 297 | __in_z_opt LPCWSTR wzName, |
204 | __in_z_opt LPCWSTR wzValue | 298 | __in_z_opt LPCWSTR wzValue |
205 | ); | 299 | ); |
206 | HRESULT DAPI RegWriteStringArray( | 300 | |
301 | /******************************************************************** | ||
302 | RegWriteString - writes a registry key value as a string. | ||
303 | |||
304 | Note: if wzValue is NULL the value will be removed. | ||
305 | *********************************************************************/ | ||
306 | HRESULT DAPI RegWriteString( | ||
207 | __in HKEY hk, | 307 | __in HKEY hk, |
208 | __in_z_opt LPCWSTR wzName, | 308 | __in_z_opt LPCWSTR wzName, |
209 | __in_ecount(cStrings) LPWSTR *rgwzStrings, | 309 | __in_z_opt LPCWSTR wzValue |
210 | __in DWORD cStrings | ||
211 | ); | 310 | ); |
212 | HRESULT DAPI RegWriteStringFormatted( | 311 | |
312 | /******************************************************************** | ||
313 | RegWriteStringFormatted - writes a registry key value as a formatted string. | ||
314 | |||
315 | *********************************************************************/ | ||
316 | HRESULT DAPIV RegWriteStringFormatted( | ||
213 | __in HKEY hk, | 317 | __in HKEY hk, |
214 | __in_z_opt LPCWSTR wzName, | 318 | __in_z_opt LPCWSTR wzName, |
215 | __in __format_string LPCWSTR szFormat, | 319 | __in __format_string LPCWSTR szFormat, |
216 | ... | 320 | ... |
217 | ); | 321 | ); |
322 | |||
323 | /******************************************************************** | ||
324 | RegWriteStringArray - writes an array of strings as a REG_MULTI_SZ value | ||
325 | |||
326 | *********************************************************************/ | ||
327 | HRESULT DAPI RegWriteStringArray( | ||
328 | __in HKEY hk, | ||
329 | __in_z_opt LPCWSTR wzName, | ||
330 | __in_ecount(cStrings) LPWSTR* rgwzStrings, | ||
331 | __in DWORD cStrings | ||
332 | ); | ||
333 | |||
334 | /******************************************************************** | ||
335 | RegWriteNone - writes a registry key value as none. | ||
336 | |||
337 | *********************************************************************/ | ||
218 | HRESULT DAPI RegWriteNone( | 338 | HRESULT DAPI RegWriteNone( |
219 | __in HKEY hk, | 339 | __in HKEY hk, |
220 | __in_z_opt LPCWSTR wzName | 340 | __in_z_opt LPCWSTR wzName |
221 | ); | 341 | ); |
342 | |||
343 | /******************************************************************** | ||
344 | RegWriteNumber - writes a registry key value as a number. | ||
345 | |||
346 | *********************************************************************/ | ||
222 | HRESULT DAPI RegWriteNumber( | 347 | HRESULT DAPI RegWriteNumber( |
223 | __in HKEY hk, | 348 | __in HKEY hk, |
224 | __in_z_opt LPCWSTR wzName, | 349 | __in_z_opt LPCWSTR wzName, |
225 | __in DWORD dwValue | 350 | __in DWORD dwValue |
226 | ); | 351 | ); |
352 | |||
353 | /******************************************************************** | ||
354 | RegWriteQword - writes a registry key value as a Qword. | ||
355 | |||
356 | *********************************************************************/ | ||
227 | HRESULT DAPI RegWriteQword( | 357 | HRESULT DAPI RegWriteQword( |
228 | __in HKEY hk, | 358 | __in HKEY hk, |
229 | __in_z_opt LPCWSTR wzName, | 359 | __in_z_opt LPCWSTR wzName, |
230 | __in DWORD64 qwValue | 360 | __in DWORD64 qwValue |
231 | ); | 361 | ); |
362 | |||
363 | /******************************************************************** | ||
364 | RegQueryKey - queries the key for the number of subkeys and values. | ||
365 | |||
366 | *********************************************************************/ | ||
232 | HRESULT DAPI RegQueryKey( | 367 | HRESULT DAPI RegQueryKey( |
233 | __in HKEY hk, | 368 | __in HKEY hk, |
234 | __out_opt DWORD* pcSubKeys, | 369 | __out_opt DWORD* pcSubKeys, |
235 | __out_opt DWORD* pcValues | 370 | __out_opt DWORD* pcValues |
236 | ); | 371 | ); |
372 | |||
373 | /******************************************************************** | ||
374 | RegKeyReadNumber - reads a DWORD registry key value as a number from | ||
375 | a specified subkey. | ||
376 | |||
377 | *********************************************************************/ | ||
237 | HRESULT DAPI RegKeyReadNumber( | 378 | HRESULT DAPI RegKeyReadNumber( |
238 | __in HKEY hk, | 379 | __in HKEY hk, |
239 | __in_z LPCWSTR wzSubKey, | 380 | __in_z LPCWSTR wzSubKey, |
@@ -241,6 +382,12 @@ HRESULT DAPI RegKeyReadNumber( | |||
241 | __in BOOL f64Bit, | 382 | __in BOOL f64Bit, |
242 | __out DWORD* pdwValue | 383 | __out DWORD* pdwValue |
243 | ); | 384 | ); |
385 | |||
386 | /******************************************************************** | ||
387 | RegValueExists - determines whether a named value exists in a | ||
388 | specified subkey. | ||
389 | |||
390 | *********************************************************************/ | ||
244 | BOOL DAPI RegValueExists( | 391 | BOOL DAPI RegValueExists( |
245 | __in HKEY hk, | 392 | __in HKEY hk, |
246 | __in_z LPCWSTR wzSubKey, | 393 | __in_z LPCWSTR wzSubKey, |