ReactOS 0.4.16-dev-197-g92996da
reg.c File Reference
#include <advapi32.h>
#include <ndk/cmfuncs.h>
#include <pseh/pseh2.h>
#include "reg.h"
Include dependency graph for reg.c:

Go to the source code of this file.

Macros

#define MAX_DEFAULT_HANDLES   6
 
#define REG_MAX_NAME_SIZE   256
 
#define REG_MAX_DATA_SIZE   2048
 
#define ClosePredefKey(Handle)
 
#define IsPredefKey(HKey)    (((ULONG_PTR)(HKey) & 0xF0000000) == 0x80000000)
 
#define GetPredefKeyIndex(HKey)    ((ULONG_PTR)(HKey) & 0x0FFFFFFF)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (reg)
 
static NTSTATUS MapDefaultKey (PHANDLE ParentKey, HKEY Key)
 
static VOID CloseDefaultKeys (VOID)
 
static NTSTATUS OpenClassesRootKey (PHANDLE KeyHandle)
 
static NTSTATUS OpenLocalMachineKey (PHANDLE KeyHandle)
 
static NTSTATUS OpenUsersKey (PHANDLE KeyHandle)
 
static NTSTATUS OpenCurrentConfigKey (PHANDLE KeyHandle)
 
static __inline int is_string (DWORD type)
 
BOOL RegInitialize (VOID)
 
BOOL RegCleanup (VOID)
 
static NTSTATUS OpenPredefinedKey (IN ULONG Index, OUT HANDLE Handle)
 
static NTSTATUS MapDefaultKey (OUT PHANDLE RealKey, IN HKEY Key)
 
static NTSTATUS OpenClassesRootKey (_Out_ PHANDLE KeyHandle)
 
LONG WINAPI RegDisablePredefinedCache (VOID)
 
LONG WINAPI RegDisablePredefinedCacheEx (VOID)
 
LONG WINAPI RegOverridePredefKey (IN HKEY hKey, IN HKEY hNewHKey OPTIONAL)
 
LONG WINAPI RegCloseKey (HKEY hKey)
 
static NTSTATUS RegpCopyTree (IN HKEY hKeySrc, IN HKEY hKeyDest)
 
LONG WINAPI RegCopyTreeW (IN HKEY hKeySrc, IN LPCWSTR lpSubKey OPTIONAL, IN HKEY hKeyDest)
 
LONG WINAPI RegCopyTreeA (IN HKEY hKeySrc, IN LPCSTR lpSubKey OPTIONAL, IN HKEY hKeyDest)
 
LONG WINAPI RegConnectRegistryA (IN LPCSTR lpMachineName, IN HKEY hKey, OUT PHKEY phkResult)
 
LONG WINAPI RegConnectRegistryW (LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult)
 
static NTSTATUS CreateNestedKey (PHKEY KeyHandle, POBJECT_ATTRIBUTES ObjectAttributes, PUNICODE_STRING ClassString, DWORD dwOptions, REGSAM samDesired, DWORD *lpdwDisposition)
 
