Sweden-Number/dlls/advapi32/registry.c

668 lines
20 KiB
C
Raw Normal View History

/*
* Registry management
*
* Copyright (C) 1999 Alexandre Julliard
* Copyright (C) 2017 Dmitry Timoshkov
*
* Based on misc/registry.c code
* Copyright (C) 1996 Marcus Meissner
* Copyright (C) 1998 Matthew Becker
* Copyright (C) 1999 Sylvain St-Germain
*
* 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 <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
2005-11-28 17:32:54 +01:00
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winerror.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(reg);
NTSTATUS WINAPI RemapPredefinedHandleInternal( HKEY hkey, HKEY override );
NTSTATUS WINAPI DisablePredefinedHandleTableInternal( HKEY hkey );
/******************************************************************************
* RegOverridePredefKey [ADVAPI32.@]
*/
LSTATUS WINAPI RegOverridePredefKey( HKEY hkey, HKEY override )
{
return RtlNtStatusToDosError( RemapPredefinedHandleInternal( hkey, override ));
}
/******************************************************************************
2004-07-14 01:33:14 +02:00
* RegCreateKeyW [ADVAPI32.@]
*
* Creates the specified reg key.
*
* PARAMS
* hKey [I] Handle to an open key.
* lpSubKey [I] Name of a key that will be opened or created.
* phkResult [O] Receives a handle to the opened or created key.
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: nonzero error code defined in Winerror.h
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegCreateKeyW( HKEY hkey, LPCWSTR lpSubKey, PHKEY phkResult )
{
2004-07-14 01:33:14 +02:00
return RegCreateKeyExW( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
}
/******************************************************************************
2004-07-14 01:33:14 +02:00
* RegCreateKeyA [ADVAPI32.@]
*
2005-11-04 12:43:27 +01:00
* See RegCreateKeyW.
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegCreateKeyA( HKEY hkey, LPCSTR lpSubKey, PHKEY phkResult )
{
2004-07-14 01:33:14 +02:00
return RegCreateKeyExA( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
}
/******************************************************************************
* RegCreateKeyTransactedW [ADVAPI32.@]
*/
LSTATUS WINAPI RegCreateKeyTransactedW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR class,
DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa,
PHKEY retkey, LPDWORD dispos, HANDLE transaction, PVOID reserved2 )
{
FIXME( "(%p,%s,%u,%s,%u,%u,%p,%p,%p,%p,%p): stub\n", hkey, debugstr_w(name), reserved,
debugstr_w(class), options, access, sa, retkey, dispos, transaction, reserved2 );
return ERROR_CALL_NOT_IMPLEMENTED;
}
/******************************************************************************
* RegCreateKeyTransactedA [ADVAPI32.@]
*/
LSTATUS WINAPI RegCreateKeyTransactedA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR class,
DWORD options, REGSAM access, SECURITY_ATTRIBUTES *sa,
PHKEY retkey, LPDWORD dispos, HANDLE transaction, PVOID reserved2 )
{
FIXME( "(%p,%s,%u,%s,%u,%u,%p,%p,%p,%p,%p): stub\n", hkey, debugstr_a(name), reserved,
debugstr_a(class), options, access, sa, retkey, dispos, transaction, reserved2 );
return ERROR_CALL_NOT_IMPLEMENTED;
}
/******************************************************************************
2004-07-14 01:33:14 +02:00
* RegOpenKeyW [ADVAPI32.@]
*
2004-04-23 23:32:34 +02:00
* See RegOpenKeyA.
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegOpenKeyW( HKEY hkey, LPCWSTR name, PHKEY retkey )
{
if (!retkey)
return ERROR_INVALID_PARAMETER;
2005-02-25 17:52:10 +01:00
if (!name || !*name)
{
*retkey = hkey;
return ERROR_SUCCESS;
}
return RegOpenKeyExW( hkey, name, 0, MAXIMUM_ALLOWED, retkey );
}
/******************************************************************************
2004-07-14 01:33:14 +02:00
* RegOpenKeyA [ADVAPI32.@]
*
2004-04-23 23:32:34 +02:00
* Open a registry key.
*
* PARAMS
2004-07-14 01:33:14 +02:00
* hkey [I] Handle of parent key to open the new key under
* name [I] Name of the key under hkey to open
* retkey [O] Destination for the resulting Handle
2004-04-23 23:32:34 +02:00
*
* RETURNS
2004-07-14 01:33:14 +02:00
* Success: ERROR_SUCCESS
* Failure: A standard Win32 error code. When retkey is valid, *retkey is set to 0.
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegOpenKeyA( HKEY hkey, LPCSTR name, PHKEY retkey )
{
if (!retkey)
return ERROR_INVALID_PARAMETER;
2005-02-25 17:52:10 +01:00
if (!name || !*name)
{
*retkey = hkey;
return ERROR_SUCCESS;
}
return RegOpenKeyExA( hkey, name, 0, MAXIMUM_ALLOWED, retkey );
}
/******************************************************************************
* RegEnumKeyW [ADVAPI32.@]
*
* Enumerates subkeys of the specified open reg key.
*
* PARAMS
* hKey [I] Handle to an open key.
* dwIndex [I] Index of the subkey of hKey to retrieve.
* lpName [O] Name of the subkey.
* cchName [I] Size of lpName in TCHARS.
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: system error code. If there are no more subkeys available, the
* function returns ERROR_NO_MORE_ITEMS.
*/
LSTATUS WINAPI RegEnumKeyW( HKEY hkey, DWORD index, LPWSTR name, DWORD name_len )
{
return RegEnumKeyExW( hkey, index, name, &name_len, NULL, NULL, NULL, NULL );
}
/******************************************************************************
* RegEnumKeyA [ADVAPI32.@]
*
* See RegEnumKeyW.
*/
LSTATUS WINAPI RegEnumKeyA( HKEY hkey, DWORD index, LPSTR name, DWORD name_len )
{
return RegEnumKeyExA( hkey, index, name, &name_len, NULL, NULL, NULL, NULL );
}
/******************************************************************************
* RegQueryMultipleValuesA [ADVAPI32.@]
*
* Retrieves the type and data for a list of value names associated with a key.
*
* PARAMS
* hKey [I] Handle to an open key.
* val_list [O] Array of VALENT structures that describes the entries.
* num_vals [I] Number of elements in val_list.
* lpValueBuf [O] Pointer to a buffer that receives the data for each value.
* ldwTotsize [I/O] Size of lpValueBuf.
2004-07-14 01:33:14 +02:00
*
* RETURNS
* Success: ERROR_SUCCESS. ldwTotsize contains num bytes copied.
* Failure: nonzero error code from Winerror.h ldwTotsize contains num needed
* bytes.
*/
LSTATUS WINAPI RegQueryMultipleValuesA( HKEY hkey, PVALENTA val_list, DWORD num_vals,
LPSTR lpValueBuf, LPDWORD ldwTotsize )
{
unsigned int i;
DWORD maxBytes = *ldwTotsize;
LSTATUS status;
LPSTR bufptr = lpValueBuf;
*ldwTotsize = 0;
TRACE("(%p,%p,%d,%p,%p=%d)\n", hkey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize);
for(i=0; i < num_vals; ++i)
{
val_list[i].ve_valuelen=0;
status = RegQueryValueExA(hkey, val_list[i].ve_valuename, NULL, NULL, NULL, &val_list[i].ve_valuelen);
if(status != ERROR_SUCCESS)
{
return status;
}
if(lpValueBuf != NULL && *ldwTotsize + val_list[i].ve_valuelen <= maxBytes)
{
status = RegQueryValueExA(hkey, val_list[i].ve_valuename, NULL, &val_list[i].ve_type,
(LPBYTE)bufptr, &val_list[i].ve_valuelen);
if(status != ERROR_SUCCESS)
{
return status;
}
val_list[i].ve_valueptr = (DWORD_PTR)bufptr;
bufptr += val_list[i].ve_valuelen;
}
*ldwTotsize += val_list[i].ve_valuelen;
}
return lpValueBuf != NULL && *ldwTotsize <= maxBytes ? ERROR_SUCCESS : ERROR_MORE_DATA;
}
/******************************************************************************
* RegQueryMultipleValuesW [ADVAPI32.@]
2004-07-14 01:33:14 +02:00
*
* See RegQueryMultipleValuesA.
*/
LSTATUS WINAPI RegQueryMultipleValuesW( HKEY hkey, PVALENTW val_list, DWORD num_vals,
LPWSTR lpValueBuf, LPDWORD ldwTotsize )
{
unsigned int i;
DWORD maxBytes = *ldwTotsize;
LSTATUS status;
LPSTR bufptr = (LPSTR)lpValueBuf;
*ldwTotsize = 0;
TRACE("(%p,%p,%d,%p,%p=%d)\n", hkey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize);
for(i=0; i < num_vals; ++i)
2002-07-20 22:02:55 +02:00
{
val_list[i].ve_valuelen=0;
status = RegQueryValueExW(hkey, val_list[i].ve_valuename, NULL, NULL, NULL, &val_list[i].ve_valuelen);
if(status != ERROR_SUCCESS)
{
return status;
}
if(lpValueBuf != NULL && *ldwTotsize + val_list[i].ve_valuelen <= maxBytes)
{
status = RegQueryValueExW(hkey, val_list[i].ve_valuename, NULL, &val_list[i].ve_type,
(LPBYTE)bufptr, &val_list[i].ve_valuelen);
if(status != ERROR_SUCCESS)
{
return status;
}
val_list[i].ve_valueptr = (DWORD_PTR)bufptr;
bufptr += val_list[i].ve_valuelen;
}
*ldwTotsize += val_list[i].ve_valuelen;
}
return lpValueBuf != NULL && *ldwTotsize <= maxBytes ? ERROR_SUCCESS : ERROR_MORE_DATA;
}
/******************************************************************************
* RegQueryReflectionKey [ADVAPI32.@]
*/
LONG WINAPI RegQueryReflectionKey( HKEY hkey, BOOL *is_reflection_disabled )
{
FIXME( "%p, %p stub\n", hkey, is_reflection_disabled );
*is_reflection_disabled = TRUE;
return ERROR_CALL_NOT_IMPLEMENTED;
}
/******************************************************************************
* RegDeleteKeyW [ADVAPI32.@]
2004-07-14 01:33:14 +02:00
*
* See RegDeleteKeyA.
*/
LSTATUS WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
{
return RegDeleteKeyExW( hkey, name, 0, 0 );
}
/******************************************************************************
* RegDeleteKeyA [ADVAPI32.@]
*
* Delete a registry key.
*
* PARAMS
* hkey [I] Handle to parent key containing the key to delete
* name [I] Name of the key user hkey to delete
2004-07-14 01:33:14 +02:00
*
* NOTES
2004-07-14 01:33:14 +02:00
*
* MSDN is wrong when it says that hkey must be opened with the DELETE access
* right. In reality, it opens a new handle with DELETE access.
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: Error code
*/
LSTATUS WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
{
return RegDeleteKeyExA( hkey, name, 0, 0 );
}
2000-11-30 21:31:41 +01:00
/******************************************************************************
* RegSetValueW [ADVAPI32.@]
2000-11-30 21:31:41 +01:00
*
* Sets the data for the default or unnamed value of a reg key.
*
2000-11-30 21:31:41 +01:00
* PARAMS
* hkey [I] Handle to an open key.
* subkey [I] Name of a subkey of hKey.
* type [I] Type of information to store.
* data [I] String that contains the data to set for the default value.
* count [I] Ignored.
2004-07-14 01:33:14 +02:00
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegSetValueW( HKEY hkey, LPCWSTR subkey, DWORD type, LPCWSTR data, DWORD count )
2000-11-30 21:31:41 +01:00
{
TRACE("(%p,%s,%d,%s,%d)\n", hkey, debugstr_w(subkey), type, debugstr_w(data), count );
2000-11-30 21:31:41 +01:00
if (type != REG_SZ || !data) return ERROR_INVALID_PARAMETER;
2000-11-30 21:31:41 +01:00
return RegSetKeyValueW( hkey, subkey, NULL, type, data, (lstrlenW(data) + 1)*sizeof(WCHAR) );
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
* RegSetValueA [ADVAPI32.@]
2004-07-14 01:33:14 +02:00
*
* See RegSetValueW.
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegSetValueA( HKEY hkey, LPCSTR subkey, DWORD type, LPCSTR data, DWORD count )
2000-11-30 21:31:41 +01:00
{
TRACE("(%p,%s,%d,%s,%d)\n", hkey, debugstr_a(subkey), type, debugstr_a(data), count );
if (type != REG_SZ || !data) return ERROR_INVALID_PARAMETER;
return RegSetKeyValueA( hkey, subkey, NULL, type, data, strlen(data) + 1 );
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
* RegQueryValueW [ADVAPI32.@]
2000-11-30 21:31:41 +01:00
*
* Retrieves the data associated with the default or unnamed value of a key.
*
2000-11-30 21:31:41 +01:00
* PARAMS
* hkey [I] Handle to an open key.
* name [I] Name of the subkey of hKey.
* data [O] Receives the string associated with the default value
* of the key.
* count [I/O] Size of lpValue in bytes.
2004-07-14 01:33:14 +02:00
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegQueryValueW( HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count )
2000-11-30 21:31:41 +01:00
{
2003-08-19 05:08:17 +02:00
DWORD ret;
HKEY subkey = hkey;
TRACE("(%p,%s,%p,%d)\n", hkey, debugstr_w(name), data, count ? *count : 0 );
2003-08-19 05:08:17 +02:00
if (name && name[0])
{
if ((ret = RegOpenKeyW( hkey, name, &subkey )) != ERROR_SUCCESS) return ret;
}
ret = RegQueryValueExW( subkey, NULL, NULL, NULL, (LPBYTE)data, (LPDWORD)count );
if (subkey != hkey) RegCloseKey( subkey );
if (ret == ERROR_FILE_NOT_FOUND)
{
/* return empty string if default value not found */
if (data) *data = 0;
if (count) *count = sizeof(WCHAR);
ret = ERROR_SUCCESS;
}
2003-08-19 05:08:17 +02:00
return ret;
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
* RegQueryValueA [ADVAPI32.@]
2004-07-14 01:33:14 +02:00
*
* See RegQueryValueW.
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegQueryValueA( HKEY hkey, LPCSTR name, LPSTR data, LPLONG count )
2000-11-30 21:31:41 +01:00
{
DWORD ret;
HKEY subkey = hkey;
TRACE("(%p,%s,%p,%d)\n", hkey, debugstr_a(name), data, count ? *count : 0 );
if (name && name[0])
{
if ((ret = RegOpenKeyA( hkey, name, &subkey )) != ERROR_SUCCESS) return ret;
}
ret = RegQueryValueExA( subkey, NULL, NULL, NULL, (LPBYTE)data, (LPDWORD)count );
if (subkey != hkey) RegCloseKey( subkey );
if (ret == ERROR_FILE_NOT_FOUND)
{
/* return empty string if default value not found */
if (data) *data = 0;
if (count) *count = 1;
ret = ERROR_SUCCESS;
}
2000-11-30 21:31:41 +01:00
return ret;
}
/******************************************************************************
* RegSaveKeyW [ADVAPI32.@]
2000-11-30 21:31:41 +01:00
*
* Save a key and all of its subkeys and values to a new file in the standard format.
*
2000-11-30 21:31:41 +01:00
* PARAMS
* hkey [I] Handle of key where save begins
* lpFile [I] Address of filename to save to
* sa [I] Address of security structure
2004-07-14 01:33:14 +02:00
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegSaveKeyW( HKEY hkey, LPCWSTR file, LPSECURITY_ATTRIBUTES sa )
2000-11-30 21:31:41 +01:00
{
return RegSaveKeyExW(hkey, file, sa, 0);
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
* RegSaveKeyA [ADVAPI32.@]
2004-07-14 01:33:14 +02:00
*
* See RegSaveKeyW.
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegSaveKeyA( HKEY hkey, LPCSTR file, LPSECURITY_ATTRIBUTES sa )
{
return RegSaveKeyExA(hkey, file, sa, 0);
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
* RegReplaceKeyW [ADVAPI32.@]
2004-04-23 23:32:34 +02:00
*
* Replace the file backing a registry key and all its subkeys with another file.
2000-11-30 21:31:41 +01:00
*
* PARAMS
* hkey [I] Handle of open key
* lpSubKey [I] Address of name of subkey
* lpNewFile [I] Address of filename for file with new data
* lpOldFile [I] Address of filename for backup file
2000-11-30 21:31:41 +01:00
*
* RETURNS
2004-07-14 01:33:14 +02:00
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegReplaceKeyW( HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpNewFile,
LPCWSTR lpOldFile )
2000-11-30 21:31:41 +01:00
{
FIXME("(%p,%s,%s,%s): stub\n", hkey, debugstr_w(lpSubKey),
debugstr_w(lpNewFile),debugstr_w(lpOldFile));
return ERROR_SUCCESS;
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
* RegRenameKey [ADVAPI32.@]
*
*/
LSTATUS WINAPI RegRenameKey( HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpNewName )
{
FIXME("(%p,%s,%s): stub\n", hkey, debugstr_w(lpSubKey), debugstr_w(lpNewName));
return ERROR_CALL_NOT_IMPLEMENTED;
}
2000-11-30 21:31:41 +01:00
/******************************************************************************
* RegReplaceKeyA [ADVAPI32.@]
2000-11-30 21:31:41 +01:00
*
* See RegReplaceKeyW.
2000-11-30 21:31:41 +01:00
*/
LSTATUS WINAPI RegReplaceKeyA( HKEY hkey, LPCSTR lpSubKey, LPCSTR lpNewFile,
LPCSTR lpOldFile )
2000-11-30 21:31:41 +01:00
{
UNICODE_STRING lpSubKeyW;
UNICODE_STRING lpNewFileW;
UNICODE_STRING lpOldFileW;
LONG ret;
RtlCreateUnicodeStringFromAsciiz( &lpSubKeyW, lpSubKey );
RtlCreateUnicodeStringFromAsciiz( &lpOldFileW, lpOldFile );
RtlCreateUnicodeStringFromAsciiz( &lpNewFileW, lpNewFile );
ret = RegReplaceKeyW( hkey, lpSubKeyW.Buffer, lpNewFileW.Buffer, lpOldFileW.Buffer );
RtlFreeUnicodeString( &lpOldFileW );
RtlFreeUnicodeString( &lpNewFileW );
RtlFreeUnicodeString( &lpSubKeyW );
return ret;
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
2001-02-15 00:11:17 +01:00
* RegConnectRegistryW [ADVAPI32.@]
2000-11-30 21:31:41 +01:00
*
2007-04-07 01:46:59 +02:00
* Establish a connection to a predefined registry key on another computer.
*
2000-11-30 21:31:41 +01:00
* PARAMS
2004-07-14 01:33:14 +02:00
* lpMachineName [I] Address of name of remote computer
* hHey [I] Predefined registry handle
* phkResult [I] Address of buffer for remote registry handle
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
2000-11-30 21:31:41 +01:00
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegConnectRegistryW( LPCWSTR lpMachineName, HKEY hKey,
PHKEY phkResult )
2000-11-30 21:31:41 +01:00
{
LONG ret;
TRACE("(%s,%p,%p)\n",debugstr_w(lpMachineName), hKey, phkResult);
2000-11-30 21:31:41 +01:00
if (!lpMachineName || !*lpMachineName) {
/* Use the local machine name */
ret = RegOpenKeyW( hKey, NULL, phkResult );
2000-11-30 21:31:41 +01:00
}
else {
WCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD len = ARRAY_SIZE( compName );
2000-11-30 21:31:41 +01:00
/* MSDN says lpMachineName must start with \\ : not so */
if( lpMachineName[0] == '\\' && lpMachineName[1] == '\\')
lpMachineName += 2;
if (GetComputerNameW(compName, &len))
{
if (!wcsicmp(lpMachineName, compName))
ret = RegOpenKeyW(hKey, NULL, phkResult);
else
{
FIXME("Connect to %s is not supported.\n",debugstr_w(lpMachineName));
ret = ERROR_BAD_NETPATH;
}
}
else
ret = GetLastError();
}
return ret;
2000-11-30 21:31:41 +01:00
}
/******************************************************************************
2001-02-15 00:11:17 +01:00
* RegConnectRegistryA [ADVAPI32.@]
2004-07-14 01:33:14 +02:00
*
2005-11-04 12:43:27 +01:00
* See RegConnectRegistryW.
2000-11-30 21:31:41 +01:00
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegConnectRegistryA( LPCSTR machine, HKEY hkey, PHKEY reskey )
2000-11-30 21:31:41 +01:00
{
UNICODE_STRING machineW;
LONG ret;
RtlCreateUnicodeStringFromAsciiz( &machineW, machine );
ret = RegConnectRegistryW( machineW.Buffer, hkey, reskey );
RtlFreeUnicodeString( &machineW );
2000-11-30 21:31:41 +01:00
return ret;
}
/******************************************************************************
* RegDisablePredefinedCache [ADVAPI32.@]
*
* Disables the caching of the HKEY_CURRENT_USER key for the process.
*
* PARAMS
* None.
*
* RETURNS
* Success: ERROR_SUCCESS
* Failure: nonzero error code from Winerror.h
*
* NOTES
* This is useful for services that use impersonation.
*/
2007-09-18 00:40:48 +02:00
LSTATUS WINAPI RegDisablePredefinedCache(void)
{
return RtlNtStatusToDosError( DisablePredefinedHandleTableInternal( HKEY_CURRENT_USER ));
}
/******************************************************************************
* RegCopyTreeA [ADVAPI32.@]
*
*/
LONG WINAPI RegCopyTreeA( HKEY hsrc, const char *subkey, HKEY hdst )
{
UNICODE_STRING subkeyW;
LONG ret;
if (subkey) RtlCreateUnicodeStringFromAsciiz( &subkeyW, subkey );
else subkeyW.Buffer = NULL;
ret = RegCopyTreeW( hsrc, subkeyW.Buffer, hdst );
RtlFreeUnicodeString( &subkeyW );
return ret;
}
/******************************************************************************
* RegEnableReflectionKey [ADVAPI32.@]
*
*/
LONG WINAPI RegEnableReflectionKey(HKEY base)
{
FIXME("%p: stub\n", base);
return ERROR_CALL_NOT_IMPLEMENTED;
}
/******************************************************************************
* RegDisableReflectionKey [ADVAPI32.@]
*
*/
LONG WINAPI RegDisableReflectionKey(HKEY base)
{
FIXME("%p: stub\n", base);
return ERROR_SUCCESS;
}