ReactOS 0.4.17-dev-116-ga4b6fe9
reg.c
Go to the documentation of this file.
1/*
2 * SHLWAPI registry functions
3 *
4 * Copyright 1998 Juergen Schmied
5 * Copyright 2001 Guy Albertelli
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <stdarg.h>
23#include <string.h>
24#include "windef.h"
25#include "winbase.h"
26#include "winuser.h"
27#include "winreg.h"
28#include "wine/debug.h"
29#define NO_SHLWAPI_STREAM
30#include "shlwapi.h"
31#include "wine/unicode.h"
32
34
35/* Key/Value names for MIME content types */
36static const char lpszContentTypeA[] = "Content Type";
37static const WCHAR lpszContentTypeW[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0'};
38
39static const char szMimeDbContentA[] = "MIME\\Database\\Content Type\\";
40static const WCHAR szMimeDbContentW[] = { 'M', 'I', 'M','E','\\',
41 'D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',
42 ' ','T','y','p','e','\\', 0 };
43static const DWORD dwLenMimeDbContent = 27; /* strlen of szMimeDbContentA/W */
44
45static const char szExtensionA[] = "Extension";
46static const WCHAR szExtensionW[] = { 'E', 'x', 't','e','n','s','i','o','n','\0' };
47
48/* internal structure of what the HUSKEY points to */
49typedef struct {
50 HKEY HKCUstart; /* Start key in CU hive */
51 HKEY HKCUkey; /* Opened key in CU hive */
52 HKEY HKLMstart; /* Start key in LM hive */
53 HKEY HKLMkey; /* Opened key in LM hive */
54 WCHAR lpszPath[MAX_PATH];
56
59
60
61#define REG_HKCU TRUE
62#define REG_HKLM FALSE
63/*************************************************************************
64 * REG_GetHKEYFromHUSKEY
65 *
66 * Function: Return the proper registry key from the HUSKEY structure
67 * also allow special predefined values.
68 */
70{
71 HKEY test = hUSKey;
72 LPSHUSKEY mihk = hUSKey;
73
74 if ((test == HKEY_CLASSES_ROOT) ||
77 (test == HKEY_DYN_DATA) ||
80/* FIXME: need to define for Win2k, ME, XP
81 * (test == HKEY_PERFORMANCE_TEXT) ||
82 * (test == HKEY_PERFORMANCE_NLSTEXT) ||
83 */
84 (test == HKEY_USERS)) return test;
85 if (which == REG_HKCU) return mihk->HKCUkey;
86 return mihk->HKLMkey;
87}
88
89
90/*************************************************************************
91 * SHRegOpenUSKeyA [SHLWAPI.@]
92 *
93 * Open a user-specific registry key.
94 *
95 * PARAMS
96 * Path [I] Key name to open
97 * AccessType [I] Access type
98 * hRelativeUSKey [I] Relative user key
99 * phNewUSKey [O] Destination for created key
100 * fIgnoreHKCU [I] TRUE=Don't check HKEY_CURRENT_USER
101 *
102 * RETURNS
103 * Success: ERROR_SUCCESS
104 * Failure: An error code from RegOpenKeyExA().
105 */
106LONG WINAPI SHRegOpenUSKeyA(LPCSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey,
107 PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
108{
110
111 if (Path)
113
114 return SHRegOpenUSKeyW(Path ? szPath : NULL, AccessType, hRelativeUSKey,
115 phNewUSKey, fIgnoreHKCU);
116}
117
118/*************************************************************************
119 * SHRegOpenUSKeyW [SHLWAPI.@]
120 *
121 * See SHRegOpenUSKeyA.
122 */
123LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey,
124 PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
125{
126 LONG ret2, ret1 = ~ERROR_SUCCESS;
128
129 TRACE("(%s,0x%x,%p,%p,%d)\n", debugstr_w(Path),(LONG)AccessType,
130 hRelativeUSKey, phNewUSKey, fIgnoreHKCU);
131
132 if (phNewUSKey)
133 *phNewUSKey = NULL;
134
135 /* Create internal HUSKEY */
137 lstrcpynW(hKey->lpszPath, Path, sizeof(hKey->lpszPath)/sizeof(WCHAR));
138
139 if (hRelativeUSKey)
140 {
141 hKey->HKCUstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(hRelativeUSKey, REG_HKCU));
142 hKey->HKLMstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(hRelativeUSKey, REG_HKLM));
143
144 /* FIXME: if either of these keys is NULL, create the start key from
145 * the relative keys start+path
146 */
147 }
148 else
149 {
150 hKey->HKCUstart = HKEY_CURRENT_USER;
151 hKey->HKLMstart = HKEY_LOCAL_MACHINE;
152 }
153
154 if (!fIgnoreHKCU)
155 {
156 ret1 = RegOpenKeyExW(hKey->HKCUstart, hKey->lpszPath, 0, AccessType, &hKey->HKCUkey);
157 if (ret1)
158 hKey->HKCUkey = 0;
159 }
160
161 ret2 = RegOpenKeyExW(hKey->HKLMstart, hKey->lpszPath, 0, AccessType, &hKey->HKLMkey);
162 if (ret2)
163 hKey->HKLMkey = 0;
164
165 if (ret1 || ret2)
166 TRACE("one or more opens failed: HKCU=%d HKLM=%d\n", ret1, ret2);
167
168 if (ret1 && ret2)
169 {
170 /* Neither open succeeded: fail */
172 return ret2;
173 }
174
175 TRACE("HUSKEY=%p\n", hKey);
176 if (phNewUSKey)
177 *phNewUSKey = hKey;
178 return ERROR_SUCCESS;
179}
180
181/*************************************************************************
182 * SHRegCloseUSKey [SHLWAPI.@]
183 *
184 * Close a user-specific registry key
185 *
186 * RETURNS
187 * Success: ERROR_SUCCESS
188 * Failure: An error code from RegCloseKey().
189 */
191 HUSKEY hUSKey) /* [I] Key to close */
192{
193 LPSHUSKEY hKey = hUSKey;
195
196 if (!hKey)
198
199 if (hKey->HKCUkey)
200 ret = RegCloseKey(hKey->HKCUkey);
201 if (hKey->HKCUstart && hKey->HKCUstart != HKEY_CURRENT_USER)
202 ret = RegCloseKey(hKey->HKCUstart);
203 if (hKey->HKLMkey)
204 ret = RegCloseKey(hKey->HKLMkey);
205 if (hKey->HKLMstart && hKey->HKLMstart != HKEY_LOCAL_MACHINE)
206 ret = RegCloseKey(hKey->HKLMstart);
207
209 return ret;
210}
211
212/*************************************************************************
213 * SHRegCreateUSKeyA [SHLWAPI.@]
214 *
215 * See SHRegCreateUSKeyW.
216 */
218 PHUSKEY new_uskey, DWORD flags)
219{
220 WCHAR *pathW;
221 LONG ret;
222
223 TRACE("(%s, 0x%08x, %p, %p, 0x%08x)\n", debugstr_a(path), samDesired, relative_key,
224 new_uskey, flags);
225
226 if (path)
227 {
228 INT len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
229 pathW = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
230 if (!pathW)
233 }
234 else
235 pathW = NULL;
236
237 ret = SHRegCreateUSKeyW(pathW, samDesired, relative_key, new_uskey, flags);
239 return ret;
240}
241
242/*************************************************************************
243 * SHRegCreateUSKeyW [SHLWAPI.@]
244 *
245 * Create or open a user-specific registry key.
246 *
247 * PARAMS
248 * path [I] Key name to create or open.
249 * samDesired [I] Wanted security access.
250 * relative_key [I] Base path if 'path' is relative. NULL otherwise.
251 * new_uskey [O] Receives a handle to the new or opened key.
252 * flags [I] Base key under which the key should be opened.
253 *
254 * RETURNS
255 * Success: ERROR_SUCCESS
256 * Failure: Nonzero error code from winerror.h
257 */
259 PHUSKEY new_uskey, DWORD flags)
260{
262 SHUSKEY *ret_key;
263
264 TRACE("(%s, 0x%08x, %p, %p, 0x%08x)\n", debugstr_w(path), samDesired,
265 relative_key, new_uskey, flags);
266
267 if (!new_uskey) return ERROR_INVALID_PARAMETER;
268
269 *new_uskey = NULL;
270
272 {
273 FIXME("unsupported flags 0x%08x\n", flags);
274 return ERROR_SUCCESS;
275 }
276
277 ret_key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret_key));
278 lstrcpynW(ret_key->lpszPath, path, sizeof(ret_key->lpszPath)/sizeof(WCHAR));
279
280 if (relative_key)
281 {
284 }
285 else
286 {
287 ret_key->HKCUstart = HKEY_CURRENT_USER;
288 ret_key->HKLMstart = HKEY_LOCAL_MACHINE;
289 }
290
292 {
293 ret = RegCreateKeyExW(ret_key->HKCUstart, path, 0, NULL, 0, samDesired, NULL, &ret_key->HKCUkey, NULL);
294 if (ret == ERROR_SUCCESS)
295 *new_uskey = ret_key;
296 else
297 HeapFree(GetProcessHeap(), 0, ret_key);
298 }
299
300 return ret;
301}
302
303/*************************************************************************
304 * SHRegDeleteEmptyUSKeyA [SHLWAPI.@]
305 *
306 * Delete an empty user-specific registry key.
307 *
308 * PARAMS
309 * hUSKey [I] Handle to an open registry key.
310 * pszValue [I] Empty key name.
311 * delRegFlags [I] Flag that specifies the base from which to delete
312 * the key.
313 *
314 * RETURNS
315 * Success: ERROR_SUCCESS
316 * Failure: Nonzero error code from winerror.h
317 */
319{
320 FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_a(pszValue), delRegFlags);
321 return ERROR_SUCCESS;
322}
323
324/*************************************************************************
325 * SHRegDeleteEmptyUSKeyW [SHLWAPI.@]
326 *
327 * See SHRegDeleteEmptyUSKeyA.
328 */
330{
331 FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_w(pszValue), delRegFlags);
332 return ERROR_SUCCESS;
333}
334
335/*************************************************************************
336 * SHRegDeleteUSValueA [SHLWAPI.@]
337 *
338 * Delete a user-specific registry value.
339 *
340 * PARAMS
341 * hUSKey [I] Handle to an open registry key.
342 * pszValue [I] Specifies the value to delete.
343 * delRegFlags [I] Flag that specifies the base of the key from which to
344 * delete the value.
345 *
346 * RETURNS
347 * Success: ERROR_SUCCESS
348 * Failure: Nonzero error code from winerror.h
349 */
351{
352 FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_a(pszValue), delRegFlags);
353 return ERROR_SUCCESS;
354}
355
356/*************************************************************************
357 * SHRegDeleteUSValueW [SHLWAPI.@]
358 *
359 * See SHRegDeleteUSValueA.
360 */
362{
363 FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_w(pszValue), delRegFlags);
364 return ERROR_SUCCESS;
365}
366
367/*************************************************************************
368 * SHRegEnumUSValueA [SHLWAPI.@]
369 *
370 * Enumerate values of a specified registry key.
371 *
372 * PARAMS
373 * hUSKey [I] Handle to an open registry key.
374 * dwIndex [I] Index of the value to be retrieved.
375 * pszValueName [O] Buffer to receive the value name.
376 * pcchValueNameLen [I] Size of pszValueName in characters.
377 * pdwType [O] Receives data type of the value.
378 * pvData [O] Receives value data. May be NULL.
379 * pcbData [I/O] Size of pvData in bytes.
380 * enumRegFlags [I] Flag that specifies the base key under which to
381 * enumerate values.
382 *
383 * RETURNS
384 * Success: ERROR_SUCCESS
385 * Failure: Nonzero error code from winerror.h
386 */
387LONG WINAPI SHRegEnumUSValueA(HUSKEY hUSKey, DWORD dwIndex, LPSTR pszValueName,
388 LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData,
389 LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
390{
391 HKEY dokey;
392
393 TRACE("(%p, 0x%08x, %p, %p, %p, %p, %p, 0x%08x)\n", hUSKey, dwIndex,
394 pszValueName, pcchValueNameLen, pdwType, pvData, pcbData, enumRegFlags);
395
396 if (((enumRegFlags == SHREGENUM_HKCU) ||
397 (enumRegFlags == SHREGENUM_DEFAULT)) &&
398 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
399 return RegEnumValueA(dokey, dwIndex, pszValueName, pcchValueNameLen,
401 }
402
403 if (((enumRegFlags == SHREGENUM_HKLM) ||
404 (enumRegFlags == SHREGENUM_DEFAULT)) &&
405 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
406 return RegEnumValueA(dokey, dwIndex, pszValueName, pcchValueNameLen,
408 }
409 FIXME("no support for SHREGENUM_BOTH\n");
411}
412
413/*************************************************************************
414 * SHRegEnumUSValueW [SHLWAPI.@]
415 *
416 * See SHRegEnumUSValueA.
417 */
418LONG WINAPI SHRegEnumUSValueW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszValueName,
419 LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData,
420 LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
421{
422 HKEY dokey;
423
424 TRACE("(%p, 0x%08x, %p, %p, %p, %p, %p, 0x%08x)\n", hUSKey, dwIndex,
425 pszValueName, pcchValueNameLen, pdwType, pvData, pcbData, enumRegFlags);
426
427 if (((enumRegFlags == SHREGENUM_HKCU) ||
428 (enumRegFlags == SHREGENUM_DEFAULT)) &&
429 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
430 return RegEnumValueW(dokey, dwIndex, pszValueName, pcchValueNameLen,
432 }
433
434 if (((enumRegFlags == SHREGENUM_HKLM) ||
435 (enumRegFlags == SHREGENUM_DEFAULT)) &&
436 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
437 return RegEnumValueW(dokey, dwIndex, pszValueName, pcchValueNameLen,
439 }
440 FIXME("no support for SHREGENUM_BOTH\n");
442}
443
444/*************************************************************************
445 * SHRegQueryUSValueA [SHLWAPI.@]
446 *
447 * Query a user-specific registry value.
448 *
449 * RETURNS
450 * Success: ERROR_SUCCESS
451 * Failure: An error code from RegQueryValueExA().
452 */
454 HUSKEY hUSKey, /* [I] Key to query */
455 LPCSTR pszValue, /* [I] Value name under hUSKey */
456 LPDWORD pdwType, /* [O] Destination for value type */
457 LPVOID pvData, /* [O] Destination for value data */
458 LPDWORD pcbData, /* [O] Destination for value length */
459 BOOL fIgnoreHKCU, /* [I] TRUE=Don't check HKEY_CURRENT_USER */
460 LPVOID pvDefaultData, /* [I] Default data if pszValue does not exist */
461 DWORD dwDefaultDataSize) /* [I] Length of pvDefaultData */
462{
463 LONG ret = ~ERROR_SUCCESS;
464 LONG i, maxmove;
465 HKEY dokey;
466 CHAR *src, *dst;
467
468 /* if user wants HKCU, and it exists, then try it */
469 if (!fIgnoreHKCU && (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
470 ret = RegQueryValueExA(dokey,
472 TRACE("HKCU RegQueryValue returned %08x\n", ret);
473 }
474
475 /* if HKCU did not work and HKLM exists, then try it */
476 if ((ret != ERROR_SUCCESS) &&
477 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
478 ret = RegQueryValueExA(dokey,
480 TRACE("HKLM RegQueryValue returned %08x\n", ret);
481 }
482
483 /* if neither worked, and default data exists, then use it */
484 if (ret != ERROR_SUCCESS) {
485 if (pvDefaultData && (dwDefaultDataSize != 0)) {
487 src = pvDefaultData;
488 dst = pvData;
489 for(i=0; i<maxmove; i++) *dst++ = *src++;
490 *pcbData = maxmove;
491 TRACE("setting default data\n");
493 }
494 }
495 return ret;
496}
497
498
499/*************************************************************************
500 * SHRegQueryUSValueW [SHLWAPI.@]
501 *
502 * See SHRegQueryUSValueA.
503 */
505 HUSKEY hUSKey,
510 BOOL fIgnoreHKCU,
511 LPVOID pvDefaultData,
513{
514 LONG ret = ~ERROR_SUCCESS;
515 LONG i, maxmove;
516 HKEY dokey;
517 CHAR *src, *dst;
518
519 /* if user wants HKCU, and it exists, then try it */
520 if (!fIgnoreHKCU && (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
521 ret = RegQueryValueExW(dokey,
523 TRACE("HKCU RegQueryValue returned %08x\n", ret);
524 }
525
526 /* if HKCU did not work and HKLM exists, then try it */
527 if ((ret != ERROR_SUCCESS) &&
528 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
529 ret = RegQueryValueExW(dokey,
531 TRACE("HKLM RegQueryValue returned %08x\n", ret);
532 }
533
534 /* if neither worked, and default data exists, then use it */
535 if (ret != ERROR_SUCCESS) {
536 if (pvDefaultData && (dwDefaultDataSize != 0)) {
538 src = pvDefaultData;
539 dst = pvData;
540 for(i=0; i<maxmove; i++) *dst++ = *src++;
541 *pcbData = maxmove;
542 TRACE("setting default data\n");
544 }
545 }
546 return ret;
547}
548
549/*************************************************************************
550 * SHRegGetUSValueA [SHLWAPI.@]
551 *
552 * Get a user-specific registry value.
553 *
554 * RETURNS
555 * Success: ERROR_SUCCESS
556 * Failure: An error code from SHRegOpenUSKeyA() or SHRegQueryUSValueA().
557 *
558 * NOTES
559 * This function opens pSubKey, queries the value, and then closes the key.
560 */
562 LPCSTR pSubKey, /* [I] Key name to open */
563 LPCSTR pValue, /* [I] Value name to open */
564 LPDWORD pwType, /* [O] Destination for the type of the value */
565 LPVOID pvData, /* [O] Destination for the value */
566 LPDWORD pcbData, /* [I] Destination for the length of the value **/
567 BOOL flagIgnoreHKCU, /* [I] TRUE=Don't check HKEY_CURRENT_USER */
568 LPVOID pDefaultData, /* [I] Default value if it doesn't exist */
569 DWORD wDefaultDataSize) /* [I] Length of pDefaultData */
570{
571 HUSKEY myhuskey;
572 LONG ret;
573
574 if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
575 TRACE("key '%s', value '%s', datalen %d, %s\n",
576 debugstr_a(pSubKey), debugstr_a(pValue), *pcbData,
577 (flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
578
579 ret = SHRegOpenUSKeyA(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
580 if (ret == ERROR_SUCCESS) {
581 ret = SHRegQueryUSValueA(myhuskey, pValue, pwType, pvData,
582 pcbData, flagIgnoreHKCU, pDefaultData,
583 wDefaultDataSize);
584 SHRegCloseUSKey(myhuskey);
585 }
586 return ret;
587}
588
589/*************************************************************************
590 * SHRegGetUSValueW [SHLWAPI.@]
591 *
592 * See SHRegGetUSValueA.
593 */
595 LPCWSTR pSubKey,
597 LPDWORD pwType,
600 BOOL flagIgnoreHKCU,
601 LPVOID pDefaultData,
602 DWORD wDefaultDataSize)
603{
604 HUSKEY myhuskey;
605 LONG ret;
606
607 if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
608 TRACE("key '%s', value '%s', datalen %d, %s\n",
609 debugstr_w(pSubKey), debugstr_w(pValue), *pcbData,
610 (flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
611
612 ret = SHRegOpenUSKeyW(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
613 if (ret == ERROR_SUCCESS) {
614 ret = SHRegQueryUSValueW(myhuskey, pValue, pwType, pvData,
615 pcbData, flagIgnoreHKCU, pDefaultData,
616 wDefaultDataSize);
617 SHRegCloseUSKey(myhuskey);
618 }
619 return ret;
620}
621
622/*************************************************************************
623 * SHRegSetUSValueA [SHLWAPI.@]
624 *
625 * Set a user-specific registry value.
626 *
627 * PARAMS
628 * pszSubKey [I] Name of key to set the value in
629 * pszValue [I] Name of value under pszSubKey to set the value in
630 * dwType [I] Type of the value
631 * pvData [I] Data to set as the value
632 * cbData [I] length of pvData
633 * dwFlags [I] SHREGSET_ flags from "shlwapi.h"
634 *
635 * RETURNS
636 * Success: ERROR_SUCCESS
637 * Failure: An error code from SHRegOpenUSKeyA() or SHRegWriteUSValueA(), or
638 * ERROR_INVALID_FUNCTION if pvData is NULL.
639 *
640 * NOTES
641 * This function opens pszSubKey, sets the value, and then closes the key.
642 */
645{
646 BOOL ignoreHKCU = TRUE;
647 HUSKEY hkey;
648 LONG ret;
649
650 TRACE("(%s,%s,%d,%p,%d,0x%08x\n", debugstr_a(pszSubKey), debugstr_a(pszValue),
651 dwType, pvData, cbData, dwFlags);
652
653 if (!pvData)
655
657 ignoreHKCU = FALSE;
658
659 ret = SHRegOpenUSKeyA(pszSubKey, KEY_ALL_ACCESS, 0, &hkey, ignoreHKCU);
660 if (ret == ERROR_SUCCESS)
661 {
663 SHRegCloseUSKey(hkey);
664 }
665 return ret;
666}
667
668/*************************************************************************
669 * SHRegSetUSValueW [SHLWAPI.@]
670 *
671 * See SHRegSetUSValueA.
672 */
675{
676 BOOL ignoreHKCU = TRUE;
677 HUSKEY hkey;
678 LONG ret;
679
680 TRACE("(%s,%s,%d,%p,%d,0x%08x\n", debugstr_w(pszSubKey), debugstr_w(pszValue),
681 dwType, pvData, cbData, dwFlags);
682
683 if (!pvData)
685
687 ignoreHKCU = FALSE;
688
689 ret = SHRegOpenUSKeyW(pszSubKey, KEY_ALL_ACCESS, 0, &hkey, ignoreHKCU);
690 if (ret == ERROR_SUCCESS)
691 {
693 SHRegCloseUSKey(hkey);
694 }
695 return ret;
696}
697
698/*************************************************************************
699 * SHRegGetBoolUSValueA [SHLWAPI.@]
700 *
701 * Get a user-specific registry boolean value.
702 *
703 * RETURNS
704 * Success: ERROR_SUCCESS
705 * Failure: An error code from SHRegOpenUSKeyA() or SHRegQueryUSValueA().
706 *
707 * NOTES
708 * This function opens pszSubKey, queries the value, and then closes the key.
709 *
710 * Boolean values are one of the following:
711 * True: YES,TRUE,non-zero
712 * False: NO,FALSE,0
713 */
715 LPCSTR pszSubKey, /* [I] Key name to open */
716 LPCSTR pszValue, /* [I] Value name to open */
717 BOOL fIgnoreHKCU, /* [I] TRUE=Don't check HKEY_CURRENT_USER */
718 BOOL fDefault) /* [I] Default value to use if pszValue is not present */
719{
720 DWORD type, datalen, work;
721 BOOL ret = fDefault;
722 CHAR data[10];
723
724 TRACE("key '%s', value '%s', %s\n",
726 (fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
727
728 datalen = sizeof(data)-1;
730 data, &datalen,
731 fIgnoreHKCU, 0, 0)) {
732 /* process returned data via type into bool */
733 switch (type) {
734 case REG_SZ:
735 data[9] = '\0'; /* set end of string */
736 if (lstrcmpiA(data, "YES") == 0) ret = TRUE;
737 if (lstrcmpiA(data, "TRUE") == 0) ret = TRUE;
738 if (lstrcmpiA(data, "NO") == 0) ret = FALSE;
739 if (lstrcmpiA(data, "FALSE") == 0) ret = FALSE;
740 break;
741 case REG_DWORD:
742 work = *(LPDWORD)data;
743 ret = (work != 0);
744 break;
745 case REG_BINARY:
746 if (datalen == 1) {
747 ret = (data[0] != '\0');
748 break;
749 }
750 default:
751 FIXME("Unsupported registry data type %d\n", type);
752 ret = FALSE;
753 }
754 TRACE("got value (type=%d), returning <%s>\n", type,
755 (ret) ? "TRUE" : "FALSE");
756 }
757 else {
758 ret = fDefault;
759 TRACE("returning default data <%s>\n",
760 (ret) ? "TRUE" : "FALSE");
761 }
762 return ret;
763}
764
765/*************************************************************************
766 * SHRegGetBoolUSValueW [SHLWAPI.@]
767 *
768 * See SHRegGetBoolUSValueA.
769 */
773 BOOL fIgnoreHKCU,
774 BOOL fDefault)
775{
776 static const WCHAR wYES[]= {'Y','E','S','\0'};
777 static const WCHAR wTRUE[]= {'T','R','U','E','\0'};
778 static const WCHAR wNO[]= {'N','O','\0'};
779 static const WCHAR wFALSE[]={'F','A','L','S','E','\0'};
780 DWORD type, datalen, work;
781 BOOL ret = fDefault;
782 WCHAR data[10];
783
784 TRACE("key '%s', value '%s', %s\n",
786 (fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
787
788 datalen = (sizeof(data)-1) * sizeof(WCHAR);
790 data, &datalen,
791 fIgnoreHKCU, 0, 0)) {
792 /* process returned data via type into bool */
793 switch (type) {
794 case REG_SZ:
795 data[9] = '\0'; /* set end of string */
796 if (lstrcmpiW(data, wYES)==0 || lstrcmpiW(data, wTRUE)==0)
797 ret = TRUE;
798 else if (lstrcmpiW(data, wNO)==0 || lstrcmpiW(data, wFALSE)==0)
799 ret = FALSE;
800 break;
801 case REG_DWORD:
802 work = *(LPDWORD)data;
803 ret = (work != 0);
804 break;
805 case REG_BINARY:
806 if (datalen == 1) {
807 ret = (data[0] != '\0');
808 break;
809 }
810 default:
811 FIXME("Unsupported registry data type %d\n", type);
812 ret = FALSE;
813 }
814 TRACE("got value (type=%d), returning <%s>\n", type,
815 (ret) ? "TRUE" : "FALSE");
816 }
817 else {
818 ret = fDefault;
819 TRACE("returning default data <%s>\n",
820 (ret) ? "TRUE" : "FALSE");
821 }
822 return ret;
823}
824
825/*************************************************************************
826 * SHRegQueryInfoUSKeyA [SHLWAPI.@]
827 *
828 * Get information about a user-specific registry key.
829 *
830 * RETURNS
831 * Success: ERROR_SUCCESS
832 * Failure: An error code from RegQueryInfoKeyA().
833 */
835 HUSKEY hUSKey, /* [I] Key to query */
836 LPDWORD pcSubKeys, /* [O] Destination for number of sub keys */
837 LPDWORD pcchMaxSubKeyLen, /* [O] Destination for the length of the biggest sub key name */
838 LPDWORD pcValues, /* [O] Destination for number of values */
839 LPDWORD pcchMaxValueNameLen,/* [O] Destination for the length of the biggest value */
840 SHREGENUM_FLAGS enumRegFlags) /* [in] SHREGENUM_ flags from "shlwapi.h" */
841{
842 HKEY dokey;
843 LONG ret;
844
845 TRACE("(%p,%p,%p,%p,%p,%d)\n",
846 hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
847 pcchMaxValueNameLen,enumRegFlags);
848
849 /* if user wants HKCU, and it exists, then try it */
850 if (((enumRegFlags == SHREGENUM_HKCU) ||
851 (enumRegFlags == SHREGENUM_DEFAULT)) &&
852 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
853 ret = RegQueryInfoKeyA(dokey, 0, 0, 0,
854 pcSubKeys, pcchMaxSubKeyLen, 0,
855 pcValues, pcchMaxValueNameLen, 0, 0, 0);
856 if ((ret == ERROR_SUCCESS) ||
857 (enumRegFlags == SHREGENUM_HKCU))
858 return ret;
859 }
860 if (((enumRegFlags == SHREGENUM_HKLM) ||
861 (enumRegFlags == SHREGENUM_DEFAULT)) &&
862 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
863 return RegQueryInfoKeyA(dokey, 0, 0, 0,
864 pcSubKeys, pcchMaxSubKeyLen, 0,
865 pcValues, pcchMaxValueNameLen, 0, 0, 0);
866 }
868}
869
870/*************************************************************************
871 * SHRegQueryInfoUSKeyW [SHLWAPI.@]
872 *
873 * See SHRegQueryInfoUSKeyA.
874 */
876 HUSKEY hUSKey,
877 LPDWORD pcSubKeys,
878 LPDWORD pcchMaxSubKeyLen,
879 LPDWORD pcValues,
880 LPDWORD pcchMaxValueNameLen,
881 SHREGENUM_FLAGS enumRegFlags)
882{
883 HKEY dokey;
884 LONG ret;
885
886 TRACE("(%p,%p,%p,%p,%p,%d)\n",
887 hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
888 pcchMaxValueNameLen,enumRegFlags);
889
890 /* if user wants HKCU, and it exists, then try it */
891 if (((enumRegFlags == SHREGENUM_HKCU) ||
892 (enumRegFlags == SHREGENUM_DEFAULT)) &&
893 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
894 ret = RegQueryInfoKeyW(dokey, 0, 0, 0,
895 pcSubKeys, pcchMaxSubKeyLen, 0,
896 pcValues, pcchMaxValueNameLen, 0, 0, 0);
897 if ((ret == ERROR_SUCCESS) ||
898 (enumRegFlags == SHREGENUM_HKCU))
899 return ret;
900 }
901 if (((enumRegFlags == SHREGENUM_HKLM) ||
902 (enumRegFlags == SHREGENUM_DEFAULT)) &&
903 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
904 return RegQueryInfoKeyW(dokey, 0, 0, 0,
905 pcSubKeys, pcchMaxSubKeyLen, 0,
906 pcValues, pcchMaxValueNameLen, 0, 0, 0);
907 }
909}
910
911/*************************************************************************
912 * SHRegEnumUSKeyA [SHLWAPI.@]
913 *
914 * Enumerate a user-specific registry key.
915 *
916 * RETURNS
917 * Success: ERROR_SUCCESS
918 * Failure: An error code from RegEnumKeyExA().
919 */
921 HUSKEY hUSKey, /* [in] Key to enumerate */
922 DWORD dwIndex, /* [in] Index within hUSKey */
923 LPSTR pszName, /* [out] Name of the enumerated value */
924 LPDWORD pcchValueNameLen, /* [in/out] Length of pszName */
925 SHREGENUM_FLAGS enumRegFlags) /* [in] SHREGENUM_ flags from "shlwapi.h" */
926{
927 HKEY dokey;
928
929 TRACE("(%p,%d,%p,%p(%d),%d)\n",
930 hUSKey, dwIndex, pszName, pcchValueNameLen,
931 *pcchValueNameLen, enumRegFlags);
932
933 if (((enumRegFlags == SHREGENUM_HKCU) ||
934 (enumRegFlags == SHREGENUM_DEFAULT)) &&
935 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
936 return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
937 0, 0, 0, 0);
938 }
939
940 if (((enumRegFlags == SHREGENUM_HKLM) ||
941 (enumRegFlags == SHREGENUM_DEFAULT)) &&
942 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
943 return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
944 0, 0, 0, 0);
945 }
946 FIXME("no support for SHREGENUM_BOTH\n");
948}
949
950/*************************************************************************
951 * SHRegEnumUSKeyW [SHLWAPI.@]
952 *
953 * See SHRegEnumUSKeyA.
954 */
956 HUSKEY hUSKey,
957 DWORD dwIndex,
958 LPWSTR pszName,
959 LPDWORD pcchValueNameLen,
960 SHREGENUM_FLAGS enumRegFlags)
961{
962 HKEY dokey;
963
964 TRACE("(%p,%d,%p,%p(%d),%d)\n",
965 hUSKey, dwIndex, pszName, pcchValueNameLen,
966 *pcchValueNameLen, enumRegFlags);
967
968 if (((enumRegFlags == SHREGENUM_HKCU) ||
969 (enumRegFlags == SHREGENUM_DEFAULT)) &&
970 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
971 return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
972 0, 0, 0, 0);
973 }
974
975 if (((enumRegFlags == SHREGENUM_HKLM) ||
976 (enumRegFlags == SHREGENUM_DEFAULT)) &&
977 (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
978 return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
979 0, 0, 0, 0);
980 }
981 FIXME("no support for SHREGENUM_BOTH\n");
983}
984
985
986/*************************************************************************
987 * SHRegWriteUSValueA [SHLWAPI.@]
988 *
989 * Write a user-specific registry value.
990 *
991 * PARAMS
992 * hUSKey [I] Key to write the value to
993 * pszValue [I] Name of value under hUSKey to write the value as
994 * dwType [I] Type of the value
995 * pvData [I] Data to set as the value
996 * cbData [I] length of pvData
997 * dwFlags [I] SHREGSET_ flags from "shlwapi.h"
998 *
999 * RETURNS
1000 * Success: ERROR_SUCCESS.
1001 * Failure: ERROR_INVALID_PARAMETER, if any parameter is invalid, otherwise
1002 * an error code from RegSetValueExA().
1003 *
1004 * NOTES
1005 * dwFlags must have at least SHREGSET_FORCE_HKCU or SHREGSET_FORCE_HKLM set.
1006 */
1009{
1010 WCHAR szValue[MAX_PATH];
1011
1012 if (pszValue)
1013 MultiByteToWideChar(CP_ACP, 0, pszValue, -1, szValue, MAX_PATH);
1014
1015 return SHRegWriteUSValueW(hUSKey, pszValue ? szValue : NULL, dwType,
1017}
1018
1019/*************************************************************************
1020 * SHRegWriteUSValueW [SHLWAPI.@]
1021 *
1022 * See SHRegWriteUSValueA.
1023 */
1026{
1027 DWORD dummy;
1028 LPSHUSKEY hKey = hUSKey;
1030
1031 TRACE("(%p,%s,%d,%p,%d,%d)\n", hUSKey, debugstr_w(pszValue),
1032 dwType, pvData, cbData, dwFlags);
1033
1034 if (!hUSKey || IsBadWritePtr(hUSKey, sizeof(SHUSKEY)) ||
1037
1039 {
1040 if (!hKey->HKCUkey)
1041 {
1042 /* Create the key */
1043 ret = RegCreateKeyW(hKey->HKCUstart, hKey->lpszPath, &hKey->HKCUkey);
1044 TRACE("Creating HKCU key, ret = %d\n", ret);
1045 if (ret && (dwFlags & (SHREGSET_FORCE_HKCU)))
1046 {
1047 hKey->HKCUkey = 0;
1048 return ret;
1049 }
1050 }
1051
1052 if (!ret)
1053 {
1054 if ((dwFlags & SHREGSET_FORCE_HKCU) ||
1056 {
1057 /* Doesn't exist or we are forcing: Write value */
1058 ret = RegSetValueExW(hKey->HKCUkey, pszValue, 0, dwType, pvData, cbData);
1059 TRACE("Writing HKCU value, ret = %d\n", ret);
1060 }
1061 }
1062 }
1063
1065 {
1066 if (!hKey->HKLMkey)
1067 {
1068 /* Create the key */
1069 ret = RegCreateKeyW(hKey->HKLMstart, hKey->lpszPath, &hKey->HKLMkey);
1070 TRACE("Creating HKLM key, ret = %d\n", ret);
1071 if (ret && (dwFlags & (SHREGSET_FORCE_HKLM)))
1072 {
1073 hKey->HKLMkey = 0;
1074 return ret;
1075 }
1076 }
1077
1078 if (!ret)
1079 {
1080 if ((dwFlags & SHREGSET_FORCE_HKLM) ||
1082 {
1083 /* Doesn't exist or we are forcing: Write value */
1084 ret = RegSetValueExW(hKey->HKLMkey, pszValue, 0, dwType, pvData, cbData);
1085 TRACE("Writing HKLM value, ret = %d\n", ret);
1086 }
1087 }
1088 }
1089
1090 return ret;
1091}
1092
1093/*************************************************************************
1094 * SHRegGetPathA [SHLWAPI.@]
1095 *
1096 * Get a path from the registry.
1097 *
1098 * PARAMS
1099 * hKey [I] Handle to registry key
1100 * lpszSubKey [I] Name of sub key containing path to get
1101 * lpszValue [I] Name of value containing path to get
1102 * lpszPath [O] Buffer for returned path
1103 * dwFlags [I] Reserved
1104 *
1105 * RETURNS
1106 * Success: ERROR_SUCCESS. lpszPath contains the path.
1107 * Failure: An error code from RegOpenKeyExA() or SHQueryValueExA().
1108 */
1110 LPSTR lpszPath, DWORD dwFlags)
1111{
1113
1114 TRACE("(hkey=%p,%s,%s,%p,%d)\n", hKey, debugstr_a(lpszSubKey),
1115 debugstr_a(lpszValue), lpszPath, dwFlags);
1116
1117 return SHGetValueA(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
1118}
1119
1120/*************************************************************************
1121 * SHRegGetPathW [SHLWAPI.@]
1122 *
1123 * See SHRegGetPathA.
1124 */
1126 LPWSTR lpszPath, DWORD dwFlags)
1127{
1129
1130 TRACE("(hkey=%p,%s,%s,%p,%d)\n", hKey, debugstr_w(lpszSubKey),
1131 debugstr_w(lpszValue), lpszPath, dwFlags);
1132
1133 return SHGetValueW(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
1134}
1135
1136
1137/*************************************************************************
1138 * SHRegSetPathA [SHLWAPI.@]
1139 *
1140 * Write a path to the registry.
1141 *
1142 * PARAMS
1143 * hKey [I] Handle to registry key
1144 * lpszSubKey [I] Name of sub key containing path to set
1145 * lpszValue [I] Name of value containing path to set
1146 * lpszPath [O] Path to write
1147 * dwFlags [I] Reserved, must be 0.
1148 *
1149 * RETURNS
1150 * Success: ERROR_SUCCESS.
1151 * Failure: An error code from SHSetValueA().
1152 */
1154 LPCSTR lpszPath, DWORD dwFlags)
1155{
1156 char szBuff[MAX_PATH];
1157#ifdef __REACTOS__
1158 DWORD dwType;
1159 LPCSTR pszData;
1160 INT cch;
1161
1163
1164 if (PathUnExpandEnvStringsA(lpszPath, szBuff, _countof(szBuff)))
1165 {
1166 dwType = REG_EXPAND_SZ;
1167 pszData = szBuff;
1168 }
1169 else
1170 {
1171 dwType = REG_SZ;
1172 pszData = lpszPath;
1173 }
1174
1175 cch = lstrlenA(pszData);
1176 return SHSetValueA(hKey, lpszSubKey, lpszValue, dwType, pszData, (cch + 1) * sizeof(CHAR));
1177#else
1178 FIXME("(hkey=%p,%s,%s,%p,%d) - semi-stub\n",hKey, debugstr_a(lpszSubKey),
1179 debugstr_a(lpszValue), lpszPath, dwFlags);
1180
1181 lstrcpyA(szBuff, lpszPath);
1182
1183 /* FIXME: PathUnExpandEnvStringsA(szBuff); */
1184
1185 return SHSetValueA(hKey,lpszSubKey, lpszValue, REG_SZ, szBuff,
1186 lstrlenA(szBuff));
1187#endif
1188}
1189
1190/*************************************************************************
1191 * SHRegSetPathW [SHLWAPI.@]
1192 *
1193 * See SHRegSetPathA.
1194 */
1196 LPCWSTR lpszPath, DWORD dwFlags)
1197{
1198 WCHAR szBuff[MAX_PATH];
1199#ifdef __REACTOS__
1200 DWORD dwType;
1201 LPCWSTR pszData;
1202 INT cch;
1203
1205
1206 if (PathUnExpandEnvStringsW(lpszPath, szBuff, _countof(szBuff)))
1207 {
1208 dwType = REG_EXPAND_SZ;
1209 pszData = szBuff;
1210 }
1211 else
1212 {
1213 dwType = REG_SZ;
1214 pszData = lpszPath;
1215 }
1216
1217 cch = lstrlenW(pszData);
1218 return SHSetValueW(hKey, lpszSubKey, lpszValue, dwType, pszData, (cch + 1) * sizeof(WCHAR));
1219#else
1220 FIXME("(hkey=%p,%s,%s,%p,%d) - semi-stub\n",hKey, debugstr_w(lpszSubKey),
1221 debugstr_w(lpszValue), lpszPath, dwFlags);
1222
1223 lstrcpyW(szBuff, lpszPath);
1224
1225 /* FIXME: PathUnExpandEnvStringsW(szBuff); */
1226
1227 return SHSetValueW(hKey,lpszSubKey, lpszValue, REG_SZ, szBuff,
1228 lstrlenW(szBuff));
1229#endif
1230}
1231
1232/*************************************************************************
1233 * SHGetValueA [SHLWAPI.@]
1234 *
1235 * Get a value from the registry.
1236 *
1237 * PARAMS
1238 * hKey [I] Handle to registry key
1239 * lpszSubKey [I] Name of sub key containing value to get
1240 * lpszValue [I] Name of value to get
1241 * pwType [O] Pointer to the values type
1242 * pvData [O] Pointer to the values data
1243 * pcbData [O] Pointer to the values size
1244 *
1245 * RETURNS
1246 * Success: ERROR_SUCCESS. Output parameters contain the details read.
1247 * Failure: An error code from RegOpenKeyExA() or SHQueryValueExA().
1248 */
1251{
1252 DWORD dwRet = 0;
1253 HKEY hSubKey = 0;
1254
1255 TRACE("(hkey=%p,%s,%s,%p,%p,%p)\n", hKey, debugstr_a(lpszSubKey),
1256 debugstr_a(lpszValue), pwType, pvData, pcbData);
1257
1258 /* lpszSubKey can be 0. In this case the value is taken from the
1259 * current key.
1260 */
1261 if(lpszSubKey)
1262 dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
1263
1264 if (! dwRet)
1265 {
1266 /* SHQueryValueEx expands Environment strings */
1267 dwRet = SHQueryValueExA(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
1268 if (hSubKey) RegCloseKey(hSubKey);
1269 }
1270 return dwRet;
1271}
1272
1273/*************************************************************************
1274 * SHGetValueW [SHLWAPI.@]
1275 *
1276 * See SHGetValueA.
1277 */
1280{
1281 DWORD dwRet = 0;
1282 HKEY hSubKey = 0;
1283
1284 TRACE("(hkey=%p,%s,%s,%p,%p,%p)\n", hKey, debugstr_w(lpszSubKey),
1285 debugstr_w(lpszValue), pwType, pvData, pcbData);
1286
1287 if(lpszSubKey)
1288 dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
1289
1290 if (! dwRet)
1291 {
1292 dwRet = SHQueryValueExW(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
1293 if (hSubKey) RegCloseKey(hSubKey);
1294 }
1295 return dwRet;
1296}
1297
1298/*************************************************************************
1299 * SHSetValueA [SHLWAPI.@]
1300 *
1301 * Set a value in the registry.
1302 *
1303 * PARAMS
1304 * hKey [I] Handle to registry key
1305 * lpszSubKey [I] Name of sub key under hKey
1306 * lpszValue [I] Name of value to set
1307 * dwType [I] Type of the value
1308 * pvData [I] Data of the value
1309 * cbData [I] Size of the value
1310 *
1311 * RETURNS
1312 * Success: ERROR_SUCCESS. The value is set with the data given.
1313 * Failure: An error code from RegCreateKeyExA() or RegSetValueExA()
1314 *
1315 * NOTES
1316 * If lpszSubKey does not exist, it is created before the value is set. If
1317 * lpszSubKey is NULL or an empty string, then the value is added directly
1318 * to hKey instead.
1319 */
1321 DWORD dwType, LPCVOID pvData, DWORD cbData)
1322{
1323 DWORD dwRet = ERROR_SUCCESS, dwDummy;
1324 HKEY hSubKey;
1325
1326 TRACE("(hkey=%p,%s,%s,%d,%p,%d)\n", hKey, debugstr_a(lpszSubKey),
1327 debugstr_a(lpszValue), dwType, pvData, cbData);
1328
1329 if (lpszSubKey && *lpszSubKey)
1330 dwRet = RegCreateKeyExA(hKey, lpszSubKey, 0, NULL,
1331 0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy);
1332 else
1333 hSubKey = hKey;
1334 if (!dwRet)
1335 {
1336 dwRet = RegSetValueExA(hSubKey, lpszValue, 0, dwType, pvData, cbData);
1337 if (hSubKey != hKey)
1338 RegCloseKey(hSubKey);
1339 }
1340 return dwRet;
1341}
1342
1343/*************************************************************************
1344 * SHSetValueW [SHLWAPI.@]
1345 *
1346 * See SHSetValueA.
1347 */
1349 DWORD dwType, LPCVOID pvData, DWORD cbData)
1350{
1351 DWORD dwRet = ERROR_SUCCESS, dwDummy;
1352 HKEY hSubKey;
1353
1354 TRACE("(hkey=%p,%s,%s,%d,%p,%d)\n", hKey, debugstr_w(lpszSubKey),
1355 debugstr_w(lpszValue), dwType, pvData, cbData);
1356
1357 if (lpszSubKey && *lpszSubKey)
1358 dwRet = RegCreateKeyExW(hKey, lpszSubKey, 0, NULL,
1359 0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy);
1360 else
1361 hSubKey = hKey;
1362 if (!dwRet)
1363 {
1364 dwRet = RegSetValueExW(hSubKey, lpszValue, 0, dwType, pvData, cbData);
1365 if (hSubKey != hKey)
1366 RegCloseKey(hSubKey);
1367 }
1368 return dwRet;
1369}
1370
1371/*************************************************************************
1372 * SHQueryInfoKeyA [SHLWAPI.@]
1373 *
1374 * Get information about a registry key. See RegQueryInfoKeyA().
1375 *
1376 * RETURNS
1377 * The result of calling RegQueryInfoKeyA().
1378 */
1380 LPDWORD pwValues, LPDWORD pwValueMax)
1381{
1382 TRACE("(hkey=%p,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
1383 pwValues, pwValueMax);
1384 return RegQueryInfoKeyA(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
1385 NULL, pwValues, pwValueMax, NULL, NULL, NULL);
1386}
1387
1388/*************************************************************************
1389 * SHQueryInfoKeyW [SHLWAPI.@]
1390 *
1391 * See SHQueryInfoKeyA.
1392 */
1394 LPDWORD pwValues, LPDWORD pwValueMax)
1395{
1396 TRACE("(hkey=%p,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
1397 pwValues, pwValueMax);
1398 return RegQueryInfoKeyW(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
1399 NULL, pwValues, pwValueMax, NULL, NULL, NULL);
1400}
1401
1402/*************************************************************************
1403 * SHQueryValueExA [SHLWAPI.@]
1404 *
1405 * Get a value from the registry, expanding environment variable strings.
1406 *
1407 * PARAMS
1408 * hKey [I] Handle to registry key
1409 * lpszValue [I] Name of value to query
1410 * lpReserved [O] Reserved for future use; must be NULL
1411 * pwType [O] Optional pointer updated with the values type
1412 * pvData [O] Optional pointer updated with the values data
1413 * pcbData [O] Optional pointer updated with the values size
1414 *
1415 * RETURNS
1416 * Success: ERROR_SUCCESS. Any non NULL output parameters are updated with
1417 * information about the value.
1418 * Failure: ERROR_OUTOFMEMORY if memory allocation fails, or the type of the
1419 * data is REG_EXPAND_SZ and pcbData is NULL. Otherwise an error
1420 * code from RegQueryValueExA() or ExpandEnvironmentStringsA().
1421 *
1422 * NOTES
1423 * Either pwType, pvData or pcbData may be NULL if the caller doesn't want
1424 * the type, data or size information for the value.
1425 *
1426 * If the type of the data is REG_EXPAND_SZ, it is expanded to REG_SZ. The
1427 * value returned will be truncated if it is of type REG_SZ and bigger than
1428 * the buffer given to store it.
1429 *
1430 * REG_EXPAND_SZ:
1431 * case-1: the unexpanded string is smaller than the expanded one
1432 * subcase-1: the buffer is too small to hold the unexpanded string:
1433 * function fails and returns the size of the unexpanded string.
1434 *
1435 * subcase-2: buffer is too small to hold the expanded string:
1436 * the function return success (!!) and the result is truncated
1437 * *** This is clearly an error in the native implementation. ***
1438 *
1439 * case-2: the unexpanded string is bigger than the expanded one
1440 * The buffer must have enough space to hold the unexpanded
1441 * string even if the result is smaller.
1442 *
1443 */
1445 LPDWORD lpReserved, LPDWORD pwType,
1447{
1448 DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
1449
1450 TRACE("(hkey=%p,%s,%p,%p,%p,%p=%d)\n", hKey, debugstr_a(lpszValue),
1451 lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
1452
1453 if (pcbData) dwUnExpDataLen = *pcbData;
1454
1455 dwRet = RegQueryValueExA(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
1456
1457 if (pcbData && (dwType == REG_EXPAND_SZ))
1458 {
1459 DWORD nBytesToAlloc;
1460
1461 /* Expand type REG_EXPAND_SZ into REG_SZ */
1462 LPSTR szData;
1463
1464 /* If the caller didn't supply a buffer or the buffer is too small we have
1465 * to allocate our own
1466 */
1467 if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
1468 {
1469 char cNull = '\0';
1470 nBytesToAlloc = dwUnExpDataLen;
1471
1472 szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1473 RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
1474 dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
1475 dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1476 LocalFree(szData);
1477 }
1478 else
1479 {
1480 nBytesToAlloc = (lstrlenA(pvData)+1) * sizeof (CHAR);
1481 szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1482 lstrcpyA(szData, pvData);
1483 dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
1484 if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
1485 dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1486 LocalFree(szData);
1487 }
1488 }
1489
1490 /* Update the type and data size if the caller wanted them */
1491 if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
1492 if ( pwType ) *pwType = dwType;
1493 if ( pcbData ) *pcbData = dwUnExpDataLen;
1494 return dwRet;
1495}
1496
1497
1498/*************************************************************************
1499 * SHQueryValueExW [SHLWAPI.@]
1500 *
1501 * See SHQueryValueExA.
1502 */
1504 LPDWORD lpReserved, LPDWORD pwType,
1506{
1507 DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
1508
1509 TRACE("(hkey=%p,%s,%p,%p,%p,%p=%d)\n", hKey, debugstr_w(lpszValue),
1510 lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
1511
1512 if (pcbData) dwUnExpDataLen = *pcbData;
1513
1514 dwRet = RegQueryValueExW(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
1515 if (dwRet!=ERROR_SUCCESS && dwRet!=ERROR_MORE_DATA)
1516 return dwRet;
1517
1518 if (pcbData && (dwType == REG_EXPAND_SZ))
1519 {
1520 DWORD nBytesToAlloc;
1521
1522 /* Expand type REG_EXPAND_SZ into REG_SZ */
1523 LPWSTR szData;
1524
1525 /* If the caller didn't supply a buffer or the buffer is too small we have
1526 * to allocate our own
1527 */
1528 if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
1529 {
1530 WCHAR cNull = '\0';
1531 nBytesToAlloc = dwUnExpDataLen;
1532
1533 szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1534 RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
1535 dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
1536 dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1537 LocalFree(szData);
1538 }
1539 else
1540 {
1541 nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
1542 szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1543 lstrcpyW(szData, pvData);
1544 dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
1545 if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
1546 dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1547 LocalFree(szData);
1548 }
1549 }
1550
1551 /* Update the type and data size if the caller wanted them */
1552 if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
1553 if ( pwType ) *pwType = dwType;
1554 if ( pcbData ) *pcbData = dwUnExpDataLen;
1555 return dwRet;
1556}
1557
1558/*************************************************************************
1559 * SHDeleteKeyA [SHLWAPI.@]
1560 *
1561 * Delete a registry key and any sub keys/values present
1562 *
1563 * This function forwards to the unicode version directly, to avoid
1564 * handling subkeys that are not representable in ASCII.
1565 *
1566 * PARAMS
1567 * hKey [I] Handle to registry key
1568 * lpszSubKey [I] Name of sub key to delete
1569 *
1570 * RETURNS
1571 * Success: ERROR_SUCCESS. The key is deleted.
1572 * Failure: An error code from RegOpenKeyExA(), RegQueryInfoKeyA(),
1573 * RegEnumKeyExA() or RegDeleteKeyA().
1574 */
1576{
1577 WCHAR subkeyW[MAX_PATH];
1578
1579 MultiByteToWideChar (CP_ACP, 0, lpszSubKey, -1, subkeyW, sizeof(subkeyW)/sizeof(WCHAR));
1580 return SHDeleteKeyW(hKey, subkeyW);
1581}
1582
1583/*************************************************************************
1584 * SHDeleteKeyW [SHLWAPI.@]
1585 *
1586 * See SHDeleteKeyA.
1587 */
1589{
1590 DWORD dwRet, dwMaxSubkeyLen = 0, dwSize;
1591 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1592 HKEY hSubKey = 0;
1593
1594 TRACE("(hkey=%p,%s)\n", hKey, debugstr_w(lpszSubKey));
1595
1596 dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1597 if(!dwRet)
1598 {
1599 /* Find the maximum subkey length so that we can allocate a buffer */
1600 dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
1601 &dwMaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
1602 if(!dwRet)
1603 {
1604 dwMaxSubkeyLen++;
1605 if (dwMaxSubkeyLen > sizeof(szNameBuf)/sizeof(WCHAR))
1606 /* Name too big: alloc a buffer for it */
1607 lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(WCHAR));
1608
1609 if(!lpszName)
1611 else
1612 {
1613 while (dwRet == ERROR_SUCCESS)
1614 {
1615 dwSize = dwMaxSubkeyLen;
1616 dwRet = RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL, NULL, NULL, NULL);
1617 if (dwRet == ERROR_SUCCESS || dwRet == ERROR_MORE_DATA)
1618 dwRet = SHDeleteKeyW(hSubKey, lpszName);
1619 }
1620 if (dwRet == ERROR_NO_MORE_ITEMS)
1621 dwRet = ERROR_SUCCESS;
1622
1623 if (lpszName != szNameBuf)
1624 HeapFree(GetProcessHeap(), 0, lpszName); /* Free buffer if allocated */
1625 }
1626 }
1627
1628 RegCloseKey(hSubKey);
1629 if(!dwRet)
1630 dwRet = RegDeleteKeyW(hKey, lpszSubKey);
1631 }
1632 return dwRet;
1633}
1634
1635/*************************************************************************
1636 * SHDeleteEmptyKeyA [SHLWAPI.@]
1637 *
1638 * Delete a registry key with no sub keys.
1639 *
1640 * PARAMS
1641 * hKey [I] Handle to registry key
1642 * lpszSubKey [I] Name of sub key to delete
1643 *
1644 * RETURNS
1645 * Success: ERROR_SUCCESS. The key is deleted.
1646 * Failure: If the key is not empty, returns ERROR_KEY_HAS_CHILDREN. Otherwise
1647 * returns an error code from RegOpenKeyExA(), RegQueryInfoKeyA() or
1648 * RegDeleteKeyA().
1649 */
1651{
1652 DWORD dwRet, dwKeyCount = 0;
1653 HKEY hSubKey = 0;
1654
1655 TRACE("(hkey=%p,%s)\n", hKey, debugstr_a(lpszSubKey));
1656
1657 dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1658 if(!dwRet)
1659 {
1660 dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1661 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1662 RegCloseKey(hSubKey);
1663 if(!dwRet)
1664 {
1665 if (!dwKeyCount)
1666 dwRet = RegDeleteKeyA(hKey, lpszSubKey);
1667 else
1668 dwRet = ERROR_KEY_HAS_CHILDREN;
1669 }
1670 }
1671 return dwRet;
1672}
1673
1674/*************************************************************************
1675 * SHDeleteEmptyKeyW [SHLWAPI.@]
1676 *
1677 * See SHDeleteEmptyKeyA.
1678 */
1680{
1681 DWORD dwRet, dwKeyCount = 0;
1682 HKEY hSubKey = 0;
1683
1684 TRACE("(hkey=%p, %s)\n", hKey, debugstr_w(lpszSubKey));
1685
1686 dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1687 if(!dwRet)
1688 {
1689 dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1690 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1691 RegCloseKey(hSubKey);
1692 if(!dwRet)
1693 {
1694 if (!dwKeyCount)
1695 dwRet = RegDeleteKeyW(hKey, lpszSubKey);
1696 else
1697 dwRet = ERROR_KEY_HAS_CHILDREN;
1698 }
1699 }
1700 return dwRet;
1701}
1702
1703/*************************************************************************
1704 * SHDeleteOrphanKeyA [SHLWAPI.@]
1705 *
1706 * Delete a registry key with no sub keys or values.
1707 *
1708 * PARAMS
1709 * hKey [I] Handle to registry key
1710 * lpszSubKey [I] Name of sub key to possibly delete
1711 *
1712 * RETURNS
1713 * Success: ERROR_SUCCESS. The key has been deleted if it was an orphan.
1714 * Failure: An error from RegOpenKeyExA(), RegQueryValueExA(), or RegDeleteKeyA().
1715 */
1717{
1718 HKEY hSubKey;
1719 DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
1720
1721 TRACE("(hkey=%p,%s)\n", hKey, debugstr_a(lpszSubKey));
1722
1723 dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1724
1725 if(!dwRet)
1726 {
1727 /* Get subkey and value count */
1728 dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1729 NULL, NULL, &dwValueCount, NULL, NULL, NULL, NULL);
1730
1731 if(!dwRet && !dwKeyCount && !dwValueCount)
1732 {
1733 dwRet = RegDeleteKeyA(hKey, lpszSubKey);
1734 }
1735 RegCloseKey(hSubKey);
1736 }
1737 return dwRet;
1738}
1739
1740/*************************************************************************
1741 * SHDeleteOrphanKeyW [SHLWAPI.@]
1742 *
1743 * See SHDeleteOrphanKeyA.
1744 */
1746{
1747 HKEY hSubKey;
1748 DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
1749
1750 TRACE("(hkey=%p,%s)\n", hKey, debugstr_w(lpszSubKey));
1751
1752 dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1753
1754 if(!dwRet)
1755 {
1756 /* Get subkey and value count */
1757 dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1758 NULL, NULL, &dwValueCount, NULL, NULL, NULL, NULL);
1759
1760 if(!dwRet && !dwKeyCount && !dwValueCount)
1761 {
1762 dwRet = RegDeleteKeyW(hKey, lpszSubKey);
1763 }
1764 RegCloseKey(hSubKey);
1765 }
1766 return dwRet;
1767}
1768
1769/*************************************************************************
1770 * SHDeleteValueA [SHLWAPI.@]
1771 *
1772 * Delete a value from the registry.
1773 *
1774 * PARAMS
1775 * hKey [I] Handle to registry key
1776 * lpszSubKey [I] Name of sub key containing value to delete
1777 * lpszValue [I] Name of value to delete
1778 *
1779 * RETURNS
1780 * Success: ERROR_SUCCESS. The value is deleted.
1781 * Failure: An error code from RegOpenKeyExA() or RegDeleteValueA().
1782 */
1784{
1785 DWORD dwRet;
1786 HKEY hSubKey;
1787
1788 TRACE("(hkey=%p,%s,%s)\n", hKey, debugstr_a(lpszSubKey), debugstr_a(lpszValue));
1789
1790 dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
1791 if (!dwRet)
1792 {
1793 dwRet = RegDeleteValueA(hSubKey, lpszValue);
1794 RegCloseKey(hSubKey);
1795 }
1796 return dwRet;
1797}
1798
1799/*************************************************************************
1800 * SHDeleteValueW [SHLWAPI.@]
1801 *
1802 * See SHDeleteValueA.
1803 */
1805{
1806 DWORD dwRet;
1807 HKEY hSubKey;
1808
1809 TRACE("(hkey=%p,%s,%s)\n", hKey, debugstr_w(lpszSubKey), debugstr_w(lpszValue));
1810
1811 dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
1812 if (!dwRet)
1813 {
1814 dwRet = RegDeleteValueW(hSubKey, lpszValue);
1815 RegCloseKey(hSubKey);
1816 }
1817 return dwRet;
1818}
1819
1820/*************************************************************************
1821 * SHEnumKeyExA [SHLWAPI.@]
1822 *
1823 * Enumerate sub keys in a registry key.
1824 *
1825 * PARAMS
1826 * hKey [I] Handle to registry key
1827 * dwIndex [I] Index of key to enumerate
1828 * lpszSubKey [O] Pointer updated with the subkey name
1829 * pwLen [O] Pointer updated with the subkey length
1830 *
1831 * RETURNS
1832 * Success: ERROR_SUCCESS. lpszSubKey and pwLen are updated.
1833 * Failure: An error code from RegEnumKeyExA().
1834 */
1836 LPDWORD pwLen)
1837{
1838 TRACE("(hkey=%p,%d,%s,%p)\n", hKey, dwIndex, debugstr_a(lpszSubKey), pwLen);
1839
1840 return RegEnumKeyExA(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
1841}
1842
1843/*************************************************************************
1844 * SHEnumKeyExW [SHLWAPI.@]
1845 *
1846 * See SHEnumKeyExA.
1847 */
1849 LPDWORD pwLen)
1850{
1851 TRACE("(hkey=%p,%d,%s,%p)\n", hKey, dwIndex, debugstr_w(lpszSubKey), pwLen);
1852
1853 return RegEnumKeyExW(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
1854}
1855
1856/*************************************************************************
1857 * SHEnumValueA [SHLWAPI.@]
1858 *
1859 * Enumerate values in a registry key.
1860 *
1861 * PARAMS
1862 * hKey [I] Handle to registry key
1863 * dwIndex [I] Index of key to enumerate
1864 * lpszValue [O] Pointer updated with the values name
1865 * pwLen [O] Pointer updated with the values length
1866 * pwType [O] Pointer updated with the values type
1867 * pvData [O] Pointer updated with the values data
1868 * pcbData [O] Pointer updated with the values size
1869 *
1870 * RETURNS
1871 * Success: ERROR_SUCCESS. Output parameters are updated.
1872 * Failure: An error code from RegEnumValueA().
1873 */
1875 LPDWORD pwLen, LPDWORD pwType,
1877{
1878 TRACE("(hkey=%p,%d,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
1879 debugstr_a(lpszValue), pwLen, pwType, pvData, pcbData);
1880
1881 return RegEnumValueA(hKey, dwIndex, lpszValue, pwLen, NULL,
1882 pwType, pvData, pcbData);
1883}
1884
1885/*************************************************************************
1886 * SHEnumValueW [SHLWAPI.@]
1887 *
1888 * See SHEnumValueA.
1889 */
1891 LPDWORD pwLen, LPDWORD pwType,
1893{
1894 TRACE("(hkey=%p,%d,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
1895 debugstr_w(lpszValue), pwLen, pwType, pvData, pcbData);
1896
1897 return RegEnumValueW(hKey, dwIndex, lpszValue, pwLen, NULL,
1898 pwType, pvData, pcbData);
1899}
1900
1901/*************************************************************************
1902 * @ [SHLWAPI.205]
1903 *
1904 * Get a value from the registry.
1905 *
1906 * PARAMS
1907 * hKey [I] Handle to registry key
1908 * pSubKey [I] Name of sub key containing value to get
1909 * pValue [I] Name of value to get
1910 * pwType [O] Destination for the values type
1911 * pvData [O] Destination for the values data
1912 * pbData [O] Destination for the values size
1913 *
1914 * RETURNS
1915 * Success: ERROR_SUCCESS. Output parameters contain the details read.
1916 * Failure: An error code from RegOpenKeyExA() or SHQueryValueExA(),
1917 * or ERROR_INVALID_FUNCTION in the machine is in safe mode.
1918 */
1920 LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
1921{
1924 return SHGetValueA(hkey, pSubKey, pValue, pwType, pvData, pbData);
1925}
1926
1927/*************************************************************************
1928 * @ [SHLWAPI.206]
1929 *
1930 * Unicode version of SHGetValueGoodBootW.
1931 */
1933 LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
1934{
1937 return SHGetValueW(hkey, pSubKey, pValue, pwType, pvData, pbData);
1938}
1939
1940/*************************************************************************
1941 * @ [SHLWAPI.320]
1942 *
1943 * Set a MIME content type in the registry.
1944 *
1945 * PARAMS
1946 * lpszSubKey [I] Name of key under HKEY_CLASSES_ROOT.
1947 * lpszValue [I] Value to set
1948 *
1949 * RETURNS
1950 * Success: TRUE
1951 * Failure: FALSE
1952 */
1954{
1955 if (!lpszValue)
1956 {
1957 WARN("Invalid lpszValue would crash under Win32!\n");
1958 return FALSE;
1959 }
1960
1961 return !SHSetValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA,
1962 REG_SZ, lpszValue, strlen(lpszValue));
1963}
1964
1965/*************************************************************************
1966 * @ [SHLWAPI.321]
1967 *
1968 * Unicode version of RegisterMIMETypeForExtensionA.
1969 */
1971{
1972 if (!lpszValue)
1973 {
1974 WARN("Invalid lpszValue would crash under Win32!\n");
1975 return FALSE;
1976 }
1977
1978 return !SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW,
1979 REG_SZ, lpszValue, strlenW(lpszValue));
1980}
1981
1982/*************************************************************************
1983 * @ [SHLWAPI.322]
1984 *
1985 * Delete a MIME content type from the registry.
1986 *
1987 * PARAMS
1988 * lpszSubKey [I] Name of sub key
1989 *
1990 * RETURNS
1991 * Success: TRUE
1992 * Failure: FALSE
1993 */
1995{
1997}
1998
1999/*************************************************************************
2000 * @ [SHLWAPI.323]
2001 *
2002 * Unicode version of UnregisterMIMETypeForExtensionA.
2003 */
2005{
2007}
2008
2009/*************************************************************************
2010 * @ [SHLWAPI.328]
2011 *
2012 * Get the registry path to a MIME content key.
2013 *
2014 * PARAMS
2015 * lpszType [I] Content type to get the path for
2016 * lpszBuffer [O] Destination for path
2017 * dwLen [I] Length of lpszBuffer
2018 *
2019 * RETURNS
2020 * Success: TRUE. lpszBuffer contains the full path.
2021 * Failure: FALSE.
2022 *
2023 * NOTES
2024 * The base path for the key is "MIME\Database\Content Type\"
2025 */
2026BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
2027{
2028 TRACE("(%s,%p,%d)\n", debugstr_a(lpszType), lpszBuffer, dwLen);
2029
2030 if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer)
2031 {
2032 size_t dwStrLen = strlen(lpszType);
2033
2034 if (dwStrLen < dwLen - dwLenMimeDbContent)
2035 {
2037 memcpy(lpszBuffer + dwLenMimeDbContent, lpszType, dwStrLen + 1);
2038 return TRUE;
2039 }
2040 }
2041 return FALSE;
2042}
2043
2044/*************************************************************************
2045 * @ [SHLWAPI.329]
2046 *
2047 * Unicode version of GetMIMETypeSubKeyA.
2048 */
2049BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
2050{
2051 TRACE("(%s,%p,%d)\n", debugstr_w(lpszType), lpszBuffer, dwLen);
2052
2053 if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer)
2054 {
2055 DWORD dwStrLen = strlenW(lpszType);
2056
2057 if (dwStrLen < dwLen - dwLenMimeDbContent)
2058 {
2059 memcpy(lpszBuffer, szMimeDbContentW, dwLenMimeDbContent * sizeof(WCHAR));
2060 memcpy(lpszBuffer + dwLenMimeDbContent, lpszType, (dwStrLen + 1) * sizeof(WCHAR));
2061 return TRUE;
2062 }
2063 }
2064 return FALSE;
2065}
2066
2067/*************************************************************************
2068 * @ [SHLWAPI.330]
2069 *
2070 * Get the file extension for a given Mime type.
2071 *
2072 * PARAMS
2073 * lpszType [I] Mime type to get the file extension for
2074 * lpExt [O] Destination for the resulting extension
2075 * iLen [I] Length of lpExt in characters
2076 *
2077 * RETURNS
2078 * Success: TRUE. lpExt contains the file extension.
2079 * Failure: FALSE, if any parameter is invalid or the extension cannot be
2080 * retrieved. If iLen > 0, lpExt is set to an empty string.
2081 *
2082 * NOTES
2083 * - The extension returned in lpExt always has a leading '.' character, even
2084 * if the registry Mime database entry does not.
2085 * - iLen must be long enough for the file extension for this function to succeed.
2086 */
2088{
2089 char szSubKey[MAX_PATH];
2090 DWORD dwlen = iLen - 1, dwType;
2091 BOOL bRet = FALSE;
2092
2093 if (iLen > 0 && lpExt)
2094 *lpExt = '\0';
2095
2096 if (lpszType && lpExt && iLen > 2 &&
2097 GetMIMETypeSubKeyA(lpszType, szSubKey, MAX_PATH) &&
2098 !SHGetValueA(HKEY_CLASSES_ROOT, szSubKey, szExtensionA, &dwType, lpExt + 1, &dwlen) &&
2099 lpExt[1])
2100 {
2101 if (lpExt[1] == '.')
2102 memmove(lpExt, lpExt + 1, strlen(lpExt + 1) + 1);
2103 else
2104 *lpExt = '.'; /* Supply a '.' */
2105 bRet = TRUE;
2106 }
2107 return bRet;
2108}
2109
2110/*************************************************************************
2111 * @ [SHLWAPI.331]
2112 *
2113 * Unicode version of MIME_GetExtensionA.
2114 */
2116{
2117 WCHAR szSubKey[MAX_PATH];
2118 DWORD dwlen = iLen - 1, dwType;
2119 BOOL bRet = FALSE;
2120
2121 if (iLen > 0 && lpExt)
2122 *lpExt = '\0';
2123
2124 if (lpszType && lpExt && iLen > 2 &&
2125 GetMIMETypeSubKeyW(lpszType, szSubKey, MAX_PATH) &&
2126 !SHGetValueW(HKEY_CLASSES_ROOT, szSubKey, szExtensionW, &dwType, lpExt + 1, &dwlen) &&
2127 lpExt[1])
2128 {
2129 if (lpExt[1] == '.')
2130 memmove(lpExt, lpExt + 1, (strlenW(lpExt + 1) + 1) * sizeof(WCHAR));
2131 else
2132 *lpExt = '.'; /* Supply a '.' */
2133 bRet = TRUE;
2134 }
2135 return bRet;
2136}
2137
2138/*************************************************************************
2139 * @ [SHLWAPI.324]
2140 *
2141 * Set the file extension for a MIME content key.
2142 *
2143 * PARAMS
2144 * lpszExt [I] File extension to set
2145 * lpszType [I] Content type to set the extension for
2146 *
2147 * RETURNS
2148 * Success: TRUE. The file extension is set in the registry.
2149 * Failure: FALSE.
2150 */
2152{
2153 DWORD dwLen;
2154 char szKey[MAX_PATH];
2155
2156 TRACE("(%s,%s)\n", debugstr_a(lpszExt), debugstr_a(lpszType));
2157
2158 if (!GetMIMETypeSubKeyA(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2159 return FALSE;
2160
2161 dwLen = strlen(lpszExt) + 1;
2162
2163 if (SHSetValueA(HKEY_CLASSES_ROOT, szKey, szExtensionA, REG_SZ, lpszExt, dwLen))
2164 return FALSE;
2165 return TRUE;
2166}
2167
2168/*************************************************************************
2169 * @ [SHLWAPI.325]
2170 *
2171 * Unicode version of RegisterExtensionForMIMETypeA.
2172 */
2174{
2175 DWORD dwLen;
2176 WCHAR szKey[MAX_PATH];
2177
2178 TRACE("(%s,%s)\n", debugstr_w(lpszExt), debugstr_w(lpszType));
2179
2180 /* Get the full path to the key */
2181 if (!GetMIMETypeSubKeyW(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2182 return FALSE;
2183
2184 dwLen = (lstrlenW(lpszExt) + 1) * sizeof(WCHAR);
2185
2186 if (SHSetValueW(HKEY_CLASSES_ROOT, szKey, szExtensionW, REG_SZ, lpszExt, dwLen))
2187 return FALSE;
2188 return TRUE;
2189}
2190
2191/*************************************************************************
2192 * @ [SHLWAPI.326]
2193 *
2194 * Delete a file extension from a MIME content type.
2195 *
2196 * PARAMS
2197 * lpszType [I] Content type to delete the extension for
2198 *
2199 * RETURNS
2200 * Success: TRUE. The file extension is deleted from the registry.
2201 * Failure: FALSE. The extension may have been removed but the key remains.
2202 *
2203 * NOTES
2204 * If deleting the extension leaves an orphan key, the key is removed also.
2205 */
2207{
2208 char szKey[MAX_PATH];
2209
2210 TRACE("(%s)\n", debugstr_a(lpszType));
2211
2212 if (!GetMIMETypeSubKeyA(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2213 return FALSE;
2214
2216 return FALSE;
2217
2219 return FALSE;
2220 return TRUE;
2221}
2222
2223/*************************************************************************
2224 * @ [SHLWAPI.327]
2225 *
2226 * Unicode version of UnregisterExtensionForMIMETypeA.
2227 */
2229{
2230 WCHAR szKey[MAX_PATH];
2231
2232 TRACE("(%s)\n", debugstr_w(lpszType));
2233
2234 if (!GetMIMETypeSubKeyW(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2235 return FALSE;
2236
2238 return FALSE;
2239
2241 return FALSE;
2242 return TRUE;
2243}
2244
2245/*************************************************************************
2246 * SHRegDuplicateHKey [SHLWAPI.@]
2247 *
2248 * Create a duplicate of a registry handle.
2249 *
2250 * PARAMS
2251 * hKey [I] key to duplicate.
2252 *
2253 * RETURNS
2254 * A new handle pointing to the same key as hKey.
2255 */
2257{
2258 HKEY newKey = 0;
2259
2260 RegOpenKeyExA(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey);
2261 TRACE("new key is %p\n", newKey);
2262 return newKey;
2263}
2264
2265
2266/*************************************************************************
2267 * SHCopyKeyA [SHLWAPI.@]
2268 *
2269 * Copy a key and its values/sub keys to another location.
2270 *
2271 * PARAMS
2272 * hKeySrc [I] Source key to copy from
2273 * lpszSrcSubKey [I] Sub key under hKeySrc, or NULL to use hKeySrc directly
2274 * hKeyDst [I] Destination key
2275 * dwReserved [I] Reserved, must be 0
2276 *
2277 * RETURNS
2278 * Success: ERROR_SUCCESS. The key is copied to the destination key.
2279 * Failure: A standard windows error code.
2280 *
2281 * NOTES
2282 * If hKeyDst is a key under hKeySrc, this function will misbehave
2283 * (It will loop until out of stack, or the registry is full). This
2284 * bug is present in Win32 also.
2285 */
2286DWORD WINAPI SHCopyKeyA(HKEY hKeySrc, LPCSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
2287{
2288 WCHAR szSubKeyW[MAX_PATH];
2289
2290 TRACE("(hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_a(lpszSrcSubKey), hKeyDst, dwReserved);
2291
2292 if (lpszSrcSubKey)
2293 MultiByteToWideChar(CP_ACP, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH);
2294
2295 return SHCopyKeyW(hKeySrc, lpszSrcSubKey ? szSubKeyW : NULL, hKeyDst, dwReserved);
2296}
2297
2298/*************************************************************************
2299 * SHCopyKeyW [SHLWAPI.@]
2300 *
2301 * See SHCopyKeyA.
2302 */
2303DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
2304{
2305 DWORD dwKeyCount = 0, dwValueCount = 0, dwMaxKeyLen = 0;
2306 DWORD dwMaxValueLen = 0, dwMaxDataLen = 0, i;
2307 BYTE buff[1024];
2308 LPVOID lpBuff = buff;
2309 WCHAR szName[MAX_PATH], *lpszName = szName;
2310 DWORD dwRet = S_OK;
2311
2312 TRACE("hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_w(lpszSrcSubKey), hKeyDst, dwReserved);
2313
2314 if(!hKeyDst || !hKeySrc)
2316 else
2317 {
2318 /* Open source key */
2319 if(lpszSrcSubKey)
2320 dwRet = RegOpenKeyExW(hKeySrc, lpszSrcSubKey, 0, KEY_ALL_ACCESS, &hKeySrc);
2321
2322 if(dwRet)
2323 hKeyDst = NULL; /* Don't close this key since we didn't open it */
2324 else
2325 {
2326 /* Get details about sub keys and values */
2327 dwRet = RegQueryInfoKeyW(hKeySrc, NULL, NULL, NULL, &dwKeyCount, &dwMaxKeyLen,
2328 NULL, &dwValueCount, &dwMaxValueLen, &dwMaxDataLen,
2329 NULL, NULL);
2330 if(!dwRet)
2331 {
2332 if (dwMaxValueLen > dwMaxKeyLen)
2333 dwMaxKeyLen = dwMaxValueLen; /* Get max size for key/value names */
2334
2335 if (dwMaxKeyLen++ > MAX_PATH - 1)
2336 lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxKeyLen * sizeof(WCHAR));
2337
2338 if (dwMaxDataLen > sizeof(buff))
2339 lpBuff = HeapAlloc(GetProcessHeap(), 0, dwMaxDataLen);
2340
2341 if (!lpszName || !lpBuff)
2343 }
2344 }
2345 }
2346
2347 /* Copy all the sub keys */
2348 for(i = 0; i < dwKeyCount && !dwRet; i++)
2349 {
2350 HKEY hSubKeySrc, hSubKeyDst;
2351 DWORD dwSize = dwMaxKeyLen;
2352
2353 dwRet = RegEnumKeyExW(hKeySrc, i, lpszName, &dwSize, NULL, NULL, NULL, NULL);
2354
2355 if(!dwRet)
2356 {
2357 /* Open source sub key */
2358 dwRet = RegOpenKeyExW(hKeySrc, lpszName, 0, KEY_READ, &hSubKeySrc);
2359
2360 if(!dwRet)
2361 {
2362 /* Create destination sub key */
2363 dwRet = RegCreateKeyW(hKeyDst, lpszName, &hSubKeyDst);
2364
2365 if(!dwRet)
2366 {
2367 /* Recursively copy keys and values from the sub key */
2368 dwRet = SHCopyKeyW(hSubKeySrc, NULL, hSubKeyDst, 0);
2369 RegCloseKey(hSubKeyDst);
2370 }
2371 }
2372 RegCloseKey(hSubKeySrc);
2373 }
2374 }
2375
2376 /* Copy all the values in this key */
2377 for (i = 0; i < dwValueCount && !dwRet; i++)
2378 {
2379 DWORD dwNameSize = dwMaxKeyLen, dwType, dwLen = dwMaxDataLen;
2380
2381 dwRet = RegEnumValueW(hKeySrc, i, lpszName, &dwNameSize, NULL, &dwType, lpBuff, &dwLen);
2382
2383 if (!dwRet)
2384 dwRet = SHSetValueW(hKeyDst, NULL, lpszName, dwType, lpBuff, dwLen);
2385 }
2386
2387 /* Free buffers if allocated */
2388 if (lpszName != szName)
2389 HeapFree(GetProcessHeap(), 0, lpszName);
2390 if (lpBuff != buff)
2391 HeapFree(GetProcessHeap(), 0, lpBuff);
2392
2393 if (lpszSrcSubKey && hKeyDst)
2394 RegCloseKey(hKeyDst);
2395 return dwRet;
2396}
2397
2398/*
2399 * The following functions are ORDINAL ONLY:
2400 */
2401
2402/*************************************************************************
2403 * @ [SHLWAPI.280]
2404 *
2405 * Read an integer value from the registry, falling back to a default.
2406 *
2407 * PARAMS
2408 * hKey [I] Registry key to read from
2409 * lpszValue [I] Value name to read
2410 * iDefault [I] Default value to return
2411 *
2412 * RETURNS
2413 * The value contained in the given registry value if present, otherwise
2414 * iDefault.
2415 */
2416int WINAPI SHRegGetIntW(HKEY hKey, LPCWSTR lpszValue, int iDefault)
2417{
2418 TRACE("(%p,%s,%d)\n", hKey, debugstr_w(lpszValue), iDefault);
2419
2420 if (hKey)
2421 {
2422 WCHAR szBuff[32];
2423 DWORD dwSize = sizeof(szBuff);
2424 szBuff[0] = '\0';
2425 SHQueryValueExW(hKey, lpszValue, 0, 0, szBuff, &dwSize);
2426
2427 if(*szBuff >= '0' && *szBuff <= '9')
2428 return StrToIntW(szBuff);
2429 }
2430 return iDefault;
2431}
2432
2433/*************************************************************************
2434 * @ [SHLWAPI.343]
2435 *
2436 * Create or open an explorer ClassId Key.
2437 *
2438 * PARAMS
2439 * guid [I] Explorer ClassId key to open
2440 * lpszValue [I] Value name under the ClassId Key
2441 * bUseHKCU [I] TRUE=Use HKEY_CURRENT_USER, FALSE=Use HKEY_CLASSES_ROOT
2442 * bCreate [I] TRUE=Create the key if it doesn't exist, FALSE=Don't
2443 * phKey [O] Destination for the resulting key handle
2444 *
2445 * RETURNS
2446 * Success: S_OK. phKey contains the resulting registry handle.
2447 * Failure: An HRESULT error code indicating the problem.
2448 */
2450{
2451 WCHAR szValue[MAX_PATH];
2452
2453 if (lpszValue)
2454 MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, sizeof(szValue)/sizeof(WCHAR));
2455
2456 return SHRegGetCLSIDKeyW(guid, lpszValue ? szValue : NULL, bUseHKCU, bCreate, phKey);
2457}
2458
2459/*************************************************************************
2460 * @ [SHLWAPI.344]
2461 *
2462 * Unicode version of SHRegGetCLSIDKeyA.
2463 */
2465 BOOL bCreate, PHKEY phKey)
2466{
2467#ifndef __REACTOS__
2468 static const WCHAR szClassIdKey[] = { 'S','o','f','t','w','a','r','e','\\',
2469 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
2470 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
2471 'E','x','p','l','o','r','e','r','\\','C','L','S','I','D','\\' };
2472#endif
2473#define szClassIdKeyLen (sizeof(szClassIdKey)/sizeof(WCHAR))
2474 WCHAR szKey[MAX_PATH];
2475 DWORD dwRet;
2476 HKEY hkey;
2477
2478 /* Create the key string */
2479#ifdef __REACTOS__
2480 // https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/reg/reggetclsidkey.htm
2481 WCHAR* ptr;
2482
2483 wcscpy(szKey, bUseHKCU ? L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\" : L"CLSID\\");
2484 ptr = szKey + wcslen(szKey);
2485 SHStringFromGUIDW(guid, ptr, 39); /* Append guid */
2486 if (lpszValue)
2487 {
2488 ptr = szKey + wcslen(szKey);
2489 wcscat(ptr, L"\\");
2490 wcscat(++ptr, lpszValue);
2491 }
2492#else
2493 memcpy(szKey, szClassIdKey, sizeof(szClassIdKey));
2494 SHStringFromGUIDW(guid, szKey + szClassIdKeyLen, 39); /* Append guid */
2495
2496 if(lpszValue)
2497 {
2498 szKey[szClassIdKeyLen + 39] = '\\';
2499 strcpyW(szKey + szClassIdKeyLen + 40, lpszValue); /* Append value name */
2500 }
2501#endif
2502
2503 hkey = bUseHKCU ? HKEY_CURRENT_USER : HKEY_CLASSES_ROOT;
2504
2505 if(bCreate)
2506 dwRet = RegCreateKeyW(hkey, szKey, phKey);
2507 else
2508 dwRet = RegOpenKeyExW(hkey, szKey, 0, KEY_READ, phKey);
2509
2510 return dwRet ? HRESULT_FROM_WIN32(dwRet) : S_OK;
2511}
2512
2513/*************************************************************************
2514 * SHRegisterValidateTemplate [SHLWAPI.@]
2515 *
2516 * observed from the ie 5.5 installer:
2517 * - allocates a buffer with the size of the given file
2518 * - read the file content into the buffer
2519 * - creates the key szTemplateKey
2520 * - sets "205523652929647911071668590831910975402"=dword:00002e37 at
2521 * the key
2522 *
2523 * PARAMS
2524 * filename [I] An existing file its content is read into an allocated
2525 * buffer
2526 * unknown [I]
2527 *
2528 * RETURNS
2529 * Success: ERROR_SUCCESS.
2530 */
2532{
2533/* static const WCHAR szTemplateKey[] = { 'S','o','f','t','w','a','r','e','\\',
2534 * 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
2535 * 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
2536 * 'E','x','p','l','o','r','e','r','\\',
2537 * 'T','e','m','p','l','a','t','e','R','e','g','i','s','t','r','y',0 };
2538 */
2539 FIXME("stub: %s, %08x\n", debugstr_w(filename), unknown);
2540
2541 return S_OK;
2542}
PRTL_UNICODE_STRING_BUFFER Path
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3583
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2668
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2287
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2419
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
INT WINAPI StrToIntW(LPCWSTR lpString)
Definition: string.c:407
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:400
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:520
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:883
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
BOOL WINAPI PathUnExpandEnvStringsW(const WCHAR *path, WCHAR *buffer, UINT buf_len)
Definition: path.c:2705
BOOL WINAPI PathUnExpandEnvStringsA(const char *path, char *buffer, UINT buf_len)
Definition: path.c:2665
GUID guid
Definition: version.c:147
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
HRESULT WINAPI SHRegisterValidateTemplate(LPCWSTR filename, BOOL unknown)
Definition: reg.c:2531
BOOL WINAPI UnregisterMIMETypeForExtensionW(LPCWSTR lpszSubKey)
Definition: reg.c:2004
DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
Definition: reg.c:2303
LONG WINAPI SHEnumKeyExW(HKEY hKey, DWORD dwIndex, LPWSTR lpszSubKey, LPDWORD pwLen)
Definition: reg.c:1848
static const char lpszContentTypeA[]
Definition: reg.c:36
LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:123
LONG WINAPI SHRegQueryInfoUSKeyW(HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags)
Definition: reg.c:875
DWORD WINAPI SHCopyKeyA(HKEY hKeySrc, LPCSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
Definition: reg.c:2286
struct SHUSKEY * LPSHUSKEY
DWORD WINAPI SHGetValueGoodBootA(HKEY hkey, LPCSTR pSubKey, LPCSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
Definition: reg.c:1919
BOOL WINAPI UnregisterMIMETypeForExtensionA(LPCSTR lpszSubKey)
Definition: reg.c:1994
LONG WINAPI SHRegQueryUSValueA(HUSKEY hUSKey, LPCSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
Definition: reg.c:453
BOOL WINAPI RegisterMIMETypeForExtensionA(LPCSTR lpszSubKey, LPCSTR lpszValue)
Definition: reg.c:1953
DWORD WINAPI SHRegSetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPCSTR lpszPath, DWORD dwFlags)
Definition: reg.c:1153
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
LONG WINAPI SHRegEnumUSKeyA(HUSKEY hUSKey, DWORD dwIndex, LPSTR pszName, LPDWORD pcchValueNameLen, SHREGENUM_FLAGS enumRegFlags)
Definition: reg.c:920
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
Definition: reg.c:1804
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1588
LONG WINAPI SHQueryInfoKeyA(HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax, LPDWORD pwValues, LPDWORD pwValueMax)
Definition: reg.c:1379
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1278
LONG WINAPI SHRegGetUSValueA(LPCSTR pSubKey, LPCSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
Definition: reg.c:561
DWORD WINAPI SHDeleteOrphanKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1745
BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:2049
DWORD WINAPI SHRegGetPathW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPWSTR lpszPath, DWORD dwFlags)
Definition: reg.c:1125
LONG WINAPI SHEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpszValue, LPDWORD pwLen, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1874
static const DWORD dwLenMimeDbContent
Definition: reg.c:43
LONG WINAPI SHRegDeleteEmptyUSKeyA(HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags)
Definition: reg.c:318
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1249
HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID, LPCWSTR, BOOL, BOOL, PHKEY)
Definition: reg.c:2464
#define REG_HKCU
Definition: reg.c:61
#define REG_HKLM
Definition: reg.c:62
LONG WINAPI SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:1007
LONG WINAPI SHRegEnumUSKeyW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszName, LPDWORD pcchValueNameLen, SHREGENUM_FLAGS enumRegFlags)
Definition: reg.c:955
LONG WINAPI SHEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpszSubKey, LPDWORD pwLen)
Definition: reg.c:1835
DWORD WINAPI SHDeleteEmptyKeyA(HKEY hKey, LPCSTR lpszSubKey)
Definition: reg.c:1650
LONG WINAPI SHRegSetUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:673
LONG WINAPI SHRegOpenUSKeyA(LPCSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:106
LONG WINAPI SHRegCreateUSKeyA(LPCSTR path, REGSAM samDesired, HUSKEY relative_key, PHUSKEY new_uskey, DWORD flags)
Definition: reg.c:217
BOOL WINAPI RegisterExtensionForMIMETypeW(LPCWSTR lpszExt, LPCWSTR lpszType)
Definition: reg.c:2173
DWORD WINAPI SHDeleteEmptyKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1679
HRESULT WINAPI SHRegGetCLSIDKeyA(REFGUID guid, LPCSTR lpszValue, BOOL bUseHKCU, BOOL bCreate, PHKEY phKey)
Definition: reg.c:2449
BOOL WINAPI RegisterExtensionForMIMETypeA(LPCSTR lpszExt, LPCSTR lpszType)
Definition: reg.c:2151
LONG WINAPI SHRegDeleteEmptyUSKeyW(HUSKEY hUSKey, LPCWSTR pszValue, SHREGDEL_FLAGS delRegFlags)
Definition: reg.c:329
LONG WINAPI SHRegQueryInfoUSKeyA(HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags)
Definition: reg.c:834
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:1024
BOOL WINAPI UnregisterExtensionForMIMETypeA(LPCSTR lpszType)
Definition: reg.c:2206
static const char szMimeDbContentA[]
Definition: reg.c:39
BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:2026
LONG WINAPI SHRegSetUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:643
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
LONG WINAPI SHRegCreateUSKeyW(LPCWSTR path, REGSAM samDesired, HUSKEY relative_key, PHUSKEY new_uskey, DWORD flags)
Definition: reg.c:258
BOOL WINAPI SHRegGetBoolUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault)
Definition: reg.c:714
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1503
static const WCHAR szMimeDbContentW[]
Definition: reg.c:40
BOOL WINAPI MIME_GetExtensionW(LPCWSTR lpszType, LPWSTR lpExt, INT iLen)
Definition: reg.c:2115
DWORD WINAPI SHQueryValueExA(HKEY hKey, LPCSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1444
LONG WINAPI SHQueryInfoKeyW(HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax, LPDWORD pwValues, LPDWORD pwValueMax)
Definition: reg.c:1393
DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1320
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
Definition: reg.c:2256
DWORD WINAPI SHDeleteOrphanKeyA(HKEY hKey, LPCSTR lpszSubKey)
Definition: reg.c:1716
BOOL WINAPI MIME_GetExtensionA(LPCSTR lpszType, LPSTR lpExt, INT iLen)
Definition: reg.c:2087
static const char szExtensionA[]
Definition: reg.c:45
DWORD WINAPI SHRegGetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPSTR lpszPath, DWORD dwFlags)
Definition: reg.c:1109
DWORD WINAPI SHGetValueGoodBootW(HKEY hkey, LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
Definition: reg.c:1932
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1348
INT WINAPI SHStringFromGUIDW(REFGUID, LPWSTR, INT)
Definition: ordinal.c:661
static const WCHAR szExtensionW[]
Definition: reg.c:46
DWORD WINAPI SHRegSetPathW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPCWSTR lpszPath, DWORD dwFlags)
Definition: reg.c:1195
int WINAPI SHRegGetIntW(HKEY hKey, LPCWSTR lpszValue, int iDefault)
Definition: reg.c:2416
LONG WINAPI SHRegGetUSValueW(LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
Definition: reg.c:594
#define szClassIdKeyLen
BOOL WINAPI UnregisterExtensionForMIMETypeW(LPCWSTR lpszType)
Definition: reg.c:2228
LONG WINAPI SHRegEnumUSValueW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszValueName, LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
Definition: reg.c:418
BOOL WINAPI SHRegGetBoolUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault)
Definition: reg.c:770
static const WCHAR lpszContentTypeW[]
Definition: reg.c:37
LONG WINAPI SHRegEnumUSValueA(HUSKEY hUSKey, DWORD dwIndex, LPSTR pszValueName, LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
Definition: reg.c:387
DWORD WINAPI SHDeleteValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue)
Definition: reg.c:1783
LONG WINAPI SHRegDeleteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags)
Definition: reg.c:350
BOOL WINAPI RegisterMIMETypeForExtensionW(LPCWSTR lpszSubKey, LPCWSTR lpszValue)
Definition: reg.c:1970
LONG WINAPI SHEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpszValue, LPDWORD pwLen, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1890
DWORD WINAPI SHDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey)
Definition: reg.c:1575
LONG WINAPI SHRegQueryUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
Definition: reg.c:504
LONG WINAPI SHRegDeleteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, SHREGDEL_FLAGS delRegFlags)
Definition: reg.c:361
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
static unsigned char buff[32768]
Definition: fatten.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PWCHAR pValue
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1033
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define LMEM_ZEROINIT
Definition: minwinbase.h:85
CONST void * LPCVOID
Definition: minwindef.h:164
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR pathW[]
Definition: path.c:2368
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
Definition: netsh.h:116
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define LPDWORD
Definition: nt_native.h:46
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define KEY_SET_VALUE
Definition: nt_native.h:1020
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
static const WCHAR szName[]
Definition: powrprof.c:45
#define SHREGSET_HKCU
Definition: shlwapi.h:719
SHREGENUM_FLAGS
Definition: shlwapi.h:732
@ SHREGENUM_HKCU
Definition: shlwapi.h:734
@ SHREGENUM_DEFAULT
Definition: shlwapi.h:733
@ SHREGENUM_HKLM
Definition: shlwapi.h:735
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define SHREGSET_HKLM
Definition: shlwapi.h:721
#define SHREGSET_FORCE_HKLM
Definition: shlwapi.h:722
_In_opt_ LPCSTR _In_opt_ LPCSTR _In_ SRRF _Out_opt_ LPDWORD pdwType
Definition: shlwapi.h:783
_In_opt_ _Inout_opt_ _Out_writes_bytes_to_opt_ pcbData _Inout_opt_ LPDWORD _In_ _In_ DWORD dwDefaultDataSize
Definition: shlwapi.h:781
SHREGDEL_FLAGS
Definition: shlwapi.h:725
_In_ _Out_writes_opt_ pcchValueName _Inout_opt_ LPDWORD _Out_opt_ _Out_writes_bytes_to_opt_ pcbData _Inout_opt_ LPDWORD pcbData
Definition: shlwapi.h:757
_In_opt_ LPCSTR pszSubKey
Definition: shlwapi.h:783
#define SHREGSET_FORCE_HKCU
Definition: shlwapi.h:720
_In_opt_ LPCSTR _In_opt_ LPCSTR pszValue
Definition: shlwapi.h:783
#define test
Definition: rosglue.h:37
#define REG_DWORD
Definition: sdbapi.c:615
wcscat
wcscpy
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1527
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
Definition: reg.c:49
HKEY HKCUkey
Definition: reg.c:51
WCHAR lpszPath[MAX_PATH]
Definition: reg.c:54
HKEY HKLMstart
Definition: reg.c:52
HKEY HKLMkey
Definition: reg.c:53
HKEY HKCUstart
Definition: reg.c:50
Definition: scsiwmi.h:51
#define max(a, b)
Definition: svc.c:63
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
uint32_t * LPDWORD
Definition: typedefs.h:59
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
static GLenum which
Definition: wgl_font.c:159
#define WINAPI
Definition: msvc.h:6
#define strlenW(s)
Definition: unicode.h:28
#define strcpyW(d, s)
Definition: unicode.h:29
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_KEY_HAS_CHILDREN
Definition: winerror.h:923
_In_ DWORD _In_ int _In_ int _In_opt_ LPNLSVERSIONINFO _In_opt_ LPVOID lpReserved
Definition: winnls.h:1268
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_USER
Definition: winreg.h:11
ACCESS_MASK REGSAM
Definition: winreg.h:76
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_USERS
Definition: winreg.h:13
#define SM_CLEANBOOT
Definition: winuser.h:1038
int WINAPI GetSystemMetrics(_In_ int)
unsigned char BYTE
Definition: xxhash.c:193