LONG WINAPI RegCreateKeyExA (_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
 
LONG WINAPI RegCreateKeyExW (_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
 
LONG WINAPI RegCreateKeyA (HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
 
LONG WINAPI RegCreateKeyW (HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
 
LONG WINAPI RegDeleteKeyA (_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
 
LONG WINAPI RegDeleteKeyW (_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
 
LONG WINAPI RegDeleteKeyExA (_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
 
LONG WINAPI RegDeleteKeyExW (_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
 
LONG WINAPI RegDeleteKeyValueW (IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValueName OPTIONAL)
 
LONG WINAPI RegDeleteKeyValueA (IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL, IN LPCSTR lpValueName OPTIONAL)
 
LSTATUS WINAPI RegDeleteTreeW (HKEY hKey, LPCWSTR lpszSubKey)
 
LONG WINAPI RegDeleteTreeA (IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL)
 
LONG WINAPI RegDisableReflectionKey (IN HKEY hBase)
 
LONG WINAPI RegEnableReflectionKey (IN HKEY hBase)
 
static VOID RegpApplyRestrictions (DWORD dwFlags, DWORD dwType, DWORD cbData, PLONG ret)
 
LSTATUS WINAPI RegGetValueW (HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
 
LSTATUS WINAPI RegGetValueA (HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
 
LONG WINAPI RegSetKeyValueW (IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValueName OPTIONAL, IN DWORD dwType, IN LPCVOID lpData OPTIONAL, IN DWORD cbData)
 
LONG WINAPI RegSetKeyValueA (IN HKEY hKey, IN LPCSTR lpSubKey OPTIONAL, IN LPCSTR lpValueName OPTIONAL, IN DWORD dwType, IN LPCVOID lpData OPTIONAL, IN DWORD cbData)
 
LONG WINAPI RegDeleteValueA (HKEY hKey, LPCSTR lpValueName)
 
LONG WINAPI RegDeleteValueW (HKEY hKey, LPCWSTR lpValueName)
 
LONG WINAPI RegEnumKeyA (HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cbName)
 
LONG WINAPI RegEnumKeyW (HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
 
LONG WINAPI RegEnumKeyExA (_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
 
LONG WINAPI RegEnumKeyExW (_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
 
LONG WINAPI RegEnumValueA (_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
 
LONG WINAPI RegEnumValueW (_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
 
LONG WINAPI RegFlushKey (HKEY hKey)
 
LONG WINAPI RegGetKeySecurity (HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor)
 
LONG WINAPI RegLoadKeyA (HKEY hKey, LPCSTR lpSubKey, LPCSTR lpFile)
 
LONG WINAPI RegLoadKeyW (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpFile)
 
LONG WINAPI RegNotifyChangeKeyValue (HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous)
 
LONG WINAPI RegOpenCurrentUser (IN REGSAM samDesired, OUT PHKEY phkResult)
 
LONG WINAPI RegOpenKeyA (HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
 
LONG WINAPI RegOpenKeyW (HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
 
LONG WINAPI RegOpenKeyExA (_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
 
LONG WINAPI RegOpenKeyExW (HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
 
LONG WINAPI RegOpenUserClassesRoot (IN HANDLE hToken, IN DWORD dwOptions, IN REGSAM samDesired, OUT PHKEY phkResult)
 
LONG WINAPI RegQueryInfoKeyA (HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
 
LONG WINAPI RegQueryInfoKeyW (HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
 
LONG WINAPI RegQueryMultipleValuesA (HKEY hKey, PVALENTA val_list, DWORD num_vals, LPSTR lpValueBuf, LPDWORD ldwTotsize)
 
LONG WINAPI RegQueryMultipleValuesW (HKEY hKey, PVALENTW val_list, DWORD num_vals, LPWSTR lpValueBuf, LPDWORD ldwTotsize)
 
LONG WINAPI RegQueryReflectionKey (IN HKEY hBase, OUT BOOL *bIsReflectionDisabled)
 
LONG WINAPI RegQueryValueExA (_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
 
LONG WINAPI RegQueryValueExW (_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
 
LSTATUS WINAPI RegQueryValueA (HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
 
LSTATUS WINAPI RegQueryValueW (HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
 
LONG WINAPI RegReplaceKeyA (HKEY hKey, LPCSTR lpSubKey, LPCSTR lpNewFile, LPCSTR lpOldFile)
 
LONG WINAPI RegReplaceKeyW (HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewFile, LPCWSTR lpOldFile)
 
LONG WINAPI RegRestoreKeyA (HKEY hKey, LPCSTR lpFile, DWORD dwFlags)
 
LONG WINAPI RegRestoreKeyW (HKEY hKey, LPCWSTR lpFile, DWORD dwFlags)
 
LONG WINAPI RegSaveKeyA (HKEY hKey, LPCSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
LONG WINAPI RegSaveKeyW (HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
LONG WINAPI RegSaveKeyExA (HKEY hKey, LPCSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
 
LONG WINAPI RegSaveKeyExW (HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
 
LONG WINAPI RegSetKeySecurity (HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
 
LONG WINAPI RegSetValueExA (HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
 
LONG WINAPI RegSetValueExW (_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
 
LONG WINAPI RegSetValueA (HKEY hKeyOriginal, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData)
 
LONG WINAPI RegSetValueW (HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
 
LONG WINAPI RegUnLoadKeyA (HKEY hKey, LPCSTR lpSubKey)
 
LONG WINAPI RegUnLoadKeyW (HKEY hKey, LPCWSTR lpSubKey)
 
static int load_string (HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
 
LONG WINAPI RegLoadMUIStringW (IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
 
LONG WINAPI RegLoadMUIStringA (IN HKEY hKey, IN LPCSTR pszValue OPTIONAL, OUT LPSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCSTR pszDirectory OPTIONAL)
 

Variables

static RTL_CRITICAL_SECTION HandleTableCS
 
static HANDLE DefaultHandleTable [MAX_DEFAULT_HANDLES]
 
static HANDLE ProcessHeap
 
static BOOLEAN DefaultHandlesDisabled = FALSE
 
static BOOLEAN DefaultHandleHKUDisabled = FALSE
 
static BOOLEAN DllInitialized = FALSE
 

Macro Definition Documentation

◆ ClosePredefKey

#define ClosePredefKey (   Handle)
Value:
if ((ULONG_PTR)Handle & 0x1) { \
NtClose(Handle); \
}
ULONG Handle
Definition: gdb_input.c:15
uint32_t ULONG_PTR
Definition: typedefs.h:65

Definition at line 44 of file reg.c.

◆ GetPredefKeyIndex

#define GetPredefKeyIndex (   HKey)     ((ULONG_PTR)(HKey) & 0x0FFFFFFF)

Definition at line 50 of file reg.c.

◆ IsPredefKey

#define IsPredefKey (   HKey)     (((ULONG_PTR)(HKey) & 0xF0000000) == 0x80000000)

Definition at line 48 of file reg.c.

◆ MAX_DEFAULT_HANDLES

#define MAX_DEFAULT_HANDLES   6

Definition at line 27 of file reg.c.

◆ REG_MAX_DATA_SIZE

#define REG_MAX_DATA_SIZE   2048

Definition at line 29 of file reg.c.

◆ REG_MAX_NAME_SIZE

#define REG_MAX_NAME_SIZE   256

Definition at line 28 of file reg.c.

Function Documentation

◆ CloseDefaultKeys()

static VOID CloseDefaultKeys ( VOID  )
static

Definition at line 216 of file reg.c.

217{
218 ULONG i;
219 RegInitialize(); /* HACK until delay-loading is implemented */
221
222 for (i = 0; i < MAX_DEFAULT_HANDLES; i++)
223 {
224 if (DefaultHandleTable[i] != NULL)
225 {
228 }
229 }
230
232}
#define NULL
Definition: types.h:112
static HANDLE DefaultHandleTable[MAX_DEFAULT_HANDLES]
Definition: reg.c:34
BOOL RegInitialize(VOID)
Definition: reg.c:70
#define MAX_DEFAULT_HANDLES
Definition: reg.c:27
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
uint32_t ULONG
Definition: typedefs.h:59

Referenced by RegCleanup().

◆ CreateNestedKey()

static NTSTATUS CreateNestedKey ( PHKEY  KeyHandle,
POBJECT_ATTRIBUTES  ObjectAttributes,
PUNICODE_STRING  ClassString,
DWORD  dwOptions,
REGSAM  samDesired,
DWORD lpdwDisposition 
)
static

Definition at line 920 of file reg.c.

926{
927 OBJECT_ATTRIBUTES LocalObjectAttributes;
928 UNICODE_STRING LocalKeyName;
931 ULONG FullNameLength;
933 PWCHAR Ptr;
934 HANDLE LocalKeyHandle;
935
937 samDesired,
939 0,
940 ClassString,
941 dwOptions,
942 (PULONG)lpdwDisposition);
943 TRACE("NtCreateKey(%wZ) called (Status %lx)\n", ObjectAttributes->ObjectName, Status);
945 return Status;
946
947 /* Copy object attributes */
948 RtlCopyMemory(&LocalObjectAttributes,
950 sizeof(OBJECT_ATTRIBUTES));
951 RtlCreateUnicodeString(&LocalKeyName,
952 ObjectAttributes->ObjectName->Buffer);
953 LocalObjectAttributes.ObjectName = &LocalKeyName;
954 FullNameLength = LocalKeyName.Length / sizeof(WCHAR);
955
956 LocalKeyHandle = NULL;
957
958 /* Remove the last part of the key name and try to create the key again. */
960 {
961 Ptr = wcsrchr(LocalKeyName.Buffer, '\\');
962 if (Ptr == NULL || Ptr == LocalKeyName.Buffer)
963 {
965 break;
966 }
967
968 *Ptr = (WCHAR)0;
969 LocalKeyName.Length = (USHORT)wcslen(LocalKeyName.Buffer) * sizeof(WCHAR);
970
971 Status = NtCreateKey(&LocalKeyHandle,
973 &LocalObjectAttributes,
974 0,
975 NULL,
976 0,
977 &Disposition);
978 TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status);
979 }
980
981 if (!NT_SUCCESS(Status))
982 {
983 RtlFreeUnicodeString(&LocalKeyName);
984 return Status;
985 }
986
987 /* Add removed parts of the key name and create them too. */
988 Length = wcslen(LocalKeyName.Buffer);
989 while (TRUE)
990 {
991 if (LocalKeyHandle)
992 NtClose (LocalKeyHandle);
993
994 LocalKeyName.Buffer[Length] = L'\\';
995 Length = wcslen (LocalKeyName.Buffer);
996 LocalKeyName.Length = Length * sizeof(WCHAR);
997
998 if (Length == FullNameLength)
999 {
1001 samDesired,
1003 0,
1004 ClassString,
1005 dwOptions,
1006 (PULONG)lpdwDisposition);
1007 break;
1008 }
1009
1010 Status = NtCreateKey(&LocalKeyHandle,
1012 &LocalObjectAttributes,
1013 0,
1014 NULL,
1015 0,
1016 &Disposition);
1017 TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status);
1018 if (!NT_SUCCESS(Status))
1019 break;
1020 }
1021
1022 RtlFreeUnicodeString(&LocalKeyName);
1023
1024 return Status;
1025}
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define wcsrchr
Definition: compat.h:16
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwOptions
Definition: solitaire.cpp:25
PUNICODE_STRING ObjectName
Definition: umtypes.h:185
uint32_t * PULONG
Definition: typedefs.h:59
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint16_t * PWCHAR
Definition: typedefs.h:56
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by RegCreateKeyExW().

◆ is_string()

static __inline int is_string ( DWORD  type)
static

Definition at line 61 of file reg.c.

62{
63 return (type == REG_SZ) || (type == REG_EXPAND_SZ) || (type == REG_MULTI_SZ);
64}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REG_SZ
Definition: layer.c:22
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_EXPAND_SZ
Definition: nt_native.h:1494

Referenced by RegEnumValueA(), RegEnumValueW(), RegQueryValueExA(), RegQueryValueExW(), RegSetValueExA(), and RegSetValueExW().

◆ load_string()

static int load_string ( HINSTANCE  hModule,
UINT  resId,
LPWSTR  pwszBuffer,
INT  cMaxChars 
)
static

Definition at line 5126 of file reg.c.

5127{
5129 HRSRC hResource;
5130 WCHAR* pString;
5131 int idxString;
5132
5133 /* Negative values have to be inverted. */
5134 if (HIWORD(resId) == 0xffff)
5135 resId = (UINT)(-((INT)resId));
5136
5137 /* Load the resource into memory and get a pointer to it. */
5138 hResource = FindResourceW(hModule, MAKEINTRESOURCEW(LOWORD(resId >> 4) + 1), (LPWSTR)RT_STRING);
5139 if (!hResource) return 0;
5140 hMemory = LoadResource(hModule, hResource);
5141 if (!hMemory) return 0;
5143
5144 /* Strings are length-prefixed. Lowest nibble of resId is an index. */
5145 idxString = resId & 0xf;
5146 while (idxString--) pString += *pString + 1;
5147
5148 /* If no buffer is given, return length of the string. */
5149 if (!pwszBuffer) return *pString;
5150
5151 /* Else copy over the string, respecting the buffer size. */
5152 cMaxChars = (*pString < cMaxChars) ? *pString : (cMaxChars - 1);
5153 if (cMaxChars >= 0)
5154 {
5155 memcpy(pwszBuffer, pString + 1, cMaxChars * sizeof(WCHAR));
5156 pwszBuffer[cMaxChars] = L'\0';
5157 }
5158
5159 return cMaxChars;
5160}
HMODULE hModule
Definition: animate.c:44
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
FxString * pString
WDFMEMORY hMemory
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define RT_STRING
Definition: pedump.c:368
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RegLoadMUIStringW().

◆ MapDefaultKey() [1/2]

static NTSTATUS MapDefaultKey ( OUT PHANDLE  RealKey,
IN HKEY  Key 
)
static

Definition at line 153 of file reg.c.

155{
157 ULONG Index;
158 BOOLEAN DoOpen, DefDisabled;
160
161 TRACE("MapDefaultKey (Key %x)\n", Key);
162
163 if (!IsPredefKey(Key))
164 {
165 *RealKey = (HANDLE)((ULONG_PTR)Key & ~0x1);
166 return STATUS_SUCCESS;
167 }
168
169 /* Handle special cases here */
172 {
174 }
175 RegInitialize(); /* HACK until delay-loading is implemented */
177
178 if (Key == HKEY_CURRENT_USER)
179 DefDisabled = DefaultHandleHKUDisabled;
180 else
181 DefDisabled = DefaultHandlesDisabled;
182
183 if (!DefDisabled)
184 {
186 DoOpen = (*Handle == NULL);
187 }
188 else
189 {
190 Handle = RealKey;
191 DoOpen = TRUE;
192 }
193
194 if (DoOpen)
195 {
196 /* create/open the default handle */
198 Handle);
199 }
200
201 if (NT_SUCCESS(Status))
202 {
203 if (!DefDisabled)
204 *RealKey = *Handle;
205 else
206 *(PULONG_PTR)Handle |= 0x1;
207 }
208
210
211 return Status;
212}
unsigned char BOOLEAN
static BOOLEAN DefaultHandlesDisabled
Definition: reg.c:36
static BOOLEAN DefaultHandleHKUDisabled
Definition: reg.c:37
static NTSTATUS OpenPredefinedKey(IN ULONG Index, OUT HANDLE Handle)
Definition: reg.c:105
#define IsPredefKey(HKey)
Definition: reg.c:48
#define GetPredefKeyIndex(HKey)
Definition: reg.c:50
int DoOpen(void)
Definition: cmds.c:2168
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t * PULONG_PTR
Definition: typedefs.h:65
PVOID HANDLE
Definition: typedefs.h:73
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ WDFCOLLECTION _In_ ULONG Index
#define HKEY_CURRENT_USER
Definition: winreg.h:11

◆ MapDefaultKey() [2/2]

◆ OpenClassesRootKey() [1/2]

static NTSTATUS OpenClassesRootKey ( _Out_ PHANDLE  KeyHandle)
static

Definition at line 236 of file reg.c.

237{
239 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\CLASSES");
241
242 TRACE("OpenClassesRootKey()\n");
243
245 &KeyName,
247 NULL,
248 NULL);
251 &Attributes);
252
253 if (!NT_SUCCESS(Status))
254 return Status;
255
256 /* Mark it as HKCR */
258
259 return Status;
260}
FORCEINLINE void MakeHKCRKey(_Inout_ HKEY *hKey)
Definition: reg.h:20
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699

◆ OpenClassesRootKey() [2/2]

static NTSTATUS OpenClassesRootKey ( PHANDLE  KeyHandle)
static

Referenced by OpenPredefinedKey().

◆ OpenCurrentConfigKey()

static NTSTATUS OpenCurrentConfigKey ( PHANDLE  KeyHandle)
static

Definition at line 307 of file reg.c.

308{
311 RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current");
312
313 TRACE("OpenCurrentConfigKey()\n");
314
316 &KeyName,
318 NULL,
319 NULL);
320 return NtOpenKey(KeyHandle,
322 &Attributes);
323}

Referenced by OpenPredefinedKey().

◆ OpenLocalMachineKey()

static NTSTATUS OpenLocalMachineKey ( PHANDLE  KeyHandle)
static

Definition at line 264 of file reg.c.

265{
267 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine");
269
270 TRACE("OpenLocalMachineKey()\n");
271
273 &KeyName,
275 NULL,
276 NULL);
279 &Attributes);
280
281 TRACE("NtOpenKey(%wZ) => %08x\n", &KeyName, Status);
282
283 return Status;
284}

Referenced by OpenPredefinedKey().

◆ OpenPredefinedKey()

static NTSTATUS OpenPredefinedKey ( IN ULONG  Index,
OUT HANDLE  Handle 
)
static

Definition at line 105 of file reg.c.

107{
109
110 switch (Index)
111 {
112 case 0: /* HKEY_CLASSES_ROOT */
114 break;
115
116 case 1: /* HKEY_CURRENT_USER */
118 Handle);
119 break;
120
121 case 2: /* HKEY_LOCAL_MACHINE */
123 break;
124
125 case 3: /* HKEY_USERS */
127 break;
128#if 0
129 case 4: /* HKEY_PERFORMANCE_DATA */
130 Status = OpenPerformanceDataKey (Handle);
131 break;
132#endif
133
134 case 5: /* HKEY_CURRENT_CONFIG */
136 break;
137
138 case 6: /* HKEY_DYN_DATA */
140 break;
141
142 default:
143 WARN("MapDefaultHandle() no handle creator\n");
145 break;
146 }
147
148 return Status;
149}
#define WARN(fmt,...)
Definition: precomp.h:61
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
static NTSTATUS OpenLocalMachineKey(PHANDLE KeyHandle)
Definition: reg.c:264
static NTSTATUS OpenClassesRootKey(PHANDLE KeyHandle)
static NTSTATUS OpenCurrentConfigKey(PHANDLE KeyHandle)
Definition: reg.c:307
static NTSTATUS OpenUsersKey(PHANDLE KeyHandle)
Definition: reg.c:288
NTSYSAPI NTSTATUS NTAPI RtlOpenCurrentUser(_In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE KeyHandle)

Referenced by MapDefaultKey(), and RegOverridePredefKey().

◆ OpenUsersKey()

static NTSTATUS OpenUsersKey ( PHANDLE  KeyHandle)
static

Definition at line 288 of file reg.c.

289{
291 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\User");
292
293 TRACE("OpenUsersKey()\n");
294
296 &KeyName,
298 NULL,
299 NULL);
300 return NtOpenKey(KeyHandle,
302 &Attributes);
303}

Referenced by OpenPredefinedKey().

◆ RegCleanup()

BOOL RegCleanup ( VOID  )

Definition at line 93 of file reg.c.

94{
95 TRACE("RegCleanup()\n");
96
99
100 return TRUE;
101}
static VOID CloseDefaultKeys(VOID)
Definition: reg.c:216
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)

Referenced by DllMain().

◆ RegCloseKey()

LONG WINAPI RegCloseKey ( HKEY  hKey)

Definition at line 424 of file reg.c.

425{
427
428 /* don't close null handle or a pseudo handle */
429 if (!hKey)
430 {
432 }
433
434 if (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000)
435 {
436 return ERROR_SUCCESS;
437 }
438
440 if (!NT_SUCCESS(Status))
441 {
443 }
444
445 return ERROR_SUCCESS;
446}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
FxAutoRegKey hKey
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)

◆ RegConnectRegistryA()

LONG WINAPI RegConnectRegistryA ( IN LPCSTR  lpMachineName,
IN HKEY  hKey,
OUT PHKEY  phkResult 
)

Definition at line 845 of file reg.c.

848{
849 UNICODE_STRING MachineName = { 0, 0, NULL };
850 LONG Ret;
851
852 if (lpMachineName != NULL &&
854 {
856 }
857
858 Ret = RegConnectRegistryW(MachineName.Buffer,
859 hKey,
860 phkResult);
861
863
864 return Ret;
865}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult)
Definition: reg.c:874
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
long LONG
Definition: pedump.c:60
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1293

Referenced by test_regconnectregistry().

◆ RegConnectRegistryW()

LONG WINAPI RegConnectRegistryW ( LPCWSTR  lpMachineName,
HKEY  hKey,
PHKEY  phkResult 
)

Definition at line 874 of file reg.c.

877{
878 LONG ret;
879
880 TRACE("(%s,%p,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult);
881
882 if (!lpMachineName || !*lpMachineName)
883 {
884 /* Use the local machine name */
885 ret = RegOpenKeyW( hKey, NULL, phkResult );
886 }
887 else
888 {
889 WCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
890 DWORD len = sizeof(compName) / sizeof(WCHAR);
891
892 /* MSDN says lpMachineName must start with \\ : not so */
893 if( lpMachineName[0] == '\\' && lpMachineName[1] == '\\')
894 lpMachineName += 2;
895
896 if (GetComputerNameW(compName, &len))
897 {
898 if (!_wcsicmp(lpMachineName, compName))
899 ret = RegOpenKeyW(hKey, NULL, phkResult);
900 else
901 {
902 FIXME("Connect to %s is not supported.\n",debugstr_w(lpMachineName));
904 }
905 }
906 else
907 ret = GetLastError();
908 }
909
910 return ret;
911}
#define FIXME(fmt,...)
Definition: precomp.h:53
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_w
Definition: kernel32.h:32
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:268
#define ERROR_BAD_NETPATH
Definition: winerror.h:145

Referenced by CM_Open_Class_Key_ExW(), CM_Open_DevNode_Key_Ex(), RegConnectRegistryA(), SetupDiCreateDeviceInfoListExW(), and SetupDiOpenClassRegKeyExW().

◆ RegCopyTreeA()

LONG WINAPI RegCopyTreeA ( IN HKEY  hKeySrc,
IN LPCSTR lpSubKey  OPTIONAL,
IN HKEY  hKeyDest 
)

Definition at line 816 of file reg.c.

819{
820 UNICODE_STRING SubKeyName = { 0, 0, NULL };
821 LONG Ret;
822
823 if (lpSubKey != NULL &&
825 {
827 }
828
829 Ret = RegCopyTreeW(hKeySrc,
830 SubKeyName.Buffer,
831 hKeyDest);
832
834
835 return Ret;
836}
LONG WINAPI RegCopyTreeW(IN HKEY hKeySrc, IN LPCWSTR lpSubKey OPTIONAL, IN HKEY hKeyDest)
Definition: reg.c:740
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4725

Referenced by InitFunctionPtrs().

◆ RegCopyTreeW()

LONG WINAPI RegCopyTreeW ( IN HKEY  hKeySrc,
IN LPCWSTR lpSubKey  OPTIONAL,
IN HKEY  hKeyDest 
)

Definition at line 740 of file reg.c.

743{
744 HANDLE DestKeyHandle, KeyHandle, CurKey, SubKeyHandle = NULL;
746
748 hKeySrc);
749 if (!NT_SUCCESS(Status))
750 {
752 }
753
754 Status = MapDefaultKey(&DestKeyHandle,
755 hKeyDest);
756 if (!NT_SUCCESS(Status))
757 {
758 goto Cleanup2;
759 }
760
761 if (lpSubKey != NULL)
762 {
765
767
769 &SubKeyName,
771 KeyHandle,
772 NULL);
773
777 if (!NT_SUCCESS(Status))
778 {
779 goto Cleanup;
780 }
781
782 CurKey = SubKeyHandle;
783 }
784 else
785 CurKey = KeyHandle;
786
787 Status = RegpCopyTree(CurKey,
788 hKeyDest);
789
790 if (SubKeyHandle != NULL)
791 {
793 }
794
795Cleanup:
796 ClosePredefKey(DestKeyHandle);
797Cleanup2:
799
800 if (!NT_SUCCESS(Status))
801 {
803 }
804
805 return ERROR_SUCCESS;
806}
#define ClosePredefKey(Handle)
Definition: reg.c:44
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
static NTSTATUS RegpCopyTree(IN HKEY hKeySrc, IN HKEY hKeyDest)
Definition: reg.c:451
static const WCHAR Cleanup[]
Definition: register.c:80
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
Definition: ndis.h:4726
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by RegCopyTreeA().

◆ RegCreateKeyA()

LONG WINAPI RegCreateKeyA ( HKEY  hKey,
LPCSTR  lpSubKey,
PHKEY  phkResult 
)

Definition at line 1179 of file reg.c.

1182{
1183 return RegCreateKeyExA(hKey,
1184 lpSubKey,
1185 0,
1186 NULL,
1187 0,
1189 NULL,
1190 phkResult,
1191 NULL);
1192}
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034

Referenced by create_new_eventlog(), create_reg_entries(), create_test_entries(), CryptRegisterOIDFunction(), CryptRegisterOIDInfo(), DllRegisterServer(), init_key(), lineGetTranslateCapsA(), register_testentry(), register_zone_domains(), RegSetValueA(), setup_main_key(), test_AddERExcludedApplicationA(), test_appsearch_reglocator(), test_classesroot_enum(), test_CreateMRUListLazyW(), test_CreateMRUListW(), test_debug_heap(), test_deleted_key(), test_enum_value(), test_ExitCode(), test_getstring_no_extra(), test_install_from(), test_internet_features(), test_internet_features_registry(), test_MRUListA(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiEnumProducts(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetUserInfo(), test_MsiOpenProduct(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), test_MsiQueryProductState(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListAddSourceEx(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListGetInfo(), test_MsiSourceListSetInfo(), test_open_class_key(), test_publish_components(), test_reg_copy_tree(), test_reg_delete_key(), test_reg_delete_tree(), test_reg_query_value(), test_registerOIDInfo(), test_registry(), test_RegNotifyChangeKeyValue(), test_rw_order(), test_SetZoneAttributes(), test_SHCopyKey(), test_SHDeleteKey(), test_string_termination(), test_write_registry_values(), test_zone_domain_cache(), WNetCachePassword(), WNetEnumCachedPasswords(), WNetGetCachedPassword(), and WNetRemoveCachedPassword().

◆ RegCreateKeyExA()

LONG WINAPI RegCreateKeyExA ( _In_ HKEY  hKey,
_In_ LPCSTR  lpSubKey,
_In_ DWORD  Reserved,
_In_ LPSTR  lpClass,
_In_ DWORD  dwOptions,
_In_ REGSAM  samDesired,
_In_ LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
_Out_ PHKEY  phkResult,
_Out_ LPDWORD  lpdwDisposition 
)

Definition at line 1034 of file reg.c.

1044{
1045 UNICODE_STRING SubKeyString;
1046 UNICODE_STRING ClassString;
1048
1049 RtlInitEmptyUnicodeString(&ClassString, NULL, 0);
1050 RtlInitEmptyUnicodeString(&SubKeyString, NULL, 0);
1051
1052 if (lpClass)
1053 {
1054 if (!RtlCreateUnicodeStringFromAsciiz(&ClassString, lpClass))
1055 {
1057 goto Exit;
1058 }
1059 }
1060
1061 if (lpSubKey)
1062 {
1063 if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyString, lpSubKey))
1064 {
1066 goto Exit;
1067 }
1068 }
1069
1071 hKey,
1072 SubKeyString.Buffer,
1073 Reserved,
1074 ClassString.Buffer,
1075 dwOptions,
1076 samDesired,
1077 lpSecurityAttributes,
1078 phkResult,
1079 lpdwDisposition);
1080
1081Exit:
1082 RtlFreeUnicodeString(&SubKeyString);
1083 RtlFreeUnicodeString(&ClassString);
1084
1085 return ErrorCode;
1086}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
static void Exit(void)
Definition: sock.c:1330
_Reserved_ PVOID Reserved
Definition: winddi.h:3974

Referenced by add_key_(), create_container_key(), create_test_association(), create_test_class(), create_test_verb_dde(), CRYPT_GetDefaultOIDKey(), CryptGetDefaultOIDDllList(), CryptRegisterOIDInfo(), expect_LayerValue_imp(), FindAdapterKey(), get_key_value(), is_elevated_process(), ODBC_ReplicateODBCInstToRegistry(), ODBC_ReplicateODBCToRegistry(), reg_unreg_wine_test_class(), RegCreateKeyA(), register_keys(), register_mediatypes_extension(), register_progid(), set_component_path(), setLayerValue(), SHAddToRecentDocs(), SHGetSettings(), SHOpenRegStream2A(), SHSetValueA(), START_TEST(), test_appsearch(), test_basic_import_31(), test_classesroot(), test_classesroot_enum(), test_CoGetClassObject(), test_CoGetPSClsid(), test_copy_key_class(), test_delete_key_value(), test_envvar(), test_ExitCode(), test_invalid_import_31(), test_MsiEnumClients(), test_MsiEnumComponents(), test_MsiEnumComponentsEx(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiEnumProducts(), test_MsiEnumProductsEx(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfo(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetProductProperty(), test_MsiGetUserInfo(), test_MsiOpenProduct(), test_MsiProvideQualifiedComponentEx(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), test_MsiQueryProductState(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListAddSourceEx(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListSetInfo(), test_null(), test_OleRegGetUserType(), test_publish_components(), test_redirection(), test_reg_create_key(), test_reg_open_key(), test_reg_query_info(), test_register_progid_info(), test_symlinks(), test_TreatAsClass(), and testRegStore().

◆ RegCreateKeyExW()

LONG WINAPI RegCreateKeyExW ( _In_ HKEY  hKey,
_In_ LPCWSTR  lpSubKey,
_In_ DWORD  Reserved,
_In_opt_ LPWSTR  lpClass,
_In_ DWORD  dwOptions,
_In_ REGSAM  samDesired,
_In_opt_ LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
_Out_ PHKEY  phkResult,
_Out_opt_ LPDWORD  lpdwDisposition 
)

Definition at line 1096 of file reg.c.

1106{
1107 UNICODE_STRING SubKeyString;
1108 UNICODE_STRING ClassString;
1113
1114 TRACE("RegCreateKeyExW() called\n");
1115
1116 /* get the real parent key */
1118 hKey);
1119 if (!NT_SUCCESS(Status))
1120 {
1122 }
1123
1124 TRACE("ParentKey %p\n", ParentKey);
1125
1126 if (IsHKCRKey(ParentKey))
1127 {
1129 ParentKey,
1130 lpSubKey,
1131 Reserved,
1132 lpClass,
1133 dwOptions,
1134 samDesired,
1135 lpSecurityAttributes,
1136 phkResult,
1137 lpdwDisposition);
1139 return ErrorCode;
1140 }
1141
1144
1145 RtlInitUnicodeString(&ClassString,
1146 lpClass);
1147 RtlInitUnicodeString(&SubKeyString,
1148 lpSubKey);
1150 &SubKeyString,
1151 Attributes,
1153 lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
1154 Status = CreateNestedKey(phkResult,
1156 (lpClass == NULL)? NULL : &ClassString,
1157 dwOptions,
1158 samDesired,
1159 lpdwDisposition);
1160
1162
1163 TRACE("Status %x\n", Status);
1164 if (!NT_SUCCESS(Status))
1165 {
1167 }
1168
1169 return ERROR_SUCCESS;
1170}
static NTSTATUS CreateNestedKey(PHKEY KeyHandle, POBJECT_ATTRIBUTES ObjectAttributes, PUNICODE_STRING ClassString, DWORD dwOptions, REGSAM samDesired, DWORD *lpdwDisposition)
Definition: reg.c:920
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
Definition: reg.h:13
LONG WINAPI CreateHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: hkcr.c:266
#define OBJ_OPENLINK
Definition: winternl.h:230
#define REG_OPTION_OPEN_LINK
Definition: nt_native.h:1070
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
Definition: wdfregistry.h:69

Referenced by _InitializeLocalSpooler(), _SHOpenProfilesKey(), ACTION_RegisterClassInfo(), ACTION_UnregisterClassInfo(), add_userkey(), COpenWithList::AddAppToMRUList(), AddNewLayout(), AddToFavoritesDlgProc(), AddUninstallKey(), ApplyEventlogSettings(), ApplyRegistryValues(), BuildVolatileEnvironment(), CategoryMgr_RegisterCategory(), CliSaveImeHotKey(), CM_Open_Class_Key_ExW(), CM_Open_DevNode_Key_Ex(), ComDBOpen(), ConCfgOpenUserSettings(), connections_on_notify(), ConnectRegistry(), CopyKey(), CopySystemProfile(), create_key(), create_mru_list(), CreateAppPath(), CreateDeviceInstance(), CreateEventLog(), CreateHKCRKey(), CreateInstanceKey(), CreateNewKey(), CreateRegAppPath(), CreateSymLink(), CreateUserProfileExW(), CredWriteW(), CriticalDeviceCoInstaller(), CRYPT_ImportSystemRootCertsToReg(), CRYPT_RegReadFromReg(), CRYPT_RegWriteToReg(), CRYPT_SysRegOpenStoreW(), CRYPT_WriteSerializedToReg(), DeleteJob(), DeleteUninstallKey(), DIALOG_Execute(), CNetConnection::Disconnect(), DllRegisterServer(), DMORegister(), do_typelib_reg_key(), DoStartStartupItems(), EditTypeDlg_WriteClass(), CSysTray::EnableService(), EnumTfLanguageProfiles_Constructor(), FillList(), FilterMapper3_CreateCategory(), FilterMapper_RegisterFilter(), FilterMapper_RegisterPin(), FilterMapper_RegisterPinType(), get_cert_mgr_usages(), get_fusion_filename(), GetCurrentDPI(), GetFallbackHKCRKey(), CSysTray::GetServicesEnabled(), ImageView_SaveSettings(), INetCfgComponentControl_fnApplyRegistryChanges(), INetCfgLock_fnAcquireWriteLock(), CRegPropertyBag::Init(), InitAppRegKey(), InitializeFormList(), InitLogs(), InitSettings(), InputProcessorProfiles_AddLanguageProfile(), InputProcessorProfiles_Register(), InputProcessorProfiles_SetDefaultLanguageProfile(), InstallDefaultSystemSoundScheme(), InstallEventSource(), InstallNetDevice(), InstallOneInterface(), InstallSystemSoundLabels(), InstallSystemSoundScheme(), InstallSystemSoundSchemeNames(), load_devices_from_reg(), LoadJobs(), LoadRecoveryOptions(), LocalAddMonitor(), MAIN_LoadSettings(), MainWnd_OnOpenRegKey(), MMDevice_Create(), MRU_SaveChanged(), MSIREG_OpenClassesUpgradeCodesKey(), MSIREG_OpenFeaturesKey(), MSIREG_OpenInstallerFeaturesKey(), MSIREG_OpenInstallProps(), MSIREG_OpenPatchesKey(), MSIREG_OpenProductKey(), MSIREG_OpenUninstallKey(), MSIREG_OpenUpgradeCodesKey(), MSIREG_OpenUserDataComponentKey(), MSIREG_OpenUserDataFeaturesKey(), MSIREG_OpenUserDataPatchKey(), MSIREG_OpenUserDataProductKey(), MSIREG_OpenUserDataProductPatchesKey(), myAddPrinterDriverEx(), notif_thread_proc(), open_cred_mgr_key(), open_key(), OpenConfigurationKey(), OpenImageFileExecOptions(), PNP_CreateKey(), PNP_GetClassInstance(), PNP_GetHwProfInfo(), PNP_SetClassRegProp(), ProcessSetupInf(), ProcessUnattendSection(), ProfilesEnumGuid_Constructor(), publish_patches(), RegCreateKeyExA(), RegCreateKeyW(), register_categories(), register_coclasses(), register_converters(), register_decoders(), register_encoders(), register_interfaces(), register_key_defvalueA(), register_key_defvalueW(), register_mediatypes_extension(), register_mediatypes_parsing(), register_metadatareaders(), register_pixelformats(), register_server(), RegisterBDAComponent(), RegisterComponent(), RegisterHelperDll(), RegisterSdbEntry(), RegisterService(), RegisterTypeLib(), registry_callback(), registry_get_handle(), RegSetDWORDValue(), run_add(), run_copy(), SampSetupAddMemberToAlias(), save_cert_mgr_usages(), save_sys_colors(), SaveBoard(), SaveDWORDToRegistry(), SaveJob(), SaveSettings(), SaveShutdownSelState(), SaveStringToRegistry(), ScmCopyControlSet(), ScmCreateNewControlPipe(), ScmCreateServiceKey(), ScmWriteSecurityDescriptor(), set_profile_device_key(), set_proxy(), COpenWithList::SetDefaultHandler(), SetFindFlags(), SetHotPlugFlags(), SetNtpClientValues(), SetParametersValues(), SetPerUserSecValuesW(), SETUP_CreateClassKey(), SETUPDI_CreateDevKey(), SETUPDI_CreateDrvKey(), SetupDiCreateDeviceInterfaceRegKeyW(), SetupDiCreateDevRegKeyW(), SHAddToRecentDocs(), SHCreateSessionKey(), SHGetShellKey(), SHOpenRegStream2W(), SHRegCreateUSKeyW(), SHSetValueW(), START_TEST(), StoreDriveSettings(), test4(), Test_CreateOpenKey(), test_IQueryAssociations_GetString(), test_legacy_filter_registration(), test_OleDoAutoConvert(), test_OleRegGetUserType(), test_system_security_access(), TestMyEventProvider(), testSystemStore(), TLB_register_interface(), TRASH_CanTrashFile(), unregister_converters(), unregister_decoders(), unregister_encoders(), unregister_metadatareaders(), unregister_pixelformats(), unregister_server(), UpdateRegistryString(), UXTHEME_BackupSystemMetrics(), WinHttpSetDefaultProxyConfiguration(), WINTRUST_WriteProviderToReg(), WINTRUST_WriteSingleUsageEntry(), WintrustGetRegPolicyFlags(), WintrustSetRegPolicyFlags(), wnet_use_connection(), write_reg_key(), write_types(), WriteCabinetState(), WritePortSettings(), WriteStartupRecoveryOptions(), and WriteUserLocale().

◆ RegCreateKeyW()

LONG WINAPI RegCreateKeyW ( HKEY  hKey,
LPCWSTR  lpSubKey,
PHKEY  phkResult 
)

Definition at line 1201 of file reg.c.

1204{
1205 return RegCreateKeyExW(hKey,
1206 lpSubKey,
1207 0,
1208 NULL,
1209 0,
1211 NULL,
1212 phkResult,
1213 NULL);
1214}

Referenced by _SHGetCurrentVersionPath(), _SHGetUserShellFolderPath(), _SHRegisterFolders(), ACTION_ForceReboot(), ACTION_RegisterClassInfo(), ACTION_RegisterExtensionInfo(), AddERExcludedApplicationW(), ApplyScheme(), CRYPT_SIPWriteFunction(), DEVENUM_CreateAMCategoryKey(), DEVENUM_IPropertyBag_Write(), do_process_key(), ATL::CRegObject::do_process_key(), FILEDLG95_MRU_get_slot(), get_mapping_key(), CTrayBandSite::GetDefaultBandsStream(), CTrayBandSite::GetUserBandsStream(), I_CryptReadTrustedPublisherDWORDValueFromRegistry(), Imm32WriteImeLayout(), InputList_PrepareUserRegistry(), ITERATE_RegisterFonts(), ITERATE_UnregisterFonts(), KmtFltAddAltitude(), LocalAddMonitor(), LocalDeleteMonitor(), MSACM_ReadCache(), MSACM_WriteCache(), MSACM_WriteCurrentPriorities(), msi_reg_set_subkey_val(), MSIREG_OpenUserComponentsKey(), MSIREG_OpenUserPatchesKey(), MSIREG_OpenUserUpgradeCodesKey(), NdrDllRegisterProxy(), open_assemblies_key(), open_driver_reg(), open_global_assembly_key(), open_local_assembly_key(), OpenMediaSubkey(), OpenNetworkSubkey(), OpenSourceKey(), OpenURLSubkey(), publish_sourcelist(), RegInitializeRegistry(), register_appid(), register_codepages(), register_progid(), register_verb(), registry_callback(), RegSetValueW(), SaveSettings(), SetupRegisterAllClasses(), SetupRegisterClass(), SHCopyKeyW(), SHPropertyBag_OnRegKey(), SHRegGetCLSIDKeyW(), SHRegWriteUSValueW(), SQLWritePrivateProfileStringW(), START_TEST(), stillimagew_RegisterLaunchApplication(), stillimagew_UnregisterLaunchApplication(), test_FolderShortcut(), test_Installer_RegistryValue(), TOOLBAR_Save(), UXTHEME_ApplyTheme(), and write_registry_values().

◆ RegDeleteKeyA()

LONG WINAPI RegDeleteKeyA ( _In_ HKEY  hKey,
_In_ LPCSTR  lpSubKey 
)

Definition at line 1224 of file reg.c.

1227{
1228 return RegDeleteKeyExA(hKey, lpSubKey, 0, 0);
1229}
LONG WINAPI RegDeleteKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1254

Referenced by cleanup_eventlog(), CryptUnregisterOIDFunction(), CryptUnregisterOIDInfo(), delete_container_key(), delete_key(), delete_key_(), delete_tree(), delete_tree_(), DllUnregisterServer(), init_key(), is_elevated_process(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), ok_registry(), reg_unreg_wine_test_class(), setperusersecvalues_test(), SHAddToRecentDocs(), SHDeleteEmptyKeyA(), SHDeleteOrphanKeyA(), START_TEST(), test_appsearch(), test_appsearch_reglocator(), test_classesroot(), test_debug_heap(), test_delete_key_value(), test_directshow_filter(), test_enum_value(), test_ExitCode(), test_install_from(), test_Installer_InstallProduct(), test_internet_features(), test_internet_features_registry(), test_key_formats(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiEnumProducts(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetProductProperty(), test_MsiGetUserInfo(), test_MsiInstallProduct(), test_MsiOpenProduct(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), test_MsiQueryProductState(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListGetInfo(), test_MsiSourceListSetInfo(), test_OleDoAutoConvert(), test_OleRegGetUserType(), test_open_class_key(), test_publish_components(), test_publish_product(), test_redirection(), test_reg_create_key(), test_reg_delete_key(), test_reg_open_key(), test_reg_query_info(), test_reg_query_value(), test_regcat(), test_register_product(), test_register_progid_info(), test_registerOIDFunction(), test_registry(), test_RegNotifyChangeKeyValue(), test_rw_order(), test_string_termination(), test_symlinks(), test_TreatAsClass(), test_write_registry_values(), test_zone_domain_cache(), testRegStore(), unregister_keys(), unregister_server(), unregister_testentry(), and unregister_zone_domains().

◆ RegDeleteKeyExA()

LONG WINAPI RegDeleteKeyExA ( _In_ HKEY  hKey,
_In_ LPCSTR  lpSubKey,
_In_ REGSAM  samDesired,
_In_ DWORD  Reserved 
)

Definition at line 1254 of file reg.c.

1259{
1262
1263 if (lpSubKey)
1264 {
1267 }
1268 else
1269 RtlInitEmptyUnicodeString(&SubKeyName, NULL, 0);
1270
1271 ErrorCode = RegDeleteKeyExW(hKey, SubKeyName.Buffer, samDesired, Reserved);
1272
1274
1275 return ErrorCode;
1276}
LONG WINAPI RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1286

Referenced by delete_key_(), delete_registry_key(), delete_tree_(), InitFunctionPtrs(), RegDeleteKeyA(), test_appsearch(), test_feature_override(), test_Installer_InstallProduct(), test_MsiEnumClients(), test_MsiEnumComponents(), test_MsiEnumComponentsEx(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiEnumProducts(), test_MsiEnumProductsEx(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfo(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetProductProperty(), test_MsiGetUserInfo(), test_MsiInstallProduct(), test_MsiOpenProduct(), test_MsiProvideQualifiedComponentEx(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), test_MsiQueryProductState(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListSetInfo(), test_null(), test_process_components(), test_publish_components(), test_publish_features(), test_publish_product(), and test_register_user().

◆ RegDeleteKeyExW()

LONG WINAPI RegDeleteKeyExW ( _In_ HKEY  hKey,
_In_ LPCWSTR  lpSubKey,
_In_ REGSAM  samDesired,
_In_ DWORD  Reserved 
)

Definition at line 1286 of file reg.c.

1291{
1295 HANDLE TargetKey;
1297
1298 /* Make sure we got a subkey */
1299 if (!lpSubKey)
1300 {
1301 /* Fail */
1303 }
1304
1306 hKey);
1307 if (!NT_SUCCESS(Status))
1308 {
1310 }
1311
1312 if (IsHKCRKey(ParentKey))
1313 {
1314 LONG ErrorCode = DeleteHKCRKey(ParentKey, lpSubKey, samDesired, Reserved);
1316 return ErrorCode;
1317 }
1318
1319 if (samDesired & KEY_WOW64_32KEY)
1320 ERR("Wow64 not yet supported!\n");
1321
1322 if (samDesired & KEY_WOW64_64KEY)
1323 ERR("Wow64 not yet supported!\n");
1324
1325
1326 RtlInitUnicodeString(&SubKeyName, lpSubKey);
1328 &SubKeyName,
1330 ParentKey,
1331 NULL);
1332 Status = NtOpenKey(&TargetKey,
1333 DELETE,
1335 if (!NT_SUCCESS(Status))
1336 {
1337 goto Cleanup;
1338 }
1339
1340 Status = NtDeleteKey(TargetKey);
1341 NtClose(TargetKey);
1342
1343Cleanup:
1345
1346 if (!NT_SUCCESS(Status))
1347 {
1349 }
1350
1351 return ERROR_SUCCESS;
1352}
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
LONG WINAPI DeleteHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM RegSam, _In_ DWORD Reserved)
Definition: hkcr.c:441
#define DELETE
Definition: nt_native.h:57
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
Definition: ntapi.c:408
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46

Referenced by delete_key(), DeleteHKCRKey(), package_RegDeleteTreeW(), RegDeleteKeyExA(), RegDeleteKeyW(), and TLB_unregister_interface().

◆ RegDeleteKeyValueA()

LONG WINAPI RegDeleteKeyValueA ( IN HKEY  hKey,
IN LPCSTR lpSubKey  OPTIONAL,
IN LPCSTR lpValueName  OPTIONAL 
)

Definition at line 1392 of file reg.c.

1395{
1396 UNICODE_STRING SubKey = { 0, 0, NULL }, ValueName = { 0, 0, NULL };
1397 LONG Ret;
1398
1399 if (lpSubKey != NULL &&
1400 !RtlCreateUnicodeStringFromAsciiz(&SubKey, lpSubKey))
1401 {
1403 }
1404
1405 if (lpValueName != NULL &&
1407 {
1408 RtlFreeUnicodeString(&SubKey);
1410 }
1411
1413 SubKey.Buffer,
1414 ValueName.Buffer);
1415
1416 RtlFreeUnicodeString(&SubKey);
1418
1419 return Ret;
1420}
LONG WINAPI RegDeleteKeyValueW(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValueName OPTIONAL)
Definition: reg.c:1361
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243

Referenced by InitFunctionPtrs().

◆ RegDeleteKeyValueW()

LONG WINAPI RegDeleteKeyValueW ( IN HKEY  hKey,
IN LPCWSTR lpSubKey  OPTIONAL,
IN LPCWSTR lpValueName  OPTIONAL 
)

Definition at line 1361 of file reg.c.

1364{
1365 HKEY hSubKey = hKey;
1367
1368 if (lpSubKey)
1369 {
1370 ErrorCode = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_SET_VALUE, &hSubKey);
1371 if (ErrorCode)
1372 {
1373 return ErrorCode;
1374 }
1375 }
1376 ErrorCode = RegDeleteValueW(hSubKey, lpValueName);
1377
1378 if (hSubKey != hKey)
1379 {
1380 RegCloseKey(hSubKey);
1381 }
1382 return ErrorCode;
1383}
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
#define KEY_SET_VALUE
Definition: nt_native.h:1017

Referenced by RegDeleteKeyValueA().

◆ RegDeleteKeyW()

LONG WINAPI RegDeleteKeyW ( _In_ HKEY  hKey,
_In_ LPCWSTR  lpSubKey 
)

Definition at line 1239 of file reg.c.

1242{
1243 return RegDeleteKeyExW(hKey, lpSubKey, 0, 0);
1244}

Referenced by ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterMIMEInfo(), ATL::AtlRegisterClassCategoriesHelper(), AtlRegisterClassCategoriesHelper(), CliSaveImeHotKey(), COMCAT_ICatRegister_UnRegisterCategories(), COMCAT_UnRegisterClassCategories(), CoTreatAsClass(), CredDeleteW(), CRYPT_RegWriteToReg(), CRYPT_SIPDeleteFunction(), del_mapping_key(), delete_key(), delete_local_assembly_key(), delete_test_key(), DeleteAppPath(), DeleteRegAppPath(), DeleteSubKey(), DeleteUninstallKey(), devinst_RegDeleteTreeW(), DllUnregisterServer(), DMOUnregister(), do_process_key(), ATL::CRegObject::do_process_key(), do_reg_operation(), FilterMapper3_UnregisterFilter(), FilterMapper_UnregisterFilter(), Imm32WriteImeLayout(), InputList_PrepareUserRegistry(), ITERATE_UnpublishComponent(), LocalAddMonitor(), MSACM_WriteCurrentPriorities(), myRegDeleteTreeW(), PNP_DeleteClassKey(), PNP_GetClassInstance(), reg_delete_tree(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RegisterSdbEntry(), RemoveEventLog(), run_delete(), ScmDeleteRegKey(), ServicesPageWndProc(), SETUP_CreateClassKey(), SHDeleteEmptyKeyW(), SHDeleteKeyW(), SHDeleteOrphanKeyW(), SHPropertyBag_OnRegKey(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), START_TEST(), Test_CreateOpenKey(), test_DeletePwrScheme(), test_directshow_filter(), test_FolderShortcut(), test_install_class(), test_IQueryAssociations_GetString(), test_legacy_filter_registration(), test_OleRegGetUserType(), test_SetupDiInstallClassExA(), test_SHGetShellKey(), test_SQLGetPrivateProfileString(), test_SQLGetPrivateProfileStringW(), test_SQLWritePrivateProfileString(), test_StdRegProv(), test_system_security_access(), testCertOpenSystemStore(), testSystemRegStore(), testSystemStore(), TLB_unregister_interface(), UnloadUserProfile(), unregister_dmo_from_category(), unregister_mediatypes_parsing(), UnregisterComponent(), UnRegisterTypeLib(), WINTRUST_RemoveProviderFromReg(), and WNetCancelConnection2W().

◆ RegDeleteTreeA()

LONG WINAPI RegDeleteTreeA ( IN HKEY  hKey,
IN LPCSTR lpSubKey  OPTIONAL 
)

Definition at line 1805 of file reg.c.

1807{
1808 UNICODE_STRING SubKeyName = { 0, 0, NULL };
1809 LONG Ret;
1810
1811 if (lpSubKey != NULL &&
1813 {
1815 }
1816
1817 Ret = RegDeleteTreeW(hKey,
1818 SubKeyName.Buffer);
1819
1821
1822 return Ret;
1823}
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1711

Referenced by InitFunctionPtrs(), unregister_coclasses(), and unregister_mediatypes_extension().

◆ RegDeleteTreeW()

LSTATUS WINAPI RegDeleteTreeW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)

Definition at line 1711 of file reg.c.

1713{
1714 LONG ret;
1715 DWORD dwMaxSubkeyLen, dwMaxValueLen;
1716 DWORD dwMaxLen, dwSize;
1719 HKEY hSubKey;
1720 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1721
1722 TRACE("(hkey=%p,%p %s)\n", hKey, lpszSubKey, debugstr_w(lpszSubKey));
1723
1725 hKey);
1726 if (!NT_SUCCESS(Status))
1727 {
1729 }
1730
1731 hSubKey = KeyHandle;
1732
1733 if(lpszSubKey)
1734 {
1735 ret = RegOpenKeyExW(KeyHandle, lpszSubKey, 0, KEY_READ, &hSubKey);
1736 if (ret)
1737 {
1739 return ret;
1740 }
1741 }
1742
1743 /* Get highest length for keys, values */
1744 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
1745 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1746 if (ret) goto cleanup;
1747
1748 dwMaxSubkeyLen++;
1749 dwMaxValueLen++;
1750 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1751 if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
1752 {
1753 /* Name too big: alloc a buffer for it */
1754 if (!(lpszName = RtlAllocateHeap( RtlGetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
1755 {
1757 goto cleanup;
1758 }
1759 }
1760
1761
1762 /* Recursively delete all the subkeys */
1763 while (TRUE)
1764 {
1765 dwSize = dwMaxLen;
1766 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
1767 NULL, NULL, NULL)) break;
1768
1769 ret = RegDeleteTreeW(hSubKey, lpszName);
1770 if (ret) goto cleanup;
1771 }
1772
1773 if (lpszSubKey)
1774 ret = RegDeleteKeyW(KeyHandle, lpszSubKey);
1775 else
1776 while (TRUE)
1777 {
1778 dwSize = dwMaxLen;
1779 if (RegEnumValueW(KeyHandle, 0, lpszName, &dwSize,
1780 NULL, NULL, NULL, NULL)) break;
1781
1782 ret = RegDeleteValueW(KeyHandle, lpszName);
1783 if (ret) goto cleanup;
1784 }
1785
1786cleanup:
1787 /* Free buffer if allocated */
1788 if (lpszName != szNameBuf)
1789 RtlFreeHeap( RtlGetProcessHeap(), 0, lpszName);
1790 if(lpszSubKey)
1791 RegCloseKey(hSubKey);
1792
1794
1795 return ret;
1796}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
#define MAX_PATH
Definition: compat.h:34
static void cleanup(void)
Definition: main.c:1335
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1023
#define max(a, b)
Definition: svc.c:63

Referenced by RegDeleteTreeA(), and RegDeleteTreeW().

◆ RegDeleteValueA()

LONG WINAPI RegDeleteValueA ( HKEY  hKey,
LPCSTR  lpValueName 
)

Definition at line 2287 of file reg.c.

2289{
2294
2296 hKey);
2297 if (!NT_SUCCESS(Status))
2298 {
2300 }
2301
2302 if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName))
2303 {
2306 }
2307
2308 if (IsHKCRKey(KeyHandle))
2309 {
2311 }
2312 else
2313 {
2315 if (!NT_SUCCESS(Status))
2317 }
2320 return ErrorCode;
2321}
LONG WINAPI DeleteHKCRValue(_In_ HKEY hKey, _In_ PUNICODE_STRING ValueName)
Definition: hkcr.c:504
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:1014

Referenced by cleanup_eventlog(), delete_value_(), DeleteRegistryValue(), ICRemove(), IStream_fnRelease(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), process_pending_renames(), restore_value(), save_cert_mgr_usages(), setLayerValue(), SHDeleteValueA(), START_TEST(), test_AddERExcludedApplicationA(), test_appsearch_reglocator(), test_debug_heap(), test_delete_value(), test_envvar(), test_GetAcceptLanguagesA(), test_ICInfo(), test_internet_features_registry(), test_machine_guid(), test_MsiEnumClients(), test_MsiEnumComponentsEx(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetProductProperty(), test_MsiGetUserInfo(), test_MsiOpenProduct(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), test_MsiQueryProductState(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListGetInfo(), test_MsiSourceListSetInfo(), test_null(), test_process_components(), test_publish_assemblies(), test_publish_features(), test_register_font(), test_register_product(), test_register_user(), test_registry(), test_symlinks(), test_XcvDataPort_ConfigureLPTPortCommandOK(), test_XcvDataPort_GetTransmissionRetryTimeout(), WhichPlatform(), and WNetRemoveCachedPassword().

◆ RegDeleteValueW()

LONG WINAPI RegDeleteValueW ( HKEY  hKey,
LPCWSTR  lpValueName 
)

Definition at line 2330 of file reg.c.

2332{
2337
2339 hKey);
2340 if (!NT_SUCCESS(Status))
2341 {
2343 }
2344
2345 RtlInitUnicodeString(&ValueName, lpValueName);
2346
2347 if (IsHKCRKey(KeyHandle))
2348 {
2350 }
2351 else
2352 {
2354 if (!NT_SUCCESS(Status))
2356 }
2358 return ErrorCode;
2359}

Referenced by _CmdWndProc(), _HandleDeletePort(), ACTION_MsiUnpublishAssemblies(), ACTION_ProcessComponents(), ConCfgWriteUserSettings(), connections_on_notify(), CryptSetProviderExW(), delete_value(), delete_value_state(), devinst_RegDeleteTreeW(), do_reg_operation(), FilterMapper_UnregisterFilter(), INetCfgComponentControl_fnApplyRegistryChanges(), INTERNET_SaveProxySettings(), IStream_fnRelease(), ITERATE_RemoveEnvironmentString(), ITERATE_UnregisterFonts(), ITERATE_WriteEnvironmentString(), LocalDeleteForm(), LocalmonDeletePort(), MainWnd_OnUpdateRegistry(), ModifyStatus(), myRegDeleteTreeW(), package_RegDeleteTreeW(), pendingRename(), PNP_SetClassRegProp(), PNP_SetDeviceRegProp(), ProcessRunKeys(), RChangeServiceConfig2W(), RegDeleteKeyValueW(), RegDeleteTreeW(), RegSetOrDelete(), remove_product_upgrade_code(), run_delete(), SaveSetting(), ScmSetFailureActions(), ScmWriteDependencies(), set_domain(), set_name_servers(), set_profile_device_key(), set_proxy(), SetAutoDaylight(), SHDeleteValueW(), SKDeleteValueW(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), START_TEST(), stillimagew_UnregisterLaunchApplication(), test_save(), unpublish_feature(), UXTHEME_ApplyTheme(), write_shared_dlls_count(), and WriteParameterArray().

◆ RegDisablePredefinedCache()

LONG WINAPI RegDisablePredefinedCache ( VOID  )

Definition at line 333 of file reg.c.

334{
335 RegInitialize(); /* HACK until delay-loading is implemented */
339 return ERROR_SUCCESS;
340}

◆ RegDisablePredefinedCacheEx()

LONG WINAPI RegDisablePredefinedCacheEx ( VOID  )

Definition at line 349 of file reg.c.

350{
351 RegInitialize(); /* HACK until delay-loading is implemented */
356 return ERROR_SUCCESS;
357}

◆ RegDisableReflectionKey()

LONG WINAPI RegDisableReflectionKey ( IN HKEY  hBase)

Definition at line 1833 of file reg.c.

1834{
1835 FIXME("RegDisableReflectionKey(0x%p) UNIMPLEMENTED!\n", hBase);
1837}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ RegEnableReflectionKey()

LONG WINAPI RegEnableReflectionKey ( IN HKEY  hBase)

Definition at line 1846 of file reg.c.

1847{
1848 FIXME("RegEnableReflectionKey(0x%p) UNIMPLEMENTED!\n", hBase);
1850}

◆ RegEnumKeyA()

LONG WINAPI RegEnumKeyA ( HKEY  hKey,
DWORD  dwIndex,
LPSTR  lpName,
DWORD  cbName 
)

Definition at line 2368 of file reg.c.

2372{
2374
2375 dwLength = cbName;
2376 return RegEnumKeyExA(hKey,
2377 dwIndex,
2378 lpName,
2379 &dwLength,
2380 NULL,
2381 NULL,
2382 NULL,
2383 NULL);
2384}
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2419
static DWORD DWORD * dwLength
Definition: fusion.c:86
_In_ LPCSTR lpName
Definition: winbase.h:2813

Referenced by delete_key(), delete_registry_key(), find_registry_key(), init_registered_oid_info(), lineGetCountryA(), lineGetTranslateCapsA(), test_classesroot_enum(), test_deleted_key(), test_RegQueryValueExPerformanceData(), and test_SHGetObjectCompatFlags().

◆ RegEnumKeyExA()

LONG WINAPI RegEnumKeyExA ( _In_ HKEY  hKey,
_In_ DWORD  dwIndex,
_Out_ LPSTR  lpName,
_Inout_ LPDWORD  lpcbName,
_Reserved_ LPDWORD  lpReserved,
_Out_opt_ LPSTR  lpClass,
_Inout_opt_ LPDWORD  lpcbClass,
_Out_opt_ PFILETIME  lpftLastWriteTime 
)

Definition at line 2419 of file reg.c.

2428{
2429 WCHAR* NameBuffer = NULL;
2430 WCHAR* ClassBuffer = NULL;
2431 DWORD NameLength, ClassLength;
2433
2434 /* Allocate our buffers */
2435 if (*lpcbName > 0)
2436 {
2437 NameLength = *lpcbName;
2438 NameBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbName * sizeof(WCHAR));
2439 if (NameBuffer == NULL)
2440 {
2442 goto Exit;
2443 }
2444 }
2445
2446 if (lpClass)
2447 {
2448 if (*lpcbClass > 0)
2449 {
2450 ClassLength = *lpcbClass;
2451 ClassBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbClass * sizeof(WCHAR));
2452 if (ClassBuffer == NULL)
2453 {
2455 goto Exit;
2456 }
2457 }
2458 }
2459
2460 /* Do the actual call */
2462 hKey,
2463 dwIndex,
2464 NameBuffer,
2465 lpcbName,
2466 lpReserved,
2467 ClassBuffer,
2468 lpcbClass,
2469 lpftLastWriteTime);
2470
2471 if (ErrorCode != ERROR_SUCCESS)
2472 goto Exit;
2473
2474 /* Convert the strings */
2475 RtlUnicodeToMultiByteN(lpName, *lpcbName, 0, NameBuffer, *lpcbName * sizeof(WCHAR));
2476 /* NULL terminate if we can */
2477 if (NameLength > *lpcbName)
2478 lpName[*lpcbName] = '\0';
2479
2480 if (lpClass)
2481 {
2482 RtlUnicodeToMultiByteN(lpClass, *lpcbClass, 0, NameBuffer, *lpcbClass * sizeof(WCHAR));
2483 if (ClassLength > *lpcbClass)
2484 lpClass[*lpcbClass] = '\0';
2485 }
2486
2487Exit:
2488 if (NameBuffer)
2489 RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
2490 if (ClassBuffer)
2491 RtlFreeHeap(RtlGetProcessHeap(), 0, ClassBuffer);
2492
2493 return ErrorCode;
2494}
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN(_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:107

Referenced by delete_tree(), delete_tree_(), DP_LoadSP(), find_typelib_key(), FindProvRegVals(), FindProvTypesRegVals(), IDirectPlay4AImpl_EnumConnections(), IDirectPlayLobby3AImpl_EnumAddressTypes(), IDirectPlayLobby3AImpl_EnumLocalApplications(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), RegEnumKeyA(), RSAENH_CPGetProvParam(), scan_subkeys(), SHEnumKeyExA(), and SHRegEnumUSKeyA().

◆ RegEnumKeyExW()

LONG WINAPI RegEnumKeyExW ( _In_ HKEY  hKey,
_In_ DWORD  dwIndex,
_Out_ LPWSTR  lpName,
_Inout_ LPDWORD  lpcbName,
_Reserved_ LPDWORD  lpReserved,
_Out_opt_ LPWSTR  lpClass,
_Inout_opt_ LPDWORD  lpcbClass,
_Out_opt_ PFILETIME  lpftLastWriteTime 
)

Definition at line 2504 of file reg.c.

2513{
2514 union
2515 {
2518 } *KeyInfo;
2519
2521 ULONG ResultSize;
2522 ULONG NameLength;
2523 ULONG ClassLength = 0;
2527
2529 hKey);
2530 if (!NT_SUCCESS(Status))
2531 {
2533 }
2534
2535 if (IsHKCRKey(KeyHandle))
2536 {
2538 KeyHandle,
2539 dwIndex,
2540 lpName,
2541 lpcbName,
2542 lpReserved,
2543 lpClass,
2544 lpcbClass,
2545 lpftLastWriteTime);
2547 return ErrorCode;
2548 }
2549
2550 if (*lpcbName > 0)
2551 {
2552 NameLength = min (*lpcbName - 1, REG_MAX_NAME_SIZE) * sizeof (WCHAR);
2553 }
2554 else
2555 {
2556 NameLength = 0;
2557 }
2558
2559 if (lpClass)
2560 {
2561 if (*lpcbClass > 0)
2562 {
2563 ClassLength = min (*lpcbClass - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR);
2564 }
2565 else
2566 {
2567 ClassLength = 0;
2568 }
2569
2570 BufferSize = ((sizeof(KEY_NODE_INFORMATION) + NameLength + 3) & ~3) + ClassLength;
2571 }
2572 else
2573 {
2574 BufferSize = sizeof(KEY_BASIC_INFORMATION) + NameLength;
2575 }
2576
2577 KeyInfo = RtlAllocateHeap(ProcessHeap,
2578 0,
2579 BufferSize);
2580 if (KeyInfo == NULL)
2581 {
2583 goto Cleanup;
2584 }
2585
2587 (ULONG)dwIndex,
2589 KeyInfo,
2590 BufferSize,
2591 &ResultSize);
2592 TRACE("NtEnumerateKey() returned status 0x%X\n", Status);
2593 if (!NT_SUCCESS(Status))
2594 {
2596 }
2597 else
2598 {
2599 if (lpClass == NULL)
2600 {
2601 if (KeyInfo->Basic.NameLength > NameLength)
2602 {
2604 }
2605 else
2606 {
2608 KeyInfo->Basic.Name,
2609 KeyInfo->Basic.NameLength);
2610 *lpcbName = (DWORD)(KeyInfo->Basic.NameLength / sizeof(WCHAR));
2611 lpName[*lpcbName] = 0;
2612 }
2613 }
2614 else
2615 {
2616 if (KeyInfo->Node.NameLength > NameLength ||
2617 KeyInfo->Node.ClassLength > ClassLength)
2618 {
2620 }
2621 else
2622 {
2624 KeyInfo->Node.Name,
2625 KeyInfo->Node.NameLength);
2626 *lpcbName = KeyInfo->Node.NameLength / sizeof(WCHAR);
2627 lpName[*lpcbName] = 0;
2628 RtlCopyMemory(lpClass,
2629 (PVOID)((ULONG_PTR)KeyInfo->Node.Name + KeyInfo->Node.ClassOffset),
2630 KeyInfo->Node.ClassLength);
2631 *lpcbClass = (DWORD)(KeyInfo->Node.ClassLength / sizeof(WCHAR));
2632 lpClass[*lpcbClass] = 0;
2633 }
2634 }
2635
2636 if (ErrorCode == ERROR_SUCCESS && lpftLastWriteTime != NULL)
2637 {
2638 if (lpClass == NULL)
2639 {
2640 lpftLastWriteTime->dwLowDateTime = KeyInfo->Basic.LastWriteTime.u.LowPart;
2641 lpftLastWriteTime->dwHighDateTime = KeyInfo->Basic.LastWriteTime.u.HighPart;
2642 }
2643 else
2644 {
2645 lpftLastWriteTime->dwLowDateTime = KeyInfo->Node.LastWriteTime.u.LowPart;
2646 lpftLastWriteTime->dwHighDateTime = KeyInfo->Node.LastWriteTime.u.HighPart;
2647 }
2648 }
2649 }
2650
2652 0,
2653 KeyInfo);
2654
2655Cleanup:
2657
2658 return ErrorCode;
2659}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define BufferSize
Definition: mmc.h:75
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
union node Node
Definition: types.h:1255
static HANDLE ProcessHeap
Definition: reg.c:35
#define REG_MAX_NAME_SIZE
Definition: reg.c:28
LONG WINAPI EnumHKCRKey(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: hkcr.c:682
#define min(a, b)
Definition: monoChain.cc:55
@ KeyBasicInformation
Definition: nt_native.h:1131
@ KeyNodeInformation
Definition: nt_native.h:1132
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
struct _KEY_NODE_INFORMATION KEY_NODE_INFORMATION
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
#define DWORD
Definition: nt_native.h:44
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by _enumeratorRememberedW(), _InitializePrintProviderList(), CDefaultContextMenu::AddStaticEntriesForKey(), AddUserProfiles(), AllSysInfo(), build_zonemap_from_reg(), BuildLogListAndFilterList(), BuildParameterArray(), capGetDriverDescriptionW(), CategoryMgr_FindClosestCategory(), CATIDEnumGUID_Next(), CertEnumSystemStore(), CheckLogOrSourceExistence(), CliGetImeHotKeysFromRegistry(), CLSIDEnumGUID_Next(), COMCAT_IEnumCATEGORYINFO_Next(), COMCAT_IsClassOfCategories(), ComponentInfo_GetGuidList(), CopyKey(), CreateComponentEnumerator(), CreateKeyboardLayoutList(), CRYPT_RegReadSerializedFromReg(), CryptEnumProvidersW(), CryptSIPRetrieveSubjectGuid(), delete_test_key(), DEVENUM_ReadPins(), DEVENUM_ReadPinTypes(), devinst_RegDeleteTreeW(), DirectPlayEnumerateAW(), DMOUnregister(), EnumClientServiceProtocol(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), EnumerateSoundProfiles(), EnumerateTimeZoneList(), EnumHKCRKey(), EnumInterfaces(), EnumPwrSchemes(), EnumTfLanguageProfiles_Next(), export_registry_data(), fetch_machine_component(), fetch_machine_product(), fetch_user_component(), fetch_user_product(), FileTypesDlg_Refresh(), GetAllInstanceList(), GetAllInstanceListSize(), GetClassMediaFile(), CQueryAssociations::GetCommand(), GetDeviceInstanceList(), GetEnumeratorInstanceList(), GetEnumeratorInstanceListSize(), GetNthChildKeyName(), GetProfiles(), IEnumDMO_fnNext(), ImportAppProfile(), ImportSoundEntry(), InitializePrinterList(), InitializePrintMonitorList(), InitializePrintProcessorList(), InitIconOverlays(), InitNotifications(), Int_EnumDependentServicesW(), LayoutList_Create(), load_devices_from_reg(), COpenWithList::LoadAppList(), LoadEventLabels(), LoadEventSources(), LoadLogFiles(), LoadUsernameHint(), LocalEnumPrintProcessors(), MCI_SysInfo(), MSACM_RegisterAllDrivers(), myRegDeleteTreeW(), next_LanguageProfile(), CEnumRegKey::NextKey(), OnTreeExpanding(), package_RegDeleteTreeW(), PNP_EnumerateSubKeys(), ProfilesEnumGuid_Next(), query_all(), query_value(), read_types(), RefreshTreeItem(), reg_delete_tree(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RegEnumKeyExA(), RegEnumKeyW(), RegFindRecurse(), RegFindWalk(), register_legacy_filters(), RegQueryRegistryKeys(), RemoveEventLog(), run_copy(), ScmCreateServiceDatabase(), ScmDeleteRegKey(), SdbUninstallByName(), search_domain_for_zone(), search_for_domain_mapping(), SETUP_CreateInterfaceList(), SetupDiClassGuidsFromNameExW(), SetupDiOpenDeviceInterfaceW(), SHCopyKeyW(), SHCreatePropSheetExtArrayEx(), SHDeleteKeyW(), SHEnumKeyExW(), SHRegEnumUSKeyW(), START_TEST(), txt_export_registry_data(), UnRegisterTypeLib(), and wnetInit().

◆ RegEnumKeyW()

◆ RegEnumValueA()

LONG WINAPI RegEnumValueA ( _In_ HKEY  hKey,
_In_ DWORD  dwIndex,
_Out_ LPSTR  lpName,
_Inout_ LPDWORD  lpcbName,
_Reserved_ LPDWORD  lpdwReserved,
_Out_opt_ LPDWORD  lpdwType,
_Out_opt_ LPBYTE  lpData,
_Inout_opt_ LPDWORD  lpcbData 
)

Definition at line 2668 of file reg.c.

2677{
2678 WCHAR* NameBuffer;
2679 DWORD NameBufferSize, NameLength;
2681 DWORD LocalType = REG_NONE;
2682 BOOL NameOverflow = FALSE;
2683
2684 /* Do parameter checks now, once and for all. */
2685 if (!lpName || !lpcbName)
2687
2688 if ((lpData && !lpcbData) || lpdwReserved)
2690
2691 /* Get the size of the buffer we must use for the first call to RegEnumValueW */
2693 hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &NameBufferSize, NULL, NULL, NULL);
2694 if (ErrorCode != ERROR_SUCCESS)
2695 return ErrorCode;
2696
2697 /* Add space for the null terminator */
2698 NameBufferSize++;
2699
2700 /* Allocate the buffer for the unicode name */
2701 NameBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, NameBufferSize * sizeof(WCHAR));
2702 if (NameBuffer == NULL)
2703 {
2705 }
2706
2707 /*
2708 * This code calls RegEnumValueW twice, because we need to know the type of the enumerated value.
2709 * So for the first call, we check if we overflow on the name, as we have no way of knowing if this
2710 * is an overflow on the data or on the name during the the second call. So the first time, we make the
2711 * call with the supplied value. This is merdique, but this is how it is.
2712 */
2713 NameLength = *lpcbName;
2715 hKey,
2716 dwIndex,
2717 NameBuffer,
2718 &NameLength,
2719 NULL,
2720 &LocalType,
2721 NULL,
2722 NULL);
2723 if (ErrorCode != ERROR_SUCCESS)
2724 {
2726 NameOverflow = TRUE;
2727 else
2728 goto Exit;
2729 }
2730
2731 if (is_string(LocalType) && lpcbData)
2732 {
2733 /* We must allocate a buffer to get the unicode data */
2734 DWORD DataBufferSize = *lpcbData * sizeof(WCHAR);
2735 WCHAR* DataBuffer = NULL;
2736 DWORD DataLength = *lpcbData;
2737 LPSTR DataStr = (LPSTR)lpData;
2738
2739 if (lpData)
2740 DataBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbData * sizeof(WCHAR));
2741
2742 /* Do the real call */
2744 hKey,
2745 dwIndex,
2746 NameBuffer,
2747 &NameBufferSize,
2748 lpdwReserved,
2749 lpdwType,
2750 (LPBYTE)DataBuffer,
2751 &DataBufferSize);
2752
2753 *lpcbData = DataBufferSize / sizeof(WCHAR);
2754
2755 if (ErrorCode != ERROR_SUCCESS)
2756 {
2757 RtlFreeHeap(RtlGetProcessHeap(), 0, DataBuffer);
2758 goto Exit;
2759 }
2760
2761 /* Copy the data whatever the error code is */
2762 if (lpData)
2763 {
2764 /* Do the data conversion */
2765 RtlUnicodeToMultiByteN(DataStr, DataLength, 0, DataBuffer, DataBufferSize);
2766 /* NULL-terminate if there is enough room */
2767 if ((DataLength > *lpcbData) && (DataStr[*lpcbData - 1] != '\0'))
2768 DataStr[*lpcbData] = '\0';
2769 }
2770
2771 RtlFreeHeap(RtlGetProcessHeap(), 0, DataBuffer);
2772 }
2773 else
2774 {
2775 /* No data conversion needed. Do the call with provided buffers */
2777 hKey,
2778 dwIndex,
2779 NameBuffer,
2780 &NameBufferSize,
2781 lpdwReserved,
2782 lpdwType,
2783 lpData,
2784 lpcbData);
2785
2786 if (ErrorCode != ERROR_SUCCESS)
2787 {
2788 goto Exit;
2789 }
2790 }
2791
2792 if (NameOverflow)
2793 {
2795 goto Exit;
2796 }
2797
2798 /* Convert the name string */
2799 RtlUnicodeToMultiByteN(lpName, *lpcbName, lpcbName, NameBuffer, NameBufferSize * sizeof(WCHAR));
2800 lpName[*lpcbName] = ANSI_NULL;
2801
2802Exit:
2803 if (NameBuffer)
2804 RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
2805
2806 return ErrorCode;
2807}
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
#define FALSE
Definition: types.h:117
static __inline int is_string(DWORD type)
Definition: reg.c:61
unsigned int BOOL
Definition: ntddk_ex.h:94
#define REG_NONE
Definition: nt_native.h:1492
#define ANSI_NULL
unsigned char * LPBYTE
Definition: typedefs.h:53
char * LPSTR
Definition: xmlstorage.h:182

Referenced by ICInfo(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), RegisterDefaultAcceptHeaders(), SHEnumValueA(), SHRegEnumUSValueA(), SQLGetPrivateProfileString(), test_classesroot_enum(), test_deleted_key(), test_enum_value(), test_RegQueryValueExPerformanceData(), test_rw_order(), test_SHGetObjectCompatFlags(), test_string_termination(), TTIsEmbeddingEnabledForFacename(), and WNetEnumCachedPasswords().

◆ RegEnumValueW()

LONG WINAPI RegEnumValueW ( _In_ HKEY  hKey,
_In_ DWORD  index,
_Out_ LPWSTR  value,
_Inout_ PDWORD  val_count,
_Reserved_ PDWORD  reserved,
_Out_opt_ PDWORD  type,
_Out_opt_ LPBYTE  data,
_Inout_opt_ PDWORD  count 
)

Definition at line 2830 of file reg.c.

2839{
2842 ULONG total_size;
2843 char buffer[256], *buf_ptr = buffer;
2845 static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name );
2846
2847 TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n",
2848 hKey, index, value, val_count, reserved, type, data, count );
2849
2850 if (!value || !val_count)
2852
2853 if ((data && !count) || reserved)
2855
2857 if (!NT_SUCCESS(status))
2858 {
2860 }
2861
2862 if (IsHKCRKey(KeyHandle))
2863 {
2865 KeyHandle,
2866 index,
2867 value,
2868 val_count,
2869 reserved,
2870 type,
2871 data,
2872 count);
2874 return ErrorCode;
2875 }
2876
2877 total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR);
2878 if (data) total_size += *count;
2879 total_size = min( sizeof(buffer), total_size );
2880
2882 buffer, total_size, &total_size );
2883 if (status && (status != STATUS_BUFFER_OVERFLOW) && (status != STATUS_BUFFER_TOO_SMALL)) goto done;
2884
2885 if (value || data)
2886 {
2887 /* retry with a dynamically allocated buffer */
2889 {
2890 if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
2891 if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size )))
2892 {
2894 goto done;
2895 }
2896 info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr;
2898 buf_ptr, total_size, &total_size );
2899 }
2900
2901 if (status) goto done;
2902
2903 if (value)
2904 {
2905 if (info->NameLength/sizeof(WCHAR) >= *val_count)
2906 {
2908 goto overflow;
2909 }
2910 memcpy( value, info->Name, info->NameLength );
2911 *val_count = info->NameLength / sizeof(WCHAR);
2912 value[*val_count] = 0;
2913 }
2914
2915 if (data)
2916 {
2917 if (info->DataLength > *count)
2918 {
2920 goto overflow;
2921 }
2922 memcpy( data, buf_ptr + info->DataOffset, info->DataLength );
2923 if (is_string(info->Type) && info->DataLength <= *count - sizeof(WCHAR))
2924 {
2925 /* if the type is REG_SZ and data is not 0-terminated
2926 * and there is enough space in the buffer NT appends a \0 */
2927 WCHAR *ptr = (WCHAR *)(data + info->DataLength);
2928 if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0;
2929 }
2930 }
2931 }
2932 else status = STATUS_SUCCESS;
2933
2934 overflow:
2935 if (type) *type = info->Type;
2936 if (count) *count = info->DataLength;
2937
2938 done:
2939 if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
2942}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
r reserved
Definition: btrfs.c:3006
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
LONG WINAPI EnumHKCRValue(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ PDWORD lpcbName, _Reserved_ PDWORD lpReserved, _Out_opt_ PDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ PDWORD lpcbData)
Definition: hkcr.c:873
static PVOID ptr
Definition: dispmode.c:27
@ KeyValueFullInformation
Definition: nt_native.h:1181
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:542
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
Definition: ps.c:97
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
Definition: pdh_main.c:94

Referenced by BuildCodePageList(), ConCfgReadUserSettings(), Control_RegisterRegistryApplets(), CopyKey(), CreateNTPServerList(), devinst_RegDeleteTreeW(), DoLoadItems(), ensure_useragent(), enum_values(), EnumHKCRValue(), CRegKeyEx::EnumValueName(), export_registry_data(), fill_source_list(), FillServerAddressCombo(), GetClassMediaFile(), GetEnumOptions(), GetUsedPorts(), InitializePrintMonitor2(), InitShellServices(), InitTTFontCache(), InstallerImpl_RegistryValue(), IsLayoutExists(), ITERATE_FindRelatedProducts(), LoadHelpers(), LocaleList_Create(), MainWnd_OnUpdateRegistry(), MMDevPropStore_GetAt(), MMDevPropStore_GetCount(), MSACM_RegisterAllDrivers(), MSI_EnumComponentQualifiers(), MsiEnumClientsW(), MsiEnumFeaturesW(), MsiEnumRelatedProductsW(), MsiGetProductCodeW(), MsiSourceListEnumMediaDisksW(), myRegDeleteTreeW(), CEnumRegKey::NextValue(), OnInitMenu(), package_RegDeleteTreeW(), ProcessRunKeys(), query_all(), CFontCache::Read(), RefreshListView(), RegDeleteTreeW(), RegEnumValueA(), RegFindRecurse(), CControlPanelEnum::RegisterRegistryCPanelApps(), RegKeyHasValues(), RegQueryRegistryValues(), SSOThread::Run(), run_copy(), run_delete(), SetDefaultPrinterW(), SetSystemEnvironment(), SetUserEnvironment(), SHCopyKeyW(), SHEnumValueW(), SHGetObjectCompatFlags(), SHRegEnumUSValueW(), SQLGetInstalledDriversW(), SQLGetPrivateProfileStringW(), START_TEST(), test_enum_value(), txt_export_registry_data(), URL_GuessScheme(), and wWinMain().

◆ RegFlushKey()

LONG WINAPI RegFlushKey ( HKEY  hKey)

Definition at line 2951 of file reg.c.

2952{
2955
2957 {
2958 return ERROR_SUCCESS;
2959 }
2960
2962 hKey);
2963 if (!NT_SUCCESS(Status))
2964 {
2966 }
2967
2969
2971
2972 if (!NT_SUCCESS(Status))
2973 {
2975 }
2976
2977 return ERROR_SUCCESS;
2978}
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
Definition: ntapi.c:1085
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14

Referenced by create_new_eventlog(), CreateEventLog(), CreateUserHive(), ATL::CRegKey::Flush(), ImportRegistryFile(), InstallEventSource(), RemoveEventLog(), RSetServiceObjectSecurity(), SaveCurrentLocale(), SaveGeoID(), ScmCopyControlSet(), ScmSetLastKnownGoodControlSet(), test_deleted_key(), test_NonExistentPath(), TestMyEventProvider(), and UnloadUserProfile().

◆ RegGetKeySecurity()

LONG WINAPI RegGetKeySecurity ( HKEY  hKey,
SECURITY_INFORMATION  SecurityInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor,
LPDWORD  lpcbSecurityDescriptor 
)

Definition at line 2987 of file reg.c.

2991{
2994
2996 {
2997 return ERROR_INVALID_HANDLE;
2998 }
2999
3001 hKey);
3002 if (!NT_SUCCESS(Status))
3003 {
3004 TRACE("MapDefaultKey() failed (Status %lx)\n", Status);
3006 }
3007
3010 pSecurityDescriptor,
3011 *lpcbSecurityDescriptor,
3012 lpcbSecurityDescriptor);
3013
3015
3016 if (!NT_SUCCESS(Status))
3017 {
3018 WARN("NtQuerySecurityObject() failed (Status %lx)\n", Status);
3020 }
3021
3022 return ERROR_SUCCESS;
3023}
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1340
NTSTATUS NTAPI NtQuerySecurityObject(IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Length, OUT PULONG ResultLength)
Definition: obsecure.c:803

Referenced by AccRewriteGetHandleRights(), ATL::CRegKey::GetKeySecurity(), and CRegistryKey::GetSecurityDescriptor().

◆ RegGetValueA()

LSTATUS WINAPI RegGetValueA ( HKEY  hKey,
LPCSTR  pszSubKey,
LPCSTR  pszValue,
DWORD  dwFlags,
LPDWORD  pdwType,
PVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 2037 of file reg.c.

2044{
2045 DWORD dwType, cbData = pcbData ? *pcbData : 0;
2046 PVOID pvBuf = NULL;
2047 LONG ret;
2048
2049 TRACE("(%p,%s,%s,%ld,%p,%p,%p=%ld)\n",
2050 hKey, pszSubKey, pszValue, dwFlags, pdwType, pvData, pcbData,
2051 cbData);
2052
2053 if (pvData && !pcbData)
2056 ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
2058
2059 if (pszSubKey && pszSubKey[0])
2060 {
2061 ret = RegOpenKeyExA(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
2062 if (ret != ERROR_SUCCESS) return ret;
2063 }
2064
2065 ret = RegQueryValueExA(hKey, pszValue, NULL, &dwType, pvData, &cbData);
2066
2067 /* If we are going to expand we need to read in the whole the value even
2068 * if the passed buffer was too small as the expanded string might be
2069 * smaller than the unexpanded one and could fit into cbData bytes. */
2070 if ((ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) &&
2071 (dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND)))
2072 {
2073 do {
2074 HeapFree(GetProcessHeap(), 0, pvBuf);
2075
2076 pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
2077 if (!pvBuf)
2078 {
2080 break;
2081 }
2082
2083 if (ret == ERROR_MORE_DATA || !pvData)
2084 ret = RegQueryValueExA(hKey, pszValue, NULL,
2085 &dwType, pvBuf, &cbData);
2086 else
2087 {
2088 /* Even if cbData was large enough we have to copy the
2089 * string since ExpandEnvironmentStrings can't handle
2090 * overlapping buffers. */
2091 CopyMemory(pvBuf, pvData, cbData);
2092 }
2093
2094 /* Both the type or the value itself could have been modified in
2095 * between so we have to keep retrying until the buffer is large
2096 * enough or we no longer have to expand the value. */
2097 } while (dwType == REG_EXPAND_SZ && ret == ERROR_MORE_DATA);
2098
2099 if (ret == ERROR_SUCCESS)
2100 {
2101 /* Recheck dwType in case it changed since the first call */
2102 if (dwType == REG_EXPAND_SZ)
2103 {
2104 cbData = ExpandEnvironmentStringsA(pvBuf, pvData,
2105 pcbData ? *pcbData : 0);
2106 dwType = REG_SZ;
2107 if(pvData && pcbData && cbData > *pcbData)
2109 }
2110 else if (pvData)
2111 CopyMemory(pvData, pvBuf, *pcbData);
2112 }
2113
2114 HeapFree(GetProcessHeap(), 0, pvBuf);
2115 }
2116
2117 if (pszSubKey && pszSubKey[0])
2119
2120 RegpApplyRestrictions(dwFlags, dwType, cbData, &ret);
2121
2124
2125 if (pdwType) *pdwType = dwType;
2126 if (pcbData) *pcbData = cbData;
2127
2128 return ret;
2129}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
static VOID RegpApplyRestrictions(DWORD dwFlags, DWORD dwType, DWORD cbData, PLONG ret)
Definition: reg.c:1859
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4009
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:399
#define RRF_NOEXPAND
Definition: driver.c:583
#define RRF_ZEROONFAILURE
Definition: driver.c:584
#define RRF_RT_REG_EXPAND_SZ
Definition: driver.c:576
#define ZeroMemory
Definition: winbase.h:1736
#define CopyMemory
Definition: winbase.h:1734
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4950
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749
#define RRF_RT_ANY
Definition: winreg.h:64

Referenced by HCR_GetClassNameA(), InitFunctionPtrs(), install_from_registered_dir(), SQLGetPrivateProfileString(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), and write_registry_values().

◆ RegGetValueW()

LSTATUS WINAPI RegGetValueW ( HKEY  hKey,
LPCWSTR  pszSubKey,
LPCWSTR  pszValue,
DWORD  dwFlags,
LPDWORD  pdwType,
PVOID  pvData,
LPDWORD  pcbData 
)

Definition at line 1931 of file reg.c.

1938{
1939 DWORD dwType, cbData = pcbData ? *pcbData : 0;
1940 PVOID pvBuf = NULL;
1941 LONG ret;
1942
1943 TRACE("(%p,%s,%s,%ld,%p,%p,%p=%ld)\n",
1944 hKey, debugstr_w(pszSubKey), debugstr_w(pszValue), dwFlags, pdwType,
1945 pvData, pcbData, cbData);
1946
1947 if (pvData && !pcbData)
1950 ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
1952
1953 if (pszSubKey && pszSubKey[0])
1954 {
1955 ret = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
1956 if (ret != ERROR_SUCCESS) return ret;
1957 }
1958
1959 ret = RegQueryValueExW(hKey, pszValue, NULL, &dwType, pvData, &cbData);
1960
1961 /* If we are going to expand we need to read in the whole the value even
1962 * if the passed buffer was too small as the expanded string might be
1963 * smaller than the unexpanded one and could fit into cbData bytes. */
1964 if ((ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) &&
1965 dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND))
1966 {
1967 do
1968 {
1969 HeapFree(GetProcessHeap(), 0, pvBuf);
1970
1971 pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
1972 if (!pvBuf)
1973 {
1975 break;
1976 }
1977
1978 if (ret == ERROR_MORE_DATA || !pvData)
1979 ret = RegQueryValueExW(hKey, pszValue, NULL,
1980 &dwType, pvBuf, &cbData);
1981 else
1982 {
1983 /* Even if cbData was large enough we have to copy the
1984 * string since ExpandEnvironmentStrings can't handle
1985 * overlapping buffers. */
1986 CopyMemory(pvBuf, pvData, cbData);
1987 }
1988
1989 /* Both the type or the value itself could have been modified in
1990 * between so we have to keep retrying until the buffer is large
1991 * enough or we no longer have to expand the value. */
1992 }
1993 while (dwType == REG_EXPAND_SZ && ret == ERROR_MORE_DATA);
1994
1995 if (ret == ERROR_SUCCESS)
1996 {
1997 /* Recheck dwType in case it changed since the first call */
1998 if (dwType == REG_EXPAND_SZ)
1999 {
2000 cbData = ExpandEnvironmentStringsW(pvBuf, pvData,
2001 pcbData ? *pcbData : 0) * sizeof(WCHAR);
2002 dwType = REG_SZ;
2003 if (pvData && pcbData && cbData > *pcbData)
2005 }
2006 else if (pvData)
2007 CopyMemory(pvData, pvBuf, *pcbData);
2008 }
2009
2010 HeapFree(GetProcessHeap(), 0, pvBuf);
2011 }
2012
2013 if (pszSubKey && pszSubKey[0])
2015
2016 RegpApplyRestrictions(dwFlags, dwType, cbData, &ret);
2017
2020
2021 if (pdwType)
2022 *pdwType = dwType;
2023
2024 if (pcbData)
2025 *pcbData = cbData;
2026
2027 return ret;
2028}
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519

Referenced by AddFSClassKeysToArray(), CRegFolderEnum::AddItemsFromKey(), CDefaultContextMenu::AddStaticEntriesForKey(), AssocGetPerceivedType(), CDefaultContextMenu::BrowserFlagsFromVerb(), check_product_patches(), ComponentInfo_GetDWORDValue(), ComponentInfo_GetGUIDValue(), ComponentInfo_GetStringValue(), create_monodata(), DoGetProductType(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), CDrvDefExt::ExtraPageProc(), FILEDLG95_MRU_get_slot(), FILEDLG95_MRU_save_filename(), FindExeCplClass(), CDrvDefExt::GeneralPageProc(), get_patch_state(), get_stringvalue(), GetCLSIDForFileTypeFromExtension(), CNetConnectionPropertyUi::GetDeviceInstanceID(), GetInterfaceName(), CQueryAssociations::GetString(), HCR_GetClassNameW(), InitializeRecycleBinDlg(), InitIconOverlays(), CFileDefExt::InitOpensWithField(), COpenWithList::IsHidden(), COpenWithList::Load(), load_config_driver(), load_settings(), COpenWithList::LoadFromProgIdKey(), CNewMenu::LoadItem(), LoadPropSheetHandlers(), COpenWithList::LoadRecommendedFromHKCR(), COpenWithList::LoadRecommendedFromHKCU(), MMDevice_GetPropValue(), OpenKeyFromFileType(), PixelFormatInfo_GetChannelMask(), read_bitmap_patterns(), read_metadata_patterns(), COpenWithList::SetDefaultHandler(), SHELL32_IsShellFolderNamespaceItemHidden(), SHELL_GetRegCLSID(), SHELL_QueryCLSIDValue(), SQLGetPrivateProfileStringW(), and WshShell3_RegRead().

◆ RegInitialize()

BOOL RegInitialize ( VOID  )

Definition at line 70 of file reg.c.

71{
72 TRACE("RegInitialize()\n");
73
74 /* Lazy init hack */
75 if (!DllInitialized)
76 {
77 ProcessHeap = RtlGetProcessHeap();
79 MAX_DEFAULT_HANDLES * sizeof(HANDLE));
81
83 }
84
85 return TRUE;
86}
static BOOLEAN DllInitialized
Definition: reg.c:38
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by CloseDefaultKeys(), DllMain(), MapDefaultKey(), RegDisablePredefinedCache(), RegDisablePredefinedCacheEx(), RegOpenUserClassesRoot(), and RegOverridePredefKey().

◆ RegLoadKeyA()

LONG WINAPI RegLoadKeyA ( HKEY  hKey,
LPCSTR  lpSubKey,
LPCSTR  lpFile 
)

Definition at line 3032 of file reg.c.

3035{
3039
3040 RtlInitEmptyUnicodeString(&KeyName, NULL, 0);
3041 RtlInitEmptyUnicodeString(&FileName, NULL, 0);
3042
3043 if (lpSubKey)
3044 {
3046 {
3048 goto Exit;
3049 }
3050 }
3051
3052 if (lpFile)
3053 {
3055 {
3057 goto Exit;
3058 }
3059 }
3060
3062 KeyName.Buffer,
3063 FileName.Buffer);
3064
3065Exit:
3068
3069 return ErrorCode;
3070}
LONG WINAPI RegLoadKeyW(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpFile)
Definition: reg.c:3079
struct _FileName FileName
Definition: fatprocs.h:897

Referenced by test_reg_load_key().

◆ RegLoadKeyW()

LONG WINAPI RegLoadKeyW ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpFile 
)

Definition at line 3079 of file reg.c.

3082{
3084 OBJECT_ATTRIBUTES KeyObjectAttributes;
3090
3092 {
3093 return ERROR_INVALID_HANDLE;
3094 }
3095
3097 hKey);
3098 if (!NT_SUCCESS(Status))
3099 {
3101 }
3102
3103 if (!RtlDosPathNameToNtPathName_U(lpFile,
3104 &FileName,
3105 NULL,
3106 NULL))
3107 {
3109 goto Cleanup;
3110 }
3111
3113 &FileName,
3115 NULL,
3116 NULL);
3117
3118 RtlInitUnicodeString(&KeyName, lpSubKey);
3119
3120 InitializeObjectAttributes(&KeyObjectAttributes,
3121 &KeyName,
3123 KeyHandle,
3124 NULL);
3125
3126 Status = NtLoadKey(&KeyObjectAttributes,
3128
3129 RtlFreeHeap(RtlGetProcessHeap(),
3130 0,
3131 FileName.Buffer);
3132
3133 if (!NT_SUCCESS(Status))
3134 {
3136 goto Cleanup;
3137 }
3138
3139Cleanup:
3141
3142 return ErrorCode;
3143}
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSTATUS NTAPI NtLoadKey(IN POBJECT_ATTRIBUTES KeyObjectAttributes, IN POBJECT_ATTRIBUTES FileObjectAttributes)
Definition: ntapi.c:1129
_In_ PWDFDEVICE_INIT _In_ PWDF_FILEOBJECT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES FileObjectAttributes
Definition: wdfdevice.h:3400
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233

