Make the Wine trace facilities accessible from Winelib applications.
[wine/gsoc_dplay.git] / dlls / shell32 / shellreg.c
blob832473b229eacea872c009ccc5f94359f1934109
1 /*
2 Shell Registry Access
3 */
5 #include "config.h"
7 #include <string.h>
8 #include <stdio.h>
10 #include "shellapi.h"
11 #include "shlobj.h"
12 #include "winerror.h"
13 #include "winreg.h"
14 #include "winnls.h"
16 #include "undocshell.h"
17 #include "wine/winbase16.h"
18 #include "shell32_main.h"
20 #include "debugtools.h"
22 DEFAULT_DEBUG_CHANNEL(shell);
24 /*************************************************************************
25 * SHRegOpenKeyA [SHELL32.506]
28 HRESULT WINAPI SHRegOpenKeyA(
29 HKEY hKey,
30 LPSTR lpSubKey,
31 LPHKEY phkResult)
33 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
34 return RegOpenKeyA(hKey, lpSubKey, phkResult);
37 /*************************************************************************
38 * SHRegOpenKeyW [SHELL32.507] NT 4.0
41 HRESULT WINAPI SHRegOpenKeyW (
42 HKEY hkey,
43 LPCWSTR lpszSubKey,
44 LPHKEY retkey)
46 WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
47 return RegOpenKeyW( hkey, lpszSubKey, retkey );
50 /*************************************************************************
51 * SHRegQueryValueExA [SHELL32.509]
54 HRESULT WINAPI SHRegQueryValueExA(
55 HKEY hkey,
56 LPSTR lpValueName,
57 LPDWORD lpReserved,
58 LPDWORD lpType,
59 LPBYTE lpData,
60 LPDWORD lpcbData)
62 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
63 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
66 /*************************************************************************
67 * SHRegQueryValueW [SHELL32.510] NT4.0
70 HRESULT WINAPI SHRegQueryValueW(
71 HKEY hkey,
72 LPWSTR lpszSubKey,
73 LPWSTR lpszData,
74 LPDWORD lpcbData )
76 WARN("0x%04x %s %p %p semi-stub\n",
77 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
78 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
81 /*************************************************************************
82 * SHRegQueryValueExW [SHELL32.511] NT4.0
84 * FIXME
85 * if the datatype REG_EXPAND_SZ then expand the string and change
86 * *pdwType to REG_SZ.
88 HRESULT WINAPI SHRegQueryValueExW (
89 HKEY hkey,
90 LPWSTR pszValue,
91 LPDWORD pdwReserved,
92 LPDWORD pdwType,
93 LPVOID pvData,
94 LPDWORD pcbData)
96 DWORD ret;
97 WARN("0x%04x %s %p %p %p %p semi-stub\n",
98 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
99 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
100 return ret;
103 /*************************************************************************
104 * SHRegDeleteKeyA [SHELL32.?]
106 HRESULT WINAPI SHRegDeleteKeyA(
107 HKEY hkey,
108 LPCSTR pszSubKey)
110 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
111 return 0;
114 /*************************************************************************
115 * SHRegDeleteKeyW [SHELL32.512]
117 HRESULT WINAPI SHRegDeleteKeyW(
118 HKEY hkey,
119 LPCWSTR pszSubKey)
121 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
122 return 0;
125 /*************************************************************************
126 * SHRegCloseKey [SHELL32.505] NT 4.0
129 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
131 TRACE("0x%04x\n",hkey);
132 return RegCloseKey( hkey );
136 /* 16-bit functions */
138 /* 0 and 1 are valid rootkeys in win16 shell.dll and are used by
139 * some programs. Do not remove those cases. -MM
141 static inline void fix_win16_hkey( HKEY *hkey )
143 if (*hkey == 0 || *hkey == 1) *hkey = HKEY_CLASSES_ROOT;
146 /******************************************************************************
147 * RegOpenKey [SHELL.1]
149 DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
151 fix_win16_hkey( &hkey );
152 return RegOpenKeyA( hkey, name, retkey );
155 /******************************************************************************
156 * RegCreateKey [SHELL.2]
158 DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
160 fix_win16_hkey( &hkey );
161 return RegCreateKeyA( hkey, name, retkey );
164 /******************************************************************************
165 * RegCloseKey [SHELL.3]
167 DWORD WINAPI RegCloseKey16( HKEY hkey )
169 fix_win16_hkey( &hkey );
170 return RegCloseKey( hkey );
173 /******************************************************************************
174 * RegDeleteKey [SHELL.4]
176 DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
178 fix_win16_hkey( &hkey );
179 return RegDeleteKeyA( hkey, name );
182 /******************************************************************************
183 * RegSetValue [SHELL.5]
185 DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
187 fix_win16_hkey( &hkey );
188 return RegSetValueA( hkey, name, type, data, count );
191 /******************************************************************************
192 * RegQueryValue [SHELL.6]
194 * NOTES
195 * Is this HACK still applicable?
197 * HACK
198 * The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
199 * mask out the high 16 bit. This (not so much incidently) hopefully fixes
200 * Aldus FH4)
202 DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count )
204 fix_win16_hkey( &hkey );
205 if (count) *count &= 0xffff;
206 return RegQueryValueA( hkey, name, data, count );
209 /******************************************************************************
210 * RegEnumKey [SHELL.7]
212 DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
214 fix_win16_hkey( &hkey );
215 return RegEnumKeyA( hkey, index, name, name_len );