ReactOS  0.4.14-dev-114-gc8cbd56
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)
 

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); \
}
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ HANDLE Handle
Definition: extypes.h:390

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 }
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
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 RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
smooth NULL
Definition: ftsmooth.c:416
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
unsigned int ULONG
Definition: retypes.h:1
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

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 915 of file reg.c.

921 {
922  OBJECT_ATTRIBUTES LocalObjectAttributes;
923  UNICODE_STRING LocalKeyName;
926  ULONG FullNameLength;
927  ULONG Length;
928  PWCHAR Ptr;
929  HANDLE LocalKeyHandle;
930 
932  samDesired,
934  0,
935  ClassString,
936  dwOptions,
937  (PULONG)lpdwDisposition);
938  TRACE("NtCreateKey(%wZ) called (Status %lx)\n", ObjectAttributes->ObjectName, Status);
940  return Status;
941 
942  /* Copy object attributes */
943  RtlCopyMemory(&LocalObjectAttributes,
945  sizeof(OBJECT_ATTRIBUTES));
946  RtlCreateUnicodeString(&LocalKeyName,
947  ObjectAttributes->ObjectName->Buffer);
948  LocalObjectAttributes.ObjectName = &LocalKeyName;
949  FullNameLength = LocalKeyName.Length / sizeof(WCHAR);
950 
951  LocalKeyHandle = NULL;
952 
953  /* Remove the last part of the key name and try to create the key again. */
955  {
956  Ptr = wcsrchr(LocalKeyName.Buffer, '\\');
957  if (Ptr == NULL || Ptr == LocalKeyName.Buffer)
958  {
960  break;
961  }
962 
963  *Ptr = (WCHAR)0;
964  LocalKeyName.Length = wcslen(LocalKeyName.Buffer) * sizeof(WCHAR);
965 
966  Status = NtCreateKey(&LocalKeyHandle,
968  &LocalObjectAttributes,
969  0,
970  NULL,
971  0,
972  &Disposition);
973  TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status);
974  }
975 
976  if (!NT_SUCCESS(Status))
977  {
978  RtlFreeUnicodeString(&LocalKeyName);
979  return Status;
980  }
981 
982  /* Add removed parts of the key name and create them too. */
983  Length = wcslen(LocalKeyName.Buffer);
984  while (TRUE)
985  {
986  if (LocalKeyHandle)
987  NtClose (LocalKeyHandle);
988 
989  LocalKeyName.Buffer[Length] = L'\\';
990  Length = wcslen (LocalKeyName.Buffer);
991  LocalKeyName.Length = Length * sizeof(WCHAR);
992 
993  if (Length == FullNameLength)
994  {
996  samDesired,
998  0,
999  ClassString,
1000  dwOptions,
1001  (PULONG)lpdwDisposition);
1002  break;
1003  }
1004 
1005  Status = NtCreateKey(&LocalKeyHandle,
1007  &LocalObjectAttributes,
1008  0,
1009  NULL,
1010  0,
1011  &Disposition);
1012  TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status);
1013  if (!NT_SUCCESS(Status))
1014  break;
1015  }
1016 
1017  RtlFreeUnicodeString(&LocalKeyName);
1018 
1019  return Status;
1020 }
DWORD dwOptions
Definition: solitaire.cpp:23
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
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
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:54
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
Status
Definition: gdiplustypes.h:24
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
unsigned int * PULONG
Definition: retypes.h:1
PUNICODE_STRING ObjectName
Definition: umtypes.h:185
unsigned int ULONG
Definition: retypes.h:1
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

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_MULTI_SZ
Definition: nt_native.h:1501
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_SZ
Definition: layer.c:22

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

◆ MapDefaultKey() [1/2]

◆ MapDefaultKey() [2/2]

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

Definition at line 153 of file reg.c.

155 {
156  PHANDLE Handle;
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 */
171  if (Index >= MAX_DEFAULT_HANDLES)
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 }
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
uint32_t ULONG_PTR
Definition: typedefs.h:63
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define GetPredefKeyIndex(HKey)
Definition: reg.c:50
_In_ HANDLE Handle
Definition: extypes.h:390
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IsPredefKey(HKey)
Definition: reg.c:48
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
static const UCHAR Index[8]
Definition: usbohci.c:18
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
static BOOLEAN DefaultHandlesDisabled
Definition: reg.c:36
Status
Definition: gdiplustypes.h:24
static NTSTATUS OpenPredefinedKey(IN ULONG Index, OUT HANDLE Handle)
Definition: reg.c:105
static BOOLEAN DefaultHandleHKUDisabled
Definition: reg.c:37
unsigned int ULONG
Definition: retypes.h:1
uint32_t * PULONG_PTR
Definition: typedefs.h:63
static HANDLE DefaultHandleTable[MAX_DEFAULT_HANDLES]
Definition: reg.c:34
static ULONG DWORD void *static HANDLE
Definition: reg.c:149
int DoOpen(void)
Definition: cmds.c:2168
return STATUS_SUCCESS
Definition: btrfs.c:2966
BOOL RegInitialize(VOID)
Definition: reg.c:70
#define MAX_DEFAULT_HANDLES
Definition: reg.c:27

◆ OpenClassesRootKey() [1/2]

static NTSTATUS OpenClassesRootKey ( PHANDLE  KeyHandle)
static

Referenced by OpenPredefinedKey().

◆ OpenClassesRootKey() [2/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 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
FORCEINLINE void MakeHKCRKey(_Inout_ HKEY *hKey)
Definition: reg.h:20
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

◆ 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 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

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 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

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 }
static NTSTATUS OpenClassesRootKey(PHANDLE KeyHandle)
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS OpenUsersKey(PHANDLE KeyHandle)
Definition: reg.c:288
_In_ HANDLE Handle
Definition: extypes.h:390
static const UCHAR Index[8]
Definition: usbohci.c:18
static NTSTATUS OpenLocalMachineKey(PHANDLE KeyHandle)
Definition: reg.c:264
NTSYSAPI NTSTATUS NTAPI RtlOpenCurrentUser(_In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE KeyHandle)
static NTSTATUS OpenCurrentConfigKey(PHANDLE KeyHandle)
Definition: reg.c:307
Status
Definition: gdiplustypes.h:24

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 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

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
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)

Referenced by DllMain().

◆ RegCloseKey()

LONG WINAPI RegCloseKey ( HKEY  hKey)

Definition at line 423 of file reg.c.

424 {
426 
427  /* don't close null handle or a pseudo handle */
428  if (!hKey)
429  {
430  return ERROR_INVALID_HANDLE;
431  }
432 
433  if (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000)
434  {
435  return ERROR_SUCCESS;
436  }
437 
438  Status = NtClose(hKey);
439  if (!NT_SUCCESS(Status))
440  {
442  }
443 
444  return ERROR_SUCCESS;
445 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)

