ReactOS  0.4.12-dev-90-g2e2e63e
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

◆ GetPredefKeyIndex

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

Definition at line 50 of file reg.c.

Referenced by MapDefaultKey(), and RegOverridePredefKey().

◆ IsPredefKey

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

Definition at line 48 of file reg.c.

Referenced by MapDefaultKey(), and RegOverridePredefKey().

◆ MAX_DEFAULT_HANDLES

#define MAX_DEFAULT_HANDLES   6

Definition at line 27 of file reg.c.

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

◆ 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.

Referenced by RegEnumKeyExW(), and RegQueryInfoKeyW().

Function Documentation

◆ CloseDefaultKeys()

static VOID CloseDefaultKeys ( VOID  )
static

Definition at line 216 of file reg.c.

Referenced by RegCleanup().

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)
GLenum GLclampf GLint i
Definition: glfuncs.h:14
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:3393
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

◆ CreateNestedKey()

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

Definition at line 918 of file reg.c.

Referenced by RegCreateKeyExW().

924 {
925  OBJECT_ATTRIBUTES LocalObjectAttributes;
926  UNICODE_STRING LocalKeyName;
929  ULONG FullNameLength;
930  ULONG Length;
931  PWCHAR Ptr;
932  HANDLE LocalKeyHandle;
933 
934  Status = NtCreateKey((PHANDLE) KeyHandle,
935  samDesired,
936  ObjectAttributes,
937  0,
938  ClassString,
939  dwOptions,
940  (PULONG)lpdwDisposition);
941  TRACE("NtCreateKey(%wZ) called (Status %lx)\n", ObjectAttributes->ObjectName, Status);
942  if (Status != STATUS_OBJECT_NAME_NOT_FOUND)
943  return Status;
944 
945  /* Copy object attributes */
946  RtlCopyMemory(&LocalObjectAttributes,
947  ObjectAttributes,
948  sizeof(OBJECT_ATTRIBUTES));
949  RtlCreateUnicodeString(&LocalKeyName,
950  ObjectAttributes->ObjectName->Buffer);
951  LocalObjectAttributes.ObjectName = &LocalKeyName;
952  FullNameLength = LocalKeyName.Length / sizeof(WCHAR);
953 
954  LocalKeyHandle = NULL;
955 
956  /* Remove the last part of the key name and try to create the key again. */
957  while (Status == STATUS_OBJECT_NAME_NOT_FOUND)
958  {
959  Ptr = wcsrchr(LocalKeyName.Buffer, '\\');
960  if (Ptr == NULL || Ptr == LocalKeyName.Buffer)
961  {
962  Status = STATUS_UNSUCCESSFUL;
963  break;
964  }
965 
966  *Ptr = (WCHAR)0;
967  LocalKeyName.Length = wcslen(LocalKeyName.Buffer) * sizeof(WCHAR);
968 
969  Status = NtCreateKey(&LocalKeyHandle,
971  &LocalObjectAttributes,
972  0,
973  NULL,
974  0,
975  &Disposition);
976  TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status);
977  }
978 
979  if (!NT_SUCCESS(Status))
980  {
981  RtlFreeUnicodeString(&LocalKeyName);
982  return Status;
983  }
984 
985  /* Add removed parts of the key name and create them too. */
986  Length = wcslen(LocalKeyName.Buffer);
987  while (TRUE)
988  {
989  if (LocalKeyHandle)
990  NtClose (LocalKeyHandle);
991 
992  LocalKeyName.Buffer[Length] = L'\\';
993  Length = wcslen (LocalKeyName.Buffer);
994  LocalKeyName.Length = Length * sizeof(WCHAR);
995 
996  if (Length == FullNameLength)
997  {
998  Status = NtCreateKey((PHANDLE) KeyHandle,
999  samDesired,
1000  ObjectAttributes,
1001  0,
1002  ClassString,
1003  dwOptions,
1004  (PULONG)lpdwDisposition);
1005  break;
1006  }
1007 
1008  Status = NtCreateKey(&LocalKeyHandle,
1010  &LocalObjectAttributes,
1011  0,
1012  NULL,
1013  0,
1014  &Disposition);
1015  TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status);
1016  if (!NT_SUCCESS(Status))
1017  break;
1018  }
1019 
1020  RtlFreeUnicodeString(&LocalKeyName);
1021 
1022  return Status;
1023 }
DWORD dwOptions
Definition: solitaire.cpp:23
#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_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:54
#define WCHAR
Definition: msvc.h:43
_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
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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:3393
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1087
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)

◆ is_string()

static __inline int is_string ( DWORD  type)
static

Definition at line 61 of file reg.c.

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

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

