kernelbase/tests: Use win_skip() for missing APIs.
[wine.git] / dlls / shell32 / shellreg.c
blobdedf67babc176aac0b92a0f551667ba11989ba39
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <string.h>
22 #include <stdarg.h>
23 #include <stdio.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "shellapi.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "shlobj.h"
31 #include "winreg.h"
33 #include "shell32_main.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(shell);
39 /*************************************************************************
40 * SHRegOpenKeyA [SHELL32.506]
43 HRESULT WINAPI SHRegOpenKeyA(
44 HKEY hKey,
45 LPSTR lpSubKey,
46 PHKEY phkResult)
48 TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
49 return RegOpenKeyA(hKey, lpSubKey, phkResult);
52 /*************************************************************************
53 * SHRegOpenKeyW [SHELL32.507] NT 4.0
56 HRESULT WINAPI SHRegOpenKeyW (
57 HKEY hkey,
58 LPCWSTR lpszSubKey,
59 PHKEY retkey)
61 WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
62 return RegOpenKeyW( hkey, lpszSubKey, retkey );
65 /*************************************************************************
66 * SHRegQueryValueA [SHELL32.508]
69 HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
71 TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue);
72 return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue);
75 /*************************************************************************
76 * SHRegQueryValueExA [SHELL32.509]
79 HRESULT WINAPI SHRegQueryValueExA(
80 HKEY hkey,
81 LPSTR lpValueName,
82 LPDWORD lpReserved,
83 LPDWORD lpType,
84 LPBYTE lpData,
85 LPDWORD lpcbData)
87 TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
88 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
91 /*************************************************************************
92 * SHRegQueryValueW [SHELL32.510] NT4.0
95 HRESULT WINAPI SHRegQueryValueW(
96 HKEY hkey,
97 LPWSTR lpszSubKey,
98 LPWSTR lpszData,
99 LPDWORD lpcbData )
101 WARN("%p %s %p %p semi-stub\n",
102 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
103 return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData );
106 /*************************************************************************
107 * SHRegQueryValueExW [SHELL32.511] NT4.0
109 * FIXME
110 * if the datatype REG_EXPAND_SZ then expand the string and change
111 * *pdwType to REG_SZ.
113 HRESULT WINAPI SHRegQueryValueExW (
114 HKEY hkey,
115 LPWSTR pszValue,
116 LPDWORD pdwReserved,
117 LPDWORD pdwType,
118 LPVOID pvData,
119 LPDWORD pcbData)
121 DWORD ret;
122 WARN("%p %s %p %p %p %p semi-stub\n",
123 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
124 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
125 return ret;
128 /*************************************************************************
129 * SHRegDeleteKeyW [SHELL32.512]
131 HRESULT WINAPI SHRegDeleteKeyW(
132 HKEY hkey,
133 LPCWSTR pszSubKey)
135 FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey));
136 return 0;
139 /*************************************************************************
140 * SHRegCloseKey [SHELL32.505] NT 4.0
143 HRESULT WINAPI SHRegCloseKey (HKEY hkey)
145 TRACE("%p\n",hkey);
146 return RegCloseKey( hkey );
149 /*************************************************************************
150 * SHCreateSessionKey [SHELL32.723]
153 HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey)
155 DWORD session, ret;
156 WCHAR str[ARRAY_SIZE(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\") + 16];
158 if (hkey)
159 *hkey = NULL;
161 if (!access)
162 return E_ACCESSDENIED;
164 if (!ProcessIdToSessionId(GetCurrentProcessId(), &session))
165 return E_INVALIDARG;
167 swprintf(str, ARRAY_SIZE(str),
168 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%u", session);
169 TRACE("using session key %s\n", debugstr_w(str));
171 ret = RegCreateKeyExW(HKEY_CURRENT_USER, str, 0, NULL, REG_OPTION_VOLATILE, access, NULL, hkey, NULL);
172 return HRESULT_FROM_WIN32( ret );