Referenced by _CmdWndProc(), _enumeratorRememberedW(), _HandleConfigureLPTPortCommandOK(), _InitializeLocalSpooler(), _InitializePrintProviderList(), _LocalGetPrinterHandleData(), _LocalGetPrintServerHandleData(), _LocalSetPrinterHandleData(), _LocalSetPrintServerHandleData(), _SHExpandEnvironmentStrings(), _SHGetCurrentVersionPath(), _SHGetUserShellFolderPath(), _SHRegisterFolders(), _test_key_exists(), _test_key_not_exists(), _test_reg_key(), _tmain(), _tryLoadProvider(), _tWinMain(), AboutDlgProc(), AccpCloseObjectHandle(), AccpOpenNamedObject(), ACTION_AppSearchReg(), ACTION_ForceReboot(), ACTION_GetSharedDLLsCount(), ACTION_MsiPublishAssemblies(), ACTION_MsiUnpublishAssemblies(), ACTION_ProcessComponents(), ACTION_PublishFeatures(), ACTION_PublishProduct(), action_RegDeleteTreeA(), ACTION_RegisterClassInfo(), ACTION_RegisterExtensionInfo(), ACTION_RegisterProduct(), ACTION_RegisterUser(), ACTION_UnregisterClassInfo(), ACTION_WriteSharedDLLsCount(), add_userkey(), COpenWithList::AddAppToMRUList(), AddAssociation(), AddERExcludedApplicationW(), CDesktopFolderEnum::AddItemsFromClassicStartMenuKey(), CRegFolderEnum::AddItemsFromKey(), AddListViewItems(), AddNewLayout(), AddNotificationDll(), AddResourceItems(), AddSoundProfile(), CDefaultContextMenu::AddStaticContextMenusToMenu(), CDefaultContextMenu::AddStaticEntriesForKey(), AddUserProfiles(), alloc_device(), AllSysInfo(), ApplyChanges(), ApplyCursorScheme(), ApplyOrCancelChanges(), ApplyRegistryValues(), ApplyScheme(), ata_bblk(), ata_check_unit(), ata_get_bblist_regh(), AVIBuildFilterW(), BitmapDecoderInfo_Constructor(), BitmapDecoderInfo_Release(), BitmapEncoderInfo_Constructor(), BitmapEncoderInfo_Release(), build_zonemap_from_reg(), BuildCodePageList(), BuildFileFilterAndDeviceMenu(), BuildLeftPopupMenu(), BuildLogListAndFilterList(), BuildParameterArray(), BuildServiceArray(), BuildVolatileEnvironment(), cache_container_set_size(), CNewMenu::CacheItems(), CallNotificationDll(), CallNotificationDlls(), CanUserWritePwrScheme(), capGetDriverDescriptionW(), CategoryMgr_RegisterCategory(), CategoryMgr_UnregisterCategory(), CATIDEnumGUID_Release(), CDevSettings_SetPruningMode(), CFSExtractIcon_CreateInstance(), ChangePortNumber(), check_dirid(), CheckForLoadedProfile(), CheckLogOrSourceExistence(), CheckRegScreenSaverIsSecure(), ChildWndProc(), ChooseFavorite(), ChooseGinaUI(), cleanup_eventlog(), ATL::CRegKey::Close(), close_key(), CloseAppConfig(), CloseKey(), closeKey(), clsid_from_string_reg(), CLSIDEnumGUID_Next(), CLSIDEnumGUID_Release(), CM_Open_Class_Key_ExW(), CM_Open_DevNode_Key_Ex(), CoGetClassObject(), CoGetTreatAsClass(), COM_OpenKeyForAppIdFromCLSID(), COM_OpenKeyForCLSID(), COMCAT_ICatInformation_GetCategoryDesc(), COMCAT_ICatInformation_IsClassOfCategories(), COMCAT_ICatRegister_RegisterCategories(), COMCAT_ICatRegister_UnRegisterCategories(), COMCAT_IEnumCATEGORYINFO_Next(), COMCAT_IEnumCATEGORYINFO_Release(), COMCAT_IsClassOfCategories(), COMCAT_RegisterClassCategories(), COMCAT_UnRegisterClassCategories(), ComDBClose(), ComDBOpen(), ComponentInfo_GetGuidList(), ConCfgReadUserSettings(), ConCfgWriteUserSettings(), connections_on_initdialog(), connections_on_notify(), ConSrvOpenUserSettings(), ConSrvReadUserSettings(), ConSrvWriteUserSettings(), Control_RegisterRegistryApplets(), ConverterSupportsFormat(), CopyKey(), CopySystemProfile(), CoTreatAsClass(), create_key(), create_local_service(), create_monodata(), create_mru_list(), create_new_eventlog(), create_reg_entries(), create_server(), CreateAppPathRegKey(), CreateComponentEnumerator(), CreateComponentInfo(), CreateDeviceInstance(), CreateEnvironmentBlock(), CreateEventLog(), CreateHKCRKey(), CreateInstanceKey(), CreateKeyboardLayoutList(), CreateNewKey(), CreateNewValue(), CreateNotificationObject(), CreateNTPServerList(), CreateRegAppPath(), CreateStandardProfile(), CreateTempDir(), CreateTimeZoneList(), CreateUserEnvironment(), CreateUserProfileExW(), CredDeleteW(), CredEnumerateW(), CredReadW(), CredWriteW(), CriticalDeviceCoInstaller(), CRYPT_CreateMachineGuid(), CRYPT_GetFuncFromReg(), CRYPT_ImportSystemRootCertsToReg(), CRYPT_LoadSIPFunc(), CRYPT_RegCloseStore(), CRYPT_RegReadFromReg(), CRYPT_RegReadSerializedFromReg(), CRYPT_RegWriteToReg(), CRYPT_SIPWriteFunction(), CRYPT_SysRegOpenStoreW(), CRYPT_WriteSerializedToReg(), CryptAcquireContextW(), CRYPTDLG_CheckOnlineCRL(), CryptEnumProvidersW(), CryptEnumProviderTypesW(), CryptGetDefaultOIDDllList(), CryptGetDefaultProviderW(), CryptGetOIDFunctionValue(), CryptRegisterDefaultOIDFunction(), CryptRegisterOIDFunction(), CryptRegisterOIDInfo(), CryptSetOIDFunctionValue(), CryptSetProviderExW(), CryptSIPRetrieveSubjectGuid(), CryptUnregisterDefaultOIDFunction(), CryptUnregisterOIDInfo(), debugstr_iid(), DecrementRefCount(), delete_branch(), delete_key(), delete_local_assembly_key(), delete_reg_entries(), delete_registry_key(), delete_test_key(), delete_tree(), delete_value(), DeleteExt(), DeleteHKCRKey(), DeleteJob(), DeleteKey(), DeleteRegistryValue(), DeleteSubKey(), DeleteUserCursorScheme(), DeleteValue(), DestroyDeviceInfoSet(), DEVENUM_CreateAMCategoryKey(), DEVENUM_IEnumMoniker_Release(), DEVENUM_IPropertyBag_Read(), DEVENUM_IPropertyBag_Write(), DEVENUM_ReadPins(), DEVENUM_ReadPinTypes(), device_disabled_registry(), devinst_RegDeleteTreeW(), DIALOG_Execute(), DirectDrawEnumerateExA(), DisableShellext(), CNetConnection::Disconnect(), DisplayClassCoinstallers(), DisplayClassInstaller(), DisplayClassProperties(), DisplayDeviceCoinstallers(), DisplayImageInfo(), DisplayMatchingDeviceId(), DisplayStatus(), DllMain(), DllRegisterServer(), DllUnregisterServer(), DMOGetName(), DMOGetTypes(), DMORegister(), DMOUnregister(), do_process_key(), ATL::CRegObject::do_process_key(), do_typelib_reg_key(), DoLoadItems(), DoneRegKey(), DoStartStartupItems(), DRIVER_GetLibName(), EditTypeDlg_ReadClass(), EditTypeDlg_WriteClass(), CSysTray::EnableService(), EnableTheming(), ensure_useragent(), Enum(), enum_drivers(), enum_key(), enum_values(), EnumClientServiceProtocol(), EnumDeviceClasses(), EnumerateCursorSchemes(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumerateNetworkComponent(), EnumerateNt4ServiceSoundDevices(), EnumerateSoundProfiles(), EnumHKCRKey(), EnumHKCRValue(), EnumInstalledApplications(), CMainWindow::EnumInstalledAppProc(), EnumInterfaces(), EnumOLEVERB_Construct(), EnumOLEVERB_Release(), EnumPwrSchemes(), EnumTfLanguageProfiles_Destructor(), EnumTfLanguageProfiles_Reset(), ExecuteAutoRunFile(), expect_LayerValue_imp(), export_hkey(), export_registry_data(), export_registry_key(), ExportRegistryFile(), FDebugBreakForService(), FILEDLG95_MRU_get_slot(), FILEDLG95_MRU_save_filename(), FILEDLG95_unixfs_is_rooted_at_desktop(), filedlg_collect_places_pidls(), FileTypesDlg_AddExt(), FileTypesDlg_InsertToLV(), FillColorSchemeComboBox(), FillList(), CDefView::FillList(), FillServerAddressCombo(), FilterMapper3_CreateCategory(), FilterMapper_RegisterFilter(), FilterMapper_RegisterPin(), FilterMapper_RegisterPinType(), FilterMapper_UnregisterFilter(), FilterMapper_UnregisterPin(), find_default_printer(), find_fallback_font(), find_mime_from_ext(), find_registry_key(), find_typelib_key(), FindCurrentDriver(), FindDfltProvRegVals(), FindNetworkAdapter(), FindProvRegVals(), FindProvTypesRegVals(), FormatConverterInfo_Constructor(), FormatConverterInfo_Release(), CMainWindow::FreeInstalledAppList(), FTP_Connect(), general_on_notify(), get_action_policy(), get_app_key(), get_cert_mgr_usages(), get_client_counts(), get_cred_mgr_encryption_key(), get_default_proxy_reg_value(), get_dest_dir(), get_engine_clsid(), get_feature_from_reg(), get_fusion_filename(), get_hide_clock_from_registry(), get_install_location(), get_install_root(), get_mime_clsid(), get_mmioFromProfile(), get_mono_path_from_registry(), get_owner_company(), get_privateprofile_sectionkey(), get_progfiles_dir(), get_program_files_dir(), get_protocol_cf(), get_ps_clsid_from_registry(), get_reg_dword(), get_registered_local_package(), get_shell_icon_size(), get_system_dirs(), get_url_encoding(), get_user_dirs(), get_windows_version_str(), get_zone_from_domains(), get_zone_from_reg(), GetAcceptLanguagesW(), GetActiveClassicTheme(), GetActivePwrScheme(), GetAdaptersInfo(), GetAllUsersProfileDirectoryW(), GetAutoDaylightInfo(), GetAutostartEntriesFromRegistry(), GetBooleanRegValue(), GetBootResourceList(), GetCLSIDForFileType(), CQueryAssociations::GetCommand(), GetConnectionDescription(), GetConnectionType(), GetCurrentDPI(), GetCurrentHwProfileW(), GetCurrentScreenSaverValue(), CTrayBandSite::GetDefaultBandsStream(), GetDefaultPrinterFromRegistry(), GetDefaultPrinterW(), GetDefaultUserProfileDirectoryW(), GetDesktopPath(), CRegFolder::GetDetailsOf(), CNetConnectionPropertyUi::GetDeviceInstanceID(), GetDeviceInstanceList(), GetDeviceInstanceListSize(), GetDeviceLocationString(), GetDisabledAutostartEntriesFromRegistry(), GetDisplayNameFileAndID(), CRegFolder::GetDisplayNameOf(), GetDriverDateString(), GetDriverName(), GetDriverProviderString(), GetDriverVersionString(), GetEnumeratorInstanceList(), GetEnumeratorInstanceListSize(), GetEnumOptions(), GetEnvironmentVariables(), GetEventMessageFileDLL(), GetExplorerRegValueSet(), GetFileTypeIconsByKey(), GetFindFlags(), GetGinaPath(), GetInterfaceNameInternal(), GetIntervalSetting(), GetJobName(), GetLayoutCount(), GetLayoutID(), GetLayoutName(), GetLPTTransmissionRetryTimeout(), GetNetworkParams(), GetPerAdapterInfo(), GetPnpKey(), GetPortType(), GetProfile(), GetProfileCount(), GetProfiles(), GetProfilesDirectoryW(), GetProfileType(), GetProgramsPath(), CNetConnection::GetProperties(), GetProtoOpenNetworkDatabase(), GetPwrDiskSpindownRange(), GetRegistrySettings(), GetRegUlong(), GetRegValue(), GetServiceInstanceList(), GetServiceInstanceListSize(), GetServiceMainFunctions(), CSysTray::GetServicesEnabled(), GetSetupType(), GetShell(), GetShutdownReasonUI(), CQueryAssociations::GetString(), GetStyleValue(), GetSubkeyNames(), GetSyncSetting(), GetTimeZoneListIndex(), GetUsedPorts(), CTrayBandSite::GetUserBandsStream(), GetUserProfileDirectoryW(), GetUserWaitInterval(), go_home(), GuiConsoleReadUserSettings(), GuiConsoleWriteUserSettings(), GUILoggedOutSAS(), Handler_DllGetClassObject(), HaveDefaultMailClient(), HCR_GetClassNameA(), HCR_GetClassNameW(), HCR_GetDefaultVerbW(), HCR_GetExecuteCommandW(), HCR_GetFolderAttributes(), HCR_GetIconA(), HCR_GetIconW(), HCR_MapTypeToValueA(), HCR_MapTypeToValueW(), HlinkGetSpecialReference(), I_CryptReadTrustedPublisherDWORDValueFromRegistry(), IDirectPlay4AImpl_EnumConnections(), IEnumDMO_fnNext(), IEnumDMO_fnRelease(), ImageView_LoadSettings(), ImageView_SaveSettings(), ImmGetIMEFileNameW(), ImmInstallIMEW(), ImportAppProfile(), ImportRegistryFile(), ImportSoundEntry(), ImportSoundProfiles(), IncrementRefCount(), INetCfgComponentControl_fnApplyRegistryChanges(), INetCfgLock_fnAcquireWriteLock(), INetCfgLock_fnIsWriteLocked(), CQueryAssociations::Init(), CAutoComplete::Init(), Pane::init(), init_driver(), init_key(), init_registered_oid_info(), InitAudioDlg(), InitBackgroundDialog(), InitDialog(), InitFontSizeList(), initialize(), InitializeDefaultUserLocale(), InitializeDirectPlayDialog(), InitializePrinterList(), InitializePrintMonitorList(), InitializePrintProcessorList(), InitializeProfiles(), InitializeProgramFilesDir(), InitIconOverlays(), InitKeyboardLayouts(), InitLogs(), InitNotifications(), InitOSVersion(), InitOurDirectory(), InitPropertiesDlg(), InitRadioButtons(), InitSettings(), InitShellServices(), InitTTFontCache(), InputList_AddInputMethodToUserRegistry(), InputList_PrepareUserRegistry(), InputProcessorProfiles_AddLanguageProfile(), InputProcessorProfiles_EnableLanguageProfile(), InputProcessorProfiles_EnableLanguageProfileByDefault(), InputProcessorProfiles_GetDefaultLanguageProfile(), InputProcessorProfiles_IsEnabledLanguageProfile(), InputProcessorProfiles_Register(), InputProcessorProfiles_SetDefaultLanguageProfile(), InstallDefaultSystemSoundScheme(), InstallDevice(), InstallDeviceData(), InstallerImpl_RegistryValue(), InstallEventSource(), InstallNetDevice(), InstallNetworkComponent(), InstallOneInterface(), InstallOneService(), InstallParallelPort(), InstallReactOS(), InstallSerialPort(), InstallSoftwareDeviceInterfaceInf(), InstallSystemSoundLabels(), InstallSystemSoundScheme(), InstallSystemSoundSchemeNames(), Int_EnumDependentServicesW(), CRegistryTree::InternalGetSubkey(), INTERNET_LoadProxySettings(), INTERNET_SaveProxySettings(), IntGetIcdData(), IntSetupDiSetDeviceRegistryPropertyAW(), is_ie_hardened(), is_places_bar_enabled(), IsConsoleBoot(), IsConsoleShell(), IsExtensionAShortcut(), IsInternetESCEnabledLocal(), IsLayoutExists(), IsLiveCD(), IsThemeActive(), IStream_fnRelease(), IsWindowsOS(), ITERATE_FindRelatedProducts(), ITERATE_MigrateFeatureStates(), ITERATE_PublishComponent(), ITERATE_RegisterFonts(), ITERATE_RemoveEnvironmentString(), ITERATE_UnregisterFonts(), ITERATE_WriteEnvironmentString(), ITERATE_WriteRegistryValues(), KmtFltAddAltitude(), CNetConnectionPropertyUi::LANPropertiesUIDlg(), LayoutList_Create(), lffromreg(), lineGetCountryA(), lineGetCountryW(), lineGetTranslateCapsA(), CSettings::Load(), COpenWithList::Load(), load_config_driver(), load_devices_from_reg(), load_graphics_driver(), load_mapi_providers(), load_mapping_settings(), load_process_feature(), load_registry_settings(), load_settings(), load_wine_gecko(), load_wine_gecko_v(), COpenWithList::LoadAppList(), LoadBoard(), CNewMenu::LoadCachedItems(), LoadClassicColorSchemes(), LoadCurrentLocale(), LoadCurrentScheme(), LoadDataFromRegistry(), LoadDNSSettings(), LoadEventLabel(), LoadEventLabels(), LoadFilterSettings(), LoadInitialCursorScheme(), LoadInstallableVDD(), CNewMenu::LoadItem(), LoadJobs(), LoadKeyboardLayoutW(), LoadLogFiles(), COpenWithList::LoadProgIdList(), CInputPin::LoadProxyPlugins(), COutputPin::LoadProxyPlugins(), CKsProxy::LoadProxyPlugins(), COpenWithList::LoadRecommendedFromHKCR(), COpenWithList::LoadRecommendedFromHKCU(), LoadRecoveryOptions(), LoadRegInt(), LoadRegistrySettings(), LoadSchemeFromReg(), LoadSchemeSizes(), LoadSettings(), LoadShutdownSelState(), LoadSMBiosData(), LoadSoundProfiles(), LoadUsernameHint(), LocaleList_Create(), LocalEnumPrintProcessors(), LocalGetPrintProcessorDirectory(), main(), Main_DirectDraw_GetDeviceIdentifier7(), MAIN_LoadSettings(), MainWnd_OnInstall(), MainWnd_OnOpenRegKey(), MainWnd_OnUpdateRegistry(), MakeService(), MCI_GetDevTypeFromFileName(), MCI_SysInfo(), MetadataReaderInfo_Constructor(), MetadataReaderInfo_Release(), metricfromreg(), MIDIMAP_LoadSettings(), MIDIMAP_LoadSettingsScheme(), MMDevEnum_Free(), MMDevEnum_GetDefaultAudioEndpoint(), MMDevice_Create(), MMDevice_GetPropValue(), MMDevice_SetPropValue(), MMDevPropStore_GetAt(), MMDevPropStore_GetCount(), MMDevPropStore_OpenPropKey(), MMSYS_InstallDevice(), ModifyStatus(), MouseCallback(), mru_RegDeleteTreeA(), MRU_SaveChanged(), MSACM_ReadCache(), MSACM_RegisterAllDrivers(), MSACM_RegisterDriverFromRegistry(), MSACM_ReorderDriversByPriority(), MSACM_WriteCurrentPriorities(), msi_comp_find_package(), msi_comp_find_prod_key(), msi_comp_find_prodcode(), MSI_GetComponentPath(), MSI_GetProductInfo(), MSI_GetUserInfo(), msi_locate_product(), MSI_OpenProductW(), MSI_ProvideQualifiedComponentEx(), msi_publish_patches(), msi_publish_sourcelist(), msi_publish_upgrade_code(), msi_set_last_used_source(), msi_unpublish_feature(), MsiGetPatchInfoExW(), MsiGetProductCodeW(), MsiGetProductInfoExW(), MsiQueryProductStateW(), MsiSourceListAddMediaDiskW(), MsiSourceListAddSourceExW(), MsiSourceListAddSourceW(), MsiSourceListEnumMediaDisksW(), MsiSourceListEnumSourcesW(), MsiSourceListGetInfoW(), MsiSourceListSetInfoW(), myRegDeleteTreeA(), myRegDeleteTreeW(), NdrDllRegisterProxy(), NetBTInit(), NetIDPage_OnApply(), NetIDPage_OnInitDialog(), new_key_container(), NewCtxInit(), CRegistryTree::NewKey(), next_LanguageProfile(), NOTEPAD_LoadSettingsFromRegistry(), NOTEPAD_SaveSettingsToRegistry(), notif_thread_proc(), ODBC_ReplicateODBCInstToRegistry(), ODBC_ReplicateODBCToRegistry(), OLECONVERT_CreateCompObjStream(), OleGetAutoConvert(), OleRegEnumVerbs(), OleRegGetMiscStatus(), OleRegGetUserType(), OleSetAutoConvert(), on_vmware(), OnAutoSync(), OnColorButton(), CSearchBar::OnInitDialog(), OnInitMenu(), OnInitSysSettingsDialog(), OnOK(), OnTreeExpanding(), open_key(), open_local_assembly_key(), open_package(), OpenHardwareProfileKey(), OpenHKCRKey(), OpenInitializedCatalog(), OpenNetworkDatabase(), OpenServiceParametersKey(), OpenSourceKey(), CRegistryKey::OpenSubkey(), FileTypeManager::operator[](), package_RegDeleteTreeW(), pCDevSettings_Initialize(), pCDevSettings_InitializeExtInterface(), pendingRename(), PerformMount(), PixelFormatInfo_Constructor(), PixelFormatInfo_Release(), PlayLogonSoundThread(), 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(), PopulateCustomPathCombo(), POWRPROF_GetMachinePowerPolicy(), POWRPROF_GetUserPowerPolicy(), PrintAllAssociations(), PrintAssociation(), PrintOSVersion(), PrintSystemInfo(), process_args_from_reg(), process_extensions(), RequestHandler::process_request(), ProcessPage_OnDebug(), ProcessPageShowContextMenu(), ProcessRunKeys(), ProcessSetupInf(), ProcessUnattendSection(), ProfilesEnumGuid_Destructor(), ProgIDFromCLSID(), proxy_active(), query_all(), query_feature_state(), query_typelib_path(), query_value(), QueryConfig2A(), QueryConfig2W(), QueryHKCRValue(), QueryStringValue(), QueryUserRegValueW(), r_verifyProxyEnable(), RChangeServiceConfig2W(), RChangeServiceConfigW(), RCloseServiceHandle(), RControlService(), RCreateServiceW(), read_bitmap_patterns(), RegDirectory::read_directory(), read_key(), read_metadata_patterns(), read_oid_info(), read_types(), ReadAttributes(), ReadBindingString(), ReadCabinetState(), ReadGlobalPwrPolicy(), ReadKeysSettings(), ReadLineConfig(), ReadPageFileSettings(), ReadPerInstanceRegistryParameters(), ReadPortSettings(), ReadProcessorPwrScheme(), ReadRegistry(), ReadRegistryComputerNameValue(), ReadRegistryValue(), ReadSettings(), RefreshListView(), RefreshTreeItem(), reg_add(), reg_delete(), reg_export(), reg_get_typelib_module(), reg_query(), reg_restore(), reg_save(), reg_unreg_wine_test_class(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RegDelString(), RegFindRecurse(), RegFindWalk(), RegGetDWORD(), RegGetDWORDValue(), RegGetSZ(), RegGetValueA(), RegGetValueW(), register_appid(), register_categories(), register_coclasses(), register_codepages(), register_converters(), register_decoders(), register_encoders(), register_interfaces(), register_key_defvalueA(), register_key_defvalueW(), register_keys(), register_legacy_filters(), register_mediatypes_extension(), register_mediatypes_parsing(), register_metadatareaders(), register_pixelformats(), register_progid(), register_server(), register_testentry(), register_verb(), register_zone_domains(), RegisterBDAComponent(), RegisterComponent(), RegisterDefaultAcceptHeaders(), RegisterDword(), CControlPanelEnum::RegisterRegistryCPanelApps(), RegisterString(), RegisterTypeLib(), registry_callback(), registry_enumerate_credentials(), RegistryPropertyBag_IPropertyBag_Release(), RegQueryRegistryKeys(), RegQueryRegistryValues(), RegQueryValueA(), RegQueryValueW(), RegReadString(), RegSetDWORDValue(), RegSetKeyValueW(), RegSetValueA(), RegSetValueW(), RegTCloseKeyHandle(), remove_product_upgrade_code(), RemoveAssociation(), RemoveEventLog(), RemovePort(), CNetConnection::Rename(), RenameValue(), REnumDependentServicesA(), REnumDependentServicesW(), ReportProductInfoEvent(), RQueryServiceConfig2A(), RQueryServiceConfig2W(), RQueryServiceConfigA(), RQueryServiceConfigW(), RSAENH_CPGetProvParam(), RSAENH_CPSetProvParam(), RSetServiceObjectSecurity(), SSOThread::Run(), RunSetupThreadProc(), SampIsSetupRunning(), SampSetupAddMemberToAlias(), save_cert_mgr_usages(), save_mapping_settings(), save_registry_settings(), save_sys_colors(), COpenWithList::SaveApp(), SaveBoard(), SaveCurrentLocale(), SaveCursorScheme(), SaveCustomPath(), SaveDataToRegistry(), SaveDefaultUserHive(), SaveGeoID(), SaveJob(), SaveRegInt(), SaveSettings(), SaveShutdownSelState(), SaveSystemSettings(), scan_subkeys(), ScmAssignNewTag(), ScmAutoStartServices(), ScmCopyControlSet(), ScmCopyTree(), ScmCreateNewControlPipe(), ScmCreateServiceDatabase(), ScmCreateServiceKey(), ScmDeleteControlSet(), ScmDeleteMarkedServices(), ScmDeleteRegKey(), ScmDeleteTree(), ScmGetControlSetValues(), ScmGetNoInteractiveServicesValue(), ScmGetSetupInProgress(), ScmInitNamedPipeCriticalSection(), ScmMarkServiceForDelete(), ScmOpenServiceKey(), ScmReadSecurityDescriptor(), ScmSetLastKnownGoodControlSet(), ScmWriteSecurityDescriptor(), search_domain_for_zone(), SECUR32_initializeProviders(), ServicesPageWndProc(), set_component_path(), set_domain(), set_installed_prop(), set_lang(), set_name_servers(), set_profile_device_key(), set_proxy(), SetActivePwrScheme(), SetAllVars(), SetAutoAdminLogon(), SetAutoDaylightInfo(), COpenWithList::SetDefaultHandler(), SetDefaultLanguage(), SetDefaultPrinterW(), SetDesktopBackColor(), SetFindFlags(), SetHKCRValue(), SetInstallationCompleted(), SetKeyboardLayoutName(), SetLastID(), setLayerValue(), SetNTPServer(), SetPerUserSecValuesW(), SetProfileData(), SetRegUlong(), SetScreenSaver(), SetSetupType(), SetSystemEnvironment(), SetTime(), setup_adapter(), SETUP_CreateClassKey(), SETUP_CreateDevicesList(), SETUP_CreateDevicesListFromEnumerator(), SETUP_CreateInterfaceList(), setup_dinput_options(), setup_dsound_options(), SETUP_GetClassIconInfo(), SETUPAPI_GetCurrentHwProfile(), SETUPDI_CreateDevKey(), SETUPDI_CreateDrvKey(), SETUPDI_OpenDevKey(), SETUPDI_OpenDrvKey(), SetupDiBuildClassInfoListExW(), SetupDiCallClassInstaller(), SetupDiChangeState(), SetupDiClassGuidsFromNameExW(), SetupDiClassNameFromGuidExW(), SetupDiCreateDeviceInfoListExW(), SetupDiCreateDeviceInterfaceRegKeyW(), SetupDiCreateDevRegKeyW(), SetupDiDeleteDevRegKey(), SetupDiGetClassDescriptionExW(), SetupDiGetClassDevPropertySheetsW(), SetupDiGetDeviceRegistryPropertyW(), SetupDiInstallClassExW(), SetupDiInstallDevice(), SetupDiOpenClassRegKeyExW(), SetupDiOpenDeviceInfoW(), SetupDiOpenDeviceInterfaceRegKey(), SetupDiOpenDeviceInterfaceW(), SetupDiOpenDevRegKey(), SetupDiRegisterCoDeviceInstallers(), SetupIsActive(), CClassNode::SetupNode(), SetupRegisterAllClasses(), SetupRegisterClass(), SetUserEnvironment(), SetUserSysColors(), SetUserWaitInterval(), SetUserWallpaper(), SetWallpaper(), SetWelcomeText(), SHAboutInfoW(), SHADD_get_policy(), SHAddToRecentDocs(), SHCoCreateInstance(), SHCopyKeyW(), SHCreatePropSheetExtArrayEx(), SHDeleteEmptyKeyA(), SHDeleteEmptyKeyW(), SHDeleteKeyW(), SHDeleteOrphanKeyA(), SHDeleteOrphanKeyW(), SHDeleteValueA(), SHDeleteValueW(), SHDOCVW_GetShellInstanceObjectClassObject(), SHELL_FindExecutableByVerb(), SHELL_FS_HideExtension(), SHELL_IsShortcut(), SHELL_TryAppPathW(), ShellExecute_FromContextMenu(), ShellExecute_GetClassKey(), SHGetRestriction(), SHGetSettings(), SHGetValueA(), SHGetValueW(), SHOpenRegStream2A(), SHOpenRegStream2W(), ShowAppList(), ShowRegValue(), SHPinDllOfCLSID(), SHRegCloseKey(), SHRegCloseUSKey(), SHRestricted(), SHSetValueA(), SHSetValueW(), SIC_LoadOverlayIcon(), SKAllocValueW(), SKDeleteValueW(), SKGetValueW(), SKSetValueW(), SmoothScrollWindow(), SockLoadHelperDll(), SockLoadTransportList(), SockLoadTransportMapping(), spy_init(), SQLGetInstalledDriversW(), SQLGetPrivateProfileString(), SQLGetPrivateProfileStringW(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), SQLWritePrivateProfileStringW(), START_TEST(), StartScreenSaver(), CFindFolder::StartSearch(), StartShell(), startup(), StartWithDesktop(), stillimagew_RegisterLaunchApplication(), stillimagew_UnregisterLaunchApplication(), store_key_container_keys(), store_key_container_permissions(), StoreDriveSettings(), SuggestKeys(), tapiGetLocationInfoW(), test4(), test_add(), test_AddERExcludedApplicationA(), test_appsearch(), test_appsearch_reglocator(), test_autocreation(), test_basic_import(), test_basic_import_31(), test_basic_import_unicode(), test_CallForAttributes(), test_child_heap(), test_CoGetClassObject(), test_CoGetPSClsid(), test_comments(), test_comments_unicode(), test_CreateMRUListLazyW(), test_CreateMRUListW(), Test_CreateOpenKey(), test_debug_heap(), test_delete(), test_DeletePwrScheme(), test_device_interface_key(), test_device_key(), Test_DuplicateHandle(), test_envvar(), test_ExitCode(), test_export(), test_file_in_use(), test_file_in_use_cab(), test_FolderShortcut(), test_get_profiles_dir(), test_GetAcceptLanguagesA(), test_getstring_no_extra(), test_impersonation_level(), test_import(), test_import_31(), test_import_with_whitespace(), test_import_with_whitespace_unicode(), test_install_services(), test_Installer_InstallProduct(), test_internet_features_registry(), test_invalid_import(), test_invalid_import_31(), test_invalid_import_unicode(), test_invalid_stdin(), test_key_creation_and_deletion(), test_key_creation_and_deletion_unicode(), test_legacy_filter_registration(), test_machine_guid(), test_mixed_package(), test_MsiConfigureProductEx(), 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_MsiSourceListGetInfo(), test_MsiSourceListSetInfo(), test_NonExistentPath(), test_null(), test_OleDoAutoConvert(), test_OleRegGetUserType(), test_open_class_key(), test_process_components(), test_publish(), test_publish_assemblies(), test_publish_components(), test_publish_features(), test_publish_product(), test_query(), test_register_class_info(), test_register_extension_info(), test_register_font(), test_register_mime_info(), test_register_product(), test_register_progid_info(), test_register_typelib(), test_register_user(), test_registerDefaultOIDFunction(), test_registerOIDInfo(), test_registrar(), test_RegPolicyFlags(), test_remove_env_strings(), test_remove_registry_values(), test_remove_upgrade_code(), test_save(), test_SetupDiOpenClassRegKeyExA(), test_setvalue_on_wow64(), test_SetZoneAttributes(), test_SHCopyKey(), test_SHCreateDefaultContextMenu(), test_SHCreateSessionKey(), test_SHDeleteKey(), test_SHGetFolderPathA(), test_SHGetObjectCompatFlags(), test_SHGetShellKey(), test_SHQueryValueEx(), test_SQLGetPrivateProfileString(), test_SQLGetPrivateProfileStringW(), test_SQLInstallDriverEx(), test_SQLInstallTranslatorEx(), test_SQLWritePrivateProfileString(), test_stub(), test_system_security_access(), test_TreatAsClass(), test_unicode_import(), test_unicode_import_with_whitespace(), test_url_action(), test_value_deletion(), test_value_deletion_unicode(), test_write_registry_values(), test_WritePwrScheme(), test_XcvDataPort_ConfigureLPTPortCommandOK(), test_XcvDataPort_GetTransmissionRetryTimeout(), test_zone_domain_cache(), test_zone_domain_mappings(), TestInterfaceRegistry(), TestKeyAccess_(), TestModuleRegistry(), TestMyEventProvider(), testRegStore(), testRegStoreSavedCerts(), testSystemStore(), TLB_register_interface(), TLB_unregister_interface(), TOOLBAR_Restore(), TOOLBAR_Save(), TRASH_CanTrashFile(), try_application_url(), TTIsEmbeddingEnabledForFacename(), UniformResourceLocatorW_InvokeCommand(), CRegistryKey::Uninit(), uniquecontainer(), UnloadServiceDll(), UnloadUserProfile(), unregister_categories(), unregister_coclasses(), unregister_converters(), unregister_decoders(), unregister_dmo_from_category(), unregister_encoders(), unregister_interfaces(), unregister_keys(), unregister_mediatypes_extension(), unregister_mediatypes_parsing(), unregister_metadatareaders(), unregister_pixelformats(), unregister_server(), unregister_zone_domains(), UnregisterComponent(), UnRegisterTypeLib(), UpdateRegistryForFontSubstitutes(), UpdateRegistryString(), UpdateTcpIpInformation(), UpdateUsersShellFolderSettings(), URL_ApplyDefault(), URL_GuessScheme(), UserInstStubWrapperW(), UXTHEME_ApplyTheme(), UXTHEME_BackupSystemMetrics(), UXTHEME_LoadTheme(), UXTHEME_RestoreSystemMetrics(), verify_key_(), verify_key_nonexist_(), VfdRegisterHandlers(), VfdUnregisterHandlers(), ViewDlg_Apply(), ViewDlg_RestoreDefaults(), ViewTree_LoadAll(), ViewTree_LoadTree(), WhichPlatform(), wined3d_dll_init(), WinHttpGetDefaultProxyConfiguration(), WinHttpGetIEProxyConfigForCurrentUser(), WinHttpSetDefaultProxyConfiguration(), WINTRUST_ReadProviderFromReg(), WINTRUST_WriteProviderToReg(), WINTRUST_WriteSingleUsageEntry(), WintrustGetRegPolicyFlags(), WintrustSetRegPolicyFlags(), WlxActivateUserShell(), WlxScreenSaverNotify(), wnet_use_connection(), WNetCachePassword(), WNetCancelConnection2W(), WNetCloseEnum(), WNetEnumCachedPasswords(), wnetInit(), WNetOpenEnumW(), write_config_value(), write_reg_key(), write_registry_values(), write_types(), WriteCabinetState(), WriteComputerSettings(), WriteDefaultLogonData(), WriteGlobalData(), WriteGlobalPwrPolicy(), WriteKeysSettings(), WriteLineConfig(), WriteOwnerSettings(), WritePageFileSettings(), WriteParameterArray(), WritePortSettings(), WriteProcessorPwrScheme(), WritePwrPolicy(), WritePwrScheme(), WriteRegistry(), WriteRegistryValue(), WriteSettings(), WriteStartupRecoveryOptions(), WriteUserLocale(), WsNcDelete(), WsNcEntryInitializeFromRegistry(), WsNcOpen(), WsNcRefreshFromRegistry(), WsProcInitialize(), WsRasLoadHelperDll(), WsSetupCatalogProtection(), WsTcDelete(), WsTcEntryInitializeFromRegistry(), WsTcOpen(), WsTcRefreshFromRegistry(), wWinMain(), ZoneMgrImpl_GetZoneAttributes(), ZoneMgrImpl_SetZoneAttributes(), CDefaultContextMenu::~CDefaultContextMenu(), and CEnumRegKey::~CEnumRegKey().

◆ RegConnectRegistryA()

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

Definition at line 840 of file reg.c.

843 {
844  UNICODE_STRING MachineName = { 0, 0, NULL };
845  LONG Ret;
846 
847  if (lpMachineName != NULL &&
849  {
851  }
852 
853  Ret = RegConnectRegistryW(MachineName.Buffer,
854  hKey,
855  phkResult);
856 
858 
859  return Ret;
860 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_In_ DWORD _Out_ PDWORD _In_opt_ PCSTR MachineName
Definition: setupapi.h:1286
long LONG
Definition: pedump.c:60
LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult)
Definition: reg.c:869
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)

Referenced by test_regconnectregistry().

◆ RegConnectRegistryW()

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

Definition at line 869 of file reg.c.

872 {
873  LONG ret;
874 
875  TRACE("(%s,%p,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult);
876 
877  if (!lpMachineName || !*lpMachineName)
878  {
879  /* Use the local machine name */
880  ret = RegOpenKeyW( hKey, NULL, phkResult );
881  }
882  else
883  {
884  WCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
885  DWORD len = sizeof(compName) / sizeof(WCHAR);
886 
887  /* MSDN says lpMachineName must start with \\ : not so */
888  if( lpMachineName[0] == '\\' && lpMachineName[1] == '\\')
889  lpMachineName += 2;
890 
891  if (GetComputerNameW(compName, &len))
892  {
893  if (!_wcsicmp(lpMachineName, compName))
894  ret = RegOpenKeyW(hKey, NULL, phkResult);
895  else
896  {
897  FIXME("Connect to %s is not supported.\n",debugstr_w(lpMachineName));
899  }
900  }
901  else
902  ret = GetLastError();
903  }
904 
905  return ret;
906 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

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

◆ RegCopyTreeA()

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

Definition at line 811 of file reg.c.

814 {
815  UNICODE_STRING SubKeyName = { 0, 0, NULL };
816  LONG Ret;
817 
818  if (lpSubKey != NULL &&
820  {
822  }
823 
824  Ret = RegCopyTreeW(hKeySrc,
825  SubKeyName.Buffer,
826  hKeyDest);
827 
829 
830  return Ret;
831 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
LONG WINAPI RegCopyTreeW(IN HKEY hKeySrc, IN LPCWSTR lpSubKey OPTIONAL, IN HKEY hKeyDest)
Definition: reg.c:736

Referenced by InitFunctionPtrs().

◆ RegCopyTreeW()

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

Definition at line 736 of file reg.c.

739 {
740  HANDLE DestKeyHandle, KeyHandle, CurKey, SubKeyHandle = NULL;
742 
744  hKeySrc);
745  if (!NT_SUCCESS(Status))
746  {
748  }
749 
750  Status = MapDefaultKey(&DestKeyHandle,
751  hKeyDest);
752  if (!NT_SUCCESS(Status))
753  {
754  goto Cleanup2;
755  }
756 
757  if (lpSubKey != NULL)
758  {
761 
762  RtlInitUnicodeString(&SubKeyName, lpSubKey);
763 
765  &SubKeyName,
767  KeyHandle,
768  NULL);
769 
773  if (!NT_SUCCESS(Status))
774  {
775  goto Cleanup;
776  }
777 
778  CurKey = SubKeyHandle;
779  }
780  else
781  CurKey = KeyHandle;
782 
783  Status = RegpCopyTree(CurKey,
784  hKeyDest);
785 
786  if (SubKeyHandle != NULL)
787  {
789  }
790 
791 Cleanup:
792  ClosePredefKey(DestKeyHandle);
793 Cleanup2:
795 
796  if (!NT_SUCCESS(Status))
797  {
799  }
800 
801  return ERROR_SUCCESS;
802 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
Definition: ndis.h:4723
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static NTSTATUS RegpCopyTree(IN HKEY hKeySrc, IN HKEY hKeyDest)
Definition: reg.c:449
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ClosePredefKey(Handle)
Definition: reg.c:44
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by CopyKey(), RegCopyTreeA(), and ScmCopyControlSet().

◆ RegCreateKeyA()

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

Definition at line 1177 of file reg.c.

1180 {
1181  return RegCreateKeyExA(hKey,
1182  lpSubKey,
1183  0,
1184  NULL,
1185  0,
1187  NULL,
1188  phkResult,
1189  NULL);
1190 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
smooth NULL
Definition: ftsmooth.c:416
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:1029

Referenced by create_new_eventlog(), create_reg_entries(), create_test_entries(), CryptRegisterOIDFunction(), CryptRegisterOIDInfo(), 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_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 1029 of file reg.c.

1039 {
1040  UNICODE_STRING SubKeyString;
1041  UNICODE_STRING ClassString;
1042  DWORD ErrorCode;
1043 
1044  RtlInitEmptyUnicodeString(&ClassString, NULL, 0);
1045  RtlInitEmptyUnicodeString(&SubKeyString, NULL, 0);
1046 
1047  if (lpClass)
1048  {
1049  if (!RtlCreateUnicodeStringFromAsciiz(&ClassString, lpClass))
1050  {
1052  goto Exit;
1053  }
1054  }
1055 
1056  if (lpSubKey)
1057  {
1058  if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyString, lpSubKey))
1059  {
1061  goto Exit;
1062  }
1063  }
1064 
1066  hKey,
1067  SubKeyString.Buffer,
1068  Reserved,
1069  ClassString.Buffer,
1070  dwOptions,
1071  samDesired,
1072  lpSecurityAttributes,
1073  phkResult,
1074  lpdwDisposition);
1075 
1076 Exit:
1077  RtlFreeUnicodeString(&SubKeyString);
1078  RtlFreeUnicodeString(&ClassString);
1079 
1080  return ErrorCode;
1081 }
DWORD dwOptions
Definition: solitaire.cpp:23
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
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:1091
smooth NULL
Definition: ftsmooth.c:416
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
static void Exit(void)
Definition: sock.c:1331
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)

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(), 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(), test_appsearch(), test_basic_import_31(), test_classesroot(), test_classesroot_enum(), test_CoGetClassObject(), test_CoGetPSClsid(), test_delete_key_value(), test_envvar(), test_ExitCode(), test_import_31(), 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_remove_registry_values(), test_symlinks(), test_TreatAsClass(), test_write_registry_values(), 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 1091 of file reg.c.

1101 {
1102  UNICODE_STRING SubKeyString;
1103  UNICODE_STRING ClassString;
1105  HANDLE ParentKey;
1107  NTSTATUS Status;
1108 
1109  TRACE("RegCreateKeyExW() called\n");
1110 
1111  if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
1113 
1114  /* get the real parent key */
1115  Status = MapDefaultKey(&ParentKey,
1116  hKey);
1117  if (!NT_SUCCESS(Status))
1118  {
1119  return RtlNtStatusToDosError(Status);
1120  }
1121 
1122  TRACE("ParentKey %p\n", ParentKey);
1123 
1124  if (IsHKCRKey(ParentKey))
1125  {
1127  ParentKey,
1128  lpSubKey,
1129  Reserved,
1130  lpClass,
1131  dwOptions,
1132  samDesired,
1133  lpSecurityAttributes,
1134  phkResult,
1135  lpdwDisposition);
1136  ClosePredefKey(ParentKey);
1137  return ErrorCode;
1138  }
1139 
1142 
1143  RtlInitUnicodeString(&ClassString,
1144  lpClass);
1145  RtlInitUnicodeString(&SubKeyString,
1146  lpSubKey);
1148  &SubKeyString,
1149  Attributes,
1150  (HANDLE)ParentKey,
1151  lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
1152  Status = CreateNestedKey(phkResult,
1154  (lpClass == NULL)? NULL : &ClassString,
1155  dwOptions,
1156  samDesired,
1157  lpdwDisposition);
1158 
1159  ClosePredefKey(ParentKey);
1160 
1161  TRACE("Status %x\n", Status);
1162  if (!NT_SUCCESS(Status))
1163  {
1164  return RtlNtStatusToDosError(Status);
1165  }
1166 
1167  return ERROR_SUCCESS;
1168 }
DWORD dwOptions
Definition: solitaire.cpp:23
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_OPTION_OPEN_LINK
Definition: nt_native.h:1070
LONG NTSTATUS
Definition: precomp.h:26
#define OBJ_OPENLINK
Definition: winternl.h:230
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
static NTSTATUS CreateNestedKey(PHKEY KeyHandle, POBJECT_ATTRIBUTES ObjectAttributes, PUNICODE_STRING ClassString, DWORD dwOptions, REGSAM samDesired, DWORD *lpdwDisposition)
Definition: reg.c:915
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
Definition: reg.h:13
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ClosePredefKey(Handle)
Definition: reg.c:44
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:220

Referenced by _InitializeLocalSpooler(), _SHOpenProfilesKey(), add_userkey(), COpenWithList::AddAppToMRUList(), AddNewLayout(), ApplyRegistryValues(), BuildVolatileEnvironment(), CategoryMgr_RegisterCategory(), CM_Open_Class_Key_ExW(), CM_Open_DevNode_Key_Ex(), ComDBOpen(), ConCfgOpenUserSettings(), connections_on_notify(), ConSrvOpenUserSettings(), CopyKey(), CopySystemProfile(), create_key(), create_mru_list(), CreateAppPathRegKey(), CreateDeviceInstance(), CreateEventLog(), CreateHKCRKey(), CreateInstanceKey(), CreateNewKey(), CreateRegAppPath(), CreateUserProfileExW(), CredWriteW(), CriticalDeviceCoInstaller(), CRYPT_ImportSystemRootCertsToReg(), CRYPT_RegReadFromReg(), CRYPT_RegWriteToReg(), CRYPT_SysRegOpenStoreW(), CRYPT_WriteSerializedToReg(), DeleteJob(), 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(), ImmInstallIMEW(), INetCfgComponentControl_fnApplyRegistryChanges(), INetCfgLock_fnAcquireWriteLock(), InitLogs(), InitSettings(), InputProcessorProfiles_AddLanguageProfile(), InputProcessorProfiles_Register(), InputProcessorProfiles_SetDefaultLanguageProfile(), InstallDefaultSystemSoundScheme(), InstallEventSource(), InstallNetDevice(), InstallOneInterface(), InstallSystemSoundLabels(), InstallSystemSoundScheme(), InstallSystemSoundSchemeNames(), load_devices_from_reg(), LoadJobs(), LoadRecoveryOptions(), LoadSettings(), MAIN_LoadSettings(), MainWnd_OnOpenRegKey(), MMDevice_Create(), MRU_SaveChanged(), msi_publish_patches(), notif_thread_proc(), open_cred_mgr_key(), open_key(), OpenImageFileExecOptions(), openKeyW(), PNP_CreateKey(), PNP_GetClassInstance(), PNP_GetHwProfInfo(), PNP_SetClassRegProp(), ProcessSetupInf(), ProfilesEnumGuid_Constructor(), 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(), RegisterTypeLib(), registry_callback(), RegSetDWORDValue(), SampSetupAddMemberToAlias(), save_cert_mgr_usages(), save_registry_settings(), save_sys_colors(), SaveBoard(), SaveDataToRegistry(), SaveJob(), SaveSettings(), SaveShutdownSelState(), ScmCopyControlSet(), ScmCopyTree(), ScmCreateNewControlPipe(), ScmCreateServiceKey(), ScmWriteSecurityDescriptor(), set_profile_device_key(), set_proxy(), COpenWithList::SetDefaultHandler(), SetFindFlags(), SetPerUserSecValuesW(), SETUP_CreateClassKey(), SETUPDI_CreateDevKey(), SETUPDI_CreateDrvKey(), SetupDiCreateDeviceInterfaceRegKeyW(), SetupDiCreateDevRegKeyW(), SHCreateSessionKey(), SHELL_FS_HideExtension(), 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 1199 of file reg.c.

1202 {
1203  return RegCreateKeyExW(hKey,
1204  lpSubKey,
1205  0,
1206  NULL,
1207  0,
1209  NULL,
1210  phkResult,
1211  NULL);
1212 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
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:1091
smooth NULL
Definition: ftsmooth.c:416

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(), InputList_PrepareUserRegistry(), ITERATE_RegisterFonts(), ITERATE_UnregisterFonts(), KmtFltAddAltitude(), MSACM_ReadCache(), MSACM_WriteCache(), MSACM_WriteCurrentPriorities(), msi_publish_sourcelist(), NdrDllRegisterProxy(), open_assemblies_key(), open_global_assembly_key(), open_local_assembly_key(), OpenMediaSubkey(), OpenNetworkSubkey(), openSharedDLLsKey(), OpenSourceKey(), OpenURLSubkey(), reg_add(), register_appid(), register_codepages(), register_progid(), register_verb(), registry_callback(), RegSetKeyValueW(), RegSetValueW(), SaveSettings(), SetupRegisterAllClasses(), SetupRegisterClass(), SHCopyKeyW(), 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 1222 of file reg.c.

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

Referenced by action_RegDeleteTreeA(), cleanup_eventlog(), CryptUnregisterOIDFunction(), CryptUnregisterOIDInfo(), delete_container_key(), delete_key(), delete_key_(), delete_key_portable(), delete_tree(), init_key(), mru_RegDeleteTreeA(), myRegDeleteTreeA(), ok_registry(), reg_unreg_wine_test_class(), setperusersecvalues_test(), SHAddToRecentDocs(), SHDeleteEmptyKeyA(), SHDeleteOrphanKeyA(), test_add(), test_appsearch(), test_appsearch_reglocator(), test_basic_import(), test_basic_import_31(), test_basic_import_unicode(), test_classesroot(), test_comments(), test_comments_unicode(), test_debug_heap(), test_delete(), test_delete_key_value(), test_directshow_filter(), test_enum_value(), test_ExitCode(), test_export(), test_import(), test_import_31(), test_import_with_whitespace(), test_import_with_whitespace_unicode(), test_install_from(), test_Installer_InstallProduct(), test_internet_features(), test_internet_features_registry(), test_invalid_import(), test_invalid_import_unicode(), test_key_creation_and_deletion(), test_key_creation_and_deletion_unicode(), 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_query(), 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_progid_info(), test_registerOIDFunction(), test_registry(), test_RegNotifyChangeKeyValue(), test_rw_order(), test_string_termination(), test_symlinks(), test_TreatAsClass(), test_unicode_import(), test_unicode_import_with_whitespace(), test_value_deletion(), test_value_deletion_unicode(), 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 1252 of file reg.c.

1257 {
1258  LONG ErrorCode;
1260 
1261  if (lpSubKey)
1262  {
1264  return ERROR_NOT_ENOUGH_MEMORY;
1265  }
1266  else
1267  RtlInitEmptyUnicodeString(&SubKeyName, NULL, 0);
1268 
1269  ErrorCode = RegDeleteKeyExW(hKey, SubKeyName.Buffer, samDesired, Reserved);
1270 
1272 
1273  return ErrorCode;
1274 }
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1284
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)

Referenced by init_functionpointers(), InitFunctionPtrs(), and RegDeleteKeyA().

◆ RegDeleteKeyExW()

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

Definition at line 1284 of file reg.c.

1289 {
1292  HANDLE ParentKey;
1293  HANDLE TargetKey;
1294  NTSTATUS Status;
1295 
1296  /* Make sure we got a subkey */
1297  if (!lpSubKey)
1298  {
1299  /* Fail */
1300  return ERROR_INVALID_PARAMETER;
1301  }
1302 
1303  Status = MapDefaultKey(&ParentKey,
1304  hKey);
1305  if (!NT_SUCCESS(Status))
1306  {
1307  return RtlNtStatusToDosError(Status);
1308  }
1309 
1310  if (IsHKCRKey(ParentKey))
1311  {
1312  LONG ErrorCode = DeleteHKCRKey(ParentKey, lpSubKey, samDesired, Reserved);
1313  ClosePredefKey(ParentKey);
1314  return ErrorCode;
1315  }
1316 
1317  if (samDesired & KEY_WOW64_32KEY)
1318  ERR("Wow64 not yet supported!\n");
1319 
1320  if (samDesired & KEY_WOW64_64KEY)
1321  ERR("Wow64 not yet supported!\n");
1322 
1323 
1324  RtlInitUnicodeString(&SubKeyName, lpSubKey);
1326  &SubKeyName,
1328  ParentKey,
1329  NULL);
1330  Status = NtOpenKey(&TargetKey,
1331  DELETE,
1332  &ObjectAttributes);
1333  if (!NT_SUCCESS(Status))
1334  {
1335  goto Cleanup;
1336  }
1337 
1338  Status = NtDeleteKey(TargetKey);
1339  NtClose(TargetKey);
1340 
1341 Cleanup:
1342  ClosePredefKey(ParentKey);
1343 
1344  if (!NT_SUCCESS(Status))
1345  {
1346  return RtlNtStatusToDosError(Status);
1347  }
1348 
1349  return ERROR_SUCCESS;
1350 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
LONG NTSTATUS
Definition: precomp.h:26
LONG WINAPI DeleteHKCRKey(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM RegSam, _In_ DWORD Reserved)
Definition: hkcr.c:395
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
Definition: reg.h:13
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtDeleteKey(IN HANDLE KeyHandle)
Definition: ntapi.c:408
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERR(fmt,...)
Definition: debug.h:109
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define ClosePredefKey(Handle)
Definition: reg.c:44
#define DELETE
Definition: nt_native.h:57

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

◆ RegDeleteKeyValueA()

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

Definition at line 1428 of file reg.c.

1431 {
1432  UNICODE_STRING SubKey = { 0, 0, NULL }, ValueName = { 0, 0, NULL };
1433  LONG Ret;
1434 
1435  if (lpSubKey != NULL &&
1436  !RtlCreateUnicodeStringFromAsciiz(&SubKey, lpSubKey))
1437  {
1438  return ERROR_NOT_ENOUGH_MEMORY;
1439  }
1440 
1441  if (lpValueName != NULL &&
1443  {
1444  RtlFreeUnicodeString(&SubKey);
1445  return ERROR_NOT_ENOUGH_MEMORY;
1446  }
1447 
1448  Ret = RegDeleteKeyValueW(hKey,
1449  SubKey.Buffer,
1450  SubKey.Buffer);
1451 
1452  RtlFreeUnicodeString(&SubKey);
1454 
1455  return Ret;
1456 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
LONG WINAPI RegDeleteKeyValueW(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL, IN LPCWSTR lpValueName OPTIONAL)
Definition: reg.c:1359

Referenced by InitFunctionPtrs().

◆ RegDeleteKeyValueW()

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

Definition at line 1359 of file reg.c.

1362 {
1364  HANDLE KeyHandle, CurKey, SubKeyHandle = NULL;
1365  NTSTATUS Status;
1366 
1368  hKey);
1369  if (!NT_SUCCESS(Status))
1370  {
1371  return RtlNtStatusToDosError(Status);
1372  }
1373 
1374  if (lpSubKey != NULL)
1375  {
1378 
1379  RtlInitUnicodeString(&SubKeyName, lpSubKey);
1380 
1382  &SubKeyName,
1384  KeyHandle,
1385  NULL);
1386 
1388  KEY_SET_VALUE,
1389  &ObjectAttributes);
1390  if (!NT_SUCCESS(Status))
1391  {
1392  goto Cleanup;
1393  }
1394 
1395  CurKey = SubKeyHandle;
1396  }
1397  else
1398  CurKey = KeyHandle;
1399 
1400  RtlInitUnicodeString(&ValueName, lpValueName);
1401 
1402  Status = NtDeleteValueKey(CurKey,
1403  &ValueName);
1404 
1405  if (SubKeyHandle != NULL)
1406  {
1408  }
1409 
1410 Cleanup:
1412 
1413  if (!NT_SUCCESS(Status))
1414  {
1415  return RtlNtStatusToDosError(Status);
1416  }
1417 
1418  return ERROR_SUCCESS;
1419 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:994
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
Definition: ndis.h:4723
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ClosePredefKey(Handle)
Definition: reg.c:44

Referenced by RegDeleteKeyValueA().

◆ RegDeleteKeyW()

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

Definition at line 1237 of file reg.c.

1240 {
1241  return RegDeleteKeyExW(hKey, lpSubKey, 0, 0);
1242 }
LONG WINAPI RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1284

Referenced by ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterMIMEInfo(), AtlRegisterClassCategoriesHelper(), ATL::AtlRegisterClassCategoriesHelper(), COMCAT_ICatRegister_UnRegisterCategories(), COMCAT_UnRegisterClassCategories(), CoTreatAsClass(), CredDeleteW(), CRYPT_RegWriteToReg(), CRYPT_SIPDeleteFunction(), delete_key(), delete_local_assembly_key(), delete_test_key(), DeleteAppPathRegKey(), DeleteRegAppPath(), DeleteSubKey(), devinst_RegDeleteTreeW(), DllUnregisterServer(), DMOUnregister(), do_process_key(), ATL::CRegObject::do_process_key(), do_reg_operation(), FilterMapper3_UnregisterFilter(), FilterMapper_UnregisterFilter(), InputList_PrepareUserRegistry(), ITERATE_UnpublishComponent(), MSACM_WriteCurrentPriorities(), myRegDeleteTreeW(), package_RegDeleteTreeW(), PNP_DeleteClassKey(), PNP_GetClassInstance(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RemoveEventLog(), CMainWindow::RemoveSelectedAppFromRegistry(), ScmDeleteRegKey(), ScmDeleteTree(), ServicesPageWndProc(), SETUP_CreateClassKey(), SHDeleteEmptyKeyW(), SHDeleteKeyW(), SHDeleteOrphanKeyW(), 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 1840 of file reg.c.

1842 {
1843  UNICODE_STRING SubKeyName = { 0, 0, NULL };
1844  LONG Ret;
1845 
1846  if (lpSubKey != NULL &&
1848  {
1849  return ERROR_NOT_ENOUGH_MEMORY;
1850  }
1851 
1852  Ret = RegDeleteTreeW(hKey,
1853  SubKeyName.Buffer);
1854 
1856 
1857  return Ret;
1858 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1746

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

◆ RegDeleteTreeW()

LSTATUS WINAPI RegDeleteTreeW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)

Definition at line 1746 of file reg.c.

1748 {
1749  LONG ret;
1750  DWORD dwMaxSubkeyLen, dwMaxValueLen;
1751  DWORD dwMaxLen, dwSize;
1752  NTSTATUS Status;
1753  HANDLE KeyHandle;
1754  HKEY hSubKey;
1755  WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1756 
1757  TRACE("(hkey=%p,%p %s)\n", hKey, lpszSubKey, debugstr_w(lpszSubKey));
1758 
1760  hKey);
1761  if (!NT_SUCCESS(Status))
1762  {
1763  return RtlNtStatusToDosError(Status);
1764  }
1765 
1766  hSubKey = KeyHandle;
1767 
1768  if(lpszSubKey)
1769  {
1770  ret = RegOpenKeyExW(KeyHandle, lpszSubKey, 0, KEY_READ, &hSubKey);
1771  if (ret)
1772  {
1774  return ret;
1775  }
1776  }
1777 
1778  /* Get highest length for keys, values */
1779  ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
1780  &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1781  if (ret) goto cleanup;
1782 
1783  dwMaxSubkeyLen++;
1784  dwMaxValueLen++;
1785  dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1786  if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
1787  {
1788  /* Name too big: alloc a buffer for it */
1789  if (!(lpszName = RtlAllocateHeap( RtlGetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
1790  {
1792  goto cleanup;
1793  }
1794  }
1795 
1796 
1797  /* Recursively delete all the subkeys */
1798  while (TRUE)
1799  {
1800  dwSize = dwMaxLen;
1801  if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
1802  NULL, NULL, NULL)) break;
1803 
1804  ret = RegDeleteTreeW(hSubKey, lpszName);
1805  if (ret) goto cleanup;
1806  }
1807 
1808  if (lpszSubKey)
1809  ret = RegDeleteKeyW(KeyHandle, lpszSubKey);
1810  else
1811  while (TRUE)
1812  {
1813  dwSize = dwMaxLen;
1814  if (RegEnumValueW(KeyHandle, 0, lpszName, &dwSize,
1815  NULL, NULL, NULL, NULL)) break;
1816 
1817  ret = RegDeleteValueW(KeyHandle, lpszName);
1818  if (ret) goto cleanup;
1819  }
1820 
1821 cleanup:
1822  /* Free buffer if allocated */
1823  if (lpszName != szNameBuf)
1824  RtlFreeHeap( RtlGetProcessHeap(), 0, lpszName);
1825  if(lpszSubKey)
1826  RegCloseKey(hSubKey);
1827 
1829 
1830  return ret;
1831 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
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:2853
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
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:3686
int ret
Status
Definition: gdiplustypes.h:24
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1746
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ClosePredefKey(Handle)
Definition: reg.c:44
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:2527
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterProgIdInfo(), CategoryMgr_UnregisterCategory(), CRYPT_RegOpenStore(), delete_key_state(), delete_tree(), DEVENUM_ICreateDevEnum_CreateClassEnumerator(), do_process_key(), FilterMapper_UnregisterFilter(), FilterMapper_UnregisterPin(), InputProcessorProfiles_Unregister(), MSIREG_DeleteClassesUpgradeCodesKey(), MSIREG_DeleteLocalClassesFeaturesKey(), MSIREG_DeleteLocalClassesProductKey(), MSIREG_DeleteProductKey(), MSIREG_DeleteUninstallKey(), MSIREG_DeleteUpgradeCodesKey(), MSIREG_DeleteUserDataComponentKey(), MSIREG_DeleteUserDataPatchKey(), MSIREG_DeleteUserDataProductKey(), MSIREG_DeleteUserFeaturesKey(), MSIREG_DeleteUserProductKey(), MSIREG_DeleteUserUpgradeCodesKey(), NdrDllUnregisterProxy(), reg_delete(), RegDeleteTreeA(), ScmDeleteControlSet(), SetupRegisterAllClasses(), unreg_context_menu_handler(), unreg_icon_overlay(), unreg_prop_sheet_handler(), unregister_categories(), unregister_clsid(), unregister_coclasses(), unregister_converters(), unregister_decoders(), unregister_encoders(), unregister_interfaces(), unregister_mediatypes_parsing(), unregister_metadatareaders(), and unregister_pixelformats().

◆ RegDeleteValueA()

LONG WINAPI RegDeleteValueA ( HKEY  hKey,
LPCSTR  lpValueName 
)

Definition at line 2319 of file reg.c.

2321 {
2323  HANDLE KeyHandle;
2324  NTSTATUS Status;
2325 
2327  hKey);
2328  if (!NT_SUCCESS(Status))
2329  {
2330  return RtlNtStatusToDosError(Status);
2331  }
2332 
2335  &ValueName);
2337 
2339 
2340  if (!NT_SUCCESS(Status))
2341  {
2342  return RtlNtStatusToDosError(Status);
2343  }
2344 
2345  return ERROR_SUCCESS;
2346 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:994
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ClosePredefKey(Handle)
Definition: reg.c:44

Referenced by action_RegDeleteTreeA(), cleanup_eventlog(), delete_value_(), DeleteRegistryValue(), 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_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_remove_env_strings(), test_symlinks(), test_write_registry_values(), test_XcvDataPort_ConfigureLPTPortCommandOK(), test_XcvDataPort_GetTransmissionRetryTimeout(), WhichPlatform(), and WNetRemoveCachedPassword().

◆ RegDeleteValueW()

LONG WINAPI RegDeleteValueW ( HKEY  hKey,
LPCWSTR  lpValueName 
)

Definition at line 2355 of file reg.c.

2357 {
2359  NTSTATUS Status;
2360  HANDLE KeyHandle;
2361 
2363  hKey);
2364  if (!NT_SUCCESS(Status))
2365  {
2366  return RtlNtStatusToDosError(Status);
2367  }
2368 
2369  RtlInitUnicodeString(&ValueName, lpValueName);
2370 
2372  &ValueName);
2373 
2375 
2376  if (!NT_SUCCESS(Status))
2377  {
2378  return RtlNtStatusToDosError(Status);
2379  }
2380 
2381  return ERROR_SUCCESS;
2382 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:994
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ClosePredefKey(Handle)
Definition: reg.c:44

Referenced by _CmdWndProc(), ACTION_MsiUnpublishAssemblies(), ACTION_ProcessComponents(), ACTION_WriteSharedDLLsCount(), 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(), MainWnd_OnUpdateRegistry(), ModifyStatus(), msi_unpublish_feature(), myRegDeleteTreeW(), package_RegDeleteTreeW(), pendingRename(), PNP_SetClassRegProp(), PNP_SetDeviceRegProp(), ProcessRunKeys(), RChangeServiceConfig2W(), reg_delete(), RegDeleteTreeW(), remove_product_upgrade_code(), SaveSetting(), ScmDeleteTree(), ScmSetFailureActions(), ScmWriteDependencies(), set_domain(), set_name_servers(), set_profile_device_key(), set_proxy(), SetAutoDaylightInfo(), setValue(), SHDeleteValueW(), SKDeleteValueW(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), stillimagew_UnregisterLaunchApplication(), test_save(), UXTHEME_ApplyTheme(), and WriteParameterArray().

◆ RegDisablePredefinedCache()

LONG WINAPI RegDisablePredefinedCache ( VOID  )

Definition at line 332 of file reg.c.

333 {
334  RegInitialize(); /* HACK until delay-loading is implemented */
338  return ERROR_SUCCESS;
339 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
static BOOLEAN DefaultHandleHKUDisabled
Definition: reg.c:37
BOOL RegInitialize(VOID)
Definition: reg.c:70

◆ RegDisablePredefinedCacheEx()

LONG WINAPI RegDisablePredefinedCacheEx ( VOID  )

Definition at line 348 of file reg.c.

349 {
350  RegInitialize(); /* HACK until delay-loading is implemented */
355  return ERROR_SUCCESS;
356 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
static BOOLEAN DefaultHandlesDisabled
Definition: reg.c:36
static BOOLEAN DefaultHandleHKUDisabled
Definition: reg.c:37
BOOL RegInitialize(VOID)
Definition: reg.c:70

◆ RegDisableReflectionKey()

LONG WINAPI RegDisableReflectionKey ( IN HKEY  hBase)

Definition at line 1867 of file reg.c.

1868 {
1869  FIXME("RegDisableReflectionKey(0x%p) UNIMPLEMENTED!\n", hBase);
1871 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ RegEnableReflectionKey()

LONG WINAPI RegEnableReflectionKey ( IN HKEY  hBase)

Definition at line 1880 of file reg.c.

1881 {
1882  FIXME("RegEnableReflectionKey(0x%p) UNIMPLEMENTED!\n", hBase);
1884 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ RegEnumKeyA()

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

Definition at line 2391 of file reg.c.

2395 {
2396  DWORD dwLength;
2397 
2398  dwLength = cbName;
2399  return RegEnumKeyExA(hKey,
2400  dwIndex,
2401  lpName,
2402  &dwLength,
2403  NULL,
2404  NULL,
2405  NULL,
2406  NULL);
2407 }
_In_ LPCSTR lpName
Definition: winbase.h:2736
smooth NULL
Definition: ftsmooth.c:416
static DWORD DWORD * dwLength
Definition: fusion.c:83
unsigned long DWORD
Definition: ntddk_ex.h:95
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:2442

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 2442 of file reg.c.

2451 {
2452  WCHAR* NameBuffer = NULL;
2453  WCHAR* ClassBuffer = NULL;
2454  DWORD NameLength, ClassLength;
2455  LONG ErrorCode;
2456 
2457  /* Allocate our buffers */
2458  if (*lpcbName > 0)
2459  {
2460  NameLength = *lpcbName;
2461  NameBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbName * sizeof(WCHAR));
2462  if (NameBuffer == NULL)
2463  {
2465  goto Exit;
2466  }
2467  }
2468 
2469  if (lpClass)
2470  {
2471  if (*lpcbClass > 0)
2472  {
2473  ClassLength = *lpcbClass;
2474  ClassBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbClass * sizeof(WCHAR));
2475  if (ClassBuffer == NULL)
2476  {
2478  goto Exit;
2479  }
2480  }
2481  }
2482 
2483  /* Do the actual call */
2485  hKey,
2486  dwIndex,
2487  NameBuffer,
2488  lpcbName,
2489  lpReserved,
2490  ClassBuffer,
2491  lpcbClass,
2492  lpftLastWriteTime);
2493 
2494  if (ErrorCode != ERROR_SUCCESS)
2495  goto Exit;
2496 
2497  /* Convert the strings */
2498  RtlUnicodeToMultiByteN(lpName, *lpcbName, 0, NameBuffer, *lpcbName * sizeof(WCHAR));
2499  /* NULL terminate if we can */
2500  if (NameLength > *lpcbName)
2501  lpName[*lpcbName] = '\0';
2502 
2503  if (lpClass)
2504  {
2505  RtlUnicodeToMultiByteN(lpClass, *lpcbClass, 0, NameBuffer, *lpcbClass * sizeof(WCHAR));
2506  if (ClassLength > *lpcbClass)
2507  lpClass[*lpcbClass] = '\0';
2508  }
2509 
2510 Exit:
2511  if (NameBuffer)
2512  RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
2513  if (ClassBuffer)
2514  RtlFreeHeap(RtlGetProcessHeap(), 0, ClassBuffer);
2515 
2516  return ErrorCode;
2517 }
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_In_ LPCSTR lpName
Definition: winbase.h:2736
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void Exit(void)
Definition: sock.c:1331
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToMultiByteN(PCHAR MbString, ULONG MbSize, PULONG ResultSize, PCWCH UnicodeString, ULONG UnicodeSize)
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:2527

Referenced by action_RegDeleteTreeA(), 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 2527 of file reg.c.

2536 {
2537  union
2538  {
2540  KEY_BASIC_INFORMATION Basic;
2541  } *KeyInfo;
2542 
2543  ULONG BufferSize;
2544  ULONG ResultSize;
2545  ULONG NameLength;
2546  ULONG ClassLength = 0;
2547  HANDLE KeyHandle;
2549  NTSTATUS Status;
2550 
2552  hKey);
2553  if (!NT_SUCCESS(Status))
2554  {
2555  return RtlNtStatusToDosError(Status);
2556  }
2557 
2558  if (IsHKCRKey(KeyHandle))
2559  {
2561  KeyHandle,
2562  dwIndex,
2563  lpName,
2564  lpcbName,
2565  lpReserved,
2566  lpClass,
2567  lpcbClass,
2568  lpftLastWriteTime);
2570  return ErrorCode;
2571  }
2572 
2573  if (*lpcbName > 0)
2574  {
2575  NameLength = min (*lpcbName - 1, REG_MAX_NAME_SIZE) * sizeof (WCHAR);
2576  }
2577  else
2578  {
2579  NameLength = 0;
2580  }
2581 
2582  if (lpClass)
2583  {
2584  if (*lpcbClass > 0)
2585  {
2586  ClassLength = min (*lpcbClass - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR);
2587  }
2588  else
2589  {
2590  ClassLength = 0;
2591  }
2592 
2593  BufferSize = ((sizeof(KEY_NODE_INFORMATION) + NameLength + 3) & ~3) + ClassLength;
2594  }
2595  else
2596  {
2597  BufferSize = sizeof(KEY_BASIC_INFORMATION) + NameLength;
2598  }
2599 
2600  KeyInfo = RtlAllocateHeap(ProcessHeap,
2601  0,
2602  BufferSize);
2603  if (KeyInfo == NULL)
2604  {
2606  goto Cleanup;
2607  }
2608 
2610  (ULONG)dwIndex,
2612  KeyInfo,
2613  BufferSize,
2614  &ResultSize);
2615  TRACE("NtEnumerateKey() returned status 0x%X\n", Status);
2616  if (!NT_SUCCESS(Status))
2617  {
2619  }
2620  else
2621  {
2622  if (lpClass == NULL)
2623  {
2624  if (KeyInfo->Basic.NameLength > NameLength)
2625  {
2627  }
2628  else
2629  {
2631  KeyInfo->Basic.Name,
2632  KeyInfo->Basic.NameLength);
2633  *lpcbName = (DWORD)(KeyInfo->Basic.NameLength / sizeof(WCHAR));
2634  lpName[*lpcbName] = 0;
2635  }
2636  }
2637  else
2638  {
2639  if (KeyInfo->Node.NameLength > NameLength ||
2640  KeyInfo->Node.ClassLength > ClassLength)
2641  {
2643  }
2644  else
2645  {
2647  KeyInfo->Node.Name,
2648  KeyInfo->Node.NameLength);
2649  *lpcbName = KeyInfo->Node.NameLength / sizeof(WCHAR);
2650  lpName[*lpcbName] = 0;
2651  RtlCopyMemory(lpClass,
2652  (PVOID)((ULONG_PTR)KeyInfo->Node.Name + KeyInfo->Node.ClassOffset),
2653  KeyInfo->Node.ClassLength);
2654  *lpcbClass = (DWORD)(KeyInfo->Node.ClassLength / sizeof(WCHAR));
2655  lpClass[*lpcbClass] = 0;
2656  }
2657  }
2658 
2659  if (ErrorCode == ERROR_SUCCESS && lpftLastWriteTime != NULL)
2660  {
2661  if (lpClass == NULL)
2662  {
2663  lpftLastWriteTime->dwLowDateTime = KeyInfo->Basic.LastWriteTime.u.LowPart;
2664  lpftLastWriteTime->dwHighDateTime = KeyInfo->Basic.LastWriteTime.u.HighPart;
2665  }
2666  else
2667  {
2668  lpftLastWriteTime->dwLowDateTime = KeyInfo->Node.LastWriteTime.u.LowPart;
2669  lpftLastWriteTime->dwHighDateTime = KeyInfo->Node.LastWriteTime.u.HighPart;
2670  }
2671  }
2672  }
2673 
2675  0,
2676  KeyInfo);
2677 
2678 Cleanup:
2680 
2681  return ErrorCode;
2682 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
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:592
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
_In_ LPCSTR lpName
Definition: winbase.h:2736
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
uint32_t ULONG_PTR
Definition: typedefs.h:63
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
static HANDLE ProcessHeap
Definition: reg.c:35
long LONG
Definition: pedump.c:60
union node Node
Definition: types.h:1255
smooth NULL
Definition: ftsmooth.c:416
#define REG_MAX_NAME_SIZE
Definition: reg.c:28
struct _KEY_NODE_INFORMATION KEY_NODE_INFORMATION
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
Definition: reg.h:13
#define BufferSize
Definition: classpnp.h:419
static const WCHAR Cleanup[]
Definition: register.c:80
#define ERROR_MORE_DATA
Definition: dderror.h:13
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
#define ClosePredefKey(Handle)
Definition: reg.c:44
static ULONG ULONG *static const UNICODE_STRING void DWORD
Definition: reg.c:135
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by _enumeratorRememberedW(), _InitializePrintProviderList(), CDefaultContextMenu::AddStaticEntriesForKey(), AddUserProfiles(), AllSysInfo(), build_zonemap_from_reg(), BuildLogListAndFilterList(), BuildParameterArray(), capGetDriverDescriptionW(), CategoryMgr_FindClosestCategory(), CATIDEnumGUID_Next(), CertEnumSystemStore(), CheckLogOrSourceExistence(), CLSIDEnumGUID_Next(), COMCAT_IEnumCATEGORYINFO_Next(), COMCAT_IsClassOfCategories(), ComponentInfo_GetGuidList(), CopyKey(), CreateComponentEnumerator(), CreateKeyboardLayoutList(), CreateTimeZoneList(), CRYPT_RegReadSerializedFromReg(), CryptEnumProvidersW(), CryptSIPRetrieveSubjectGuid(), delete_test_key(), DEVENUM_ReadPins(), DEVENUM_ReadPinTypes(), devinst_RegDeleteTreeW(), DirectPlayEnumerateAW(), DMOUnregister(), EnumClientServiceProtocol(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), EnumHKCRKey(), EnumInstalledApplications(), EnumInterfaces(), EnumPwrSchemes(), EnumTfLanguageProfiles_Next(), export_hkey(), export_registry_data(), fetch_machine_component(), fetch_machine_product(), fetch_user_component(), fetch_user_product(), FileTypesDlg_DoList(), GetAllInstanceList(), GetAllInstanceListSize(), GetClassMediaFile(), CQueryAssociations::GetCommand(), GetDeviceInstanceList(), GetEnumeratorInstanceList(), GetEnumeratorInstanceListSize(), GetNthChildKeyName(), GetProfiles(), IEnumDMO_fnNext(), InitializePrinterList(), InitializePrintMonitorList(), InitializePrintProcessorList(), InitIconOverlays(), InitNotifications(), Int_EnumDependentServicesW(), LayoutList_Create(), load_devices_from_reg(), COpenWithList::LoadAppList(), 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(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RegEnumKeyExA(), RegEnumKeyW(), RegFindRecurse(), RegFindWalk(), register_legacy_filters(), RegQueryRegistryKeys(), RemoveEventLog(), ScmCopyTree(), ScmCreateServiceDatabase(), ScmDeleteRegKey(), ScmDeleteTree(), search_domain_for_zone(), search_for_domain_mapping(), SETUP_CreateDevicesList(), SETUP_CreateDevicesListFromEnumerator(), SETUP_CreateInterfaceList(), SetupDiBuildClassInfoListExW(), SetupDiClassGuidsFromNameExW(), SetupDiOpenDeviceInterfaceW(), SHCopyKeyW(), SHCreatePropSheetExtArrayEx(), SHDeleteKeyW(), SHEnumKeyExW(), SHRegEnumUSKeyW(), START_TEST(), and UnRegisterTypeLib().

◆ RegEnumKeyW()

LONG WINAPI RegEnumKeyW ( HKEY  hKey,
DWORD  dwIndex,
LPWSTR  lpName,
DWORD  cbName 
)

Definition at line 2416 of file reg.c.

2420 {
2421  DWORD dwLength;
2422 
2423  dwLength = cbName;
2424  return RegEnumKeyExW(hKey,
2425  dwIndex,
2426  lpName,
2427  &dwLength,
2428  NULL,
2429  NULL,
2430  NULL,
2431  NULL);
2432 }
_In_ LPCSTR lpName
Definition: winbase.h:2736
smooth NULL
Definition: ftsmooth.c:416
static DWORD DWORD * dwLength
Definition: fusion.c:83
unsigned long DWORD
Definition: ntddk_ex.h:95
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:2527

Referenced by CRegFolderEnum::AddItemsFromKey(), AVIBuildFilterW(), CNewMenu::CacheItems(), CryptEnumProvidersW(), CryptEnumProviderTypesW(), delete_key(), DEVENUM_IEnumMoniker_Next(), DEVENUM_IEnumMoniker_Skip(), DirectPlayEnumerateAW(), DisplayStatus(), EditTypeDlg_ReadClass(), EditTypeDlg_WriteClass(), enum_key(), EnumOLEVERB_Next(), HCR_GetDefaultVerbW(), InstallerImpl_RegistryValue(), lineGetCountryW(), LoadClassicColorSchemes(), LoadSchemeSizes(), MIDIMAP_LoadSettingsScheme(), registry_enumerate_credentials(), ShellExecute_FromContextMenu(), UIINSERTOBJECTDLG_PopulateObjectTypes(), ViewTree_LoadAll(), and ViewTree_LoadTree().

◆ 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 2691 of file reg.c.

2700 {
2701  WCHAR* NameBuffer;
2702  DWORD NameBufferSize, NameLength;
2703  LONG ErrorCode;
2704  DWORD LocalType = REG_NONE;
2705  BOOL NameOverflow = FALSE;
2706 
2707  /* Do parameter checks now, once and for all. */
2708  if (!lpName || !lpcbName)
2709  return ERROR_INVALID_PARAMETER;
2710 
2711  if ((lpData && !lpcbData) || lpdwReserved)
2712  return ERROR_INVALID_PARAMETER;
2713 
2714  /* Get the size of the buffer we must use for the first call to RegEnumValueW */
2716  hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &NameBufferSize, NULL, NULL, NULL);
2717  if (ErrorCode != ERROR_SUCCESS)
2718  return ErrorCode;
2719 
2720  /* Add space for the null terminator */
2721  NameBufferSize++;
2722 
2723  /* Allocate the buffer for the unicode name */
2724  NameBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, NameBufferSize * sizeof(WCHAR));
2725  if (NameBuffer == NULL)
2726  {
2727  return ERROR_NOT_ENOUGH_MEMORY;
2728  }
2729 
2730  /*
2731  * This code calls RegEnumValueW twice, because we need to know the type of the enumerated value.
2732  * So for the first call, we check if we overflow on the name, as we have no way of knowing if this
2733  * is an overflow on the data or on the name during the the second call. So the first time, we make the
2734  * call with the supplied value. This is merdique, but this is how it is.
2735  */
2736  NameLength = *lpcbName;
2738  hKey,
2739  dwIndex,
2740  NameBuffer,
2741  &NameLength,
2742  NULL,
2743  &LocalType,
2744  NULL,
2745  NULL);
2746  if (ErrorCode != ERROR_SUCCESS)
2747  {
2748  if (ErrorCode == ERROR_MORE_DATA)
2749  NameOverflow = TRUE;
2750  else
2751  goto Exit;
2752  }
2753 
2754  if (is_string(LocalType) && lpcbData)
2755  {
2756  /* We must allocate a buffer to get the unicode data */
2757  DWORD DataBufferSize = *lpcbData * sizeof(WCHAR);
2758  WCHAR* DataBuffer = NULL;
2759  DWORD DataLength = *lpcbData;
2760  LPSTR DataStr = (LPSTR)lpData;
2761 
2762  if (lpData)
2763  DataBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbData * sizeof(WCHAR));
2764 
2765  /* Do the real call */
2767  hKey,
2768  dwIndex,
2769  NameBuffer,
2770  &NameBufferSize,
2771  lpdwReserved,
2772  lpdwType,
2773  (LPBYTE)DataBuffer,
2774  &DataBufferSize);
2775 
2776  *lpcbData = DataBufferSize / sizeof(WCHAR);
2777 
2778  if (ErrorCode != ERROR_SUCCESS)
2779  {
2780  RtlFreeHeap(RtlGetProcessHeap(), 0, DataBuffer);
2781  goto Exit;
2782  }
2783 
2784  /* Copy the data whatever the error code is */
2785  if (lpData)
2786  {
2787  /* Do the data conversion */
2788  RtlUnicodeToMultiByteN(DataStr, DataLength, 0, DataBuffer, DataBufferSize);
2789  /* NULL-terminate if there is enough room */
2790  if ((DataLength > *lpcbData) && (DataStr[*lpcbData - 1] != '\0'))
2791  DataStr[*lpcbData] = '\0';
2792  }
2793 
2794  RtlFreeHeap(RtlGetProcessHeap(), 0, DataBuffer);
2795  }
2796  else
2797  {
2798  /* No data conversion needed. Do the call with provided buffers */
2800  hKey,
2801  dwIndex,
2802  NameBuffer,
2803  &NameBufferSize,
2804  lpdwReserved,
2805  lpdwType,
2806  lpData,
2807  lpcbData);
2808 
2809  if (ErrorCode != ERROR_SUCCESS)
2810  {
2811  goto Exit;
2812  }
2813  }
2814 
2815  if (NameOverflow)
2816  {
2818  goto Exit;
2819  }
2820 
2821  /* Convert the name string */
2822  RtlUnicodeToMultiByteN(lpName, *lpcbName, lpcbName, NameBuffer, NameBufferSize * sizeof(WCHAR));
2823  lpName[*lpcbName] = ANSI_NULL;
2824 
2825 Exit:
2826  if (NameBuffer)
2827  RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
2828 
2829  return ErrorCode;
2830 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_In_ LPCSTR lpName
Definition: winbase.h:2736
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
char * LPSTR
Definition: xmlstorage.h:182
unsigned char * LPBYTE
Definition: typedefs.h:52
#define ANSI_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
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:2853
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void Exit(void)
Definition: sock.c:1331
unsigned long DWORD
Definition: ntddk_ex.h:95
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:3686
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToMultiByteN(PCHAR MbString, ULONG MbSize, PULONG ResultSize, PCWCH UnicodeString, ULONG UnicodeSize)
#define ERROR_MORE_DATA
Definition: dderror.h:13
static __inline int is_string(DWORD type)
Definition: reg.c:61
#define REG_NONE
Definition: nt_native.h:1492
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333