◆ 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 */
170  Index = GetPredefKeyIndex(Key);
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  {
185  Handle = &DefaultHandleTable[Index];
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 */
197  Status = OpenPredefinedKey(Index,
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:24
#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:2725
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 
244  InitializeObjectAttributes(&Attributes,
245  &KeyName,
247  NULL,
248  NULL);
249  Status = NtOpenKey(KeyHandle,
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:4693
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
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:24
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1087
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.

Referenced by OpenPredefinedKey().

308 {
311  RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current");
312 
313  TRACE("OpenCurrentConfigKey()\n");
314 
315  InitializeObjectAttributes(&Attributes,
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:4693
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
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:1087
_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

◆ OpenLocalMachineKey()

static NTSTATUS OpenLocalMachineKey ( PHANDLE  KeyHandle)
static

Definition at line 264 of file reg.c.

Referenced by OpenPredefinedKey().

265 {
267  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine");
269 
270  TRACE("OpenLocalMachineKey()\n");
271 
272  InitializeObjectAttributes(&Attributes,
273  &KeyName,
275  NULL,
276  NULL);
277  Status = NtOpenKey(KeyHandle,
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:4693
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
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:1087
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

◆ OpenPredefinedKey()

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

Definition at line 105 of file reg.c.

Referenced by MapDefaultKey(), and RegOverridePredefKey().

107 {
109 
110  switch (Index)
111  {
112  case 0: /* HKEY_CLASSES_ROOT */
113  Status = OpenClassesRootKey (Handle);
114  break;
115 
116  case 1: /* HKEY_CURRENT_USER */
118  Handle);
119  break;
120 
121  case 2: /* HKEY_LOCAL_MACHINE */
122  Status = OpenLocalMachineKey (Handle);
123  break;
124 
125  case 3: /* HKEY_USERS */
126  Status = OpenUsersKey (Handle);
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 */
135  Status = OpenCurrentConfigKey (Handle);
136  break;
137 
138  case 6: /* HKEY_DYN_DATA */
139  Status = STATUS_NOT_IMPLEMENTED;
140  break;
141 
142  default:
143  WARN("MapDefaultHandle() no handle creator\n");
144  Status = STATUS_INVALID_PARAMETER;
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

◆ OpenUsersKey()

static NTSTATUS OpenUsersKey ( PHANDLE  KeyHandle)
static

Definition at line 288 of file reg.c.

Referenced by OpenPredefinedKey().

289 {
291  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\User");
292 
293  TRACE("OpenUsersKey()\n");
294 
295  InitializeObjectAttributes(&Attributes,
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:4693
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
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:1087
_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

◆ RegCleanup()

BOOL RegCleanup ( VOID  )

Definition at line 93 of file reg.c.

Referenced by DllMain().

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)

◆ RegCloseKey()

LONG WINAPI RegCloseKey ( HKEY  hKey)

Definition at line 423 of file reg.c.

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(), 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(), 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_local_service(), create_monodata(), create_mru_list(), create_new_eventlog(), create_reg_entries(), create_server(), CreateAppPathRegKey(), CreateComponentEnumerator(), CreateComponentInfo(), CreateDeviceInstance(), CreateEnvironmentBlock(), CreateEventLog(), CreateHKCRKey(), 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(), CryptSetOIDFunctionValue(), CryptSetProviderExW(), CryptSIPRetrieveSubjectGuid(), CryptUnregisterDefaultOIDFunction(), debugstr_iid(), 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(), EnableTheming(), ensure_useragent(), Enum(), enum_drivers(), enum_key(), enum_values(), EnumClientServiceProtocol(), EnumDeviceClasses(), EnumerateCursorSchemes(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumerateNetworkComponent(), EnumerateNt4ServiceSoundDevices(), EnumerateSoundProfiles(), EnumHKCRKey(), EnumHKCRValue(), EnumInstalledApplications(), 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(), GetBootResourceList(), GetCLSIDForFileType(), CQueryAssociations::GetCommand(), GetConnectionDescription(), GetConnectionType(), GetCurrentDPI(), GetCurrentHwProfileW(), GetCurrentScreenSaverValue(), CTrayBandSite::GetDefaultBandsStream(), GetDefaultPrinterFromRegistry(), GetDefaultPrinterW(), GetDefaultUserProfileDirectoryW(), GetDesktopPath(), CRegFolder::GetDetailsOf(), CNetConnectionPropertyUi::GetDeviceInstanceID(), GetDeviceLocationString(), GetDisabledAutostartEntriesFromRegistry(), GetDisplayNameFileAndID(), CRegFolder::GetDisplayNameOf(), GetDriverDateString(), GetDriverName(), GetDriverProviderString(), GetDriverVersionString(), GetEnumOptions(), GetEnvironmentVariables(), GetEventMessageFileDLL(), GetExplorerRegValueSet(), GetFileTypeIconsByKey(), GetFindFlags(), GetGinaPath(), GetInterfaceNameInternal(), GetJobName(), GetLayoutCount(), GetLayoutID(), GetLayoutName(), GetLPTTransmissionRetryTimeout(), GetNetworkParams(), GetNTPServerAddress(), GetPerAdapterInfo(), GetPnpKey(), GetPortType(), GetProfile(), GetProfileCount(), GetProfiles(), GetProfilesDirectoryW(), GetProgramsPath(), CNetConnection::GetProperties(), GetProtoOpenNetworkDatabase(), GetPwrDiskSpindownRange(), GetRegistrySettings(), GetRegUlong(), GetRegValue(), GetServiceMainFunctions(), GetSetupType(), GetShell(), GetShutdownReasonUI(), CQueryAssociations::GetString(), 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(), INetCfgComponentControl_fnApplyRegistryChanges(), INetCfgLock_fnAcquireWriteLock(), INetCfgLock_fnIsWriteLocked(), CQueryAssociations::Init(), CAutoComplete::Init(), Pane::init(), init_driver(), init_key(), InitAudioDlg(), InitBackgroundDialog(), InitDialog(), InitFontSizeList(), InitializeDefaultUserLocale(), InitializeDirectPlayDialog(), InitializePrinterList(), InitializePrintMonitorList(), InitializePrintProcessorList(), InitializeProfiles(), InitializeProgramFilesDir(), InitIconOverlays(), InitKeyboardLayouts(), InitLogs(), InitNotifications(), InitOSVersion(), InitOurDirectory(), InitPropertiesDlg(), InitRadioButtons(), InitSettings(), InitShellServices(), 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(), 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(), 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(), LoadNotificationDll(), COpenWithList::LoadProgIdList(), CInputPin::LoadProxyPlugins(), COutputPin::LoadProxyPlugins(), CKsProxy::LoadProxyPlugins(), COpenWithList::LoadRecommendedFromHKCR(), COpenWithList::LoadRecommendedFromHKCU(), LoadRecoveryOptions(), 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(), OnColorButton(), OnInitMenu(), OnInitSysSettingsDialog(), OnOK(), OnTreeExpanding(), open_key(), open_local_assembly_key(), open_package(), OpenHardwareProfileKey(), OpenHKCRKey(), OpenInitializedCatalog(), OpenNetworkDatabase(), OpenServiceParametersKey(), CRegistryKey::OpenSubkey(), FileTypeManager::operator[](), package_RegDeleteTreeW(), pCDevSettings_Initialize(), pCDevSettings_InitializeExtInterface(), pendingRename(), PerformMount(), PixelFormatInfo_Constructor(), PixelFormatInfo_Release(), PlayLogonSoundThread(), PNP_AddID(), PNP_CreateKey(), PNP_GetClassCount(), 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_types(), ReadAttributes(), 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_unreg_wine_test_class(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RegDelString(), RegFindRecurse(), RegFindWalk(), RegGetDWORD(), RegGetDWORDValue(), RegGetSZ(), RegGetValueA(), RegGetValueW(), register_appid(), register_categories(), register_coclasses(), register_codecs(), 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(), CMainWindow::s_EnumInstalledAppProc(), SampIsSetupRunning(), SampSetupAddMemberToAlias(), save_cert_mgr_usages(), save_config(), save_mapping_settings(), save_registry_settings(), save_sys_colors(), COpenWithList::SaveApp(), SaveBoard(), SaveCurrentLocale(), SaveCursorScheme(), SaveCustomPath(), SaveDataToRegistry(), SaveDefaultUserHive(), SaveGeoID(), SaveJob(), SaveSettings(), SaveShutdownSelState(), SaveSystemSettings(), scan_subkeys(), ScmAssignNewTag(), ScmAutoStartServices(), ScmCopyControlSet(), ScmCopyTree(), ScmCreateNewControlPipe(), ScmCreateServiceDatabase(), ScmCreateServiceKey(), ScmDeleteMarkedServices(), ScmDeleteRegKey(), 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(), SetRegUlong(), SetScreenSaver(), SetSetupType(), SetSystemEnvironment(), 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(), 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_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_MsiGetProductInfo(), 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_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_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(), testDevRegKey(), TestInterfaceRegistry(), TestKeyAccess_(), TestModuleRegistry(), TestMyEventProvider(), testRegisterAndGetDetail(), 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(), 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(), 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().

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  {
441  return RtlNtStatusToDosError(Status);
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:24
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)

◆ RegConnectRegistryA()

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

Definition at line 842 of file reg.c.

Referenced by test_regconnectregistry().

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

◆ RegConnectRegistryW()

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

Definition at line 872 of file reg.c.

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

875 {
876  LONG ret;
877 
878  TRACE("(%s,%p,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult);
879 
880  if (!lpMachineName || !*lpMachineName)
881  {
882  /* Use the local machine name */
883  ret = RegOpenKeyW( hKey, NULL, phkResult );
884  }
885  else
886  {
887  WCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
888  DWORD len = sizeof(compName) / sizeof(WCHAR);
889 
890  /* MSDN says lpMachineName must start with \\ : not so */
891  if( lpMachineName[0] == '\\' && lpMachineName[1] == '\\')
892  lpMachineName += 2;
893 
894  if (GetComputerNameW(compName, &len))
895  {
896  if (!_wcsicmp(lpMachineName, compName))
897  ret = RegOpenKeyW(hKey, NULL, phkResult);
898  else
899  {
900  FIXME("Connect to %s is not supported.\n",debugstr_w(lpMachineName));
901  ret = ERROR_BAD_NETPATH;
902  }
903  }
904  else
905  ret = GetLastError();
906  }
907 
908  return ret;
909 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:439
#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:3311
#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
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)

◆ RegCopyTreeA()

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

Definition at line 812 of file reg.c.

Referenced by InitFunctionPtrs().

815 {
816  UNICODE_STRING SubKeyName = { 0, 0, NULL };
817  LONG Ret;
818 
819  if (lpSubKey != NULL &&
821  (LPSTR)lpSubKey))
822  {
824  }
825 
826  Ret = RegCopyTreeW(hKeySrc,
827  SubKeyName.Buffer,
828  hKeyDest);
829 
830  RtlFreeUnicodeString(&SubKeyName);
831 
832  return Ret;
833 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4705
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
char * LPSTR
Definition: xmlstorage.h:182
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

◆ RegCopyTreeW()

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

Definition at line 736 of file reg.c.

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

739 {
740  HANDLE DestKeyHandle, KeyHandle, CurKey, SubKeyHandle = NULL;
742 
743  Status = MapDefaultKey(&KeyHandle,
744  hKeySrc);
745  if (!NT_SUCCESS(Status))
746  {
747  return RtlNtStatusToDosError(Status);
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,
763  (LPWSTR)lpSubKey);
764 
765  InitializeObjectAttributes(&ObjectAttributes,
766  &SubKeyName,
768  KeyHandle,
769  NULL);
770 
771  Status = NtOpenKey(&SubKeyHandle,
773  &ObjectAttributes);
774  if (!NT_SUCCESS(Status))
775  {
776  goto Cleanup;
777  }
778 
779  CurKey = SubKeyHandle;
780  }
781  else
782  CurKey = KeyHandle;
783 
784  Status = RegpCopyTree(CurKey,
785  hKeyDest);
786 
787  if (SubKeyHandle != NULL)
788  {
789  NtClose(SubKeyHandle);
790  }
791 
792 Cleanup:
793  ClosePredefKey(DestKeyHandle);
794 Cleanup2:
795  ClosePredefKey(KeyHandle);
796 
797  if (!NT_SUCCESS(Status))
798  {
799  return RtlNtStatusToDosError(Status);
800  }
801 
802  return ERROR_SUCCESS;
803 }
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:4705
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
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:24
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
#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:4705
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
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

◆ RegCreateKeyA()

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

Definition at line 1180 of file reg.c.

Referenced by create_new_eventlog(), create_reg_entries(), create_test_entries(), CryptRegisterOIDFunction(), 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_internet_features(), test_internet_features_registry(), test_MRUListA(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiEnumProducts(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfo(), 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_publish_components(), test_reg_copy_tree(), test_reg_delete_key(), test_reg_delete_tree(), test_reg_query_value(), test_registry(), test_RegNotifyChangeKeyValue(), test_rw_order(), test_SetupDiOpenClassRegKeyExA(), test_SetZoneAttributes(), test_SHCopyKey(), test_SHDeleteKey(), test_string_termination(), test_zone_domain_cache(), WNetCachePassword(), WNetEnumCachedPasswords(), WNetGetCachedPassword(), and WNetRemoveCachedPassword().

1183 {
1184  return RegCreateKeyExA(hKey,
1185  lpSubKey,
1186  0,
1187  NULL,
1188  0,
1190  NULL,
1191  phkResult,
1192  NULL);
1193 }
#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:1032

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

Referenced by add_key_(), create_container_key(), create_test_association(), create_test_class(), create_test_verb_dde(), CRYPT_GetDefaultOIDKey(), CryptGetDefaultOIDDllList(), 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_MsiGetProductInfo(), 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().

1042 {
1043  UNICODE_STRING SubKeyString;
1044  UNICODE_STRING ClassString;
1045  DWORD ErrorCode;
1046 
1047  RtlInitEmptyUnicodeString(&ClassString, NULL, 0);
1048  RtlInitEmptyUnicodeString(&SubKeyString, NULL, 0);
1049 
1050  if (lpClass)
1051  {
1052  if (!RtlCreateUnicodeStringFromAsciiz(&ClassString, lpClass))
1053  {
1054  ErrorCode = ERROR_NOT_ENOUGH_MEMORY;
1055  goto Exit;
1056  }
1057  }
1058 
1059  if (lpSubKey)
1060  {
1061  if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyString, lpSubKey))
1062  {
1063  ErrorCode = ERROR_NOT_ENOUGH_MEMORY;
1064  goto Exit;
1065  }
1066  }
1067 
1068  ErrorCode = RegCreateKeyExW(
1069  hKey,
1070  SubKeyString.Buffer,
1071  Reserved,
1072  ClassString.Buffer,
1073  dwOptions,
1074  samDesired,
1075  lpSecurityAttributes,
1076  phkResult,
1077  lpdwDisposition);
1078 
1079 Exit:
1080  RtlFreeUnicodeString(&SubKeyString);
1081  RtlFreeUnicodeString(&ClassString);
1082 
1083  return ErrorCode;
1084 }
DWORD dwOptions
Definition: solitaire.cpp:23
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
#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:1094
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)

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

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_mru_list(), CreateAppPathRegKey(), CreateDeviceInstance(), CreateEventLog(), CreateHKCRKey(), 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(), EnumTfLanguageProfiles_Constructor(), FillList(), FilterMapper3_CreateCategory(), FilterMapper_RegisterFilter(), FilterMapper_RegisterPin(), FilterMapper_RegisterPinType(), get_cert_mgr_usages(), get_fusion_filename(), GetCurrentDPI(), GetFallbackHKCRKey(), 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_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(), UXTHEME_BackupSystemMetrics(), WinHttpSetDefaultProxyConfiguration(), WINTRUST_WriteProviderToReg(), WINTRUST_WriteSingleUsageEntry(), WintrustGetRegPolicyFlags(), WintrustSetRegPolicyFlags(), wnet_use_connection(), write_reg_key(), write_types(), WriteCabinetState(), WritePortSettings(), WriteStartupRecoveryOptions(), and WriteUserLocale().

1104 {
1105  UNICODE_STRING SubKeyString;
1106  UNICODE_STRING ClassString;
1108  HANDLE ParentKey;
1110  NTSTATUS Status;
1111 
1112  TRACE("RegCreateKeyExW() called\n");
1113 
1114  if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES))
1116 
1117  /* get the real parent key */
1118  Status = MapDefaultKey(&ParentKey,
1119  hKey);
1120  if (!NT_SUCCESS(Status))
1121  {
1122  return RtlNtStatusToDosError(Status);
1123  }
1124 
1125  TRACE("ParentKey %p\n", ParentKey);
1126 
1127  if (IsHKCRKey(ParentKey))
1128  {
1130  ParentKey,
1131  lpSubKey,
1132  Reserved,
1133  lpClass,
1134  dwOptions,
1135  samDesired,
1136  lpSecurityAttributes,
1137  phkResult,
1138  lpdwDisposition);
1139  ClosePredefKey(ParentKey);
1140  return ErrorCode;
1141  }
1142 
1144  Attributes |= OBJ_OPENLINK;
1145 
1146  RtlInitUnicodeString(&ClassString,
1147  lpClass);
1148  RtlInitUnicodeString(&SubKeyString,
1149  lpSubKey);
1150  InitializeObjectAttributes(&ObjectAttributes,
1151  &SubKeyString,
1152  Attributes,
1153  (HANDLE)ParentKey,
1154  lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
1155  Status = CreateNestedKey(phkResult,
1156  &ObjectAttributes,
1157  (lpClass == NULL)? NULL : &ClassString,
1158  dwOptions,
1159  samDesired,
1160  lpdwDisposition);
1161 
1162  ClosePredefKey(ParentKey);
1163 
1164  TRACE("Status %x\n", Status);
1165  if (!NT_SUCCESS(Status))
1166  {
1167  return RtlNtStatusToDosError(Status);
1168  }
1169 
1170  return ERROR_SUCCESS;
1171 }
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:4418
#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:918
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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

◆ RegCreateKeyW()

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

Definition at line 1202 of file reg.c.

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_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().

1205 {
1206  return RegCreateKeyExW(hKey,
1207  lpSubKey,
1208  0,
1209  NULL,
1210  0,
1212  NULL,
1213  phkResult,
1214  NULL);
1215 }
#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:1094
smooth NULL
Definition: ftsmooth.c:416

◆ RegDeleteKeyA()

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

Definition at line 1225 of file reg.c.

Referenced by action_RegDeleteTreeA(), cleanup_eventlog(), CryptUnregisterOIDFunction(), 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_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_MsiGetProductInfo(), 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_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_SetupDiOpenClassRegKeyExA(), 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(), testDeviceRegistryPropertyA(), testRegStore(), unregister_keys(), unregister_server(), unregister_testentry(), and unregister_zone_domains().

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

◆ RegDeleteKeyExA()

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

Definition at line 1255 of file reg.c.

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

1260 {
1261  LONG ErrorCode;
1263 
1264  if (lpSubKey)
1265  {
1266  if (!RtlCreateUnicodeStringFromAsciiz(&SubKeyName, lpSubKey))
1267  return ERROR_NOT_ENOUGH_MEMORY;
1268  }
1269  else
1270  RtlInitEmptyUnicodeString(&SubKeyName, NULL, 0);
1271 
1272  ErrorCode = RegDeleteKeyExW(hKey, SubKeyName.Buffer, samDesired, Reserved);
1273 
1274  RtlFreeUnicodeString(&SubKeyName);
1275 
1276  return ErrorCode;
1277 }
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4705
#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:1287
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)

◆ RegDeleteKeyExW()

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

Definition at line 1287 of file reg.c.

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

1292 {
1295  HANDLE ParentKey;
1296  HANDLE TargetKey;
1297  NTSTATUS Status;
1298 
1299  /* Make sure we got a subkey */
1300  if (!lpSubKey)
1301  {
1302  /* Fail */
1303  return ERROR_INVALID_PARAMETER;
1304  }
1305 
1306  Status = MapDefaultKey(&ParentKey,
1307  hKey);
1308  if (!NT_SUCCESS(Status))
1309  {
1310  return RtlNtStatusToDosError(Status);
1311  }
1312 
1313  if (IsHKCRKey(ParentKey))
1314  {
1315  LONG ErrorCode = DeleteHKCRKey(ParentKey, lpSubKey, samDesired, Reserved);
1316  ClosePredefKey(ParentKey);
1317  return ErrorCode;
1318  }
1319 
1320  if (samDesired & KEY_WOW64_32KEY)
1321  ERR("Wow64 not yet supported!\n");
1322 
1323  if (samDesired & KEY_WOW64_64KEY)
1324  ERR("Wow64 not yet supported!\n");
1325 
1326 
1327  RtlInitUnicodeString(&SubKeyName,
1328  (LPWSTR)lpSubKey);
1329  InitializeObjectAttributes(&ObjectAttributes,
1330  &SubKeyName,
1332  ParentKey,
1333  NULL);
1334  Status = NtOpenKey(&TargetKey,
1335  DELETE,
1336  &ObjectAttributes);
1337  if (!NT_SUCCESS(Status))
1338  {
1339  goto Cleanup;
1340  }
1341 
1342  Status = NtDeleteKey(TargetKey);
1343  NtClose(TargetKey);
1344 
1345 Cleanup:
1346  ClosePredefKey(ParentKey);
1347 
1348  if (!NT_SUCCESS(Status))
1349  {
1350  return RtlNtStatusToDosError(Status);
1351  }
1352 
1353  return ERROR_SUCCESS;
1354 }
#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:4418
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4705
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:24
FORCEINLINE BOOL IsHKCRKey(_In_ HKEY hKey)
Definition: reg.h:13
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
#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
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define DELETE
Definition: nt_native.h:57

◆ RegDeleteKeyValueA()

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

Definition at line 1434 of file reg.c.

Referenced by InitFunctionPtrs().

1437 {
1438  UNICODE_STRING SubKey = { 0, 0, NULL }, ValueName = { 0, 0, NULL };
1439  LONG Ret;
1440 
1441  if (lpSubKey != NULL &&
1443  (LPSTR)lpSubKey))
1444  {
1445  return ERROR_NOT_ENOUGH_MEMORY;
1446  }
1447 
1448  if (lpValueName != NULL &&
1450  (LPSTR)lpValueName))
1451  {
1452  RtlFreeUnicodeString(&SubKey);
1453  return ERROR_NOT_ENOUGH_MEMORY;
1454  }
1455 
1456  Ret = RegDeleteKeyValueW(hKey,
1457  SubKey.Buffer,
1458  SubKey.Buffer);
1459 
1460  RtlFreeUnicodeString(&SubKey);
1461  RtlFreeUnicodeString(&ValueName);
1462 
1463  return Ret;
1464 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
char * LPSTR
Definition: xmlstorage.h:182
_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:1363

◆ RegDeleteKeyValueW()

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

Definition at line 1363 of file reg.c.

Referenced by RegDeleteKeyValueA().

1366 {
1368  HANDLE KeyHandle, CurKey, SubKeyHandle = NULL;
1369  NTSTATUS Status;
1370 
1371  Status = MapDefaultKey(&KeyHandle,
1372  hKey);
1373  if (!NT_SUCCESS(Status))
1374  {
1375  return RtlNtStatusToDosError(Status);
1376  }
1377 
1378  if (lpSubKey != NULL)
1379  {
1382 
1383  RtlInitUnicodeString(&SubKeyName,
1384  (LPWSTR)lpSubKey);
1385 
1386  InitializeObjectAttributes(&ObjectAttributes,
1387  &SubKeyName,
1389  KeyHandle,
1390  NULL);
1391 
1392  Status = NtOpenKey(&SubKeyHandle,
1393  KEY_SET_VALUE,
1394  &ObjectAttributes);
1395  if (!NT_SUCCESS(Status))
1396  {
1397  goto Cleanup;
1398  }
1399 
1400  CurKey = SubKeyHandle;
1401  }
1402  else
1403  CurKey = KeyHandle;
1404 
1405  RtlInitUnicodeString(&ValueName,
1406  (LPWSTR)lpValueName);
1407 
1408  Status = NtDeleteValueKey(CurKey,
1409  &ValueName);
1410 
1411  if (SubKeyHandle != NULL)
1412  {
1413  NtClose(SubKeyHandle);
1414  }
1415 
1416 Cleanup:
1417  ClosePredefKey(KeyHandle);
1418 
1419  if (!NT_SUCCESS(Status))
1420  {
1421  return RtlNtStatusToDosError(Status);
1422  }
1423 
1424  return ERROR_SUCCESS;
1425 }
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:4705
#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:4693
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:24
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
#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:4705
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
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ RegDeleteKeyW()

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

Definition at line 1240 of file reg.c.

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(), RegDeleteTreeW(), ATL::CRegObject::RegDeleteTreeX(), RemoveAppFromRegistry(), RemoveEventLog(), ScmDeleteRegKey(), ServicesPageWndProc(), SETUP_CreateClassKey(), SHDeleteEmptyKeyW(), SHDeleteKeyW(), SHDeleteOrphanKeyW(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), START_TEST(), Test_CreateOpenKey(), test_DeletePwrScheme(), test_directshow_filter(), test_FolderShortcut(), test_IQueryAssociations_GetString(), test_legacy_filter_registration(), test_OleRegGetUserType(), test_SetupDiInstallClassExA(), test_SHGetShellKey(), test_SQLGetPrivateProfileString(), test_SQLGetPrivateProfileStringW(), test_SQLWritePrivateProfileString(), test_system_security_access(), testCertOpenSystemStore(), testDeviceRegistryPropertyW(), testInstallClass(), testSystemRegStore(), testSystemStore(), TLB_unregister_interface(), UnloadUserProfile(), unregister_dmo_from_category(), unregister_mediatypes_parsing(), UnregisterComponent(), UnRegisterTypeLib(), WINTRUST_RemoveProviderFromReg(), and WNetCancelConnection2W().

1243 {
1244  return RegDeleteKeyExW(hKey, lpSubKey, 0, 0);
1245 }
LONG WINAPI RegDeleteKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ REGSAM samDesired, _In_ DWORD Reserved)
Definition: reg.c:1287

◆ RegDeleteTreeA()

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

Definition at line 1849 of file reg.c.

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

1851 {
1852  UNICODE_STRING SubKeyName = { 0, 0, NULL };
1853  LONG Ret;
1854 
1855  if (lpSubKey != NULL &&
1856  !RtlCreateUnicodeStringFromAsciiz(&SubKeyName,
1857  (LPSTR)lpSubKey))
1858  {
1859  return ERROR_NOT_ENOUGH_MEMORY;
1860  }
1861 
1862  Ret = RegDeleteTreeW(hKey,
1863  SubKeyName.Buffer);
1864 
1865  RtlFreeUnicodeString(&SubKeyName);
1866 
1867  return Ret;
1868 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4705
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
char * LPSTR
Definition: xmlstorage.h:182
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:1755

◆ RegDeleteTreeW()

LSTATUS WINAPI RegDeleteTreeW ( HKEY  hKey,
LPCWSTR  lpszSubKey 
)

Definition at line 1755 of file reg.c.

Referenced by ACTION_UnregisterClassInfo(), ACTION_UnregisterExtensionInfo(), ACTION_UnregisterProgIdInfo(), CategoryMgr_UnregisterCategory(), CRYPT_RegOpenStore(), delete_key_state(), delete_tree(), 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(), RegDeleteKeyValueA(), RegDeleteTreeA(), register_codecs(), 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().

1757 {
1758  LONG ret;
1759  DWORD dwMaxSubkeyLen, dwMaxValueLen;
1760  DWORD dwMaxLen, dwSize;
1761  NTSTATUS Status;
1762  HANDLE KeyHandle;
1763  HKEY hSubKey;
1764  WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1765 
1766  TRACE("(hkey=%p,%p %s)\n", hKey, lpszSubKey, debugstr_w(lpszSubKey));
1767 
1768  Status = MapDefaultKey(&KeyHandle,
1769  hKey);
1770  if (!NT_SUCCESS(Status))
1771  {
1772  return RtlNtStatusToDosError(Status);
1773  }
1774 
1775  hSubKey = KeyHandle;
1776 
1777  if(lpszSubKey)
1778  {
1779  ret = RegOpenKeyExW(KeyHandle, lpszSubKey, 0, KEY_READ, &hSubKey);
1780  if (ret)
1781  {
1782  ClosePredefKey(KeyHandle);
1783  return ret;
1784  }
1785  }
1786 
1787  /* Get highest length for keys, values */
1788  ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
1789  &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1790  if (ret) goto cleanup;
1791 
1792  dwMaxSubkeyLen++;
1793  dwMaxValueLen++;
1794  dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1795  if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
1796  {
1797  /* Name too big: alloc a buffer for it */
1798  if (!(lpszName = RtlAllocateHeap( RtlGetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
1799  {
1801  goto cleanup;
1802  }
1803  }
1804 
1805 
1806  /* Recursively delete all the subkeys */
1807  while (TRUE)
1808  {
1809  dwSize = dwMaxLen;
1810  if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
1811  NULL, NULL, NULL)) break;
1812 
1813  ret = RegDeleteTreeW(hSubKey, lpszName);
1814  if (ret) goto cleanup;
1815  }
1816 
1817  if (lpszSubKey)
1818  ret = RegDeleteKeyW(KeyHandle, lpszSubKey);
1819  else
1820  while (TRUE)
1821  {
1822  dwSize = dwMaxLen;
1823  if (RegEnumValueW(KeyHandle, 0, lpszName, &dwSize,
1824  NULL, NULL, NULL, NULL)) break;
1825 
1826  ret = RegDeleteValueW(KeyHandle, lpszName);
1827  if (ret) goto cleanup;
1828  }
1829 
1830 cleanup:
1831  /* Free buffer if allocated */
1832  if (lpszName != szNameBuf)
1833  RtlFreeHeap( RtlGetProcessHeap(), 0, lpszName);
1834  if(lpszSubKey)
1835  RegCloseKey(hSubKey);
1836 
1837  ClosePredefKey(KeyHandle);
1838 
1839  return ret;
1840 }
#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:4693
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1240
#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:2867
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#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:3704
int ret
Status
Definition: gdiplustypes.h:24
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1755
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2368
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
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:2541
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ RegDeleteValueA()

LONG WINAPI RegDeleteValueA ( HKEY  hKey,
LPCSTR  lpValueName 
)

Definition at line 2331 of file reg.c.

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_MsiGetProductInfo(), 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().

2333 {
2335  HANDLE KeyHandle;
2336  NTSTATUS Status;
2337 
2338  Status = MapDefaultKey(&KeyHandle,
2339  hKey);
2340  if (!NT_SUCCESS(Status))
2341  {
2342  return RtlNtStatusToDosError(Status);
2343  }
2344 
2346  (LPSTR)lpValueName);
2347  Status = NtDeleteValueKey(KeyHandle,
2348  &ValueName);
2349  RtlFreeUnicodeString (&ValueName);
2350 
2351  ClosePredefKey(KeyHandle);
2352 
2353  if (!NT_SUCCESS(Status))
2354  {
2355  return RtlNtStatusToDosError(Status);
2356  }
2357 
2358  return ERROR_SUCCESS;
2359 }
#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:4693
LONG NTSTATUS
Definition: precomp.h:26
char * LPSTR
Definition: xmlstorage.h:182
_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:24
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ClosePredefKey(Handle)
Definition: reg.c:44

◆ RegDeleteValueW()

LONG WINAPI RegDeleteValueW ( HKEY  hKey,
LPCWSTR  lpValueName 
)

Definition at line 2368 of file reg.c.

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(), 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().

2370 {
2372  NTSTATUS Status;
2373  HANDLE KeyHandle;
2374 
2375  Status = MapDefaultKey(&KeyHandle,
2376  hKey);
2377  if (!NT_SUCCESS(Status))
2378  {
2379  return RtlNtStatusToDosError(Status);
2380  }
2381 
2382  RtlInitUnicodeString(&ValueName,
2383  (LPWSTR)lpValueName);
2384 
2385  Status = NtDeleteValueKey(KeyHandle,
2386  &ValueName);
2387 
2388  ClosePredefKey(KeyHandle);
2389 
2390  if (!NT_SUCCESS(Status))
2391  {
2392  return RtlNtStatusToDosError(Status);
2393  }
2394 
2395  return ERROR_SUCCESS;
2396 }
#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:4693
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:24
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
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

1878 {
1879  FIXME("RegDisableReflectionKey(0x%p) UNIMPLEMENTED!\n", hBase);
1881 }
#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 1890 of file reg.c.

1891 {
1892  FIXME("RegEnableReflectionKey(0x%p) UNIMPLEMENTED!\n", hBase);
1894 }
#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 2405 of file reg.c.

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

2409 {
2410  DWORD dwLength;
2411 
2412  dwLength = cbName;
2413  return RegEnumKeyExA(hKey,
2414  dwIndex,
2415  lpName,
2416  &dwLength,
2417  NULL,
2418  NULL,
2419  NULL,
2420  NULL);
2421 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
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:2456

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

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().

2465 {
2466  WCHAR* NameBuffer = NULL;
2467  WCHAR* ClassBuffer = NULL;
2468  DWORD NameLength, ClassLength;
2469  LONG ErrorCode;
2470 
2471  /* Allocate our buffers */
2472  if (*lpcbName > 0)
2473  {
2474  NameLength = *lpcbName;
2475  NameBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbName * sizeof(WCHAR));
2476  if (NameBuffer == NULL)
2477  {
2478  ErrorCode = ERROR_NOT_ENOUGH_MEMORY;
2479  goto Exit;
2480  }
2481  }
2482 
2483  if (lpClass)
2484  {
2485  if (*lpcbClass > 0)
2486  {
2487  ClassLength = *lpcbClass;
2488  ClassBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *lpcbClass * sizeof(WCHAR));
2489  if (ClassBuffer == NULL)
2490  {
2491  ErrorCode = ERROR_NOT_ENOUGH_MEMORY;
2492  goto Exit;
2493  }
2494  }
2495  }
2496 
2497  /* Do the actual call */
2498  ErrorCode = RegEnumKeyExW(
2499  hKey,
2500  dwIndex,
2501  NameBuffer,
2502  lpcbName,
2503  lpReserved,
2504  ClassBuffer,
2505  lpcbClass,
2506  lpftLastWriteTime);
2507 
2508  if (ErrorCode != ERROR_SUCCESS)
2509  goto Exit;
2510 
2511  /* Convert the strings */
2512  RtlUnicodeToMultiByteN(lpName, *lpcbName, 0, NameBuffer, *lpcbName * sizeof(WCHAR));
2513  /* NULL terminate if we can */
2514  if (NameLength > *lpcbName)
2515  lpName[*lpcbName] = '\0';
2516 
2517  if (lpClass)
2518  {
2519  RtlUnicodeToMultiByteN(lpClass, *lpcbClass, 0, NameBuffer, *lpcbClass * sizeof(WCHAR));
2520  if (ClassLength > *lpcbClass)
2521  lpClass[*lpcbClass] = '\0';
2522  }
2523 
2524 Exit:
2525  if (NameBuffer)
2526  RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
2527  if (ClassBuffer)
2528  RtlFreeHeap(RtlGetProcessHeap(), 0, ClassBuffer);
2529 
2530  return ErrorCode;
2531 }
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
_In_ LPCSTR lpName
Definition: winbase.h:2729
#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:585
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:2541

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

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(), GetClassMediaFile(), CQueryAssociations::GetCommand(), 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(), 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().

2550 {
2551  union
2552  {
2554  KEY_BASIC_INFORMATION Basic;
2555  } *KeyInfo;
2556 
2557  ULONG BufferSize;
2558  ULONG ResultSize;
2559  ULONG NameLength;
2560  ULONG ClassLength = 0;
2561  HANDLE KeyHandle;
2563  NTSTATUS Status;
2564 
2565  Status = MapDefaultKey(&KeyHandle,
2566  hKey);
2567  if (!NT_SUCCESS(Status))
2568  {
2569  return RtlNtStatusToDosError(Status);
2570  }
2571 
2572  if (IsHKCRKey(KeyHandle))
2573  {
2574  ErrorCode = EnumHKCRKey(
2575  KeyHandle,
2576  dwIndex,
2577  lpName,
2578  lpcbName,
2579  lpReserved,
2580  lpClass,
2581  lpcbClass,
2582  lpftLastWriteTime);
2583  ClosePredefKey(KeyHandle);
2584  return ErrorCode;
2585  }
2586 
2587  if (*lpcbName > 0)
2588  {
2589  NameLength = min (*lpcbName - 1, REG_MAX_NAME_SIZE) * sizeof (WCHAR);
2590  }
2591  else
2592  {
2593  NameLength = 0;
2594  }
2595 
2596  if (lpClass)
2597  {
2598  if (*lpcbClass > 0)
2599  {
2600  ClassLength = min (*lpcbClass - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR);
2601  }
2602  else
2603  {
2604  ClassLength = 0;
2605  }
2606 
2607  BufferSize = ((sizeof(KEY_NODE_INFORMATION) + NameLength + 3) & ~3) + ClassLength;
2608  }
2609  else
2610  {
2611  BufferSize = sizeof(KEY_BASIC_INFORMATION) + NameLength;
2612  }
2613 
2614  KeyInfo = RtlAllocateHeap(ProcessHeap,
2615  0,
2616  BufferSize);
2617  if (KeyInfo == NULL)
2618  {
2619  ErrorCode = ERROR_OUTOFMEMORY;
2620  goto Cleanup;
2621  }
2622 
2623  Status = NtEnumerateKey(KeyHandle,
2624  (ULONG)dwIndex,
2626  KeyInfo,
2627  BufferSize,
2628  &ResultSize);
2629  TRACE("NtEnumerateKey() returned status 0x%X\n", Status);
2630  if (!NT_SUCCESS(Status))
2631  {
2632  ErrorCode = RtlNtStatusToDosError (Status);
2633  }
2634  else
2635  {
2636  if (lpClass == NULL)
2637  {
2638  if (KeyInfo->Basic.NameLength > NameLength)
2639  {
2640  ErrorCode = ERROR_MORE_DATA;
2641  }
2642  else
2643  {
2645  KeyInfo->Basic.Name,
2646  KeyInfo->Basic.NameLength);
2647  *lpcbName = (DWORD)(KeyInfo->Basic.NameLength / sizeof(WCHAR));
2648  lpName[*lpcbName] = 0;
2649  }
2650  }
2651  else
2652  {
2653  if (KeyInfo->Node.NameLength > NameLength ||
2654  KeyInfo->Node.ClassLength > ClassLength)
2655  {
2656  ErrorCode = ERROR_MORE_DATA;
2657  }
2658  else
2659  {
2661  KeyInfo->Node.Name,
2662  KeyInfo->Node.NameLength);
2663  *lpcbName = KeyInfo->Node.NameLength / sizeof(WCHAR);
2664  lpName[*lpcbName] = 0;
2665  RtlCopyMemory(lpClass,
2666  (PVOID)((ULONG_PTR)KeyInfo->Node.Name + KeyInfo->Node.ClassOffset),
2667  KeyInfo->Node.ClassLength);
2668  *lpcbClass = (DWORD)(KeyInfo->Node.ClassLength / sizeof(WCHAR));
2669  lpClass[*lpcbClass] = 0;
2670  }
2671  }
2672 
2673  if (ErrorCode == ERROR_SUCCESS && lpftLastWriteTime != NULL)
2674  {
2675  if (lpClass == NULL)
2676  {
2677  lpftLastWriteTime->dwLowDateTime = KeyInfo->Basic.LastWriteTime.u.LowPart;
2678  lpftLastWriteTime->dwHighDateTime = KeyInfo->Basic.LastWriteTime.u.HighPart;
2679  }
2680  else
2681  {
2682  lpftLastWriteTime->dwLowDateTime = KeyInfo->Node.LastWriteTime.u.LowPart;
2683  lpftLastWriteTime->dwHighDateTime = KeyInfo->Node.LastWriteTime.u.HighPart;
2684  }
2685  }
2686  }
2687 
2689  0,
2690  KeyInfo);
2691 
2692 Cleanup:
2693  ClosePredefKey(KeyHandle);
2694 
2695  return ErrorCode;
2696 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
#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:4693
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:603
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define WCHAR
Definition: msvc.h:43
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
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:585
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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
union gl_dlist_node Node
Definition: dlist.c:302
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

◆ RegEnumKeyW()

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

Definition at line 2430 of file reg.c.

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().

2434 {
2435  DWORD dwLength;
2436 
2437  dwLength = cbName;
2438  return RegEnumKeyExW(hKey,
2439  dwIndex,
2440  lpName,
2441  &dwLength,
2442  NULL,
2443  NULL,
2444  NULL,
2445  NULL);
2446 }
_In_ LPCSTR lpName
Definition: winbase.h:2729
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:2541

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

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().

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

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

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(), 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(), RefreshListView(), reg_delete(), RegDeleteTreeW(), RegEnumValueA(), RegFindRecurse(), CControlPanelEnum::RegisterRegistryCPanelApps(), RegQueryRegistryValues(), SSOThread::Run(), ScmCopyTree(), SetDefaultPrinterW(), SetSystemEnvironment(), SetUserEnvironment(), SHCopyKeyW(), SHEnumValueW(), SHGetObjectCompatFlags(), SHRegEnumUSValueW(), SQLGetInstalledDriversW(), SQLGetPrivateProfileStringW(), START_TEST(), test_enum_value(), URL_GuessScheme(), and wWinMain().

2876 {
2877  HANDLE KeyHandle;
2878  NTSTATUS status;
2879  ULONG total_size;
2880  char buffer[256], *buf_ptr = buffer;
2882  static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name );
2883 
2884  TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n",
2885  hKey, index, value, val_count, reserved, type, data, count );
2886 
2887  if (!value || !val_count)
2888  return ERROR_INVALID_PARAMETER;
2889 
2890  if ((data && !count) || reserved)
2891  return ERROR_INVALID_PARAMETER;
2892 
2893  status = MapDefaultKey(&KeyHandle, hKey);
2894  if (!NT_SUCCESS(status))
2895  {
2896  return RtlNtStatusToDosError(status);
2897  }
2898 
2899  if (IsHKCRKey(KeyHandle))
2900  {
2902  KeyHandle,
2903  index,
2904  value,
2905  val_count,
2906  reserved,
2907  type,
2908  data,
2909  count);
2910  ClosePredefKey(KeyHandle);
2911  return ErrorCode;
2912  }
2913 
2914  total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR);
2915  if (data) total_size += *count;
2916  total_size = min( sizeof(buffer), total_size );
2917 
2918  status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation,
2919  buffer, total_size, &total_size );
2920  if (status && (status != STATUS_BUFFER_OVERFLOW) && (status != STATUS_BUFFER_TOO_SMALL)) goto done;
2921 
2922  if (value || data)
2923  {
2924  /* retry with a dynamically allocated buffer */
2925  while ((status == STATUS_BUFFER_OVERFLOW) || (status == STATUS_BUFFER_TOO_SMALL))
2926  {
2927  if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
2928  if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size )))
2929  {
2930  status = ERROR_NOT_ENOUGH_MEMORY;
2931  goto done;
2932  }
2933  info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr;
2934  status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation,
2935  buf_ptr, total_size, &total_size );
2936  }
2937 
2938  if (status) goto done;
2939 
2940  if (value)
2941  {
2942  if (info->NameLength/sizeof(WCHAR) >= *val_count)
2943  {
2944  status = STATUS_BUFFER_OVERFLOW;
2945  goto overflow;
2946  }
2947  memcpy( value, info->Name, info->NameLength );
2948  *val_count = info->NameLength / sizeof(WCHAR);
2949  value[*val_count] = 0;
2950  }
2951 
2952  if (data)
2953  {
2954  if (info->DataLength > *count)
2955  {
2956  status = STATUS_BUFFER_OVERFLOW;
2957  goto overflow;
2958  }
2959  memcpy( data, buf_ptr + info->DataOffset, info->DataLength );
2960  if (is_string(info->Type) && info->DataLength <= *count - sizeof(WCHAR))
2961  {
2962  /* if the type is REG_SZ and data is not 0-terminated
2963  * and there is enough space in the buffer NT appends a \0 */
2964  WCHAR *ptr = (WCHAR *)(data + info->DataLength);
2965  if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0;
2966  }
2967  }
2968  }
2969  else status = STATUS_SUCCESS;
2970 
2971  overflow:
2972  if (type) *type = info->Type;
2973  if (count) *count = info->DataLength;
2974 
2975  done:
2976  if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr );
2977  ClosePredefKey(KeyHandle);
2978  return RtlNtStatusToDosError(status);
2979 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
Definition: get.c:139
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4418
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
__wchar_t WCHAR
Definition: xmlstorage.h:180
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 WCHAR
Definition: msvc.h:43
#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:2655
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)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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:2725
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ RegFlushKey()