Referenced by CreateUserProfileExW(), LoadHive(), LoadUserProfileW(), and RegLoadKeyA().

◆ RegLoadMUIStringA()

LONG WINAPI RegLoadMUIStringA ( IN HKEY  hKey,
IN LPCSTR pszValue  OPTIONAL,
OUT LPSTR  pszOutBuf,
IN DWORD  cbOutBuf,
OUT LPDWORD pcbData  OPTIONAL,
IN DWORD  Flags,
IN LPCSTR pszDirectory  OPTIONAL 
)

Definition at line 5268 of file reg.c.

5276{
5277 UNICODE_STRING valueW, baseDirW;
5278 WCHAR* pwszBuffer;
5279 DWORD cbData = cbOutBuf * sizeof(WCHAR);
5280 LONG result;
5281
5282 valueW.Buffer = baseDirW.Buffer = pwszBuffer = NULL;
5283 if (!RtlCreateUnicodeStringFromAsciiz(&valueW, pszValue) ||
5284 !RtlCreateUnicodeStringFromAsciiz(&baseDirW, pszDirectory) ||
5285 !(pwszBuffer = HeapAlloc(GetProcessHeap(), 0, cbData)))
5286 {
5288 goto cleanup;
5289 }
5290
5291 result = RegLoadMUIStringW(hKey, valueW.Buffer, pwszBuffer, cbData, NULL, Flags,
5292 baseDirW.Buffer);
5293
5294 if (result == ERROR_SUCCESS)
5295 {
5296 cbData = WideCharToMultiByte(CP_ACP, 0, pwszBuffer, -1, pszOutBuf, cbOutBuf, NULL, NULL);
5297 if (pcbData)
5298 *pcbData = cbData;
5299 }
5300
5301cleanup:
5302 HeapFree(GetProcessHeap(), 0, pwszBuffer);
5303 RtlFreeUnicodeString(&baseDirW);
5305
5306 return result;
5307}
LONG WINAPI RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
Definition: reg.c:5168
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
static const WCHAR valueW[]
Definition: object.c:48
GLuint64EXT * result
Definition: glext.h:11304
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by CRegFolder::GetDetailsOf(), HCR_GetClassNameA(), and HCR_MapTypeToValueA().

