[4121] | 1 | /*
|
---|
[6709] | 2 | Shell Registry Access
|
---|
[4121] | 3 | */
|
---|
| 4 | #include <string.h>
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include "winerror.h"
|
---|
| 7 | #include "winreg.h"
|
---|
| 8 | #include "debugtools.h"
|
---|
| 9 | #include "winnls.h"
|
---|
| 10 |
|
---|
| 11 | #include "shellapi.h"
|
---|
| 12 | #include "shlobj.h"
|
---|
| 13 | #include "shell32_main.h"
|
---|
[8614] | 14 | #include "undocshell.h"
|
---|
[4121] | 15 |
|
---|
| 16 | DEFAULT_DEBUG_CHANNEL(shell);
|
---|
| 17 |
|
---|
| 18 | /*************************************************************************
|
---|
[6709] | 19 | * SHRegOpenKeyA [SHELL32.506]
|
---|
[4121] | 20 | *
|
---|
| 21 | */
|
---|
| 22 | HRESULT WINAPI SHRegOpenKeyA(
|
---|
[6709] | 23 | HKEY hKey,
|
---|
| 24 | LPSTR lpSubKey,
|
---|
| 25 | LPHKEY phkResult)
|
---|
[4121] | 26 | {
|
---|
[6709] | 27 | TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
|
---|
| 28 | return RegOpenKeyA(hKey, lpSubKey, phkResult);
|
---|
[4121] | 29 | }
|
---|
| 30 |
|
---|
| 31 | /*************************************************************************
|
---|
[6709] | 32 | * SHRegOpenKeyW [NT4.0:SHELL32.507]
|
---|
[4121] | 33 | *
|
---|
| 34 | */
|
---|
| 35 | HRESULT WINAPI SHRegOpenKeyW (
|
---|
[6709] | 36 | HKEY hkey,
|
---|
| 37 | LPCWSTR lpszSubKey,
|
---|
| 38 | LPHKEY retkey)
|
---|
[4121] | 39 | {
|
---|
[6709] | 40 | WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
|
---|
| 41 | return RegOpenKeyW( hkey, lpszSubKey, retkey );
|
---|
[4121] | 42 | }
|
---|
| 43 |
|
---|
| 44 | /*************************************************************************
|
---|
| 45 | * SHRegQueryValueExA [SHELL32.509]
|
---|
| 46 | *
|
---|
| 47 | */
|
---|
| 48 | HRESULT WINAPI SHRegQueryValueExA(
|
---|
[6709] | 49 | HKEY hkey,
|
---|
| 50 | LPSTR lpValueName,
|
---|
| 51 | LPDWORD lpReserved,
|
---|
| 52 | LPDWORD lpType,
|
---|
| 53 | LPBYTE lpData,
|
---|
| 54 | LPDWORD lpcbData)
|
---|
[4121] | 55 | {
|
---|
[6709] | 56 | TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
---|
| 57 | return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
---|
[4121] | 58 | }
|
---|
| 59 |
|
---|
| 60 | /*************************************************************************
|
---|
[6709] | 61 | * SHRegQueryValueW [NT4.0:SHELL32.510]
|
---|
[4121] | 62 | *
|
---|
| 63 | */
|
---|
| 64 | HRESULT WINAPI SHRegQueryValueW(
|
---|
[6709] | 65 | HKEY hkey,
|
---|
| 66 | LPWSTR lpszSubKey,
|
---|
| 67 | LPWSTR lpszData,
|
---|
| 68 | LPDWORD lpcbData )
|
---|
[4121] | 69 | {
|
---|
[6709] | 70 | WARN("0x%04x %s %p %p semi-stub\n",
|
---|
| 71 | hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
|
---|
| 72 | return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
|
---|
[4121] | 73 | }
|
---|
| 74 |
|
---|
| 75 | /*************************************************************************
|
---|
[6709] | 76 | * SHRegQueryValueExW [NT4.0:SHELL32.511]
|
---|
[4121] | 77 | *
|
---|
[6709] | 78 | * FIXME
|
---|
[4121] | 79 | * if the datatype REG_EXPAND_SZ then expand the string and change
|
---|
[6709] | 80 | * *pdwType to REG_SZ.
|
---|
[4121] | 81 | */
|
---|
| 82 | HRESULT WINAPI SHRegQueryValueExW (
|
---|
[6709] | 83 | HKEY hkey,
|
---|
| 84 | LPWSTR pszValue,
|
---|
| 85 | LPDWORD pdwReserved,
|
---|
| 86 | LPDWORD pdwType,
|
---|
| 87 | LPVOID pvData,
|
---|
| 88 | LPDWORD pcbData)
|
---|
[4121] | 89 | {
|
---|
[6709] | 90 | DWORD ret;
|
---|
| 91 | WARN("0x%04x %s %p %p %p %p semi-stub\n",
|
---|
| 92 | hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
|
---|
| 93 | ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
|
---|
| 94 | return ret;
|
---|
[4121] | 95 | }
|
---|
| 96 |
|
---|
| 97 | /*************************************************************************
|
---|
| 98 | * SHRegDeleteKeyA [SHELL32]
|
---|
| 99 | */
|
---|
| 100 | HRESULT WINAPI SHRegDeleteKeyA(
|
---|
[6709] | 101 | HKEY hkey,
|
---|
| 102 | LPCSTR pszSubKey)
|
---|
[4121] | 103 | {
|
---|
[6709] | 104 | FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
|
---|
[5618] | 105 | #ifdef __WIN32OS2__
|
---|
| 106 | return RegDeleteKeyA(hkey,pszSubKey);
|
---|
| 107 | #else
|
---|
[6709] | 108 | return 0;
|
---|
[5618] | 109 | #endif
|
---|
[4121] | 110 | }
|
---|
| 111 |
|
---|
| 112 | /*************************************************************************
|
---|
| 113 | * SHRegDeleteKeyW [SHELL32]
|
---|
| 114 | */
|
---|
| 115 | HRESULT WINAPI SHRegDeleteKeyW(
|
---|
[6709] | 116 | HKEY hkey,
|
---|
| 117 | LPCWSTR pszSubKey)
|
---|
[4121] | 118 | {
|
---|
[6709] | 119 | FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
|
---|
[5618] | 120 | #ifdef __WIN32OS2__
|
---|
| 121 | return RegDeleteKeyW(hkey,pszSubKey);
|
---|
| 122 | #else
|
---|
[6709] | 123 | return 0;
|
---|
[5618] | 124 | #endif
|
---|
[4121] | 125 | }
|
---|
| 126 |
|
---|
| 127 | /*************************************************************************
|
---|
[6709] | 128 | * SHRegCloseKey [NT4.0:SHELL32.505]
|
---|
[4121] | 129 | *
|
---|
| 130 | */
|
---|
| 131 | HRESULT WINAPI SHRegCloseKey (HKEY hkey)
|
---|
| 132 | {
|
---|
[6709] | 133 | TRACE("0x%04x\n",hkey);
|
---|
| 134 | return RegCloseKey( hkey );
|
---|
[4121] | 135 | }
|
---|
[5618] | 136 |
|
---|
| 137 | #ifndef __WIN32OS2__
|
---|
| 138 |
|
---|
| 139 | /* 16-bit functions */
|
---|
| 140 |
|
---|
| 141 | /* 0 and 1 are valid rootkeys in win16 shell.dll and are used by
|
---|
| 142 | * some programs. Do not remove those cases. -MM
|
---|
| 143 | */
|
---|
| 144 | static inline void fix_win16_hkey( HKEY *hkey )
|
---|
| 145 | {
|
---|
| 146 | if (*hkey == 0 || *hkey == 1) *hkey = HKEY_CLASSES_ROOT;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | /******************************************************************************
|
---|
| 150 | * RegOpenKey16 [SHELL.1]
|
---|
| 151 | */
|
---|
| 152 | DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
|
---|
| 153 | {
|
---|
| 154 | fix_win16_hkey( &hkey );
|
---|
| 155 | return RegOpenKeyA( hkey, name, retkey );
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | /******************************************************************************
|
---|
| 159 | * RegCreateKey16 [SHELL.2]
|
---|
| 160 | */
|
---|
| 161 | DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
|
---|
| 162 | {
|
---|
| 163 | fix_win16_hkey( &hkey );
|
---|
| 164 | return RegCreateKeyA( hkey, name, retkey );
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | /******************************************************************************
|
---|
| 168 | * RegCloseKey16 [SHELL.3]
|
---|
| 169 | */
|
---|
| 170 | DWORD WINAPI RegCloseKey16( HKEY hkey )
|
---|
| 171 | {
|
---|
| 172 | fix_win16_hkey( &hkey );
|
---|
| 173 | return RegCloseKey( hkey );
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | /******************************************************************************
|
---|
| 177 | * RegDeleteKey16 [SHELL.4]
|
---|
| 178 | */
|
---|
| 179 | DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
|
---|
| 180 | {
|
---|
| 181 | fix_win16_hkey( &hkey );
|
---|
| 182 | return RegDeleteKeyA( hkey, name );
|
---|
| 183 | }
|
---|
| 184 |
|
---|
| 185 | /******************************************************************************
|
---|
| 186 | * RegSetValue16 [SHELL.5]
|
---|
| 187 | */
|
---|
| 188 | DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
|
---|
| 189 | {
|
---|
| 190 | fix_win16_hkey( &hkey );
|
---|
| 191 | return RegSetValueA( hkey, name, type, data, count );
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | /******************************************************************************
|
---|
| 195 | * RegQueryValue16 [SHELL.6]
|
---|
| 196 | *
|
---|
| 197 | * NOTES
|
---|
| 198 | * Is this HACK still applicable?
|
---|
| 199 | *
|
---|
| 200 | * HACK
|
---|
| 201 | * The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
|
---|
| 202 | * mask out the high 16 bit. This (not so much incidently) hopefully fixes
|
---|
| 203 | * Aldus FH4)
|
---|
| 204 | */
|
---|
| 205 | DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count )
|
---|
| 206 | {
|
---|
| 207 | fix_win16_hkey( &hkey );
|
---|
| 208 | if (count) *count &= 0xffff;
|
---|
| 209 | return RegQueryValueA( hkey, name, data, count );
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | /******************************************************************************
|
---|
| 213 | * RegEnumKey16 [SHELL.7]
|
---|
| 214 | */
|
---|
| 215 | DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
|
---|
| 216 | {
|
---|
| 217 | fix_win16_hkey( &hkey );
|
---|
| 218 | return RegEnumKeyA( hkey, index, name, name_len );
|
---|
| 219 | }
|
---|
| 220 | #endif //__WIN32OS2__
|
---|