LONG WINAPI RegFlushKey ( HKEY  hKey)

Definition at line 2988 of file reg.c.

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

2989 {
2990  HANDLE KeyHandle;
2991  NTSTATUS Status;
2992 
2993  if (hKey == HKEY_PERFORMANCE_DATA)
2994  {
2995  return ERROR_SUCCESS;
2996  }
2997 
2998  Status = MapDefaultKey(&KeyHandle,
2999  hKey);
3000  if (!NT_SUCCESS(Status))
3001  {
3002  return RtlNtStatusToDosError(Status);
3003  }
3004 
3005  Status = NtFlushKey(KeyHandle);
3006 
3007  ClosePredefKey(KeyHandle);
3008 
3009  if (!NT_SUCCESS(Status))
3010  {
3011  return RtlNtStatusToDosError(Status);
3012  }
3013 
3014  return ERROR_SUCCESS;
3015 }
#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:4693
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS MapDefaultKey(PHANDLE ParentKey, HKEY Key)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
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

◆ RegGetKeySecurity()

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

Definition at line 3024 of file reg.c.

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

3028 {
3029  HANDLE KeyHandle;
3030  NTSTATUS Status;
3031 
3032  if (hKey == HKEY_PERFORMANCE_DATA)
3033  {
3034  return ERROR_INVALID_HANDLE;
3035  }
3036 
3037  Status = MapDefaultKey(&KeyHandle,
3038  hKey);
3039  if (!NT_SUCCESS(Status))
3040  {
3041  TRACE("MapDefaultKey() failed (Status %lx)\n", Status);
3042  return RtlNtStatusToDosError(Status);
3043  }
3044 
3045  Status = NtQuerySecurityObject(KeyHandle,
3047  pSecurityDescriptor,
3048  *lpcbSecurityDescriptor,
3049  lpcbSecurityDescriptor);
3050 
3051  ClosePredefKey(KeyHandle);
3052 
3053  if (!NT_SUCCESS(Status))
3054  {
3055  WARN("NtQuerySecurityObject() failed (Status %lx)\n", Status);
3056  return RtlNtStatusToDosError(Status);
3057  }
3058 
3059  return ERROR_SUCCESS;
3060 }
#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:4693
#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:24
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