◆ RegLoadMUIStringW()

LONG WINAPI RegLoadMUIStringW ( IN HKEY  hKey,
IN LPCWSTR pszValue  OPTIONAL,
OUT LPWSTR  pszOutBuf,
IN DWORD  cbOutBuf,
OUT LPDWORD pcbData  OPTIONAL,
IN DWORD  Flags,
IN LPCWSTR pszDirectory  OPTIONAL 
)

Definition at line 5168 of file reg.c.

5176{
5177 DWORD dwValueType, cbData;
5178 LPWSTR pwszTempBuffer = NULL, pwszExpandedBuffer = NULL;
5179 LONG result;
5180
5181 /* Parameter sanity checks. */
5182 if (!hKey || !pszOutBuf)
5184
5185 if (pszDirectory && *pszDirectory)
5186 {
5187 FIXME("BaseDir parameter not yet supported!\n");
5189 }
5190
5191 /* Check for value existence and correctness of it's type, allocate a buffer and load it. */
5192 result = RegQueryValueExW(hKey, pszValue, NULL, &dwValueType, NULL, &cbData);
5193 if (result != ERROR_SUCCESS) goto cleanup;
5194 if (!(dwValueType == REG_SZ || dwValueType == REG_EXPAND_SZ) || !cbData)
5195 {
5197 goto cleanup;
5198 }
5199 pwszTempBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
5200 if (!pwszTempBuffer)
5201 {
5203 goto cleanup;
5204 }
5205 result = RegQueryValueExW(hKey, pszValue, NULL, &dwValueType, (LPBYTE)pwszTempBuffer, &cbData);
5206 if (result != ERROR_SUCCESS) goto cleanup;
5207
5208 /* Expand environment variables, if appropriate, or copy the original string over. */
5209 if (dwValueType == REG_EXPAND_SZ)
5210 {
5211 cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR);
5212 if (!cbData) goto cleanup;
5213 pwszExpandedBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
5214 if (!pwszExpandedBuffer)
5215 {
5217 goto cleanup;
5218 }
5219 ExpandEnvironmentStringsW(pwszTempBuffer, pwszExpandedBuffer, cbData);
5220 }
5221 else
5222 {
5223 pwszExpandedBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
5224 memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData);
5225 }
5226
5227 /* If the value references a resource based string, parse the value and load the string.
5228 * Else just copy over the original value. */
5230 if (*pwszExpandedBuffer != L'@') /* '@' is the prefix for resource based string entries. */
5231 {
5232 lstrcpynW(pszOutBuf, pwszExpandedBuffer, cbOutBuf / sizeof(WCHAR));
5233 }
5234 else
5235 {
5236 WCHAR* pComma = wcsrchr(pwszExpandedBuffer, L',');
5237 UINT uiStringId;
5239
5240 /* Format of the expanded value is 'path_to_dll,-resId' */
5241 if (!pComma || pComma[1] != L'-')
5242 {
5244 goto cleanup;
5245 }
5246
5247 uiStringId = _wtoi(pComma + 2);
5248 *pComma = L'\0';
5249
5250 hModule = LoadLibraryExW(pwszExpandedBuffer + 1, NULL, LOAD_LIBRARY_AS_DATAFILE);
5251 if (!hModule || !load_string(hModule, uiStringId, pszOutBuf, cbOutBuf / sizeof(WCHAR)))
5254 }
5255
5256cleanup:
5257 HeapFree(GetProcessHeap(), 0, pwszTempBuffer);
5258 HeapFree(GetProcessHeap(), 0, pwszExpandedBuffer);
5259 return result;
5260}
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: reg.c:5126
#define FreeLibrary(x)
Definition: compat.h:748
#define lstrcpynW
Definition: compat.h:738
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:367
#define ERROR_BADKEY
Definition: winerror.h:589

Referenced by RegLoadMUIStringA().

◆ RegNotifyChangeKeyValue()

LONG WINAPI RegNotifyChangeKeyValue ( HKEY  hKey,
BOOL  bWatchSubtree,
DWORD  dwNotifyFilter,
HANDLE  hEvent,
BOOL  fAsynchronous 
)

Definition at line 3152 of file reg.c.

3157{
3162
3164 {
3165 return ERROR_INVALID_HANDLE;
3166 }
3167
3168 if ((fAsynchronous != FALSE) && (hEvent == NULL))
3169 {
3171 }
3172
3174 hKey);
3175 if (!NT_SUCCESS(Status))
3176 {
3178 }
3179
3180 /* FIXME: Remote key handles must fail */
3181
3183 hEvent,
3184 0,
3185 0,
3187 dwNotifyFilter,
3188 bWatchSubtree,
3189 0,
3190 0,
3191 fAsynchronous);
3193 {
3195 }
3196
3198
3199 return ErrorCode;
3200}
#define STATUS_TIMEOUT
Definition: d3dkmdt.h:49
static HANDLE hEvent
Definition: comm.c:54
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
NTSTATUS NTAPI NtNotifyChangeKey(IN HANDLE KeyHandle, IN HANDLE Event, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG CompletionFilter, IN BOOLEAN WatchTree, OUT PVOID Buffer, IN ULONG Length, IN BOOLEAN Asynchronous)
Definition: ntapi.c:1290

Referenced by notif_thread_proc(), ATL::CRegKey::NotifyChangeKeyValue(), test_RegNotifyChangeKeyValue(), and WsSetupCatalogProtection().

◆ RegOpenCurrentUser()

LONG WINAPI RegOpenCurrentUser ( IN REGSAM  samDesired,
OUT PHKEY  phkResult 
)

◆ RegOpenKeyA()

LONG WINAPI RegOpenKeyA ( HKEY  hKey,
LPCSTR  lpSubKey,
PHKEY  phkResult 
)

Definition at line 3234 of file reg.c.

3237{
3238 TRACE("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n",
3239 hKey, lpSubKey, phkResult);
3240
3241 if (!phkResult)
3243
3244 if (!hKey && !lpSubKey)
3245 {
3246 *phkResult = hKey;
3247 return ERROR_SUCCESS;
3248 }
3249
3250 return RegOpenKeyExA(hKey,
3251 lpSubKey,
3252 0,
3254 phkResult);
3255}

Referenced by _test_key_exists(), _test_key_not_exists(), _test_reg_key(), check_dirid(), check_reg_entries(), cleanup_eventlog(), create_new_eventlog(), CryptGetOIDFunctionValue(), CryptSetOIDFunctionValue(), device_disabled_registry(), DirectDrawEnumerateExA(), DllMain(), env_absent(), env_present(), filedlg_collect_places_pidls(), find_fallback_font(), FindDfltProvRegVals(), FindProvRegVals(), FindProvTypesRegVals(), get_app_key(), get_owner_company(), get_progfiles_dir(), get_program_files_dir(), get_reg_dword(), get_shell_icon_size(), get_user_dirs(), GetAdaptersInfo(), is_places_bar_enabled(), lffromreg(), lineGetCountryA(), lineGetTranslateCapsA(), load_wine_gecko_v(), LoadRegistryMMEDrivers(), metricfromreg(), MIDIMAP_LoadSettingsScheme(), MMDRV_Init(), pa_absent(), pa_present(), pub_absent(), pub_present(), r_verifyProxyEnable(), rci_absent(), rci_present(), register_zone_domains(), RegisterDefaultAcceptHeaders(), RegQueryValueA(), rei_absent(), rei_present(), rmi_absent(), rmi_present(), rpi_absent(), rpi_present(), setup_dsound_options(), setup_main_key(), SHRegOpenKeyA(), SmoothScrollWindow(), spy_init(), sr_absent(), sr_present(), test_AddERExcludedApplicationA(), test_autocreation(), test_child_heap(), test_classesroot(), test_classesroot_enum(), test_classesroot_mask(), test_deleted_key(), test_device_interface_key(), test_GetAcceptLanguagesA(), test_install_from(), test_install_services(), test_Installer_InstallProduct(), test_installprops(), test_internet_features(), test_internet_features_registry(), test_MsiInstallProduct(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListAddSourceEx(), test_MsiSourceListSetInfo(), test_perflib_key(), test_publish_assemblies(), test_publish_components(), test_publish_features(), test_publish_product(), test_reg_close_key(), test_reg_copy_tree(), test_reg_delete_key(), test_reg_delete_tree(), test_reg_load_key(), test_reg_open_key(), test_register_class_info(), test_register_extension_info(), test_register_mime_info(), test_register_product(), test_register_progid_info(), test_registerDefaultOIDFunction(), test_registerOIDInfo(), test_registrar(), test_registry(), test_registry_property_a(), test_RegQueryValueExPerformanceData(), test_self_registration(), test_SetZoneAttributes(), test_SHCopyKey(), test_SHDeleteKey(), test_SHGetFolderPathA(), test_SHGetObjectCompatFlags(), test_symlinks(), test_url_action(), test_write_registry_values(), test_zone_domain_cache(), test_zone_domain_mappings(), uniquecontainer(), unregister_zone_domains(), wined3d_dll_init(), wrv_absent(), and wrv_present().

◆ RegOpenKeyExA()

LONG WINAPI RegOpenKeyExA ( _In_ HKEY  hKey,
_In_ LPCSTR  lpSubKey,
_In_ DWORD  ulOptions,
_In_ REGSAM  samDesired,
_Out_ PHKEY  phkResult 
)

Definition at line 3298 of file reg.c.

3304{
3305 UNICODE_STRING SubKeyString;
3307
3308 TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n",
3309 hKey, lpSubKey, ulOptions, samDesired, phkResult);
3310
3311 if (lpSubKey)
3312 {
3313 if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyString, lpSubKey))
3315 }
3316 else
3317 RtlInitEmptyUnicodeString(&SubKeyString, NULL, 0);
3318
3319 ErrorCode = RegOpenKeyExW(hKey, SubKeyString.Buffer, ulOptions, samDesired, phkResult);
3320
3321 RtlFreeUnicodeString(&SubKeyString);
3322
3323 return ErrorCode;
3324}

