Convert HKEY to a void*.
[wine/gsoc_dplay.git] / dlls / shell32 / shellreg.c
bloba6d7f46d3043e64b871901b01cb8ecc122a9f134
1 /*
2 * Shell Registry Access
4 * Copyright 2000 Juergen Schmied
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "config.h"
23 #include <string.h>
24 #include <stdio.h>
26 #include "shellapi.h"
27 #include "shlobj.h"
28 #include "winerror.h"
29 #include "winreg.h"
30 #include "winnls.h"
32 #include "undocshell.h"
33 #include "wine/winbase16.h"
34 #include "shell32_main.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(shell);
40 /*************************************************************************
41 * SHRegOpenKeyA [SHELL32.506]
44 HRESULT WINAPI SHRegOpenKeyA(
45 HKEY hKey,
46 LPSTR lpSubKey,
47 LPHKEY phkResult)
49 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
50 return RegOpenKeyA(hKey, lpSubKey, phkResult);
53 /*************************************************************************
54 * SHRegOpenKeyW [SHELL32.507] NT 4.0
57 HRESULT WINAPI SHRegOpenKeyW (
58 HKEY hkey,
59 LPCWSTR lpszSubKey,
60 LPHKEY retkey)
62 WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
63 return RegOpenKeyW( hkey, lpszSubKey, retkey );
66 /*************************************************************************
67 * SHRegQueryValueExA [SHELL32.509]
70 HRESULT WINAPI SHRegQueryValueExA(
71 HKEY hkey,
72 LPSTR lpValueName,
73 LPDWORD lpReserved,
74 LPDWORD lpType,
75 LPBYTE lpData,
76 LPDWORD lpcbData)
78 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
79 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
82 /*************************************************************************
83 * SHRegQueryValueW [SHELL32.510] NT4.0
86 HRESULT WINAPI SHRegQueryValueW(
87 HKEY hkey,
88 LPWSTR lpszSubKey,
89 LPWSTR lpszData,
90 LPDWORD lpcbData )
92 WARN("0x%04x %s %p %p semi-stub\n",
93 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
94 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
97 /*************************************************************************
98 * SHRegQueryValueExW [SHELL32.511] NT4.0
100 * FIXME
101 * if the datatype REG_EXPAND_SZ then expand the string and change
102 * *pdwType to REG_SZ.
104 HRESULT WINAPI SHRegQueryValueExW (
105 HKEY hkey,
106 LPWSTR pszValue,
107 LPDWORD pdwReserved,
108 LPDWORD pdwType,
109 LPVOID pvData,
110 LPDWORD pcbData)
112 DWORD ret;
113 WARN("0x%04x %s %p %p %p %p semi-stub\n",
114 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
115 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
116 return ret;
119 /*************************************************************************
120 * SHRegDeleteKeyA [SHELL32.?]
122 HRESULT WINAPI SHRegDeleteKeyA(
123 HKEY hkey,
124 LPCSTR pszSubKey)
126 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
127 return 0;
130 /*************************************************************************
131 * SHRegDeleteKeyW [SHELL32.512]
133 HRESULT WINAPI SHRegDeleteKeyW(
134 HKEY hkey,
135 LPCWSTR pszSubKey)
137 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
138 return 0;
141 /*************************************************************************
142 * SHRegCloseKey [SHELL32.505] NT 4.0
145 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
147 TRACE("0x%04x\n",hkey);
148 return RegCloseKey( hkey );
152 /* 16-bit functions */
154 /* 0 and 1 are valid rootkeys in win16 shell.dll and are used by
155 * some programs. Do not remove those cases. -MM
157 static inline void fix_win16_hkey( HKEY *hkey )
159 if (*hkey == 0 || *hkey == (HKEY)1) *hkey = HKEY_CLASSES_ROOT;
162 /******************************************************************************
163 * RegOpenKey [SHELL.1]
165 DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
167 fix_win16_hkey( &hkey );
168 return RegOpenKeyA( hkey, name, retkey );
171 /******************************************************************************
172 * RegCreateKey [SHELL.2]
174 DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
176 fix_win16_hkey( &hkey );
177 return RegCreateKeyA( hkey, name, retkey );
180 /******************************************************************************
181 * RegCloseKey [SHELL.3]
183 DWORD WINAPI RegCloseKey16( HKEY hkey )
185 fix_win16_hkey( &hkey );
186 return RegCloseKey( hkey );
189 /******************************************************************************
190 * RegDeleteKey [SHELL.4]
192 DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
194 fix_win16_hkey( &hkey );
195 return RegDeleteKeyA( hkey, name );
198 /******************************************************************************
199 * RegSetValue [SHELL.5]
201 DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
203 fix_win16_hkey( &hkey );
204 return RegSetValueA( hkey, name, type, data, count );
207 /******************************************************************************
208 * RegQueryValue [SHELL.6]
210 * NOTES
211 * Is this HACK still applicable?
213 * HACK
214 * The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
215 * mask out the high 16 bit. This (not so much incidently) hopefully fixes
216 * Aldus FH4)
218 DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count )
220 fix_win16_hkey( &hkey );
221 if (count) *count &= 0xffff;
222 return RegQueryValueA( hkey, name, data, count );
225 /******************************************************************************
226 * RegEnumKey [SHELL.7]
228 DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
230 fix_win16_hkey( &hkey );
231 return RegEnumKeyA( hkey, index, name, name_len );