◆ RegGetValueA()

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

Definition at line 2081 of file reg.c.

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

2088 {
2089  DWORD dwType, cbData = pcbData ? *pcbData : 0;
2090  PVOID pvBuf = NULL;
2091  LONG ret;
2092 
2093  TRACE("(%p,%s,%s,%ld,%p,%p,%p=%ld)\n",
2094  hKey, pszSubKey, pszValue, dwFlags, pdwType, pvData, pcbData,
2095  cbData);
2096 
2097  if (pvData && !pcbData)
2098  return ERROR_INVALID_PARAMETER;
2100  ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
2101  return ERROR_INVALID_PARAMETER;
2102 
2103  if (pszSubKey && pszSubKey[0])
2104  {
2105  ret = RegOpenKeyExA(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
2106  if (ret != ERROR_SUCCESS) return ret;
2107  }
2108 
2109  ret = RegQueryValueExA(hKey, pszValue, NULL, &dwType, pvData, &cbData);
2110 
2111  /* If we are going to expand we need to read in the whole the value even
2112  * if the passed buffer was too small as the expanded string might be
2113  * smaller than the unexpanded one and could fit into cbData bytes. */
2114  if ((ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) &&
2115  (dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND)))
2116  {
2117  do {
2118  HeapFree(GetProcessHeap(), 0, pvBuf);
2119 
2120  pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
2121  if (!pvBuf)
2122  {
2124  break;
2125  }
2126 
2127  if (ret == ERROR_MORE_DATA || !pvData)
2128  ret = RegQueryValueExA(hKey, pszValue, NULL,
2129  &dwType, pvBuf, &cbData);
2130  else
2131  {
2132  /* Even if cbData was large enough we have to copy the
2133  * string since ExpandEnvironmentStrings can't handle
2134  * overlapping buffers. */
2135  CopyMemory(pvBuf, pvData, cbData);
2136  }
2137 
2138  /* Both the type or the value itself could have been modified in
2139  * between so we have to keep retrying until the buffer is large
2140  * enough or we no longer have to expand the value. */
2141  } while (dwType == REG_EXPAND_SZ && ret == ERROR_MORE_DATA);
2142 
2143  if (ret == ERROR_SUCCESS)
2144  {
2145  /* Recheck dwType in case it changed since the first call */
2146  if (dwType == REG_EXPAND_SZ)
2147  {
2148  cbData = ExpandEnvironmentStringsA(pvBuf, pvData,
2149  pcbData ? *pcbData : 0);
2150  dwType = REG_SZ;
2151  if(pvData && pcbData && cbData > *pcbData)
2152  ret = ERROR_MORE_DATA;
2153  }
2154  else if (pvData)
2155  CopyMemory(pvData, pvBuf, *pcbData);
2156  }
2157 
2158  HeapFree(GetProcessHeap(), 0, pvBuf);
2159  }
2160 
2161  if (pszSubKey && pszSubKey[0])
2162  RegCloseKey(hKey);
2163 
2164  RegpApplyRestrictions(dwFlags, dwType, cbData, &ret);
2165 
2166  if (pvData && ret != ERROR_SUCCESS && (dwFlags & RRF_ZEROONFAILURE))
2167  ZeroMemory(pvData, *pcbData);
2168 
2169  if (pdwType) *pdwType = dwType;
2170  if (pcbData) *pcbData = cbData;
2171 
2172  return ret;
2173 }
#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:4041
#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:3346
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define RRF_RT_REG_EXPAND_SZ
Definition: driver.c:576
#define ZeroMemory
Definition: winbase.h:1635
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
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:1633
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:1903
#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:4951
#define REG_SZ
Definition: layer.c:22