Referenced by check_user_privs(), create_test_verb_dde(), CRYPT_GetFuncFromReg(), CryptUnregisterOIDInfo(), debugstr_iid(), delete_key(), delete_reg_entries(), delete_registry_key(), delete_tree(), delete_tree_(), DeleteRegistryValue(), DP_LoadSP(), find_default_printer(), find_registry_key(), font_absent(), font_present(), get_owner_company(), get_system_dirs(), GetAdapterFriendlyName(), GetDriverName(), GetNetworkParams(), HaveDefaultMailClient(), HCR_GetIconA(), HCR_MapTypeToValueA(), HCR_RegOpenClassIDKey(), ICInfo(), ICInstall(), ICRemove(), IDirectMusic8Impl_GetDefaultPort(), IDirectPlay4AImpl_EnumConnections(), IDirectPlayLobby3AImpl_EnumAddressTypes(), IDirectPlayLobby3AImpl_EnumLocalApplications(), init_registered_oid_info(), initialize(), is_ie_hardened(), main(), Main_DirectDraw_GetDeviceIdentifier7(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), on_vmware(), open_container_key(), open_key_(), pf_absent(), pf_present(), pp_absent(), pp_present(), ppc_absent(), ppc_present(), PrintSystemInfo(), proxy_active(), QueryConfig2A(), rci_absent(), rci_present(), read_oid_info(), ReadRegistryComputerNameValue(), ReadRegistryValue(), reg_get_typelib_module(), RegGetValueA(), RegOpenKeyA(), rp_absent(), rp_present(), rpi_absent(), rpi_present(), ru_absent(), ru_present(), scan_subkeys(), set_domain(), set_name_servers(), setup_adapter(), SHADD_get_policy(), SHDeleteEmptyKeyA(), SHDeleteOrphanKeyA(), SHDeleteValueA(), SHGetValueA(), SHOpenRegStream2A(), SHPinDllOfCLSID(), SHRegDuplicateHKey(), START_TEST(), test_classesroot(), test_enumdisplaydevices_adapter(), test_file_in_use(), test_file_in_use_cab(), test_get_profiles_dir(), test_ICInfo(), test_impersonation_level(), test_installprops(), test_machine_guid(), test_mixed_package(), test_MsiConfigureProductEx(), test_MsiInstallProduct(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListAddSourceEx(), test_MsiSourceListSetInfo(), test_NonExistentPath(), test_null(), test_process_components(), test_publish(), test_publish_assemblies(), test_publish_features(), test_publish_product(), test_redirection(), test_reg_open_key(), test_register_font(), test_register_product(), test_register_typelib(), test_register_user(), test_RegPolicyFlags(), test_RegQueryValueExPerformanceData(), test_remove_upgrade_code(), test_SetupDiOpenClassRegKeyExA(), test_SHCreateDefaultContextMenu(), test_SHQueryValueEx(), test_SQLInstallDriverEx(), test_SQLInstallTranslatorEx(), test_stub(), test_symlinks(), test_TreatAsClass(), test_XcvDataPort_ConfigureLPTPortCommandOK(), test_XcvDataPort_GetTransmissionRetryTimeout(), uniquecontainer(), unregister_keys(), verify_key_(), verify_key_nonexist_(), WhichPlatform(), and WriteRegistryValue().

◆ RegOpenKeyExW()

LONG WINAPI RegOpenKeyExW ( HKEY  hKey,
LPCWSTR  lpSubKey,
DWORD  ulOptions,
REGSAM  samDesired,
PHKEY  phkResult 
)

Definition at line 3333 of file reg.c.

3338{
3340 UNICODE_STRING SubKeyString;
3345 BOOLEAN SubKeyStringAllocated = FALSE;
3346
3347 TRACE("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n",
3348 hKey, lpSubKey, ulOptions, samDesired, phkResult);
3349 if (!phkResult)
3350 {
3352 }
3353
3354 if (!hKey && lpSubKey && phkResult)
3355 {
3356 return ERROR_INVALID_HANDLE;
3357 }
3358
3359 if (IsPredefKey(hKey) && (!lpSubKey || !*lpSubKey))
3360 {
3361 *phkResult = hKey;
3362 return ERROR_SUCCESS;
3363 }
3364
3366 if (!NT_SUCCESS(Status))
3367 {
3369 }
3370
3371 if (IsHKCRKey(KeyHandle))
3372 {
3373 ErrorCode = OpenHKCRKey(KeyHandle, lpSubKey, ulOptions, samDesired, phkResult);
3375 return ErrorCode;
3376 }
3377
3378 if (ulOptions & REG_OPTION_OPEN_LINK)
3380
3381 if (lpSubKey == NULL || wcscmp(lpSubKey, L"\\") == 0)
3382 {
3383 RtlInitUnicodeString(&SubKeyString, L"");
3384 }
3385 else
3386 {
3387 RtlInitUnicodeString(&SubKeyString, lpSubKey);
3388
3389 /* Handle unaligned lpSubKey */
3390 if ((ULONG_PTR)lpSubKey & 1)
3391 {
3392 UNICODE_STRING AlignedString;
3393
3395 &SubKeyString,
3396 &AlignedString);
3397 if (!NT_SUCCESS(Status))
3398 {
3399 goto Exit;
3400 }
3401
3402 SubKeyString = AlignedString;
3403 SubKeyStringAllocated = TRUE;
3404 }
3405 }
3406
3408 &SubKeyString,
3409 Attributes,
3410 KeyHandle,
3411 NULL);
3412
3413 Status = NtOpenKey((PHANDLE)phkResult,
3414 samDesired,
3416
3417Exit:
3418
3419 if (SubKeyStringAllocated)
3420 {
3421 RtlFreeUnicodeString(&SubKeyString);
3422 }
3423
3424 if (!NT_SUCCESS(Status))
3425 {
3427 }
3428
3430
3431 return ErrorCode;
3432}
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
LONG WINAPI OpenHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _In_ PHKEY phkResult)
Definition: hkcr.c:370
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int, const UNICODE_STRING *, UNICODE_STRING *)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by _CmdWndProc(), CBandSiteMenu::_CreateMenuPart(), _enumeratorRememberedW(), _HandleConfigureLPTPortCommandOK(), _InitializeLocalSpooler(), _InitializePrintProviderList(), _LocalGetPrinterHandleData(), _LocalGetPrintServerHandleData(), _LocalSetPrinterHandleData(), _LocalSetPrintServerHandleData(), _OpenEnvironment(), _tryLoadProvider(), AboutDlgProc(), AddClassKeyToArray(), AddNewLayout(), AddNotificationDll(), AddSoundProfile(), CDefaultContextMenu::AddStaticEntriesForKey(), AddUserProfiles(), AllSysInfo(), ApplyChanges(), ApplyOrCancelChanges(), BuildCodePageList(), BuildLogListAndFilterList(), BuildParameterArray(), BuildServiceArray(), BuildVolatileEnvironment(), CallNotificationDll(), CallNotificationDlls(), CanUserWritePwrScheme(), capGetDriverDescriptionW(), CategoryMgr_FindClosestCategory(), CategoryMgr_RegisterCategory(), CategoryMgr_UnregisterCategory(), ChangeNtProductType(), check_product_patches(), CheckForLiveCD(), CheckForLoadedProfile(), CheckLogOrSourceExistence(), ChooseFavorite(), ChooseGinaUI(), CliGetImeHotKeysFromRegistry(), CliGetPreloadKeyboardLayouts(), CliSetSingleHotKey(), CM_Open_Class_Key_ExW(), CM_Open_DevNode_Key_Ex(), ComponentInfo_GetGuidList(), ConCfgOpenUserSettings(), ConverterSupportsFormat(), CopyKey(), create_EnumMoniker(), create_monodata(), CreateComponentEnumerator(), CreateComponentInfo(), CreateDeviceInstance(), CreateEnvironmentBlock(), CreateEventLog(), CreateHKCRKey(), CreateKeyboardLayoutList(), CreateNewValue(), CreateNotificationObject(), CreateNTPServerList(), CreateStandardProfile(), CreateTempDir(), CreateUserHive(), CreateUserProfileExW(), CredReadW(), CriticalDeviceCoInstaller(), CRYPT_CreateMachineGuid(), CRYPT_OpenParentStore(), CRYPT_OpenSIPFunctionKey(), CRYPT_RegReadSerializedFromReg(), CRYPT_SysRegOpenStoreW(), CRYPTDLG_CheckOnlineCRL(), CryptSIPRetrieveSubjectGuid(), DecrementRefCount(), delete_key(), delete_test_key(), DeleteExt(), DeleteHelperCommand(), DeleteKey(), DeleteProfileW(), DeleteSubKey(), DEVENUM_IEnumMoniker_Next(), DEVENUM_ReadPins(), DEVENUM_ReadPinTypes(), devinst_RegDeleteTreeW(), DirectPlayEnumerateAW(), DisableShellext(), CNetConnection::Disconnect(), DisplayClassCoinstallers(), DisplayImageInfo(), DllMain(), DllRegisterServer(), DllUnregisterServer(), DMOGetName(), DMOGetTypes(), DMOUnregister(), DoGetProductType(), DoLoadItems(), DoWriteProductOption(), DoWriteSoundEvents(), DRIVER_GetLibName(), EditTypeDlg_ReadClass(), enum_key(), enum_values(), EnumClientServiceProtocol(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumerateNetworkComponent(), EnumerateSoundProfiles(), EnumerateTimeZoneList(), EnumHKCRKey(), EnumInterfaces(), EnumPwrSchemes(), EnumTfLanguageProfiles_Clone(), export_registry_data(), ExportRegistryFile(), FDebugBreakForService(), fetch_machine_component(), fetch_machine_product(), fetch_user_component(), fetch_user_product(), FILEDLG95_unixfs_is_rooted_at_desktop(), FileTypesDlg_InsertToLV(), FillServerAddressCombo(), FilterMapper_RegisterPin(), FilterMapper_RegisterPinType(), FilterMapper_UnregisterFilter(), FilterMapper_UnregisterPin(), find_typelib_key(), FindExeCplClass(), FindNetworkAdapter(), ForceFriendlyUI(), get_default_proxy_reg_value(), get_fusion_filename(), get_install_root(), get_mono_path_from_registry(), get_patch_state(), GetActivePwrScheme(), GetAllUsersProfileDirectoryW(), GetAssocClass(), GetAutoDaylight(), GetBooleanRegValue(), GetBootResourceList(), GetClassMediaFile(), CQueryAssociations::GetCommand(), GetComputerNames(), GetCurrentHwProfileW(), GetCurrentUserKey(), GetDefaultPrinterFromRegistry(), GetDefaultPrinterW(), GetDefaultUserProfileDirectoryW(), GetDesktopPath(), CNetConnectionPropertyUi::GetDeviceInstanceID(), GetDeviceInstanceList(), GetDeviceInstanceListSize(), GetDisplayNameFileAndID(), GetEnumeratorInstanceList(), GetEnumeratorInstanceListSize(), GetEnumOptions(), GetEventMessageFileDLL(), GetFallbackHKCRKey(), GetFileTypeIconsByKey(), GetGinaPath(), GetHotPlugFlags(), GetInterfaceFriendlyName(), GetInterfaceNameInternal(), GetIntervalSetting(), GetJapaneseUninstallCmdLine(), GetLayoutCount(), GetLayoutName(), GetLPTTransmissionRetryTimeout(), GetPerAdapterInfo(), GetPreferredHKCRKey(), GetProfile(), GetProfileCount(), GetProfiles(), GetProfilesDirectoryW(), GetProfileType(), GetProgramsPath(), CNetConnection::GetProperties(), GetPwrDiskSpindownRange(), GetRegistrySettings(), GetRegValue(), GetResourceList(), GetServiceInstanceList(), GetServiceInstanceListSize(), GetSetupType(), GetShell(), GetShutdownReasonUI(), CQueryAssociations::GetString(), GetSubkeyInfoHelper(), GetSyncSetting(), GetTimeZoneListIndex(), GetTypeName(), CZipFolder::GetUIObjectOf(), GetUsedPorts(), GetUserProfileDirectoryW(), GetUserWaitInterval(), GUILoggedOutSAS(), HCR_GetDefaultVerbW(), HCR_GetExecuteCommandW(), HCR_GetFolderAttributes(), HCR_GetIconW(), HCR_MapTypeToValueW(), IEnumDMO_Constructor(), IEnumDMO_fnNext(), ImageView_LoadSettings(), ImmLoadLayout(), ImpersonateTokenWithEveryoneOrWithout(), ImportAppProfile(), ImportRegistryFile(), ImportSoundEntry(), ImportSoundLabel(), ImportSoundProfiles(), IncrementRefCount(), INetCfgComponent_fnOpenParamKey(), INetCfgLock_fnAcquireWriteLock(), INetCfgLock_fnIsWriteLocked(), CQueryAssociations::Init(), CRegPropertyBag::Init(), InitAudioDlg(), CEnumRegKey::Initialize(), InitializeDefaultUserLocale(), InitializeDialog(), InitializeDirectPlayDialog(), InitializeFormList(), InitializePnPManager(), InitializePrinterList(), InitializePrintMonitor2(), InitializePrintMonitorList(), InitializePrintProcessorList(), InitializeProfiles(), InitializeProgramFilesDir(), InitIconOverlays(), InitKeyboardLayouts(), InitNotifications(), InitPropertiesDlg(), InitSettings(), InitTTFontCache(), InitWorkstationInfo(), InputList_PrepareUserRegistry(), InputProcessorProfiles_AddLanguageProfile(), InputProcessorProfiles_EnableLanguageProfile(), InputProcessorProfiles_EnableLanguageProfileByDefault(), InputProcessorProfiles_GetDefaultLanguageProfile(), InputProcessorProfiles_IsEnabledLanguageProfile(), InstallDevice(), InstallOneService(), InstallReactOS(), InstallScreenSaverW(), Int_EnumDependentServicesW(), IntGetIcdData(), IntLoadKeyboardLayout(), IsConsoleBoot(), IsExtensionAShortcut(), IsFriendlyUIActive(), IsInternetESCEnabledLocal(), IsLayoutExists(), IsLiveCD(), IsShowHibernateButtonActive(), IsWindowsOS(), KLIDFromSpecialHKL(), CNetConnectionPropertyUi::LANPropertiesUIDlg(), LayoutList_Create(), load_mapi_providers(), LoadAdvancedSettings(), COpenWithList::LoadAppList(), LoadBoard(), CNewMenu::LoadCachedItems(), LoadCurrentLocale(), LoadDNSSettings(), LoadDWORDFromRegistry(), LoadEventLabel(), LoadEventLabels(), LoadFilterSettings(), LoadHelpers(), LoadInstallableVDD(), CNewMenu::LoadItem(), LoadLogFiles(), COpenWithList::LoadProgIdList(), CInputPin::LoadProxyPlugins(), COutputPin::LoadProxyPlugins(), CKsProxy::LoadProxyPlugins(), COpenWithList::LoadRecommendedFromHKCR(), COpenWithList::LoadRecommendedFromHKCU(), LoadRegistrySettings(), LoadSettings(), LoadShutdownSelState(), LoadSoundProfiles(), LoadStringFromRegistry(), LoadUsernameHint(), LoadUserProfileW(), LocaleList_Create(), LocalEnumPrintProcessors(), MainWnd_OnInstall(), MainWnd_OnUpdateRegistry(), MCI_GetDevTypeFromFileName(), MCI_SysInfo(), MMDevPropStore_OpenPropKey(), MMSYS_InstallDevice(), MRU_SaveChanged(), MSACM_RegisterAllDrivers(), MSACM_RegisterDriverFromRegistry(), MsiGetPatchInfoExW(), MSIREG_DeleteClassesUpgradeCodesKey(), MSIREG_DeleteLocalClassesFeaturesKey(), MSIREG_DeleteLocalClassesProductKey(), MSIREG_DeleteProductKey(), MSIREG_DeleteUninstallKey(), MSIREG_DeleteUpgradeCodesKey(), MSIREG_DeleteUserDataComponentKey(), MSIREG_DeleteUserDataPatchKey(), MSIREG_DeleteUserDataProductKey(), MSIREG_OpenClassesUpgradeCodesKey(), MSIREG_OpenFeaturesKey(), MSIREG_OpenInstallerFeaturesKey(), MSIREG_OpenInstallProps(), MSIREG_OpenPatchesKey(), MSIREG_OpenProductKey(), MSIREG_OpenUninstallKey(), MSIREG_OpenUpgradeCodesKey(), MSIREG_OpenUserComponentsKey(), MSIREG_OpenUserDataComponentKey(), MSIREG_OpenUserDataFeaturesKey(), MSIREG_OpenUserDataPatchKey(), MSIREG_OpenUserDataProductKey(), MSIREG_OpenUserDataProductPatchesKey(), myRegDeleteTreeW(), NetBTInit(), NetIDPage_OnApply(), NetIDPage_OnInitDialog(), NetworkDlg_OnOK(), next_LanguageProfile(), OnAutoSync(), OnTreeExpanding(), open_env_key(), open_export_key(), open_key(), OpenChildKeyRead(), OpenComputerNameKey(), OpenConfigurationKey(), OpenHardwareProfileKey(), OpenHKCRKey(), OpenHostNameKey(), OpenHostsFile(), OpenImageFileExecOptions(), OpenKey(), OpenKeyboardLayouts(), OpenKeyFromFileType(), OpenRegKey(), OpenServiceParametersKey(), package_RegDeleteTreeW(), pendingRename(), PNP_AddID(), PNP_CreateKey(), PNP_GetClassCount(), PNP_GetClassInstance(), PNP_GetClassName(), PNP_GetClassRegProp(), PNP_GetCustomDevProp(), PNP_GetDeviceRegProp(), PNP_GetHwProfInfo(), PNP_HwProfFlags(), PNP_IsDockStationPresent(), PNP_SetClassRegProp(), PNP_SetDeviceRegProp(), PNP_ValidateDeviceInstance(), POWRPROF_GetMachinePowerPolicy(), POWRPROF_GetUserPowerPolicy(), PrintOSVersion(), process_extensions(), ProcessPage_OnDebug(), ProcessPageShowContextMenu(), ProcessRunKeys(), ProcessRunOnceEx(), ProcessSetupInf(), ProcessUnattendSection(), query_all(), query_typelib_path(), query_value(), QueryAppSettings(), QueryConfig2W(), QueryUserRegValueW(), RControlService(), read_bitmap_patterns(), read_key(), read_metadata_patterns(), read_types(), ReadAttributes(), ReadBindingString(), ReadGlobalPwrPolicy(), ReadKeysSettings(), ReadPerInstanceRegistryParameters(), ReadPortSettings(), ReadRegistryValue(), RefreshListView(), RefreshTreeItem(), reg_delete_tree(), reg_export(), RegDeleteKeyValueW(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RegFindRecurse(), RegFindWalk(), RegGetDWORD(), RegGetDWORDValue(), RegGetSZ(), RegGetValueW(), register_legacy_filters(), registry_enumerate_credentials(), registry_get_handle(), RegKeyExists(), RegOpenKeyExA(), RegOpenKeyW(), RegQueryRegistryKeys(), RegQueryRegistryValues(), RegSetDWORDValue(), RegTGetKeyHandle(), RemoveEventLog(), CNetConnection::Rename(), REnumDependentServicesA(), REnumDependentServicesW(), ReportProductInfoEvent(), ReturnNtProduct(), run_copy(), run_delete(), run_query(), RunSetupThreadProc(), SampIsSetupRunning(), SaveAdvancedSettings(), SaveAppSettings(), SaveCurrentLocale(), SaveDefaultUserHive(), SaveGeoID(), SavePropertiesDlg(), SaveSettings(), SaveWorkstationInfo(), ScmAssignNewTag(), ScmAutoStartServices(), ScmCopyControlSet(), ScmCreateServiceDatabase(), ScmCreateServiceKey(), ScmDeleteControlSet(), ScmDeleteMarkedServices(), ScmDeleteRegKey(), ScmDeleteService(), ScmGetControlSetValues(), ScmGetNoInteractiveServicesValue(), ScmGetSetupInProgress(), ScmInitNamedPipeCriticalSection(), ScmOpenServiceKey(), ScmReadSecurityDescriptor(), ScmSetLastKnownGoodControlSet(), SdbUninstallByGuid(), SdbUninstallByName(), search_reg(), SECUR32_initializeProviders(), SelectExtOnRename(), set_installer_properties(), SetAutoAdminLogon(), SetAutoDaylight(), COpenWithList::SetDefaultHandler(), SetDefaultLanguage(), SetDefaultPrinterW(), SetInstallationCompleted(), SetKeyboardLayoutName(), SetNTPServer(), SetProfileData(), SetSetupType(), SetSystemEnvironment(), SetTime(), SETUP_CreateClassKey(), SETUP_CreateInterfaceList(), SETUPAPI_GetCurrentHwProfile(), SetupDeviceInstance(), SETUPDI_CreateDrvKey(), SETUPDI_OpenDevKey(), SETUPDI_OpenDrvKey(), SetupDiCallClassInstaller(), SetupDiClassGuidsFromNameExW(), SetupDiOpenClassRegKeyExW(), SetupDiOpenDeviceInfoW(), SetupDiOpenDeviceInterfaceRegKey(), SetupDiOpenDeviceInterfaceW(), SetupDiOpenDevRegKey(), SetupIsActive(), SetUserEnvironment(), SetUserSysColors(), SetUserWaitInterval(), SetUserWallpaper(), SetWelcomeText(), SHAboutInfoW(), SHCoCreateInstance(), SHCopyKeyW(), SHCreatePropSheetExtArrayEx(), SHDeleteEmptyKeyW(), SHDeleteKeyW(), SHDeleteOrphanKeyW(), SHDeleteValueW(), SHDOCVW_GetShellInstanceObjectClassObject(), SHELL_FindExecutableByVerb(), SHELL_IsShortcut(), SHELL_TryAppPathW(), SHGetShellKey(), SHGetValueW(), SHOpenRegStream2W(), SHPropertyBag_OnRegKey(), SHRegGetCLSIDKeyW(), SHRegOpenUSKeyW(), SockLoadHelperDll(), SockLoadTransportList(), SockLoadTransportMapping(), SQLGetInstalledDriversW(), START_TEST(), StartScreenSaver(), StartShell(), SuggestKeys(), test4(), test_CallForAttributes(), Test_CreateOpenKey(), Test_DuplicateHandle(), Test_KLID(), test_set_value(), test_SetupDiInstallClassExA(), test_setvalue_on_wow64(), test_SQLGetPrivateProfileString(), test_SQLGetPrivateProfileStringW(), test_SQLWritePrivateProfileString(), TestInterfaceRegistry(), TestKeyAccess_(), TestModuleRegistry(), TestMyEventProvider(), testRegStoreSavedCerts(), TLB_unregister_interface(), TOOLBAR_Restore(), TreeWndNotifyProc(), TTIsEmbeddingEnabledForFacename(), txt_export_registry_data(), txt_open_export_key(), UIINSERTOBJECTDLG_PopulateObjectTypes(), UnloadUserProfile(), unregister_categories(), unregister_coclasses(), unregister_converters(), unregister_decoders(), unregister_dmo_from_category(), unregister_encoders(), unregister_interfaces(), unregister_mediatypes_extension(), unregister_mediatypes_parsing(), unregister_metadatareaders(), unregister_pixelformats(), UnregisterComponent(), UnRegisterTypeLib(), UpdateCaretBlinkTimeReg(), UpdateRegistryForFontSubstitutes(), UpdateTcpIpInformation(), UpdateUsersShellFolderSettings(), URL_ApplyDefault(), URL_GuessScheme(), UserInstStubWrapperW(), UXTHEME_RestoreSystemMetrics(), ViewDlg_Apply(), ViewDlg_RestoreDefaults(), ViewTree_LoadAll(), ViewTree_LoadTree(), W32TmServiceMain(), WinHttpGetDefaultProxyConfiguration(), WinHttpGetIEProxyConfigForCurrentUser(), WINTRUST_ReadProviderFromReg(), WlxActivateUserShell(), WlxScreenSaverNotify(), wmain(), wnetInit(), WNetOpenEnumW(), WriteComputerSettings(), WriteDefaultLogonData(), WriteKeysSettings(), WriteOwnerSettings(), WritePortSettings(), WriteSettings(), and wWinMain().

◆ RegOpenKeyW()

LONG WINAPI RegOpenKeyW ( HKEY  hKey,
LPCWSTR  lpSubKey,
PHKEY  phkResult 
)

Definition at line 3268 of file reg.c.

3271{
3272 TRACE("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n",
3273 hKey, lpSubKey, phkResult);
3274
3275 if (!phkResult)
3277
3278 if (!hKey && !lpSubKey)
3279 {
3280 *phkResult = hKey;
3281 return ERROR_SUCCESS;
3282 }
3283
3284 return RegOpenKeyExW(hKey,
3285 lpSubKey,
3286 0,
3288 phkResult);
3289}

Referenced by _HandleAddPort(), _HandleDeletePort(), ACTION_UnregisterClassInfo(), CRegFolderEnum::AddItemsFromKey(), AddPrintMonitorList(), CDefaultContextMenu::AddStaticContextMenusToMenu(), AVIBuildFilterW(), build_zonemap_from_reg(), cache_container_set_size(), capGetDriverDescriptionW(), connections_on_initdialog(), connections_on_notify(), Control_RegisterRegistryApplets(), CreateNewKey(), CryptAcquireContextW(), CryptEnumProvidersW(), CryptEnumProviderTypesW(), CryptGetDefaultProviderW(), CryptSetProviderExW(), DEVENUM_ICreateDevEnum_CreateClassEnumerator(), DEVENUM_IPropertyBag_Read(), do_process_key(), ATL::CRegObject::do_process_key(), EnableTheming(), ensure_useragent(), find_mime_from_ext(), FTP_Connect(), general_on_notify(), get_dest_dir(), get_engine_clsid(), get_feature_from_reg(), get_mapping_key(), get_mime_clsid(), get_mime_filter(), get_mmioFromProfile(), get_privateprofile_sectionkey(), get_protocol_cf(), get_url_encoding(), get_zone_from_domains(), get_zone_from_reg(), GetAcceptLanguagesW(), GetActiveClassicTheme(), GetFindFlags(), go_home(), HlinkGetSpecialReference(), Imm32GetImeLayout(), Imm32IsCUASEnabledInRegistry(), Imm32IsTIMDisabledInRegistry(), Imm32WriteImeLayout(), init_driver(), InitShellServices(), InstallerImpl_RegistryValue(), InstallOneService(), INTERNET_LoadProxySettings(), INTERNET_SaveProxySettings(), IntLoadPreloadKeyboardLayouts(), IsThemeActive(), lineGetCountryW(), COpenWithList::Load(), load_config_driver(), load_process_feature(), load_settings(), load_wine_gecko(), LoadClassicColorSchemes(), LoadCurrentScheme(), LoadSchemeFromReg(), LoadSchemeSizes(), LoadSettings(), LoadSMBiosData(), LocalmonAddPort(), LocalmonAddPortEx(), LocalmonDeletePort(), MakeService(), MIDIMAP_LoadSettings(), MIDIMAP_LoadSettingsScheme(), MMDevEnum_GetDefaultAudioEndpoint(), MSACM_ReorderDriversByPriority(), MSI_GetProductInfo(), MSIREG_OpenUserComponentsKey(), MSIREG_OpenUserPatchesKey(), MSIREG_OpenUserUpgradeCodesKey(), NetBTInit(), OnInitMenu(), open_zone_key(), OpenMediaSubkey(), OpenNetworkSubkey(), OpenSourceKey(), OpenURLSubkey(), process_args_from_reg(), QueryStringValue(), ReadCabinetState(), RegConnectRegistryW(), RegDeleteKeyW(), CControlPanelEnum::RegisterRegistryCPanelApps(), registry_callback(), RegQueryValueW(), RenameValue(), SaveSystemSettings(), search_domain_for_zone(), set_installer_properties(), set_lang(), SHCreatePropSheetExtArrayEx(), SHELL_FS_HideExtension(), ShellExecute_FromContextMenuHandlers(), ShellExecute_GetClassKey(), SHGetObjectCompatFlags(), SHGetRestriction(), SHRegOpenKeyW(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), START_TEST(), StartWithDesktop(), tapiGetLocationInfoW(), test_BCryptGetFipsAlgorithmMode(), test_DeletePwrScheme(), test_device_key(), test_Installer_RegistryValue(), test_readTrustedPublisherDWORD(), test_register_device_iface(), test_registry_property_w(), test_save(), test_SHCreateSessionKey(), test_WritePwrScheme(), try_application_url(), UniformResourceLocatorW_InvokeCommand(), UXTHEME_LoadTheme(), and write_config_value().

◆ RegOpenUserClassesRoot()

LONG WINAPI RegOpenUserClassesRoot ( IN HANDLE  hToken,
IN DWORD  dwOptions,
IN REGSAM  samDesired,
OUT PHKEY  phkResult 
)

Definition at line 3441 of file reg.c.

3445{
3446 const WCHAR UserClassesKeyPrefix[] = L"\\Registry\\User\\";
3447 const WCHAR UserClassesKeySuffix[] = L"_Classes";
3448 PTOKEN_USER TokenUserData;
3450 UNICODE_STRING UserSidString, UserClassesKeyRoot;
3453
3454 /* check parameters */
3455 if (hToken == NULL || dwOptions != 0 || phkResult == NULL)
3456 {
3458 }
3459
3460 /*
3461 * Get the user sid from the token
3462 */
3463
3464ReadTokenSid:
3465 /* determine how much memory we need */
3467 TokenUser,
3468 NULL,
3469 0,
3472 {
3473 /* NOTE - as opposed to all other registry functions windows does indeed
3474 change the last error code in case the caller supplied a invalid
3475 handle for example! */
3477 }
3478 RegInitialize(); /* HACK until delay-loading is implemented */
3479 TokenUserData = RtlAllocateHeap(ProcessHeap,
3480 0,
3482 if (TokenUserData == NULL)
3483 {
3485 }
3486
3487 /* attempt to read the information */
3489 TokenUser,
3490 TokenUserData,
3493 if (!NT_SUCCESS(Status))
3494 {
3496 0,
3497 TokenUserData);
3499 {
3500 /* the information appears to have changed?! try again */
3501 goto ReadTokenSid;
3502 }
3503
3504 /* NOTE - as opposed to all other registry functions windows does indeed
3505 change the last error code in case the caller supplied a invalid
3506 handle for example! */
3508 }
3509
3510 /*
3511 * Build the absolute path for the user's registry in the form
3512 * "\Registry\User<SID>_Classes"
3513 */
3514 Status = RtlConvertSidToUnicodeString(&UserSidString,
3515 TokenUserData->User.Sid,
3516 TRUE);
3517
3518 /* we don't need the user data anymore, free it */
3520 0,
3521 TokenUserData);
3522
3523 if (!NT_SUCCESS(Status))
3524 {
3526 }
3527
3528 /* allocate enough memory for the entire key string */
3529 UserClassesKeyRoot.Length = 0;
3530 UserClassesKeyRoot.MaximumLength = UserSidString.Length +
3531 sizeof(UserClassesKeyPrefix) +
3532 sizeof(UserClassesKeySuffix);
3533 UserClassesKeyRoot.Buffer = RtlAllocateHeap(ProcessHeap,
3534 0,
3535 UserClassesKeyRoot.MaximumLength);
3536 if (UserClassesKeyRoot.Buffer == NULL)
3537 {
3538 RtlFreeUnicodeString(&UserSidString);
3540 }
3541
3542 /* build the string */
3543 RtlAppendUnicodeToString(&UserClassesKeyRoot,
3544 UserClassesKeyPrefix);
3545 RtlAppendUnicodeStringToString(&UserClassesKeyRoot,
3546 &UserSidString);
3547 RtlAppendUnicodeToString(&UserClassesKeyRoot,
3548 UserClassesKeySuffix);
3549
3550 TRACE("RegOpenUserClassesRoot: Absolute path: %wZ\n", &UserClassesKeyRoot);
3551
3552 /*
3553 * Open the key
3554 */
3556 &UserClassesKeyRoot,
3558 NULL,
3559 NULL);
3560
3561 Status = NtOpenKey((PHANDLE)phkResult,
3562 samDesired,
3564
3565 RtlFreeUnicodeString(&UserSidString);
3566 RtlFreeUnicodeString(&UserClassesKeyRoot);
3567
3568 if (!NT_SUCCESS(Status))
3569 {
3571 }
3572
3573 return ERROR_SUCCESS;
3574}
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI NTSTATUS NTAPI RtlConvertSidToUnicodeString(OUT PUNICODE_STRING DestinationString, IN PVOID Sid, IN BOOLEAN AllocateDestinationString)
SID_AND_ATTRIBUTES User
Definition: setypes.h:1010
USHORT MaximumLength
Definition: env_spec_w32.h:370
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtQueryInformationToken(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation, _In_ ULONG TokenInformationLength, _Out_ PULONG ReturnLength)
Queries a specific type of information in regard of an access token based upon the information class....
Definition: tokencls.c:473
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:30
@ TokenUser
Definition: setypes.h:966

◆ RegOverridePredefKey()

LONG WINAPI RegOverridePredefKey ( IN HKEY  hKey,
IN HKEY hNewHKey  OPTIONAL 
)

Definition at line 366 of file reg.c.

368{
370
371 if ((hKey == HKEY_CLASSES_ROOT ||
376 hKey == HKEY_USERS) &&
377 !IsPredefKey(hNewHKey))
378 {
380 ULONG Index;
381
384
385 if (hNewHKey == NULL)
386 {
387 /* restore the default mapping */
389 &hNewHKey);
390 if (!NT_SUCCESS(Status))
391 {
393 }
394
395 ASSERT(hNewHKey != NULL);
396 }
397 RegInitialize(); /* HACK until delay-loading is implemented */
399
400 /* close the currently mapped handle if existing */
401 if (*Handle != NULL)
402 {
403 NtClose(*Handle);
404 }
405
406 /* update the mapping */
407 *Handle = hNewHKey;
408
410 }
411 else
413
414 return ErrorCode;
415}
#define ASSERT(a)
Definition: mode.c:44
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_USERS
Definition: winreg.h:13

◆ RegpApplyRestrictions()

static VOID RegpApplyRestrictions ( DWORD  dwFlags,
DWORD  dwType,
DWORD  cbData,
PLONG  ret 
)
static

Definition at line 1859 of file reg.c.

