Sweden-Number/dlls/shell32/shellreg.c

174 lines
4.7 KiB
C
Raw Normal View History

/*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "shellapi.h"
#include "wingdi.h"
#include "winuser.h"
#include "shlobj.h"
#include "winreg.h"
#include "shell32_main.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/*************************************************************************
* SHRegOpenKeyA [SHELL32.506]
*
*/
HRESULT WINAPI SHRegOpenKeyA(
HKEY hKey,
LPSTR lpSubKey,
PHKEY phkResult)
{
2002-11-22 00:56:42 +01:00
TRACE("(%p, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);
return RegOpenKeyA(hKey, lpSubKey, phkResult);
}
/*************************************************************************
2001-07-11 20:56:41 +02:00
* SHRegOpenKeyW [SHELL32.507] NT 4.0
*
*/
HRESULT WINAPI SHRegOpenKeyW (
HKEY hkey,
LPCWSTR lpszSubKey,
PHKEY retkey)
{
2002-11-22 00:56:42 +01:00
WARN("%p %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
return RegOpenKeyW( hkey, lpszSubKey, retkey );
}
/*************************************************************************
* 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);
}
/*************************************************************************
* SHRegQueryValueExA [SHELL32.509]
*
*/
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);
return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);
}
/*************************************************************************
2001-07-11 20:56:41 +02:00
* SHRegQueryValueW [SHELL32.510] NT4.0
*
*/
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",
hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
2005-08-22 11:26:53 +02:00
return RegQueryValueW( hkey, lpszSubKey, lpszData, (LONG*)lpcbData );
}
/*************************************************************************
2001-07-11 20:56:41 +02:00
* SHRegQueryValueExW [SHELL32.511] NT4.0
*
2002-06-01 01:06:46 +02:00
* FIXME
* if the datatype REG_EXPAND_SZ then expand the string and change
2002-06-01 01:06:46 +02:00
* *pdwType to REG_SZ.
*/
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",
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]
*/
HRESULT WINAPI SHRegDeleteKeyW(
HKEY hkey,
LPCWSTR pszSubKey)
{
2002-11-22 00:56:42 +01:00
FIXME("hkey=%p, %s\n", hkey, debugstr_w(pszSubKey));
return 0;
}
/*************************************************************************
2001-07-11 20:56:41 +02:00
* SHRegCloseKey [SHELL32.505] NT 4.0
*
*/
HRESULT WINAPI SHRegCloseKey (HKEY hkey)
{
2002-11-22 00:56:42 +01:00
TRACE("%p\n",hkey);
return RegCloseKey( hkey );
}
/*************************************************************************
* SHCreateSessionKey [SHELL32.723]
*
*/
HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey)
{
DWORD session, ret;
WCHAR str[ARRAY_SIZE(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\") + 16];
if (hkey)
*hkey = NULL;
if (!access)
return E_ACCESSDENIED;
if (!ProcessIdToSessionId(GetCurrentProcessId(), &session))
return E_INVALIDARG;
swprintf(str, ARRAY_SIZE(str),
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%u", session);
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 );
}