Referenced by action_RegDeleteTreeA(), enum_drivers(), 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 2853 of file reg.c.

2862 {
2863  HANDLE KeyHandle;
2864  NTSTATUS status;
2865  ULONG total_size;
2866  char buffer[256], *buf_ptr = buffer;
2868  static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name );
2869 
2870  TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n",
2871  hKey, index, value, val_count, reserved, type, data, count );
2872 
2873  if (!value || !val_count)
2874  return ERROR_INVALID_PARAMETER;
2875 
2876  if ((data && !count) || reserved)
2877  return ERROR_INVALID_PARAMETER;
2878 
2879  status = MapDefaultKey(&KeyHandle, hKey);
2880  if (!NT_SUCCESS(status))
2881  {
2882  return RtlNtStatusToDosError(status);
2883  }
2884 
2885  if (IsHKCRKey(KeyHandle))
2886  {
2888  KeyHandle,
2889  index,
2890  value,
2891  val_count,
2892  reserved,
2893  type,
2894  data,
2895  count);
2897  return ErrorCode;
2898  }
2899 
2900  total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR);
2901  if (data) total_size += *count;
2902  total_size = min( sizeof(buffer), total_size );
2903 
2905  buffer, total_size, &total_size );
2906  if (status && (status != STATUS_BUFFER_OVERFLOW) && (status != STATUS_BUFFER_TOO_SMALL)) goto done;
2907 
2908  if (value || data)
2909  {
2910  /* retry with a dynamically allocated buffer */
2912  {
2913  if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
2914  if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size )))
2915  {
2917  goto done;
2918  }
2919  info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr;
2921  buf_ptr, total_size, &total_size );
2922  }
2923 
2924  if (status) goto done;
2925 
2926  if (value)
2927  {
2928  if (info->NameLength/sizeof(WCHAR) >= *val_count)
2929  {
2931  goto overflow;
2932  }
2933  memcpy( value, info->Name, info->NameLength );
2934  *val_count = info->NameLength / sizeof(WCHAR);
2935  value[*val_count] = 0;
2936  }
2937 
2938  if (data)
2939  {
2940  if (info->DataLength > *count)
2941  {
2943  goto overflow;
2944  }
2945  memcpy( data, buf_ptr + info->DataOffset, info->DataLength );
2946  if (is_string(info->Type) && info->DataLength <= *count - sizeof(WCHAR))
2947  {
2948  /* if the type is REG_SZ and data is not 0-terminated
2949  * and there is enough space in the buffer NT appends a \0 */
2950  WCHAR *ptr = (WCHAR *)(data + info->DataLength);
2951  if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0;
2952  }
2953  }
2954  }
2955  else status = STATUS_SUCCESS;
2956 
2957  overflow:
2958  if (type) *type = info->Type;
2959  if (count) *count = info->DataLength;
2960 
2961  done:
2962  if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
2964  return RtlNtStatusToDosError(status);
2965 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG NTSTATUS
Definition: precomp.h:26
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
GLuint buffer
Definition: glext.h:5915
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
long LONG
Definition: pedump.c:60
static PVOID ptr
Definition: dispmode.c:27
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:807
r reserved
Definition: btrfs.c:2893
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
Definition: reg.h:13
#define MAX_PATH
Definition: compat.h:26
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
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
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static __inline int is_string(DWORD type)
Definition: reg.c:61
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
#define ClosePredefKey(Handle)
Definition: reg.c:44
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: ps.c:97