1863{
1864 /* Check if the type is restricted by the passed flags */
1865 if (*ret == ERROR_SUCCESS || *ret == ERROR_MORE_DATA)
1866 {
1867 DWORD dwMask = 0;
1868
1869 switch (dwType)
1870 {
1871 case REG_NONE: dwMask = RRF_RT_REG_NONE; break;
1872 case REG_SZ: dwMask = RRF_RT_REG_SZ; break;
1873 case REG_EXPAND_SZ: dwMask = RRF_RT_REG_EXPAND_SZ; break;
1874 case REG_MULTI_SZ: dwMask = RRF_RT_REG_MULTI_SZ; break;
1875 case REG_BINARY: dwMask = RRF_RT_REG_BINARY; break;
1876 case REG_DWORD: dwMask = RRF_RT_REG_DWORD; break;
1877 case REG_QWORD: dwMask = RRF_RT_REG_QWORD; break;
1878 }
1879
1880 if (dwFlags & dwMask)
1881 {
1882 /* Type is not restricted, check for size mismatch */
1883 if (dwType == REG_BINARY)
1884 {
1885 DWORD cbExpect = 0;
1886
1887 if ((dwFlags & RRF_RT_ANY) == RRF_RT_DWORD)
1888 cbExpect = 4;
1889 else if ((dwFlags & RRF_RT_ANY) == RRF_RT_QWORD)
1890 cbExpect = 8;
1891
1892 if (cbExpect && cbData != cbExpect)
1894 }
1895 }
1897 }
1898}
#define RRF_RT_REG_BINARY
Definition: driver.c:577
#define RRF_RT_REG_QWORD
Definition: driver.c:580
#define RRF_RT_REG_DWORD
Definition: driver.c:578
#define RRF_RT_REG_MULTI_SZ
Definition: driver.c:579
#define RRF_RT_REG_NONE
Definition: driver.c:574
#define RRF_RT_DWORD
Definition: driver.c:581
#define RRF_RT_QWORD
Definition: driver.c:582
#define RRF_RT_REG_SZ
Definition: driver.c:575
#define REG_BINARY
Definition: nt_native.h:1496
#define REG_QWORD
Definition: sdbapi.c:597
#define REG_DWORD
Definition: sdbapi.c:596
#define ERROR_UNSUPPORTED_TYPE
Definition: winerror.h:988
#define ERROR_DATATYPE_MISMATCH
Definition: winerror.h:987

Referenced by RegGetValueA(), and RegGetValueW().

◆ RegpCopyTree()

static NTSTATUS RegpCopyTree ( IN HKEY  hKeySrc,
IN HKEY  hKeyDest 
)
static

Definition at line 451 of file reg.c.

453{
454 typedef struct
455 {
456 LIST_ENTRY ListEntry;
457 HANDLE hKeySrc;
458 HANDLE hKeyDest;
459 } REGP_COPY_KEYS, *PREGP_COPY_KEYS;
460
461 LIST_ENTRY copyQueueHead;
462 PREGP_COPY_KEYS copyKeys, newCopyKeys;
463 union
464 {
466 KEY_NODE_INFORMATION *KeyNode;
468 } Info;
469 ULONG Index, BufferSizeRequired, BufferSize = 0x200;
471 NTSTATUS Status2 = STATUS_SUCCESS;
472
473 InitializeListHead(&copyQueueHead);
474
476 0,
477 BufferSize);
478 if (Info.Buffer == NULL)
479 {
481 }
482
483 copyKeys = RtlAllocateHeap(ProcessHeap,
484 0,
485 sizeof(REGP_COPY_KEYS));
486 if (copyKeys != NULL)
487 {
488 copyKeys->hKeySrc = hKeySrc;
489 copyKeys->hKeyDest = hKeyDest;
490 InsertHeadList(&copyQueueHead,
491 &copyKeys->ListEntry);
492
493 /* FIXME - copy security from hKeySrc to hKeyDest or just for the subkeys? */
494
495 do
496 {
497 copyKeys = CONTAINING_RECORD(copyQueueHead.Flink,
498 REGP_COPY_KEYS,
499 ListEntry);
500
501 /* enumerate all values and copy them */
502 Index = 0;
503 for (;;)
504 {
505 Status2 = NtEnumerateValueKey(copyKeys->hKeySrc,
506 Index,
508 Info.KeyValue,
510 &BufferSizeRequired);
511 if (NT_SUCCESS(Status2))
512 {
514 PVOID Data;
515
516 /* don't use RtlInitUnicodeString as the string is not NULL-terminated! */
517 ValueName.Length = Info.KeyValue->NameLength;
518 ValueName.MaximumLength = ValueName.Length;
519 ValueName.Buffer = Info.KeyValue->Name;
520
521 Data = (PVOID)((ULONG_PTR)Info.KeyValue + Info.KeyValue->DataOffset);
522
523 Status2 = NtSetValueKey(copyKeys->hKeyDest,
524 &ValueName,
525 Info.KeyValue->TitleIndex,
526 Info.KeyValue->Type,
527 Data,
528 Info.KeyValue->DataLength);
529
530 /* don't break, let's try to copy as many values as possible */
531 if (!NT_SUCCESS(Status2) && NT_SUCCESS(Status))
532 {
533 Status = Status2;
534 }
535
536 Index++;
537 }
538 else if (Status2 == STATUS_BUFFER_OVERFLOW)
539 {
541
542 ASSERT(BufferSize < BufferSizeRequired);
543
545 0,
546 Info.Buffer,
547 BufferSizeRequired);
548 if (Buffer != NULL)
549 {
550 Info.Buffer = Buffer;
551 BufferSize = BufferSizeRequired;
552 /* try again */
553 }
554 else
555 {
556 /* don't break, let's try to copy as many values as possible */
558 Index++;
559
560 if (NT_SUCCESS(Status))
561 {
562 Status = Status2;
563 }
564 }
565 }
566 else
567 {
568 /* break to avoid an infinite loop in case of denied access or
569 other errors! */
570 if (Status2 != STATUS_NO_MORE_ENTRIES && NT_SUCCESS(Status))
571 {
572 Status = Status2;
573 }
574
575 break;
576 }
577 }
578
579 /* enumerate all subkeys and open and enqueue them */
580 Index = 0;
581 for (;;)
582 {
583 Status2 = NtEnumerateKey(copyKeys->hKeySrc,
584 Index,
586 Info.KeyNode,
588 &BufferSizeRequired);
589 if (NT_SUCCESS(Status2))
590 {
591 HANDLE KeyHandle, NewKeyHandle;
593 UNICODE_STRING SubKeyName, ClassName;
594
595 /* don't use RtlInitUnicodeString as the string is not NULL-terminated! */
596 SubKeyName.Length = Info.KeyNode->NameLength;
597 SubKeyName.MaximumLength = SubKeyName.Length;
598 SubKeyName.Buffer = Info.KeyNode->Name;
599 ClassName.Length = Info.KeyNode->ClassLength;
600 ClassName.MaximumLength = ClassName.Length;
601 ClassName.Buffer = (PWSTR)((ULONG_PTR)Info.KeyNode + Info.KeyNode->ClassOffset);
602
603 /* open the subkey with sufficient rights */
604
606 &SubKeyName,
608 copyKeys->hKeySrc,
609 NULL);
610
611 Status2 = NtOpenKey(&KeyHandle,
614 if (NT_SUCCESS(Status2))
615 {
616 /* FIXME - attempt to query the security information */
617
619 &SubKeyName,
621 copyKeys->hKeyDest,
622 NULL);
623
624 Status2 = NtCreateKey(&NewKeyHandle,
627 Info.KeyNode->TitleIndex,
628 &ClassName,
629 0,
630 NULL);
631 if (NT_SUCCESS(Status2))
632 {
633 newCopyKeys = RtlAllocateHeap(ProcessHeap,
634 0,
635 sizeof(REGP_COPY_KEYS));
636 if (newCopyKeys != NULL)
637 {
638 /* save the handles and enqueue the subkey */
639 newCopyKeys->hKeySrc = KeyHandle;
640 newCopyKeys->hKeyDest = NewKeyHandle;
641 InsertTailList(&copyQueueHead,
642 &newCopyKeys->ListEntry);
643 }
644 else
645 {
647 NtClose(NewKeyHandle);
648
650 }
651 }
652 else
653 {
655 }
656 }
657
658 if (!NT_SUCCESS(Status2) && NT_SUCCESS(Status))
659 {
660 Status = Status2;
661 }
662
663 Index++;
664 }
665 else if (Status2 == STATUS_BUFFER_OVERFLOW)
666 {
668
669 ASSERT(BufferSize < BufferSizeRequired);
670
672 0,
673 Info.Buffer,
674 BufferSizeRequired);
675 if (Buffer != NULL)
676 {
677 Info.Buffer = Buffer;
678 BufferSize = BufferSizeRequired;
679 /* try again */
680 }
681 else
682 {
683 /* don't break, let's try to copy as many keys as possible */
685 Index++;
686
687 if (NT_SUCCESS(Status))
688 {
689 Status = Status2;
690 }
691 }
692 }
693 else
694 {
695 /* break to avoid an infinite loop in case of denied access or
696 other errors! */
697 if (Status2 != STATUS_NO_MORE_ENTRIES && NT_SUCCESS(Status))
698 {
699 Status = Status2;
700 }
701
702 break;
703 }
704 }
705
706 /* close the handles and remove the entry from the list */
707 if (copyKeys->hKeySrc != hKeySrc)
708 {
709 NtClose(copyKeys->hKeySrc);
710 }
711 if (copyKeys->hKeyDest != hKeyDest)
712 {
713 NtClose(copyKeys->hKeyDest);
714 }
715
716 RemoveEntryList(&copyKeys->ListEntry);
717
719 0,
720 copyKeys);
721 } while (!IsListEmpty(&copyQueueHead));
722 }
723 else
725
727 0,
728 Info.Buffer);
729
730 return Status;
731}
Definition: bufpool.h:45
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
Definition: heap.c:2686
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
std::string Name
Definition: xml2sdb.h:101
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
uint16_t * PWSTR
Definition: typedefs.h:56
void * PVOID
Definition: typedefs.h:50
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

Referenced by RegCopyTreeW().

◆ RegQueryInfoKeyA()

LONG WINAPI RegQueryInfoKeyA ( HKEY  hKey,
LPSTR  lpClass,
LPDWORD  lpcClass,
LPDWORD  lpReserved,
LPDWORD  lpcSubKeys,
LPDWORD  lpcMaxSubKeyLen,
LPDWORD  lpcMaxClassLen,
LPDWORD  lpcValues,
LPDWORD  lpcMaxValueNameLen,
LPDWORD  lpcMaxValueLen,
LPDWORD  lpcbSecurityDescriptor,
PFILETIME  lpftLastWriteTime 
)

Definition at line 3583 of file reg.c.

3595{
3596 WCHAR ClassName[MAX_PATH];
3601 DWORD cClass = 0;
3602
3603 if ((lpClass) && (!lpcClass))
3604 {
3606 }
3607
3609 NULL);
3610 if (lpClass != NULL)
3611 {
3612 RtlInitEmptyUnicodeString(&UnicodeString,
3613 ClassName,
3614 sizeof(ClassName));
3615 cClass = sizeof(ClassName) / sizeof(WCHAR);
3616 }
3617
3619 UnicodeString.Buffer,
3620 &cClass,
3621 lpReserved,
3622 lpcSubKeys,
3623 lpcMaxSubKeyLen,
3624 lpcMaxClassLen,
3625 lpcValues,
3626 lpcMaxValueNameLen,
3627 lpcMaxValueLen,
3628 lpcbSecurityDescriptor,
3629 lpftLastWriteTime);
3630 if ((ErrorCode == ERROR_SUCCESS) && (lpClass != NULL))
3631 {
3632 if (*lpcClass == 0)
3633 {
3634 return ErrorCode;
3635 }
3636
3637 RtlInitEmptyAnsiString(&AnsiString, lpClass, *lpcClass);
3638 UnicodeString.Length = cClass * sizeof(WCHAR);
3641 FALSE);
3643 cClass = AnsiString.Length;
3644 lpClass[cClass] = ANSI_NULL;
3645 }
3646
3647 if (lpcClass != NULL)
3648 {
3649 *lpcClass = cClass;
3650 }
3651
3652 return ErrorCode;
3653}
@ AnsiString
Definition: dnslib.h:19
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)

Referenced by delete_registry_key(), delete_tree(), delete_tree_(), find_registry_key(), FindProvRegVals(), FindProvTypesRegVals(), lineGetCountryA(), lineGetTranslateCapsA(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), SHDeleteEmptyKeyA(), SHDeleteOrphanKeyA(), SHQueryInfoKeyA(), SHRegQueryInfoUSKeyA(), test_copy_key_class(), test_reg_query_info(), test_rw_order(), and TestKeyAccess_().

◆ RegQueryInfoKeyW()

LONG WINAPI RegQueryInfoKeyW ( HKEY  hKey,
LPWSTR  lpClass,
LPDWORD  lpcClass,
LPDWORD  lpReserved,
LPDWORD  lpcSubKeys,
LPDWORD  lpcMaxSubKeyLen,
LPDWORD  lpcMaxClassLen,
LPDWORD  lpcValues,
LPDWORD  lpcMaxValueNameLen,
LPDWORD  lpcMaxValueLen,
LPDWORD  lpcbSecurityDescriptor,
PFILETIME  lpftLastWriteTime 
)

Definition at line 3662 of file reg.c.

3674{
3675 KEY_FULL_INFORMATION FullInfoBuffer;
3676 PKEY_FULL_INFORMATION FullInfo;
3677 ULONG FullInfoSize;
3678 ULONG ClassLength = 0;
3681 ULONG Length;
3683
3684 if ((lpClass) && (!lpcClass))
3685 {
3687 }
3688
3690 hKey);
3691 if (!NT_SUCCESS(Status))
3692 {
3694 }
3695
3696 if (IsHKCRKey(KeyHandle))
3697 {
3698 ErrorCode = QueryInfoHKCRKey(KeyHandle, lpClass, lpcClass, lpReserved,
3699 lpcSubKeys, lpcMaxSubKeyLen, lpcMaxClassLen,
3700 lpcValues, lpcMaxValueNameLen, lpcMaxValueLen,
3701 lpcbSecurityDescriptor, lpftLastWriteTime);
3703 return ErrorCode;
3704 }
3705
3706 if (lpClass != NULL)
3707 {
3708 if (*lpcClass > 0)
3709 {
3710 ClassLength = min(*lpcClass - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR);
3711 }
3712 else
3713 {
3714 ClassLength = 0;
3715 }
3716
3717 FullInfoSize = sizeof(KEY_FULL_INFORMATION) + ((ClassLength + 3) & ~3);
3718 FullInfo = RtlAllocateHeap(ProcessHeap,
3719 0,
3720 FullInfoSize);
3721 if (FullInfo == NULL)
3722 {
3724 goto Cleanup;
3725 }
3726 }
3727 else
3728 {
3729 FullInfoSize = sizeof(KEY_FULL_INFORMATION);
3730 FullInfo = &FullInfoBuffer;
3731 }
3732
3733 if (lpcbSecurityDescriptor != NULL)
3734 *lpcbSecurityDescriptor = 0;
3735
3738 FullInfo,
3739 FullInfoSize,
3740 &Length);
3741 TRACE("NtQueryKey() returned status 0x%X\n", Status);
3743 {
3745 goto Cleanup;
3746 }
3747
3748 TRACE("SubKeys %d\n", FullInfo->SubKeys);
3749 if (lpcSubKeys != NULL)
3750 {
3751 *lpcSubKeys = FullInfo->SubKeys;
3752 }
3753
3754 TRACE("MaxNameLen %lu\n", FullInfo->MaxNameLen);
3755 if (lpcMaxSubKeyLen != NULL)
3756 {
3757 *lpcMaxSubKeyLen = FullInfo->MaxNameLen / sizeof(WCHAR);
3758 }
3759
3760 TRACE("MaxClassLen %lu\n", FullInfo->MaxClassLen);
3761 if (lpcMaxClassLen != NULL)
3762 {
3763 *lpcMaxClassLen = FullInfo->MaxClassLen / sizeof(WCHAR);
3764 }
3765
3766 TRACE("Values %lu\n", FullInfo->Values);
3767 if (lpcValues != NULL)
3768 {
3769 *lpcValues = FullInfo->Values;
3770 }
3771
3772 TRACE("MaxValueNameLen %lu\n", FullInfo->MaxValueNameLen);
3773 if (lpcMaxValueNameLen != NULL)
3774 {
3775 *lpcMaxValueNameLen = FullInfo->MaxValueNameLen / sizeof(WCHAR);
3776 }
3777
3778 TRACE("MaxValueDataLen %lu\n", FullInfo->MaxValueDataLen);
3779 if (lpcMaxValueLen != NULL)
3780 {
3781 *lpcMaxValueLen = FullInfo->MaxValueDataLen;
3782 }
3783
3784 if (lpcbSecurityDescriptor != NULL)
3785 {
3790 NULL,
3791 0,
3792 lpcbSecurityDescriptor);
3793 TRACE("NtQuerySecurityObject() returned status 0x%X\n", Status);
3794 }
3795
3796 if (lpftLastWriteTime != NULL)
3797 {
3798 lpftLastWriteTime->dwLowDateTime = FullInfo->LastWriteTime.u.LowPart;
3799 lpftLastWriteTime->dwHighDateTime = FullInfo->LastWriteTime.u.HighPart;
3800 }
3801
3802 if (lpClass != NULL)
3803 {
3804 if (*lpcClass == 0)
3805 {
3806 goto Cleanup;
3807 }
3808
3809 if (FullInfo->ClassLength > ClassLength)
3810 {
3812 }
3813 else
3814 {
3815 RtlCopyMemory(lpClass,
3816 FullInfo->Class,
3817 FullInfo->ClassLength);
3818 lpClass[FullInfo->ClassLength / sizeof(WCHAR)] = UNICODE_NULL;
3819 }
3820 }
3821
3822 if (lpcClass != NULL)
3823 {
3824 *lpcClass = FullInfo->ClassLength / sizeof(WCHAR);
3825 }
3826
3827Cleanup:
3828 if (lpClass != NULL)
3829 {
3831 0,
3832 FullInfo);
3833 }
3834
3836
3837 return ErrorCode;
3838}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
LONG WINAPI QueryInfoHKCRKey(_In_ HKEY hKey, _Out_writes_to_opt_(*lpcchClass, *lpcchClass+1) LPWSTR lpClass, _Inout_opt_ LPDWORD lpcchClass, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPDWORD lpcSubKeys, _Out_opt_ LPDWORD lpcbMaxSubKeyLen, _Out_opt_ LPDWORD lpcbMaxClassLen, _Out_opt_ LPDWORD lpcValues, _Out_opt_ LPDWORD lpcbMaxValueNameLen, _Out_opt_ LPDWORD lpcbMaxValueLen, _Out_opt_ LPDWORD lpcbSecurityDescriptor, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: hkcr.c:1087
@ KeyFullInformation
Definition: nt_native.h:1133
struct _KEY_FULL_INFORMATION KEY_FULL_INFORMATION
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:632
#define UNICODE_NULL
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:1117
struct _LARGE_INTEGER::@2299 u
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124

Referenced by _InitializePrintProviderList(), _test_key_deleted(), AddEntryToTree(), BuildLogListAndFilterList(), BuildParameterArray(), ComponentInfo_GetGuidList(), ConCfgReadUserSettings(), CredEnumerateW(), CryptEnumProvidersW(), CryptEnumProviderTypesW(), delete_test_key(), DEVENUM_ReadPins(), DEVENUM_ReadPinTypes(), devinst_RegDeleteTreeW(), DisplayStatus(), enum_values(), EnumHKCRValue(), EnumInterfaces(), get_client_counts(), GetClassMediaFile(), CQueryAssociations::GetCommand(), GetDeviceInstanceListSize(), GetEnumOptions(), CRegistryKey::GetLastWriteTime(), GetLongestChildKeyName(), CRegistryKey::GetMaxValueDataSize(), CRegistryKey::GetMaxValueNameLength(), GetProfileCount(), CRegistryKey::GetSecurityDescriptorLength(), GetServiceInstanceListSize(), CRegistryKey::GetSubkeyCount(), GetSubkeyInfoHelper(), GetUniqueConnectionName(), CRegistryKey::GetValueCount(), InitializePrinterList(), InitializePrintMonitor2(), InitializePrintMonitorList(), InitializePrintProcessorList(), InitIconOverlays(), InitSettings(), InstallerImpl_RegistryValue(), Int_EnumDependentServicesW(), is_key_empty(), lineGetCountryW(), LoadEventSources(), LoadHelpers(), LoadLogFile(), LoadLogFiles(), LocalEnumPrintProcessors(), MCI_SysInfo(), MSACM_RegisterAllDrivers(), MsiSourceListEnumMediaDisksW(), myRegDeleteTreeW(), OleRegEnumVerbs(), OnTreeExpanding(), package_RegDeleteTreeW(), PNP_GetClassCount(), ProcessRunKeys(), ProcessRunOnceEx(), query_all(), QueryInfoHKCRKey(), read_bitmap_patterns(), read_metadata_patterns(), RefreshListView(), RefreshTreeItem(), reg_delete_tree(), RegDeleteTreeW(), RegEnumValueA(), RegFindRecurse(), RegFindWalk(), register_legacy_filters(), RegQueryInfoKeyA(), remove_product_upgrade_code(), RemoveEventLog(), run_copy(), RunOnceExInstance::RunOnceExInstance(), RunOnceExSection::RunOnceExSection(), ScmDeleteRegKey(), search_domain_for_zone(), search_for_domain_mapping(), SHCopyKeyW(), SHDeleteEmptyKeyW(), SHDeleteKeyW(), SHDeleteOrphanKeyW(), SHQueryInfoKeyW(), SHRegQueryInfoUSKeyW(), test4(), test_reg_query_info(), TestKeyAccess_(), and txt_export_class_and_last_write().

◆ RegQueryMultipleValuesA()

LONG WINAPI RegQueryMultipleValuesA ( HKEY  hKey,
PVALENTA  val_list,
DWORD  num_vals,
LPSTR  lpValueBuf,
LPDWORD  ldwTotsize 
)

Definition at line 3847 of file reg.c.

3852{
3853 ULONG i;
3854 DWORD maxBytes = *ldwTotsize;
3855 LPSTR bufptr = lpValueBuf;
3857
3858 if (maxBytes >= (1024*1024))
3859 return ERROR_MORE_DATA;
3860
3861 *ldwTotsize = 0;
3862
3863 TRACE("RegQueryMultipleValuesA(%p,%p,%ld,%p,%p=%ld)\n",
3864 hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize);
3865
3866 for (i = 0; i < num_vals; i++)
3867 {
3868 val_list[i].ve_valuelen = 0;
3870 val_list[i].ve_valuename,
3871 NULL,
3872 NULL,
3873 NULL,
3874 &val_list[i].ve_valuelen);
3875 if (ErrorCode != ERROR_SUCCESS)
3876 {
3877 return ErrorCode;
3878 }
3879
3880 if (lpValueBuf != NULL && *ldwTotsize + val_list[i].ve_valuelen <= maxBytes)
3881 {
3883 val_list[i].ve_valuename,
3884 NULL,
3885 &val_list[i].ve_type,
3886 (LPBYTE)bufptr,
3887 &val_list[i].ve_valuelen);
3888 if (ErrorCode != ERROR_SUCCESS)
3889 {
3890 return ErrorCode;
3891 }
3892
3893 val_list[i].ve_valueptr = (DWORD_PTR)bufptr;
3894
3895 bufptr += val_list[i].ve_valuelen;
3896 }
3897
3898 *ldwTotsize += val_list[i].ve_valuelen;
3899 }
3900
3901 return (lpValueBuf != NULL && *ldwTotsize <= maxBytes) ? ERROR_SUCCESS : ERROR_MORE_DATA;
3902}
DWORD ve_valuelen
Definition: winreg.h:73
DWORD ve_valueptr
Definition: winreg.h:74
static unsigned int bufptr
Definition: tncon.cpp:77
#define DWORD_PTR
Definition: treelist.c:76

◆ RegQueryMultipleValuesW()

LONG WINAPI RegQueryMultipleValuesW ( HKEY  hKey,
PVALENTW  val_list,
DWORD  num_vals,
LPWSTR  lpValueBuf,
LPDWORD  ldwTotsize 
)

Definition at line 3911 of file reg.c.

3916{
3917 ULONG i;
3918 DWORD maxBytes = *ldwTotsize;
3919 LPSTR bufptr = (LPSTR)lpValueBuf;
3921
3922 if (maxBytes >= (1024*1024))
3923 return ERROR_MORE_DATA;
3924
3925 *ldwTotsize = 0;
3926
3927 TRACE("RegQueryMultipleValuesW(%p,%p,%ld,%p,%p=%ld)\n",
3928 hKey, val_list, num_vals, lpValueBuf, ldwTotsize, *ldwTotsize);
3929
3930 for (i = 0; i < num_vals; i++)
3931 {
3932 val_list[i].ve_valuelen = 0;
3934 val_list[i].ve_valuename,
3935 NULL,
3936 NULL,
3937 NULL,
3938 &val_list[i].ve_valuelen);
3939 if (ErrorCode != ERROR_SUCCESS)
3940 {
3941 return ErrorCode;
3942 }
3943
3944 if (lpValueBuf != NULL && *ldwTotsize + val_list[i].ve_valuelen <= maxBytes)
3945 {
3947 val_list[i].ve_valuename,
3948 NULL,
3949 &val_list[i].ve_type,
3950 (LPBYTE)bufptr,
3951 &val_list[i].ve_valuelen);
3952 if (ErrorCode != ERROR_SUCCESS)
3953 {
3954 return ErrorCode;
3955 }
3956
3957 val_list[i].ve_valueptr = (DWORD_PTR)bufptr;
3958
3959 bufptr += val_list[i].ve_valuelen;
3960 }
3961
3962 *ldwTotsize += val_list[i].ve_valuelen;
3963 }
3964
3965 return (lpValueBuf != NULL && *ldwTotsize <= maxBytes) ? ERROR_SUCCESS : ERROR_MORE_DATA;
3966}
DWORD ve_valuelen
Definition: winreg.h:79
DWORD ve_valueptr
Definition: winreg.h:80

◆ RegQueryReflectionKey()

LONG WINAPI RegQueryReflectionKey ( IN HKEY  hBase,
OUT BOOL bIsReflectionDisabled 
)

Definition at line 3975 of file reg.c.

3977{
3978 FIXME("RegQueryReflectionKey(0x%p, 0x%p) UNIMPLEMENTED!\n",
3979 hBase, bIsReflectionDisabled);
3981}

◆ RegQueryValueA()

LSTATUS WINAPI RegQueryValueA ( HKEY  hkey,
LPCSTR  name,
LPSTR  data,
LPLONG  count 
)

Definition at line 4212 of file reg.c.

4213{
4214 DWORD ret;
4215 HKEY subkey = hkey;
4216
4217 TRACE("(%p,%s,%p,%d)\n", hkey, debugstr_a(name), data, count ? *count : 0 );
4218
4219 if (name && name[0])
4220 {
4221 if ((ret = RegOpenKeyA( hkey, name, &subkey )) != ERROR_SUCCESS) return ret;
4222 }
4224 if (subkey != hkey) RegCloseKey( subkey );
4226 {
4227 /* return empty string if default value not found */
4228 if (data) *data = 0;
4229 if (count) *count = 1;
4231 }
4232 return ret;
4233}
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
#define debugstr_a
Definition: kernel32.h:31
Definition: name.c:39
uint32_t * LPDWORD
Definition: typedefs.h:59

Referenced by AVIFILE_GetFileHandlerByExtension(), AVIMakeCompressedStream(), debugstr_iid(), HCR_MapTypeToValueA(), OLECONVERT_CreateCompObjStream(), reg_get_typelib_module(), SHRegQueryValueA(), test_device_interface_key(), test_reg_copy_tree(), test_reg_delete_tree(), test_reg_query_value(), test_register_typelib(), and test_RegQueryValueExPerformanceData().

◆ RegQueryValueExA()

LONG WINAPI RegQueryValueExA ( _In_ HKEY  hkeyorg,
_In_ LPCSTR  name,
_In_ LPDWORD  reserved,
_Out_opt_ LPDWORD  type,
_Out_opt_ LPBYTE  data,
_Inout_opt_ LPDWORD  count 
)

Definition at line 4009 of file reg.c.

4016{
4020 DWORD BufferSize = 0;
4021 WCHAR* Buffer;
4022 CHAR* DataStr = (CHAR*)data;
4023 DWORD LocalType;
4024
4025 /* Validate those parameters, the rest will be done with the first RegQueryValueExW call */
4026 if ((data && !count) || reserved)
4028
4029 if (name)
4030 {
4033 }
4034 else
4035 RtlInitEmptyUnicodeString(&nameW, NULL, 0);
4036
4037 ErrorCode = RegQueryValueExW(hkeyorg, nameW.Buffer, NULL, &LocalType, NULL, &BufferSize);
4038 if (ErrorCode != ERROR_SUCCESS)
4039 {
4040 if ((!data) && count)
4041 *count = 0;
4043 return ErrorCode;
4044 }
4045
4046 /* See if we can directly handle the call without caring for conversion */
4047 if (!is_string(LocalType) || !count)
4048 {
4049 ErrorCode = RegQueryValueExW(hkeyorg, nameW.Buffer, reserved, type, data, count);
4051 return ErrorCode;
4052 }
4053
4054 /* Allocate a unicode string to get the data */
4055 Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferSize);
4056 if (!Buffer)
4057 {
4060 }
4061
4063 if (ErrorCode != ERROR_SUCCESS)
4064 {
4065 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
4067 return ErrorCode;
4068 }
4069
4070 /* We don't need this anymore */
4072
4073 /* Get the length for the multi-byte string (without the terminating NULL!) */
4074 DataLength = *count;
4076
4077 if ((!data) || (DataLength < *count))
4078 {
4079 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
4081 }
4082
4083 /* We can finally do the conversion */
4085
4086 /* NULL-terminate if there is enough room */
4087 if (DataLength > *count)
4088 DataStr[*count] = '\0';
4089
4090 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
4091
4092 return ERROR_SUCCESS;
4093}
static const WCHAR nameW[]
Definition: main.c:49
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
char CHAR
Definition: xmlstorage.h:175

