2000-07-26 19:51:32 +02:00
|
|
|
/*
|
|
|
|
* SHLWAPI registry functions
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* Copyright 1998 Juergen Schmied
|
|
|
|
* Copyright 2001 Guy Albertelli
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
|
|
|
|
2001-03-22 20:33:57 +01:00
|
|
|
#include <string.h>
|
2000-07-26 19:51:32 +02:00
|
|
|
#include "windef.h"
|
2001-02-13 21:17:59 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
2000-07-26 19:51:32 +02:00
|
|
|
#include "winerror.h"
|
2001-10-21 17:09:36 +02:00
|
|
|
#include "winnls.h"
|
2000-07-26 19:51:32 +02:00
|
|
|
#include "winreg.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2001-12-11 01:30:17 +01:00
|
|
|
#define NO_SHLWAPI_STREAM
|
2001-01-07 22:50:52 +01:00
|
|
|
#include "shlwapi.h"
|
2001-02-13 21:17:59 +01:00
|
|
|
#include "wine/unicode.h"
|
2000-07-26 19:51:32 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
2000-07-26 19:51:32 +02:00
|
|
|
|
2001-02-13 21:17:59 +01:00
|
|
|
static const char *lpszContentTypeA = "Content Type";
|
|
|
|
static const WCHAR lpszContentTypeW[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0'};
|
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
/* internal structure of what the HUSKEY points to */
|
|
|
|
typedef struct {
|
2001-10-24 04:45:08 +02:00
|
|
|
HKEY HKCUkey; /* HKEY of opened HKCU key */
|
|
|
|
HKEY HKLMkey; /* HKEY of opened HKLM key */
|
|
|
|
HKEY start; /* HKEY of where to start */
|
2001-10-21 17:09:36 +02:00
|
|
|
WCHAR key_string[MAX_PATH]; /* additional path from 'start' */
|
|
|
|
} Internal_HUSKEY, *LPInternal_HUSKEY;
|
|
|
|
|
|
|
|
|
2001-10-24 04:45:08 +02:00
|
|
|
#define REG_HKCU TRUE
|
|
|
|
#define REG_HKLM FALSE
|
|
|
|
/*************************************************************************
|
|
|
|
* REG_GetHKEYFromHUSKEY
|
|
|
|
*
|
|
|
|
* Function: Return the proper registry key from the HUSKEY structure
|
|
|
|
* also allow special predefined values.
|
|
|
|
*/
|
|
|
|
HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
|
|
|
|
{
|
|
|
|
HKEY test = (HKEY) hUSKey;
|
|
|
|
LPInternal_HUSKEY mihk = (LPInternal_HUSKEY) hUSKey;
|
|
|
|
|
|
|
|
if ((test == HKEY_CLASSES_ROOT) ||
|
|
|
|
(test == HKEY_CURRENT_CONFIG) ||
|
|
|
|
(test == HKEY_CURRENT_USER) ||
|
|
|
|
(test == HKEY_DYN_DATA) ||
|
|
|
|
(test == HKEY_LOCAL_MACHINE) ||
|
|
|
|
(test == HKEY_PERFORMANCE_DATA) ||
|
|
|
|
/* FIXME: need to define for Win2k, ME, XP
|
|
|
|
* (test == HKEY_PERFORMANCE_TEXT) ||
|
|
|
|
* (test == HKEY_PERFORMANCE_NLSTEXT) ||
|
|
|
|
*/
|
|
|
|
(test == HKEY_USERS)) return test;
|
|
|
|
if (which == REG_HKCU) return mihk->HKCUkey;
|
|
|
|
return mihk->HKLMkey;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegOpenUSKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Opens a user-specific registry key
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegOpenUSKeyA(
|
|
|
|
LPCSTR Path,
|
|
|
|
REGSAM AccessType,
|
|
|
|
HUSKEY hRelativeUSKey,
|
|
|
|
PHUSKEY phNewUSKey,
|
|
|
|
BOOL fIgnoreHKCU)
|
|
|
|
{
|
2001-10-24 04:45:08 +02:00
|
|
|
HKEY openHKCUkey=0;
|
|
|
|
HKEY openHKLMkey=0;
|
|
|
|
LONG ret2, ret1 = ~ERROR_SUCCESS;
|
2001-10-21 17:09:36 +02:00
|
|
|
LPInternal_HUSKEY ihky;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE("(%s, 0x%lx, 0x%lx, %p, %s)\n", debugstr_a(Path),
|
|
|
|
(LONG)AccessType, (LONG)hRelativeUSKey, phNewUSKey,
|
2001-10-21 17:09:36 +02:00
|
|
|
(fIgnoreHKCU) ? "Ignoring HKCU" : "Process HKCU then HKLM");
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* now create the internal version of HUSKEY */
|
2002-06-01 01:06:46 +02:00
|
|
|
ihky = (LPInternal_HUSKEY)HeapAlloc(GetProcessHeap(), 0 ,
|
2001-10-24 04:45:08 +02:00
|
|
|
sizeof(Internal_HUSKEY));
|
|
|
|
MultiByteToWideChar(0, 0, Path, -1, ihky->key_string,
|
|
|
|
sizeof(ihky->key_string)-1);
|
|
|
|
|
|
|
|
if (hRelativeUSKey) {
|
|
|
|
openHKCUkey = ((LPInternal_HUSKEY)hRelativeUSKey)->HKCUkey;
|
|
|
|
openHKLMkey = ((LPInternal_HUSKEY)hRelativeUSKey)->HKLMkey;
|
|
|
|
}
|
2001-10-21 17:09:36 +02:00
|
|
|
else {
|
2001-10-24 04:45:08 +02:00
|
|
|
openHKCUkey = HKEY_CURRENT_USER;
|
|
|
|
openHKLMkey = HKEY_LOCAL_MACHINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ihky->HKCUkey = 0;
|
|
|
|
ihky->HKLMkey = 0;
|
|
|
|
if (!fIgnoreHKCU) {
|
2002-06-01 01:06:46 +02:00
|
|
|
ret1 = RegOpenKeyExA(openHKCUkey, Path,
|
2001-10-24 04:45:08 +02:00
|
|
|
0, AccessType, &ihky->HKCUkey);
|
|
|
|
/* if successful, then save real starting point */
|
|
|
|
if (ret1 != ERROR_SUCCESS)
|
|
|
|
ihky->HKCUkey = 0;
|
2001-10-21 17:09:36 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
ret2 = RegOpenKeyExA(openHKLMkey, Path,
|
2001-10-24 04:45:08 +02:00
|
|
|
0, AccessType, &ihky->HKLMkey);
|
|
|
|
if (ret2 != ERROR_SUCCESS)
|
|
|
|
ihky->HKLMkey = 0;
|
2001-10-21 17:09:36 +02:00
|
|
|
|
2001-10-24 04:45:08 +02:00
|
|
|
if ((ret1 != ERROR_SUCCESS) || (ret2 != ERROR_SUCCESS))
|
|
|
|
TRACE("one or more opens failed: HKCU=%ld HKLM=%ld\n", ret1, ret2);
|
2001-10-21 17:09:36 +02:00
|
|
|
|
|
|
|
/* if all attempts have failed then bail */
|
2001-10-24 04:45:08 +02:00
|
|
|
if ((ret1 != ERROR_SUCCESS) && (ret2 != ERROR_SUCCESS)) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, ihky);
|
|
|
|
if (phNewUSKey)
|
|
|
|
*phNewUSKey = (HUSKEY)0;
|
|
|
|
return ret2;
|
2001-10-21 17:09:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("HUSKEY=0x%08lx\n", (LONG)ihky);
|
|
|
|
if (phNewUSKey)
|
|
|
|
*phNewUSKey = (HUSKEY)ihky;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegOpenUSKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Opens a user-specific registry key
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegOpenUSKeyW(
|
|
|
|
LPCWSTR Path,
|
|
|
|
REGSAM AccessType,
|
|
|
|
HUSKEY hRelativeUSKey,
|
|
|
|
PHUSKEY phNewUSKey,
|
|
|
|
BOOL fIgnoreHKCU)
|
|
|
|
{
|
2001-10-24 04:45:08 +02:00
|
|
|
HKEY openHKCUkey=0;
|
|
|
|
HKEY openHKLMkey=0;
|
|
|
|
LONG ret2, ret1 = ~ERROR_SUCCESS;
|
2001-10-21 17:09:36 +02:00
|
|
|
LPInternal_HUSKEY ihky;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE("(%s, 0x%lx, 0x%lx, %p, %s)\n", debugstr_w(Path),
|
|
|
|
(LONG)AccessType, (LONG)hRelativeUSKey, phNewUSKey,
|
2001-10-21 17:09:36 +02:00
|
|
|
(fIgnoreHKCU) ? "Ignoring HKCU" : "Process HKCU then HKLM");
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* now create the internal version of HUSKEY */
|
2002-06-01 01:06:46 +02:00
|
|
|
ihky = (LPInternal_HUSKEY)HeapAlloc(GetProcessHeap(), 0 ,
|
2001-10-24 04:45:08 +02:00
|
|
|
sizeof(Internal_HUSKEY));
|
|
|
|
lstrcpynW(ihky->key_string, Path, sizeof(ihky->key_string));
|
|
|
|
|
|
|
|
if (hRelativeUSKey) {
|
|
|
|
openHKCUkey = ((LPInternal_HUSKEY)hRelativeUSKey)->HKCUkey;
|
|
|
|
openHKLMkey = ((LPInternal_HUSKEY)hRelativeUSKey)->HKLMkey;
|
|
|
|
}
|
2001-10-21 17:09:36 +02:00
|
|
|
else {
|
2001-10-24 04:45:08 +02:00
|
|
|
openHKCUkey = HKEY_CURRENT_USER;
|
|
|
|
openHKLMkey = HKEY_LOCAL_MACHINE;
|
2001-10-21 17:09:36 +02:00
|
|
|
}
|
|
|
|
|
2001-10-24 04:45:08 +02:00
|
|
|
ihky->HKCUkey = 0;
|
|
|
|
ihky->HKLMkey = 0;
|
|
|
|
if (!fIgnoreHKCU) {
|
2002-06-01 01:06:46 +02:00
|
|
|
ret1 = RegOpenKeyExW(openHKCUkey, Path,
|
2001-10-24 04:45:08 +02:00
|
|
|
0, AccessType, &ihky->HKCUkey);
|
|
|
|
/* if successful, then save real starting point */
|
|
|
|
if (ret1 != ERROR_SUCCESS)
|
|
|
|
ihky->HKCUkey = 0;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
ret2 = RegOpenKeyExW(openHKLMkey, Path,
|
2001-10-24 04:45:08 +02:00
|
|
|
0, AccessType, &ihky->HKLMkey);
|
|
|
|
if (ret2 != ERROR_SUCCESS)
|
|
|
|
ihky->HKLMkey = 0;
|
|
|
|
|
|
|
|
if ((ret1 != ERROR_SUCCESS) || (ret2 != ERROR_SUCCESS))
|
|
|
|
TRACE("one or more opens failed: HKCU=%ld HKLM=%ld\n", ret1, ret2);
|
2001-10-21 17:09:36 +02:00
|
|
|
|
|
|
|
/* if all attempts have failed then bail */
|
2001-10-24 04:45:08 +02:00
|
|
|
if ((ret1 != ERROR_SUCCESS) && (ret2 != ERROR_SUCCESS)) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, ihky);
|
|
|
|
if (phNewUSKey)
|
|
|
|
*phNewUSKey = (HUSKEY)0;
|
|
|
|
return ret2;
|
2001-10-21 17:09:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("HUSKEY=0x%08lx\n", (LONG)ihky);
|
|
|
|
if (phNewUSKey)
|
|
|
|
*phNewUSKey = (HUSKEY)ihky;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegCloseUSKey [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Closes a user-specific registry key
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegCloseUSKey(
|
|
|
|
HUSKEY hUSKey)
|
|
|
|
{
|
|
|
|
LPInternal_HUSKEY mihk = (LPInternal_HUSKEY)hUSKey;
|
2001-10-24 04:45:08 +02:00
|
|
|
LONG ret = ERROR_SUCCESS;
|
2001-10-21 17:09:36 +02:00
|
|
|
|
2001-10-24 04:45:08 +02:00
|
|
|
if (mihk->HKCUkey)
|
|
|
|
ret = RegCloseKey(mihk->HKCUkey);
|
|
|
|
if (mihk->HKLMkey)
|
|
|
|
ret = RegCloseKey(mihk->HKLMkey);
|
2001-10-21 17:09:36 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, mihk);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2001-10-24 04:45:08 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryUSValueA [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegQueryUSValueA(
|
|
|
|
HUSKEY hUSKey, /* [in] */
|
|
|
|
LPCSTR pszValue,
|
|
|
|
LPDWORD pdwType,
|
|
|
|
LPVOID pvData,
|
|
|
|
LPDWORD pcbData,
|
|
|
|
BOOL fIgnoreHKCU,
|
|
|
|
LPVOID pvDefaultData,
|
|
|
|
DWORD dwDefaultDataSize)
|
|
|
|
{
|
|
|
|
LONG ret = ~ERROR_SUCCESS;
|
|
|
|
LONG i, maxmove;
|
|
|
|
HKEY dokey;
|
|
|
|
CHAR *src, *dst;
|
|
|
|
|
|
|
|
/* if user wants HKCU, and it exists, then try it */
|
2002-01-29 03:47:17 +01:00
|
|
|
if (!fIgnoreHKCU && (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
ret = RegQueryValueExA(dokey,
|
2001-10-24 04:45:08 +02:00
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2002-01-29 03:47:17 +01:00
|
|
|
TRACE("HKCU RegQueryValue returned %08lx\n", ret);
|
|
|
|
}
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* if HKCU did not work and HKLM exists, then try it */
|
|
|
|
if ((ret != ERROR_SUCCESS) &&
|
2002-01-29 03:47:17 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
2001-10-24 04:45:08 +02:00
|
|
|
ret = RegQueryValueExA(dokey,
|
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2002-01-29 03:47:17 +01:00
|
|
|
TRACE("HKLM RegQueryValue returned %08lx\n", ret);
|
|
|
|
}
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* if neither worked, and default data exists, then use it */
|
|
|
|
if (ret != ERROR_SUCCESS) {
|
|
|
|
if (pvDefaultData && (dwDefaultDataSize != 0)) {
|
|
|
|
maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
|
|
|
|
src = (CHAR*)pvDefaultData;
|
|
|
|
dst = (CHAR*)pvData;
|
|
|
|
for(i=0; i<maxmove; i++) *dst++ = *src++;
|
|
|
|
*pcbData = maxmove;
|
|
|
|
TRACE("setting default data\n");
|
|
|
|
ret = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryUSValueW [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegQueryUSValueW(
|
|
|
|
HUSKEY hUSKey, /* [in] */
|
|
|
|
LPCWSTR pszValue,
|
|
|
|
LPDWORD pdwType,
|
|
|
|
LPVOID pvData,
|
|
|
|
LPDWORD pcbData,
|
|
|
|
BOOL fIgnoreHKCU,
|
|
|
|
LPVOID pvDefaultData,
|
|
|
|
DWORD dwDefaultDataSize)
|
|
|
|
{
|
|
|
|
LONG ret = ~ERROR_SUCCESS;
|
|
|
|
LONG i, maxmove;
|
|
|
|
HKEY dokey;
|
|
|
|
CHAR *src, *dst;
|
|
|
|
|
|
|
|
/* if user wants HKCU, and it exists, then try it */
|
2002-01-29 03:47:17 +01:00
|
|
|
if (!fIgnoreHKCU && (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
ret = RegQueryValueExW(dokey,
|
2001-10-24 04:45:08 +02:00
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2002-01-29 03:47:17 +01:00
|
|
|
TRACE("HKCU RegQueryValue returned %08lx\n", ret);
|
|
|
|
}
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* if HKCU did not work and HKLM exists, then try it */
|
|
|
|
if ((ret != ERROR_SUCCESS) &&
|
2002-01-29 03:47:17 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
2001-10-24 04:45:08 +02:00
|
|
|
ret = RegQueryValueExW(dokey,
|
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2002-01-29 03:47:17 +01:00
|
|
|
TRACE("HKLM RegQueryValue returned %08lx\n", ret);
|
|
|
|
}
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* if neither worked, and default data exists, then use it */
|
|
|
|
if (ret != ERROR_SUCCESS) {
|
|
|
|
if (pvDefaultData && (dwDefaultDataSize != 0)) {
|
|
|
|
maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
|
|
|
|
src = (CHAR*)pvDefaultData;
|
|
|
|
dst = (CHAR*)pvData;
|
|
|
|
for(i=0; i<maxmove; i++) *dst++ = *src++;
|
|
|
|
*pcbData = maxmove;
|
|
|
|
TRACE("setting default data\n");
|
|
|
|
ret = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-07-26 19:51:32 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetUSValueA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Gets a user-specific registry value
|
2001-10-24 04:45:08 +02:00
|
|
|
* Will open the key, query the value, and close the key
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegGetUSValueA(
|
|
|
|
LPCSTR pSubKey,
|
|
|
|
LPCSTR pValue,
|
|
|
|
LPDWORD pwType,
|
|
|
|
LPVOID pvData,
|
2001-10-21 17:09:36 +02:00
|
|
|
LPDWORD pcbData,
|
|
|
|
BOOL flagIgnoreHKCU,
|
2000-07-26 19:51:32 +02:00
|
|
|
LPVOID pDefaultData,
|
|
|
|
DWORD wDefaultDataSize)
|
|
|
|
{
|
2001-10-21 17:09:36 +02:00
|
|
|
HUSKEY myhuskey;
|
2001-10-24 04:45:08 +02:00
|
|
|
LONG ret;
|
2001-10-21 17:09:36 +02:00
|
|
|
|
|
|
|
if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
|
|
|
|
TRACE("key '%s', value '%s', datalen %ld, %s\n",
|
|
|
|
debugstr_a(pSubKey), debugstr_a(pValue), *pcbData,
|
2001-11-06 22:01:32 +01:00
|
|
|
(flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-10-21 17:09:36 +02:00
|
|
|
|
|
|
|
ret = SHRegOpenUSKeyA(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
|
|
|
|
if (ret == ERROR_SUCCESS) {
|
2001-10-24 04:45:08 +02:00
|
|
|
ret = SHRegQueryUSValueA(myhuskey, pValue, pwType, pvData,
|
|
|
|
pcbData, flagIgnoreHKCU, pDefaultData,
|
|
|
|
wDefaultDataSize);
|
2001-10-21 17:09:36 +02:00
|
|
|
SHRegCloseUSKey(myhuskey);
|
|
|
|
}
|
|
|
|
return ret;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetUSValueW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Gets a user-specific registry value
|
2001-10-24 04:45:08 +02:00
|
|
|
* Will open the key, query the value, and close the key
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegGetUSValueW(
|
|
|
|
LPCWSTR pSubKey,
|
|
|
|
LPCWSTR pValue,
|
|
|
|
LPDWORD pwType,
|
|
|
|
LPVOID pvData,
|
2001-10-21 17:09:36 +02:00
|
|
|
LPDWORD pcbData,
|
2000-07-26 19:51:32 +02:00
|
|
|
BOOL flagIgnoreHKCU,
|
|
|
|
LPVOID pDefaultData,
|
|
|
|
DWORD wDefaultDataSize)
|
|
|
|
{
|
2001-10-21 17:09:36 +02:00
|
|
|
HUSKEY myhuskey;
|
2001-10-24 04:45:08 +02:00
|
|
|
LONG ret;
|
2000-07-26 19:51:32 +02:00
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
|
|
|
|
TRACE("key '%s', value '%s', datalen %ld, %s\n",
|
|
|
|
debugstr_w(pSubKey), debugstr_w(pValue), *pcbData,
|
2001-11-06 22:01:32 +01:00
|
|
|
(flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-04-25 21:51:56 +02:00
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
ret = SHRegOpenUSKeyW(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
|
|
|
|
if (ret == ERROR_SUCCESS) {
|
2001-10-24 04:45:08 +02:00
|
|
|
ret = SHRegQueryUSValueW(myhuskey, pValue, pwType, pvData,
|
|
|
|
pcbData, flagIgnoreHKCU, pDefaultData,
|
|
|
|
wDefaultDataSize);
|
2001-10-21 17:09:36 +02:00
|
|
|
SHRegCloseUSKey(myhuskey);
|
|
|
|
}
|
|
|
|
return ret;
|
2001-04-25 21:51:56 +02:00
|
|
|
}
|
|
|
|
|
2000-07-26 19:51:32 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetBoolUSValueA [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SHRegGetBoolUSValueA(
|
|
|
|
LPCSTR pszSubKey,
|
|
|
|
LPCSTR pszValue,
|
|
|
|
BOOL fIgnoreHKCU,
|
|
|
|
BOOL fDefault)
|
|
|
|
{
|
2001-10-28 22:13:16 +01:00
|
|
|
LONG retvalue;
|
|
|
|
DWORD type, datalen, work;
|
|
|
|
BOOL ret = fDefault;
|
|
|
|
CHAR data[10];
|
|
|
|
|
|
|
|
TRACE("key '%s', value '%s', %s\n",
|
|
|
|
debugstr_a(pszSubKey), debugstr_a(pszValue),
|
2001-11-06 22:01:32 +01:00
|
|
|
(fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-10-28 22:13:16 +01:00
|
|
|
|
|
|
|
datalen = sizeof(data)-1;
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(retvalue = SHRegGetUSValueA( pszSubKey, pszValue, &type,
|
2001-10-28 22:13:16 +01:00
|
|
|
data, &datalen,
|
|
|
|
fIgnoreHKCU, 0, 0))) {
|
|
|
|
/* process returned data via type into bool */
|
|
|
|
switch (type) {
|
|
|
|
case REG_SZ:
|
|
|
|
data[9] = '\0'; /* set end of string */
|
|
|
|
if (lstrcmpiA(data, "YES") == 0) ret = TRUE;
|
|
|
|
if (lstrcmpiA(data, "TRUE") == 0) ret = TRUE;
|
|
|
|
if (lstrcmpiA(data, "NO") == 0) ret = FALSE;
|
|
|
|
if (lstrcmpiA(data, "FALSE") == 0) ret = FALSE;
|
|
|
|
break;
|
|
|
|
case REG_DWORD:
|
|
|
|
work = *(LPDWORD)data;
|
|
|
|
ret = (work != 0);
|
|
|
|
break;
|
|
|
|
case REG_BINARY:
|
|
|
|
if (datalen == 1) {
|
|
|
|
ret = (data[0] != '\0');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
FIXME("Unsupported registry data type %ld\n", type);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
TRACE("got value (type=%ld), returing <%s>\n", type,
|
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = fDefault;
|
|
|
|
TRACE("returning default data <%s>\n",
|
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
return ret;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetBoolUSValueW [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SHRegGetBoolUSValueW(
|
|
|
|
LPCWSTR pszSubKey,
|
|
|
|
LPCWSTR pszValue,
|
|
|
|
BOOL fIgnoreHKCU,
|
|
|
|
BOOL fDefault)
|
|
|
|
{
|
2001-11-06 01:48:51 +01:00
|
|
|
static const WCHAR wYES[]= {'Y','E','S','\0'};
|
|
|
|
static const WCHAR wTRUE[]= {'T','R','U','E','\0'};
|
|
|
|
static const WCHAR wNO[]= {'N','O','\0'};
|
|
|
|
static const WCHAR wFALSE[]={'F','A','L','S','E','\0'};
|
2001-10-28 22:13:16 +01:00
|
|
|
LONG retvalue;
|
|
|
|
DWORD type, datalen, work;
|
|
|
|
BOOL ret = fDefault;
|
|
|
|
WCHAR data[10];
|
|
|
|
|
|
|
|
TRACE("key '%s', value '%s', %s\n",
|
|
|
|
debugstr_w(pszSubKey), debugstr_w(pszValue),
|
2001-11-06 22:01:32 +01:00
|
|
|
(fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-10-28 22:13:16 +01:00
|
|
|
|
|
|
|
datalen = (sizeof(data)-1) * sizeof(WCHAR);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!(retvalue = SHRegGetUSValueW( pszSubKey, pszValue, &type,
|
2001-10-28 22:13:16 +01:00
|
|
|
data, &datalen,
|
|
|
|
fIgnoreHKCU, 0, 0))) {
|
|
|
|
/* process returned data via type into bool */
|
|
|
|
switch (type) {
|
|
|
|
case REG_SZ:
|
|
|
|
data[9] = L'\0'; /* set end of string */
|
2001-11-06 01:48:51 +01:00
|
|
|
if (lstrcmpiW(data, wYES)==0 || lstrcmpiW(data, wTRUE)==0)
|
|
|
|
ret = TRUE;
|
|
|
|
else if (lstrcmpiW(data, wNO)==0 || lstrcmpiW(data, wFALSE)==0)
|
|
|
|
ret = FALSE;
|
2001-10-28 22:13:16 +01:00
|
|
|
break;
|
|
|
|
case REG_DWORD:
|
|
|
|
work = *(LPDWORD)data;
|
|
|
|
ret = (work != 0);
|
|
|
|
break;
|
|
|
|
case REG_BINARY:
|
|
|
|
if (datalen == 1) {
|
|
|
|
ret = (data[0] != L'\0');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
FIXME("Unsupported registry data type %ld\n", type);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
TRACE("got value (type=%ld), returing <%s>\n", type,
|
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = fDefault;
|
|
|
|
TRACE("returning default data <%s>\n",
|
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
return ret;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryInfoUSKeyA [SHLWAPI.@]
|
|
|
|
*/
|
2001-12-11 01:30:17 +01:00
|
|
|
LONG WINAPI SHRegQueryInfoUSKeyA(
|
2001-10-24 04:45:08 +02:00
|
|
|
HUSKEY hUSKey, /* [in] */
|
2001-10-21 17:09:36 +02:00
|
|
|
LPDWORD pcSubKeys,
|
|
|
|
LPDWORD pcchMaxSubKeyLen,
|
|
|
|
LPDWORD pcValues,
|
|
|
|
LPDWORD pcchMaxValueNameLen,
|
|
|
|
SHREGENUM_FLAGS enumRegFlags)
|
|
|
|
{
|
2001-10-24 04:45:08 +02:00
|
|
|
HKEY dokey;
|
|
|
|
LONG ret;
|
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
TRACE("(0x%lx,%p,%p,%p,%p,%d)\n",
|
2001-10-24 04:45:08 +02:00
|
|
|
(LONG)hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
|
|
|
|
pcchMaxValueNameLen,enumRegFlags);
|
|
|
|
|
|
|
|
/* if user wants HKCU, and it exists, then try it */
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 04:45:08 +02:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
|
|
|
ret = RegQueryInfoKeyA(dokey, 0, 0, 0,
|
|
|
|
pcSubKeys, pcchMaxSubKeyLen, 0,
|
|
|
|
pcValues, pcchMaxValueNameLen, 0, 0, 0);
|
|
|
|
if ((ret == ERROR_SUCCESS) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_HKCU))
|
2001-10-24 04:45:08 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 04:45:08 +02:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
|
|
|
return RegQueryInfoKeyA(dokey, 0, 0, 0,
|
|
|
|
pcSubKeys, pcchMaxSubKeyLen, 0,
|
|
|
|
pcValues, pcchMaxValueNameLen, 0, 0, 0);
|
|
|
|
}
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
2001-10-21 17:09:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryInfoUSKeyW [SHLWAPI.@]
|
|
|
|
*/
|
2001-12-11 01:30:17 +01:00
|
|
|
LONG WINAPI SHRegQueryInfoUSKeyW(
|
2001-10-24 04:45:08 +02:00
|
|
|
HUSKEY hUSKey, /* [in] */
|
2001-10-21 17:09:36 +02:00
|
|
|
LPDWORD pcSubKeys,
|
|
|
|
LPDWORD pcchMaxSubKeyLen,
|
|
|
|
LPDWORD pcValues,
|
|
|
|
LPDWORD pcchMaxValueNameLen,
|
|
|
|
SHREGENUM_FLAGS enumRegFlags)
|
|
|
|
{
|
2001-10-24 04:45:08 +02:00
|
|
|
HKEY dokey;
|
|
|
|
LONG ret;
|
|
|
|
|
2001-10-21 17:09:36 +02:00
|
|
|
TRACE("(0x%lx,%p,%p,%p,%p,%d)\n",
|
|
|
|
(LONG)hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
|
|
|
|
pcchMaxValueNameLen,enumRegFlags);
|
2001-10-24 04:45:08 +02:00
|
|
|
|
|
|
|
/* if user wants HKCU, and it exists, then try it */
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 04:45:08 +02:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
|
|
|
ret = RegQueryInfoKeyW(dokey, 0, 0, 0,
|
|
|
|
pcSubKeys, pcchMaxSubKeyLen, 0,
|
|
|
|
pcValues, pcchMaxValueNameLen, 0, 0, 0);
|
|
|
|
if ((ret == ERROR_SUCCESS) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_HKCU))
|
2001-10-24 04:45:08 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 04:45:08 +02:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
|
|
|
return RegQueryInfoKeyW(dokey, 0, 0, 0,
|
|
|
|
pcSubKeys, pcchMaxSubKeyLen, 0,
|
|
|
|
pcValues, pcchMaxValueNameLen, 0, 0, 0);
|
|
|
|
}
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
2001-10-21 17:09:36 +02:00
|
|
|
}
|
|
|
|
|
2001-09-07 20:36:47 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegEnumUSKeyA [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegEnumUSKeyA(
|
2001-10-21 17:09:36 +02:00
|
|
|
HUSKEY hUSKey, /* [in] */
|
2001-11-13 22:28:21 +01:00
|
|
|
DWORD dwIndex, /* [in] */
|
|
|
|
LPSTR pszName, /* [out] */
|
|
|
|
LPDWORD pcchValueNameLen, /* [in/out] */
|
2001-10-21 17:09:36 +02:00
|
|
|
SHREGENUM_FLAGS enumRegFlags) /* [in] */
|
2001-09-07 20:36:47 +02:00
|
|
|
{
|
2001-11-13 22:28:21 +01:00
|
|
|
HKEY dokey;
|
|
|
|
|
|
|
|
TRACE("(0x%lx,%ld,%p,%p(%ld),%d)\n",
|
|
|
|
(LONG)hUSKey, dwIndex, pszName, pcchValueNameLen,
|
|
|
|
*pcchValueNameLen, enumRegFlags);
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 22:28:21 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
2002-06-01 01:06:46 +02:00
|
|
|
return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 22:28:21 +01:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 22:28:21 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 22:28:21 +01:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
FIXME("no support for SHREGNUM_BOTH\n");
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
2001-09-07 20:36:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegEnumUSKeyW [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegEnumUSKeyW(
|
2001-10-21 17:09:36 +02:00
|
|
|
HUSKEY hUSKey, /* [in] */
|
2001-11-13 22:28:21 +01:00
|
|
|
DWORD dwIndex, /* [in] */
|
|
|
|
LPWSTR pszName, /* [out] */
|
|
|
|
LPDWORD pcchValueNameLen, /* [in/out] */
|
2001-10-21 17:09:36 +02:00
|
|
|
SHREGENUM_FLAGS enumRegFlags) /* [in] */
|
2001-09-07 20:36:47 +02:00
|
|
|
{
|
2001-11-13 22:28:21 +01:00
|
|
|
HKEY dokey;
|
|
|
|
|
|
|
|
TRACE("(0x%lx,%ld,%p,%p(%ld),%d)\n",
|
|
|
|
(LONG)hUSKey, dwIndex, pszName, pcchValueNameLen,
|
|
|
|
*pcchValueNameLen, enumRegFlags);
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
2002-06-01 01:06:46 +02:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 22:28:21 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 22:28:21 +01:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 22:28:21 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 22:28:21 +01:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
FIXME("no support for SHREGNUM_BOTH\n");
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegWriteUSValueA [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType,
|
|
|
|
LPVOID pvData, DWORD cbData, DWORD dwFlags)
|
|
|
|
{
|
2002-02-12 19:44:14 +01:00
|
|
|
HKEY dokey;
|
|
|
|
|
|
|
|
TRACE("(0x%lx,%s,%ld,%p,%ld,%ld)\n",
|
2001-11-13 22:28:21 +01:00
|
|
|
(LONG)hUSKey, debugstr_a(pszValue), dwType, pvData, cbData, dwFlags);
|
2002-02-12 19:44:14 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((dwFlags & SHREGSET_FORCE_HKCU) &&
|
2002-02-12 19:44:14 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
|
|
|
RegSetValueExA(dokey, pszValue, 0, dwType, pvData, cbData);
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((dwFlags & SHREGSET_FORCE_HKLM) &&
|
2002-02-12 19:44:14 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
|
|
|
RegSetValueExA(dokey, pszValue, 0, dwType, pvData, cbData);
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (dwFlags & (SHREGSET_FORCE_HKCU | SHREGSET_FORCE_HKLM))
|
2002-02-12 19:44:14 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
FIXME("SHREGSET_HKCU or SHREGSET_HKLM not supported\n");
|
2001-11-13 22:28:21 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegWriteUSValueW [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType,
|
|
|
|
LPVOID pvData, DWORD cbData, DWORD dwFlags)
|
|
|
|
{
|
2002-02-12 19:44:14 +01:00
|
|
|
HKEY dokey;
|
|
|
|
|
|
|
|
TRACE("(0x%lx,%s,%ld,%p,%ld,%ld)\n",
|
2001-11-13 22:28:21 +01:00
|
|
|
(LONG)hUSKey, debugstr_w(pszValue), dwType, pvData, cbData, dwFlags);
|
2002-02-12 19:44:14 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((dwFlags & SHREGSET_FORCE_HKCU) &&
|
2002-02-12 19:44:14 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
|
|
|
RegSetValueExW(dokey, pszValue, 0, dwType, pvData, cbData);
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((dwFlags & SHREGSET_FORCE_HKLM) &&
|
2002-02-12 19:44:14 +01:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
|
|
|
RegSetValueExW(dokey, pszValue, 0, dwType, pvData, cbData);
|
|
|
|
}
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (dwFlags & (SHREGSET_FORCE_HKCU | SHREGSET_FORCE_HKLM))
|
2002-02-12 19:44:14 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
FIXME("SHREGSET_HKCU or SHREGSET_HKLM not supported\n");
|
2001-11-13 22:28:21 +01:00
|
|
|
return ERROR_SUCCESS;
|
2001-09-07 20:36:47 +02:00
|
|
|
}
|
|
|
|
|
2000-07-26 19:51:32 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetPathA [SHLWAPI.@]
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
*
|
|
|
|
* Get a path from the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key containing path to get
|
|
|
|
* lpszValue [I] Name of value containing path to get
|
|
|
|
* lpszPath [O] Buffer for returned path
|
|
|
|
* dwFlags [I] Reserved
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. lpszPath contains the path.
|
|
|
|
* Failure: An error code from RegOpenKeyExA or SHQueryValueExA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHRegGetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
LPSTR lpszPath, DWORD dwFlags)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD dwSize = MAX_PATH;
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s,%s,%p,%ld)\n", hKey, debugstr_a(lpszSubKey),
|
|
|
|
debugstr_a(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
2002-05-09 21:43:44 +02:00
|
|
|
return SHGetValueA(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetPathW [SHLWAPI.@]
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
*
|
|
|
|
* See SHRegGetPathA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHRegGetPathW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
LPWSTR lpszPath, DWORD dwFlags)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD dwSize = MAX_PATH;
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s,%s,%p,%ld)\n", hKey, debugstr_w(lpszSubKey),
|
|
|
|
debugstr_w(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
2002-05-09 21:43:44 +02:00
|
|
|
return SHGetValueW(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
|
2000-07-26 19:51:32 +02:00
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHRegSetPathA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Write a path to the registry.
|
2000-07-26 19:51:32 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key containing path to set
|
|
|
|
* lpszValue [I] Name of value containing path to set
|
|
|
|
* lpszPath [O] Path to write
|
|
|
|
* dwFlags [I] Reserved
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An error code from SHSetValueA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHRegSetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
LPCSTR lpszPath, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
char szBuff[MAX_PATH];
|
|
|
|
|
2002-05-29 21:09:54 +02:00
|
|
|
FIXME("(hkey=0x%08x,%s,%s,%p,%ld) - semi-stub\n",hKey, debugstr_a(lpszSubKey),
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
debugstr_a(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
|
|
|
lstrcpyA(szBuff, lpszPath);
|
|
|
|
|
|
|
|
/* FIXME: PathUnExpandEnvStringsA(szBuff); */
|
|
|
|
|
|
|
|
return SHSetValueA(hKey,lpszSubKey, lpszValue, REG_SZ, szBuff,
|
|
|
|
lstrlenA(szBuff));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegSetPathW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHRegSetPathA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHRegSetPathW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
LPCWSTR lpszPath, DWORD dwFlags)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
WCHAR szBuff[MAX_PATH];
|
|
|
|
|
2002-05-29 21:09:54 +02:00
|
|
|
FIXME("(hkey=0x%08x,%s,%s,%p,%ld) - semi-stub\n",hKey, debugstr_w(lpszSubKey),
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
debugstr_w(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
|
|
|
lstrcpyW(szBuff, lpszPath);
|
|
|
|
|
|
|
|
/* FIXME: PathUnExpandEnvStringsW(szBuff); */
|
2001-02-13 21:17:59 +01:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return SHSetValueW(hKey,lpszSubKey, lpszValue, REG_SZ, szBuff,
|
|
|
|
lstrlenW(szBuff));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHGetValueA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Get a value from the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key containing value to get
|
|
|
|
* lpszValue [I] Name of value to get
|
|
|
|
* pwType [O] Pointer to the values type
|
|
|
|
* pvData [O] Pointer to the values data
|
|
|
|
* pcbData [O] Pointer to the values size
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. Output parameters contain the details read.
|
2002-05-09 21:43:44 +02:00
|
|
|
* Failure: An error code from RegOpenKeyExA or SHQueryValueExA.
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
|
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD dwRet = 0;
|
|
|
|
HKEY hSubKey = 0;
|
2001-02-13 21:17:59 +01:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%s,%s,%p,%p,%p)\n", hKey, debugstr_a(lpszSubKey),
|
|
|
|
debugstr_a(lpszValue), pwType, pvData, pcbData);
|
2001-02-13 21:17:59 +01:00
|
|
|
|
2002-05-09 21:43:44 +02:00
|
|
|
/* lpszSubKey can be 0. In this case the value is taken from the
|
|
|
|
* current key.
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
if(lpszSubKey)
|
2002-05-09 21:43:44 +02:00
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
|
|
|
|
|
|
|
|
if (! dwRet)
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
/* SHQueryValueEx expands Environment strings */
|
|
|
|
dwRet = SHQueryValueExA(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
|
|
|
|
if (hSubKey) RegCloseKey(hSubKey);
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
}
|
|
|
|
return dwRet;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHGetValueW [SHLWAPI.@]
|
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* See SHGetValueA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD dwRet = 0;
|
|
|
|
HKEY hSubKey = 0;
|
2001-02-13 21:17:59 +01:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%s,%s,%p,%p,%p)\n", hKey, debugstr_w(lpszSubKey),
|
|
|
|
debugstr_w(lpszValue), pwType, pvData, pcbData);
|
2001-02-13 21:17:59 +01:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if(lpszSubKey)
|
2002-05-09 21:43:44 +02:00
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
|
|
|
|
|
|
|
|
if (! dwRet)
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
dwRet = SHQueryValueExW(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
|
|
|
|
if (hSubKey) RegCloseKey(hSubKey);
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
2001-02-13 21:17:59 +01:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SHSetValueA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Set a value in the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key under hKey
|
|
|
|
* lpszValue [I] Name of value to set
|
|
|
|
* dwType [I] Type of the value
|
|
|
|
* pvData [I] Data of the value
|
|
|
|
* cbData [I] Size of the value
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The value is set with the data given.
|
|
|
|
* Failure: An error code from RegCreateKeyExA or RegSetValueExA
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* If the sub key does not exist, it is created before the value is set. If
|
|
|
|
* The sub key is NULL or an empty string, then the value is added directly
|
|
|
|
* to hKey instead.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
DWORD dwType, LPCVOID pvData, DWORD cbData)
|
|
|
|
{
|
|
|
|
DWORD dwRet = ERROR_SUCCESS, dwDummy;
|
|
|
|
HKEY hSubKey;
|
|
|
|
LPSTR szEmpty = "";
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_a(lpszSubKey),
|
|
|
|
debugstr_a(lpszValue), dwType, pvData, cbData);
|
|
|
|
|
|
|
|
if (lpszSubKey && *lpszSubKey)
|
|
|
|
dwRet = RegCreateKeyExA(hKey, lpszSubKey, 0, szEmpty,
|
|
|
|
0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy);
|
|
|
|
else
|
|
|
|
hSubKey = hKey;
|
|
|
|
if (!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegSetValueExA(hSubKey, lpszValue, 0, dwType, pvData, cbData);
|
|
|
|
if (hSubKey != hKey)
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHSetValueW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHSetValueA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
DWORD dwType, LPCVOID pvData, DWORD cbData)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD dwRet = ERROR_SUCCESS, dwDummy;
|
|
|
|
HKEY hSubKey;
|
|
|
|
WCHAR szEmpty[] = { '\0' };
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_w(lpszSubKey),
|
|
|
|
debugstr_w(lpszValue), dwType, pvData, cbData);
|
|
|
|
|
|
|
|
if (lpszSubKey && *lpszSubKey)
|
|
|
|
dwRet = RegCreateKeyExW(hKey, lpszSubKey, 0, szEmpty,
|
|
|
|
0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy);
|
|
|
|
else
|
|
|
|
hSubKey = hKey;
|
|
|
|
if (!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegSetValueExW(hSubKey, lpszValue, 0, dwType, pvData, cbData);
|
|
|
|
if (hSubKey != hKey)
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-11-25 02:24:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHQueryInfoKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Get information about a registry key. See RegQueryInfoKeyA.
|
2000-11-25 02:24:10 +01:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
LONG WINAPI SHQueryInfoKeyA(HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax,
|
|
|
|
LPDWORD pwValues, LPDWORD pwValueMax)
|
2000-11-25 02:24:10 +01:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
|
|
|
|
pwValues, pwValueMax);
|
|
|
|
return RegQueryInfoKeyA(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
|
|
|
|
NULL, pwValues, pwValueMax, NULL, NULL, NULL);
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHQueryInfoKeyW [SHLWAPI.@]
|
2000-07-26 19:51:32 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* See SHQueryInfoKeyA
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
LONG WINAPI SHQueryInfoKeyW(HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax,
|
|
|
|
LPDWORD pwValues, LPDWORD pwValueMax)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
|
|
|
|
pwValues, pwValueMax);
|
|
|
|
return RegQueryInfoKeyW(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
|
|
|
|
NULL, pwValues, pwValueMax, NULL, NULL, NULL);
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SHQueryValueExA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Get a value from the registry, expanding environment variable strings.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
2002-05-09 21:43:44 +02:00
|
|
|
* lpszValue [I] Name of value to query
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* lpReserved [O] Reserved for future use; must be NULL
|
|
|
|
* pwType [O] Optional pointer updated with the values type
|
|
|
|
* pvData [O] Optional pointer updated with the values data
|
|
|
|
* pcbData [O] Optional pointer updated with the values size
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. Any non-NULL output parameters are updated with
|
|
|
|
* information about the value.
|
|
|
|
* Failure: ERROR_OUTOFMEMORY if memory allocation fails, or the type of the
|
|
|
|
* data is REG_EXPAND_SZ and pcbData is NULL. Otherwise an error
|
|
|
|
* code from RegQueryValueExA or ExpandEnvironmentStringsA.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Either pwType, pvData or pcbData may be NULL if the caller doesn't want
|
|
|
|
* the type, data or size information for the value.
|
|
|
|
*
|
|
|
|
* If the type of the data is REG_EXPAND_SZ, it is expanded to REG_SZ. The
|
|
|
|
* value returned will be truncated if it is of type REG_SZ and bigger than
|
|
|
|
* the buffer given to store it.
|
2002-07-20 22:04:44 +02:00
|
|
|
*
|
|
|
|
* REG_EXPAND_SZ
|
|
|
|
* case 1: the unexpanded string is smaller than the expanded one
|
|
|
|
* subcase 1: the buffer is to small to hold the unexpanded string:
|
|
|
|
* function fails and returns the size of the unexpanded string.
|
|
|
|
*
|
|
|
|
* subcase 2: buffer is to small to hold the expanded string:
|
|
|
|
* the function return success (!!) and the result is truncated
|
|
|
|
* *** This is clearly a error in the native implemantation. ***
|
|
|
|
*
|
|
|
|
* case 2: the unexpanded string is bigger than the expanded one
|
|
|
|
* The buffer must have enough space to hold the unexpanded
|
|
|
|
* string even if the result is smaller.
|
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
*/
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD WINAPI SHQueryValueExA( HKEY hKey, LPCSTR lpszValue,
|
|
|
|
LPDWORD lpReserved, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
|
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%s,%p,%p,%p,%p=%ld)\n", hKey, debugstr_a(lpszValue),
|
|
|
|
lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
|
|
|
|
|
2002-05-09 21:43:44 +02:00
|
|
|
if (pcbData) dwUnExpDataLen = *pcbData;
|
|
|
|
|
|
|
|
dwRet = RegQueryValueExA(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
|
|
|
|
|
|
|
|
if (pcbData && (dwType == REG_EXPAND_SZ))
|
|
|
|
{
|
|
|
|
DWORD nBytesToAlloc;
|
|
|
|
|
|
|
|
/* Expand type REG_EXPAND_SZ into REG_SZ */
|
|
|
|
LPSTR szData;
|
|
|
|
|
|
|
|
/* If the caller didn't supply a buffer or the buffer is to small we have
|
|
|
|
* to allocate our own
|
|
|
|
*/
|
|
|
|
if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
char cNull = '\0';
|
|
|
|
nBytesToAlloc = (!pvData || (dwRet == ERROR_MORE_DATA)) ? dwUnExpDataLen : *pcbData;
|
|
|
|
|
|
|
|
szData = (LPSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc);
|
|
|
|
RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
|
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
|
|
|
LocalFree((HLOCAL) szData);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nBytesToAlloc = lstrlenA(pvData) * sizeof (CHAR);
|
|
|
|
szData = (LPSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc + 1);
|
|
|
|
lstrcpyA(szData, pvData);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
|
2002-06-01 01:06:46 +02:00
|
|
|
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
|
2002-05-09 21:43:44 +02:00
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
|
|
|
LocalFree((HLOCAL) szData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the type and data size if the caller wanted them */
|
|
|
|
if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
|
|
|
|
if ( pwType ) *pwType = dwType;
|
|
|
|
if ( pcbData ) *pcbData = dwUnExpDataLen;
|
|
|
|
return dwRet;
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
}
|
2000-07-26 19:51:32 +02:00
|
|
|
|
2002-05-09 21:43:44 +02:00
|
|
|
|
2000-07-26 19:51:32 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHQueryValueExW [SHLWAPI.@]
|
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* See SHQueryValueExA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue,
|
|
|
|
LPDWORD lpReserved, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
|
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%s,%p,%p,%p,%p=%ld)\n", hKey, debugstr_w(lpszValue),
|
|
|
|
lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
|
|
|
|
|
2002-05-09 21:43:44 +02:00
|
|
|
if (pcbData) dwUnExpDataLen = *pcbData;
|
|
|
|
|
|
|
|
dwRet = RegQueryValueExW(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
|
|
|
|
|
|
|
|
if (pcbData && (dwType == REG_EXPAND_SZ))
|
|
|
|
{
|
|
|
|
DWORD nBytesToAlloc;
|
|
|
|
|
|
|
|
/* Expand type REG_EXPAND_SZ into REG_SZ */
|
|
|
|
LPWSTR szData;
|
|
|
|
|
|
|
|
/* If the caller didn't supply a buffer or the buffer is to small we have
|
|
|
|
* to allocate our own
|
|
|
|
*/
|
|
|
|
if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2002-05-09 21:43:44 +02:00
|
|
|
WCHAR cNull = '\0';
|
|
|
|
nBytesToAlloc = (!pvData || (dwRet == ERROR_MORE_DATA)) ? dwUnExpDataLen : *pcbData;
|
|
|
|
|
|
|
|
szData = (LPWSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc);
|
|
|
|
RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
|
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
|
|
|
LocalFree((HLOCAL) szData);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nBytesToAlloc = lstrlenW(pvData) * sizeof(WCHAR);
|
|
|
|
szData = (LPWSTR) LocalAlloc(GMEM_ZEROINIT, nBytesToAlloc + 1);
|
|
|
|
lstrcpyW(szData, pvData);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
|
2002-06-01 01:06:46 +02:00
|
|
|
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
|
2002-05-09 21:43:44 +02:00
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
|
|
|
LocalFree((HLOCAL) szData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the type and data size if the caller wanted them */
|
|
|
|
if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
|
|
|
|
if ( pwType ) *pwType = dwType;
|
|
|
|
if ( pcbData ) *pcbData = dwUnExpDataLen;
|
|
|
|
return dwRet;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteKeyA [SHLWAPI.@]
|
2000-09-29 02:25:56 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* Delete a registry key and any sub keys/values present
|
2000-09-29 02:25:56 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key to delete
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The key is deleted.
|
|
|
|
* Failure: An error code from RegOpenKeyExA, RegQueryInfoKeyA,
|
|
|
|
* RegEnumKeyExA or RegDeleteKeyA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD dwRet, dwKeyCount = 0, dwMaxSubkeyLen = 0, dwSize, i;
|
|
|
|
CHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s)\n", hKey, debugstr_a(lpszSubKey));
|
|
|
|
|
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Find how many subkeys there are */
|
|
|
|
dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
|
|
|
|
&dwMaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
if(!dwRet)
|
2000-09-29 02:25:56 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
dwMaxSubkeyLen++;
|
|
|
|
if (dwMaxSubkeyLen > sizeof(szNameBuf))
|
|
|
|
/* Name too big: alloc a buffer for it */
|
|
|
|
lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(CHAR));
|
|
|
|
|
|
|
|
if(!lpszName)
|
|
|
|
dwRet = ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Recursively delete all the subkeys */
|
|
|
|
for(i = 0; i < dwKeyCount && !dwRet; i++)
|
|
|
|
{
|
|
|
|
dwSize = dwMaxSubkeyLen;
|
|
|
|
dwRet = RegEnumKeyExA(hSubKey, i, lpszName, &dwSize, NULL, NULL, NULL, NULL);
|
|
|
|
if(!dwRet)
|
|
|
|
dwRet = SHDeleteKeyA(hSubKey, lpszName);
|
|
|
|
}
|
|
|
|
if (lpszName != szNameBuf)
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpszName); /* Free buffer if allocated */
|
|
|
|
}
|
2000-09-29 02:25:56 +02:00
|
|
|
}
|
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
dwRet = RegDeleteKeyA(hKey, lpszSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHDeleteKeyA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
DWORD dwRet, dwKeyCount = 0, dwMaxSubkeyLen = 0, dwSize, i;
|
|
|
|
WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s)\n", hKey, debugstr_w(lpszSubKey));
|
|
|
|
|
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Find how many subkeys there are */
|
|
|
|
dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
|
|
|
|
&dwMaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
if(!dwRet)
|
2000-09-29 02:25:56 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
dwMaxSubkeyLen++;
|
|
|
|
if (dwMaxSubkeyLen > sizeof(szNameBuf)/sizeof(WCHAR))
|
|
|
|
/* Name too big: alloc a buffer for it */
|
|
|
|
lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(WCHAR));
|
|
|
|
|
|
|
|
if(!lpszName)
|
|
|
|
dwRet = ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Recursively delete all the subkeys */
|
|
|
|
for(i = 0; i < dwKeyCount && !dwRet; i++)
|
|
|
|
{
|
|
|
|
dwSize = dwMaxSubkeyLen;
|
|
|
|
dwRet = RegEnumKeyExW(hSubKey, i, lpszName, &dwSize, NULL, NULL, NULL, NULL);
|
|
|
|
if(!dwRet)
|
|
|
|
dwRet = SHDeleteKeyW(hSubKey, lpszName);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpszName != szNameBuf)
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpszName); /* Free buffer if allocated */
|
|
|
|
}
|
2000-09-29 02:25:56 +02:00
|
|
|
}
|
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
dwRet = RegDeleteKeyW(hKey, lpszSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteEmptyKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Delete a registry key with no sub keys.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key to delete
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The key is deleted.
|
|
|
|
* Failure: If the key is not empty, returns ERROR_KEY_HAS_CHILDREN. Otherwise
|
|
|
|
* returns an error code from RegOpenKeyExA, RegQueryInfoKeyA or
|
|
|
|
* RegDeleteKeyA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteEmptyKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
DWORD dwRet, dwKeyCount = 0;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s)\n", hKey, debugstr_a(lpszSubKey));
|
|
|
|
|
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
|
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
if(!dwRet)
|
2000-09-29 02:25:56 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
if (!dwKeyCount)
|
|
|
|
dwRet = RegDeleteKeyA(hKey, lpszSubKey);
|
|
|
|
else
|
|
|
|
dwRet = ERROR_KEY_HAS_CHILDREN;
|
2000-09-29 02:25:56 +02:00
|
|
|
}
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteEmptyKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHDeleteEmptyKeyA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteEmptyKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
DWORD dwRet, dwKeyCount = 0;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x, %s)\n", hKey, debugstr_w(lpszSubKey));
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
|
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
2000-09-29 02:25:56 +02:00
|
|
|
RegCloseKey(hSubKey);
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
if (!dwKeyCount)
|
|
|
|
dwRet = RegDeleteKeyW(hKey, lpszSubKey);
|
|
|
|
else
|
|
|
|
dwRet = ERROR_KEY_HAS_CHILDREN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteOrphanKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Delete a registry key with no sub keys or values.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key to possibly delete
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The key has been deleted if it was an orphan.
|
|
|
|
* Failure: An error from RegOpenKeyExA, RegQueryValueExA, or RegDeleteKeyA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteOrphanKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
HKEY hSubKey;
|
|
|
|
DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
|
|
|
|
|
2002-05-29 21:09:54 +02:00
|
|
|
TRACE("(hkey=0x%08x,%s)\n", hKey, debugstr_a(lpszSubKey));
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
|
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Get subkey and value count */
|
|
|
|
dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
|
|
|
|
NULL, NULL, &dwValueCount, NULL, NULL, NULL, NULL);
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
if(!dwRet && !dwKeyCount && !dwValueCount)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteKeyA(hKey, lpszSubKey);
|
|
|
|
}
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHDeleteOrphanKeyW [SHLWAPI.@]
|
2000-09-29 02:25:56 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* See SHDeleteOrphanKeyA.
|
2000-07-26 19:51:32 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHDeleteOrphanKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
2000-07-26 19:51:32 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
HKEY hSubKey;
|
|
|
|
DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
|
|
|
|
|
2002-05-29 21:09:54 +02:00
|
|
|
TRACE("(hkey=0x%08x,%s)\n", hKey, debugstr_w(lpszSubKey));
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
|
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
|
|
|
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Get subkey and value count */
|
|
|
|
dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
|
|
|
|
NULL, NULL, &dwValueCount, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
if(!dwRet && !dwKeyCount && !dwValueCount)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteKeyW(hKey, lpszSubKey);
|
|
|
|
}
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-07-26 19:51:32 +02:00
|
|
|
}
|
2000-09-29 02:25:56 +02:00
|
|
|
|
2000-11-25 02:24:10 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteValueA [SHLWAPI.@]
|
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* Delete a value from the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key containing value to delete
|
|
|
|
* lpszValue [I] Name of value to delete
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The value is deleted.
|
|
|
|
* Failure: An error code from RegOpenKeyExA or RegDeleteValueA.
|
2000-11-25 02:24:10 +01:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHDeleteValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue)
|
|
|
|
{
|
|
|
|
DWORD dwRet;
|
|
|
|
HKEY hSubKey;
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s,%s)\n", hKey, debugstr_a(lpszSubKey), debugstr_a(lpszValue));
|
|
|
|
|
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
|
|
|
|
if (!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteValueA(hSubKey, lpszValue);
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-11-25 02:24:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteValueW [SHLWAPI.@]
|
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* See SHDeleteValueA.
|
2000-11-25 02:24:10 +01:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
|
|
|
|
{
|
|
|
|
DWORD dwRet;
|
|
|
|
HKEY hSubKey;
|
|
|
|
|
|
|
|
TRACE("(hkey=0x%08x,%s,%s)\n", hKey, debugstr_w(lpszSubKey), debugstr_w(lpszValue));
|
|
|
|
|
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
|
|
|
|
if (!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteValueW(hSubKey, lpszValue);
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-11-25 02:24:10 +01:00
|
|
|
}
|
|
|
|
|
2000-09-29 02:25:56 +02:00
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHEnumKeyExA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Enumerate sub keys in a registry key.
|
2000-09-29 02:25:56 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* dwIndex [I] Index of key to enumerate
|
|
|
|
* lpszSubKey [O] Pointer updated with the subkey name
|
|
|
|
* pwLen [O] Pointer updated with the subkey length
|
2000-09-29 02:25:56 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* RETURN
|
|
|
|
* Success: ERROR_SUCCESS. lpszSubKey and pwLen are updated.
|
|
|
|
* Failure: An error code from RegEnumKeyExA.
|
2000-09-29 02:25:56 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
LONG WINAPI SHEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpszSubKey,
|
|
|
|
LPDWORD pwLen)
|
2000-09-29 02:25:56 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%ld,%s,%p)\n", hKey, dwIndex, debugstr_a(lpszSubKey), pwLen);
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return RegEnumKeyExA(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SHEnumKeyExW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHEnumKeyExA.
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHEnumKeyExW(HKEY hKey, DWORD dwIndex, LPWSTR lpszSubKey,
|
|
|
|
LPDWORD pwLen)
|
|
|
|
{
|
|
|
|
TRACE("(hkey=0x%08x,%ld,%s,%p)\n", hKey, dwIndex, debugstr_w(lpszSubKey), pwLen);
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return RegEnumKeyExW(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* SHEnumValueA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Enumerate values in a registry key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* dwIndex [I] Index of key to enumerate
|
|
|
|
* lpszValue [O] Pointer updated with the values name
|
|
|
|
* pwLen [O] Pointer updated with the values length
|
|
|
|
* pwType [O] Pointer updated with the values type
|
|
|
|
* pvData [O] Pointer updated with the values data
|
|
|
|
* pcbData [O] Pointer updated with the values size
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. Output parameters are updated.
|
|
|
|
* Failure: An error code from RegEnumValueExA.
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpszValue,
|
|
|
|
LPDWORD pwLen, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
|
|
|
{
|
|
|
|
TRACE("(hkey=0x%08x,%ld,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
|
|
|
|
debugstr_a(lpszValue), pwLen, pwType, pvData, pcbData);
|
2000-09-29 02:25:56 +02:00
|
|
|
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return RegEnumValueA(hKey, dwIndex, lpszValue, pwLen, NULL,
|
|
|
|
pwType, pvData, pcbData);
|
2000-09-29 02:25:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* SHEnumValueW [SHLWAPI.@]
|
2000-09-29 02:25:56 +02:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* See SHEnumValueA.
|
2000-09-29 02:25:56 +02:00
|
|
|
*/
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
LONG WINAPI SHEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpszValue,
|
|
|
|
LPDWORD pwLen, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
2000-09-29 02:25:56 +02:00
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
TRACE("(hkey=0x%08x,%ld,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
|
|
|
|
debugstr_w(lpszValue), pwLen, pwType, pvData, pcbData);
|
|
|
|
|
|
|
|
return RegEnumValueW(hKey, dwIndex, lpszValue, pwLen, NULL,
|
|
|
|
pwType, pvData, pcbData);
|
2000-09-29 02:25:56 +02:00
|
|
|
}
|
|
|
|
|
2001-02-13 21:17:59 +01:00
|
|
|
/*************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* @ [SHLWAPI.205]
|
2001-02-13 21:17:59 +01:00
|
|
|
*
|
|
|
|
* Wrapper for SHGetValueA in case machine is in safe mode.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHLWAPI_205(HKEY hkey, LPCSTR pSubKey, LPCSTR pValue,
|
|
|
|
LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
|
|
|
|
{
|
|
|
|
if (GetSystemMetrics(SM_CLEANBOOT))
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
return SHGetValueA(hkey, pSubKey, pValue, pwType, pvData, pbData);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* @ [SHLWAPI.206]
|
2001-02-13 21:17:59 +01:00
|
|
|
*
|
|
|
|
* Unicode version of SHLWAPI_205.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHLWAPI_206(HKEY hkey, LPCWSTR pSubKey, LPCWSTR pValue,
|
|
|
|
LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
|
|
|
|
{
|
|
|
|
if (GetSystemMetrics(SM_CLEANBOOT))
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
return SHGetValueW(hkey, pSubKey, pValue, pwType, pvData, pbData);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* @ [SHLWAPI.320]
|
2001-02-13 21:17:59 +01:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* Set a content type in the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key under hKey
|
|
|
|
* lpszValue [I] Value to set
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
2001-02-13 21:17:59 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI SHLWAPI_320(LPCSTR lpszSubKey, LPCSTR lpszValue)
|
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD dwRet;
|
|
|
|
|
|
|
|
if (!lpszValue)
|
|
|
|
{
|
2002-05-24 23:17:59 +02:00
|
|
|
WARN("Invalid lpszValue would crash under Win32!\n");
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwRet = SHSetValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA,
|
|
|
|
REG_SZ, lpszValue, strlen(lpszValue));
|
|
|
|
return dwRet ? FALSE : TRUE;
|
2001-02-13 21:17:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* @ [SHLWAPI.321]
|
2001-02-13 21:17:59 +01:00
|
|
|
*
|
|
|
|
* Unicode version of SHLWAPI_320.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SHLWAPI_321(LPCWSTR lpszSubKey, LPCWSTR lpszValue)
|
|
|
|
{
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
DWORD dwRet;
|
|
|
|
|
|
|
|
if (!lpszValue)
|
|
|
|
{
|
2002-05-24 23:17:59 +02:00
|
|
|
WARN("Invalid lpszValue would crash under Win32!\n");
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwRet = SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW,
|
|
|
|
REG_SZ, lpszValue, strlenW(lpszValue));
|
|
|
|
return dwRet ? FALSE : TRUE;
|
2001-02-13 21:17:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* @ [SHLWAPI.322]
|
2001-02-13 21:17:59 +01:00
|
|
|
*
|
Implemented, documented or fixed SHDeleteOrphanKeyA/W, SHEnumKeyExA/W,
SHEnumValueA/W, SHQueryInfoKeyA/W. SHRegGetPathA/W, SHRegSetPathA/W,
SHGetValueA/W, SHSetValueA/W, SHQueryValueExA/W, SHDeleteKeyA/W,
SHDeleteEmptyKeyA/W, SHDeleteValueA/W, ordinals 320-323.
2001-12-17 22:21:29 +01:00
|
|
|
* Delete a content type from the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszSubKey [I] Name of sub key
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
2001-02-13 21:17:59 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI SHLWAPI_322(LPCSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
HRESULT ret = SHDeleteValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA);
|
|
|
|
return ret ? FALSE : TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* @ [SHLWAPI.323]
|
2001-02-13 21:17:59 +01:00
|
|
|
*
|
|
|
|
* Unicode version of SHLWAPI_322.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SHLWAPI_323(LPCWSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
HRESULT ret = SHDeleteValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW);
|
|
|
|
return ret ? FALSE : TRUE;
|
|
|
|
}
|
|
|
|
|
2001-12-01 01:37:12 +01:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegDuplicateHKey [SHLWAPI.@]
|
|
|
|
*/
|
|
|
|
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
|
|
|
|
{
|
|
|
|
HKEY newKey = 0;
|
|
|
|
|
|
|
|
RegOpenKeyExA(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey);
|
|
|
|
TRACE("new key is %08x\n", newKey);
|
|
|
|
return newKey;
|
|
|
|
}
|