xref: /reactos/base/setup/lib/utils/regutil.h (revision 4567e13e)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Setup Library
4  * FILE:            base/setup/lib/regutil.h
5  * PURPOSE:         Registry utility functions
6  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7  */
8 
9 #pragma once
10 
11 /*
12  * This function is similar to the one in dlls/win32/advapi32/reg/reg.c
13  * TODO: I should review both of them very carefully, because they may need
14  * some adjustments in their NtCreateKey calls, especially for CreateOptions
15  * stuff etc...
16  */
17 NTSTATUS
18 CreateNestedKey(PHANDLE KeyHandle,
19                 ACCESS_MASK DesiredAccess,
20                 POBJECT_ATTRIBUTES ObjectAttributes,
21                 ULONG CreateOptions);
22 
23 /*
24  * Should be called under SE_BACKUP_PRIVILEGE privilege
25  */
26 NTSTATUS
27 CreateRegistryFile(
28     IN PUNICODE_STRING NtSystemRoot,
29     IN PCWSTR RegistryKey,
30     IN BOOLEAN IsHiveNew,
31     IN HANDLE ProtoKeyHandle
32 /*
33     IN PUCHAR Descriptor,
34     IN ULONG DescriptorLength
35 */
36     );
37 
38 /* Adapted from ntoskrnl/config/cmsysini.c:CmpLinkKeyToHive() */
39 NTSTATUS
40 CreateSymLinkKey(
41     IN HANDLE RootKey OPTIONAL,
42     IN PCWSTR LinkKeyName,
43     IN PCWSTR TargetKeyName);
44 
45 NTSTATUS
46 DeleteSymLinkKey(
47     IN HANDLE RootKey OPTIONAL,
48     IN PCWSTR LinkKeyName);
49 
50 /*
51  * Should be called under SE_RESTORE_PRIVILEGE privilege
52  */
53 NTSTATUS
54 ConnectRegistry(
55     IN HANDLE RootKey OPTIONAL,
56     IN PCWSTR RegMountPoint,
57     // IN HANDLE RootDirectory OPTIONAL,
58     IN PUNICODE_STRING NtSystemRoot,
59     IN PCWSTR RegistryKey
60 /*
61     IN PUCHAR Descriptor,
62     IN ULONG DescriptorLength
63 */
64     );
65 
66 /*
67  * Should be called under SE_RESTORE_PRIVILEGE privilege
68  */
69 NTSTATUS
70 DisconnectRegistry(
71     IN HANDLE RootKey OPTIONAL,
72     IN PCWSTR RegMountPoint,
73     IN ULONG Flags);
74 
75 /*
76  * Should be called under SE_RESTORE_PRIVILEGE privilege
77  */
78 NTSTATUS
79 VerifyRegistryHive(
80     // IN HANDLE RootKey OPTIONAL,
81     // // IN HANDLE RootDirectory OPTIONAL,
82     IN PUNICODE_STRING NtSystemRoot,
83     IN PCWSTR RegistryKey /* ,
84     IN PCWSTR RegMountPoint */);
85 
86 /* EOF */
87