shellreg.c 6.17 KB
Newer Older
1
/*
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 * 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
 */
20 21 22

#include "config.h"

23 24
#include <string.h>
#include <stdio.h>
25 26 27

#include "shellapi.h"
#include "shlobj.h"
28 29 30 31
#include "winerror.h"
#include "winreg.h"
#include "winnls.h"

32
#include "undocshell.h"
33 34 35
#include "wine/winbase16.h"
#include "shell32_main.h"

36
#include "wine/debug.h"
37

38
WINE_DEFAULT_DEBUG_CHANNEL(shell);
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

/*************************************************************************
 * 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);
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
54
 * SHRegOpenKeyW				[SHELL32.507] NT 4.0
55 56 57 58 59 60 61 62 63 64 65 66
 *
 */
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 );
}

/*************************************************************************
67
 * SHRegQueryValueExA   [SHELL32.509]
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
 *
 */
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);
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
83
 * SHRegQueryValueW				[SHELL32.510] NT4.0
84 85 86 87 88 89 90 91 92 93 94 95 96 97
 *
 */
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 );
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
98
 * SHRegQueryValueExW	[SHELL32.511] NT4.0
99
 *
100
 * FIXME
101
 *  if the datatype REG_EXPAND_SZ then expand the string and change
102
 *  *pdwType to REG_SZ.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
 */
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;
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
120
 * SHRegDeleteKeyA   [SHELL32.?]
121 122 123 124 125 126 127 128 129 130
 */
HRESULT WINAPI SHRegDeleteKeyA(
	HKEY hkey,
	LPCSTR pszSubKey)
{
	FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));
	return 0;
}

/*************************************************************************
131
 * SHRegDeleteKeyW   [SHELL32.512]
132 133 134 135 136 137 138 139 140 141
 */
HRESULT WINAPI SHRegDeleteKeyW(
	HKEY hkey,
	LPCWSTR pszSubKey)
{
	FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));
	return 0;
}

/*************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
142
 * SHRegCloseKey			[SHELL32.505] NT 4.0
143 144 145 146 147 148 149
 *
 */
HRESULT WINAPI SHRegCloseKey (HKEY hkey)
{
	TRACE("0x%04x\n",hkey);
	return RegCloseKey( hkey );
}
150 151 152 153 154 155 156 157 158 159 160 161 162


/* 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;
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
163
 *           RegOpenKey   [SHELL.1]
164 165 166 167 168 169 170 171
 */
DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
{
    fix_win16_hkey( &hkey );
    return RegOpenKeyA( hkey, name, retkey );
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
172
 *           RegCreateKey   [SHELL.2]
173 174 175 176 177 178 179 180
 */
DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR name, LPHKEY retkey )
{
    fix_win16_hkey( &hkey );
    return RegCreateKeyA( hkey, name, retkey );
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
181
 *           RegCloseKey   [SHELL.3]
182 183 184 185 186 187 188 189
 */
DWORD WINAPI RegCloseKey16( HKEY hkey )
{
    fix_win16_hkey( &hkey );
    return RegCloseKey( hkey );
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
190
 *           RegDeleteKey   [SHELL.4]
191 192 193 194 195 196 197 198
 */
DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR name )
{
    fix_win16_hkey( &hkey );
    return RegDeleteKeyA( hkey, name );
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
199
 *           RegSetValue   [SHELL.5]
200 201 202 203 204 205 206 207
 */
DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR name, DWORD type, LPCSTR data, DWORD count )
{
    fix_win16_hkey( &hkey );
    return RegSetValueA( hkey, name, type, data, count );
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
208
 *           RegQueryValue   [SHELL.6]
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
 *
 * 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 );
}

/******************************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
226
 *           RegEnumKey   [SHELL.7]
227 228 229 230 231 232
 */
DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
{
    fix_win16_hkey( &hkey );
    return RegEnumKeyA( hkey, index, name, name_len );
}