◆ RegGetValueW()

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

Definition at line 1975 of file reg.c.

Referenced by AddFSClassKeysToArray(), CRegFolderEnum::AddItemsFromKey(), AssocGetPerceivedType(), CDefaultContextMenu::BrowserFlagsFromVerb(), ComponentInfo_GetDWORDValue(), ComponentInfo_GetGUIDValue(), ComponentInfo_GetStringValue(), create_monodata(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), CDrvDefExt::ExtraPageProc(), FILEDLG95_MRU_get_slot(), FILEDLG95_MRU_save_filename(), CDrvDefExt::GeneralPageProc(), get_stringvalue(), GetCLSIDForFileType(), CNetConnectionPropertyUi::GetDeviceInstanceID(), CQueryAssociations::GetString(), HCR_GetClassNameW(), ImmGetIMEFileNameW(), InitializeRecycleBinDlg(), InitIconOverlays(), CFileDefExt::InitOpensWithField(), COpenWithList::IsHidden(), IsNamespaceExtensionHidden(), COpenWithList::Load(), load_config_driver(), load_settings(), COpenWithList::LoadFromProgIdKey(), CNewMenu::LoadItem(), LoadPropSheetHandlers(), COpenWithList::LoadRecommendedFromHKCR(), COpenWithList::LoadRecommendedFromHKCU(), MMDevice_GetPropValue(), msi_check_product_patches(), msi_get_patch_state(), OpenKeyFromFileType(), PixelFormatInfo_GetChannelMask(), read_bitmap_patterns(), read_metadata_patterns(), COpenWithList::SetDefaultHandler(), SHEmptyRecycleBinW(), SQLGetPrivateProfileStringW(), test_BCryptGetFipsAlgorithmMode(), and WshShell3_RegRead().

