Merged msacm and msacm32 dlls.
[wine] / dlls / shell32 / shellreg.c
1 /*
2         Shell Registry Access
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 #include "winversion.h"
11 #include "heap.h"
12
13 #include "shellapi.h"
14 #include "shlobj.h"
15 #include "shell32_main.h"
16 #include "wine/undocshell.h"
17
18 DEFAULT_DEBUG_CHANNEL(shell);
19
20 /*************************************************************************
21  * SHRegOpenKeyA                                [SHELL32.506]
22  *
23  */
24 HRESULT WINAPI SHRegOpenKeyA(
25         HKEY hKey,
26         LPSTR lpSubKey,
27         LPHKEY phkResult)
28 {
29         TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
30         return RegOpenKeyA(hKey, lpSubKey, phkResult);
31 }
32
33 /*************************************************************************
34  * SHRegOpenKeyW                                [NT4.0:SHELL32.507]
35  *
36  */
37 HRESULT WINAPI SHRegOpenKeyW (
38         HKEY hkey,
39         LPCWSTR lpszSubKey,
40         LPHKEY retkey)
41 {
42         WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
43         return RegOpenKeyW( hkey, lpszSubKey, retkey );
44 }
45
46 /*************************************************************************
47  * SHRegQueryValueExA SHQueryValueExA           [SHELL32.509][SHLWAPI.@]
48  *
49  */
50 HRESULT WINAPI SHRegQueryValueExA(
51         HKEY hkey,
52         LPSTR lpValueName,
53         LPDWORD lpReserved,
54         LPDWORD lpType,
55         LPBYTE lpData,
56         LPDWORD lpcbData)
57 {
58         TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
59         return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
60 }
61
62 /*************************************************************************
63  * SHRegQueryValueW                             [NT4.0:SHELL32.510]
64  *
65  */
66 HRESULT WINAPI SHRegQueryValueW(
67         HKEY hkey,
68         LPWSTR lpszSubKey,
69         LPWSTR lpszData,
70         LPDWORD lpcbData )
71 {
72         WARN("0x%04x %s %p %p semi-stub\n",
73                 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
74         return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
75 }
76
77 /*************************************************************************
78  * SHRegQueryValueExW, SHQueryValueExW  [NT4.0:SHELL32.511][SHLWAPI.@]
79  *
80  * FIXME 
81  *  if the datatype REG_EXPAND_SZ then expand the string and change
82  *  *pdwType to REG_SZ. 
83  */
84 HRESULT WINAPI SHRegQueryValueExW (
85         HKEY hkey,
86         LPWSTR pszValue,
87         LPDWORD pdwReserved,
88         LPDWORD pdwType,
89         LPVOID pvData,
90         LPDWORD pcbData)
91 {
92         DWORD ret;
93         WARN("0x%04x %s %p %p %p %p semi-stub\n",
94                 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
95         ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
96         return ret;
97 }
98
99  /* SHGetValue: Gets a value from the registry */
100
101 /*************************************************************************
102  * SHGetValueA
103  *
104  * Gets a value from the registry
105  */
106 DWORD WINAPI SHGetValueA(
107         HKEY     hkey,
108         LPCSTR   pSubKey,
109         LPCSTR   pValue,
110         LPDWORD  pwType,
111         LPVOID   pvData,
112         LPDWORD  pbData)
113 {
114         HKEY hSubKey;
115         DWORD res;
116         
117         TRACE("(%s %s)\n", pSubKey, pValue);
118         
119         if((res = RegOpenKeyA(hkey, pSubKey, &hSubKey))) return res;
120         res = RegQueryValueExA(hSubKey, pValue, 0, pwType, pvData, pbData);
121         RegCloseKey( hSubKey );
122         
123         return res;
124 }
125
126 /*************************************************************************
127  * SHGetValueW
128  *
129  * Gets a value from the registry
130  */
131 DWORD WINAPI SHGetValueW(
132         HKEY     hkey,
133         LPCWSTR  pSubKey,
134         LPCWSTR  pValue,
135         LPDWORD  pwType,
136         LPVOID   pvData,
137         LPDWORD  pbData)
138 {
139         HKEY hSubKey;
140         DWORD res;
141         
142         TRACE("(%s %s)\n", debugstr_w(pSubKey), debugstr_w(pValue));
143         
144         if((res = RegOpenKeyW(hkey, pSubKey, &hSubKey))) return res;
145         res = RegQueryValueExW(hSubKey, pValue, 0, pwType, pvData, pbData);
146         RegCloseKey( hSubKey );
147         
148         return res;
149 }
150
151 /* gets a user-specific registry value. */
152
153 /*************************************************************************
154  * SHRegGetUSValueA
155  *
156  * Gets a user-specific registry value
157  */
158 LONG WINAPI SHRegGetUSValueA(
159         LPCSTR   pSubKey,
160         LPCSTR   pValue,
161         LPDWORD  pwType,
162         LPVOID   pvData,
163         LPDWORD  pbData,
164         BOOL     fIgnoreHKCU,
165         LPVOID   pDefaultData,
166         DWORD    wDefaultDataSize)
167 {
168         FIXME("(%p),stub!\n", pSubKey);
169         return ERROR_SUCCESS;  /* return success */
170 }
171
172 /*************************************************************************
173  * SHRegGetUSValueW
174  *
175  * Gets a user-specific registry value
176  */
177 LONG WINAPI SHRegGetUSValueW(
178         LPCWSTR  pSubKey,
179         LPCWSTR  pValue,
180         LPDWORD  pwType,
181         LPVOID   pvData,
182         LPDWORD  pbData,
183         BOOL     flagIgnoreHKCU,
184         LPVOID   pDefaultData,
185         DWORD    wDefaultDataSize)
186 {
187         FIXME("(%p),stub!\n", pSubKey);
188         return ERROR_SUCCESS;  /* return success */
189 }
190
191 /*************************************************************************
192  * SHRegGetBoolUSValueA
193  */
194 BOOL WINAPI SHRegGetBoolUSValueA(
195         LPCSTR pszSubKey,
196         LPCSTR pszValue,
197         BOOL fIgnoreHKCU,
198         BOOL fDefault)
199 {
200         FIXME("%s %s\n", pszSubKey,pszValue);
201         return fDefault;
202 }
203
204 /*************************************************************************
205  * SHRegGetBoolUSValueW
206  */
207 BOOL WINAPI SHRegGetBoolUSValueW(
208         LPCWSTR pszSubKey,
209         LPCWSTR pszValue,
210         BOOL fIgnoreHKCU,
211         BOOL fDefault)
212 {
213         FIXME("%s %s\n", debugstr_w(pszSubKey),debugstr_w(pszValue));
214         return fDefault;
215 }
216
217 /*************************************************************************
218  *      SHRegQueryUSValueA      [SHLWAPI]
219  */
220 LONG WINAPI SHRegQueryUSValueA(
221         HKEY/*HUSKEY*/ hUSKey,
222         LPCSTR pszValue,
223         LPDWORD pdwType,
224         void *pvData,
225         LPDWORD pcbData,
226         BOOL fIgnoreHKCU,
227         void *pvDefaultData,
228         DWORD dwDefaultDataSize)
229 {
230         FIXME("%s stub\n",pszValue);
231         return 1;
232 }
233
234 /*************************************************************************
235  * SHRegGetPathA
236  */
237 DWORD WINAPI SHRegGetPathA(
238         HKEY hKey,
239         LPCSTR pcszSubKey,
240         LPCSTR pcszValue,
241         LPSTR pszPath,
242         DWORD dwFlags)
243 {
244         FIXME("%s %s\n", pcszSubKey, pcszValue);
245         return 0;
246 }
247
248 /*************************************************************************
249  * SHRegGetPathW
250  */
251 DWORD WINAPI SHRegGetPathW(
252         HKEY hKey,
253         LPCWSTR pcszSubKey,
254         LPCWSTR pcszValue,
255         LPWSTR pszPath,
256         DWORD dwFlags)
257 {
258         FIXME("%s %s\n", debugstr_w(pcszSubKey), debugstr_w(pcszValue));
259         return 0;
260 }
261 /*************************************************************************
262  * SHRegDeleteKeyA and SHDeleteKeyA
263  */
264 HRESULT WINAPI SHRegDeleteKeyA(
265         HKEY hkey,
266         LPCSTR pszSubKey)
267 {
268         FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
269         return 0;
270 }
271
272 /*************************************************************************
273  * SHRegDeleteKeyW and SHDeleteKeyA
274  */
275 HRESULT WINAPI SHRegDeleteKeyW(
276         HKEY hkey,
277         LPCWSTR pszSubKey)
278 {
279         FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
280         return 0;
281 }
282
283 /*************************************************************************
284  *      SHSetValueA     [SHLWAPI]
285  */
286 DWORD WINAPI SHSetValueA(
287         HKEY hkey,
288         LPCSTR pszSubKey,
289         LPCSTR pszValue,
290         DWORD dwType,
291         LPCVOID pvData,
292         DWORD cbData)
293 {
294         FIXME("(%s %s)stub\n",pszSubKey, pszValue);
295         return 1;
296 }
297
298 /*************************************************************************
299  * SHRegCloseKey                        [NT4.0:SHELL32.505]
300  *
301  */
302 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
303 {
304         TRACE("0x%04x\n",hkey);
305         return RegCloseKey( hkey );
306 }