2000-06-02 01:25:44 +02:00
|
|
|
/*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Shell Registry Access
|
|
|
|
*
|
|
|
|
* Copyright 2000 Juergen Schmied
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*/
|
2001-07-20 20:00:00 +02:00
|
|
|
|
2000-06-02 01:25:44 +02:00
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-06-02 01:25:44 +02:00
|
|
|
#include <stdio.h>
|
2001-07-20 20:00:00 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2001-07-20 20:00:00 +02:00
|
|
|
#include "shellapi.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
2001-07-20 20:00:00 +02:00
|
|
|
#include "shlobj.h"
|
2000-06-02 01:25:44 +02:00
|
|
|
#include "winreg.h"
|
|
|
|
|
2018-04-19 11:59:36 +02:00
|
|
|
#include "shell32_main.h"
|
2001-07-20 20:00:00 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2000-06-02 01:25:44 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
2000-06-02 01:25:44 +02:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHRegOpenKeyA [SHELL32.506]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegOpenKeyA(
|
|
|
|
HKEY hKey,
|
|
|
|
LPSTR lpSubKey,
|
2002-10-03 21:46:27 +02:00
|
|
|
PHKEY phkResult)
|
2000-06-02 01:25:44 +02:00
|
|
|
{
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
|
2000-06-02 01:25:44 +02:00
|
|
|
return RegOpenKeyA(hKey, lpSubKey, phkResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* SHRegOpenKeyW [SHELL32.507] NT 4.0
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegOpenKeyW (
|
|
|
|
HKEY hkey,
|
|
|
|
LPCWSTR lpszSubKey,
|
2002-10-03 21:46:27 +02:00
|
|
|
PHKEY retkey)
|
2000-06-02 01:25:44 +02:00
|
|
|
{
|
2002-11-22 00:56:42 +01:00
|
|
|
WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
|
2000-06-02 01:25:44 +02:00
|
|
|
return RegOpenKeyW( hkey, lpszSubKey, retkey );
|
|
|
|
}
|
|
|
|
|
2006-10-12 19:41:53 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* SHRegQueryValueA [SHELL32.508]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegQueryValueA(HKEY hkey, LPSTR lpSubKey, LPSTR lpValue, LPDWORD lpcbValue)
|
|
|
|
{
|
|
|
|
TRACE("(%p %s %p %p)\n", hkey, debugstr_a(lpSubKey), lpValue, lpcbValue);
|
|
|
|
return RegQueryValueA(hkey, lpSubKey, lpValue, (LONG*)lpcbValue);
|
|
|
|
}
|
|
|
|
|
2000-06-02 01:25:44 +02:00
|
|
|
/*************************************************************************
|
2000-07-26 19:51:32 +02:00
|
|
|
* SHRegQueryValueExA [SHELL32.509]
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegQueryValueExA(
|
|
|
|
HKEY hkey,
|
|
|
|
LPSTR lpValueName,
|
|
|
|
LPDWORD lpReserved,
|
|
|
|
LPDWORD lpType,
|
|
|
|
LPBYTE lpData,
|
|
|
|
LPDWORD lpcbData)
|
|
|
|
{
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE("%p %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
2000-06-02 01:25:44 +02:00
|
|
|
return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* SHRegQueryValueW [SHELL32.510] NT4.0
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegQueryValueW(
|
|
|
|
HKEY hkey,
|
|
|
|
LPWSTR lpszSubKey,
|
|
|
|
LPWSTR lpszData,
|
|
|
|
LPDWORD lpcbData )
|
|
|
|
{
|
2002-11-22 00:56:42 +01:00
|
|
|
WARN("%p %s %p %p semi-stub\n",
|
2000-06-02 01:25:44 +02:00
|
|
|
hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
|
2005-08-22 11:26:53 +02:00
|
|
|
return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData );
|
2000-06-02 01:25:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* SHRegQueryValueExW [SHELL32.511] NT4.0
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
2002-06-01 01:06:46 +02:00
|
|
|
* FIXME
|
2000-06-02 01:25:44 +02:00
|
|
|
* if the datatype REG_EXPAND_SZ then expand the string and change
|
2002-06-01 01:06:46 +02:00
|
|
|
* *pdwType to REG_SZ.
|
2000-06-02 01:25:44 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegQueryValueExW (
|
|
|
|
HKEY hkey,
|
|
|
|
LPWSTR pszValue,
|
|
|
|
LPDWORD pdwReserved,
|
|
|
|
LPDWORD pdwType,
|
|
|
|
LPVOID pvData,
|
|
|
|
LPDWORD pcbData)
|
|
|
|
{
|
|
|
|
DWORD ret;
|
2002-11-22 00:56:42 +01:00
|
|
|
WARN("%p %s %p %p %p %p semi-stub\n",
|
2000-06-02 01:25:44 +02:00
|
|
|
hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
|
|
|
|
ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* SHRegDeleteKeyW [SHELL32.512]
|
2000-06-02 01:25:44 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegDeleteKeyW(
|
|
|
|
HKEY hkey,
|
|
|
|
LPCWSTR pszSubKey)
|
|
|
|
{
|
2002-11-22 00:56:42 +01:00
|
|
|
FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey));
|
2000-06-02 01:25:44 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* SHRegCloseKey [SHELL32.505] NT 4.0
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegCloseKey (HKEY hkey)
|
|
|
|
{
|
2002-11-22 00:56:42 +01:00
|
|
|
TRACE("%p\n",hkey);
|
2000-06-02 01:25:44 +02:00
|
|
|
return RegCloseKey( hkey );
|
|
|
|
}
|
2016-10-19 13:07:33 +02:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
* SHCreateSessionKey [SHELL32.723]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey)
|
|
|
|
{
|
2018-04-19 11:59:36 +02:00
|
|
|
DWORD session, ret;
|
2021-09-17 17:16:11 +02:00
|
|
|
WCHAR str[ARRAY_SIZE(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\") + 16];
|
2018-04-19 11:59:36 +02:00
|
|
|
|
|
|
|
if (hkey)
|
|
|
|
*hkey = NULL;
|
|
|
|
|
|
|
|
if (!access)
|
|
|
|
return E_ACCESSDENIED;
|
|
|
|
|
|
|
|
if (!ProcessIdToSessionId(GetCurrentProcessId(), &session))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2021-09-17 17:16:11 +02:00
|
|
|
swprintf(str, ARRAY_SIZE(str),
|
|
|
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%u", session);
|
2018-04-19 11:59:36 +02:00
|
|
|
TRACE("using session key %s\n", debugstr_w(str));
|
|
|
|
|
|
|
|
ret = RegCreateKeyExW(HKEY_CURRENT_USER, str, 0, NULL, REG_OPTION_VOLATILE, access, NULL, hkey, NULL);
|
|
|
|
return HRESULT_FROM_WIN32( ret );
|
2016-10-19 13:07:33 +02:00
|
|
|
}
|