ReactOS  0.4.14-dev-50-g13bb5e2
reg.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winreg.h"
#include "wine/debug.h"
#include "shlwapi.h"
#include "wine/unicode.h"
Include dependency graph for reg.c:

Go to the source code of this file.

Classes

struct  SHUSKEY
 

Macros

#define NO_SHLWAPI_STREAM
 
#define REG_HKCU   TRUE
 
#define REG_HKLM   FALSE
 
#define szClassIdKeyLen   (sizeof(szClassIdKey)/sizeof(WCHAR))
 

Typedefs

typedef struct SHUSKEYLPSHUSKEY
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
INT WINAPI SHStringFromGUIDW (REFGUID, LPWSTR, INT)
 
HRESULT WINAPI SHRegGetCLSIDKeyW (REFGUID, LPCWSTR, BOOL, BOOL, PHKEY)
 
static HKEY REG_GetHKEYFromHUSKEY (HUSKEY hUSKey, BOOL which)
 
LONG WINAPI SHRegOpenUSKeyA (LPCSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
 
LONG WINAPI SHRegOpenUSKeyW (LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
 
LONG WINAPI SHRegCloseUSKey (HUSKEY hUSKey)
 
LONG WINAPI SHRegCreateUSKeyA (LPCSTR path, REGSAM samDesired, HUSKEY relative_key, PHUSKEY new_uskey, DWORD flags)
 
LONG WINAPI SHRegCreateUSKeyW (LPCWSTR path, REGSAM samDesired, HUSKEY relative_key, PHUSKEY new_uskey, DWORD flags)
 
LONG WINAPI SHRegDeleteEmptyUSKeyA (HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags)
 
LONG WINAPI SHRegDeleteEmptyUSKeyW (HUSKEY hUSKey, LPCWSTR pszValue, SHREGDEL_FLAGS delRegFlags)
 
LONG WINAPI SHRegDeleteUSValueA (HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags)
 
LONG WINAPI SHRegDeleteUSValueW (HUSKEY hUSKey, LPCWSTR pszValue, SHREGDEL_FLAGS delRegFlags)
 
LONG WINAPI SHRegEnumUSValueA (HUSKEY hUSKey, DWORD dwIndex, LPSTR pszValueName, LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
 
LONG WINAPI SHRegEnumUSValueW (HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszValueName, LPDWORD pcchValueNameLen, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags)
 
LONG WINAPI SHRegQueryUSValueA (HUSKEY hUSKey, LPCSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
 
LONG WINAPI SHRegQueryUSValueW (HUSKEY hUSKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
 
LONG WINAPI SHRegGetUSValueA (LPCSTR pSubKey, LPCSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
 
LONG WINAPI SHRegGetUSValueW (LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
 
LONG WINAPI SHRegSetUSValueA (LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
 
LONG WINAPI SHRegSetUSValueW (LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
 
BOOL WINAPI SHRegGetBoolUSValueA (LPCSTR pszSubKey, LPCSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault)
 
BOOL WINAPI SHRegGetBoolUSValueW (LPCWSTR pszSubKey, LPCWSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault)
 
LONG WINAPI SHRegQueryInfoUSKeyA (HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags)
 
LONG WINAPI SHRegQueryInfoUSKeyW (HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags)
 
LONG WINAPI SHRegEnumUSKeyA (HUSKEY hUSKey, DWORD dwIndex, LPSTR pszName, LPDWORD pcchValueNameLen, SHREGENUM_FLAGS enumRegFlags)
 
LONG WINAPI SHRegEnumUSKeyW (HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszName, LPDWORD pcchValueNameLen, SHREGENUM_FLAGS enumRegFlags)
 
LONG WINAPI SHRegWriteUSValueA (HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
 
LONG WINAPI SHRegWriteUSValueW (HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
 
DWORD WINAPI SHRegGetPathA (HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPSTR lpszPath, DWORD dwFlags)
 
DWORD WINAPI SHRegGetPathW (HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPWSTR lpszPath, DWORD dwFlags)
 
DWORD WINAPI SHRegSetPathA (HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPCSTR lpszPath, DWORD dwFlags)
 
DWORD WINAPI SHRegSetPathW (HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPCWSTR lpszPath, DWORD dwFlags)
 
DWORD WINAPI SHGetValueA (HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 
DWORD WINAPI SHGetValueW (HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 
DWORD WINAPI SHSetValueA (HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
 
DWORD WINAPI SHSetValueW (HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
 
LONG WINAPI SHQueryInfoKeyA (HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax, LPDWORD pwValues, LPDWORD pwValueMax)
 
LONG WINAPI SHQueryInfoKeyW (HKEY hKey, LPDWORD pwSubKeys, LPDWORD pwSubKeyMax, LPDWORD pwValues, LPDWORD pwValueMax)
 
DWORD WINAPI SHQueryValueExA (HKEY hKey, LPCSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 
DWORD WINAPI SHQueryValueExW (HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 
DWORD WINAPI SHDeleteKeyA (HKEY hKey, LPCSTR lpszSubKey)
 
DWORD WINAPI SHDeleteKeyW (HKEY hKey, LPCWSTR lpszSubKey)
 
DWORD WINAPI SHDeleteEmptyKeyA (HKEY hKey, LPCSTR lpszSubKey)
 
DWORD WINAPI SHDeleteEmptyKeyW (HKEY hKey, LPCWSTR lpszSubKey)
 
DWORD WINAPI SHDeleteOrphanKeyA (HKEY hKey, LPCSTR lpszSubKey)
 
DWORD WINAPI SHDeleteOrphanKeyW (HKEY hKey, LPCWSTR lpszSubKey)
 
DWORD WINAPI SHDeleteValueA (HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue)
 
DWORD WINAPI SHDeleteValueW (HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
 
LONG WINAPI SHEnumKeyExA (HKEY hKey, DWORD dwIndex, LPSTR lpszSubKey, LPDWORD pwLen)
 
LONG WINAPI SHEnumKeyExW (HKEY hKey, DWORD dwIndex, LPWSTR lpszSubKey, LPDWORD pwLen)
 
LONG WINAPI SHEnumValueA (HKEY hKey, DWORD dwIndex, LPSTR lpszValue, LPDWORD pwLen, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 
LONG WINAPI SHEnumValueW (HKEY hKey, DWORD dwIndex, LPWSTR lpszValue, LPDWORD pwLen, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
 
DWORD WINAPI SHGetValueGoodBootA (HKEY hkey, LPCSTR pSubKey, LPCSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
 
DWORD WINAPI SHGetValueGoodBootW (HKEY hkey, LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pbData)
 
BOOL WINAPI RegisterMIMETypeForExtensionA (LPCSTR lpszSubKey, LPCSTR lpszValue)
 
BOOL WINAPI RegisterMIMETypeForExtensionW (LPCWSTR lpszSubKey, LPCWSTR lpszValue)
 
BOOL WINAPI UnregisterMIMETypeForExtensionA (LPCSTR lpszSubKey)
 
BOOL WINAPI UnregisterMIMETypeForExtensionW (LPCWSTR lpszSubKey)
 
BOOL WINAPI GetMIMETypeSubKeyA (LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
 
BOOL WINAPI GetMIMETypeSubKeyW (LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
 
BOOL WINAPI MIME_GetExtensionA (LPCSTR lpszType, LPSTR lpExt, INT iLen)
 
BOOL WINAPI MIME_GetExtensionW (LPCWSTR lpszType, LPWSTR lpExt, INT iLen)
 
BOOL WINAPI RegisterExtensionForMIMETypeA (LPCSTR lpszExt, LPCSTR lpszType)
 
BOOL WINAPI RegisterExtensionForMIMETypeW (LPCWSTR lpszExt, LPCWSTR lpszType)
 
BOOL WINAPI UnregisterExtensionForMIMETypeA (LPCSTR lpszType)
 
BOOL WINAPI UnregisterExtensionForMIMETypeW (LPCWSTR lpszType)
 
HKEY WINAPI SHRegDuplicateHKey (HKEY hKey)
 
DWORD WINAPI SHCopyKeyA (HKEY hKeySrc, LPCSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
 
DWORD WINAPI SHCopyKeyW (HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
 
int WINAPI SHRegGetIntW (HKEY hKey, LPCWSTR lpszValue, int iDefault)
 
HRESULT WINAPI SHRegGetCLSIDKeyA (REFGUID guid, LPCSTR lpszValue, BOOL bUseHKCU, BOOL bCreate, PHKEY phKey)
 
HRESULT WINAPI SHRegisterValidateTemplate (LPCWSTR filename, BOOL unknown)
 

Variables

static const char lpszContentTypeA [] = "Content Type"
 
static const WCHAR lpszContentTypeW [] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0'}
 
static const char szMimeDbContentA [] = "MIME\\Database\\Content Type\\"
 
static const WCHAR szMimeDbContentW []
 
static const DWORD dwLenMimeDbContent = 27
 
static const char szExtensionA [] = "Extension"
 
static const WCHAR szExtensionW [] = { 'E', 'x', 't','e','n','s','i','o','n','\0' }
 

Macro Definition Documentation

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 29 of file reg.c.

◆ REG_HKCU

#define REG_HKCU   TRUE

Definition at line 61 of file reg.c.

◆ REG_HKLM

#define REG_HKLM   FALSE

Definition at line 62 of file reg.c.

◆ szClassIdKeyLen

#define szClassIdKeyLen   (sizeof(szClassIdKey)/sizeof(WCHAR))

Typedef Documentation

◆ LPSHUSKEY

Function Documentation

◆ GetMIMETypeSubKeyA()

BOOL WINAPI GetMIMETypeSubKeyA ( LPCSTR  lpszType,
LPSTR  lpszBuffer,
DWORD  dwLen 
)

Definition at line 1984 of file reg.c.

1985 {
1986  TRACE("(%s,%p,%d)\n", debugstr_a(lpszType), lpszBuffer, dwLen);
1987 
1988  if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer)
1989  {
1990  size_t dwStrLen = strlen(lpszType);
1991 
1992  if (dwStrLen < dwLen - dwLenMimeDbContent)
1993  {
1995  memcpy(lpszBuffer + dwLenMimeDbContent, lpszType, dwStrLen + 1);
1996  return TRUE;
1997  }
1998  }
1999  return FALSE;
2000 }
#define TRUE
Definition: types.h:120
static const DWORD dwLenMimeDbContent
Definition: reg.c:43
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const char szMimeDbContentA[]
Definition: reg.c:39

Referenced by MIME_GetExtensionA(), RegisterExtensionForMIMETypeA(), and UnregisterExtensionForMIMETypeA().

◆ GetMIMETypeSubKeyW()

BOOL WINAPI GetMIMETypeSubKeyW ( LPCWSTR  lpszType,
LPWSTR  lpszBuffer,
DWORD  dwLen 
)

Definition at line 2007 of file reg.c.

2008 {
2009  TRACE("(%s,%p,%d)\n", debugstr_w(lpszType), lpszBuffer, dwLen);
2010 
2011  if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer)
2012  {
2013  DWORD dwStrLen = strlenW(lpszType);
2014 
2015  if (dwStrLen < dwLen - dwLenMimeDbContent)
2016  {
2017  memcpy(lpszBuffer, szMimeDbContentW, dwLenMimeDbContent * sizeof(WCHAR));
2018  memcpy(lpszBuffer + dwLenMimeDbContent, lpszType, (dwStrLen + 1) * sizeof(WCHAR));
2019  return TRUE;
2020  }
2021  }
2022  return FALSE;
2023 }
static const WCHAR szMimeDbContentW[]
Definition: reg.c:40
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static const DWORD dwLenMimeDbContent
Definition: reg.c:43
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by MIME_GetExtensionW(), RegisterExtensionForMIMETypeW(), and UnregisterExtensionForMIMETypeW().

◆ MIME_GetExtensionA()

BOOL WINAPI MIME_GetExtensionA ( LPCSTR  lpszType,
LPSTR  lpExt,
INT  iLen 
)

Definition at line 2045 of file reg.c.

2046 {
2047  char szSubKey[MAX_PATH];
2048  DWORD dwlen = iLen - 1, dwType;
2049  BOOL bRet = FALSE;
2050 
2051  if (iLen > 0 && lpExt)
2052  *lpExt = '\0';
2053 
2054  if (lpszType && lpExt && iLen > 2 &&
2055  GetMIMETypeSubKeyA(lpszType, szSubKey, MAX_PATH) &&
2056  !SHGetValueA(HKEY_CLASSES_ROOT, szSubKey, szExtensionA, &dwType, lpExt + 1, &dwlen) &&
2057  lpExt[1])
2058  {
2059  if (lpExt[1] == '.')
2060  memmove(lpExt, lpExt + 1, strlen(lpExt + 1) + 1);
2061  else
2062  *lpExt = '.'; /* Supply a '.' */
2063  bRet = TRUE;
2064  }
2065  return bRet;
2066 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:1984
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1207
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static const char szExtensionA[]
Definition: reg.c:45

◆ MIME_GetExtensionW()

BOOL WINAPI MIME_GetExtensionW ( LPCWSTR  lpszType,
LPWSTR  lpExt,
INT  iLen 
)

Definition at line 2073 of file reg.c.

2074 {
2075  WCHAR szSubKey[MAX_PATH];
2076  DWORD dwlen = iLen - 1, dwType;
2077  BOOL bRet = FALSE;
2078 
2079  if (iLen > 0 && lpExt)
2080  *lpExt = '\0';
2081 
2082  if (lpszType && lpExt && iLen > 2 &&
2083  GetMIMETypeSubKeyW(lpszType, szSubKey, MAX_PATH) &&
2084  !SHGetValueW(HKEY_CLASSES_ROOT, szSubKey, szExtensionW, &dwType, lpExt + 1, &dwlen) &&
2085  lpExt[1])
2086  {
2087  if (lpExt[1] == '.')
2088  memmove(lpExt, lpExt + 1, (strlenW(lpExt + 1) + 1) * sizeof(WCHAR));
2089  else
2090  *lpExt = '.'; /* Supply a '.' */
2091  bRet = TRUE;
2092  }
2093  return bRet;
2094 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static const WCHAR szExtensionW[]
Definition: reg.c:46
unsigned int BOOL
Definition: ntddk_ex.h:94
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:2007
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

◆ REG_GetHKEYFromHUSKEY()

static HKEY REG_GetHKEYFromHUSKEY ( HUSKEY  hUSKey,
BOOL  which 
)
static

Definition at line 69 of file reg.c.

70 {
71  HKEY test = hUSKey;
72  LPSHUSKEY mihk = hUSKey;
73 
74  if ((test == HKEY_CLASSES_ROOT) ||
76  (test == HKEY_CURRENT_USER) ||
77  (test == HKEY_DYN_DATA) ||
78  (test == HKEY_LOCAL_MACHINE) ||
80 /* FIXME: need to define for Win2k, ME, XP
81  * (test == HKEY_PERFORMANCE_TEXT) ||
82  * (test == HKEY_PERFORMANCE_NLSTEXT) ||
83  */
84  (test == HKEY_USERS)) return test;
85  if (which == REG_HKCU) return mihk->HKCUkey;
86  return mihk->HKLMkey;
87 }
#define HKEY_USERS
Definition: winreg.h:13
Definition: reg.c:49
static GLenum which
Definition: wgl_font.c:159
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define test
Definition: rosglue.h:37
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
HKEY HKLMkey
Definition: reg.c:53
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14
HKEY HKCUkey
Definition: reg.c:51
#define REG_HKCU
Definition: reg.c:61
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by SHRegCreateUSKeyW(), SHRegEnumUSKeyA(), SHRegEnumUSKeyW(), SHRegEnumUSValueA(), SHRegEnumUSValueW(), SHRegOpenUSKeyW(), SHRegQueryInfoUSKeyA(), SHRegQueryInfoUSKeyW(), SHRegQueryUSValueA(), and SHRegQueryUSValueW().

◆ RegisterExtensionForMIMETypeA()

BOOL WINAPI RegisterExtensionForMIMETypeA ( LPCSTR  lpszExt,
LPCSTR  lpszType 
)

Definition at line 2109 of file reg.c.

2110 {
2111  DWORD dwLen;
2112  char szKey[MAX_PATH];
2113 
2114  TRACE("(%s,%s)\n", debugstr_a(lpszExt), debugstr_a(lpszType));
2115 
2116  if (!GetMIMETypeSubKeyA(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2117  return FALSE;
2118 
2119  dwLen = strlen(lpszExt) + 1;
2120 
2121  if (SHSetValueA(HKEY_CLASSES_ROOT, szKey, szExtensionA, REG_SZ, lpszExt, dwLen))
2122  return FALSE;
2123  return TRUE;
2124 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1278
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:1984
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static const char szExtensionA[]
Definition: reg.c:45
#define REG_SZ
Definition: layer.c:22

◆ RegisterExtensionForMIMETypeW()

BOOL WINAPI RegisterExtensionForMIMETypeW ( LPCWSTR  lpszExt,
LPCWSTR  lpszType 
)

Definition at line 2131 of file reg.c.

2132 {
2133  DWORD dwLen;
2134  WCHAR szKey[MAX_PATH];
2135 
2136  TRACE("(%s,%s)\n", debugstr_w(lpszExt), debugstr_w(lpszType));
2137 
2138  /* Get the full path to the key */
2139  if (!GetMIMETypeSubKeyW(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2140  return FALSE;
2141 
2142  dwLen = (lstrlenW(lpszExt) + 1) * sizeof(WCHAR);
2143 
2144  if (SHSetValueW(HKEY_CLASSES_ROOT, szKey, szExtensionW, REG_SZ, lpszExt, dwLen))
2145  return FALSE;
2146  return TRUE;
2147 }
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define TRUE
Definition: types.h:120
static const WCHAR szExtensionW[]
Definition: reg.c:46
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:2007
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_SZ
Definition: layer.c:22

◆ RegisterMIMETypeForExtensionA()

BOOL WINAPI RegisterMIMETypeForExtensionA ( LPCSTR  lpszSubKey,
LPCSTR  lpszValue 
)

Definition at line 1911 of file reg.c.

1912 {
1913  if (!lpszValue)
1914  {
1915  WARN("Invalid lpszValue would crash under Win32!\n");
1916  return FALSE;
1917  }
1918 
1919  return !SHSetValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA,
1920  REG_SZ, lpszValue, strlen(lpszValue));
1921 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1278
static const char lpszContentTypeA[]
Definition: reg.c:36
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_SZ
Definition: layer.c:22

◆ RegisterMIMETypeForExtensionW()

BOOL WINAPI RegisterMIMETypeForExtensionW ( LPCWSTR  lpszSubKey,
LPCWSTR  lpszValue 
)

Definition at line 1928 of file reg.c.

1929 {
1930  if (!lpszValue)
1931  {
1932  WARN("Invalid lpszValue would crash under Win32!\n");
1933  return FALSE;
1934  }
1935 
1936  return !SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW,
1937  REG_SZ, lpszValue, strlenW(lpszValue));
1938 }
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define WARN(fmt,...)
Definition: debug.h:111
static const WCHAR lpszContentTypeW[]
Definition: reg.c:37
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_SZ
Definition: layer.c:22

◆ SHCopyKeyA()

DWORD WINAPI SHCopyKeyA ( HKEY  hKeySrc,
LPCSTR  lpszSrcSubKey,
HKEY  hKeyDst,
DWORD  dwReserved 
)

Definition at line 2244 of file reg.c.

2245 {
2246  WCHAR szSubKeyW[MAX_PATH];
2247 
2248  TRACE("(hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_a(lpszSrcSubKey), hKeyDst, dwReserved);
2249 
2250  if (lpszSrcSubKey)
2251  MultiByteToWideChar(CP_ACP, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH);
2252 
2253  return SHCopyKeyW(hKeySrc, lpszSrcSubKey ? szSubKeyW : NULL, hKeyDst, dwReserved);
2254 }
DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
Definition: reg.c:2261
#define CP_ACP
Definition: compat.h:99
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
#define MultiByteToWideChar
Definition: compat.h:100

◆ SHCopyKeyW()

DWORD WINAPI SHCopyKeyW ( HKEY  hKeySrc,
LPCWSTR  lpszSrcSubKey,
HKEY  hKeyDst,
DWORD  dwReserved 
)

Definition at line 2261 of file reg.c.

2262 {
2263  DWORD dwKeyCount = 0, dwValueCount = 0, dwMaxKeyLen = 0;
2264  DWORD dwMaxValueLen = 0, dwMaxDataLen = 0, i;
2265  BYTE buff[1024];
2266  LPVOID lpBuff = buff;
2267  WCHAR szName[MAX_PATH], *lpszName = szName;
2268  DWORD dwRet = S_OK;
2269 
2270  TRACE("hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_w(lpszSrcSubKey), hKeyDst, dwReserved);
2271 
2272  if(!hKeyDst || !hKeySrc)
2273  dwRet = ERROR_INVALID_PARAMETER;
2274  else
2275  {
2276  /* Open source key */
2277  if(lpszSrcSubKey)
2278  dwRet = RegOpenKeyExW(hKeySrc, lpszSrcSubKey, 0, KEY_ALL_ACCESS, &hKeySrc);
2279 
2280  if(dwRet)
2281  hKeyDst = NULL; /* Don't close this key since we didn't open it */
2282  else
2283  {
2284  /* Get details about sub keys and values */
2285  dwRet = RegQueryInfoKeyW(hKeySrc, NULL, NULL, NULL, &dwKeyCount, &dwMaxKeyLen,
2286  NULL, &dwValueCount, &dwMaxValueLen, &dwMaxDataLen,
2287  NULL, NULL);
2288  if(!dwRet)
2289  {
2290  if (dwMaxValueLen > dwMaxKeyLen)
2291  dwMaxKeyLen = dwMaxValueLen; /* Get max size for key/value names */
2292 
2293  if (dwMaxKeyLen++ > MAX_PATH - 1)
2294  lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxKeyLen * sizeof(WCHAR));
2295 
2296  if (dwMaxDataLen > sizeof(buff))
2297  lpBuff = HeapAlloc(GetProcessHeap(), 0, dwMaxDataLen);
2298 
2299  if (!lpszName || !lpBuff)
2300  dwRet = ERROR_NOT_ENOUGH_MEMORY;
2301  }
2302  }
2303  }
2304 
2305  /* Copy all the sub keys */
2306  for(i = 0; i < dwKeyCount && !dwRet; i++)
2307  {
2308  HKEY hSubKeySrc, hSubKeyDst;
2309  DWORD dwSize = dwMaxKeyLen;
2310 
2311  dwRet = RegEnumKeyExW(hKeySrc, i, lpszName, &dwSize, NULL, NULL, NULL, NULL);
2312 
2313  if(!dwRet)
2314  {
2315  /* Open source sub key */
2316  dwRet = RegOpenKeyExW(hKeySrc, lpszName, 0, KEY_READ, &hSubKeySrc);
2317 
2318  if(!dwRet)
2319  {
2320  /* Create destination sub key */
2321  dwRet = RegCreateKeyW(hKeyDst, lpszName, &hSubKeyDst);
2322 
2323  if(!dwRet)
2324  {
2325  /* Recursively copy keys and values from the sub key */
2326  dwRet = SHCopyKeyW(hSubKeySrc, NULL, hSubKeyDst, 0);
2327  RegCloseKey(hSubKeyDst);
2328  }
2329  }
2330  RegCloseKey(hSubKeySrc);
2331  }
2332  }
2333 
2334  /* Copy all the values in this key */
2335  for (i = 0; i < dwValueCount && !dwRet; i++)
2336  {
2337  DWORD dwNameSize = dwMaxKeyLen, dwType, dwLen = dwMaxDataLen;
2338 
2339  dwRet = RegEnumValueW(hKeySrc, i, lpszName, &dwNameSize, NULL, &dwType, lpBuff, &dwLen);
2340 
2341  if (!dwRet)
2342  dwRet = SHSetValueW(hKeyDst, NULL, lpszName, dwType, lpBuff, dwLen);
2343  }
2344 
2345  /* Free buffers if allocated */
2346  if (lpszName != szName)
2347  HeapFree(GetProcessHeap(), 0, lpszName);
2348  if (lpBuff != buff)
2349  HeapFree(GetProcessHeap(), 0, lpBuff);
2350 
2351  if (lpszSrcSubKey && hKeyDst)
2352  RegCloseKey(hKeyDst);
2353  return dwRet;
2354 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
Definition: reg.c:2261
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define KEY_READ
Definition: nt_native.h:1023
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define S_OK
Definition: intsafe.h:59
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
static const WCHAR szName[]
Definition: msipriv.h:1194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
static unsigned char buff[32768]
Definition: fatten.c:17
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by COpenWithList::SetDefaultHandler(), and SHCopyKeyA().

◆ SHDeleteEmptyKeyA()

DWORD WINAPI SHDeleteEmptyKeyA ( HKEY  hKey,
LPCSTR  lpszSubKey 
)

Definition at line 1608 of file reg.c.

1609 {
1610  DWORD dwRet, dwKeyCount = 0;
1611  HKEY hSubKey = 0;
1612 
1613  TRACE("(hkey=%p,%s)\n", hKey, debugstr_a(lpszSubKey));
1614 
1615  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1616  if(!dwRet)
1617  {
1618  dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1619  NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1620  RegCloseKey(hSubKey);
1621  if(!dwRet)
1622  {
1623  if (!dwKeyCount)
1624  dwRet = RegDeleteKeyA(hKey, lpszSubKey);
1625  else
1626  dwRet = ERROR_KEY_HAS_CHILDREN;
1627  }
1628  }
1629  return dwRet;
1630 }
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3607
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_KEY_HAS_CHILDREN
Definition: winerror.h:599
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222

◆ SHDeleteEmptyKeyW()

DWORD WINAPI SHDeleteEmptyKeyW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)

Definition at line 1637 of file reg.c.

1638 {
1639  DWORD dwRet, dwKeyCount = 0;
1640  HKEY hSubKey = 0;
1641 
1642  TRACE("(hkey=%p, %s)\n", hKey, debugstr_w(lpszSubKey));
1643 
1644  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1645  if(!dwRet)
1646  {
1647  dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1648  NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1649  RegCloseKey(hSubKey);
1650  if(!dwRet)
1651  {
1652  if (!dwKeyCount)
1653  dwRet = RegDeleteKeyW(hKey, lpszSubKey);
1654  else
1655  dwRet = ERROR_KEY_HAS_CHILDREN;
1656  }
1657  }
1658  return dwRet;
1659 }
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
#define ERROR_KEY_HAS_CHILDREN
Definition: winerror.h:599
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366

◆ SHDeleteKeyA()

DWORD WINAPI SHDeleteKeyA ( HKEY  hKey,
LPCSTR  lpszSubKey 
)

Definition at line 1533 of file reg.c.

1534 {
1535  WCHAR subkeyW[MAX_PATH];
1536 
1537  MultiByteToWideChar (CP_ACP, 0, lpszSubKey, -1, subkeyW, sizeof(subkeyW)/sizeof(WCHAR));
1538  return SHDeleteKeyW(hKey, subkeyW);
1539 }
#define CP_ACP
Definition: compat.h:99
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define MultiByteToWideChar
Definition: compat.h:100
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546

Referenced by delete_key(), test_getstring_no_extra(), test_SHCopyKey(), test_SHDeleteKey(), and testRegStore().

◆ SHDeleteKeyW()

DWORD WINAPI SHDeleteKeyW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)

Definition at line 1546 of file reg.c.

1547 {
1548  DWORD dwRet, dwMaxSubkeyLen = 0, dwSize;
1549  WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1550  HKEY hSubKey = 0;
1551 
1552  TRACE("(hkey=%p,%s)\n", hKey, debugstr_w(lpszSubKey));
1553 
1554  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1555  if(!dwRet)
1556  {
1557  /* Find the maximum subkey length so that we can allocate a buffer */
1558  dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
1559  &dwMaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
1560  if(!dwRet)
1561  {
1562  dwMaxSubkeyLen++;
1563  if (dwMaxSubkeyLen > sizeof(szNameBuf)/sizeof(WCHAR))
1564  /* Name too big: alloc a buffer for it */
1565  lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(WCHAR));
1566 
1567  if(!lpszName)
1568  dwRet = ERROR_NOT_ENOUGH_MEMORY;
1569  else
1570  {
1571  while (dwRet == ERROR_SUCCESS)
1572  {
1573  dwSize = dwMaxSubkeyLen;
1574  dwRet = RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL, NULL, NULL, NULL);
1575  if (dwRet == ERROR_SUCCESS || dwRet == ERROR_MORE_DATA)
1576  dwRet = SHDeleteKeyW(hSubKey, lpszName);
1577  }
1578  if (dwRet == ERROR_NO_MORE_ITEMS)
1579  dwRet = ERROR_SUCCESS;
1580 
1581  if (lpszName != szNameBuf)
1582  HeapFree(GetProcessHeap(), 0, lpszName); /* Free buffer if allocated */
1583  }
1584  }
1585 
1586  RegCloseKey(hSubKey);
1587  if(!dwRet)
1588  dwRet = RegDeleteKeyW(hKey, lpszSubKey);
1589  }
1590  return dwRet;
1591 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
#define ERROR_MORE_DATA
Definition: dderror.h:13
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1546
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by DeleteExt(), EditTypeDlg_WriteClass(), PNP_DeleteClassKey(), and SHDeleteKeyA().

◆ SHDeleteOrphanKeyA()

DWORD WINAPI SHDeleteOrphanKeyA ( HKEY  hKey,
LPCSTR  lpszSubKey 
)

Definition at line 1674 of file reg.c.

1675 {
1676  HKEY hSubKey;
1677  DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
1678 
1679  TRACE("(hkey=%p,%s)\n", hKey, debugstr_a(lpszSubKey));
1680 
1681  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1682 
1683  if(!dwRet)
1684  {
1685  /* Get subkey and value count */
1686  dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1687  NULL, NULL, &dwValueCount, NULL, NULL, NULL, NULL);
1688 
1689  if(!dwRet && !dwKeyCount && !dwValueCount)
1690  {
1691  dwRet = RegDeleteKeyA(hKey, lpszSubKey);
1692  }
1693  RegCloseKey(hSubKey);
1694  }
1695  return dwRet;
1696 }
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3607
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222

Referenced by UnregisterExtensionForMIMETypeA().

◆ SHDeleteOrphanKeyW()

DWORD WINAPI SHDeleteOrphanKeyW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)

Definition at line 1703 of file reg.c.

1704 {
1705  HKEY hSubKey;
1706  DWORD dwKeyCount = 0, dwValueCount = 0, dwRet;
1707 
1708  TRACE("(hkey=%p,%s)\n", hKey, debugstr_w(lpszSubKey));
1709 
1710  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
1711 
1712  if(!dwRet)
1713  {
1714  /* Get subkey and value count */
1715  dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
1716  NULL, NULL, &dwValueCount, NULL, NULL, NULL, NULL);
1717 
1718  if(!dwRet && !dwKeyCount && !dwValueCount)
1719  {
1720  dwRet = RegDeleteKeyW(hKey, lpszSubKey);
1721  }
1722  RegCloseKey(hSubKey);
1723  }
1724  return dwRet;
1725 }
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366

Referenced by UnregisterExtensionForMIMETypeW().

◆ SHDeleteValueA()

DWORD WINAPI SHDeleteValueA ( HKEY  hKey,
LPCSTR  lpszSubKey,
LPCSTR  lpszValue 
)

Definition at line 1741 of file reg.c.

1742 {
1743  DWORD dwRet;
1744  HKEY hSubKey;
1745 
1746  TRACE("(hkey=%p,%s,%s)\n", hKey, debugstr_a(lpszSubKey), debugstr_a(lpszValue));
1747 
1748  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
1749  if (!dwRet)
1750  {
1751  dwRet = RegDeleteValueA(hSubKey, lpszValue);
1752  RegCloseKey(hSubKey);
1753  }
1754  return dwRet;
1755 }
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2319

Referenced by UnregisterExtensionForMIMETypeA(), and UnregisterMIMETypeForExtensionA().

◆ SHDeleteValueW()

DWORD WINAPI SHDeleteValueW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
LPCWSTR  lpszValue 
)

Definition at line 1762 of file reg.c.

1763 {
1764  DWORD dwRet;
1765  HKEY hSubKey;
1766 
1767  TRACE("(hkey=%p,%s,%s)\n", hKey, debugstr_w(lpszSubKey), debugstr_w(lpszValue));
1768 
1769  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_SET_VALUE, &hSubKey);
1770  if (!dwRet)
1771  {
1772  dwRet = RegDeleteValueW(hSubKey, lpszValue);
1773  RegCloseKey(hSubKey);
1774  }
1775  return dwRet;
1776 }
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366

Referenced by UnregisterExtensionForMIMETypeW(), and UnregisterMIMETypeForExtensionW().

◆ SHEnumKeyExA()

LONG WINAPI SHEnumKeyExA ( HKEY  hKey,
DWORD  dwIndex,
LPSTR  lpszSubKey,
LPDWORD  pwLen 
)

Definition at line 1793 of file reg.c.

1795 {
1796  TRACE("(hkey=%p,%d,%s,%p)\n", hKey, dwIndex, debugstr_a(lpszSubKey), pwLen);
1797 
1798  return RegEnumKeyExA(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
1799 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2442

◆ SHEnumKeyExW()

LONG WINAPI SHEnumKeyExW ( HKEY  hKey,
DWORD  dwIndex,
LPWSTR  lpszSubKey,
LPDWORD  pwLen 
)

Definition at line 1806 of file reg.c.

1808 {
1809  TRACE("(hkey=%p,%d,%s,%p)\n", hKey, dwIndex, debugstr_w(lpszSubKey), pwLen);
1810 
1811  return RegEnumKeyExW(hKey, dwIndex, lpszSubKey, pwLen, NULL, NULL, NULL, NULL);
1812 }
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527

◆ SHEnumValueA()

LONG WINAPI SHEnumValueA ( HKEY  hKey,
DWORD  dwIndex,
LPSTR  lpszValue,
LPDWORD  pwLen,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1832 of file reg.c.

1835 {
1836  TRACE("(hkey=%p,%d,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
1837  debugstr_a(lpszValue), pwLen, pwType, pvData, pcbData);
1838 
1839  return RegEnumValueA(hKey, dwIndex, lpszValue, pwLen, NULL,
1840  pwType, pvData, pcbData);
1841 }
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2691
#define debugstr_a
Definition: kernel32.h:31
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953

◆ SHEnumValueW()

LONG WINAPI SHEnumValueW ( HKEY  hKey,
DWORD  dwIndex,
LPWSTR  lpszValue,
LPDWORD  pwLen,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1848 of file reg.c.

1851 {
1852  TRACE("(hkey=%p,%d,%s,%p,%p,%p,%p)\n", hKey, dwIndex,
1853  debugstr_w(lpszValue), pwLen, pwType, pvData, pcbData);
1854 
1855  return RegEnumValueW(hKey, dwIndex, lpszValue, pwLen, NULL,
1856  pwType, pvData, pcbData);
1857 }
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953

◆ SHGetValueA()

DWORD WINAPI SHGetValueA ( HKEY  hKey,
LPCSTR  lpszSubKey,
LPCSTR  lpszValue,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1207 of file reg.c.

1209 {
1210  DWORD dwRet = 0;
1211  HKEY hSubKey = 0;
1212 
1213  TRACE("(hkey=%p,%s,%s,%p,%p,%p)\n", hKey, debugstr_a(lpszSubKey),
1214  debugstr_a(lpszValue), pwType, pvData, pcbData);
1215 
1216  /* lpszSubKey can be 0. In this case the value is taken from the
1217  * current key.
1218  */
1219  if(lpszSubKey)
1220  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
1221 
1222  if (! dwRet)
1223  {
1224  /* SHQueryValueEx expands Environment strings */
1225  dwRet = SHQueryValueExA(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
1226  if (hSubKey) RegCloseKey(hSubKey);
1227  }
1228  return dwRet;
1229 }
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
DWORD WINAPI SHQueryValueExA(HKEY hKey, LPCSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1402
unsigned long DWORD
Definition: ntddk_ex.h:95
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953

Referenced by MIME_GetExtensionA(), PathIsContentTypeA(), SHGetValueGoodBootA(), SHLWAPI_UseSystemForSystemFolders(), SHRegGetPathA(), and test_SHGetValue().

◆ SHGetValueGoodBootA()

DWORD WINAPI SHGetValueGoodBootA ( HKEY  hkey,
LPCSTR  pSubKey,
LPCSTR  pValue,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pbData 
)

Definition at line 1877 of file reg.c.

1879 {
1881  return ERROR_INVALID_FUNCTION;
1882  return SHGetValueA(hkey, pSubKey, pValue, pwType, pvData, pbData);
1883 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define SM_CLEANBOOT
Definition: winuser.h:1017
int WINAPI GetSystemMetrics(_In_ int)
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1207
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

◆ SHGetValueGoodBootW()

DWORD WINAPI SHGetValueGoodBootW ( HKEY  hkey,
LPCWSTR  pSubKey,
LPCWSTR  pValue,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pbData 
)

Definition at line 1890 of file reg.c.

1892 {
1894  return ERROR_INVALID_FUNCTION;
1895  return SHGetValueW(hkey, pSubKey, pValue, pwType, pvData, pbData);
1896 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define SM_CLEANBOOT
Definition: winuser.h:1017
int WINAPI GetSystemMetrics(_In_ int)
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201

◆ SHGetValueW()

DWORD WINAPI SHGetValueW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
LPCWSTR  lpszValue,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1236 of file reg.c.

1238 {
1239  DWORD dwRet = 0;
1240  HKEY hSubKey = 0;
1241 
1242  TRACE("(hkey=%p,%s,%s,%p,%p,%p)\n", hKey, debugstr_w(lpszSubKey),
1243  debugstr_w(lpszValue), pwType, pvData, pcbData);
1244 
1245  if(lpszSubKey)
1246  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
1247 
1248  if (! dwRet)
1249  {
1250  dwRet = SHQueryValueExW(hSubKey ? hSubKey : hKey, lpszValue, 0, pwType, pvData, pcbData);
1251  if (hSubKey) RegCloseKey(hSubKey);
1252  }
1253  return dwRet;
1254 }
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953

Referenced by CRegFolder::GetDisplayNameOf(), HCR_GetExecuteCommandW(), IntGetShellStateSettings(), IntSetShellStateSettings(), TaskbarSettings::Load(), MIME_GetExtensionW(), PathIsContentTypeW(), SHAboutInfoW(), SHCreatePropSheetExtArrayEx(), SHGetRestriction(), SHGetValueGoodBootW(), SHRegGetPathW(), and CDefView::UpdateListColors().

◆ SHQueryInfoKeyA()

LONG WINAPI SHQueryInfoKeyA ( HKEY  hKey,
LPDWORD  pwSubKeys,
LPDWORD  pwSubKeyMax,
LPDWORD  pwValues,
LPDWORD  pwValueMax 
)

Definition at line 1337 of file reg.c.

1339 {
1340  TRACE("(hkey=%p,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
1341  pwValues, pwValueMax);
1342  return RegQueryInfoKeyA(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
1343  NULL, pwValues, pwValueMax, NULL, NULL, NULL);
1344 }
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3607
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

◆ SHQueryInfoKeyW()

LONG WINAPI SHQueryInfoKeyW ( HKEY  hKey,
LPDWORD  pwSubKeys,
LPDWORD  pwSubKeyMax,
LPDWORD  pwValues,
LPDWORD  pwValueMax 
)

Definition at line 1351 of file reg.c.

1353 {
1354  TRACE("(hkey=%p,%p,%p,%p,%p)\n", hKey, pwSubKeys, pwSubKeyMax,
1355  pwValues, pwValueMax);
1356  return RegQueryInfoKeyW(hKey, NULL, NULL, NULL, pwSubKeys, pwSubKeyMax,
1357  NULL, pwValues, pwValueMax, NULL, NULL, NULL);
1358 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686

◆ SHQueryValueExA()

DWORD WINAPI SHQueryValueExA ( HKEY  hKey,
LPCSTR  lpszValue,
LPDWORD  lpReserved,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1402 of file reg.c.

1405 {
1406  DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
1407 
1408  TRACE("(hkey=%p,%s,%p,%p,%p,%p=%d)\n", hKey, debugstr_a(lpszValue),
1409  lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
1410 
1411  if (pcbData) dwUnExpDataLen = *pcbData;
1412 
1413  dwRet = RegQueryValueExA(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
1414 
1415  if (pcbData && (dwType == REG_EXPAND_SZ))
1416  {
1417  DWORD nBytesToAlloc;
1418 
1419  /* Expand type REG_EXPAND_SZ into REG_SZ */
1420  LPSTR szData;
1421 
1422  /* If the caller didn't supply a buffer or the buffer is too small we have
1423  * to allocate our own
1424  */
1425  if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
1426  {
1427  char cNull = '\0';
1428  nBytesToAlloc = dwUnExpDataLen;
1429 
1430  szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1431  RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
1432  dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
1433  dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1434  LocalFree(szData);
1435  }
1436  else
1437  {
1438  nBytesToAlloc = (lstrlenA(pvData)+1) * sizeof (CHAR);
1439  szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1441  dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
1442  if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
1443  dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1444  LocalFree(szData);
1445  }
1446  }
1447 
1448  /* Update the type and data size if the caller wanted them */
1449  if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
1450  if ( pwType ) *pwType = dwType;
1451  if ( pcbData ) *pcbData = dwUnExpDataLen;
1452  return dwRet;
1453 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define max(a, b)
Definition: svc.c:63
char CHAR
Definition: xmlstorage.h:175
static const WCHAR szData[]
Definition: msipriv.h:1195
char * LPSTR
Definition: xmlstorage.h:182
unsigned char * LPBYTE
Definition: typedefs.h:52
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:399
#define TRACE(s)
Definition: solgame.cpp:4
#define LMEM_ZEROINIT
Definition: winbase.h:356
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define ERROR_MORE_DATA
Definition: dderror.h:13
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_SZ
Definition: layer.c:22

Referenced by SHADD_get_policy(), SHGetValueA(), test_SHCopyKey(), and test_SHQueryValueEx().

◆ SHQueryValueExW()

DWORD WINAPI SHQueryValueExW ( HKEY  hKey,
LPCWSTR  lpszValue,
LPDWORD  lpReserved,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1461 of file reg.c.

1464 {
1465  DWORD dwRet, dwType, dwUnExpDataLen = 0, dwExpDataLen;
1466 
1467  TRACE("(hkey=%p,%s,%p,%p,%p,%p=%d)\n", hKey, debugstr_w(lpszValue),
1468  lpReserved, pwType, pvData, pcbData, pcbData ? *pcbData : 0);
1469 
1470  if (pcbData) dwUnExpDataLen = *pcbData;
1471 
1472  dwRet = RegQueryValueExW(hKey, lpszValue, lpReserved, &dwType, pvData, &dwUnExpDataLen);
1473  if (dwRet!=ERROR_SUCCESS && dwRet!=ERROR_MORE_DATA)
1474  return dwRet;
1475 
1476  if (pcbData && (dwType == REG_EXPAND_SZ))
1477  {
1478  DWORD nBytesToAlloc;
1479 
1480  /* Expand type REG_EXPAND_SZ into REG_SZ */
1481  LPWSTR szData;
1482 
1483  /* If the caller didn't supply a buffer or the buffer is too small we have
1484  * to allocate our own
1485  */
1486  if ((!pvData) || (dwRet == ERROR_MORE_DATA) )
1487  {
1488  WCHAR cNull = '\0';
1489  nBytesToAlloc = dwUnExpDataLen;
1490 
1491  szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1492  RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
1493  dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
1494  dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1495  LocalFree(szData);
1496  }
1497  else
1498  {
1499  nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
1500  szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
1502  dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
1503  if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
1504  dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
1505  LocalFree(szData);
1506  }
1507  }
1508 
1509  /* Update the type and data size if the caller wanted them */
1510  if ( dwType == REG_EXPAND_SZ ) dwType = REG_SZ;
1511  if ( pwType ) *pwType = dwType;
1512  if ( pcbData ) *pcbData = dwUnExpDataLen;
1513  return dwRet;
1514 }
#define max(a, b)
Definition: svc.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szData[]
Definition: msipriv.h:1195
#define lstrlenW
Definition: compat.h:407
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define LMEM_ZEROINIT
Definition: winbase.h:356
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define lstrcpyW
Definition: compat.h:406
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_SZ
Definition: layer.c:22

Referenced by CFSExtractIcon_CreateInstance(), SHCoCreateInstance(), SHGetValueW(), SHRegGetIntW(), SKAllocValueW(), and SKGetValueW().

◆ SHRegCloseUSKey()

LONG WINAPI SHRegCloseUSKey ( HUSKEY  hUSKey)

Definition at line 190 of file reg.c.

192 {
193  LPSHUSKEY hKey = hUSKey;
195 
196  if (!hKey)
198 
199  if (hKey->HKCUkey)
200  ret = RegCloseKey(hKey->HKCUkey);
201  if (hKey->HKCUstart && hKey->HKCUstart != HKEY_CURRENT_USER)
202  ret = RegCloseKey(hKey->HKCUstart);
203  if (hKey->HKLMkey)
204  ret = RegCloseKey(hKey->HKLMkey);
205  if (hKey->HKLMstart && hKey->HKLMstart != HKEY_LOCAL_MACHINE)
206  ret = RegCloseKey(hKey->HKLMstart);
207 
208  HeapFree(GetProcessHeap(), 0, hKey);
209  return ret;
210 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
Definition: reg.c:49
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY HKLMstart
Definition: reg.c:52
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
HKEY HKCUstart
Definition: reg.c:50
#define GetProcessHeap()
Definition: compat.h:395
int ret
HKEY HKLMkey
Definition: reg.c:53
HKEY HKCUkey
Definition: reg.c:51
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by add_tbs_to_menu(), SHRegGetUSValueA(), SHRegGetUSValueW(), SHRegOpenUSKeyW(), SHRegSetUSValueA(), and SHRegSetUSValueW().

◆ SHRegCreateUSKeyA()

LONG WINAPI SHRegCreateUSKeyA ( LPCSTR  path,
REGSAM  samDesired,
HUSKEY  relative_key,
PHUSKEY  new_uskey,
DWORD  flags 
)

Definition at line 217 of file reg.c.

219 {
220  WCHAR *pathW;
221  LONG ret;
222 
223  TRACE("(%s, 0x%08x, %p, %p, 0x%08x)\n", debugstr_a(path), samDesired, relative_key,
224  new_uskey, flags);
225 
226  if (path)
227  {
228  INT len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
229  pathW = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
230  if (!pathW)
232  MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len);
233  }
234  else
235  pathW = NULL;
236 
237  ret = SHRegCreateUSKeyW(pathW, samDesired, relative_key, new_uskey, flags);
238  HeapFree(GetProcessHeap(), 0, pathW);
239  return ret;
240 }
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int32_t INT
Definition: typedefs.h:56
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
Definition: services.c:325
LONG WINAPI SHRegCreateUSKeyW(LPCWSTR path, REGSAM samDesired, HUSKEY relative_key, PHUSKEY new_uskey, DWORD flags)
Definition: reg.c:258
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SHRegCreateUSKeyW()

LONG WINAPI SHRegCreateUSKeyW ( LPCWSTR  path,
REGSAM  samDesired,
HUSKEY  relative_key,
PHUSKEY  new_uskey,
DWORD  flags 
)

Definition at line 258 of file reg.c.

260 {
262  SHUSKEY *ret_key;
263 
264  TRACE("(%s, 0x%08x, %p, %p, 0x%08x)\n", debugstr_w(path), samDesired,
265  relative_key, new_uskey, flags);
266 
267  if (!new_uskey) return ERROR_INVALID_PARAMETER;
268 
269  *new_uskey = NULL;
270 
271  if (flags & ~SHREGSET_FORCE_HKCU)
272  {
273  FIXME("unsupported flags 0x%08x\n", flags);
274  return ERROR_SUCCESS;
275  }
276 
277  ret_key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret_key));
278  lstrcpynW(ret_key->lpszPath, path, sizeof(ret_key->lpszPath)/sizeof(WCHAR));
279 
280  if (relative_key)
281  {
282  ret_key->HKCUstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(relative_key, REG_HKCU));
283  ret_key->HKLMstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(relative_key, REG_HKLM));
284  }
285  else
286  {
287  ret_key->HKCUstart = HKEY_CURRENT_USER;
288  ret_key->HKLMstart = HKEY_LOCAL_MACHINE;
289  }
290 
292  {
293  ret = RegCreateKeyExW(ret_key->HKCUstart, path, 0, NULL, 0, samDesired, NULL, &ret_key->HKCUkey, NULL);
294  if (ret == ERROR_SUCCESS)
295  *new_uskey = ret_key;
296  else
297  HeapFree(GetProcessHeap(), 0, ret_key);
298  }
299 
300  return ret;
301 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
WCHAR lpszPath[MAX_PATH]
Definition: reg.c:54
#define REG_HKLM
Definition: reg.c:62
Definition: reg.c:49
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY HKLMstart
Definition: reg.c:52
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define lstrcpynW
Definition: compat.h:397
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
HKEY HKCUstart
Definition: reg.c:50
#define TRACE(s)
Definition: solgame.cpp:4
#define SHREGSET_FORCE_HKCU
Definition: shlwapi.h:312
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLbitfield flags
Definition: glext.h:7161
int ret
Definition: services.c:325
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
HKEY HKCUkey
Definition: reg.c:51
#define HeapFree(x, y, z)
Definition: compat.h:394
#define REG_HKCU
Definition: reg.c:61
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
Definition: reg.c:2214

Referenced by SHRegCreateUSKeyA().

◆ SHRegDeleteEmptyUSKeyA()

LONG WINAPI SHRegDeleteEmptyUSKeyA ( HUSKEY  hUSKey,
LPCSTR  pszValue,
SHREGDEL_FLAGS  delRegFlags 
)

Definition at line 318 of file reg.c.

319 {
320  FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_a(pszValue), delRegFlags);
321  return ERROR_SUCCESS;
322 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31

◆ SHRegDeleteEmptyUSKeyW()

LONG WINAPI SHRegDeleteEmptyUSKeyW ( HUSKEY  hUSKey,
LPCWSTR  pszValue,
SHREGDEL_FLAGS  delRegFlags 
)

Definition at line 329 of file reg.c.

330 {
331  FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_w(pszValue), delRegFlags);
332  return ERROR_SUCCESS;
333 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SHRegDeleteUSValueA()

LONG WINAPI SHRegDeleteUSValueA ( HUSKEY  hUSKey,
LPCSTR  pszValue,
SHREGDEL_FLAGS  delRegFlags 
)

Definition at line 350 of file reg.c.

351 {
352  FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_a(pszValue), delRegFlags);
353  return ERROR_SUCCESS;
354 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31

◆ SHRegDeleteUSValueW()

LONG WINAPI SHRegDeleteUSValueW ( HUSKEY  hUSKey,
LPCWSTR  pszValue,
SHREGDEL_FLAGS  delRegFlags 
)

Definition at line 361 of file reg.c.

362 {
363  FIXME("(%p, %s, 0x%08x) stub\n", hUSKey, debugstr_w(pszValue), delRegFlags);
364  return ERROR_SUCCESS;
365 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SHRegDuplicateHKey()

HKEY WINAPI SHRegDuplicateHKey ( HKEY  hKey)

Definition at line 2214 of file reg.c.

2215 {
2216  HKEY newKey = 0;
2217 
2218  RegOpenKeyExA(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey);
2219  TRACE("new key is %p\n", newKey);
2220  return newKey;
2221 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by SHRegCreateUSKeyW(), and SHRegOpenUSKeyW().

◆ SHRegEnumUSKeyA()

LONG WINAPI SHRegEnumUSKeyA ( HUSKEY  hUSKey,
DWORD  dwIndex,
LPSTR  pszName,
LPDWORD  pcchValueNameLen,
SHREGENUM_FLAGS  enumRegFlags 
)

Definition at line 920 of file reg.c.

926 {
927  HKEY dokey;
928 
929  TRACE("(%p,%d,%p,%p(%d),%d)\n",
930  hUSKey, dwIndex, pszName, pcchValueNameLen,
931  *pcchValueNameLen, enumRegFlags);
932 
933  if (((enumRegFlags == SHREGENUM_HKCU) ||
934  (enumRegFlags == SHREGENUM_DEFAULT)) &&
935  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
936  return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
937  0, 0, 0, 0);
938  }
939 
940  if (((enumRegFlags == SHREGENUM_HKLM) ||
941  (enumRegFlags == SHREGENUM_DEFAULT)) &&
942  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
943  return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
944  0, 0, 0, 0);
945  }
946  FIXME("no support for SHREGENUM_BOTH\n");
947  return ERROR_INVALID_FUNCTION;
948 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2442
#define REG_HKCU
Definition: reg.c:61

◆ SHRegEnumUSKeyW()

LONG WINAPI SHRegEnumUSKeyW ( HUSKEY  hUSKey,
DWORD  dwIndex,
LPWSTR  pszName,
LPDWORD  pcchValueNameLen,
SHREGENUM_FLAGS  enumRegFlags 
)

Definition at line 955 of file reg.c.

961 {
962  HKEY dokey;
963 
964  TRACE("(%p,%d,%p,%p(%d),%d)\n",
965  hUSKey, dwIndex, pszName, pcchValueNameLen,
966  *pcchValueNameLen, enumRegFlags);
967 
968  if (((enumRegFlags == SHREGENUM_HKCU) ||
969  (enumRegFlags == SHREGENUM_DEFAULT)) &&
970  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
971  return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
972  0, 0, 0, 0);
973  }
974 
975  if (((enumRegFlags == SHREGENUM_HKLM) ||
976  (enumRegFlags == SHREGENUM_DEFAULT)) &&
977  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
978  return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
979  0, 0, 0, 0);
980  }
981  FIXME("no support for SHREGENUM_BOTH\n");
982  return ERROR_INVALID_FUNCTION;
983 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
#define REG_HKCU
Definition: reg.c:61

◆ SHRegEnumUSValueA()

LONG WINAPI SHRegEnumUSValueA ( HUSKEY  hUSKey,
DWORD  dwIndex,
LPSTR  pszValueName,
LPDWORD  pcchValueNameLen,
LPDWORD  pdwType,
LPVOID  pvData,
LPDWORD  pcbData,
SHREGENUM_FLAGS  enumRegFlags 
)

Definition at line 387 of file reg.c.

390 {
391  HKEY dokey;
392 
393  TRACE("(%p, 0x%08x, %p, %p, %p, %p, %p, 0x%08x)\n", hUSKey, dwIndex,
394  pszValueName, pcchValueNameLen, pdwType, pvData, pcbData, enumRegFlags);
395 
396  if (((enumRegFlags == SHREGENUM_HKCU) ||
397  (enumRegFlags == SHREGENUM_DEFAULT)) &&
398  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
399  return RegEnumValueA(dokey, dwIndex, pszValueName, pcchValueNameLen,
400  NULL, pdwType, pvData, pcbData);
401  }
402 
403  if (((enumRegFlags == SHREGENUM_HKLM) ||
404  (enumRegFlags == SHREGENUM_DEFAULT)) &&
405  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
406  return RegEnumValueA(dokey, dwIndex, pszValueName, pcchValueNameLen,
407  NULL, pdwType, pvData, pcbData);
408  }
409  FIXME("no support for SHREGENUM_BOTH\n");
410  return ERROR_INVALID_FUNCTION;
411 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2691
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_HKCU
Definition: reg.c:61

◆ SHRegEnumUSValueW()

LONG WINAPI SHRegEnumUSValueW ( HUSKEY  hUSKey,
DWORD  dwIndex,
LPWSTR  pszValueName,
LPDWORD  pcchValueNameLen,
LPDWORD  pdwType,
LPVOID  pvData,
LPDWORD  pcbData,
SHREGENUM_FLAGS  enumRegFlags 
)

Definition at line 418 of file reg.c.

421 {
422  HKEY dokey;
423 
424  TRACE("(%p, 0x%08x, %p, %p, %p, %p, %p, 0x%08x)\n", hUSKey, dwIndex,
425  pszValueName, pcchValueNameLen, pdwType, pvData, pcbData, enumRegFlags);
426 
427  if (((enumRegFlags == SHREGENUM_HKCU) ||
428  (enumRegFlags == SHREGENUM_DEFAULT)) &&
429  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
430  return RegEnumValueW(dokey, dwIndex, pszValueName, pcchValueNameLen,
431  NULL, pdwType, pvData, pcbData);
432  }
433 
434  if (((enumRegFlags == SHREGENUM_HKLM) ||
435  (enumRegFlags == SHREGENUM_DEFAULT)) &&
436  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
437  return RegEnumValueW(dokey, dwIndex, pszValueName, pcchValueNameLen,
438  NULL, pdwType, pvData, pcbData);
439  }
440  FIXME("no support for SHREGENUM_BOTH\n");
441  return ERROR_INVALID_FUNCTION;
442 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define FIXME(fmt,...)
Definition: debug.h:110
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_HKCU
Definition: reg.c:61

Referenced by add_tbs_to_menu().

◆ SHRegGetBoolUSValueA()

BOOL WINAPI SHRegGetBoolUSValueA ( LPCSTR  pszSubKey,
LPCSTR  pszValue,
BOOL  fIgnoreHKCU,
BOOL  fDefault 
)

Definition at line 714 of file reg.c.

719 {
720  DWORD type, datalen, work;
721  BOOL ret = fDefault;
722  CHAR data[10];
723 
724  TRACE("key '%s', value '%s', %s\n",
725  debugstr_a(pszSubKey), debugstr_a(pszValue),
726  (fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
727 
728  datalen = sizeof(data)-1;
729  if (!SHRegGetUSValueA( pszSubKey, pszValue, &type,
730  data, &datalen,
731  fIgnoreHKCU, 0, 0)) {
732  /* process returned data via type into bool */
733  switch (type) {
734  case REG_SZ:
735  data[9] = '\0'; /* set end of string */
736  if (lstrcmpiA(data, "YES") == 0) ret = TRUE;
737  if (lstrcmpiA(data, "TRUE") == 0) ret = TRUE;
738  if (lstrcmpiA(data, "NO") == 0) ret = FALSE;
739  if (lstrcmpiA(data, "FALSE") == 0) ret = FALSE;
740  break;
741  case REG_DWORD:
742  work = *(LPDWORD)data;
743  ret = (work != 0);
744  break;
745  case REG_BINARY:
746  if (datalen == 1) {
747  ret = (data[0] != '\0');
748  break;
749  }
750  default:
751  FIXME("Unsupported registry data type %d\n", type);
752  ret = FALSE;
753  }
754  TRACE("got value (type=%d), returning <%s>\n", type,
755  (ret) ? "TRUE" : "FALSE");
756  }
757  else {
758  ret = fDefault;
759  TRACE("returning default data <%s>\n",
760  (ret) ? "TRUE" : "FALSE");
761  }
762  return ret;
763 }
#define TRUE
Definition: types.h:120
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
LONG WINAPI SHRegGetUSValueA(LPCSTR pSubKey, LPCSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
Definition: reg.c:561
#define REG_BINARY
Definition: nt_native.h:1496
char CHAR
Definition: xmlstorage.h:175
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define LPDWORD
Definition: nt_native.h:46
#define REG_DWORD
Definition: sdbapi.c:596
DWORD type
Definition: reg.c:66
#define REG_SZ
Definition: layer.c:22

◆ SHRegGetBoolUSValueW()

BOOL WINAPI SHRegGetBoolUSValueW ( LPCWSTR  pszSubKey,
LPCWSTR  pszValue,
BOOL  fIgnoreHKCU,
BOOL  fDefault 
)

Definition at line 770 of file reg.c.

775 {
776  static const WCHAR wYES[]= {'Y','E','S','\0'};
777  static const WCHAR wTRUE[]= {'T','R','U','E','\0'};
778  static const WCHAR wNO[]= {'N','O','\0'};
779  static const WCHAR wFALSE[]={'F','A','L','S','E','\0'};
780  DWORD type, datalen, work;
781  BOOL ret = fDefault;
782  WCHAR data[10];
783 
784  TRACE("key '%s', value '%s', %s\n",
785  debugstr_w(pszSubKey), debugstr_w(pszValue),
786  (fIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
787 
788  datalen = (sizeof(data)-1) * sizeof(WCHAR);
789  if (!SHRegGetUSValueW( pszSubKey, pszValue, &type,
790  data, &datalen,
791  fIgnoreHKCU, 0, 0)) {
792  /* process returned data via type into bool */
793  switch (type) {
794  case REG_SZ:
795  data[9] = '\0'; /* set end of string */
796  if (lstrcmpiW(data, wYES)==0 || lstrcmpiW(data, wTRUE)==0)
797  ret = TRUE;
798  else if (lstrcmpiW(data, wNO)==0 || lstrcmpiW(data, wFALSE)==0)
799  ret = FALSE;
800  break;
801  case REG_DWORD:
802  work = *(LPDWORD)data;
803  ret = (work != 0);
804  break;
805  case REG_BINARY:
806  if (datalen == 1) {
807  ret = (data[0] != '\0');
808  break;
809  }
810  default:
811  FIXME("Unsupported registry data type %d\n", type);
812  ret = FALSE;
813  }
814  TRACE("got value (type=%d), returning <%s>\n", type,
815  (ret) ? "TRUE" : "FALSE");
816  }
817  else {
818  ret = fDefault;
819  TRACE("returning default data <%s>\n",
820  (ret) ? "TRUE" : "FALSE");
821  }
822  return ret;
823 }
#define TRUE
Definition: types.h:120
#define REG_BINARY
Definition: nt_native.h:1496
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int const JOCTET unsigned int datalen
Definition: jpeglib.h:1027
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define LPDWORD
Definition: nt_native.h:46
LONG WINAPI SHRegGetUSValueW(LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
Definition: reg.c:594
#define REG_DWORD
Definition: sdbapi.c:596
DWORD type
Definition: reg.c:66
#define REG_SZ
Definition: layer.c:22

Referenced by CInternetToolbar::OnContextMenu(), CAddressBand::OnWinEvent(), CAddressBand::SetSite(), and SHMessageBoxCheckExW().

◆ SHRegGetCLSIDKeyA()

HRESULT WINAPI SHRegGetCLSIDKeyA ( REFGUID  guid,
LPCSTR  lpszValue,
BOOL  bUseHKCU,
BOOL  bCreate,
PHKEY  phKey 
)

Definition at line 2407 of file reg.c.

2408 {
2409  WCHAR szValue[MAX_PATH];
2410 
2411  if (lpszValue)
2412  MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, sizeof(szValue)/sizeof(WCHAR));
2413 
2414  return SHRegGetCLSIDKeyW(guid, lpszValue ? szValue : NULL, bUseHKCU, bCreate, phKey);
2415 }
#define CP_ACP
Definition: compat.h:99
const GUID * guid
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID, LPCWSTR, BOOL, BOOL, PHKEY)
Definition: reg.c:2422
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1435
#define MultiByteToWideChar
Definition: compat.h:100

◆ SHRegGetCLSIDKeyW()

HRESULT WINAPI SHRegGetCLSIDKeyW ( REFGUID  guid,
LPCWSTR  lpszValue,
BOOL  bUseHKCU,
BOOL  bCreate,
PHKEY  phKey 
)

Definition at line 2422 of file reg.c.

2424 {
2425  static const WCHAR szClassIdKey[] = { 'S','o','f','t','w','a','r','e','\\',
2426  'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
2427  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
2428  'E','x','p','l','o','r','e','r','\\','C','L','S','I','D','\\' };
2429 #define szClassIdKeyLen (sizeof(szClassIdKey)/sizeof(WCHAR))
2430  WCHAR szKey[MAX_PATH];
2431  DWORD dwRet;
2432  HKEY hkey;
2433 
2434  /* Create the key string */
2435  memcpy(szKey, szClassIdKey, sizeof(szClassIdKey));
2436  SHStringFromGUIDW(guid, szKey + szClassIdKeyLen, 39); /* Append guid */
2437 
2438  if(lpszValue)
2439  {
2440  szKey[szClassIdKeyLen + 39] = '\\';
2441  strcpyW(szKey + szClassIdKeyLen + 40, lpszValue); /* Append value name */
2442  }
2443 
2444  hkey = bUseHKCU ? HKEY_CURRENT_USER : HKEY_CLASSES_ROOT;
2445 
2446  if(bCreate)
2447  dwRet = RegCreateKeyW(hkey, szKey, phKey);
2448  else
2449  dwRet = RegOpenKeyExW(hkey, szKey, 0, KEY_READ, phKey);
2450 
2451  return dwRet ? HRESULT_FROM_WIN32(dwRet) : S_OK;
2452 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define szClassIdKeyLen
const GUID * guid
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
INT WINAPI SHStringFromGUIDW(REFGUID, LPWSTR, INT)
Definition: ordinal.c:608
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1435
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by SHRegGetCLSIDKeyA().

◆ SHRegGetIntW()

int WINAPI SHRegGetIntW ( HKEY  hKey,
LPCWSTR  lpszValue,
int  iDefault 
)

Definition at line 2374 of file reg.c.

2375 {
2376  TRACE("(%p,%s,%d)\n", hKey, debugstr_w(lpszValue), iDefault);
2377 
2378  if (hKey)
2379  {
2380  WCHAR szBuff[32];
2381  DWORD dwSize = sizeof(szBuff);
2382  szBuff[0] = '\0';
2383  SHQueryValueExW(hKey, lpszValue, 0, 0, szBuff, &dwSize);
2384 
2385  if(*szBuff >= '0' && *szBuff <= '9')
2386  return StrToIntW(szBuff);
2387  }
2388  return iDefault;
2389 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
INT WINAPI StrToIntW(LPCWSTR lpString)
Definition: string.c:411
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by LoadCurrentScheme(), and LoadSchemeFromReg().

◆ SHRegGetPathA()

DWORD WINAPI SHRegGetPathA ( HKEY  hKey,
LPCSTR  lpszSubKey,
LPCSTR  lpszValue,
LPSTR  lpszPath,
DWORD  dwFlags 
)

Definition at line 1109 of file reg.c.

1111 {
1112  DWORD dwSize = MAX_PATH;
1113 
1114  TRACE("(hkey=%p,%s,%s,%p,%d)\n", hKey, debugstr_a(lpszSubKey),
1115  debugstr_a(lpszValue), lpszPath, dwFlags);
1116 
1117  return SHGetValueA(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
1118 }
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1207
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ SHRegGetPathW()

DWORD WINAPI SHRegGetPathW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
LPCWSTR  lpszValue,
LPWSTR  lpszPath,
DWORD  dwFlags 
)

Definition at line 1125 of file reg.c.

1127 {
1128  DWORD dwSize = MAX_PATH;
1129 
1130  TRACE("(hkey=%p,%s,%s,%p,%d)\n", hKey, debugstr_w(lpszSubKey),
1131  debugstr_w(lpszValue), lpszPath, dwFlags);
1132 
1133  return SHGetValueW(hKey, lpszSubKey, lpszValue, 0, lpszPath, &dwSize);
1134 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ SHRegGetUSValueA()

LONG WINAPI SHRegGetUSValueA ( LPCSTR  pSubKey,
LPCSTR  pValue,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData,
BOOL  flagIgnoreHKCU,
LPVOID  pDefaultData,
DWORD  wDefaultDataSize 
)

Definition at line 561 of file reg.c.

570 {
571  HUSKEY myhuskey;
572  LONG ret;
573 
574  if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
575  TRACE("key '%s', value '%s', datalen %d, %s\n",
576  debugstr_a(pSubKey), debugstr_a(pValue), *pcbData,
577  (flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
578 
579  ret = SHRegOpenUSKeyA(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
580  if (ret == ERROR_SUCCESS) {
581  ret = SHRegQueryUSValueA(myhuskey, pValue, pwType, pvData,
582  pcbData, flagIgnoreHKCU, pDefaultData,
583  wDefaultDataSize);
584  SHRegCloseUSKey(myhuskey);
585  }
586  return ret;
587 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
LONG WINAPI SHRegOpenUSKeyA(LPCSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:106
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
long LONG
Definition: pedump.c:60
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
LONG WINAPI SHRegQueryUSValueA(HUSKEY hUSKey, LPCSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
Definition: reg.c:453
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
int ret
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953

Referenced by SHRegGetBoolUSValueA(), and URLSubRegQueryA().

◆ SHRegGetUSValueW()

LONG WINAPI SHRegGetUSValueW ( LPCWSTR  pSubKey,
LPCWSTR  pValue,
LPDWORD  pwType,
LPVOID  pvData,
LPDWORD  pcbData,
BOOL  flagIgnoreHKCU,
LPVOID  pDefaultData,
DWORD  wDefaultDataSize 
)

Definition at line 594 of file reg.c.

603 {
604  HUSKEY myhuskey;
605  LONG ret;
606 
607  if (!pvData || !pcbData) return ERROR_INVALID_FUNCTION; /* FIXME:wrong*/
608  TRACE("key '%s', value '%s', datalen %d, %s\n",
609  debugstr_w(pSubKey), debugstr_w(pValue), *pcbData,
610  (flagIgnoreHKCU) ? "Ignoring HKCU" : "Tries HKCU then HKLM");
611 
612  ret = SHRegOpenUSKeyW(pSubKey, 0x1, 0, &myhuskey, flagIgnoreHKCU);
613  if (ret == ERROR_SUCCESS) {
614  ret = SHRegQueryUSValueW(myhuskey, pValue, pwType, pvData,
615  pcbData, flagIgnoreHKCU, pDefaultData,
616  wDefaultDataSize);
617  SHRegCloseUSKey(myhuskey);
618  }
619  return ret;
620 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:123
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
int ret
LONG WINAPI SHRegQueryUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
Definition: reg.c:504
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953

Referenced by general_on_command(), general_on_initdialog(), and SHRegGetBoolUSValueW().

◆ SHRegisterValidateTemplate()

HRESULT WINAPI SHRegisterValidateTemplate ( LPCWSTR  filename,
BOOL  unknown 
)

Definition at line 2472 of file reg.c.

2473 {
2474 /* static const WCHAR szTemplateKey[] = { 'S','o','f','t','w','a','r','e','\\',
2475  * 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
2476  * 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
2477  * 'E','x','p','l','o','r','e','r','\\',
2478  * 'T','e','m','p','l','a','t','e','R','e','g','i','s','t','r','y',0 };
2479  */
2480  FIXME("stub: %s, %08x\n", debugstr_w(filename), unknown);
2481 
2482  return S_OK;
2483 }
const char * filename
Definition: ioapi.h:135
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
Definition: id3.c:18
#define S_OK
Definition: intsafe.h:59

◆ SHRegOpenUSKeyA()

LONG WINAPI SHRegOpenUSKeyA ( LPCSTR  Path,
REGSAM  AccessType,
HUSKEY  hRelativeUSKey,
PHUSKEY  phNewUSKey,
BOOL  fIgnoreHKCU 
)

Definition at line 106 of file reg.c.

108 {
110 
111  if (Path)
113 
114  return SHRegOpenUSKeyW(Path ? szPath : NULL, AccessType, hRelativeUSKey,
115  phNewUSKey, fIgnoreHKCU);
116 }
#define CP_ACP
Definition: compat.h:99
LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:123
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
PRTL_UNICODE_STRING_BUFFER Path
LPCWSTR szPath
Definition: env.c:35
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by SHRegGetUSValueA(), and SHRegSetUSValueA().

◆ SHRegOpenUSKeyW()

LONG WINAPI SHRegOpenUSKeyW ( LPCWSTR  Path,
REGSAM  AccessType,
HUSKEY  hRelativeUSKey,
PHUSKEY  phNewUSKey,
BOOL  fIgnoreHKCU 
)

Definition at line 123 of file reg.c.

125 {
126  LONG ret2, ret1 = ~ERROR_SUCCESS;
127  LPSHUSKEY hKey;
128 
129  TRACE("(%s,0x%x,%p,%p,%d)\n", debugstr_w(Path),(LONG)AccessType,
130  hRelativeUSKey, phNewUSKey, fIgnoreHKCU);
131 
132  if (phNewUSKey)
133  *phNewUSKey = NULL;
134 
135  /* Create internal HUSKEY */
136  hKey = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*hKey));
137  lstrcpynW(hKey->lpszPath, Path, sizeof(hKey->lpszPath)/sizeof(WCHAR));
138 
139  if (hRelativeUSKey)
140  {
143 
144  /* FIXME: if either of these keys is NULL, create the start key from
145  * the relative keys start+path
146  */
147  }
148  else
149  {
152  }
153 
154  if (!fIgnoreHKCU)
155  {
156  ret1 = RegOpenKeyExW(hKey->HKCUstart, hKey->lpszPath, 0, AccessType, &hKey->HKCUkey);
157  if (ret1)
158  hKey->HKCUkey = 0;
159  }
160 
161  ret2 = RegOpenKeyExW(hKey->HKLMstart, hKey->lpszPath, 0, AccessType, &hKey->HKLMkey);
162  if (ret2)
163  hKey->HKLMkey = 0;
164 
165  if (ret1 || ret2)
166  TRACE("one or more opens failed: HKCU=%d HKLM=%d\n", ret1, ret2);
167 
168  if (ret1 && ret2)
169  {
170  /* Neither open succeeded: fail */
171  SHRegCloseUSKey(hKey);
172  return ret2;
173  }
174 
175  TRACE("HUSKEY=%p\n", hKey);
176  if (phNewUSKey)
177  *phNewUSKey = hKey;
178  return ERROR_SUCCESS;
179 }
WCHAR lpszPath[MAX_PATH]
Definition: reg.c:54
#define REG_HKLM
Definition: reg.c:62
Definition: reg.c:49
#define ERROR_SUCCESS
Definition: deptool.c:10
HKEY HKLMstart
Definition: reg.c:52
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define lstrcpynW
Definition: compat.h:397
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
HKEY HKCUstart
Definition: reg.c:50
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
PRTL_UNICODE_STRING_BUFFER Path
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HKEY HKLMkey
Definition: reg.c:53
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
HKEY HKCUkey
Definition: reg.c:51
#define REG_HKCU
Definition: reg.c:61
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
Definition: reg.c:2214

Referenced by add_tbs_to_menu(), SHRegGetUSValueW(), SHRegOpenUSKeyA(), and SHRegSetUSValueW().

◆ SHRegQueryInfoUSKeyA()

LONG WINAPI SHRegQueryInfoUSKeyA ( HUSKEY  hUSKey,
LPDWORD  pcSubKeys,
LPDWORD  pcchMaxSubKeyLen,
LPDWORD  pcValues,
LPDWORD  pcchMaxValueNameLen,
SHREGENUM_FLAGS  enumRegFlags 
)

Definition at line 834 of file reg.c.

841 {
842  HKEY dokey;
843  LONG ret;
844 
845  TRACE("(%p,%p,%p,%p,%p,%d)\n",
846  hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
847  pcchMaxValueNameLen,enumRegFlags);
848 
849  /* if user wants HKCU, and it exists, then try it */
850  if (((enumRegFlags == SHREGENUM_HKCU) ||
851  (enumRegFlags == SHREGENUM_DEFAULT)) &&
852  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
853  ret = RegQueryInfoKeyA(dokey, 0, 0, 0,
854  pcSubKeys, pcchMaxSubKeyLen, 0,
855  pcValues, pcchMaxValueNameLen, 0, 0, 0);
856  if ((ret == ERROR_SUCCESS) ||
857  (enumRegFlags == SHREGENUM_HKCU))
858  return ret;
859  }
860  if (((enumRegFlags == SHREGENUM_HKLM) ||
861  (enumRegFlags == SHREGENUM_DEFAULT)) &&
862  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
863  return RegQueryInfoKeyA(dokey, 0, 0, 0,
864  pcSubKeys, pcchMaxSubKeyLen, 0,
865  pcValues, pcchMaxValueNameLen, 0, 0, 0);
866  }
867  return ERROR_INVALID_FUNCTION;
868 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3607
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
int ret
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
#define REG_HKCU
Definition: reg.c:61

◆ SHRegQueryInfoUSKeyW()

LONG WINAPI SHRegQueryInfoUSKeyW ( HUSKEY  hUSKey,
LPDWORD  pcSubKeys,
LPDWORD  pcchMaxSubKeyLen,
LPDWORD  pcValues,
LPDWORD  pcchMaxValueNameLen,
SHREGENUM_FLAGS  enumRegFlags 
)

Definition at line 875 of file reg.c.

882 {
883  HKEY dokey;
884  LONG ret;
885 
886  TRACE("(%p,%p,%p,%p,%p,%d)\n",
887  hUSKey,pcSubKeys,pcchMaxSubKeyLen,pcValues,
888  pcchMaxValueNameLen,enumRegFlags);
889 
890  /* if user wants HKCU, and it exists, then try it */
891  if (((enumRegFlags == SHREGENUM_HKCU) ||
892  (enumRegFlags == SHREGENUM_DEFAULT)) &&
893  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
894  ret = RegQueryInfoKeyW(dokey, 0, 0, 0,
895  pcSubKeys, pcchMaxSubKeyLen, 0,
896  pcValues, pcchMaxValueNameLen, 0, 0, 0);
897  if ((ret == ERROR_SUCCESS) ||
898  (enumRegFlags == SHREGENUM_HKCU))
899  return ret;
900  }
901  if (((enumRegFlags == SHREGENUM_HKLM) ||
902  (enumRegFlags == SHREGENUM_DEFAULT)) &&
903  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
904  return RegQueryInfoKeyW(dokey, 0, 0, 0,
905  pcSubKeys, pcchMaxSubKeyLen, 0,
906  pcValues, pcchMaxValueNameLen, 0, 0, 0);
907  }
908  return ERROR_INVALID_FUNCTION;
909 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
int ret
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
#define REG_HKCU
Definition: reg.c:61

◆ SHRegQueryUSValueA()

LONG WINAPI SHRegQueryUSValueA ( HUSKEY  hUSKey,
LPCSTR  pszValue,
LPDWORD  pdwType,
LPVOID  pvData,
LPDWORD  pcbData,
BOOL  fIgnoreHKCU,
LPVOID  pvDefaultData,
DWORD  dwDefaultDataSize 
)

Definition at line 453 of file reg.c.

462 {
464  LONG i, maxmove;
465  HKEY dokey;
466  CHAR *src, *dst;
467 
468  /* if user wants HKCU, and it exists, then try it */
469  if (!fIgnoreHKCU && (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
470  ret = RegQueryValueExA(dokey,
471  pszValue, 0, pdwType, pvData, pcbData);
472  TRACE("HKCU RegQueryValue returned %08x\n", ret);
473  }
474 
475  /* if HKCU did not work and HKLM exists, then try it */
476  if ((ret != ERROR_SUCCESS) &&
477  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
478  ret = RegQueryValueExA(dokey,
479  pszValue, 0, pdwType, pvData, pcbData);
480  TRACE("HKLM RegQueryValue returned %08x\n", ret);
481  }
482 
483  /* if neither worked, and default data exists, then use it */
484  if (ret != ERROR_SUCCESS) {
485  if (pvDefaultData && (dwDefaultDataSize != 0)) {
486  maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
487  src = pvDefaultData;
488  dst = pvData;
489  for(i=0; i<maxmove; i++) *dst++ = *src++;
490  *pcbData = maxmove;
491  TRACE("setting default data\n");
492  ret = ERROR_SUCCESS;
493  }
494  }
495  return ret;
496 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define REG_HKLM
Definition: reg.c:62
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
int ret
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_HKCU
Definition: reg.c:61

Referenced by SHRegGetUSValueA().

◆ SHRegQueryUSValueW()

LONG WINAPI SHRegQueryUSValueW ( HUSKEY  hUSKey,
LPCWSTR  pszValue,
LPDWORD  pdwType,
LPVOID  pvData,
LPDWORD  pcbData,
BOOL  fIgnoreHKCU,
LPVOID  pvDefaultData,
DWORD  dwDefaultDataSize 
)

Definition at line 504 of file reg.c.

513 {
515  LONG i, maxmove;
516  HKEY dokey;
517  CHAR *src, *dst;
518 
519  /* if user wants HKCU, and it exists, then try it */
520  if (!fIgnoreHKCU && (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
521  ret = RegQueryValueExW(dokey,
522  pszValue, 0, pdwType, pvData, pcbData);
523  TRACE("HKCU RegQueryValue returned %08x\n", ret);
524  }
525 
526  /* if HKCU did not work and HKLM exists, then try it */
527  if ((ret != ERROR_SUCCESS) &&
528  (dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
529  ret = RegQueryValueExW(dokey,
530  pszValue, 0, pdwType, pvData, pcbData);
531  TRACE("HKLM RegQueryValue returned %08x\n", ret);
532  }
533 
534  /* if neither worked, and default data exists, then use it */
535  if (ret != ERROR_SUCCESS) {
536  if (pvDefaultData && (dwDefaultDataSize != 0)) {
537  maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
538  src = pvDefaultData;
539  dst = pvData;
540  for(i=0; i<maxmove; i++) *dst++ = *src++;
541  *pcbData = maxmove;
542  TRACE("setting default data\n");
543  ret = ERROR_SUCCESS;
544  }
545  }
546  return ret;
547 }
#define REG_HKLM
Definition: reg.c:62
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
int ret
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
static HKEY REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
Definition: reg.c:69
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_HKCU
Definition: reg.c:61

Referenced by add_tbs_to_menu(), and SHRegGetUSValueW().

◆ SHRegSetPathA()

DWORD WINAPI SHRegSetPathA ( HKEY  hKey,
LPCSTR  lpszSubKey,
LPCSTR  lpszValue,
LPCSTR  lpszPath,
DWORD  dwFlags 
)

Definition at line 1153 of file reg.c.

1155 {
1156  char szBuff[MAX_PATH];
1157 
1158  FIXME("(hkey=%p,%s,%s,%p,%d) - semi-stub\n",hKey, debugstr_a(lpszSubKey),
1159  debugstr_a(lpszValue), lpszPath, dwFlags);
1160 
1161  lstrcpyA(szBuff, lpszPath);
1162 
1163  /* FIXME: PathUnExpandEnvStringsA(szBuff); */
1164 
1165  return SHSetValueA(hKey,lpszSubKey, lpszValue, REG_SZ, szBuff,
1166  lstrlenA(szBuff));
1167 }
DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1278
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define REG_SZ
Definition: layer.c:22

◆ SHRegSetPathW()

DWORD WINAPI SHRegSetPathW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
LPCWSTR  lpszValue,
LPCWSTR  lpszPath,
DWORD  dwFlags 
)

Definition at line 1174 of file reg.c.

1176 {
1177  WCHAR szBuff[MAX_PATH];
1178 
1179  FIXME("(hkey=%p,%s,%s,%p,%d) - semi-stub\n",hKey, debugstr_w(lpszSubKey),
1180  debugstr_w(lpszValue), lpszPath, dwFlags);
1181 
1182  lstrcpyW(szBuff, lpszPath);
1183 
1184  /* FIXME: PathUnExpandEnvStringsW(szBuff); */
1185 
1186  return SHSetValueW(hKey,lpszSubKey, lpszValue, REG_SZ, szBuff,
1187  lstrlenW(szBuff));
1188 }
DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD dwType, LPCVOID pvData, DWORD cbData)
Definition: reg.c:1306
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define lstrcpyW
Definition: compat.h:406
#define REG_SZ
Definition: layer.c:22

◆ SHRegSetUSValueA()

LONG WINAPI SHRegSetUSValueA ( LPCSTR  pszSubKey,
LPCSTR  pszValue,
DWORD  dwType,
LPVOID  pvData,
DWORD  cbData,
DWORD  dwFlags 
)

Definition at line 643 of file reg.c.

645 {
646  BOOL ignoreHKCU = TRUE;
647  HUSKEY hkey;
648  LONG ret;
649 
650  TRACE("(%s,%s,%d,%p,%d,0x%08x\n", debugstr_a(pszSubKey), debugstr_a(pszValue),
651  dwType, pvData, cbData, dwFlags);
652 
653  if (!pvData)
654  return ERROR_INVALID_FUNCTION;
655 
657  ignoreHKCU = FALSE;
658 
659  ret = SHRegOpenUSKeyA(pszSubKey, KEY_ALL_ACCESS, 0, &hkey, ignoreHKCU);
660  if (ret == ERROR_SUCCESS)
661  {
662  ret = SHRegWriteUSValueA(hkey, pszValue, dwType, pvData, cbData, dwFlags);
663  SHRegCloseUSKey(hkey);
664  }
665  return ret;
666 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define SHREGSET_HKCU
Definition: shlwapi.h:311
LONG WINAPI SHRegOpenUSKeyA(LPCSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:106
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
#define SHREGSET_FORCE_HKCU
Definition: shlwapi.h:312
#define debugstr_a
Definition: kernel32.h:31
LONG WINAPI SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:1007
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041

◆ SHRegSetUSValueW()

LONG WINAPI SHRegSetUSValueW ( LPCWSTR  pszSubKey,
LPCWSTR  pszValue,
DWORD  dwType,
LPVOID  pvData,
DWORD  cbData,
DWORD  dwFlags 
)

Definition at line 673 of file reg.c.

675 {
676  BOOL ignoreHKCU = TRUE;
677  HUSKEY hkey;
678  LONG ret;
679 
680  TRACE("(%s,%s,%d,%p,%d,0x%08x\n", debugstr_w(pszSubKey), debugstr_w(pszValue),
681  dwType, pvData, cbData, dwFlags);
682 
683  if (!pvData)
684  return ERROR_INVALID_FUNCTION;
685 
687  ignoreHKCU = FALSE;
688 
689  ret = SHRegOpenUSKeyW(pszSubKey, KEY_ALL_ACCESS, 0, &hkey, ignoreHKCU);
690  if (ret == ERROR_SUCCESS)
691  {
692  ret = SHRegWriteUSValueW(hkey, pszValue, dwType, pvData, cbData, dwFlags);
693  SHRegCloseUSKey(hkey);
694  }
695  return ret;
696 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define SHREGSET_HKCU
Definition: shlwapi.h:311
LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:123
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:1024
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
#define TRACE(s)
Definition: solgame.cpp:4
#define SHREGSET_FORCE_HKCU
Definition: shlwapi.h:312
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041

Referenced by CAddressBand::OnWinEvent(), and SHDlgProcEx().

◆ SHRegWriteUSValueA()

LONG WINAPI SHRegWriteUSValueA ( HUSKEY  hUSKey,
LPCSTR  pszValue,
DWORD  dwType,
LPVOID  pvData,
DWORD  cbData,
DWORD  dwFlags 
)

Definition at line 1007 of file reg.c.

1009 {
1010  WCHAR szValue[MAX_PATH];
1011 
1012  if (pszValue)
1013  MultiByteToWideChar(CP_ACP, 0, pszValue, -1, szValue, MAX_PATH);
1014 
1015  return SHRegWriteUSValueW(hUSKey, pszValue ? szValue : NULL, dwType,
1016  pvData, cbData, dwFlags);
1017 }
#define CP_ACP
Definition: compat.h:99
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType, LPVOID pvData, DWORD cbData, DWORD dwFlags)
Definition: reg.c:1024
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by SHRegSetUSValueA().

◆ SHRegWriteUSValueW()

LONG WINAPI SHRegWriteUSValueW ( HUSKEY  hUSKey,
LPCWSTR  pszValue,
DWORD  dwType,
LPVOID  pvData,
DWORD  cbData,
DWORD  dwFlags 
)

Definition at line 1024 of file reg.c.

1026 {
1027  DWORD dummy;
1028  LPSHUSKEY hKey = hUSKey;
1030 
1031  TRACE("(%p,%s,%d,%p,%d,%d)\n", hUSKey, debugstr_w(pszValue),
1032  dwType, pvData, cbData, dwFlags);
1033 
1034  if (!hUSKey || IsBadWritePtr(hUSKey, sizeof(SHUSKEY)) ||
1036  return ERROR_INVALID_PARAMETER;
1037 
1039  {
1040  if (!hKey->HKCUkey)
1041  {
1042  /* Create the key */
1043  ret = RegCreateKeyW(hKey->HKCUstart, hKey->lpszPath, &hKey->HKCUkey);
1044  TRACE("Creating HKCU key, ret = %d\n", ret);
1045  if (ret && (dwFlags & (SHREGSET_FORCE_HKCU)))
1046  {
1047  hKey->HKCUkey = 0;
1048  return ret;
1049  }
1050  }
1051 
1052  if (!ret)
1053  {
1054  if ((dwFlags & SHREGSET_FORCE_HKCU) ||
1055  RegQueryValueExW(hKey->HKCUkey, pszValue, NULL, NULL, NULL, &dummy))
1056  {
1057  /* Doesn't exist or we are forcing: Write value */
1058  ret = RegSetValueExW(hKey->HKCUkey, pszValue, 0, dwType, pvData, cbData);
1059  TRACE("Writing HKCU value, ret = %d\n", ret);
1060  }
1061  }
1062  }
1063 
1065  {
1066  if (!hKey->HKLMkey)
1067  {
1068  /* Create the key */
1069  ret = RegCreateKeyW(hKey->HKLMstart, hKey->lpszPath, &hKey->HKLMkey);
1070  TRACE("Creating HKLM key, ret = %d\n", ret);
1071  if (ret && (dwFlags & (SHREGSET_FORCE_HKLM)))
1072  {
1073  hKey->HKLMkey = 0;
1074  return ret;
1075  }
1076  }
1077 
1078  if (!ret)
1079  {
1080  if ((dwFlags & SHREGSET_FORCE_HKLM) ||
1081  RegQueryValueExW(hKey->HKLMkey, pszValue, NULL, NULL, NULL, &dummy))
1082  {
1083  /* Doesn't exist or we are forcing: Write value */
1084  ret = RegSetValueExW(hKey->HKLMkey, pszValue, 0, dwType, pvData, cbData);
1085  TRACE("Writing HKLM value, ret = %d\n", ret);
1086  }
1087  }
1088  }
1089 
1090  return ret;
1091 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
WCHAR lpszPath[MAX_PATH]
Definition: reg.c:54
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:885
Definition: reg.c:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SHREGSET_HKCU
Definition: shlwapi.h:311
HKEY HKLMstart
Definition: reg.c:52
#define SHREGSET_HKLM
Definition: shlwapi.h:313
#define SHREGSET_FORCE_HKLM
Definition: shlwapi.h:314
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
HKEY HKCUstart
Definition: reg.c:50
#define TRACE(s)
Definition: solgame.cpp:4
#define SHREGSET_FORCE_HKCU
Definition: shlwapi.h:312
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
unsigned char dummy
Definition: maze.c:118
HKEY HKLMkey
Definition: reg.c:53
HKEY HKCUkey
Definition: reg.c:51

Referenced by SHRegSetUSValueW(), and SHRegWriteUSValueA().

◆ SHSetValueA()

DWORD WINAPI SHSetValueA ( HKEY  hKey,
LPCSTR  lpszSubKey,
LPCSTR  lpszValue,
DWORD  dwType,
LPCVOID  pvData,
DWORD  cbData 
)

Definition at line 1278 of file reg.c.

1280 {
1281  DWORD dwRet = ERROR_SUCCESS, dwDummy;
1282  HKEY hSubKey;
1283 
1284  TRACE("(hkey=%p,%s,%s,%d,%p,%d)\n", hKey, debugstr_a(lpszSubKey),
1285  debugstr_a(lpszValue), dwType, pvData, cbData);
1286 
1287  if (lpszSubKey && *lpszSubKey)
1288  dwRet = RegCreateKeyExA(hKey, lpszSubKey, 0, NULL,
1289  0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy);
1290  else
1291  hSubKey = hKey;
1292  if (!dwRet)
1293  {
1294  dwRet = RegSetValueExA(hSubKey, lpszValue, 0, dwType, pvData, cbData);
1295  if (hSubKey != hKey)
1296  RegCloseKey(hSubKey);
1297  }
1298  return dwRet;
1299 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1029

Referenced by RegisterExtensionForMIMETypeA(), RegisterMIMETypeForExtensionA(), and SHRegSetPathA().

◆ SHSetValueW()

DWORD WINAPI SHSetValueW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
LPCWSTR  lpszValue,
DWORD  dwType,
LPCVOID  pvData,
DWORD  cbData 
)

Definition at line 1306 of file reg.c.

1308 {
1309  DWORD dwRet = ERROR_SUCCESS, dwDummy;
1310  HKEY hSubKey;
1311 
1312  TRACE("(hkey=%p,%s,%s,%d,%p,%d)\n", hKey, debugstr_w(lpszSubKey),
1313  debugstr_w(lpszValue), dwType, pvData, cbData);
1314 
1315  if (lpszSubKey && *lpszSubKey)
1316  dwRet = RegCreateKeyExW(hKey, lpszSubKey, 0, NULL,
1317  0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy);
1318  else
1319  hSubKey = hKey;
1320  if (!dwRet)
1321  {
1322  dwRet = RegSetValueExW(hSubKey, lpszValue, 0, dwType, pvData, cbData);
1323  if (hSubKey != hKey)
1324  RegCloseKey(hSubKey);
1325  }
1326  return dwRet;
1327 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by ApplyScheme(), IntSetShellStateSettings(), RegisterExtensionForMIMETypeW(), RegisterMIMETypeForExtensionW(), TaskbarSettings::Save(), CRegFolder::SetNameOf(), SHCopyKeyW(), and SHRegSetPathW().

◆ SHStringFromGUIDW()

INT WINAPI SHStringFromGUIDW ( REFGUID  ,
LPWSTR  ,
INT   
)

Definition at line 608 of file ordinal.c.

609 {
610  WCHAR xguid[40];
611  INT iLen;
612  static const WCHAR wszFormat[] = {'{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-',
613  '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2',
614  'X','%','0','2','X','%','0','2','X','}',0};
615 
616  TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax);
617 
618  sprintfW(xguid, wszFormat, guid->Data1, guid->Data2, guid->Data3,
619  guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
620  guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
621 
622  iLen = strlenW(xguid) + 1;
623 
624  if (iLen > cchMax)
625  return 0;
626  memcpy(lpszDest, xguid, iLen*sizeof(WCHAR));
627  return iLen;
628 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int32_t INT
Definition: typedefs.h:56
const GUID * guid
WCHAR lpszDest[260]
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT cchMax
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define sprintfW
Definition: unicode.h:58

Referenced by SHRegGetCLSIDKeyW().

◆ UnregisterExtensionForMIMETypeA()

BOOL WINAPI UnregisterExtensionForMIMETypeA ( LPCSTR  lpszType)

Definition at line 2164 of file reg.c.

2165 {
2166  char szKey[MAX_PATH];
2167 
2168  TRACE("(%s)\n", debugstr_a(lpszType));
2169 
2170  if (!GetMIMETypeSubKeyA(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2171  return FALSE;
2172 
2174  return FALSE;
2175 
2177  return FALSE;
2178  return TRUE;
2179 }
#define TRUE
Definition: types.h:120
DWORD WINAPI SHDeleteOrphanKeyA(HKEY hKey, LPCSTR lpszSubKey)
Definition: reg.c:1674
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
DWORD WINAPI SHDeleteValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue)
Definition: reg.c:1741
BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:1984
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
static const char szExtensionA[]
Definition: reg.c:45

◆ UnregisterExtensionForMIMETypeW()

BOOL WINAPI UnregisterExtensionForMIMETypeW ( LPCWSTR  lpszType)

Definition at line 2186 of file reg.c.

2187 {
2188  WCHAR szKey[MAX_PATH];
2189 
2190  TRACE("(%s)\n", debugstr_w(lpszType));
2191 
2192  if (!GetMIMETypeSubKeyW(lpszType, szKey, MAX_PATH)) /* Get full path to the key */
2193  return FALSE;
2194 
2196  return FALSE;
2197 
2199  return FALSE;
2200  return TRUE;
2201 }
#define TRUE
Definition: types.h:120
static const WCHAR szExtensionW[]
Definition: reg.c:46
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
Definition: reg.c:1762
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen)
Definition: reg.c:2007
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
DWORD WINAPI SHDeleteOrphanKeyW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1703

◆ UnregisterMIMETypeForExtensionA()

BOOL WINAPI UnregisterMIMETypeForExtensionA ( LPCSTR  lpszSubKey)

Definition at line 1952 of file reg.c.

1953 {
1954  return !SHDeleteValueA(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeA);
1955 }
static const char lpszContentTypeA[]
Definition: reg.c:36
DWORD WINAPI SHDeleteValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue)
Definition: reg.c:1741
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

◆ UnregisterMIMETypeForExtensionW()

BOOL WINAPI UnregisterMIMETypeForExtensionW ( LPCWSTR  lpszSubKey)

Definition at line 1962 of file reg.c.

1963 {
1964  return !SHDeleteValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW);
1965 }
DWORD WINAPI SHDeleteValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue)
Definition: reg.c:1762
static const WCHAR lpszContentTypeW[]
Definition: reg.c:37
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ dwLenMimeDbContent

const DWORD dwLenMimeDbContent = 27
static

Definition at line 43 of file reg.c.

Referenced by GetMIMETypeSubKeyA(), and GetMIMETypeSubKeyW().

◆ lpszContentTypeA

const char lpszContentTypeA[] = "Content Type"
static

Definition at line 36 of file reg.c.

Referenced by RegisterMIMETypeForExtensionA(), and UnregisterMIMETypeForExtensionA().

◆ lpszContentTypeW

const WCHAR lpszContentTypeW[] = { 'C','o','n','t','e','n','t',' ','T','y','p','e','\0'}
static

Definition at line 37 of file reg.c.

Referenced by RegisterMIMETypeForExtensionW(), and UnregisterMIMETypeForExtensionW().

◆ szExtensionA

const char szExtensionA[] = "Extension"
static

◆ szExtensionW

const WCHAR szExtensionW[] = { 'E', 'x', 't','e','n','s','i','o','n','\0' }
static

◆ szMimeDbContentA

const char szMimeDbContentA[] = "MIME\\Database\\Content Type\\"
static

Definition at line 39 of file reg.c.

Referenced by GetMIMETypeSubKeyA().

◆ szMimeDbContentW

const WCHAR szMimeDbContentW[]
static
Initial value:
= { 'M', 'I', 'M','E','\\',
'D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',
' ','T','y','p','e','\\', 0 }

Definition at line 40 of file reg.c.

Referenced by GetMIMETypeSubKeyW().