Referenced by _test_hkey_main_Value_A(), _test_reg_key(), CallNotificationDll(), check_dirid(), check_reg_dword(), check_reg_entries(), check_reg_multi(), check_reg_str(), CRYPT_GetFuncFromReg(), CRYPT_LoadSIPFuncFromKey(), DirectDrawEnumerateExA(), DirectPlayEnumerateAW(), DllMain(), DP_LoadSP(), expect_LayerValue_imp(), find_default_printer(), FindDfltProvRegVals(), FindProvRegVals(), FindProvTypesRegVals(), font_present(), get_cert_mgr_usages(), get_config_key(), get_config_key_dword(), get_key_value(), get_progfiles_dir(), get_program_files_dir(), get_reg_dword(), get_shell_icon_size(), get_system_dirs(), get_user_dirs(), GetAdaptersInfo(), GetDriverName(), GetNetworkParams(), HaveDefaultMailClient(), HCR_GetClassNameA(), HCR_RegGetIconA(), IDirectMusic8Impl_GetDefaultPort(), IDirectPlay4AImpl_EnumConnections(), IDirectPlayLobby3AImpl_EnumAddressTypes(), IDirectPlayLobby3AImpl_EnumLocalApplications(), is_ie_hardened(), lffromreg(), lineGetCountryA(), lineGetTranslateCapsA(), main(), Main_DirectDraw_GetDeviceIdentifier7(), metricfromreg(), MIDIMAP_LoadSettings(), MIDIMAP_LoadSettingsScheme(), MMDRV_Init(), MSACM_ReadCache(), NetBTInit(), ODBC_ReplicateODBCInstToRegistry(), ODBC_ReplicateODBCToRegistry(), PrintAdapterDescription(), PrintSystemInfo(), process_pending_renames(), proxy_active(), pub_present(), QueryConfig2A(), r_verify_reg_nonexist(), r_verifyProxyEnable(), read_key_value(), ReadKey(), ReadRegistryComputerNameValue(), ReadRegistryValue(), reg_get_typelib_module(), reg_get_val_str(), RegGetValueA(), RegQueryMultipleValuesA(), RegQueryValueA(), RegReadStringA(), RunApplicationA_EnumLocalApplications(), save_value(), scan_subkeys(), set_lang(), SHGetSettings(), SHOpenRegStream2A(), SHPinDllOfCLSID(), SHQueryValueExA(), SHRegQueryUSValueA(), SmoothScrollWindow(), spy_init(), START_TEST(), test_autocreation(), test_basic_import(), test_basic_import_unicode(), test_child_heap(), test_classesroot(), test_delete_key_value(), test_delete_value(), test_deleted_key(), test_enumdisplaydevices_adapter(), test_export(), test_get_profiles_dir(), test_GetAcceptLanguagesA(), test_ICInfo(), test_import(), test_install_services(), test_Installer_InstallProduct(), test_installprops(), test_machine_guid(), test_mixed_package(), test_MsiConfigureProductEx(), test_MsiInstallProduct(), test_MsiSourceListAddSource(), test_MsiSourceListAddSourceEx(), test_NonExistentPath(), test_null(), test_perflib_key(), test_process_components(), test_publish(), test_publish_components(), test_query_value_ex(), test_redirection(), test_reg_binary(), test_reg_copy_tree(), test_reg_delete_tree(), test_reg_dword(), test_register_font(), test_register_product(), test_registerDefaultOIDFunction(), test_registerOIDInfo(), test_registrar(), test_registry(), test_RegPolicyFlags(), test_RegQueryValueExPerformanceData(), test_remove_upgrade_code(), test_SHGetFolderPathA(), test_SQLInstallDriverEx(), test_SQLInstallTranslatorEx(), test_string_termination(), test_symlinks(), test_unicode_import(), test_url_action(), test_write_registry_values(), test_XcvDataPort_ConfigureLPTPortCommandOK(), test_XcvDataPort_GetTransmissionRetryTimeout(), testRegStore(), uniquecontainer(), UXTHEME_RestoreSystemMetrics(), verify_reg_(), verify_reg_nonexist_(), WhichPlatform(), WINTRUST_ReadProviderFromReg(), and WNetGetCachedPassword().

◆ RegQueryValueExW()

LONG WINAPI RegQueryValueExW ( _In_ HKEY  hkeyorg,
_In_ LPCWSTR  name,
_In_ LPDWORD  reserved,
_In_ LPDWORD  type,
_In_ LPBYTE  data,
_In_ LPDWORD  count 
)

Definition at line 4103 of file reg.c.

4110{
4111 HANDLE hkey;
4113 UNICODE_STRING name_str;
4114 DWORD total_size;
4115 char buffer[256], *buf_ptr = buffer;
4117 static const int info_size = offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data );
4118
4119 TRACE("(%p,%s,%p,%p,%p,%p=%d)\n",
4120 hkeyorg, debugstr_w(name), reserved, type, data, count,
4121 (count && data) ? *count : 0 );
4122
4123 if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER;
4124
4125 status = MapDefaultKey(&hkey, hkeyorg);
4126 if (!NT_SUCCESS(status))
4127 {
4129 }
4130
4131 if (IsHKCRKey(hkey))
4132 {
4134 ClosePredefKey(hkey);
4135 return ErrorCode;
4136 }
4137
4138 RtlInitUnicodeString( &name_str, name );
4139
4140 if (data)
4141 total_size = min( sizeof(buffer), *count + info_size );
4142 else
4143 total_size = info_size;
4144
4145
4147 buffer, total_size, &total_size );
4148
4150 {
4151 // NT: Valid handles with inexistant/null values or invalid (but not NULL) handles sets type to REG_NONE
4152 // On windows these conditions are likely to be side effects of the implementation...
4153 if (status == STATUS_INVALID_HANDLE && hkey)
4154 {
4155 if (type) *type = REG_NONE;
4156 if (count) *count = 0;
4157 }
4159 {
4160 if (type) *type = REG_NONE;
4161 if (data == NULL && count) *count = 0;
4162 }
4163 goto done;
4164 }
4165
4166 if (data)
4167 {
4168 /* retry with a dynamically allocated buffer */
4169 while (status == STATUS_BUFFER_OVERFLOW && total_size - info_size <= *count)
4170 {
4171 if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
4172 if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size )))
4173 {
4174 ClosePredefKey(hkey);
4176 }
4179 buf_ptr, total_size, &total_size );
4180 }
4181
4182 if (NT_SUCCESS(status))
4183 {
4184 memcpy( data, buf_ptr + info_size, total_size - info_size );
4185 /* if the type is REG_SZ and data is not 0-terminated
4186 * and there is enough space in the buffer NT appends a \0 */
4187 if (is_string(info->Type) && total_size - info_size <= *count-sizeof(WCHAR))
4188 {
4189 WCHAR *ptr = (WCHAR *)(data + total_size - info_size);
4190 if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0;
4191 }
4192 }
4193 else if (status != STATUS_BUFFER_OVERFLOW) goto done;
4194 }
4195 else status = STATUS_SUCCESS;
4196
4197 if (type) *type = info->Type;
4198 if (count) *count = total_size - info_size;
4199
4200 done:
4201 if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
4202 ClosePredefKey(hkey);
4204}
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
LONG WINAPI QueryHKCRValue(_In_ HKEY hKey, _In_ LPCWSTR Name, _In_ LPDWORD Reserved, _In_ LPDWORD Type, _In_ LPBYTE Data, _In_ LPDWORD Count)
Definition: hkcr.c:548
@ KeyValuePartialInformation
Definition: nt_native.h:1182
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define offsetof(TYPE, MEMBER)

Referenced by _enumeratorRememberedW(), _InitializeLocalSpooler(), _InitializePrintProviderList(), _LocalGetPrinterHandleData(), _LocalGetPrintServerHandleData(), _SHGetCurrentVersionPath(), _SHGetProfilesValue(), _SHGetUserShellFolderPath(), _SHRegisterFolders(), _test_hkey_main_Value_W(), _tryLoadProvider(), AddInstallationSource(), AddNotificationDll(), AddPrintMonitorList(), AddSoundProfile(), AddUserProfile(), AllocAndRegQueryWSZ(), append_multi_sz_value(), AppendStringToMultiSZ(), AssocQ(), BuildLogListAndFilterList(), BuildVolatileEnvironment(), cache_container_set_size(), capGetDriverDescriptionW(), CheckForLiveCD(), CheckLogOrSourceExistence(), ChooseFavorite(), CliGetPreloadKeyboardLayouts(), CliReadRegistryValue(), COM_OpenKeyForAppIdFromCLSID(), COMCAT_GetCategoryDesc(), ComDBClaimNextFreePort(), ComDBClaimPort(), ComDBGetCurrentPortUsage(), ComDBOpen(), ComDBReleasePort(), ComDBResizeDatabase(), comp_find_package(), comp_find_prodcode(), connections_on_initdialog(), create_local_service(), create_mru_list(), create_server(), CreateEnvironmentBlock(), CAppDB::CreateInstalledAppByRegistryKey(), CreateNewValue(), CreateNotificationObject(), CreateServiceListEntry(), CreateTempDir(), CreateUserProfileExW(), CriticalDeviceCoInstaller(), CRYPT_CreateMachineGuid(), CRYPT_GetDefaultOIDDlls(), CRYPT_GetFuncFromReg(), CRYPT_LoadSIPFuncFromKey(), CRYPT_RegReadSerializedFromReg(), CryptAcquireContextW(), CRYPTDLG_CheckOnlineCRL(), CryptEnumProvidersW(), CryptEnumProviderTypesW(), CryptGetDefaultOIDDllList(), CryptGetDefaultProviderW(), CryptGetOIDFunctionValue(), DecrementRefCount(), delete_multi_sz_value(), DeleteExt(), DeleteProfileW(), DEVENUM_IPropertyBag_Read(), DEVENUM_ReadPins(), DIALOG_Execute(), DIALOG_ProgramAttributes(), DirectPlayEnumerateAW(), DisableShellext(), CNetConnection::Disconnect(), DllMain(), DMOGetName(), do_reg_operation(), DoTestComputerName(), DRIVER_GetLibName(), EditTypeDlg_ReadClass(), EnumClientServiceProtocol(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumerateSoundProfiles(), EnumHKCRValue(), FileTypesDlg_InsertToLV(), FillList(), FillServerAddressCombo(), find_fallback_font(), find_mime_from_ext(), FindNetworkAdapter(), ForceFriendlyUI(), FTP_Connect(), get_action_policy(), get_config_key_as_dword(), get_config_key_dword(), get_config_key_string(), get_cred_mgr_encryption_key(), get_default_proxy_reg_value(), get_dest_dir(), get_dword_from_reg(), get_feature_from_reg(), get_fusion_filename(), get_install_root(), get_mime_clsid(), get_mime_filter(), get_mmioFromProfile(), get_mono_path_from_registry(), get_object_dll_path(), get_protocol_cf(), get_ps_clsid_from_registry(), get_reg_str(), get_shared_dlls_count(), get_string_from_reg(), get_threading_model(), get_url_encoding(), get_zone_for_scheme(), get_zone_from_reg(), GetAcceptLanguagesW(), GetActivePwrScheme(), GetAdapterFriendlyName(), GetAllUsersProfileDirectoryW(), CInstalledApplicationInfo::GetApplicationRegDword(), GetAutoDaylight(), GetBooleanRegValue(), GetBooleanValue(), GetBootResourceList(), GetClassMediaFile(), GetComputerNames(), GetConfigurationData(), GetCurrentDPI(), GetCurrentHwProfileW(), GetCurrentLoggedOnUserName(), GetDefaultPrinterFromRegistry(), GetDefaultPrinterW(), GetDefaultUserProfileDirectoryW(), GetDesktopPath(), GetDisplayNameFileAndID(), GetDWordValue(), GetEventMessageFileDLL(), GetFileTypeIconsByKey(), GetFindFlags(), GetGinaPath(), GetHotPlugFlags(), GetInterfaceFriendlyName(), GetInterfaceNameInternal(), GetIntervalSetting(), GetIntValue(), GetJapaneseUninstallCmdLine(), GetLayoutCount(), GetLayoutName(), GetLongValue(), GetLPTTransmissionRetryTimeout(), GetPerAdapterInfo(), GetPortType(), GetProfile(), GetProfilesDirectoryW(), GetProfileType(), GetProgramsPath(), CNetConnection::GetProperties(), GetPwrDiskSpindownRange(), GetRegDWORD(), GetRegistrySettings(), GetRegValue(), GetResourceList(), GetServiceInstanceList(), GetServiceInstanceListSize(), GetServiceMainFunctions(), CSysTray::GetServicesEnabled(), GetSetupType(), GetShell(), GetShutdownReasonUI(), GetStringValue(), GetSyncSetting(), GetTimeZoneListIndex(), GetTypeName(), GetUserProfileDirectoryW(), GetUserWaitInterval(), CQueryAssociations::GetValue(), go_home(), HCR_GetClassNameW(), HCR_GetFolderAttributes(), HCR_RegGetIconW(), HlinkGetSpecialReference(), I_CryptReadTrustedPublisherDWORDValueFromRegistry(), IEnumDMO_fnNext(), ImageView_LoadSettings(), Imm32GetImeLayout(), Imm32IsCUASEnabledInRegistry(), Imm32IsTIMDisabledInRegistry(), Imm32WriteImeLayout(), ImmLoadLayout(), ImportAppProfile(), ImportSoundLabel(), IncrementRefCount(), INetCfgLock_fnAcquireWriteLock(), INetCfgLock_fnIsWriteLocked(), init_driver(), InitAudioDlg(), InitControl(), InitializeDefaultUserLocale(), InitializePrinterList(), InitializePrintProcessorList(), InitKeyboardLayouts(), InitPropertiesDlg(), InitSettings(), InitWorkstationInfo(), InputList_FindPreloadKLID(), InputProcessorProfiles_GetDefaultLanguageProfile(), InputProcessorProfiles_IsEnabledLanguageProfile(), InstallDevice(), InstallerImpl_RegistryValue(), InstallOneService(), Int_EnumDependentServicesW(), INTERNET_LoadProxySettings(), IntGetIcdData(), IntLoadKeyboardLayout(), IntLoadPreloadKeyboardLayouts(), IsFriendlyUIActive(), IsInternetESCEnabledLocal(), IsLayoutExists(), IsShortcut(), IsShowHibernateButtonActive(), IsThemeActive(), IsWindowsOS(), ITERATE_FindRelatedProducts(), ITERATE_RemoveEnvironmentString(), ITERATE_WriteEnvironmentString(), KLIDFromSpecialHKL(), LayoutList_ReadLayout(), lineGetCountryW(), COpenWithList::Load(), load_mapi_provider(), load_mapi_providers(), load_mapping_settings(), load_wine_gecko_v(), LoadAdvancedSettings(), LoadBoard(), CNewMenu::LoadCachedItems(), LoadCurrentLocale(), LoadDNSSettings(), LoadDWORDFromRegistry(), LoadEventLabel(), LoadFilterSettings(), LoadInstallableVDD(), LoadLogFile(), LoadRecoveryOptions(), LoadRegistrySettings(), LoadSchemeFromReg(), LoadSettings(), LoadShutdownSelState(), LoadSMBiosData(), LoadStringFromRegistry(), LoadTcpFilterSettingsFromRegistry(), LoadUsernameHint(), LocalAddForm(), LocalAddMonitor(), LocalDeleteForm(), LocalGetPrintProcessorDirectory(), LocalSetForm(), main(), MAIN_AutoStart(), MAIN_CreateMainWindow(), MAIN_LoadSettings(), MakeService(), MCI_GetDevTypeFromFileName(), MIDIMAP_LoadSettings(), MIDIMAP_LoadSettingsScheme(), MMDevEnum_GetDefaultAudioEndpoint(), MMSYS_InstallDevice(), ModifyStatus(), ModifyValue(), MouseOnDialogInit(), MSACM_RegisterDriverFromRegistry(), MSACM_ReorderDriversByPriority(), msi_reg_get_val_dword(), msi_reg_get_val_str(), MsiSourceListEnumSourcesW(), MsiSourceListGetInfoW(), NetBTInit(), NetIDPage_OnApply(), NetIDPage_OnInitDialog(), CEnumRegKey::NextValue(), notif_thread_proc(), notify_if_changed(), OleRegGetUserType(), OLEUTL_ReadRegistryDWORDValue(), OpenHostsFile(), pendingRename(), PNP_AddID(), PNP_GetClassName(), PNP_GetClassRegProp(), PNP_GetCustomDevProp(), PNP_GetDeviceRegProp(), PNP_GetHwProfInfo(), PNP_HwProfFlags(), PNP_IsDockStationPresent(), PopulateCustomPathCombo(), POWRPROF_GetMachinePowerPolicy(), POWRPROF_GetUserPowerPolicy(), PrintOSVersion(), process_args_from_reg(), process_extensions(), ProcessPage_OnDebug(), ProcessPageShowContextMenu(), query_reg_path(), query_value(), QueryAppSettings(), QueryConfig2W(), QueryHKCRValue(), QueryKeyValue(), QueryNameServer(), QueryRegistryValue(), QueryStringValue(), QueryTimeZoneData(), QueryUserRegValueW(), read_credential_blob(), read_key(), read_oid_info(), read_types(), ReadAttributes(), ReadBindingString(), ReadCabinetState(), ReadGlobalPwrPolicy(), ReadKeysSettings(), ReadPortSettings(), ReadProcessorPwrScheme(), ReadRegDwordValue(), ReadRegistryValue(), ReadRegSzKey(), ReadRegSzValue(), ReadSZFlagsFromRegistry(), reg_get_multisz(), reg_get_sz(), reg_get_value(), RegFindRecurse(), RegGetDWORD(), RegGetDWORDValue(), RegGetSZ(), RegGetValueW(), register_legacy_filters(), registry_credential_matches_filter(), registry_read_credential(), registry_read_filelist(), registry_read_formatopts(), registry_read_maximized(), registry_read_pagemargins(), registry_read_previewpages(), registry_read_winrect(), RegistryPropertyBag_IPropertyBag_Read(), RegLoadMUIStringW(), RegQueryDword(), RegQueryMultipleValuesW(), RegQueryValueExA(), RegQueryValueW(), RegQueryValueWithAlloc(), RegReadStringW(), RegTGetDwordValue(), RegTGetStringValue(), RegValueExists(), RenameValue(), ReportProductInfoEvent(), ReturnNtProduct(), RQueryServiceConfig2A(), RQueryServiceConfig2W(), run_add(), run_copy(), RunSetupThreadProc(), SampIsSetupRunning(), ScmAssignNewTag(), ScmAutoStartServices(), ScmCreateNewControlPipe(), ScmGetControlSetValues(), ScmGetNoInteractiveServicesValue(), ScmGetSetupInProgress(), ScmInitNamedPipeCriticalSection(), ScmIsDeleteFlagSet(), ScmReadSecurityDescriptor(), ScmReadString(), ScmSetFailureActions(), SdbUninstallByGuid(), SdbUninstallByName(), search_reg(), SECUR32_initializeProviders(), SelectExtOnRename(), set_installer_properties(), SetAutoAdminLogon(), SetDefaultLanguage(), SetDefaultPrinterW(), SetHKCRValue(), SetKeyboardLayoutName(), SetRegTextData(), SetTime(), SETUP_CreateInterfaceList(), SETUP_GetClassIconInfo(), SETUP_GetIconIndex(), SETUP_GetValueString(), SETUPAPI_GetCurrentHwProfile(), SetupDeviceInstance(), SETUPDI_CreateDrvKey(), SETUPDI_OpenDrvKey(), SetupDiBuildClassInfoListExW(), SetupDiCallClassInstaller(), SetupDiChangeState(), SetupDiClassGuidsFromNameExW(), SetupDiGetDeviceRegistryPropertyW(), SetupDiOpenDeviceInfoW(), SetupDiOpenDeviceInterfaceW(), SetupIsActive(), CClassNode::SetupNode(), SetUserSysColors(), SetUserWallpaper(), SetWelcomeText(), SHDOCVW_GetShellInstanceObjectClassObject(), SHELL_FS_HideExtension(), SHELL_IsShortcut(), ShellExecute_GetClassKey(), SHLoadRegUIStringW(), SHOpenRegStream2W(), SHPropertyBag_OnRegKey(), SHQueryValueExW(), SHRegQueryUSValueW(), SHRegWriteUSValueW(), SockLoadHelperDll(), SockLoadTransportList(), SockLoadTransportMapping(), START_TEST(), StartScreenSaver(), StartShell(), tapiGetLocationInfoW(), test4(), test_BCryptGetFipsAlgorithmMode(), test_CallForAttributes(), Test_KLID(), test_readTrustedPublisherDWORD(), test_RegQueryValueExPerformanceData(), test_save(), test_set_value(), test_setvalue_on_wow64(), TestInterfaceRegistry(), TestModuleRegistry(), TOOLBAR_Restore(), TRASH_CanTrashFile(), try_application_url(), UniformResourceLocatorW_InvokeCommand(), UnloadServiceDll(), UnloadUserProfile(), UpdateTcpIpInformation(), URL_ApplyDefault(), UserInstStubWrapperW(), UXTHEME_LoadTheme(), UXTHEME_RestoreSystemMetrics(), ViewTree_LoadTree(), W32TmServiceMain(), WinHttpGetDefaultProxyConfiguration(), WinHttpGetIEProxyConfigForCurrentUser(), WINTRUST_ReadProviderFromReg(), WintrustGetRegPolicyFlags(), WlxActivateUserShell(), WlxScreenSaverNotify(), wnetInit(), WsNcEntryInitializeFromRegistry(), and wWinMain().

◆ RegQueryValueW()

LSTATUS WINAPI RegQueryValueW ( HKEY  hkey,
LPCWSTR  name,
LPWSTR  data,
LPLONG  count 
)

Definition at line 4241 of file reg.c.

4242{
4243 DWORD ret;
4244 HKEY subkey = hkey;
4245
4246 TRACE("(%p,%s,%p,%d)\n", hkey, debugstr_w(name), data, count ? *count : 0 );
4247 if (hkey == NULL)
4248 {
4249 return ERROR_INVALID_HANDLE;
4250 }
4251 if (name && name[0])
4252 {
4253 ret = RegOpenKeyW( hkey, name, &subkey);
4254 if (ret != ERROR_SUCCESS)
4255 {
4256 return ret;
4257 }
4258 }
4259
4261
4262 if (subkey != hkey)
4263 {
4264 RegCloseKey( subkey );
4265 }
4266
4268 {
4269 /* return empty string if default value not found */
4270 if (data)
4271 *data = 0;
4272 if (count)
4273 *count = sizeof(WCHAR);
4275 }
4276 return ret;
4277}

Referenced by AVIBuildFilterW(), clsid_from_string_reg(), CoGetTreatAsClass(), CoTreatAsClass(), dde_connect(), EnumOLEVERB_Next(), execute_from_key(), get_engine_clsid(), GetClassFile(), HCR_GetDefaultVerbW(), HCR_MapTypeToValueW(), OleGetAutoConvert(), ProgIDFromCLSID(), query_typelib_path(), SHELL_FindExecutable(), SHELL_FindExecutableByVerb(), SHELL_FS_HideExtension(), SHRegQueryValueW(), test_reg_query_value(), test_WritePwrScheme(), and UIINSERTOBJECTDLG_PopulateObjectTypes().

◆ RegReplaceKeyA()

LONG WINAPI RegReplaceKeyA ( HKEY  hKey,
LPCSTR  lpSubKey,
LPCSTR  lpNewFile,
LPCSTR  lpOldFile 
)

Definition at line 4286 of file reg.c.

4290{
4291 UNICODE_STRING SubKey;
4292 UNICODE_STRING NewFile;
4293 UNICODE_STRING OldFile;
4295
4296 RtlInitEmptyUnicodeString(&SubKey, NULL, 0);
4297 RtlInitEmptyUnicodeString(&OldFile, NULL, 0);
4298 RtlInitEmptyUnicodeString(&NewFile, NULL, 0);
4299
4300 if (lpSubKey)
4301 {
4302 if (!RtlCreateUnicodeStringFromAsciiz(&SubKey, lpSubKey))
4303 {
4305 goto Exit;
4306 }
4307 }
4308
4309 if (lpOldFile)
4310 {
4311 if (!RtlCreateUnicodeStringFromAsciiz(&OldFile, lpOldFile))
4312 {
4314 goto Exit;
4315 }
4316 }
4317
4318 if (lpNewFile)
4319 {
4320 if (!RtlCreateUnicodeStringFromAsciiz(&NewFile, lpNewFile))
4321 {
4323 goto Exit;
4324 }
4325 }
4326
4328 SubKey.Buffer,
4329 NewFile.Buffer,
4330 OldFile.Buffer);
4331
4332Exit:
4333 RtlFreeUnicodeString(&OldFile);
4334 RtlFreeUnicodeString(&NewFile);
4335 RtlFreeUnicodeString(&SubKey);
4336
4337 return ErrorCode;
4338}
LONG WINAPI RegReplaceKeyW(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewFile, LPCWSTR lpOldFile)
Definition: reg.c:4347

◆ RegReplaceKeyW()

LONG WINAPI RegReplaceKeyW ( HKEY  hKey,
LPCWSTR  lpSubKey,
LPCWSTR  lpNewFile,
LPCWSTR  lpOldFile 
)

Definition at line 4347 of file reg.c.

4351{
4352 OBJECT_ATTRIBUTES KeyObjectAttributes;
4353 OBJECT_ATTRIBUTES NewObjectAttributes;
4354 OBJECT_ATTRIBUTES OldObjectAttributes;
4356 UNICODE_STRING NewFileName;
4357 UNICODE_STRING OldFileName;
4358 BOOLEAN CloseRealKey;
4359 HANDLE RealKeyHandle;
4363
4365 {
4366 return ERROR_INVALID_HANDLE;
4367 }
4368
4370 hKey);
4371 if (!NT_SUCCESS(Status))
4372 {
4374 }
4375
4376 /* Open the real key */
4377 if (lpSubKey != NULL && *lpSubKey != (WCHAR)0)
4378 {
4379 RtlInitUnicodeString(&SubKeyName, lpSubKey);
4380 InitializeObjectAttributes(&KeyObjectAttributes,
4381 &SubKeyName,
4383 KeyHandle,
4384 NULL);
4385 Status = NtOpenKey(&RealKeyHandle,
4387 &KeyObjectAttributes);
4388 if (!NT_SUCCESS(Status))
4389 {
4391 goto Cleanup;
4392 }
4393
4394 CloseRealKey = TRUE;
4395 }
4396 else
4397 {
4398 RealKeyHandle = KeyHandle;
4399 CloseRealKey = FALSE;
4400 }
4401
4402 /* Convert new file name */
4403 if (!RtlDosPathNameToNtPathName_U(lpNewFile,
4404 &NewFileName,
4405 NULL,
4406 NULL))
4407 {
4408 if (CloseRealKey)
4409 {
4410 NtClose(RealKeyHandle);
4411 }
4412
4414 goto Cleanup;
4415 }
4416
4417 InitializeObjectAttributes(&NewObjectAttributes,
4418 &NewFileName,
4420 NULL,
4421 NULL);
4422
4423 /* Convert old file name */
4424 if (!RtlDosPathNameToNtPathName_U(lpOldFile,
4425 &OldFileName,
4426 NULL,
4427 NULL))
4428 {
4429 RtlFreeHeap(RtlGetProcessHeap (),
4430 0,
4431 NewFileName.Buffer);
4432 if (CloseRealKey)
4433 {
4434 NtClose(RealKeyHandle);
4435 }
4436
4438 goto Cleanup;
4439 }
4440
4441 InitializeObjectAttributes(&OldObjectAttributes,
4442 &OldFileName,
4444 NULL,
4445 NULL);
4446
4447 Status = NtReplaceKey(&NewObjectAttributes,
4448 RealKeyHandle,
4449 &OldObjectAttributes);
4450
4451 RtlFreeHeap(RtlGetProcessHeap(),
4452 0,
4453 OldFileName.Buffer);
4454 RtlFreeHeap(RtlGetProcessHeap(),
4455 0,
4456 NewFileName.Buffer);
4457
4458 if (CloseRealKey)
4459 {
4460 NtClose(RealKeyHandle);
4461 }
4462
4463 if (!NT_SUCCESS(Status))
4464 {
4466 }
4467
4468Cleanup:
4470
4471 return ErrorCode;
4472}
NTSTATUS NTAPI NtReplaceKey(IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE Key, IN POBJECT_ATTRIBUTES ReplacedObjectAttributes)
Definition: ntapi.c:1614

Referenced by RegReplaceKeyA().

◆ RegRestoreKeyA()

LONG WINAPI RegRestoreKeyA ( HKEY  hKey,
LPCSTR  lpFile,
DWORD  dwFlags 
)

Definition at line 4481 of file reg.c.

4484{
4487
4488 if (lpFile)
4489 {
4492 }
4493 else
4494 RtlInitEmptyUnicodeString(&FileName, NULL, 0);
4495
4497 FileName.Buffer,
4498 dwFlags);
4499
4501
4502 return ErrorCode;
4503}
LONG WINAPI RegRestoreKeyW(HKEY hKey, LPCWSTR lpFile, DWORD dwFlags)
Definition: reg.c:4512

◆ RegRestoreKeyW()

LONG WINAPI RegRestoreKeyW ( HKEY  hKey,
LPCWSTR  lpFile,
DWORD  dwFlags 
)

Definition at line 4512 of file reg.c.

