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 <wine/config.h>
25 #define WIN32_NO_STATUS
32 #include <wine/debug.h>
34 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
36 /*************************************************************************
37 * SHRegOpenKeyA [SHELL32.506]
40 HRESULT WINAPI
SHRegOpenKeyA(
45 TRACE("(%p, %s, %p)\n", hKey
, debugstr_a(lpSubKey
), phkResult
);
46 return RegOpenKeyA(hKey
, lpSubKey
, phkResult
);
49 /*************************************************************************
50 * SHRegOpenKeyW [SHELL32.507] NT 4.0
53 HRESULT WINAPI
SHRegOpenKeyW (
58 WARN("%p %s %p\n",hkey
,debugstr_w(lpszSubKey
),retkey
);
59 return RegOpenKeyW( hkey
, lpszSubKey
, retkey
);
62 /*************************************************************************
63 * SHRegQueryValueA [SHELL32.508]
66 HRESULT WINAPI
SHRegQueryValueA(HKEY hkey
, LPSTR lpSubKey
, LPSTR lpValue
, LPDWORD lpcbValue
)
68 TRACE("(%p %s %p %p)\n", hkey
, debugstr_a(lpSubKey
), lpValue
, lpcbValue
);
69 return RegQueryValueA(hkey
, lpSubKey
, lpValue
, (LONG
*)lpcbValue
);
72 /*************************************************************************
73 * SHRegQueryValueExA [SHELL32.509]
76 HRESULT WINAPI
SHRegQueryValueExA(
84 TRACE("%p %s %p %p %p %p\n", hkey
, lpValueName
, lpReserved
, lpType
, lpData
, lpcbData
);
85 return RegQueryValueExA (hkey
, lpValueName
, lpReserved
, lpType
, lpData
, lpcbData
);
88 /*************************************************************************
89 * SHRegQueryValueW [SHELL32.510] NT4.0
92 HRESULT WINAPI
SHRegQueryValueW(
98 WARN("%p %s %p %p semi-stub\n",
99 hkey
, debugstr_w(lpszSubKey
), lpszData
, lpcbData
);
100 return RegQueryValueW( hkey
, lpszSubKey
, lpszData
, (LONG
*)lpcbData
);
103 /*************************************************************************
104 * SHRegQueryValueExW [SHELL32.511] NT4.0
107 * if the datatype REG_EXPAND_SZ then expand the string and change
108 * *pdwType to REG_SZ.
110 HRESULT WINAPI
SHRegQueryValueExW (
119 WARN("%p %s %p %p %p %p semi-stub\n",
120 hkey
, debugstr_w(pszValue
), pdwReserved
, pdwType
, pvData
, pcbData
);
121 ret
= RegQueryValueExW ( hkey
, pszValue
, pdwReserved
, pdwType
, pvData
, pcbData
);
125 /*************************************************************************
126 * SHRegDeleteKeyW [SHELL32.512]
128 HRESULT WINAPI
SHRegDeleteKeyW(
132 FIXME("hkey=%p, %s\n", hkey
, debugstr_w(pszSubKey
));
136 /*************************************************************************
137 * SHRegCloseKey [SHELL32.505] NT 4.0
140 HRESULT WINAPI
SHRegCloseKey (HKEY hkey
)
143 return RegCloseKey( hkey
);
146 /*************************************************************************
147 * SHCreateSessionKey [SHELL32.723]
151 SHCreateSessionKey(REGSAM samDesired
, PHKEY phKey
)
154 static WCHAR wszSessionKey
[256];
157 if (!wszSessionKey
[0]) // FIXME: Critical Section
161 if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ
, &hToken
))
163 TOKEN_STATISTICS Stats
;
166 if (GetTokenInformation(hToken
, TokenStatistics
, &Stats
, sizeof(Stats
), &ReturnLength
))
168 swprintf(wszSessionKey
,
169 L
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%08x%08x",
170 Stats
.AuthenticationId
.HighPart
, Stats
.AuthenticationId
.LowPart
);
173 hr
= HRESULT_FROM_WIN32(GetLastError());
178 hr
= HRESULT_FROM_WIN32(GetLastError());
183 Error
= RegCreateKeyExW(HKEY_LOCAL_MACHINE
, wszSessionKey
, 0, NULL
,
184 REG_OPTION_VOLATILE
, samDesired
, NULL
, phKey
, NULL
);
185 if (Error
!= ERROR_SUCCESS
)
186 hr
= HRESULT_FROM_WIN32(Error
);