Referenced by CDesktopFolderEnum::AddItemsFromClassicStartMenuKey(), BuildCodePageList(), ConCfgReadUserSettings(), ConSrvReadUserSettings(), Control_RegisterRegistryApplets(), CopyKey(), CreateNTPServerList(), devinst_RegDeleteTreeW(), DoLoadItems(), ensure_useragent(), enum_values(), EnumHKCRValue(), export_hkey(), export_registry_data(), fill_source_list(), FillServerAddressCombo(), GetClassMediaFile(), GetEnumOptions(), GetUsedPorts(), GuiConsoleReadUserSettings(), InitializePrintMonitor2(), InitShellServices(), InitTTFontCache(), InstallerImpl_RegistryValue(), IsLayoutExists(), ITERATE_FindRelatedProducts(), 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(), reg_delete(), RegDeleteTreeW(), RegEnumValueA(), RegFindRecurse(), CControlPanelEnum::RegisterRegistryCPanelApps(), RegQueryRegistryValues(), SSOThread::Run(), ScmCopyTree(), ScmDeleteTree(), SetDefaultPrinterW(), SetSystemEnvironment(), SetUserEnvironment(), SHCopyKeyW(), SHEnumValueW(), SHGetObjectCompatFlags(), SHRegEnumUSValueW(), SQLGetInstalledDriversW(), SQLGetPrivateProfileStringW(), START_TEST(), test_enum_value(), URL_GuessScheme(), and wWinMain().