4515{
4522
4524 {
4525 return ERROR_INVALID_HANDLE;
4526 }
4527
4529 hKey);
4530 if (!NT_SUCCESS(Status))
4531 {
4533 }
4534
4535 if (!RtlDosPathNameToNtPathName_U(lpFile,
4536 &FileName,
4537 NULL,
4538 NULL))
4539 {
4541 goto Cleanup;
4542 }
4543
4545 &FileName,
4547 NULL,
4548 NULL);
4549
4556 RtlFreeHeap(RtlGetProcessHeap(),
4557 0,
4558 FileName.Buffer);
4559 if (!NT_SUCCESS(Status))
4560 {
4561 goto Cleanup;
4562 }
4563
4565 FileHandle,
4566 (ULONG)dwFlags);
4568
4569Cleanup:
4571
4572 if (!NT_SUCCESS(Status))
4573 {
4575 }
4576
4577 return ERROR_SUCCESS;
4578}
#define FILE_SHARE_READ
Definition: compat.h:136
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define FILE_GENERIC_READ
Definition: nt_native.h:653
NTSTATUS NTAPI NtRestoreKey(IN HANDLE KeyHandle, IN HANDLE FileHandle, IN ULONG RestoreFlags)
Definition: ntapi.c:1624

Referenced by RegRestoreKeyA().

◆ RegSaveKeyA()

LONG WINAPI RegSaveKeyA ( HKEY  hKey,
LPCSTR  lpFile,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)

Definition at line 4587 of file reg.c.

4590{
4593
4594 if (lpFile)
4595 {
4598 }
4599 else
4600 RtlInitEmptyUnicodeString(&FileName, NULL, 0);
4601
4603 FileName.Buffer,
4604 lpSecurityAttributes);
4606
4607 return ErrorCode;
4608}
LONG WINAPI RegSaveKeyW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: reg.c:4617

Referenced by test_reg_save_key().

◆ RegSaveKeyExA()

LONG WINAPI RegSaveKeyExA ( HKEY  hKey,
LPCSTR  lpFile,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
DWORD  Flags 
)

Definition at line 4697 of file reg.c.

4701{
4704
4705 if (lpFile)
4706 {
4709 }
4710 else
4711 RtlInitEmptyUnicodeString(&FileName, NULL, 0);
4712
4714 FileName.Buffer,
4715 lpSecurityAttributes,
4716 Flags);
4718
4719 return ErrorCode;
4720}
LONG WINAPI RegSaveKeyExW(HKEY hKey, LPCWSTR lpFile, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags)
Definition: reg.c:4730

◆ RegSaveKeyExW()

LONG WINAPI RegSaveKeyExW ( HKEY  hKey,
LPCWSTR  lpFile,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
DWORD  Flags 
)

Definition at line 4730 of file reg.c.

4734{
4735 switch (Flags)
4736 {
4738 case REG_LATEST_FORMAT:
4739 case REG_NO_COMPRESSION:
4740 break;
4741 default:
4743 }
4744
4745 FIXME("RegSaveKeyExW(): Flags ignored!\n");
4746
4747 return RegSaveKeyW(hKey,
4748 lpFile,
4749 lpSecurityAttributes);
4750}
#define REG_LATEST_FORMAT
Definition: cmtypes.h:98
#define REG_NO_COMPRESSION
Definition: cmtypes.h:99
#define REG_STANDARD_FORMAT
Definition: cmtypes.h:97

Referenced by RegSaveKeyExA(), and SaveDefaultUserHive().

◆ RegSaveKeyW()

LONG WINAPI RegSaveKeyW ( HKEY  hKey,
LPCWSTR  lpFile,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)

Definition at line 4617 of file reg.c.

4620{
4628
4630 hKey);
4631 if (!NT_SUCCESS(Status))
4632 {
4634 }
4635
4636 if (!RtlDosPathNameToNtPathName_U(lpFile,
4637 &FileName,
4638 NULL,
4639 NULL))
4640 {
4642 goto Cleanup;
4643 }
4644
4645 if (lpSecurityAttributes != NULL)
4646 {
4647 SecurityDescriptor = lpSecurityAttributes->lpSecurityDescriptor;
4648 }
4649
4651 &FileName,
4653 NULL,
4659 NULL,
4664 NULL,
4665 0);
4666 RtlFreeHeap(RtlGetProcessHeap(),
4667 0,
4668 FileName.Buffer);
4669 if (!NT_SUCCESS(Status))
4670 {
4671 goto Cleanup;
4672 }
4673
4675 FileHandle);
4677
4678Cleanup:
4680
4681 if (!NT_SUCCESS(Status))
4682 {
4684 }
4685
4686 return ERROR_SUCCESS;
4687}
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSTATUS NTAPI NtSaveKey(IN HANDLE KeyHandle, IN HANDLE FileHandle)
Definition: ntapi.c:1634
LPVOID lpSecurityDescriptor
Definition: compat.h:193
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:191

Referenced by ExportRegistryFile(), RegSaveKeyA(), and RegSaveKeyExW().

◆ RegSetKeySecurity()

LONG WINAPI RegSetKeySecurity ( HKEY  hKey,
SECURITY_INFORMATION  SecurityInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor 
)

Definition at line 4759 of file reg.c.

4762{
4765
4767 {
4768 return ERROR_INVALID_HANDLE;
4769 }
4770
4772 hKey);
4773 if (!NT_SUCCESS(Status))
4774 {
4776 }
4777
4780 pSecurityDescriptor);
4781
4783
4784 if (!NT_SUCCESS(Status))
4785 {
4787 }
4788
4789 return ERROR_SUCCESS;
4790}
NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)

Referenced by AccRewriteSetHandleRights(), ATL::CRegKey::SetKeySecurity(), test_reg_create_key(), and test_reg_open_key().

◆ RegSetKeyValueA()

LONG WINAPI RegSetKeyValueA ( IN HKEY  hKey,
IN LPCSTR lpSubKey  OPTIONAL,
IN LPCSTR lpValueName  OPTIONAL,
IN DWORD  dwType,
IN LPCVOID lpData  OPTIONAL,
IN DWORD  cbData 
)

Definition at line 2210 of file reg.c.

2216{
2217 HANDLE KeyHandle, CurKey, SubKeyHandle = NULL;
2219 LONG Ret;
2220
2222 hKey);
2223 if (!NT_SUCCESS(Status))
2224 {
2226 }
2227
2228 if (lpSubKey != NULL)
2229 {
2232
2234 {
2236 goto Cleanup;
2237 }
2238
2240 &SubKeyName,
2242 KeyHandle,
2243 NULL);
2244
2248
2250
2251 if (!NT_SUCCESS(Status))
2252 {
2254 goto Cleanup;
2255 }
2256
2257 CurKey = SubKeyHandle;
2258 }
2259 else
2260 CurKey = KeyHandle;
2261
2262 Ret = RegSetValueExA(CurKey,
2263 lpValueName,
2264 0,
2265 dwType,
2266 lpData,
2267 cbData);
2268
2269 if (SubKeyHandle != NULL)
2270 {
2272 }
2273
2274Cleanup:
2276
2277 return Ret;
2278}
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799

◆ RegSetKeyValueW()

LONG WINAPI RegSetKeyValueW ( IN HKEY  hKey,
IN LPCWSTR lpSubKey  OPTIONAL,
IN LPCWSTR lpValueName  OPTIONAL,
IN DWORD  dwType,
IN LPCVOID lpData  OPTIONAL,
IN DWORD  cbData 
)

Definition at line 2139 of file reg.c.

2145{
2146 HANDLE KeyHandle, CurKey, SubKeyHandle = NULL;
2148 LONG Ret;
2149
2151 hKey);
2152 if (!NT_SUCCESS(Status))
2153 {
2155 }
2156
2157 if (lpSubKey != NULL)
2158 {
2161
2162 RtlInitUnicodeString(&SubKeyName, lpSubKey);
2163
2165 &SubKeyName,
2167 KeyHandle,
2168 NULL);
2169
2173 if (!NT_SUCCESS(Status))
2174 {
2176 goto Cleanup;
2177 }
2178
2179 CurKey = SubKeyHandle;
2180 }
2181 else
2182 CurKey = KeyHandle;
2183
2184 Ret = RegSetValueExW(CurKey,
2185 lpValueName,
2186 0,
2187 dwType,
2188 lpData,
2189 cbData);
2190
2191 if (SubKeyHandle != NULL)
2192 {
2194 }
2195
2196Cleanup:
2198
2199 return Ret;
2200}
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882

Referenced by InitFunctionPtrs(), and WshShell3_RegWrite().

◆ RegSetValueA()

LONG WINAPI RegSetValueA ( HKEY  hKeyOriginal,
LPCSTR  lpSubKey,
DWORD  dwType,
LPCSTR  lpData,
DWORD  cbData 
)

Definition at line 4954 of file reg.c.

4959{
4960 HKEY subkey;
4961 HANDLE hKey;
4962 DWORD ret;
4964
4965 TRACE("(%p,%s,%d,%s,%d)\n", hKeyOriginal, debugstr_a(lpSubKey), dwType, debugstr_a(lpData), cbData );
4966
4967 if (dwType != REG_SZ || !lpData) return ERROR_INVALID_PARAMETER;
4968
4969 Status = MapDefaultKey(&hKey, hKeyOriginal);
4970 if (!NT_SUCCESS(Status))
4971 {
4973 }
4974 subkey = hKey;
4975
4976 if (lpSubKey && lpSubKey[0]) /* need to create the subkey */
4977 {
4978 ret = RegCreateKeyA(hKey, lpSubKey, &subkey);
4979 if (ret != ERROR_SUCCESS)
4980 goto Cleanup;
4981 }
4982
4983 ret = RegSetValueExA( subkey, NULL, 0, REG_SZ, (const BYTE*)lpData, strlen(lpData)+1 );
4984 if (subkey != hKey)
4985 RegCloseKey(subkey);
4986
4987Cleanup:
4989
4990 return ret;
4991}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LONG WINAPI RegCreateKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1179
unsigned char BYTE
Definition: xxhash.c:193

Referenced by init_key(), register_server(), register_testentry(), test_appsearch_reglocator(), test_device_interface_key(), test_getstring_no_extra(), test_null(), test_reg_copy_tree(), test_reg_delete_tree(), test_reg_query_value(), test_RegQueryValueExPerformanceData(), and test_set_value().

◆ RegSetValueExA()

LONG WINAPI RegSetValueExA ( HKEY  hKey,
LPCSTR  lpValueName,
DWORD  Reserved,
DWORD  dwType,
CONST BYTE lpData,
DWORD  cbData 
)

Definition at line 4799 of file reg.c.

4805{
4807 LPWSTR pValueName;
4811 LPBYTE pData;
4814
4815 /* Convert SubKey name to Unicode */
4816 if (lpValueName != NULL && lpValueName[0] != '\0')
4817 {
4818 if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, lpValueName))
4820 }
4821 else
4822 {
4823 ValueName.Buffer = NULL;
4824 }
4825
4826 pValueName = (LPWSTR)ValueName.Buffer;
4827
4828
4829 if (is_string(dwType) && (cbData != 0))
4830 {
4831 /* Convert ANSI string Data to Unicode */
4832 /* If last character NOT zero then increment length */
4833 LONG bNoNulledStr = ((lpData[cbData-1] != '\0') ? 1 : 0);
4834 AnsiString.Buffer = (PSTR)lpData;
4835 AnsiString.Length = cbData + bNoNulledStr;
4836 AnsiString.MaximumLength = cbData + bNoNulledStr;
4838 &AnsiString,
4839 TRUE);
4840
4841 if (!NT_SUCCESS(Status))
4842 {
4843 if (pValueName != NULL)
4845
4847 }
4848 pData = (LPBYTE)Data.Buffer;
4849 DataSize = cbData * sizeof(WCHAR);
4850 }
4851 else
4852 {
4853 Data.Buffer = NULL;
4854 pData = (LPBYTE)lpData;
4855 DataSize = cbData;
4856 }
4857
4859 pValueName,
4860 Reserved,
4861 dwType,
4862 pData,
4863 DataSize);
4864
4865 if (pValueName != NULL)
4867
4868 if (Data.Buffer != NULL)
4870
4871 return ErrorCode;
4872}
if(dx< 0)
Definition: linetemp.h:194
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
char * PSTR
Definition: typedefs.h:51

Referenced by add_value_(), crash_and_debug(), crash_and_winedbg(), create_test_association(), create_test_class(), create_test_entries(), create_test_verb_dde(), CryptRegisterOIDFunction(), ICInstall(), IntSetupDiSetDeviceRegistryPropertyAW(), IStream_fnRelease(), lineGetTranslateCapsA(), MSACM_WriteCache(), NdrDllRegisterProxy(), ODBC_ReplicateODBCInstToRegistry(), ODBC_ReplicateODBCToRegistry(), process_pending_renames(), reg_unreg_wine_test_class(), register_coclasses(), register_codepages(), register_converters(), register_decoders(), register_encoders(), register_interfaces(), register_key_defvalueA(), register_keys(), register_mediatypes_parsing(), register_metadatareaders(), register_pixelformats(), register_progid(), register_zone_domains(), RegSetKeyValueA(), RegSetValueA(), restore_value(), save_cert_mgr_usages(), save_sys_colors(), set_component_path(), set_domain(), set_name_servers(), setLayerValue(), setup_adapter(), SHSetValueA(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), START_TEST(), store_key_pair(), store_key_permissions(), test_appsearch(), test_appsearch_reglocator(), test_classesroot(), test_classesroot_enum(), test_CoGetPSClsid(), test_debug_heap(), test_delete_key_value(), test_delete_value(), test_deleted_key(), test_enum_value(), test_envvar(), test_ExitCode(), test_GetAcceptLanguagesA(), test_internet_features_registry(), test_machine_guid(), test_MsiConfigureProductEx(), test_MsiEnumClients(), test_MsiEnumComponentsEx(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfo(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetProductProperty(), test_MsiGetUserInfo(), test_MsiOpenProduct(), test_MsiProvideQualifiedComponentEx(), test_MsiQueryComponentState(), test_MsiQueryFeatureState(), test_MsiQueryProductState(), test_MsiSourceListAddSource(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListGetInfo(), test_NonExistentPath(), test_null(), test_OleRegGetUserType(), test_publish_components(), test_redirection(), test_reg_copy_tree(), test_reg_delete_tree(), test_reg_query_info(), test_registry(), test_RegQueryValueExPerformanceData(), test_rw_order(), test_set_value(), test_string_termination(), test_symlinks(), test_write_registry_values(), test_XcvDataPort_ConfigureLPTPortCommandOK(), test_XcvDataPort_GetTransmissionRetryTimeout(), test_zone_domain_cache(), testRegStore(), WhichPlatform(), WNetCachePassword(), write_registry_values(), and WriteRegistryValue().

◆ RegSetValueExW()

LONG WINAPI RegSetValueExW ( _In_ HKEY  hKey,
_In_ LPCWSTR  lpValueName,
_In_ DWORD  Reserved,
_In_ DWORD  dwType,
_In_ CONST BYTE lpData,
_In_ DWORD  cbData 
)

Definition at line 4882 of file reg.c.

4889{
4893
4895 hKey);
4896 if (!NT_SUCCESS(Status))
4897 {
4899 }
4900
4901 if (IsHKCRKey(KeyHandle))
4902 {
4903 LONG ErrorCode = SetHKCRValue(KeyHandle, lpValueName, Reserved, dwType, lpData, cbData);
4905 return ErrorCode;
4906 }
4907
4908 if (is_string(dwType) && (cbData != 0))
4909 {
4910 PWSTR pwsData = (PWSTR)lpData;
4911
4912 _SEH2_TRY
4913 {
4914 if((pwsData[cbData / sizeof(WCHAR) - 1] != L'\0') &&
4915 (pwsData[cbData / sizeof(WCHAR)] == L'\0'))
4916 {
4917 /* Increment length if last character is not zero and next is zero */
4918 cbData += sizeof(WCHAR);
4919 }
4920 }
4922 {
4923 /* Do not fail if we fault where we were told not to go */
4924 }
4925 _SEH2_END;
4926 }
4927
4928 RtlInitUnicodeString(&ValueName, lpValueName);
4929
4931 &ValueName,
4932 0,
4933 dwType,
4934 (PVOID)lpData,
4935 (ULONG)cbData);
4936
4938
4939 if (!NT_SUCCESS(Status))
4940 {
4942 }
4943
4944 return ERROR_SUCCESS;
4945}
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
LONG WINAPI SetHKCRValue(_In_ HKEY hKey, _In_ LPCWSTR Name, _In_ DWORD Reserved, _In_ DWORD Type, _In_ CONST BYTE *Data, _In_ DWORD DataSize)
Definition: hkcr.c:613
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66

Referenced by _HandleAddPort(), _HandleConfigureLPTPortCommandOK(), _InitializeLocalSpooler(), _LocalSetPrinterHandleData(), _LocalSetPrintServerHandleData(), _RegSetStringValueW(), _SHGetCurrentVersionPath(), _SHGetProfilesValue(), _SHGetUserShellFolderPath(), _SHRegisterFolders(), _tmain(), ACTION_MsiPublishAssemblies(), ACTION_PublishFeatures(), add_userkey(), AddERExcludedApplicationW(), AddInstallationSource(), AddNewLayout(), AddToFavoritesDlgProc(), AddUninstallKey(), append_multi_sz_value(), AppendStringToMultiSZ(), ApplyChanges(), ApplyOrCancelChanges(), ApplyScheme(), BuildVolatileEnvironment(), CNewMenu::CacheItems(), ChangeNtProductType(), ChangePortNumber(), CliSaveImeHotKey(), CM_Open_Class_Key_ExW(), COMCAT_ICatRegister_RegisterCategories(), ComDBClaimNextFreePort(), ComDBClaimPort(), ComDBOpen(), ComDBReleasePort(), ComDBResizeDatabase(), ConCfgWriteUserSettings(), connections_on_notify(), CopyKey(), CopySystemProfile(), CreateAppPath(), CreateDeviceInstance(), CreateEventLog(), CreateInstanceKey(), CreateNewValue(), CreateStandardProfile(), CreateUserProfileExW(), CriticalDeviceCoInstaller(), CRYPT_CreateMachineGuid(), CRYPT_SetDefaultOIDDlls(), CRYPT_SIPWriteFunction(), CRYPT_WriteSerializedToReg(), CryptRegisterOIDFunction(), CryptRegisterOIDInfo(), CryptSetOIDFunctionValue(), CryptSetProviderExW(), DecrementRefCount(), delete_multi_sz_value(), DEVENUM_IPropertyBag_Write(), DIALOG_Execute(), CNetConnection::Disconnect(), DllRegisterServer(), DMORegister(), do_process_key(), ATL::CRegObject::do_process_key(), do_reg_operation(), do_typelib_reg_key(), CFontExt::DoInstallFontFile(), DoTestComputerName(), DoWriteProductOption(), DoWriteSoundEvents(), EditTypeDlg_WriteClass(), CSysTray::EnableService(), EnableTheming(), FILEDLG95_MRU_save_filename(), FillList(), FilterMapper3_CreateCategory(), FilterMapper_RegisterFilter(), FilterMapper_RegisterPin(), general_on_notify(), get_cred_mgr_encryption_key(), GetCurrentDPI(), GetCurrentHwProfileW(), ImageView_SaveSettings(), Imm32WriteImeLayout(), ImpersonateTokenWithEveryoneOrWithout(), IncrementRefCount(), INetCfgComponentControl_fnApplyRegistryChanges(), INetCfgLock_fnAcquireWriteLock(), InitializeDefaultUserLocale(), InitializeFormList(), InitializeProfiles(), InitializeProgramFilesDir(), InitLogs(), InputList_AddInputMethodToUserRegistry(), InputList_WriteSubst(), InputProcessorProfiles_AddLanguageProfile(), InputProcessorProfiles_EnableLanguageProfile(), InputProcessorProfiles_EnableLanguageProfileByDefault(), InputProcessorProfiles_SetDefaultLanguageProfile(), InstallDefaultSystemSoundScheme(), InstallEventSource(), InstallNetDevice(), InstallOneService(), InstallParallelPort(), InstallReactOS(), InstallScreenSaverW(), InstallSerialPort(), InstallSystemSoundLabels(), InstallSystemSoundScheme(), InstallSystemSoundSchemeNames(), INTERNET_LoadProxySettings(), INTERNET_SaveProxySettings(), IntSetupDiSetDeviceRegistryPropertyAW(), IStream_fnRelease(), ITERATE_RemoveEnvironmentString(), ITERATE_WriteEnvironmentString(), ITERATE_WriteRegistryValues(), KmtFltAddAltitude(), CNetConnectionPropertyUi::LANPropertiesUIDlg(), LoadEventSources(), LoadLogFile(), LocalAddForm(), LocalAddMonitor(), LocalmonAddPort(), LocalmonAddPortEx(), LocalSetForm(), MAIN_LoadSettings(), MAIN_MenuCommand(), MAIN_SaveSettings(), MainWnd_OnInstall(), MainWnd_OnOpenRegKey(), MainWnd_OnUpdateRegistry(), MMDevice_Create(), MMDevice_SetPropValue(), MMSYS_InstallDevice(), ModifyStatus(), ModifyValue(), MouseOnApply(), MRU_SaveChanged(), MSACM_WriteCurrentPriorities(), msi_reg_set_val_dword(), msi_reg_set_val_multi_str(), msi_reg_set_val_str(), msi_set_last_used_source(), MsiSourceListAddMediaDiskW(), MsiSourceListAddSourceExW(), MsiSourceListSetInfoW(), myAddPrinterDriverEx(), NdrDllRegisterProxy(), NetIDPage_OnApply(), NetworkDlg_OnOK(), OnAutoSync(), PerformMount(), PNP_AddID(), PNP_SetClassRegProp(), PNP_SetDeviceRegProp(), ProcessSetupInf(), ProcessUnattendSection(), publish_install_properties(), publish_patches(), RChangeServiceConfig2W(), RChangeServiceConfigW(), RCreateServiceW(), register_categories(), register_codepages(), register_converters(), register_decoders(), register_encoders(), register_interfaces(), register_key_defvalueW(), register_mediatypes_extension(), register_mediatypes_parsing(), register_metadatareaders(), register_pixelformats(), RegisterBDAComponent(), RegisterHelperDll(), RegisterSdbEntry(), RegisterService(), RegisterTypeLib(), registry_set_filelist(), registry_set_formatopts(), registry_set_options(), registry_set_pagemargins(), registry_set_previewpages(), registry_write_credential(), RegSetDWORDValue(), RegSetKeyValueW(), RegSetOrDelete(), RegSetString(), RegSetValueExA(), RegSetValueW(), CNetConnection::Rename(), RenameValue(), run_add(), run_copy(), save_mapping_settings(), SaveAdvancedSettings(), SaveAppSettings(), SaveBoard(), SaveCustomPath(), SaveDWORDToRegistry(), SaveGeoID(), SavePropertiesDlg(), SaveSetting(), SaveSettings(), SaveShutdownSelState(), SaveStringToRegistry(), SaveSystemSettings(), SaveUserLocale(), SaveWorkstationInfo(), ScmCreateNewControlPipe(), ScmMarkServiceForDelete(), ScmSetFailureActions(), ScmSetLastKnownGoodControlSet(), ScmWriteDependencies(), ScmWriteSecurityDescriptor(), set_profile_device_key(), set_proxy(), set_value_state(), SetActivePwrScheme(), SetAutoAdminLogon(), SetAutoDaylight(), COpenWithList::SetDefaultHandler(), SetDefaultPrinterW(), SetFindFlags(), SetHKCRValue(), SetHotPlugFlags(), SetInstallationCompleted(), SetLastID(), SetNtpClientValues(), SetNTPServer(), SetParametersValues(), SetPerUserSecValuesW(), SetProfileData(), SetSetupType(), SETUP_CreateClassKey(), SETUPDI_CreateDrvKey(), SetupDiChangeState(), SetupDiInstallDevice(), SetupRegisterClass(), SetUserWaitInterval(), SHRegWriteUSValueW(), SHSetValueW(), SKSetValueW(), SQLWritePrivateProfileStringW(), START_TEST(), CFindFolder::StartSearch(), stillimagew_RegisterLaunchApplication(), StoreDriveSettings(), test4(), test_CallForAttributes(), test_enum_value(), test_Installer_RegistryValue(), test_IQueryAssociations_GetString(), test_legacy_filter_registration(), test_OleRegGetUserType(), test_set_value(), TestMyEventProvider(), TLB_register_interface(), TOOLBAR_Save(), TRASH_CanTrashFile(), UpdateCaretBlinkTimeReg(), UpdateRegistryForFontSubstitutes(), UpdateRegistryString(), UpdateTcpIpInformation(), UpdateUsersShellFolderSettings(), UXTHEME_ApplyTheme(), UXTHEME_BackupSystemMetrics(), ViewDlg_Apply(), ViewDlg_RestoreDefaults(), WinHttpSetDefaultProxyConfiguration(), WINTRUST_WriteProviderToReg(), WINTRUST_WriteSingleUsageEntry(), WintrustSetRegPolicyFlags(), wnet_use_connection(), write_config_value(), write_credential_blob(), write_reg_key(), write_registry_values(), write_types(), WriteCabinetState(), WriteGlobalPwrPolicy(), WriteKeysSettings(), WriteOwnerSettings(), WriteParameterArray(), WritePortSettings(), WriteProcessorPwrScheme(), WritePwrPolicy(), WritePwrScheme(), WriteStartupRecoveryOptions(), WriteUserLocale(), and ZoneMgrImpl_SetZoneAttributes().

◆ RegSetValueW()

LONG WINAPI RegSetValueW ( HKEY  hKeyOriginal,
LPCWSTR  lpSubKey,
DWORD  dwType,
LPCWSTR  lpData,
DWORD  cbData 
)

Definition at line 5000 of file reg.c.

5005{
5006 HKEY subkey;
5007 HANDLE hKey;
5008 DWORD ret;
5010
5011 TRACE("(%p,%s,%d,%s,%d)\n", hKeyOriginal, debugstr_w(lpSubKey), dwType, debugstr_w(lpData), cbData );
5012
5013 if (dwType != REG_SZ || !lpData)
5015
5017 hKeyOriginal);
5018 if (!NT_SUCCESS(Status))
5019 {
5021 }
5022 subkey = hKey;
5023
5024 if (lpSubKey && lpSubKey[0]) /* need to create the subkey */
5025 {
5026 ret = RegCreateKeyW(hKey, lpSubKey, &subkey);
5027 if (ret != ERROR_SUCCESS)
5028 goto Cleanup;
5029 }
5030
5031 ret = RegSetValueExW( subkey, NULL, 0, REG_SZ, (const BYTE*)lpData,
5032 (wcslen( lpData ) + 1) * sizeof(WCHAR) );
5033 if (subkey != hKey)
5034 RegCloseKey(subkey);
5035
5036Cleanup:
5038
5039 return ret;
5040}
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201

Referenced by CoTreatAsClass(), CreateRegAppPath(), DllRegisterServer(), NdrDllRegisterProxy(), OleSetAutoConvert(), SetupRegisterClass(), test_reg_query_value(), and test_set_value().

◆ RegUnLoadKeyA()

LONG WINAPI RegUnLoadKeyA ( HKEY  hKey,
LPCSTR  lpSubKey 
)

Definition at line 5049 of file reg.c.

5051{
5054
5055 if (lpSubKey)
5056 {
5059 }
5060 else
5061 RtlInitEmptyUnicodeString(&KeyName, NULL, 0);
5062
5064 KeyName.Buffer);
5065
5067
5068 return ErrorCode;
5069}
LONG WINAPI RegUnLoadKeyW(HKEY hKey, LPCWSTR lpSubKey)
Definition: reg.c:5078

Referenced by test_reg_unload_key().

◆ RegUnLoadKeyW()

LONG WINAPI RegUnLoadKeyW ( HKEY  hKey,
LPCWSTR  lpSubKey 
)

Definition at line 5078 of file reg.c.

5080{
5085
5087 {
5088 return ERROR_INVALID_HANDLE;
5089 }
5090
5092 if (!NT_SUCCESS(Status))
5093 {
5095 }
5096
5097 RtlInitUnicodeString(&KeyName, lpSubKey);
5098
5100 &KeyName,
5102 KeyHandle,
5103 NULL);
5104
5106
5108
5109 if (!NT_SUCCESS(Status))
5110 {
5112 }
5113
5114 return ERROR_SUCCESS;
5115}
NTSTATUS NTAPI NtUnloadKey(IN POBJECT_ATTRIBUTES KeyObjectAttributes)
Definition: ntapi.c:1789

Referenced by CreateUserProfileExW(), RegUnLoadKeyA(), UnloadHive(), and UnloadUserProfile().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( reg  )

Variable Documentation

◆ DefaultHandleHKUDisabled

BOOLEAN DefaultHandleHKUDisabled = FALSE
static

Definition at line 37 of file reg.c.

Referenced by MapDefaultKey(), RegDisablePredefinedCache(), and RegDisablePredefinedCacheEx().

◆ DefaultHandlesDisabled

BOOLEAN DefaultHandlesDisabled = FALSE
static

Definition at line 36 of file reg.c.

Referenced by MapDefaultKey(), and RegDisablePredefinedCacheEx().

◆ DefaultHandleTable

HANDLE DefaultHandleTable[MAX_DEFAULT_HANDLES]
static

Definition at line 34 of file reg.c.

Referenced by CloseDefaultKeys(), MapDefaultKey(), RegInitialize(), and RegOverridePredefKey().

◆ DllInitialized

BOOLEAN DllInitialized = FALSE
static

Definition at line 38 of file reg.c.

Referenced by RegInitialize().

◆ HandleTableCS

◆ ProcessHeap

HANDLE ProcessHeap
static