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
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
2001-07-20 20:00:00 +02:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2000-06-02 01:25:44 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
2001-07-20 20:00:00 +02:00
|
|
|
|
|
|
|
#include "shellapi.h"
|
|
|
|
#include "shlobj.h"
|
2000-06-02 01:25:44 +02:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
|
2001-08-16 20:49:56 +02:00
|
|
|
#include "undocshell.h"
|
2001-07-20 20:00:00 +02:00
|
|
|
#include "wine/winbase16.h"
|
|
|
|
#include "shell32_main.h"
|
|
|
|
|
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,
|
|
|
|
LPHKEY phkResult)
|
|
|
|
{
|
|
|
|
TRACE("(0x%08x, %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
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegOpenKeyW (
|
|
|
|
HKEY hkey,
|
|
|
|
LPCWSTR lpszSubKey,
|
|
|
|
LPHKEY retkey)
|
|
|
|
{
|
|
|
|
WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);
|
|
|
|
return RegOpenKeyW( hkey, lpszSubKey, retkey );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
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)
|
|
|
|
{
|
|
|
|
TRACE("0x%04x %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
|
2000-06-02 01:25:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegQueryValueW(
|
|
|
|
HKEY hkey,
|
|
|
|
LPWSTR lpszSubKey,
|
|
|
|
LPWSTR lpszData,
|
|
|
|
LPDWORD lpcbData )
|
|
|
|
{
|
|
|
|
WARN("0x%04x %s %p %p semi-stub\n",
|
|
|
|
hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);
|
|
|
|
return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
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;
|
|
|
|
WARN("0x%04x %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-07-11 20:56:41 +02:00
|
|
|
* SHRegDeleteKeyA [SHELL32.?]
|
2000-06-02 01:25:44 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI SHRegDeleteKeyA(
|
|
|
|
HKEY hkey,
|
|
|
|
LPCSTR pszSubKey)
|
|
|
|
{
|
|
|
|
FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
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)
|
|
|
|
{
|
|
|
|
FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
TRACE("0x%04x\n",hkey);
|
|
|
|
return RegCloseKey( hkey );
|
|
|
|
}
|
2000-12-01 21:48:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* 16-bit functions */
|
|
|
|
|
|
|
|
/* 0 and 1 are valid rootkeys in win16 shell.dll and are used by
|
|
|
|
* some programs. Do not remove those cases. -MM
|
|
|
|
*/
|
|
|
|
static inline void fix_win16_hkey( HKEY *hkey )
|
|
|
|
{
|
|
|
|
if (*hkey == 0 || *hkey == 1) *hkey = HKEY_CLASSES_ROOT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegOpenKey [SHELL.1]
|
2000-12-01 21:48:41 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
return RegOpenKeyA( hkey, name, retkey );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegCreateKey [SHELL.2]
|
2000-12-01 21:48:41 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
return RegCreateKeyA( hkey, name, retkey );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegCloseKey [SHELL.3]
|
2000-12-01 21:48:41 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RegCloseKey16( HKEY hkey )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
return RegCloseKey( hkey );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegDeleteKey [SHELL.4]
|
2000-12-01 21:48:41 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
return RegDeleteKeyA( hkey, name );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegSetValue [SHELL.5]
|
2000-12-01 21:48:41 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
return RegSetValueA( hkey, name, type, data, count );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegQueryValue [SHELL.6]
|
2000-12-01 21:48:41 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Is this HACK still applicable?
|
|
|
|
*
|
|
|
|
* HACK
|
|
|
|
* The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
|
|
|
|
* mask out the high 16 bit. This (not so much incidently) hopefully fixes
|
|
|
|
* Aldus FH4)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI RegQueryValue16( HKEY hkey, LPCSTR name, LPSTR data, LPDWORD count )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
if (count) *count &= 0xffff;
|
|
|
|
return RegQueryValueA( hkey, name, data, count );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RegEnumKey [SHELL.7]
|
2000-12-01 21:48:41 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
|
|
|
|
{
|
|
|
|
fix_win16_hkey( &hkey );
|
|
|
|
return RegEnumKeyA( hkey, index, name, name_len );
|
|
|
|
}
|