ReactOS 0.4.15-dev-7924-g5949c20
registry.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for registry.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

LSTATUS WINAPI RegCopyTreeW (_In_ HKEY, _In_opt_ LPCWSTR, _In_ HKEY)
 
static BOOL CopyKey (HKEY hDstKey, HKEY hSrcKey)
 
BOOL CreateUserHive (LPCWSTR lpKeyName, LPCWSTR lpProfilePath)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 29 of file registry.c.

Function Documentation

◆ CopyKey()

static BOOL CopyKey ( HKEY  hDstKey,
HKEY  hSrcKey 
)
static

Definition at line 38 of file registry.c.

40{
41 LONG Error;
42
43 Error = RegCopyTreeW(hSrcKey,
44 NULL,
45 hDstKey);
46 if (Error != ERROR_SUCCESS)
47 {
49 return FALSE;
50 }
51
52 return TRUE;
53}
BOOL Error
Definition: chkdsk.c:66
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
LSTATUS WINAPI RegCopyTreeW(_In_ HKEY, _In_opt_ LPCWSTR, _In_ HKEY)
unsigned long DWORD
Definition: ntddk_ex.h:95
long LONG
Definition: pedump.c:60

Referenced by CreateUserHive().

◆ CreateUserHive()

BOOL CreateUserHive ( LPCWSTR  lpKeyName,
LPCWSTR  lpProfilePath 
)

Definition at line 57 of file registry.c.

59{
60 HKEY hDefaultKey = NULL;
61 HKEY hUserKey = NULL;
62 LONG Error;
63 BOOL Ret = FALSE;
64
65 DPRINT("CreateUserHive(%S) called\n", lpKeyName);
66
68 L".Default",
69 0,
71 &hDefaultKey);
72 if (Error != ERROR_SUCCESS)
73 {
75 goto Cleanup;
76 }
77
79 lpKeyName,
80 0,
82 &hUserKey);
83 if (Error != ERROR_SUCCESS)
84 {
86 goto Cleanup;
87 }
88
89 if (!CopyKey(hUserKey, hDefaultKey))
90 {
91 goto Cleanup;
92 }
93
94 if (!UpdateUsersShellFolderSettings(lpProfilePath,
95 hUserKey))
96 {
97 goto Cleanup;
98 }
99
100 RegFlushKey(hUserKey);
101 Ret = TRUE;
102
103Cleanup:
104 if (hUserKey != NULL)
105 RegCloseKey (hUserKey);
106
107 if (hDefaultKey != NULL)
108 RegCloseKey (hDefaultKey);
109
110 return Ret;
111}
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2951
BOOL UpdateUsersShellFolderSettings(LPCWSTR lpUserProfilePath, HKEY hUserKey)
Definition: setup.c:434
static BOOL CopyKey(HKEY hDstKey, HKEY hSrcKey)
Definition: registry.c:38
static const WCHAR Cleanup[]
Definition: register.c:80
unsigned int BOOL
Definition: ntddk_ex.h:94
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
#define DPRINT
Definition: sndvol32.h:71
#define HKEY_USERS
Definition: winreg.h:13

Referenced by CreateUserProfileExW().

◆ RegCopyTreeW()

LSTATUS WINAPI RegCopyTreeW ( _In_  HKEY,
_In_opt_  LPCWSTR,
_In_  HKEY 
)

Referenced by CopyKey().