◆ RegFlushKey()

LONG WINAPI RegFlushKey ( HKEY  hKey)

Definition at line 2974 of file reg.c.

2975 {
2976  HANDLE KeyHandle;
2977  NTSTATUS Status;
2978 
2979  if (hKey == HKEY_PERFORMANCE_DATA)
2980  {
2981  return ERROR_SUCCESS;
2982  }
2983 
2985  hKey);
2986  if (!NT_SUCCESS(Status))
2987  {
2988  return RtlNtStatusToDosError(Status);
2989  }
2990 
2992 
2994 
2995  if (!NT_SUCCESS(Status))
2996  {
2997  return RtlNtStatusToDosError(Status);
2998  }
2999 
3000  return ERROR_SUCCESS;
3001 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSTATUS NTAPI NtFlushKey(IN HANDLE KeyHandle)
Definition: ntapi.c:1065
#define ClosePredefKey(Handle)
Definition: reg.c:44
#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 3010 of file reg.c.

3014 {
3015  HANDLE KeyHandle;
3016  NTSTATUS Status;
3017 
3018  if (hKey == HKEY_PERFORMANCE_DATA)
3019  {
3020  return ERROR_INVALID_HANDLE;
3021  }
3022 
3024  hKey);
3025  if (!NT_SUCCESS(Status))
3026  {
3027  TRACE("MapDefaultKey() failed (Status %lx)\n", Status);
3028  return RtlNtStatusToDosError(Status);
3029  }
3030 
3033  pSecurityDescriptor,
3034  *lpcbSecurityDescriptor,
3035  lpcbSecurityDescriptor);
3036 
3038 
3039  if (!NT_SUCCESS(Status))
3040  {
3041  WARN("NtQuerySecurityObject() failed (Status %lx)\n", Status);
3042  return RtlNtStatusToDosError(Status);
3043  }
3044 
3045  return ERROR_SUCCESS;
3046 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define WARN(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
NTSTATUS NTAPI NtQuerySecurityObject(IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Length, OUT PULONG ResultLength)
Definition: obsecure.c:803
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ClosePredefKey(Handle)
Definition: reg.c:44
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14

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 2071 of file reg.c.

2078 {
2079  DWORD dwType, cbData = pcbData ? *pcbData : 0;
2080  PVOID pvBuf = NULL;
2081  LONG ret;
2082 
2083  TRACE("(%p,%s,%s,%ld,%p,%p,%p=%ld)\n",
2084  hKey, pszSubKey, pszValue, dwFlags, pdwType, pvData, pcbData,
2085  cbData);
2086 
2087  if (pvData && !pcbData)
2088  return ERROR_INVALID_PARAMETER;
2090  ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
2091  return ERROR_INVALID_PARAMETER;
2092 
2093  if (pszSubKey && pszSubKey[0])
2094  {
2095  ret = RegOpenKeyExA(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
2096  if (ret != ERROR_SUCCESS) return ret;
2097  }
2098 
2099  ret = RegQueryValueExA(hKey, pszValue, NULL, &dwType, pvData, &cbData);
2100 
2101  /* If we are going to expand we need to read in the whole the value even
2102  * if the passed buffer was too small as the expanded string might be
2103  * smaller than the unexpanded one and could fit into cbData bytes. */
2104  if ((ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) &&
2105  (dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND)))
2106  {
2107  do {
2108  HeapFree(GetProcessHeap(), 0, pvBuf);
2109 
2110  pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
2111  if (!pvBuf)
2112  {
2114  break;
2115  }
2116 
2117  if (ret == ERROR_MORE_DATA || !pvData)
2118  ret = RegQueryValueExA(hKey, pszValue, NULL,
2119  &dwType, pvBuf, &cbData);
2120  else
2121  {
2122  /* Even if cbData was large enough we have to copy the
2123  * string since ExpandEnvironmentStrings can't handle
2124  * overlapping buffers. */
2125  CopyMemory(pvBuf, pvData, cbData);
2126  }
2127 
2128  /* Both the type or the value itself could have been modified in
2129  * between so we have to keep retrying until the buffer is large
2130  * enough or we no longer have to expand the value. */
2131  } while (dwType == REG_EXPAND_SZ && ret == ERROR_MORE_DATA);
2132 
2133  if (ret == ERROR_SUCCESS)
2134  {
2135  /* Recheck dwType in case it changed since the first call */
2136  if (dwType == REG_EXPAND_SZ)
2137  {
2138  cbData = ExpandEnvironmentStringsA(pvBuf, pvData,
2139  pcbData ? *pcbData : 0);
2140  dwType = REG_SZ;
2141  if(pvData && pcbData && cbData > *pcbData)
2142  ret = ERROR_MORE_DATA;
2143  }
2144  else if (pvData)
2145  CopyMemory(pvData, pvBuf, *pcbData);
2146  }
2147 
2148  HeapFree(GetProcessHeap(), 0, pvBuf);
2149  }
2150 
2151  if (pszSubKey && pszSubKey[0])
2152  RegCloseKey(hKey);
2153 
2154  RegpApplyRestrictions(dwFlags, dwType, cbData, &ret);
2155 
2158 
2159  if (pdwType) *pdwType = dwType;
2160  if (pcbData) *pcbData = cbData;
2161 
2162  return ret;
2163 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
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:4023
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define RRF_RT_REG_EXPAND_SZ
Definition: driver.c:576
#define ZeroMemory
Definition: winbase.h:1642
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:399
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RRF_ZEROONFAILURE
Definition: driver.c:584
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define RRF_NOEXPAND
Definition: driver.c:583
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
static VOID RegpApplyRestrictions(DWORD dwFlags, DWORD dwType, DWORD cbData, PLONG ret)
Definition: reg.c:1893
#define RRF_RT_ANY
Definition: winreg.h:64
#define HeapFree(x, y, z)
Definition: compat.h:394
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4953
#define REG_SZ
Definition: layer.c:22

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 1965 of file reg.c.

1972 {
1973  DWORD dwType, cbData = pcbData ? *pcbData : 0;
1974  PVOID pvBuf = NULL;
1975  LONG ret;
1976 
1977  TRACE("(%p,%s,%s,%ld,%p,%p,%p=%ld)\n",
1978  hKey, debugstr_w(pszSubKey), debugstr_w(pszValue), dwFlags, pdwType,
1979  pvData, pcbData, cbData);
1980 
1981  if (pvData && !pcbData)
1982  return ERROR_INVALID_PARAMETER;
1984  ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
1985  return ERROR_INVALID_PARAMETER;
1986 
1987  if (pszSubKey && pszSubKey[0])
1988  {
1989  ret = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
1990  if (ret != ERROR_SUCCESS) return ret;
1991  }
1992 
1993  ret = RegQueryValueExW(hKey, pszValue, NULL, &dwType, pvData, &cbData);
1994 
1995  /* If we are going to expand we need to read in the whole the value even
1996  * if the passed buffer was too small as the expanded string might be
1997  * smaller than the unexpanded one and could fit into cbData bytes. */
1998  if ((ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) &&
1999  dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND))
2000  {
2001  do
2002  {
2003  HeapFree(GetProcessHeap(), 0, pvBuf);
2004 
2005  pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
2006  if (!pvBuf)
2007  {
2009  break;
2010  }
2011 
2012  if (ret == ERROR_MORE_DATA || !pvData)
2013  ret = RegQueryValueExW(hKey, pszValue, NULL,
2014  &dwType, pvBuf, &cbData);
2015  else
2016  {
2017  /* Even if cbData was large enough we have to copy the
2018  * string since ExpandEnvironmentStrings can't handle
2019  * overlapping buffers. */
2020  CopyMemory(pvBuf, pvData, cbData);
2021  }
2022 
2023  /* Both the type or the value itself could have been modified in
2024  * between so we have to keep retrying until the buffer is large
2025  * enough or we no longer have to expand the value. */
2026  }
2027  while (dwType == REG_EXPAND_SZ && ret == ERROR_MORE_DATA);
2028 
2029  if (ret == ERROR_SUCCESS)
2030  {
2031  /* Recheck dwType in case it changed since the first call */
2032  if (dwType == REG_EXPAND_SZ)
2033  {
2034  cbData = ExpandEnvironmentStringsW(pvBuf, pvData,
2035  pcbData ? *pcbData : 0) * sizeof(WCHAR);
2036  dwType = REG_SZ;
2037  if (pvData && pcbData && cbData > *pcbData)
2038  ret = ERROR_MORE_DATA;
2039  }
2040  else if (pvData)
2041  CopyMemory(pvData, pvBuf, *pcbData);
2042  }
2043 
2044  HeapFree(GetProcessHeap(), 0, pvBuf);
2045  }
2046 
2047  if (pszSubKey && pszSubKey[0])
2048  RegCloseKey(hKey);
2049 
2050  RegpApplyRestrictions(dwFlags, dwType, cbData, &ret);
2051 
2054 
2055  if (pdwType)
2056  *pdwType = dwType;
2057 
2058  if (