2000-07-26 17:51:32 +00:00
|
|
|
/*
|
|
|
|
* SHLWAPI registry functions
|
2002-03-09 23:29:33 +00: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
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2000-07-26 17:51:32 +00:00
|
|
|
*/
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2001-03-22 19:33:57 +00:00
|
|
|
#include <string.h>
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "windef.h"
|
2001-02-13 20:17:59 +00:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2000-07-26 17:51:32 +00:00
|
|
|
#include "winreg.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
2001-12-11 00:30:17 +00:00
|
|
|
#define NO_SHLWAPI_STREAM
|
2001-01-07 21:50:52 +00:00
|
|
|
#include "shlwapi.h"
|
2001-02-13 20:17:59 +00:00
|
|
|
#include "wine/unicode.h"
|
2000-07-26 17:51:32 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
2000-07-26 17:51:32 +00:00
|
|
|
|
2002-09-06 19:35:08 +00:00
|
|
|
/* Key/Value names for MIME content types */
|
2006-11-28 10:39:32 +00:00
|
|
|
static const char lpszContentTypeA[] = "Content Type";
|
2001-02-13 20:17:59 +00:00
|
|
|
static const WCHAR lpszContentTypeW[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0'};
|
|
|
|
|
2006-11-28 10:39:32 +00:00
|
|
|
static const char szMimeDbContentA[] = "MIME\\Database\\Content Type\\";
|
2002-09-06 19:35:08 +00:00
|
|
|
static const WCHAR szMimeDbContentW[] = { 'M', 'I', 'M','E','\\',
|
|
|
|
'D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',
|
2003-03-30 03:05:55 +00:00
|
|
|
' ','T','y','p','e','\\', 0 };
|
2002-09-06 19:35:08 +00:00
|
|
|
static const DWORD dwLenMimeDbContent = 27; /* strlen of szMimeDbContentA/W */
|
|
|
|
|
2006-11-28 10:39:32 +00:00
|
|
|
static const char szExtensionA[] = "Extension";
|
2002-09-06 19:35:08 +00:00
|
|
|
static const WCHAR szExtensionW[] = { 'E', 'x', 't','e','n','s','i','o','n','\0' };
|
|
|
|
|
2001-10-21 15:09:36 +00:00
|
|
|
/* internal structure of what the HUSKEY points to */
|
|
|
|
typedef struct {
|
2004-03-17 20:48:03 +00:00
|
|
|
HKEY HKCUstart; /* Start key in CU hive */
|
|
|
|
HKEY HKCUkey; /* Opened key in CU hive */
|
|
|
|
HKEY HKLMstart; /* Start key in LM hive */
|
|
|
|
HKEY HKLMkey; /* Opened key in LM hive */
|
|
|
|
WCHAR lpszPath[MAX_PATH];
|
|
|
|
} SHUSKEY, *LPSHUSKEY;
|
2001-10-21 15:09:36 +00:00
|
|
|
|
2007-04-14 12:48:21 +00:00
|
|
|
INT WINAPI SHStringFromGUIDW(REFGUID,LPWSTR,INT);
|
2003-09-11 02:56:15 +00:00
|
|
|
HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID,LPCWSTR,BOOL,BOOL,PHKEY);
|
2003-07-22 00:58:09 +00:00
|
|
|
|
2001-10-21 15:09:36 +00:00
|
|
|
|
2001-10-24 02:45:08 +00: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.
|
|
|
|
*/
|
2008-11-24 16:22:44 +00:00
|
|
|
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
|
2001-10-24 02:45:08 +00:00
|
|
|
{
|
2008-11-05 22:04:51 +00:00
|
|
|
HKEY test = hUSKey;
|
|
|
|
LPSHUSKEY mihk = hUSKey;
|
2001-10-24 02:45:08 +00:00
|
|
|
|
|
|
|
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 15:09:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegOpenUSKeyA [SHLWAPI.@]
|
|
|
|
*
|
2004-03-17 20:48:03 +00:00
|
|
|
* Open a user-specific registry key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* Path [I] Key name to open
|
|
|
|
* AccessType [I] Access type
|
|
|
|
* hRelativeUSKey [I] Relative user key
|
|
|
|
* phNewUSKey [O] Destination for created key
|
|
|
|
* fIgnoreHKCU [I] TRUE=Don't check HKEY_CURRENT_USER
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from RegOpenKeyExA().
|
2001-10-21 15:09:36 +00:00
|
|
|
*/
|
2004-03-17 20:48:03 +00:00
|
|
|
LONG WINAPI SHRegOpenUSKeyA(LPCSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey,
|
|
|
|
PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
|
2001-10-21 15:09:36 +00:00
|
|
|
{
|
2004-03-17 20:48:03 +00:00
|
|
|
WCHAR szPath[MAX_PATH];
|
2001-10-24 02:45:08 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (Path)
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, Path, -1, szPath, MAX_PATH);
|
2001-10-21 15:09:36 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
return SHRegOpenUSKeyW(Path ? szPath : NULL, AccessType, hRelativeUSKey,
|
|
|
|
phNewUSKey, fIgnoreHKCU);
|
2001-10-21 15:09:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegOpenUSKeyW [SHLWAPI.@]
|
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* See SHRegOpenUSKeyA.
|
2001-10-21 15:09:36 +00:00
|
|
|
*/
|
2004-03-17 20:48:03 +00:00
|
|
|
LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey,
|
|
|
|
PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
|
2001-10-21 15:09:36 +00:00
|
|
|
{
|
2001-10-24 02:45:08 +00:00
|
|
|
LONG ret2, ret1 = ~ERROR_SUCCESS;
|
2004-03-17 20:48:03 +00:00
|
|
|
LPSHUSKEY hKey;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%s,0x%x,%p,%p,%d)\n", debugstr_w(Path),(LONG)AccessType,
|
2004-03-17 20:48:03 +00:00
|
|
|
hRelativeUSKey, phNewUSKey, fIgnoreHKCU);
|
2001-10-21 15:09:36 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (phNewUSKey)
|
|
|
|
*phNewUSKey = NULL;
|
2001-10-24 02:45:08 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
/* Create internal HUSKEY */
|
2005-03-24 21:01:35 +00:00
|
|
|
hKey = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*hKey));
|
2005-09-12 22:07:53 +00:00
|
|
|
lstrcpynW(hKey->lpszPath, Path, sizeof(hKey->lpszPath)/sizeof(WCHAR));
|
2001-10-24 02:45:08 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (hRelativeUSKey)
|
|
|
|
{
|
|
|
|
hKey->HKCUstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(hRelativeUSKey, REG_HKCU));
|
|
|
|
hKey->HKLMstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(hRelativeUSKey, REG_HKLM));
|
|
|
|
|
|
|
|
/* FIXME: if either of these keys is NULL, create the start key from
|
|
|
|
* the relative keys start+path
|
|
|
|
*/
|
2001-10-24 02:45:08 +00:00
|
|
|
}
|
2004-03-17 20:48:03 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
hKey->HKCUstart = HKEY_CURRENT_USER;
|
|
|
|
hKey->HKLMstart = HKEY_LOCAL_MACHINE;
|
2001-10-21 15:09:36 +00:00
|
|
|
}
|
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (!fIgnoreHKCU)
|
|
|
|
{
|
|
|
|
ret1 = RegOpenKeyExW(hKey->HKCUstart, hKey->lpszPath, 0, AccessType, &hKey->HKCUkey);
|
|
|
|
if (ret1)
|
|
|
|
hKey->HKCUkey = 0;
|
2001-10-24 02:45:08 +00:00
|
|
|
}
|
2004-03-17 20:48:03 +00:00
|
|
|
|
|
|
|
ret2 = RegOpenKeyExW(hKey->HKLMstart, hKey->lpszPath, 0, AccessType, &hKey->HKLMkey);
|
|
|
|
if (ret2)
|
|
|
|
hKey->HKLMkey = 0;
|
|
|
|
|
|
|
|
if (ret1 || ret2)
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("one or more opens failed: HKCU=%d HKLM=%d\n", ret1, ret2);
|
2004-03-17 20:48:03 +00:00
|
|
|
|
|
|
|
if (ret1 && ret2)
|
|
|
|
{
|
|
|
|
/* Neither open succeeded: fail */
|
|
|
|
SHRegCloseUSKey(hKey);
|
|
|
|
return ret2;
|
2001-10-21 15:09:36 +00:00
|
|
|
}
|
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
TRACE("HUSKEY=%p\n", hKey);
|
2001-10-21 15:09:36 +00:00
|
|
|
if (phNewUSKey)
|
2008-11-05 22:04:51 +00:00
|
|
|
*phNewUSKey = hKey;
|
2001-10-21 15:09:36 +00:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegCloseUSKey [SHLWAPI.@]
|
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* Close a user-specific registry key
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from RegCloseKey().
|
2001-10-21 15:09:36 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegCloseUSKey(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey) /* [I] Key to close */
|
2001-10-21 15:09:36 +00:00
|
|
|
{
|
2009-01-22 08:52:44 +00:00
|
|
|
LPSHUSKEY hKey = hUSKey;
|
2001-10-24 02:45:08 +00:00
|
|
|
LONG ret = ERROR_SUCCESS;
|
2001-10-21 15:09:36 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (hKey->HKCUkey)
|
|
|
|
ret = RegCloseKey(hKey->HKCUkey);
|
|
|
|
if (hKey->HKCUstart && hKey->HKCUstart != HKEY_CURRENT_USER)
|
|
|
|
ret = RegCloseKey(hKey->HKCUstart);
|
|
|
|
if (hKey->HKLMkey)
|
|
|
|
ret = RegCloseKey(hKey->HKLMkey);
|
|
|
|
if (hKey->HKLMstart && hKey->HKLMstart != HKEY_LOCAL_MACHINE)
|
2009-12-03 20:04:20 +00:00
|
|
|
ret = RegCloseKey(hKey->HKLMstart);
|
2004-03-17 20:48:03 +00:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, hKey);
|
2001-10-21 15:09:36 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-01-18 11:39:05 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegCreateUSKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Create or open a user-specific registry key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pszPath [I] Key name to create or open.
|
|
|
|
* samDesired [I] Wanted security access.
|
|
|
|
* hRelativeUSKey [I] Base path if pszPath is relative. NULL otherwise.
|
2008-04-21 05:17:27 +00:00
|
|
|
* phNewUSKey [O] Receives a handle to the new or opened key.
|
2005-01-18 11:39:05 +00:00
|
|
|
* dwFlags [I] Base key under which the key should be opened.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: Nonzero error code from winerror.h
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegCreateUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativeUSKey,
|
|
|
|
PHUSKEY phNewUSKey, DWORD dwFlags)
|
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
FIXME("(%s, 0x%08x, %p, %p, 0x%08x) stub\n", debugstr_a(pszPath), samDesired,
|
2005-01-18 11:39:05 +00:00
|
|
|
hRelativeUSKey, phNewUSKey, dwFlags);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegCreateUSKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHRegCreateUSKeyA.
|
|
|
|
*/
|
2011-12-01 17:19:29 +00:00
|
|
|
LONG WINAPI SHRegCreateUSKeyW(LPCWSTR path, REGSAM samDesired, HUSKEY relative_key,
|
|
|
|
PHUSKEY new_uskey, DWORD flags)
|
2005-01-18 11:39:05 +00:00
|
|
|
{
|
2011-12-01 17:19:29 +00:00
|
|
|
LONG ret = ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
SHUSKEY *ret_key;
|
|
|
|
|
|
|
|
TRACE("(%s, 0x%08x, %p, %p, 0x%08x)\n", debugstr_w(path), samDesired,
|
|
|
|
relative_key, new_uskey, flags);
|
|
|
|
|
|
|
|
if (!new_uskey) return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
*new_uskey = NULL;
|
|
|
|
|
|
|
|
if (flags & ~SHREGSET_FORCE_HKCU)
|
|
|
|
{
|
|
|
|
FIXME("unsupported flags 0x%08x\n", flags);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret_key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret_key));
|
|
|
|
lstrcpynW(ret_key->lpszPath, path, sizeof(ret_key->lpszPath)/sizeof(WCHAR));
|
|
|
|
|
|
|
|
if (relative_key)
|
|
|
|
{
|
|
|
|
ret_key->HKCUstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(relative_key, REG_HKCU));
|
|
|
|
ret_key->HKLMstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(relative_key, REG_HKLM));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret_key->HKCUstart = HKEY_CURRENT_USER;
|
|
|
|
ret_key->HKLMstart = HKEY_LOCAL_MACHINE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SHREGSET_FORCE_HKCU)
|
|
|
|
{
|
|
|
|
ret = RegCreateKeyExW(ret_key->HKCUstart, path, 0, NULL, 0, samDesired, NULL, &ret_key->HKCUkey, NULL);
|
|
|
|
if (ret == ERROR_SUCCESS)
|
|
|
|
*new_uskey = ret_key;
|
|
|
|
else
|
|
|
|
HeapFree(GetProcessHeap(), 0, ret_key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2005-01-18 11:39:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegDeleteEmptyUSKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Delete an empty user-specific registry key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hUSKey [I] Handle to an open registry key.
|
|
|
|
* pszValue [I] Empty key name.
|
|
|
|
* delRegFlags [I] Flag that specifies the base from which to delete
|
|
|
|
* the key.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: Nonzero error code from winerror.h
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegDeleteEmptyUSKeyA(HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_a(pszValue), delRegFlags);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegDeleteEmptyUSKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHRegDeleteEmptyUSKeyA.
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegDeleteEmptyUSKeyW(HUSKEY hUSKey, LPCWSTR pszValue, SHREGDEL_FLAGS delRegFlags)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_w(pszValue), delRegFlags);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegDeleteUSValueA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Delete a user-specific registry value.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hUSKey [I] Handle to an open registry key.
|
|
|
|
* pszValue [I] Specifies the value to delete.
|
|
|
|
* delRegFlags [I] Flag that specifies the base of the key from which to
|
|
|
|
* delete the value.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: Nonzero error code from winerror.h
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegDeleteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_a(pszValue), delRegFlags);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegDeleteUSValueW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHRegDeleteUSValueA.
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegDeleteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, SHREGDEL_FLAGS delRegFlags)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_w(pszValue), delRegFlags);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegEnumUSValueA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Enumerate values of a specified registry key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hUSKey [I] Handle to an open registry key.
|
|
|
|
* dwIndex [I] Index of the value to be retrieved.
|
|
|
|
* pszValueName [O] Buffer to receive the value name.
|
|
|
|
* pcchValueNameLen [I] Size of pszValueName in characters.
|
|
|
|
* pdwType [O] Receives data type of the value.
|
|
|
|
* pvData [O] Receives value data. May be NULL.
|
|
|
|
* pcbData [I/O] Size of pvData in bytes.
|
|
|
|
* enumRegFlags [I] Flag that specifies the base key under which to
|
|
|
|
* enumerate values.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: Nonzero error code from winerror.h
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegEnumUSValueA(HUSKEY hUSKey, DWORD dwIndex, LPSTR pszValueName,
|
|
|
|
LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData,
|
|
|
|
LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
|
|
|
|
{
|
2010-05-18 20:45:17 +00:00
|
|
|
HKEY dokey;
|
|
|
|
|
|
|
|
TRACE("(%p, 0x%08x, %p, %p, %p, %p, %p, 0x%08x)\n", hUSKey, dwIndex,
|
|
|
|
pszValueName, pcchValueNameLen, pdwType, pvData, pcbData, enumRegFlags);
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
|
|
|
return RegEnumValueA(dokey, dwIndex, pszValueName, pcchValueNameLen,
|
|
|
|
NULL, pdwType, pvData, pcbData);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
|
|
|
return RegEnumValueA(dokey, dwIndex, pszValueName, pcchValueNameLen,
|
|
|
|
NULL, pdwType, pvData, pcbData);
|
|
|
|
}
|
|
|
|
FIXME("no support for SHREGENUM_BOTH\n");
|
2005-01-18 11:39:05 +00:00
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegEnumUSValueW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHRegEnumUSValueA.
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegEnumUSValueW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszValueName,
|
|
|
|
LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData,
|
|
|
|
LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
|
|
|
|
{
|
2010-05-18 20:45:17 +00:00
|
|
|
HKEY dokey;
|
|
|
|
|
|
|
|
TRACE("(%p, 0x%08x, %p, %p, %p, %p, %p, 0x%08x)\n", hUSKey, dwIndex,
|
|
|
|
pszValueName, pcchValueNameLen, pdwType, pvData, pcbData, enumRegFlags);
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
|
|
|
return RegEnumValueW(dokey, dwIndex, pszValueName, pcchValueNameLen,
|
|
|
|
NULL, pdwType, pvData, pcbData);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
|
|
|
return RegEnumValueW(dokey, dwIndex, pszValueName, pcchValueNameLen,
|
|
|
|
NULL, pdwType, pvData, pcbData);
|
|
|
|
}
|
|
|
|
FIXME("no support for SHREGENUM_BOTH\n");
|
2005-01-18 11:39:05 +00:00
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
2001-10-24 02:45:08 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryUSValueA [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* Query a user-specific registry value.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from RegQueryValueExA().
|
2001-10-24 02:45:08 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegQueryUSValueA(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey, /* [I] Key to query */
|
|
|
|
LPCSTR pszValue, /* [I] Value name under hUSKey */
|
|
|
|
LPDWORD pdwType, /* [O] Destination for value type */
|
|
|
|
LPVOID pvData, /* [O] Destination for value data */
|
|
|
|
LPDWORD pcbData, /* [O] Destination for value length */
|
|
|
|
BOOL fIgnoreHKCU, /* [I] TRUE=Don't check HKEY_CURRENT_USER */
|
|
|
|
LPVOID pvDefaultData, /* [I] Default data if pszValue does not exist */
|
|
|
|
DWORD dwDefaultDataSize) /* [I] Length of pvDefaultData */
|
2001-10-24 02:45:08 +00:00
|
|
|
{
|
|
|
|
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 02:47:17 +00: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 21:21:29 +00:00
|
|
|
ret = RegQueryValueExA(dokey,
|
2001-10-24 02:45:08 +00:00
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("HKCU RegQueryValue returned %08x\n", ret);
|
2002-01-29 02:47:17 +00:00
|
|
|
}
|
2001-10-24 02:45:08 +00:00
|
|
|
|
|
|
|
/* if HKCU did not work and HKLM exists, then try it */
|
|
|
|
if ((ret != ERROR_SUCCESS) &&
|
2002-01-29 02:47:17 +00:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
2001-10-24 02:45:08 +00:00
|
|
|
ret = RegQueryValueExA(dokey,
|
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("HKLM RegQueryValue returned %08x\n", ret);
|
2002-01-29 02:47:17 +00:00
|
|
|
}
|
2001-10-24 02:45:08 +00:00
|
|
|
|
|
|
|
/* if neither worked, and default data exists, then use it */
|
|
|
|
if (ret != ERROR_SUCCESS) {
|
|
|
|
if (pvDefaultData && (dwDefaultDataSize != 0)) {
|
|
|
|
maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
|
2009-01-22 08:52:44 +00:00
|
|
|
src = pvDefaultData;
|
|
|
|
dst = pvData;
|
2001-10-24 02:45:08 +00:00
|
|
|
for(i=0; i<maxmove; i++) *dst++ = *src++;
|
|
|
|
*pcbData = maxmove;
|
|
|
|
TRACE("setting default data\n");
|
|
|
|
ret = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryUSValueW [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* See SHRegQueryUSValueA.
|
2001-10-24 02:45:08 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegQueryUSValueW(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey,
|
2001-10-24 02:45:08 +00:00
|
|
|
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 02:47:17 +00: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 21:21:29 +00:00
|
|
|
ret = RegQueryValueExW(dokey,
|
2001-10-24 02:45:08 +00:00
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("HKCU RegQueryValue returned %08x\n", ret);
|
2002-01-29 02:47:17 +00:00
|
|
|
}
|
2001-10-24 02:45:08 +00:00
|
|
|
|
|
|
|
/* if HKCU did not work and HKLM exists, then try it */
|
|
|
|
if ((ret != ERROR_SUCCESS) &&
|
2002-01-29 02:47:17 +00:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
|
2001-10-24 02:45:08 +00:00
|
|
|
ret = RegQueryValueExW(dokey,
|
|
|
|
pszValue, 0, pdwType, pvData, pcbData);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("HKLM RegQueryValue returned %08x\n", ret);
|
2002-01-29 02:47:17 +00:00
|
|
|
}
|
2001-10-24 02:45:08 +00:00
|
|
|
|
|
|
|
/* if neither worked, and default data exists, then use it */
|
|
|
|
if (ret != ERROR_SUCCESS) {
|
|
|
|
if (pvDefaultData && (dwDefaultDataSize != 0)) {
|
|
|
|
maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
|
2009-01-22 08:52:44 +00:00
|
|
|
src = pvDefaultData;
|
|
|
|
dst = pvData;
|
2001-10-24 02:45:08 +00:00
|
|
|
for(i=0; i<maxmove; i++) *dst++ = *src++;
|
|
|
|
*pcbData = maxmove;
|
|
|
|
TRACE("setting default data\n");
|
|
|
|
ret = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-07-26 17:51:32 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetUSValueA [SHLWAPI.@]
|
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* Get a user-specific registry value.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from SHRegOpenUSKeyA() or SHRegQueryUSValueA().
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This function opens pSubKey, queries the value, and then closes the key.
|
2000-07-26 17:51:32 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegGetUSValueA(
|
2003-03-18 18:35:48 +00:00
|
|
|
LPCSTR pSubKey, /* [I] Key name to open */
|
|
|
|
LPCSTR pValue, /* [I] Value name to open */
|
|
|
|
LPDWORD pwType, /* [O] Destination for the type of the value */
|
|
|
|
LPVOID pvData, /* [O] Destination for the value */
|
|
|
|
LPDWORD pcbData, /* [I] Destination for the length of the value **/
|
|
|
|
BOOL flagIgnoreHKCU, /* [I] TRUE=Don't check HKEY_CURRENT_USER */
|
|
|
|
LPVOID pDefaultData, /* [I] Default value if it doesn't exist */
|
|
|
|
DWORD wDefaultDataSize) /* [I] Length of pDefaultData */
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2001-10-21 15:09:36 +00:00
|
|
|
HUSKEY myhuskey;
|
2001-10-24 02:45:08 +00:00
|
|
|
LONG ret;
|
2001-10-21 15:09:36 +00:00
|
|
|
|
|
|
|
if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("key '%s', value '%s', datalen %d, %s\n",
|
2001-10-21 15:09:36 +00:00
|
|
|
debugstr_a(pSubKey), debugstr_a(pValue), *pcbData,
|
2001-11-06 21:01:32 +00:00
|
|
|
(flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-10-21 15:09:36 +00:00
|
|
|
|
|
|
|
ret = SHRegOpenUSKeyA(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
|
|
|
|
if (ret == ERROR_SUCCESS) {
|
2001-10-24 02:45:08 +00:00
|
|
|
ret = SHRegQueryUSValueA(myhuskey, pValue, pwType, pvData,
|
|
|
|
pcbData, flagIgnoreHKCU, pDefaultData,
|
|
|
|
wDefaultDataSize);
|
2001-10-21 15:09:36 +00:00
|
|
|
SHRegCloseUSKey(myhuskey);
|
|
|
|
}
|
|
|
|
return ret;
|
2000-07-26 17:51:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetUSValueW [SHLWAPI.@]
|
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* See SHRegGetUSValueA.
|
2000-07-26 17:51:32 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegGetUSValueW(
|
|
|
|
LPCWSTR pSubKey,
|
|
|
|
LPCWSTR pValue,
|
|
|
|
LPDWORD pwType,
|
|
|
|
LPVOID pvData,
|
2001-10-21 15:09:36 +00:00
|
|
|
LPDWORD pcbData,
|
2000-07-26 17:51:32 +00:00
|
|
|
BOOL flagIgnoreHKCU,
|
|
|
|
LPVOID pDefaultData,
|
|
|
|
DWORD wDefaultDataSize)
|
|
|
|
{
|
2001-10-21 15:09:36 +00:00
|
|
|
HUSKEY myhuskey;
|
2001-10-24 02:45:08 +00:00
|
|
|
LONG ret;
|
2000-07-26 17:51:32 +00:00
|
|
|
|
2001-10-21 15:09:36 +00:00
|
|
|
if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("key '%s', value '%s', datalen %d, %s\n",
|
2001-10-21 15:09:36 +00:00
|
|
|
debugstr_w(pSubKey), debugstr_w(pValue), *pcbData,
|
2001-11-06 21:01:32 +00:00
|
|
|
(flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-04-25 19:51:56 +00:00
|
|
|
|
2001-10-21 15:09:36 +00:00
|
|
|
ret = SHRegOpenUSKeyW(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
|
|
|
|
if (ret == ERROR_SUCCESS) {
|
2001-10-24 02:45:08 +00:00
|
|
|
ret = SHRegQueryUSValueW(myhuskey, pValue, pwType, pvData,
|
|
|
|
pcbData, flagIgnoreHKCU, pDefaultData,
|
2003-07-22 00:58:09 +00:00
|
|
|
wDefaultDataSize);
|
2003-03-10 19:02:47 +00:00
|
|
|
SHRegCloseUSKey(myhuskey);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegSetUSValueA [SHLWAPI.@]
|
2003-07-22 00:58:09 +00:00
|
|
|
*
|
|
|
|
* Set a user-specific registry value.
|
|
|
|
*
|
2004-03-17 20:48:03 +00:00
|
|
|
* PARAMS
|
|
|
|
* pszSubKey [I] Name of key to set the value in
|
|
|
|
* pszValue [I] Name of value under pszSubKey to set the value in
|
|
|
|
* dwType [I] Type of the value
|
|
|
|
* pvData [I] Data to set as the value
|
|
|
|
* cbData [I] length of pvData
|
|
|
|
* dwFlags [I] SHREGSET_ flags from "shlwapi.h"
|
|
|
|
*
|
2003-07-22 00:58:09 +00:00
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from SHRegOpenUSKeyA() or SHRegWriteUSValueA(), or
|
|
|
|
* ERROR_INVALID_FUNCTION if pvData is NULL.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This function opens pszSubKey, sets the value, and then closes the key.
|
2003-03-10 19:02:47 +00:00
|
|
|
*/
|
2004-03-17 20:48:03 +00:00
|
|
|
LONG WINAPI SHRegSetUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwType,
|
|
|
|
LPVOID pvData, DWORD cbData, DWORD dwFlags)
|
2003-03-10 19:02:47 +00:00
|
|
|
{
|
2004-03-17 20:48:03 +00:00
|
|
|
BOOL ignoreHKCU = TRUE;
|
|
|
|
HUSKEY hkey;
|
|
|
|
LONG ret;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%s,%s,%d,%p,%d,0x%08x\n", debugstr_a(pszSubKey), debugstr_a(pszValue),
|
2004-03-17 20:48:03 +00:00
|
|
|
dwType, pvData, cbData, dwFlags);
|
|
|
|
|
|
|
|
if (!pvData)
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
|
|
|
|
if (dwFlags & SHREGSET_HKCU || dwFlags & SHREGSET_FORCE_HKCU)
|
|
|
|
ignoreHKCU = FALSE;
|
|
|
|
|
|
|
|
ret = SHRegOpenUSKeyA(pszSubKey, KEY_ALL_ACCESS, 0, &hkey, ignoreHKCU);
|
|
|
|
if (ret == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ret = SHRegWriteUSValueA(hkey, pszValue, dwType, pvData, cbData, dwFlags);
|
|
|
|
SHRegCloseUSKey(hkey);
|
|
|
|
}
|
|
|
|
return ret;
|
2003-03-10 19:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegSetUSValueW [SHLWAPI.@]
|
2003-07-22 00:58:09 +00:00
|
|
|
*
|
|
|
|
* See SHRegSetUSValueA.
|
2003-03-10 19:02:47 +00:00
|
|
|
*/
|
2004-03-17 20:48:03 +00:00
|
|
|
LONG WINAPI SHRegSetUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwType,
|
|
|
|
LPVOID pvData, DWORD cbData, DWORD dwFlags)
|
2003-03-10 19:02:47 +00:00
|
|
|
{
|
2004-03-17 20:48:03 +00:00
|
|
|
BOOL ignoreHKCU = TRUE;
|
|
|
|
HUSKEY hkey;
|
|
|
|
LONG ret;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%s,%s,%d,%p,%d,0x%08x\n", debugstr_w(pszSubKey), debugstr_w(pszValue),
|
2004-03-17 20:48:03 +00:00
|
|
|
dwType, pvData, cbData, dwFlags);
|
|
|
|
|
|
|
|
if (!pvData)
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
|
|
|
|
if (dwFlags & SHREGSET_HKCU || dwFlags & SHREGSET_FORCE_HKCU)
|
|
|
|
ignoreHKCU = FALSE;
|
|
|
|
|
|
|
|
ret = SHRegOpenUSKeyW(pszSubKey, KEY_ALL_ACCESS, 0, &hkey, ignoreHKCU);
|
|
|
|
if (ret == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ret = SHRegWriteUSValueW(hkey, pszValue, dwType, pvData, cbData, dwFlags);
|
|
|
|
SHRegCloseUSKey(hkey);
|
|
|
|
}
|
|
|
|
return ret;
|
2001-04-25 19:51:56 +00:00
|
|
|
}
|
|
|
|
|
2000-07-26 17:51:32 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetBoolUSValueA [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* Get a user-specific registry boolean value.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from SHRegOpenUSKeyA() or SHRegQueryUSValueA().
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This function opens pszSubKey, queries the value, and then closes the key.
|
|
|
|
*
|
|
|
|
* Boolean values are one of the following:
|
|
|
|
* True: YES,TRUE,non-zero
|
|
|
|
* False: NO,FALSE,0
|
2000-07-26 17:51:32 +00:00
|
|
|
*/
|
|
|
|
BOOL WINAPI SHRegGetBoolUSValueA(
|
2003-03-18 18:35:48 +00:00
|
|
|
LPCSTR pszSubKey, /* [I] Key name to open */
|
|
|
|
LPCSTR pszValue, /* [I] Value name to open */
|
|
|
|
BOOL fIgnoreHKCU, /* [I] TRUE=Don't check HKEY_CURRENT_USER */
|
|
|
|
BOOL fDefault) /* [I] Default value to use if pszValue is not present */
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2001-10-28 21:13:16 +00:00
|
|
|
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 21:01:32 +00:00
|
|
|
(fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-10-28 21:13:16 +00:00
|
|
|
|
|
|
|
datalen = sizeof(data)-1;
|
2008-04-28 21:17:14 +00:00
|
|
|
if (!SHRegGetUSValueA( pszSubKey, pszValue, &type,
|
|
|
|
data, &datalen,
|
|
|
|
fIgnoreHKCU, 0, 0)) {
|
2001-10-28 21:13:16 +00:00
|
|
|
/* 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:
|
2006-10-06 10:43:28 +00:00
|
|
|
FIXME("Unsupported registry data type %d\n", type);
|
2001-10-28 21:13:16 +00:00
|
|
|
ret = FALSE;
|
|
|
|
}
|
2006-10-13 00:19:42 +00:00
|
|
|
TRACE("got value (type=%d), returning <%s>\n", type,
|
2001-10-28 21:13:16 +00:00
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = fDefault;
|
|
|
|
TRACE("returning default data <%s>\n",
|
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
return ret;
|
2000-07-26 17:51:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegGetBoolUSValueW [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* See SHRegGetBoolUSValueA.
|
2000-07-26 17:51:32 +00:00
|
|
|
*/
|
|
|
|
BOOL WINAPI SHRegGetBoolUSValueW(
|
|
|
|
LPCWSTR pszSubKey,
|
|
|
|
LPCWSTR pszValue,
|
|
|
|
BOOL fIgnoreHKCU,
|
|
|
|
BOOL fDefault)
|
|
|
|
{
|
2001-11-06 00:48:51 +00: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 21:13:16 +00:00
|
|
|
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 21:01:32 +00:00
|
|
|
(fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
|
2001-10-28 21:13:16 +00:00
|
|
|
|
|
|
|
datalen = (sizeof(data)-1) * sizeof(WCHAR);
|
2008-04-28 21:17:14 +00:00
|
|
|
if (!SHRegGetUSValueW( pszSubKey, pszValue, &type,
|
|
|
|
data, &datalen,
|
|
|
|
fIgnoreHKCU, 0, 0)) {
|
2001-10-28 21:13:16 +00:00
|
|
|
/* process returned data via type into bool */
|
|
|
|
switch (type) {
|
|
|
|
case REG_SZ:
|
2007-06-20 21:34:50 +00:00
|
|
|
data[9] = '\0'; /* set end of string */
|
2001-11-06 00:48:51 +00: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 21:13:16 +00:00
|
|
|
break;
|
|
|
|
case REG_DWORD:
|
|
|
|
work = *(LPDWORD)data;
|
|
|
|
ret = (work != 0);
|
|
|
|
break;
|
|
|
|
case REG_BINARY:
|
|
|
|
if (datalen == 1) {
|
2007-06-20 21:34:50 +00:00
|
|
|
ret = (data[0] != '\0');
|
2001-10-28 21:13:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2006-10-06 10:43:28 +00:00
|
|
|
FIXME("Unsupported registry data type %d\n", type);
|
2001-10-28 21:13:16 +00:00
|
|
|
ret = FALSE;
|
|
|
|
}
|
2006-10-13 00:19:42 +00:00
|
|
|
TRACE("got value (type=%d), returning <%s>\n", type,
|
2001-10-28 21:13:16 +00:00
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = fDefault;
|
|
|
|
TRACE("returning default data <%s>\n",
|
|
|
|
(ret) ? "TRUE" : "FALSE");
|
|
|
|
}
|
|
|
|
return ret;
|
2000-07-26 17:51:32 +00:00
|
|
|
}
|
|
|
|
|
2001-10-21 15:09:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryInfoUSKeyA [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* Get information about a user-specific registry key.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from RegQueryInfoKeyA().
|
2001-10-21 15:09:36 +00:00
|
|
|
*/
|
2001-12-11 00:30:17 +00:00
|
|
|
LONG WINAPI SHRegQueryInfoUSKeyA(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey, /* [I] Key to query */
|
|
|
|
LPDWORD pcSubKeys, /* [O] Destination for number of sub keys */
|
|
|
|
LPDWORD pcchMaxSubKeyLen, /* [O] Destination for the length of the biggest sub key name */
|
|
|
|
LPDWORD pcValues, /* [O] Destination for number of values */
|
|
|
|
LPDWORD pcchMaxValueNameLen,/* [O] Destination for the length of the biggest value */
|
|
|
|
SHREGENUM_FLAGS enumRegFlags) /* [in] SHREGENUM_ flags from "shlwapi.h" */
|
2001-10-21 15:09:36 +00:00
|
|
|
{
|
2001-10-24 02:45:08 +00:00
|
|
|
HKEY dokey;
|
|
|
|
LONG ret;
|
|
|
|
|
2003-07-22 00:58:09 +00:00
|
|
|
TRACE("(%p,%p,%p,%p,%p,%d)\n",
|
|
|
|
hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
|
2001-10-24 02:45:08 +00:00
|
|
|
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 21:21:29 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 02:45:08 +00: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-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_HKCU))
|
2001-10-24 02:45:08 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
2002-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 02:45:08 +00: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 15:09:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryInfoUSKeyW [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* See SHRegQueryInfoUSKeyA.
|
2001-10-21 15:09:36 +00:00
|
|
|
*/
|
2001-12-11 00:30:17 +00:00
|
|
|
LONG WINAPI SHRegQueryInfoUSKeyW(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey,
|
2001-10-21 15:09:36 +00:00
|
|
|
LPDWORD pcSubKeys,
|
|
|
|
LPDWORD pcchMaxSubKeyLen,
|
|
|
|
LPDWORD pcValues,
|
|
|
|
LPDWORD pcchMaxValueNameLen,
|
|
|
|
SHREGENUM_FLAGS enumRegFlags)
|
|
|
|
{
|
2001-10-24 02:45:08 +00:00
|
|
|
HKEY dokey;
|
|
|
|
LONG ret;
|
|
|
|
|
2003-07-22 00:58:09 +00:00
|
|
|
TRACE("(%p,%p,%p,%p,%p,%d)\n",
|
|
|
|
hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
|
2001-10-21 15:09:36 +00:00
|
|
|
pcchMaxValueNameLen,enumRegFlags);
|
2001-10-24 02:45:08 +00:00
|
|
|
|
|
|
|
/* if user wants HKCU, and it exists, then try it */
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
2002-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 02:45:08 +00: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-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_HKCU))
|
2001-10-24 02:45:08 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
2002-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-10-24 02:45:08 +00: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 15:09:36 +00:00
|
|
|
}
|
|
|
|
|
2001-09-07 18:36:47 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegEnumUSKeyA [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* Enumerate a user-specific registry key.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: An error code from RegEnumKeyExA().
|
2001-09-07 18:36:47 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegEnumUSKeyA(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey, /* [in] Key to enumerate */
|
|
|
|
DWORD dwIndex, /* [in] Index within hUSKey */
|
|
|
|
LPSTR pszName, /* [out] Name of the enumerated value */
|
|
|
|
LPDWORD pcchValueNameLen, /* [in/out] Length of pszName */
|
|
|
|
SHREGENUM_FLAGS enumRegFlags) /* [in] SHREGENUM_ flags from "shlwapi.h" */
|
2001-09-07 18:36:47 +00:00
|
|
|
{
|
2001-11-13 21:28:21 +00:00
|
|
|
HKEY dokey;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%p,%d,%p,%p(%d),%d)\n",
|
2003-07-22 00:58:09 +00:00
|
|
|
hUSKey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 21:28:21 +00:00
|
|
|
*pcchValueNameLen, enumRegFlags);
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
2002-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 21:28:21 +00:00
|
|
|
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
|
2002-05-31 23:06:46 +00:00
|
|
|
return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 21:28:21 +00:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKLM) ||
|
2002-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 21:28:21 +00: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 21:21:29 +00:00
|
|
|
return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 21:28:21 +00:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
2002-10-25 19:09:02 +00:00
|
|
|
FIXME("no support for SHREGENUM_BOTH\n");
|
2001-11-13 21:28:21 +00:00
|
|
|
return ERROR_INVALID_FUNCTION;
|
2001-09-07 18:36:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegEnumUSKeyW [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* See SHRegEnumUSKeyA.
|
2001-09-07 18:36:47 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegEnumUSKeyW(
|
2003-03-18 18:35:48 +00:00
|
|
|
HUSKEY hUSKey,
|
|
|
|
DWORD dwIndex,
|
|
|
|
LPWSTR pszName,
|
|
|
|
LPDWORD pcchValueNameLen,
|
|
|
|
SHREGENUM_FLAGS enumRegFlags)
|
2001-09-07 18:36:47 +00:00
|
|
|
{
|
2001-11-13 21:28:21 +00:00
|
|
|
HKEY dokey;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%p,%d,%p,%p(%d),%d)\n",
|
2003-07-22 00:58:09 +00:00
|
|
|
hUSKey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 21:28:21 +00:00
|
|
|
*pcchValueNameLen, enumRegFlags);
|
|
|
|
|
|
|
|
if (((enumRegFlags == SHREGENUM_HKCU) ||
|
2002-05-31 23:06:46 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 21:28:21 +00: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 21:21:29 +00:00
|
|
|
return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 21:28:21 +00: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 21:21:29 +00:00
|
|
|
(enumRegFlags == SHREGENUM_DEFAULT)) &&
|
2001-11-13 21:28:21 +00: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 21:21:29 +00:00
|
|
|
return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
|
2001-11-13 21:28:21 +00:00
|
|
|
0, 0, 0, 0);
|
|
|
|
}
|
2002-10-25 19:09:02 +00:00
|
|
|
FIXME("no support for SHREGENUM_BOTH\n");
|
2001-11-13 21:28:21 +00:00
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
2003-07-22 00:58:09 +00:00
|
|
|
|
2001-11-13 21:28:21 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegWriteUSValueA [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
2003-07-22 00:58:09 +00:00
|
|
|
* Write a user-specific registry value.
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
2003-07-22 00:58:09 +00:00
|
|
|
* PARAMS
|
|
|
|
* hUSKey [I] Key to write the value to
|
|
|
|
* pszValue [I] Name of value under hUSKey to write the value as
|
|
|
|
* dwType [I] Type of the value
|
|
|
|
* pvData [I] Data to set as the value
|
|
|
|
* cbData [I] length of pvData
|
|
|
|
* dwFlags [I] SHREGSET_ flags from "shlwapi.h"
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
2004-03-17 20:48:03 +00:00
|
|
|
* Failure: ERROR_INVALID_PARAMETER, if any parameter is invalid, otherwise
|
|
|
|
* an error code from RegSetValueExA().
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* dwFlags must have at least SHREGSET_FORCE_HKCU or SHREGSET_FORCE_HKLM set.
|
2001-11-13 21:28:21 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType,
|
2004-03-17 20:48:03 +00:00
|
|
|
LPVOID pvData, DWORD cbData, DWORD dwFlags)
|
2001-11-13 21:28:21 +00:00
|
|
|
{
|
2004-03-17 20:48:03 +00:00
|
|
|
WCHAR szValue[MAX_PATH];
|
2002-02-12 18:44:14 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (pszValue)
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, pszValue, -1, szValue, MAX_PATH);
|
2002-02-12 18:44:14 +00:00
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
return SHRegWriteUSValueW(hUSKey, pszValue ? szValue : NULL, dwType,
|
|
|
|
pvData, cbData, dwFlags);
|
2001-11-13 21:28:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegWriteUSValueW [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* See SHRegWriteUSValueA.
|
2001-11-13 21:28:21 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType,
|
2004-03-17 20:48:03 +00:00
|
|
|
LPVOID pvData, DWORD cbData, DWORD dwFlags)
|
2001-11-13 21:28:21 +00:00
|
|
|
{
|
2005-07-07 12:08:42 +00:00
|
|
|
DWORD dummy;
|
2009-01-22 08:52:44 +00:00
|
|
|
LPSHUSKEY hKey = hUSKey;
|
2004-03-17 20:48:03 +00:00
|
|
|
LONG ret = ERROR_SUCCESS;
|
2002-02-12 18:44:14 +00:00
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%p,%s,%d,%p,%d,%d)\n", hUSKey, debugstr_w(pszValue),
|
2004-03-17 20:48:03 +00:00
|
|
|
dwType, pvData, cbData, dwFlags);
|
|
|
|
|
|
|
|
if (!hUSKey || IsBadWritePtr(hUSKey, sizeof(SHUSKEY)) ||
|
|
|
|
!(dwFlags & (SHREGSET_FORCE_HKCU|SHREGSET_FORCE_HKLM)))
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if (dwFlags & (SHREGSET_FORCE_HKCU|SHREGSET_HKCU))
|
|
|
|
{
|
|
|
|
if (!hKey->HKCUkey)
|
|
|
|
{
|
|
|
|
/* Create the key */
|
|
|
|
ret = RegCreateKeyW(hKey->HKCUstart, hKey->lpszPath, &hKey->HKCUkey);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("Creating HKCU key, ret = %d\n", ret);
|
2004-03-17 20:48:03 +00:00
|
|
|
if (ret && (dwFlags & (SHREGSET_FORCE_HKCU)))
|
|
|
|
{
|
|
|
|
hKey->HKCUkey = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
if ((dwFlags & SHREGSET_FORCE_HKCU) ||
|
|
|
|
RegQueryValueExW(hKey->HKCUkey, pszValue, NULL, NULL, NULL, &dummy))
|
|
|
|
{
|
|
|
|
/* Doesn't exist or we are forcing: Write value */
|
|
|
|
ret = RegSetValueExW(hKey->HKCUkey, pszValue, 0, dwType, pvData, cbData);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("Writing HKCU value, ret = %d\n", ret);
|
2004-03-17 20:48:03 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-12 18:44:14 +00:00
|
|
|
}
|
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
if (dwFlags & (SHREGSET_FORCE_HKLM|SHREGSET_HKLM))
|
|
|
|
{
|
|
|
|
if (!hKey->HKLMkey)
|
|
|
|
{
|
|
|
|
/* Create the key */
|
|
|
|
ret = RegCreateKeyW(hKey->HKLMstart, hKey->lpszPath, &hKey->HKLMkey);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("Creating HKLM key, ret = %d\n", ret);
|
2004-03-17 20:48:03 +00:00
|
|
|
if (ret && (dwFlags & (SHREGSET_FORCE_HKLM)))
|
|
|
|
{
|
|
|
|
hKey->HKLMkey = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
if ((dwFlags & SHREGSET_FORCE_HKLM) ||
|
|
|
|
RegQueryValueExW(hKey->HKLMkey, pszValue, NULL, NULL, NULL, &dummy))
|
|
|
|
{
|
|
|
|
/* Doesn't exist or we are forcing: Write value */
|
|
|
|
ret = RegSetValueExW(hKey->HKLMkey, pszValue, 0, dwType, pvData, cbData);
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("Writing HKLM value, ret = %d\n", ret);
|
2004-03-17 20:48:03 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-12 18:44:14 +00:00
|
|
|
}
|
|
|
|
|
2004-03-17 20:48:03 +00:00
|
|
|
return ret;
|
2001-09-07 18:36:47 +00:00
|
|
|
}
|
|
|
|
|
2000-07-26 17:51:32 +00: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 21:21:29 +00: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.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error code from RegOpenKeyExA() or SHQueryValueExA().
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHRegGetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
LPSTR lpszPath, DWORD dwFlags)
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s,%p,%d)\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 21:21:29 +00:00
|
|
|
debugstr_a(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
2002-05-09 19:43:44 +00:00
|
|
|
return SHGetValueA(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
*
|
|
|
|
* See SHRegGetPathA.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHRegGetPathW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
LPWSTR lpszPath, DWORD dwFlags)
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s,%p,%d)\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 21:21:29 +00:00
|
|
|
debugstr_w(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
2002-05-09 19:43:44 +00:00
|
|
|
return SHGetValueW(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
* SHRegSetPathA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Write a path to the registry.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00: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
|
2003-03-18 18:35:48 +00:00
|
|
|
* dwFlags [I] Reserved, must be 0.
|
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 21:21:29 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
2003-07-22 00:58:09 +00:00
|
|
|
* Failure: An error code from SHSetValueA().
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHRegSetPathA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
LPCSTR lpszPath, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
char szBuff[MAX_PATH];
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
FIXME("(hkey=%p,%s,%s,%p,%d) - 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 21:21:29 +00: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 17:51:32 +00: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 21:21:29 +00:00
|
|
|
WCHAR szBuff[MAX_PATH];
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
FIXME("(hkey=%p,%s,%s,%p,%d) - 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 21:21:29 +00:00
|
|
|
debugstr_w(lpszValue), lpszPath, dwFlags);
|
|
|
|
|
|
|
|
lstrcpyW(szBuff, lpszPath);
|
|
|
|
|
|
|
|
/* FIXME: PathUnExpandEnvStringsW(szBuff); */
|
2001-02-13 20:17:59 +00: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 21:21:29 +00: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.
|
2003-03-18 18:35:48 +00: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 21:21:29 +00:00
|
|
|
*/
|
|
|
|
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|
|
|
LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
|
|
|
|
{
|
2002-05-09 19:43:44 +00:00
|
|
|
DWORD dwRet = 0;
|
|
|
|
HKEY hSubKey = 0;
|
2001-02-13 20:17:59 +00:00
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s,%p,%p,%p)\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 21:21:29 +00:00
|
|
|
debugstr_a(lpszValue), pwType, pvData, pcbData);
|
2001-02-13 20:17:59 +00:00
|
|
|
|
2002-05-09 19:43:44 +00:00
|
|
|
/* lpszSubKey can be 0. In this case the value is taken from the
|
|
|
|
* current key.
|
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
if(lpszSubKey)
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
}
|
|
|
|
return dwRet;
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
* See SHGetValueA.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00:00
|
|
|
DWORD dwRet = 0;
|
|
|
|
HKEY hSubKey = 0;
|
2001-02-13 20:17:59 +00:00
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s,%p,%p,%p)\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 21:21:29 +00:00
|
|
|
debugstr_w(lpszValue), pwType, pvData, pcbData);
|
2001-02-13 20:17:59 +00:00
|
|
|
|
2002-05-31 23:06:46 +00:00
|
|
|
if(lpszSubKey)
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
2001-02-13 20:17:59 +00: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 21:21:29 +00: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.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error code from RegCreateKeyExA() or RegSetValueExA()
|
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 21:21:29 +00:00
|
|
|
*
|
|
|
|
* NOTES
|
2003-03-18 18:35:48 +00:00
|
|
|
* If lpszSubKey does not exist, it is created before the value is set. If
|
|
|
|
* lpszSubKey is NULL or an empty string, then the value is added directly
|
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 21:21:29 +00:00
|
|
|
* 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;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s,%d,%p,%d)\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 21:21:29 +00:00
|
|
|
debugstr_a(lpszValue), dwType, pvData, cbData);
|
|
|
|
|
|
|
|
if (lpszSubKey && *lpszSubKey)
|
2005-07-28 10:18:23 +00:00
|
|
|
dwRet = RegCreateKeyExA(hKey, lpszSubKey, 0, NULL,
|
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 21:21:29 +00:00
|
|
|
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 17:51:32 +00: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 21:21:29 +00:00
|
|
|
* SHSetValueW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHSetValueA.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
|
|
|
|
DWORD dwType, LPCVOID pvData, DWORD cbData)
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD dwRet = ERROR_SUCCESS, dwDummy;
|
|
|
|
HKEY hSubKey;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s,%d,%p,%d)\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 21:21:29 +00:00
|
|
|
debugstr_w(lpszValue), dwType, pvData, cbData);
|
|
|
|
|
|
|
|
if (lpszSubKey && *lpszSubKey)
|
2005-07-28 10:18:23 +00:00
|
|
|
dwRet = RegCreateKeyExW(hKey, lpszSubKey, 0, NULL,
|
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 21:21:29 +00:00
|
|
|
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 01:24:10 +00: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 21:21:29 +00:00
|
|
|
* SHQueryInfoKeyA [SHLWAPI.@]
|
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* Get information about a registry key. See RegQueryInfoKeyA().
|
2003-07-22 00:58:09 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* The result of calling RegQueryInfoKeyA().
|
2000-11-25 01:24:10 +00: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 21:21:29 +00:00
|
|
|
LONG WINAPI SHQueryInfoKeyA(HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax,
|
|
|
|
LPDWORD pwValues, LPDWORD pwValueMax)
|
2000-11-25 01:24:10 +00:00
|
|
|
{
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
|
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 21:21:29 +00:00
|
|
|
pwValues, pwValueMax);
|
|
|
|
return RegQueryInfoKeyA(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
|
|
|
|
NULL, pwValues, pwValueMax, NULL, NULL, NULL);
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
* SHQueryInfoKeyW [SHLWAPI.@]
|
2000-07-26 17:51:32 +00:00
|
|
|
*
|
2003-07-22 00:58:09 +00:00
|
|
|
* See SHQueryInfoKeyA.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
LONG WINAPI SHQueryInfoKeyW(HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax,
|
|
|
|
LPDWORD pwValues, LPDWORD pwValueMax)
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
|
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 21:21:29 +00:00
|
|
|
pwValues, pwValueMax);
|
|
|
|
return RegQueryInfoKeyW(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
|
|
|
|
NULL, pwValues, pwValueMax, NULL, NULL, NULL);
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHQueryValueExA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Get a value from the registry, expanding environment variable strings.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
2002-05-09 19:43:44 +00: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 21:21:29 +00: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
|
2003-03-18 18:35:48 +00:00
|
|
|
* Success: ERROR_SUCCESS. Any non NULL output parameters are updated with
|
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 21:21:29 +00:00
|
|
|
* 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
|
2003-03-18 18:35:48 +00:00
|
|
|
* code from RegQueryValueExA() or ExpandEnvironmentStringsA().
|
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 21:21:29 +00:00
|
|
|
*
|
|
|
|
* 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 20:04:44 +00:00
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* REG_EXPAND_SZ:
|
|
|
|
* case-1: the unexpanded string is smaller than the expanded one
|
2005-05-06 15:44:31 +00:00
|
|
|
* subcase-1: the buffer is too small to hold the unexpanded string:
|
2002-07-20 20:04:44 +00:00
|
|
|
* function fails and returns the size of the unexpanded string.
|
|
|
|
*
|
2005-05-06 15:44:31 +00:00
|
|
|
* subcase-2: buffer is too small to hold the expanded string:
|
2002-07-20 20:04:44 +00:00
|
|
|
* the function return success (!!) and the result is truncated
|
2005-03-23 13:15:18 +00:00
|
|
|
* *** This is clearly an error in the native implementation. ***
|
2002-07-20 20:04:44 +00:00
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* case-2: the unexpanded string is bigger than the expanded one
|
2002-07-20 20:04:44 +00:00
|
|
|
* 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 21:21:29 +00:00
|
|
|
*/
|
2002-05-09 19:43:44 +00: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 21:21:29 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00:00
|
|
|
DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%p,%p,%p,%p=%d)\n", hKey, debugstr_a(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 21:21:29 +00:00
|
|
|
lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
|
|
|
|
|
2002-05-09 19:43:44 +00: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;
|
|
|
|
|
2005-05-06 15:44:31 +00:00
|
|
|
/* If the caller didn't supply a buffer or the buffer is too small we have
|
2002-05-09 19:43:44 +00:00
|
|
|
* to allocate our own
|
|
|
|
*/
|
|
|
|
if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
|
2002-05-31 23:06:46 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00:00
|
|
|
char cNull = '\0';
|
2007-01-04 11:27:45 +00:00
|
|
|
nBytesToAlloc = dwUnExpDataLen;
|
2002-05-09 19:43:44 +00:00
|
|
|
|
2008-11-05 22:04:51 +00:00
|
|
|
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
|
2002-05-09 19:43:44 +00:00
|
|
|
RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
|
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
2008-11-05 22:04:51 +00:00
|
|
|
LocalFree(szData);
|
2002-05-09 19:43:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-07-04 00:06:29 +00:00
|
|
|
nBytesToAlloc = (lstrlenA(pvData)+1) * sizeof (CHAR);
|
2008-11-05 22:04:51 +00:00
|
|
|
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
|
2002-05-09 19:43:44 +00:00
|
|
|
lstrcpyA(szData, pvData);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
|
2002-05-31 23:06:46 +00:00
|
|
|
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
|
2002-05-09 19:43:44 +00:00
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
2008-11-05 22:04:51 +00:00
|
|
|
LocalFree(szData);
|
2002-05-09 19:43:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 21:21:29 +00:00
|
|
|
}
|
2000-07-26 17:51:32 +00:00
|
|
|
|
2002-05-09 19:43:44 +00:00
|
|
|
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
* See SHQueryValueExA.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue,
|
|
|
|
LPDWORD lpReserved, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00:00
|
|
|
DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%p,%p,%p,%p=%d)\n", hKey, debugstr_w(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 21:21:29 +00:00
|
|
|
lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
|
|
|
|
|
2002-05-09 19:43:44 +00:00
|
|
|
if (pcbData) dwUnExpDataLen = *pcbData;
|
|
|
|
|
|
|
|
dwRet = RegQueryValueExW(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
|
2003-11-20 04:20:50 +00:00
|
|
|
if (dwRet!=ERROR_SUCCESS && dwRet!=ERROR_MORE_DATA)
|
|
|
|
return dwRet;
|
2002-05-09 19:43:44 +00:00
|
|
|
|
|
|
|
if (pcbData && (dwType == REG_EXPAND_SZ))
|
|
|
|
{
|
|
|
|
DWORD nBytesToAlloc;
|
|
|
|
|
|
|
|
/* Expand type REG_EXPAND_SZ into REG_SZ */
|
|
|
|
LPWSTR szData;
|
|
|
|
|
2003-11-20 04:20:50 +00:00
|
|
|
/* If the caller didn't supply a buffer or the buffer is too small we have
|
2002-05-09 19:43:44 +00:00
|
|
|
* to allocate our own
|
|
|
|
*/
|
|
|
|
if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
|
2002-05-31 23:06:46 +00:00
|
|
|
{
|
2002-05-09 19:43:44 +00:00
|
|
|
WCHAR cNull = '\0';
|
2007-01-05 11:11:21 +00:00
|
|
|
nBytesToAlloc = dwUnExpDataLen;
|
2002-05-09 19:43:44 +00:00
|
|
|
|
2008-11-05 22:04:51 +00:00
|
|
|
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
|
2002-05-09 19:43:44 +00:00
|
|
|
RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
|
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
2008-11-05 22:04:51 +00:00
|
|
|
LocalFree(szData);
|
2002-05-09 19:43:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-07-04 00:06:29 +00:00
|
|
|
nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
|
2008-11-05 22:04:51 +00:00
|
|
|
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
|
2002-05-09 19:43:44 +00:00
|
|
|
lstrcpyW(szData, pvData);
|
|
|
|
dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
|
2002-05-31 23:06:46 +00:00
|
|
|
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
|
2002-05-09 19:43:44 +00:00
|
|
|
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
|
2008-11-05 22:04:51 +00:00
|
|
|
LocalFree(szData);
|
2002-05-09 19:43:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 17:51:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteKeyA [SHLWAPI.@]
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
* Delete a registry key and any sub keys/values present
|
2000-09-29 00:25:56 +00:00
|
|
|
*
|
2006-12-03 15:09:24 +00:00
|
|
|
* This function forwards to the unicode version directly, to avoid
|
|
|
|
* handling subkeys that are not representable in ASCII.
|
|
|
|
*
|
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 21:21:29 +00:00
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* lpszSubKey [I] Name of sub key to delete
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The key is deleted.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error code from RegOpenKeyExA(), RegQueryInfoKeyA(),
|
|
|
|
* RegEnumKeyExA() or RegDeleteKeyA().
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
2000-07-26 17:51:32 +00:00
|
|
|
{
|
2006-12-03 15:09:24 +00:00
|
|
|
WCHAR subkeyW[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 21:21:29 +00:00
|
|
|
|
2006-12-03 15:09:24 +00:00
|
|
|
MultiByteToWideChar (CP_ACP, 0, lpszSubKey, -1, subkeyW, sizeof(subkeyW)/sizeof(WCHAR));
|
|
|
|
return SHDeleteKeyW(hKey, subkeyW);
|
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 21:21:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHDeleteKeyA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
|
|
|
{
|
2006-11-10 10:57:27 +00:00
|
|
|
DWORD dwRet, dwMaxSubkeyLen = 0, dwSize;
|
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 21:21:29 +00:00
|
|
|
WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%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 21:21:29 +00:00
|
|
|
|
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
2006-11-10 10:57:27 +00:00
|
|
|
/* Find the maximum subkey length so that we can allocate a buffer */
|
|
|
|
dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
|
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 21:21:29 +00:00
|
|
|
&dwMaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
if(!dwRet)
|
2000-09-29 00:25:56 +00: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 21:21:29 +00: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
|
|
|
|
{
|
2006-11-10 10:57:27 +00:00
|
|
|
while (dwRet == ERROR_SUCCESS)
|
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 21:21:29 +00:00
|
|
|
{
|
|
|
|
dwSize = dwMaxSubkeyLen;
|
2006-11-10 10:57:27 +00:00
|
|
|
dwRet = RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL, NULL, NULL, NULL);
|
|
|
|
if (dwRet == ERROR_SUCCESS || dwRet == ERROR_MORE_DATA)
|
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 21:21:29 +00:00
|
|
|
dwRet = SHDeleteKeyW(hSubKey, lpszName);
|
|
|
|
}
|
2006-11-10 10:57:27 +00:00
|
|
|
if (dwRet == ERROR_NO_MORE_ITEMS)
|
|
|
|
dwRet = ERROR_SUCCESS;
|
|
|
|
|
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 21:21:29 +00:00
|
|
|
if (lpszName != szNameBuf)
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpszName); /* Free buffer if allocated */
|
|
|
|
}
|
2000-09-29 00:25:56 +00: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 21:21:29 +00: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
|
2003-03-18 18:35:48 +00:00
|
|
|
* returns an error code from RegOpenKeyExA(), RegQueryInfoKeyA() or
|
|
|
|
* RegDeleteKeyA().
|
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 21:21:29 +00:00
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteEmptyKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
DWORD dwRet, dwKeyCount = 0;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%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 21:21:29 +00:00
|
|
|
|
|
|
|
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 00:25:56 +00: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 21:21:29 +00:00
|
|
|
if (!dwKeyCount)
|
|
|
|
dwRet = RegDeleteKeyA(hKey, lpszSubKey);
|
|
|
|
else
|
|
|
|
dwRet = ERROR_KEY_HAS_CHILDREN;
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHDeleteEmptyKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHDeleteEmptyKeyA.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteEmptyKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
DWORD dwRet, dwKeyCount = 0;
|
|
|
|
HKEY hSubKey = 0;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p, %s)\n", hKey, debugstr_w(lpszSubKey));
|
2000-09-29 00:25:56 +00: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 21:21:29 +00: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 00:25:56 +00: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 21:21:29 +00: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.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error from RegOpenKeyExA(), RegQueryValueExA(), or RegDeleteKeyA().
|
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 21:21:29 +00:00
|
|
|
*/
|
|
|
|
DWORD WINAPI SHDeleteOrphanKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
|
|
|
{
|
|
|
|
HKEY hSubKey;
|
|
|
|
DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%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 21:21:29 +00:00
|
|
|
|
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
|
2000-09-29 00:25:56 +00: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 21:21:29 +00: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 00:25:56 +00: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 21:21:29 +00:00
|
|
|
if(!dwRet && !dwKeyCount && !dwValueCount)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteKeyA(hKey, lpszSubKey);
|
|
|
|
}
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
* SHDeleteOrphanKeyW [SHLWAPI.@]
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
* See SHDeleteOrphanKeyA.
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHDeleteOrphanKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
2000-07-26 17:51:32 +00: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 21:21:29 +00:00
|
|
|
HKEY hSubKey;
|
|
|
|
DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%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 21:21:29 +00: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 17:51:32 +00:00
|
|
|
}
|
2000-09-29 00:25:56 +00:00
|
|
|
|
2000-11-25 01:24:10 +00: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 21:21:29 +00: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.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error code from RegOpenKeyExA() or RegDeleteValueA().
|
2000-11-25 01:24:10 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHDeleteValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue)
|
|
|
|
{
|
|
|
|
DWORD dwRet;
|
|
|
|
HKEY hSubKey;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s)\n", hKey, debugstr_a(lpszSubKey), debugstr_a(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 21:21:29 +00:00
|
|
|
|
|
|
|
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
|
|
|
|
if (!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteValueA(hSubKey, lpszValue);
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-11-25 01:24:10 +00: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 21:21:29 +00:00
|
|
|
* See SHDeleteValueA.
|
2000-11-25 01:24:10 +00: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 21:21:29 +00:00
|
|
|
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
|
|
|
|
{
|
|
|
|
DWORD dwRet;
|
|
|
|
HKEY hSubKey;
|
|
|
|
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("(hkey=%p,%s,%s)\n", hKey, debugstr_w(lpszSubKey), debugstr_w(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 21:21:29 +00:00
|
|
|
|
|
|
|
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
|
|
|
|
if (!dwRet)
|
|
|
|
{
|
|
|
|
dwRet = RegDeleteValueW(hSubKey, lpszValue);
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
}
|
|
|
|
return dwRet;
|
2000-11-25 01:24:10 +00:00
|
|
|
}
|
|
|
|
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
* SHEnumKeyExA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Enumerate sub keys in a registry key.
|
2000-09-29 00:25:56 +00: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 21:21:29 +00: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 00:25:56 +00:00
|
|
|
*
|
2003-07-22 00:58:09 +00:00
|
|
|
* RETURNS
|
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 21:21:29 +00:00
|
|
|
* Success: ERROR_SUCCESS. lpszSubKey and pwLen are updated.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error code from RegEnumKeyExA().
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
LONG WINAPI SHEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpszSubKey,
|
|
|
|
LPDWORD pwLen)
|
2000-09-29 00:25:56 +00:00
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%d,%s,%p)\n", hKey, dwIndex, debugstr_a(lpszSubKey), pwLen);
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
return RegEnumKeyExA(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* SHEnumKeyExW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHEnumKeyExA.
|
|
|
|
*/
|
|
|
|
LONG WINAPI SHEnumKeyExW(HKEY hKey, DWORD dwIndex, LPWSTR lpszSubKey,
|
|
|
|
LPDWORD pwLen)
|
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%d,%s,%p)\n", hKey, dwIndex, debugstr_w(lpszSubKey), pwLen);
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
return RegEnumKeyExW(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
2000-09-29 00:25:56 +00: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 21:21:29 +00: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.
|
2003-03-18 18:35:48 +00:00
|
|
|
* Failure: An error code from RegEnumValueA().
|
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 21:21:29 +00:00
|
|
|
*/
|
|
|
|
LONG WINAPI SHEnumValueA(HKEY hKey, DWORD dwIndex, LPSTR lpszValue,
|
|
|
|
LPDWORD pwLen, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%d,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
|
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 21:21:29 +00:00
|
|
|
debugstr_a(lpszValue), pwLen, pwType, pvData, pcbData);
|
2000-09-29 00:25:56 +00:00
|
|
|
|
2002-09-06 19:35:08 +00:00
|
|
|
return RegEnumValueA(hKey, dwIndex, lpszValue, pwLen, NULL,
|
|
|
|
pwType, pvData, pcbData);
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
* SHEnumValueW [SHLWAPI.@]
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
* See SHEnumValueA.
|
2000-09-29 00:25:56 +00: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 21:21:29 +00:00
|
|
|
LONG WINAPI SHEnumValueW(HKEY hKey, DWORD dwIndex, LPWSTR lpszValue,
|
|
|
|
LPDWORD pwLen, LPDWORD pwType,
|
|
|
|
LPVOID pvData, LPDWORD pcbData)
|
2000-09-29 00:25:56 +00:00
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%d,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
|
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 21:21:29 +00:00
|
|
|
debugstr_w(lpszValue), pwLen, pwType, pvData, pcbData);
|
|
|
|
|
|
|
|
return RegEnumValueW(hKey, dwIndex, lpszValue, pwLen, NULL,
|
|
|
|
pwType, pvData, pcbData);
|
2000-09-29 00:25:56 +00:00
|
|
|
}
|
|
|
|
|
2001-02-13 20:17:59 +00:00
|
|
|
/*************************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* @ [SHLWAPI.205]
|
2001-02-13 20:17:59 +00:00
|
|
|
*
|
2003-03-18 18:35:48 +00:00
|
|
|
* Get a value from the registry.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Handle to registry key
|
|
|
|
* pSubKey [I] Name of sub key containing value to get
|
|
|
|
* pValue [I] Name of value to get
|
|
|
|
* pwType [O] Destination for the values type
|
|
|
|
* pvData [O] Destination for the values data
|
|
|
|
* pbData [O] Destination for the values size
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. Output parameters contain the details read.
|
|
|
|
* Failure: An error code from RegOpenKeyExA() or SHQueryValueExA(),
|
|
|
|
* or ERROR_INVALID_FUNCTION in the machine is in safe mode.
|
2001-02-13 20:17:59 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
DWORD WINAPI SHGetValueGoodBootA(HKEY hkey, LPCSTR pSubKey, LPCSTR pValue,
|
2001-02-13 20:17:59 +00:00
|
|
|
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 19:59:40 +00:00
|
|
|
* @ [SHLWAPI.206]
|
2001-02-13 20:17:59 +00:00
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of SHGetValueGoodBootW.
|
2001-02-13 20:17:59 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
DWORD WINAPI SHGetValueGoodBootW(HKEY hkey, LPCWSTR pSubKey, LPCWSTR pValue,
|
2001-02-13 20:17:59 +00:00
|
|
|
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 19:59:40 +00:00
|
|
|
* @ [SHLWAPI.320]
|
2001-02-13 20:17:59 +00:00
|
|
|
*
|
2002-09-06 19:35:08 +00:00
|
|
|
* Set a MIME content type in the registry.
|
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 21:21:29 +00:00
|
|
|
*
|
|
|
|
* PARAMS
|
2003-07-22 00:58:09 +00:00
|
|
|
* lpszSubKey [I] Name of key under HKEY_CLASSES_ROOT.
|
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 21:21:29 +00:00
|
|
|
* lpszValue [I] Value to set
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
2001-02-13 20:17:59 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI RegisterMIMETypeForExtensionA(LPCSTR lpszSubKey, LPCSTR lpszValue)
|
2001-02-13 20:17:59 +00: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 21:21:29 +00:00
|
|
|
if (!lpszValue)
|
|
|
|
{
|
2002-05-24 21:17:59 +00: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 21:21:29 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-08-08 19:35:53 +00:00
|
|
|
return !SHSetValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA,
|
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 21:21:29 +00:00
|
|
|
REG_SZ, lpszValue, strlen(lpszValue));
|
2001-02-13 20:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* @ [SHLWAPI.321]
|
2001-02-13 20:17:59 +00:00
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of RegisterMIMETypeForExtensionA.
|
2001-02-13 20:17:59 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI RegisterMIMETypeForExtensionW(LPCWSTR lpszSubKey, LPCWSTR lpszValue)
|
2001-02-13 20:17:59 +00: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 21:21:29 +00:00
|
|
|
if (!lpszValue)
|
|
|
|
{
|
2002-05-24 21:17:59 +00: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 21:21:29 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-08-08 19:35:53 +00:00
|
|
|
return !SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW,
|
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 21:21:29 +00:00
|
|
|
REG_SZ, lpszValue, strlenW(lpszValue));
|
2001-02-13 20:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* @ [SHLWAPI.322]
|
2001-02-13 20:17:59 +00:00
|
|
|
*
|
2002-09-06 19:35:08 +00:00
|
|
|
* Delete a MIME content type from the registry.
|
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 21:21:29 +00:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszSubKey [I] Name of sub key
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE
|
|
|
|
* Failure: FALSE
|
2001-02-13 20:17:59 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI UnregisterMIMETypeForExtensionA(LPCSTR lpszSubKey)
|
2001-02-13 20:17:59 +00:00
|
|
|
{
|
2012-08-08 19:35:53 +00:00
|
|
|
return !SHDeleteValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA);
|
2001-02-13 20:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* @ [SHLWAPI.323]
|
2001-02-13 20:17:59 +00:00
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of UnregisterMIMETypeForExtensionA.
|
2001-02-13 20:17:59 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI UnregisterMIMETypeForExtensionW(LPCWSTR lpszSubKey)
|
2001-02-13 20:17:59 +00:00
|
|
|
{
|
2012-08-08 19:35:53 +00:00
|
|
|
return !SHDeleteValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW);
|
2001-02-13 20:17:59 +00:00
|
|
|
}
|
|
|
|
|
2002-09-06 19:35:08 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.328]
|
|
|
|
*
|
|
|
|
* Get the registry path to a MIME content key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszType [I] Content type to get the path for
|
|
|
|
* lpszBuffer [O] Destination for path
|
|
|
|
* dwLen [I] Length of lpszBuffer
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. lpszBuffer contains the full path.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* The base path for the key is "MIME\Database\Content Type\"
|
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
|
2002-09-06 19:35:08 +00:00
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%s,%p,%d)\n", debugstr_a(lpszType), lpszBuffer, dwLen);
|
2002-09-06 19:35:08 +00:00
|
|
|
|
|
|
|
if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer)
|
|
|
|
{
|
2003-07-22 00:58:09 +00:00
|
|
|
size_t dwStrLen = strlen(lpszType);
|
2002-09-06 19:35:08 +00:00
|
|
|
|
|
|
|
if (dwStrLen < dwLen - dwLenMimeDbContent)
|
|
|
|
{
|
|
|
|
memcpy(lpszBuffer, szMimeDbContentA, dwLenMimeDbContent);
|
|
|
|
memcpy(lpszBuffer + dwLenMimeDbContent, lpszType, dwStrLen + 1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.329]
|
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of GetMIMETypeSubKeyA.
|
2002-09-06 19:35:08 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
|
2002-09-06 19:35:08 +00:00
|
|
|
{
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(%s,%p,%d)\n", debugstr_w(lpszType), lpszBuffer, dwLen);
|
2002-09-06 19:35:08 +00:00
|
|
|
|
|
|
|
if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer)
|
|
|
|
{
|
|
|
|
DWORD dwStrLen = strlenW(lpszType);
|
|
|
|
|
|
|
|
if (dwStrLen < dwLen - dwLenMimeDbContent)
|
|
|
|
{
|
2003-10-15 21:02:53 +00:00
|
|
|
memcpy(lpszBuffer, szMimeDbContentW, dwLenMimeDbContent * sizeof(WCHAR));
|
2002-09-06 19:35:08 +00:00
|
|
|
memcpy(lpszBuffer + dwLenMimeDbContent, lpszType, (dwStrLen + 1) * sizeof(WCHAR));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-09-13 18:11:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.330]
|
|
|
|
*
|
2004-09-14 19:31:22 +00:00
|
|
|
* Get the file extension for a given Mime type.
|
2004-09-13 18:11:56 +00:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszType [I] Mime type to get the file extension for
|
2004-09-14 19:31:22 +00:00
|
|
|
* lpExt [O] Destination for the resulting extension
|
|
|
|
* iLen [I] Length of lpExt in characters
|
2004-09-13 18:11:56 +00:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. lpExt contains the file extension.
|
2004-09-14 19:31:22 +00:00
|
|
|
* Failure: FALSE, if any parameter is invalid or the extension cannot be
|
2004-09-13 18:11:56 +00:00
|
|
|
* retrieved. If iLen > 0, lpExt is set to an empty string.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* - The extension returned in lpExt always has a leading '.' character, even
|
|
|
|
* if the registry Mime database entry does not.
|
|
|
|
* - iLen must be long enough for the file extension for this function to succeed.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI MIME_GetExtensionA(LPCSTR lpszType, LPSTR lpExt, INT iLen)
|
|
|
|
{
|
|
|
|
char szSubKey[MAX_PATH];
|
|
|
|
DWORD dwlen = iLen - 1, dwType;
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
|
|
|
|
if (iLen > 0 && lpExt)
|
|
|
|
*lpExt = '\0';
|
|
|
|
|
|
|
|
if (lpszType && lpExt && iLen > 2 &&
|
|
|
|
GetMIMETypeSubKeyA(lpszType, szSubKey, MAX_PATH) &&
|
|
|
|
!SHGetValueA(HKEY_CLASSES_ROOT, szSubKey, szExtensionA, &dwType, lpExt + 1, &dwlen) &&
|
|
|
|
lpExt[1])
|
|
|
|
{
|
|
|
|
if (lpExt[1] == '.')
|
|
|
|
memmove(lpExt, lpExt + 1, strlen(lpExt + 1) + 1);
|
|
|
|
else
|
|
|
|
*lpExt = '.'; /* Supply a '.' */
|
|
|
|
bRet = TRUE;
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.331]
|
|
|
|
*
|
|
|
|
* Unicode version of MIME_GetExtensionA.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI MIME_GetExtensionW(LPCWSTR lpszType, LPWSTR lpExt, INT iLen)
|
|
|
|
{
|
|
|
|
WCHAR szSubKey[MAX_PATH];
|
|
|
|
DWORD dwlen = iLen - 1, dwType;
|
|
|
|
BOOL bRet = FALSE;
|
|
|
|
|
|
|
|
if (iLen > 0 && lpExt)
|
|
|
|
*lpExt = '\0';
|
|
|
|
|
|
|
|
if (lpszType && lpExt && iLen > 2 &&
|
|
|
|
GetMIMETypeSubKeyW(lpszType, szSubKey, MAX_PATH) &&
|
|
|
|
!SHGetValueW(HKEY_CLASSES_ROOT, szSubKey, szExtensionW, &dwType, lpExt + 1, &dwlen) &&
|
|
|
|
lpExt[1])
|
|
|
|
{
|
|
|
|
if (lpExt[1] == '.')
|
|
|
|
memmove(lpExt, lpExt + 1, (strlenW(lpExt + 1) + 1) * sizeof(WCHAR));
|
|
|
|
else
|
|
|
|
*lpExt = '.'; /* Supply a '.' */
|
|
|
|
bRet = TRUE;
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2002-09-06 19:35:08 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.324]
|
|
|
|
*
|
|
|
|
* Set the file extension for a MIME content key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszExt [I] File extension to set
|
|
|
|
* lpszType [I] Content type to set the extension for
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. The file extension is set in the registry.
|
|
|
|
* Failure: FALSE.
|
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI RegisterExtensionForMIMETypeA(LPCSTR lpszExt, LPCSTR lpszType)
|
2002-09-06 19:35:08 +00:00
|
|
|
{
|
|
|
|
DWORD dwLen;
|
|
|
|
char szKey[MAX_PATH];
|
|
|
|
|
|
|
|
TRACE("(%s,%s)\n", debugstr_a(lpszExt), debugstr_a(lpszType));
|
|
|
|
|
2003-09-11 02:56:15 +00:00
|
|
|
if (!GetMIMETypeSubKeyA(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
|
2002-09-06 19:35:08 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
dwLen = strlen(lpszExt) + 1;
|
|
|
|
|
|
|
|
if (SHSetValueA(HKEY_CLASSES_ROOT, szKey, szExtensionA, REG_SZ, lpszExt, dwLen))
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.325]
|
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of RegisterExtensionForMIMETypeA.
|
2002-09-06 19:35:08 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI RegisterExtensionForMIMETypeW(LPCWSTR lpszExt, LPCWSTR lpszType)
|
2002-09-06 19:35:08 +00:00
|
|
|
{
|
|
|
|
DWORD dwLen;
|
|
|
|
WCHAR szKey[MAX_PATH];
|
|
|
|
|
|
|
|
TRACE("(%s,%s)\n", debugstr_w(lpszExt), debugstr_w(lpszType));
|
|
|
|
|
|
|
|
/* Get the full path to the key */
|
2003-09-11 02:56:15 +00:00
|
|
|
if (!GetMIMETypeSubKeyW(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
|
2002-09-06 19:35:08 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
dwLen = (lstrlenW(lpszExt) + 1) * sizeof(WCHAR);
|
|
|
|
|
|
|
|
if (SHSetValueW(HKEY_CLASSES_ROOT, szKey, szExtensionW, REG_SZ, lpszExt, dwLen))
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.326]
|
|
|
|
*
|
|
|
|
* Delete a file extension from a MIME content type.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpszType [I] Content type to delete the extension for
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. The file extension is deleted from the registry.
|
|
|
|
* Failure: FALSE. The extension may have been removed but the key remains.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* If deleting the extension leaves an orphan key, the key is removed also.
|
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI UnregisterExtensionForMIMETypeA(LPCSTR lpszType)
|
2002-09-06 19:35:08 +00:00
|
|
|
{
|
|
|
|
char szKey[MAX_PATH];
|
|
|
|
|
|
|
|
TRACE("(%s)\n", debugstr_a(lpszType));
|
|
|
|
|
2003-09-11 02:56:15 +00:00
|
|
|
if (!GetMIMETypeSubKeyA(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
|
2002-09-06 19:35:08 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!SHDeleteValueA(HKEY_CLASSES_ROOT, szKey, szExtensionA))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!SHDeleteOrphanKeyA(HKEY_CLASSES_ROOT, szKey))
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* @ [SHLWAPI.327]
|
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of UnregisterExtensionForMIMETypeA.
|
2002-09-06 19:35:08 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
BOOL WINAPI UnregisterExtensionForMIMETypeW(LPCWSTR lpszType)
|
2002-09-06 19:35:08 +00:00
|
|
|
{
|
|
|
|
WCHAR szKey[MAX_PATH];
|
|
|
|
|
|
|
|
TRACE("(%s)\n", debugstr_w(lpszType));
|
|
|
|
|
2003-09-11 02:56:15 +00:00
|
|
|
if (!GetMIMETypeSubKeyW(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
|
2002-09-06 19:35:08 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!SHDeleteValueW(HKEY_CLASSES_ROOT, szKey, szExtensionW))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!SHDeleteOrphanKeyW(HKEY_CLASSES_ROOT, szKey))
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2001-12-01 00:37:12 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegDuplicateHKey [SHLWAPI.@]
|
2003-03-18 18:35:48 +00:00
|
|
|
*
|
|
|
|
* Create a duplicate of a registry handle.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] key to duplicate.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* A new handle pointing to the same key as hKey.
|
2001-12-01 00:37:12 +00:00
|
|
|
*/
|
|
|
|
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
|
|
|
|
{
|
|
|
|
HKEY newKey = 0;
|
|
|
|
|
|
|
|
RegOpenKeyExA(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey);
|
2002-10-25 03:12:32 +00:00
|
|
|
TRACE("new key is %p\n", newKey);
|
2001-12-01 00:37:12 +00:00
|
|
|
return newKey;
|
|
|
|
}
|
2002-09-12 18:02:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHCopyKeyA [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* Copy a key and its values/sub keys to another location.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKeySrc [I] Source key to copy from
|
2005-03-21 10:50:55 +00:00
|
|
|
* lpszSrcSubKey [I] Sub key under hKeySrc, or NULL to use hKeySrc directly
|
2005-01-17 15:33:00 +00:00
|
|
|
* hKeyDst [I] Destination key
|
2002-09-12 18:02:14 +00:00
|
|
|
* dwReserved [I] Reserved, must be 0
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS. The key is copied to the destination key.
|
|
|
|
* Failure: A standard windows error code.
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* If hKeyDst is a key under hKeySrc, this function will misbehave
|
2003-03-18 18:35:48 +00:00
|
|
|
* (It will loop until out of stack, or the registry is full). This
|
|
|
|
* bug is present in Win32 also.
|
2002-09-12 18:02:14 +00:00
|
|
|
*/
|
2005-03-21 10:50:55 +00:00
|
|
|
DWORD WINAPI SHCopyKeyA(HKEY hKeySrc, LPCSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
|
2002-09-12 18:02:14 +00:00
|
|
|
{
|
|
|
|
WCHAR szSubKeyW[MAX_PATH];
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("(hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_a(lpszSrcSubKey), hKeyDst, dwReserved);
|
2002-09-12 18:02:14 +00:00
|
|
|
|
2005-03-21 10:50:55 +00:00
|
|
|
if (lpszSrcSubKey)
|
2012-09-24 11:04:26 +00:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH);
|
2002-09-12 18:02:14 +00:00
|
|
|
|
2005-03-21 10:50:55 +00:00
|
|
|
return SHCopyKeyW(hKeySrc, lpszSrcSubKey ? szSubKeyW : NULL, hKeyDst, dwReserved);
|
2002-09-12 18:02:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHCopyKeyW [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* See SHCopyKeyA.
|
|
|
|
*/
|
2005-03-21 10:50:55 +00:00
|
|
|
DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
|
2002-09-12 18:02:14 +00:00
|
|
|
{
|
|
|
|
DWORD dwKeyCount = 0, dwValueCount = 0, dwMaxKeyLen = 0;
|
|
|
|
DWORD dwMaxValueLen = 0, dwMaxDataLen = 0, i;
|
|
|
|
BYTE buff[1024];
|
2009-01-22 08:52:44 +00:00
|
|
|
LPVOID lpBuff = buff;
|
2002-09-12 18:02:14 +00:00
|
|
|
WCHAR szName[MAX_PATH], *lpszName = szName;
|
|
|
|
DWORD dwRet = S_OK;
|
|
|
|
|
2006-10-06 10:43:28 +00:00
|
|
|
TRACE("hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_w(lpszSrcSubKey), hKeyDst, dwReserved);
|
2002-09-12 18:02:14 +00:00
|
|
|
|
|
|
|
if(!hKeyDst || !hKeySrc)
|
|
|
|
dwRet = ERROR_INVALID_PARAMETER;
|
|
|
|
else
|
|
|
|
{
|
2005-03-21 10:50:55 +00:00
|
|
|
/* Open source key */
|
|
|
|
if(lpszSrcSubKey)
|
|
|
|
dwRet = RegOpenKeyExW(hKeySrc, lpszSrcSubKey, 0, KEY_ALL_ACCESS, &hKeySrc);
|
2002-09-12 18:02:14 +00:00
|
|
|
|
|
|
|
if(dwRet)
|
2005-03-21 10:50:55 +00:00
|
|
|
hKeyDst = NULL; /* Don't close this key since we didn't open it */
|
2002-09-12 18:02:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Get details about sub keys and values */
|
|
|
|
dwRet = RegQueryInfoKeyW(hKeySrc, NULL, NULL, NULL, &dwKeyCount, &dwMaxKeyLen,
|
|
|
|
NULL, &dwValueCount, &dwMaxValueLen, &dwMaxDataLen,
|
|
|
|
NULL, NULL);
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
if (dwMaxValueLen > dwMaxKeyLen)
|
|
|
|
dwMaxKeyLen = dwMaxValueLen; /* Get max size for key/value names */
|
|
|
|
|
|
|
|
if (dwMaxKeyLen++ > MAX_PATH - 1)
|
|
|
|
lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxKeyLen * sizeof(WCHAR));
|
|
|
|
|
|
|
|
if (dwMaxDataLen > sizeof(buff))
|
|
|
|
lpBuff = HeapAlloc(GetProcessHeap(), 0, dwMaxDataLen);
|
|
|
|
|
|
|
|
if (!lpszName || !lpBuff)
|
|
|
|
dwRet = ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy all the sub keys */
|
|
|
|
for(i = 0; i < dwKeyCount && !dwRet; i++)
|
|
|
|
{
|
|
|
|
HKEY hSubKeySrc, hSubKeyDst;
|
|
|
|
DWORD dwSize = dwMaxKeyLen;
|
|
|
|
|
|
|
|
dwRet = RegEnumKeyExW(hKeySrc, i, lpszName, &dwSize, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Open source sub key */
|
|
|
|
dwRet = RegOpenKeyExW(hKeySrc, lpszName, 0, KEY_READ, &hSubKeySrc);
|
|
|
|
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Create destination sub key */
|
|
|
|
dwRet = RegCreateKeyW(hKeyDst, lpszName, &hSubKeyDst);
|
|
|
|
|
|
|
|
if(!dwRet)
|
|
|
|
{
|
|
|
|
/* Recursively copy keys and values from the sub key */
|
2005-01-17 15:33:00 +00:00
|
|
|
dwRet = SHCopyKeyW(hSubKeySrc, NULL, hSubKeyDst, 0);
|
2002-09-12 18:02:14 +00:00
|
|
|
RegCloseKey(hSubKeyDst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey(hSubKeySrc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy all the values in this key */
|
|
|
|
for (i = 0; i < dwValueCount && !dwRet; i++)
|
|
|
|
{
|
|
|
|
DWORD dwNameSize = dwMaxKeyLen, dwType, dwLen = dwMaxDataLen;
|
|
|
|
|
2006-01-17 12:34:52 +00:00
|
|
|
dwRet = RegEnumValueW(hKeySrc, i, lpszName, &dwNameSize, NULL, &dwType, lpBuff, &dwLen);
|
2002-09-12 18:02:14 +00:00
|
|
|
|
|
|
|
if (!dwRet)
|
|
|
|
dwRet = SHSetValueW(hKeyDst, NULL, lpszName, dwType, lpBuff, dwLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free buffers if allocated */
|
|
|
|
if (lpszName != szName)
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpszName);
|
|
|
|
if (lpBuff != buff)
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpBuff);
|
|
|
|
|
2005-03-21 10:50:55 +00:00
|
|
|
if (lpszSrcSubKey && hKeyDst)
|
2002-09-12 18:02:14 +00:00
|
|
|
RegCloseKey(hKeyDst);
|
|
|
|
return dwRet;
|
|
|
|
}
|
2003-07-22 00:58:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The following functions are ORDINAL ONLY:
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*************************************************************************
|
2003-09-11 02:56:15 +00:00
|
|
|
* @ [SHLWAPI.280]
|
2003-07-22 00:58:09 +00:00
|
|
|
*
|
|
|
|
* Read an integer value from the registry, falling back to a default.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hKey [I] Registry key to read from
|
|
|
|
* lpszValue [I] Value name to read
|
|
|
|
* iDefault [I] Default value to return
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* The value contained in the given registry value if present, otherwise
|
|
|
|
* iDefault.
|
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
int WINAPI SHRegGetIntW(HKEY hKey, LPCWSTR lpszValue, int iDefault)
|
2003-07-22 00:58:09 +00:00
|
|
|
{
|
2004-01-27 00:01:43 +00:00
|
|
|
TRACE("(%p,%s,%d)\n", hKey, debugstr_w(lpszValue), iDefault);
|
2003-07-22 00:58:09 +00:00
|
|
|
|
|
|
|
if (hKey)
|
|
|
|
{
|
|
|
|
WCHAR szBuff[32];
|
|
|
|
DWORD dwSize = sizeof(szBuff);
|
|
|
|
szBuff[0] = '\0';
|
|
|
|
SHQueryValueExW(hKey, lpszValue, 0, 0, szBuff, &dwSize);
|
|
|
|
|
|
|
|
if(*szBuff >= '0' && *szBuff <= '9')
|
|
|
|
return StrToIntW(szBuff);
|
|
|
|
}
|
|
|
|
return iDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2003-09-11 02:56:15 +00:00
|
|
|
* @ [SHLWAPI.343]
|
2003-07-22 00:58:09 +00:00
|
|
|
*
|
|
|
|
* Create or open an explorer ClassId Key.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* guid [I] Explorer ClassId key to open
|
|
|
|
* lpszValue [I] Value name under the ClassId Key
|
|
|
|
* bUseHKCU [I] TRUE=Use HKEY_CURRENT_USER, FALSE=Use HKEY_CLASSES_ROOT
|
|
|
|
* bCreate [I] TRUE=Create the key if it doesn't exist, FALSE=Don't
|
|
|
|
* phKey [O] Destination for the resulting key handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: S_OK. phKey contains the resulting registry handle.
|
|
|
|
* Failure: An HRESULT error code indicating the problem.
|
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
HRESULT WINAPI SHRegGetCLSIDKeyA(REFGUID guid, LPCSTR lpszValue, BOOL bUseHKCU, BOOL bCreate, PHKEY phKey)
|
2003-07-22 00:58:09 +00:00
|
|
|
{
|
|
|
|
WCHAR szValue[MAX_PATH];
|
|
|
|
|
|
|
|
if (lpszValue)
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, sizeof(szValue)/sizeof(WCHAR));
|
|
|
|
|
2003-09-11 02:56:15 +00:00
|
|
|
return SHRegGetCLSIDKeyW(guid, lpszValue ? szValue : NULL, bUseHKCU, bCreate, phKey);
|
2003-07-22 00:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2003-09-11 02:56:15 +00:00
|
|
|
* @ [SHLWAPI.344]
|
2003-07-22 00:58:09 +00:00
|
|
|
*
|
2003-09-11 02:56:15 +00:00
|
|
|
* Unicode version of SHRegGetCLSIDKeyA.
|
2003-07-22 00:58:09 +00:00
|
|
|
*/
|
2003-09-11 02:56:15 +00:00
|
|
|
HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID guid, LPCWSTR lpszValue, BOOL bUseHKCU,
|
2003-07-22 00:58:09 +00:00
|
|
|
BOOL bCreate, PHKEY phKey)
|
|
|
|
{
|
|
|
|
static const WCHAR szClassIdKey[] = { 'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'E','x','p','l','o','r','e','r','\\','C','L','S','I','D','\\' };
|
|
|
|
#define szClassIdKeyLen (sizeof(szClassIdKey)/sizeof(WCHAR))
|
|
|
|
WCHAR szKey[MAX_PATH];
|
|
|
|
DWORD dwRet;
|
|
|
|
HKEY hkey;
|
|
|
|
|
|
|
|
/* Create the key string */
|
|
|
|
memcpy(szKey, szClassIdKey, sizeof(szClassIdKey));
|
2003-09-11 02:56:15 +00:00
|
|
|
SHStringFromGUIDW(guid, szKey + szClassIdKeyLen, 39); /* Append guid */
|
2003-07-22 00:58:09 +00:00
|
|
|
|
|
|
|
if(lpszValue)
|
|
|
|
{
|
|
|
|
szKey[szClassIdKeyLen + 39] = '\\';
|
|
|
|
strcpyW(szKey + szClassIdKeyLen + 40, lpszValue); /* Append value name */
|
|
|
|
}
|
|
|
|
|
|
|
|
hkey = bUseHKCU ? HKEY_CURRENT_USER : HKEY_CLASSES_ROOT;
|
|
|
|
|
|
|
|
if(bCreate)
|
|
|
|
dwRet = RegCreateKeyW(hkey, szKey, phKey);
|
|
|
|
else
|
|
|
|
dwRet = RegOpenKeyExW(hkey, szKey, 0, KEY_READ, phKey);
|
|
|
|
|
|
|
|
return dwRet ? HRESULT_FROM_WIN32(dwRet) : S_OK;
|
|
|
|
}
|
2004-01-18 22:07:57 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegisterValidateTemplate [SHLWAPI.@]
|
|
|
|
*
|
|
|
|
* observed from the ie 5.5 installer:
|
|
|
|
* - allocates a buffer with the size of the given file
|
|
|
|
* - read the file content into the buffer
|
|
|
|
* - creates the key szTemplateKey
|
|
|
|
* - sets "205523652929647911071668590831910975402"=dword:00002e37 at
|
|
|
|
* the key
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* filename [I] An existing file its content is read into an allocated
|
|
|
|
* buffer
|
|
|
|
* unknown [I]
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegisterValidateTemplate(LPCWSTR filename, BOOL unknown)
|
|
|
|
{
|
|
|
|
/* static const WCHAR szTemplateKey[] = { 'S','o','f','t','w','a','r','e','\\',
|
|
|
|
* 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
|
|
|
|
* 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
* 'E','x','p','l','o','r','e','r','\\',
|
|
|
|
* 'T','e','m','p','l','a','t','e','R','e','g','i','s','t','r','y',0 };
|
|
|
|
*/
|
|
|
|
FIXME("stub: %s, %08x\n", debugstr_w(filename), unknown);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|