1982 {
1983  DWORD dwType, cbData = pcbData ? *pcbData : 0;
1984  PVOID pvBuf = NULL;
1985  LONG ret;
1986 
1987  TRACE("(%p,%s,%s,%ld,%p,%p,%p=%ld)\n",
1988  hKey, debugstr_w(pszSubKey), debugstr_w(pszValue), dwFlags, pdwType,
1989  pvData, pcbData, cbData);
1990 
1991  if (pvData && !pcbData)
1992  return ERROR_INVALID_PARAMETER;
1994  ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
1995  return ERROR_INVALID_PARAMETER;
1996 
1997  if (pszSubKey && pszSubKey[0])
1998  {
1999  ret = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
2000  if (ret != ERROR_SUCCESS) return ret;
2001  }
2002 
2003  ret = RegQueryValueExW(hKey, pszValue, NULL, &dwType, pvData, &cbData);
2004 
2005  /* If we are going to expand we need to read in the whole the value even
2006  * if the passed buffer was too small as the expanded string might be
2007  * smaller than the unexpanded one and could fit into cbData bytes. */
2008  if ((ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) &&
2009  dwType == REG_EXPAND_SZ && !(dwFlags & RRF_NOEXPAND))
2010  {
2011  do
2012  {
2013  HeapFree(GetProcessHeap(), 0, pvBuf);
2014 
2015  pvBuf = HeapAlloc(GetProcessHeap(), 0, cbData);
2016  if (!pvBuf)
2017  {
2019  break;
2020  }
2021 
2022  if (ret == ERROR_MORE_DATA || !pvData)
2023  ret = RegQueryValueExW(hKey, pszValue, NULL,
2024  &dwType, pvBuf, &cbData);
2025  else
2026  {
2027  /* Even if cbData was large enough we have to copy the
2028  * string since ExpandEnvironmentStrings can't handle
2029  * overlapping buffers. */
2030  CopyMemory(pvBuf, pvData, cbData);
2031  }
2032 
2033  /* Both the type or the value itself could have been modified in
2034  * between so we have to keep retrying until the buffer is large
2035  * enough or we no longer have to expand the value. */
2036  }
2037  while (dwType == REG_EXPAND_SZ && ret == ERROR_MORE_DATA);
2038 
2039  if (ret == ERROR_SUCCESS)
2040  {
2041  /* Recheck dwType in case it changed since the first call */
2042  if (dwType == REG_EXPAND_SZ)
2043  {
2044  cbData = ExpandEnvironmentStringsW(pvBuf, pvData,
2045  pcbData ? *pcbData : 0) * sizeof(WCHAR);
2046  dwType = REG_SZ;
2047  if (pvData && pcbData && cbData > *pcbData)
2048  ret = ERROR_MORE_DATA;
2049  }
2050  else if (pvData)
2051  CopyMemory(pvData, pvBuf, *pcbData);
2052  }
2053 
2054  HeapFree(GetProcessHeap(), 0, pvBuf);
2055  }
2056 
2057  if (pszSubKey && pszSubKey[0])
2058  RegCloseKey(hKey);
2059 
2060  RegpApplyRestrictions(dwFlags, dwType, cbData, &ret);
2061 
2062  if (pvData && ret != ERROR_SUCCESS && (dwFlags & RRF_ZEROONFAILURE))
2063  ZeroMemory(pvData, *pcbData);
2064 
2065  if (pdwType)
2066  *pdwType = dwType;
2067 
2068  if (pcbData)
2069  *pcbData = cbData;
2070 
2071  return ret;
2072 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define RRF_RT_REG_EXPAND_SZ
Definition: driver.c:576
#define ZeroMemory
Definition: winbase.h:1635
#define WCHAR
Definition: msvc.h:43
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define RRF_ZEROONFAILURE
Definition: driver.c:584
#define CopyMemory
Definition: winbase.h:1633
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
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
static VOID RegpApplyRestrictions(DWORD dwFlags, DWORD dwType, DWORD cbData, PLONG ret)
Definition: reg.c:1903
#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:4951
#define REG_SZ
Definition: layer.c:22

◆ RegInitialize()

BOOL RegInitialize ( VOID  )

Definition at line 70 of file reg.c.

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

71 {
72  TRACE("RegInitialize()\n");
73 
74  /* Lazy init hack */
75  if (!DllInitialized)
76  {
77  ProcessHeap = RtlGetProcessHeap();
79  MAX_DEFAULT_HANDLES * sizeof(HANDLE));
81 
83  }
84 
85  return TRUE;
86 }
#define TRUE
Definition: types.h:120
static BOOLEAN DllInitialized
Definition: reg.c:38
static HANDLE ProcessHeap
Definition: reg.c:35
#define TRACE(s)
Definition: solgame.cpp:4
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static RTL_CRITICAL_SECTION HandleTableCS
Definition: reg.c:33
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static HANDLE DefaultHandleTable[MAX_DEFAULT_HANDLES]
Definition: reg.c:34
#define MAX_DEFAULT_HANDLES
Definition: reg.c:27

◆ RegLoadKeyA()

LONG WINAPI RegLoadKeyA ( HKEY  hKey,
LPCSTR  lpSubKey,