ObjFW
OFWindowsRegistryKey.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFString.h"
18 
19 #include <windows.h>
20 
21 OF_ASSUME_NONNULL_BEGIN
22 
23 @class OFData;
24 
29 OF_SUBCLASSING_RESTRICTED
30 @interface OFWindowsRegistryKey: OFObject
31 {
32  HKEY _hKey;
33  bool _close;
34 }
35 
41 + (instancetype)classesRootKey;
42 
48 + (instancetype)currentConfigKey;
49 
55 + (instancetype)currentUserKey;
56 
62 + (instancetype)localMachineKey;
63 
69 + (instancetype)usersKey;
70 
71 - (instancetype)init OF_UNAVAILABLE;
72 
81 - (nullable OFWindowsRegistryKey *)
82  openSubkeyAtPath: (OFString *)path
83  securityAndAccessRights: (REGSAM)securityAndAccessRights;
84 
95 - (nullable OFWindowsRegistryKey *)
96  openSubkeyAtPath: (OFString *)path
97  options: (DWORD)options
98  securityAndAccessRights: (REGSAM)securityAndAccessRights;
99 
109 - (OFWindowsRegistryKey *)createSubkeyAtPath: (OFString *)path
110  securityAndAccessRights: (REGSAM)securityAndAccessRights;
111 
129 - (OFWindowsRegistryKey *)
130  createSubkeyAtPath: (OFString *)path
131  options: (DWORD)options
132  securityAndAccessRights: (REGSAM)securityAndAccessRights
133  securityAttributes: (nullable SECURITY_ATTRIBUTES *)securityAttributes
134  disposition: (nullable DWORD *)disposition;
135 
143 - (nullable OFData *)dataForValueNamed: (nullable OFString *)name
144  type: (nullable DWORD *)type;
145 
153 - (void)setData: (nullable OFData *)data
154  forValueNamed: (nullable OFString *)name
155  type: (DWORD)type;
156 
163 - (nullable OFString *)stringForValueNamed: (nullable OFString *)name;
164 
172 - (nullable OFString *)stringForValueNamed: (nullable OFString *)name
173  type: (nullable DWORD *)type;
174 
181 - (void)setString: (nullable OFString *)string
182  forValueNamed: (nullable OFString *)name;
183 
191 - (void)setString: (nullable OFString *)string
192  forValueNamed: (nullable OFString *)name
193  type: (DWORD)type;
194 
200 - (void)deleteValueNamed: (nullable OFString *)name;
201 
207 - (void)deleteSubkeyAtPath: (OFString *)subkeyPath;
208 @end
209 
210 OF_ASSUME_NONNULL_END
A class for storing arbitrary data in an array.
Definition: OFData.h:40
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A class for handling strings.
Definition: OFString.h:132