Modified src/OFObject.h
from [b61464d46f]
to [81f633ed2d].
︙ | | | ︙ | |
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include <stdbool.h>
#include <limits.h>
#import "macros.h"
#import "autorelease.h"
#import "block.h"
OF_ASSUME_NONNULL_BEGIN
/*! @file */
/*!
* @brief A result of a comparison.
*/
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include <stdbool.h>
#include <limits.h>
#import "macros.h"
#import "autorelease.h"
#import "block.h"
/*
* Some versions of MinGW require <winsock2.h> to be included before
* <windows.h>. Do this here to make sure this is always done in the correct
* order, even if another header includes just <windows.h>.
*/
#ifdef __MINGW32__
# include <_mingw.h>
# ifdef __MINGW64_VERSION_MAJOR
# include <winsock2.h>
# include <windows.h>
# endif
#endif
OF_ASSUME_NONNULL_BEGIN
/*! @file */
/*!
* @brief A result of a comparison.
*/
|
︙ | | | ︙ | |
Modified src/OFWindowsRegistryKey.h
from [e752ad4a7b]
to [9fac5d4d25].
︙ | | | ︙ | |
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Opens the subkey at the specified path.
*
* @param path The path of the subkey to open
* @param securityAndAccessRights Please refer to the `RegOpenKeyEx()`
* documentation
* @return The subkey with the specified path, or nil if it does not exist
*/
- (nullable OFWindowsRegistryKey *)
openSubKeyWithPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights;
/*!
* @brief Opens the subkey at the specified path.
*
* @param path The path of the subkey to open
* @param options Please refer to the `RegOpenKeyEx()` documentation. Usually 0.
* @param securityAndAccessRights Please refer to the `RegOpenKeyEx()`
* documentation
* @return The subkey with the specified path, or nil if it does not exist
*/
- (nullable OFWindowsRegistryKey *)
openSubKeyWithPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights;
/*!
* @brief Creates a subkey at the specified path or opens it if it already
* exists.
*
* @param path The path of the subkey to create
* @param securityAndAccessRights Please refer to the `RegCreateKeyEx()`
* documentation
* @return The subkey with the specified path
*/
- (OFWindowsRegistryKey *)
createSubKeyWithPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights;
/*!
* @brief Creates a subkey at the specified path or opens it if it already
* exists.
*
* @param path The path of the subkey to create
* @param options Please refer to the `RegCreateKeyEx()` documentation.
* Usually 0.
* @param securityAndAccessRights Please refer to the `RegCreateKeyEx()`
* documentation
* @param securityAttributes Please refer to the `RegCreateKeyEx()`
* documentation. Usually NULL.
* @param disposition Whether the key was created or already existed. Please
* refer to the `RegCreateKeyEx()` documentation.
* @return The subkey with the specified path
*/
- (OFWindowsRegistryKey *)
createSubKeyWithPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights
securityAttributes: (nullable LPSECURITY_ATTRIBUTES)securityAttributes
disposition: (nullable LPDWORD)disposition;
/*!
* @brief Returns the string for the specified value at the specified path.
*
* @param value The name of the value to return
* @param subkeyPath The path of the key from which to retrieve the value
* @return The string for the specified value
*/
- (nullable OFString *)stringForValue: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath;
/*!
* @brief Returns the data for the specified value at the specified path.
*
* @param value The name of the value to return
* @param subkeyPath The path of the key from which to retrieve the value
* @param flags Extra flags for `RegGetValue()`. Usually 0.
* @param type A pointer to store the type of the value, or NULL
* @return The data for the specified value
*/
- (nullable OFData *)dataForValue: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
type: (nullable LPDWORD)type;
@end
OF_ASSUME_NONNULL_END
|
|
|
|
>
|
|
|
|
<
|
|
|
>
|
>
|
<
<
<
<
<
<
<
<
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Opens the subkey at the specified path.
*
* @param path The path of the subkey to open
* @param securityAndAccessRights Please refer to the `RegOpenKeyEx()`
* documentation for `samDesired`
* @return The subkey with the specified path, or nil if it does not exist
*/
- (nullable OFWindowsRegistryKey *)
openSubkeyAtPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights;
/*!
* @brief Opens the subkey at the specified path.
*
* @param path The path of the subkey to open
* @param options Please refer to the `RegOpenKeyEx()` documentation for
* `ulOptions`. Usually 0.
* @param securityAndAccessRights Please refer to the `RegOpenKeyEx()`
* documentation for `samDesired`
* @return The subkey with the specified path, or nil if it does not exist
*/
- (nullable OFWindowsRegistryKey *)
openSubkeyAtPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights;
/*!
* @brief Creates a subkey at the specified path or opens it if it already
* exists.
*
* @param path The path of the subkey to create
* @param securityAndAccessRights Please refer to the `RegCreateKeyEx()`
* documentation for `samDesired`
* @return The subkey with the specified path
*/
- (OFWindowsRegistryKey *)createSubkeyAtPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights;
/*!
* @brief Creates a subkey at the specified path or opens it if it already
* exists.
*
* @param path The path of the subkey to create
* @param options Please refer to the `RegCreateKeyEx()` documentation.
* Usually 0.
* @param securityAndAccessRights Please refer to the `RegCreateKeyEx()`
* documentation for `samDesired`
* @param securityAttributes Please refer to the `RegCreateKeyEx()`
* documentation for `lpSecurityAttributes`. Usually
* NULL.
* @param disposition Whether the key was created or already existed. Please
* refer to the `RegCreateKeyEx()` documentation for
* `lpdwDisposition`.
* @return The subkey with the specified path
*/
- (OFWindowsRegistryKey *)
createSubkeyAtPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights
securityAttributes: (nullable LPSECURITY_ATTRIBUTES)securityAttributes
disposition: (nullable LPDWORD)disposition;
/*!
* @brief Returns the data for the specified value at the specified path.
*
* @param value The name of the value to return
* @param subkeyPath The path of the key from which to retrieve the value
* @param flags Extra flags for `RegGetValue()`. Usually 0.
* @param type A pointer to store the type of the value, or NULL
* @return The data for the specified value
*/
- (nullable OFData *)dataForValue: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
type: (nullable LPDWORD)type;
/*!
* @brief Sets the data for the specified value.
*
* @param data The data to set the value to
* @param value The name of the value to set
* @param type The type for the value
*/
- (void)setData: (nullable OFData *)data
forValue: (nullable OFString *)value
type: (DWORD)type;
/*!
* @brief Returns the string for the specified value at the specified path.
*
* @param value The name of the value to return
* @param subkeyPath The path of the key from which to retrieve the value
* @return The string for the specified value
*/
- (nullable OFString *)stringForValue: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath;
/*!
* @brief Returns the string for the specified value at the specified path.
*
* @param value The name of the value to return
* @param subkeyPath The path of the key from which to retrieve the value
* @param flags Extra flags for `RegGetValue()`. Usually 0.
* @param type A pointer to store the type of the value, or NULL
* @return The string for the specified value
*/
- (nullable OFString *)stringForValue: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
type: (nullable LPDWORD)type;
/*!
* @brief Sets the string for the specified value.
*
* @param string The string to set the value to
* @param value The name of the value to set
*/
- (void)setString: (nullable OFString *)string
forValue: (nullable OFString *)value;
/*!
* @brief Sets the string for the specified value.
*
* @param string The string to set the value to
* @param value The name of the value to set
* @param type The type for the value
*/
- (void)setString: (nullable OFString *)string
forValue: (nullable OFString *)value
type: (DWORD)type;
/*!
* @brief Deletes the specified value.
*
* @param value The value to delete
*/
- (void)deleteValue: (nullable OFString *)value;
/*!
* @brief Deletes the specified subkey.
*
* @param subkeyPath The path of the subkey to delete
*/
- (void)deleteSubkeyAtPath: (OFString *)subkeyPath;
@end
OF_ASSUME_NONNULL_END
|
Modified src/OFWindowsRegistryKey.m
from [d4e7766886]
to [393e6cb19f].
︙ | | | ︙ | |
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#import "OFWindowsRegistryKey.h"
#import "OFData.h"
#include <windows.h>
#import "OFCreateWindowsRegistryKeyFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFOpenWindowsRegistryKeyFailedException.h"
#import "OFReadWindowsRegistryValueFailedException.h"
@interface OFWindowsRegistryKey ()
- (instancetype)of_initWithHKey: (HKEY)hKey
close: (bool)close;
@end
@implementation OFWindowsRegistryKey
|
>
>
>
>
|
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#import "OFWindowsRegistryKey.h"
#import "OFData.h"
#include <windows.h>
#import "OFCreateWindowsRegistryKeyFailedException.h"
#import "OFDeleteWindowsRegistryKeyFailedException.h"
#import "OFDeleteWindowsRegistryValueFailedException.h"
#import "OFGetWindowsRegistryValueFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFOpenWindowsRegistryKeyFailedException.h"
#import "OFOutOfRangeException.h"
#import "OFSetWindowsRegistryValueFailedException.h"
@interface OFWindowsRegistryKey ()
- (instancetype)of_initWithHKey: (HKEY)hKey
close: (bool)close;
@end
@implementation OFWindowsRegistryKey
|
︙ | | | ︙ | |
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
{
if (_close)
RegCloseKey(_hKey);
[super dealloc];
}
- (OFWindowsRegistryKey *)openSubKeyWithPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights
{
return [self openSubKeyWithPath: path
options: 0
securityAndAccessRights: securityAndAccessRights];
}
- (OFWindowsRegistryKey *)openSubKeyWithPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights
{
void *pool = objc_autoreleasePoolPush();
LSTATUS status;
HKEY subKey;
if ((status = RegOpenKeyExW(_hKey, [path UTF16String], options,
securityAndAccessRights, &subKey)) != ERROR_SUCCESS) {
|
|
|
|
|
|
|
|
|
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
{
if (_close)
RegCloseKey(_hKey);
[super dealloc];
}
- (OFWindowsRegistryKey *)openSubkeyAtPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights
{
return [self openSubkeyAtPath: path
options: 0
securityAndAccessRights: securityAndAccessRights];
}
- (OFWindowsRegistryKey *)openSubkeyAtPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights
{
void *pool = objc_autoreleasePoolPush();
LSTATUS status;
HKEY subKey;
if ((status = RegOpenKeyExW(_hKey, [path UTF16String], options,
securityAndAccessRights, &subKey)) != ERROR_SUCCESS) {
|
︙ | | | ︙ | |
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
objc_autoreleasePoolPop(pool);
return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey
close: true]
autorelease];
}
- (OFWindowsRegistryKey *)
createSubKeyWithPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights
{
return [self createSubKeyWithPath: path
options: 0
securityAndAccessRights: securityAndAccessRights
securityAttributes: NULL
disposition: NULL];
}
- (OFWindowsRegistryKey *)
createSubKeyWithPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights
securityAttributes: (LPSECURITY_ATTRIBUTES)securityAttributes
disposition: (LPDWORD)disposition
{
void *pool = objc_autoreleasePoolPush();
LSTATUS status;
|
|
<
|
|
|
|
|
|
|
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
objc_autoreleasePoolPop(pool);
return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey
close: true]
autorelease];
}
- (OFWindowsRegistryKey *)createSubkeyAtPath: (OFString *)path
securityAndAccessRights: (REGSAM)securityAndAccessRights
{
return [self createSubkeyAtPath: path
options: 0
securityAndAccessRights: securityAndAccessRights
securityAttributes: NULL
disposition: NULL];
}
- (OFWindowsRegistryKey *)
createSubkeyAtPath: (OFString *)path
options: (DWORD)options
securityAndAccessRights: (REGSAM)securityAndAccessRights
securityAttributes: (LPSECURITY_ATTRIBUTES)securityAttributes
disposition: (LPDWORD)disposition
{
void *pool = objc_autoreleasePoolPush();
LSTATUS status;
|
︙ | | | ︙ | |
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
objc_autoreleasePoolPop(pool);
return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey
close: true]
autorelease];
}
- (OFString *)stringForValue: (OFString *)value
subkeyPath: (OFString *)subkeyPath
{
void *pool = objc_autoreleasePoolPush();
OFData *data = [self dataForValue: value
subkeyPath: subkeyPath
flags: RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ
type: NULL];
const of_char16_t *UTF16String;
size_t length;
OFString *ret;
if (data == nil)
return nil;
UTF16String = [data items];
length = [data count];
if ([data itemSize] != 1 || length % 2 == 1)
@throw [OFInvalidFormatException exception];
length /= 2;
/*
* REG_SZ and REG_EXPAND_SZ contain a \0, but can contain data after it
* that should be ignored.
*/
for (size_t i = 0; i < length; i++) {
if (UTF16String[i] == 0) {
length = i;
break;
}
}
ret = [[OFString alloc] initWithUTF16String: UTF16String
length: length];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
- (OFData *)dataForValue: (OFString *)value
subkeyPath: (OFString *)subkeyPath
flags: (DWORD)flags
type: (LPDWORD)type
{
void *pool = objc_autoreleasePoolPush();
char stackBuffer[256], *buffer = stackBuffer;
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
objc_autoreleasePoolPop(pool);
return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey
close: true]
autorelease];
}
- (OFData *)dataForValue: (OFString *)value
subkeyPath: (OFString *)subkeyPath
flags: (DWORD)flags
type: (LPDWORD)type
{
void *pool = objc_autoreleasePoolPush();
char stackBuffer[256], *buffer = stackBuffer;
|
︙ | | | ︙ | |
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
ret = [OFMutableData dataWithCapacity: length];
[ret increaseCountBy: length];
buffer = [ret items];
continue;
default:
@throw [OFReadWindowsRegistryValueFailedException
exceptionWithRegistryKey: self
value: value
subkeyPath: subkeyPath
flags: flags
status: status];
}
}
}
@end
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
ret = [OFMutableData dataWithCapacity: length];
[ret increaseCountBy: length];
buffer = [ret items];
continue;
default:
@throw [OFGetWindowsRegistryValueFailedException
exceptionWithRegistryKey: self
value: value
subkeyPath: subkeyPath
flags: flags
status: status];
}
}
}
- (void)setData: (OFData *)data
forValue: (OFString *)value
type: (DWORD)type
{
size_t length = [data count] * [data itemSize];
LSTATUS status;
if (length > UINT32_MAX)
@throw [OFOutOfRangeException exception];
if ((status = RegSetValueExW(_hKey, [value UTF16String], 0, type,
[data items], (DWORD)length)) != ERROR_SUCCESS)
@throw [OFSetWindowsRegistryValueFailedException
exceptionWithRegistryKey: self
value: value
data: data
type: type
status: status];
}
- (OFString *)stringForValue: (OFString *)value
subkeyPath: (OFString *)subkeyPath
{
return [self stringForValue: value
subkeyPath: subkeyPath
flags: RRF_RT_REG_SZ
type: NULL];
}
- (OFString *)stringForValue: (OFString *)value
subkeyPath: (OFString *)subkeyPath
flags: (DWORD)flags
type: (LPDWORD)type
{
void *pool = objc_autoreleasePoolPush();
OFData *data = [self dataForValue: value
subkeyPath: subkeyPath
flags: flags
type: type];
const of_char16_t *UTF16String;
size_t length;
OFString *ret;
if (data == nil)
return nil;
UTF16String = [data items];
length = [data count];
if ([data itemSize] != 1 || length % 2 == 1)
@throw [OFInvalidFormatException exception];
length /= 2;
/*
* REG_SZ and REG_EXPAND_SZ contain a \0, but can contain data after it
* that should be ignored.
*/
for (size_t i = 0; i < length; i++) {
if (UTF16String[i] == 0) {
length = i;
break;
}
}
ret = [[OFString alloc] initWithUTF16String: UTF16String
length: length];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
- (void)setString: (OFString *)string
forValue: (OFString *)value
{
[self setString: string
forValue: value
type: REG_SZ];
}
- (void)setString: (OFString *)string
forValue: (OFString *)value
type: (DWORD)type
{
void *pool = objc_autoreleasePoolPush();
OFData *data;
data = [OFData dataWithItems: [string UTF16String]
itemSize: sizeof(of_char16_t)
count: [string UTF16StringLength] + 1];
[self setData: data
forValue: value
type: type];
objc_autoreleasePoolPop(pool);
}
- (void)deleteValue: (OFString *)value
{
void *pool = objc_autoreleasePoolPush();
LSTATUS status;
if ((status = RegDeleteValueW(_hKey, [value UTF16String])) !=
ERROR_SUCCESS)
@throw [OFDeleteWindowsRegistryValueFailedException
exceptionWithRegistryKey: self
value: value
status: status];
objc_autoreleasePoolPop(pool);
}
- (void)deleteSubkeyAtPath: (OFString *)subkeyPath
{
void *pool = objc_autoreleasePoolPush();
LSTATUS status;
if ((status = RegDeleteKeyW(_hKey, [subkeyPath UTF16String])) !=
ERROR_SUCCESS)
@throw [OFDeleteWindowsRegistryKeyFailedException
exceptionWithRegistryKey: self
subkeyPath: subkeyPath
status: status];
objc_autoreleasePoolPop(pool);
}
@end
|
Modified src/ObjFW.h
from [cbd434e22c]
to [51f4765bba].
︙ | | | ︙ | |
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# import "OFConnectionFailedException.h"
#endif
#import "OFCopyItemFailedException.h"
#import "OFCreateDirectoryFailedException.h"
#import "OFCreateSymbolicLinkFailedException.h"
#ifdef OF_WINDOWS
# import "OFCreateWindowsRegistryKeyFailedException.h"
#endif
#import "OFEnumerationMutationException.h"
#ifdef OF_HAVE_FILES
# import "OFGetCurrentDirectoryPathFailedException.h"
#endif
#import "OFGetOptionFailedException.h"
#import "OFHashAlreadyCalculatedException.h"
#ifdef OF_HAVE_SOCKETS
# import "OFHTTPRequestFailedException.h"
#endif
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
|
>
>
>
>
>
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# import "OFConnectionFailedException.h"
#endif
#import "OFCopyItemFailedException.h"
#import "OFCreateDirectoryFailedException.h"
#import "OFCreateSymbolicLinkFailedException.h"
#ifdef OF_WINDOWS
# import "OFCreateWindowsRegistryKeyFailedException.h"
# import "OFDeleteWindowsRegistryKeyFailedException.h"
# import "OFDeleteWindowsRegistryValueFailedException.h"
#endif
#import "OFEnumerationMutationException.h"
#ifdef OF_HAVE_FILES
# import "OFGetCurrentDirectoryPathFailedException.h"
#endif
#import "OFGetOptionFailedException.h"
#ifdef OF_WINDOWS
# import "OFGetWindowsRegistryValueFailedException.h"
#endif
#import "OFHashAlreadyCalculatedException.h"
#ifdef OF_HAVE_SOCKETS
# import "OFHTTPRequestFailedException.h"
#endif
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
|
︙ | | | ︙ | |
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
#ifdef OF_WINDOWS
# import "OFOpenWindowsRegistryKeyFailedException.h"
#endif
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFReadOrWriteFailedException.h"
#ifdef OF_WINDOWS
# import "OFReadWindowsRegistryValueFailedException.h"
#endif
#import "OFRemoveItemFailedException.h"
#import "OFRetrieveItemAttributesFailedException.h"
#import "OFSandboxActivationFailedException.h"
#import "OFSeekFailedException.h"
#import "OFSetItemAttributesFailedException.h"
#import "OFSetOptionFailedException.h"
#import "OFStillLockedException.h"
#ifdef OF_HAVE_THREADS
# import "OFThreadJoinFailedException.h"
# import "OFThreadStartFailedException.h"
# import "OFThreadStillRunningException.h"
#endif
#import "OFTruncatedDataException.h"
|
<
<
<
>
>
>
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
#ifdef OF_WINDOWS
# import "OFOpenWindowsRegistryKeyFailedException.h"
#endif
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFReadOrWriteFailedException.h"
#import "OFRemoveItemFailedException.h"
#import "OFRetrieveItemAttributesFailedException.h"
#import "OFSandboxActivationFailedException.h"
#import "OFSeekFailedException.h"
#import "OFSetItemAttributesFailedException.h"
#import "OFSetOptionFailedException.h"
#ifdef OF_WINDOWS
# import "OFSetWindowsRegistryValueFailedException.h"
#endif
#import "OFStillLockedException.h"
#ifdef OF_HAVE_THREADS
# import "OFThreadJoinFailedException.h"
# import "OFThreadStartFailedException.h"
# import "OFThreadStillRunningException.h"
#endif
#import "OFTruncatedDataException.h"
|
︙ | | | ︙ | |
Modified src/exceptions/Makefile
from [761d7b910a]
to [78ae506a77].
︙ | | | ︙ | |
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
OFConditionSignalFailedException.m \
OFConditionStillWaitingException.m \
OFConditionWaitFailedException.m \
OFThreadJoinFailedException.m \
OFThreadStartFailedException.m \
OFThreadStillRunningException.m
SRCS_WINDOWS = OFCreateWindowsRegistryKeyFailedException.m \
OFOpenWindowsRegistryKeyFailedException.m \
OFReadWindowsRegistryValueFailedException.m
INCLUDES = ${SRCS:.m=.h}
include ../../buildsys.mk
CPPFLAGS += -I. -I.. -I../.. -I../runtime
|
>
>
>
|
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
OFConditionSignalFailedException.m \
OFConditionStillWaitingException.m \
OFConditionWaitFailedException.m \
OFThreadJoinFailedException.m \
OFThreadStartFailedException.m \
OFThreadStillRunningException.m
SRCS_WINDOWS = OFCreateWindowsRegistryKeyFailedException.m \
OFDeleteWindowsRegistryKeyFailedException.m \
OFDeleteWindowsRegistryValueFailedException.m \
OFGetWindowsRegistryValueFailedException.m \
OFOpenWindowsRegistryKeyFailedException.m \
OFSetWindowsRegistryValueFailedException.m
INCLUDES = ${SRCS:.m=.h}
include ../../buildsys.mk
CPPFLAGS += -I. -I.. -I../.. -I../runtime
|
Modified src/exceptions/OFCreateWindowsRegistryKeyFailedException.m
from [26992d06a4]
to [4d64ce1c37].
︙ | | | ︙ | |
77
78
79
80
81
82
83
84
85
86
87
|
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to create subkey at path %@: Status code %u!",
_path, _status];
}
@end
|
|
|
|
77
78
79
80
81
82
83
84
85
86
87
|
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to create subkey at path %@: %@",
_path, of_windows_status_to_string(_status)];
}
@end
|
Added src/exceptions/OFDeleteWindowsRegistryKeyFailedException.h version [30f1f9897a].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFException.h"
#import "OFWindowsRegistryKey.h"
#include <windows.h>
OF_ASSUME_NONNULL_BEGIN
/*!
* @class OFDeleteWindowsRegistryKeyFailedException \
* OFDeleteWindowsRegistryKeyFailedException.h \
* ObjFW/OFDeleteWindowsRegistryKeyFailedException.h
*
* @brief An exception indicating that deleting a Windows registry key failed.
*/
@interface OFDeleteWindowsRegistryKeyFailedException: OFException
{
OFWindowsRegistryKey *_registryKey;
OFString *_subkeyPath;
LSTATUS _status;
}
/*!
* @brief The registry key on which deleting the subkey failed.
*/
@property (readonly, nonatomic) OFWindowsRegistryKey *registryKey;
/*!
* @brief The path of the subkey which could not be deleted.
*/
@property (readonly, nonatomic) OFString *subkeyPath;
/*!
* @brief The status returned by RegDeleteKeyEx().
*/
@property (readonly, nonatomic) LSTATUS status;
/*!
* @brief Creates a new, autoreleased delete Windows registry key failed
* exception.
*
* @param registryKey The registry key on which deleting the subkey failed
* @param subkeyPath The path of the subkey which could not be deleted
* @param status The status returned by RegDeleteKeyEx()
* @return A new, autoreleased delete Windows registry key failed exception
*/
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
subkeyPath: (OFString *)subkeyPath
status: (LSTATUS)status;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Initializes an already allocated delete Windows registry key failed
* exception.
*
* @param registryKey The registry key on which deleting the subkey failed
* @param subkeyPath The path of the subkey which could not be deleted
* @param status The status returned by RegDeleteKeyEx()
* @return An initialized delete Windows registry key failed exception
*/
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
subkeyPath: (OFString *)subkeyPath
status: (LSTATUS)status OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
Added src/exceptions/OFDeleteWindowsRegistryKeyFailedException.m version [e183cbe5dc].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFDeleteWindowsRegistryKeyFailedException.h"
#import "OFData.h"
@implementation OFDeleteWindowsRegistryKeyFailedException
@synthesize registryKey = _registryKey, subkeyPath = _subkeyPath;
@synthesize status = _status;
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
subkeyPath: (OFString *)subkeyPath
status: (LSTATUS)status
{
return [[[self alloc] initWithRegistryKey: registryKey
subkeyPath: subkeyPath
status: status] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
subkeyPath: (OFString *)subkeyPath
status: (LSTATUS)status
{
self = [super init];
@try {
_registryKey = [registryKey retain];
_subkeyPath = [subkeyPath copy];
_status = status;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_registryKey release];
[_subkeyPath release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to delete subkey at path %@: %@",
_subkeyPath, of_windows_status_to_string(_status)];
}
@end
|
Added src/exceptions/OFDeleteWindowsRegistryValueFailedException.h version [7c523a0131].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFException.h"
#import "OFWindowsRegistryKey.h"
#include <windows.h>
OF_ASSUME_NONNULL_BEGIN
/*!
* @class OFDeleteWindowsRegistryValueFailedException \
* OFDeleteWindowsRegistryValueFailedException.h \
* ObjFW/OFDeleteWindowsRegistryValueFailedException.h
*
* @brief An exception indicating that deleting a Windows registry value failed.
*/
@interface OFDeleteWindowsRegistryValueFailedException: OFException
{
OFWindowsRegistryKey *_registryKey;
OFString *_Nullable _value;
LSTATUS _status;
}
/*!
* @brief The registry key on which deleting the value failed.
*/
@property (readonly, nonatomic) OFWindowsRegistryKey *registryKey;
/*!
* @brief The value which could not be deleted.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *value;
/*!
* @brief The status returned by RegDeleteValueEx().
*/
@property (readonly, nonatomic) LSTATUS status;
/*!
* @brief Creates a new, autoreleased delete Windows registry value failed
* exception.
*
* @param registryKey The registry key on which deleting the value failed
* @param value The value which could not be deleted
* @param status The status returned by RegDeleteValueEx()
* @return A new, autoreleased delete Windows registry value failed exception
*/
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
status: (LSTATUS)status;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Initializes an already allocated delete Windows registry value failed
* exception.
*
* @param registryKey The registry key on which deleting the value failed
* @param value The value which could not be deleted
* @param status The status returned by RegDeleteValueEx()
* @return An initialized delete Windows registry value failed exception
*/
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
status: (LSTATUS)status OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
Added src/exceptions/OFDeleteWindowsRegistryValueFailedException.m version [6e05c014fd].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFDeleteWindowsRegistryValueFailedException.h"
#import "OFData.h"
@implementation OFDeleteWindowsRegistryValueFailedException
@synthesize registryKey = _registryKey, value = _value, status = _status;
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (OFString *)value
status: (LSTATUS)status
{
return [[[self alloc] initWithRegistryKey: registryKey
value: value
status: status] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (OFString *)value
status: (LSTATUS)status
{
self = [super init];
@try {
_registryKey = [registryKey retain];
_value = [value copy];
_status = status;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_registryKey release];
[_value release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to delete value %@: %@",
_value, of_windows_status_to_string(_status)];
}
@end
|
Modified src/exceptions/OFException.h
from [fea3f53592]
to [ebba9465c8].
︙ | | | ︙ | |
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFObject.h"
OF_ASSUME_NONNULL_BEGIN
@class OFArray OF_GENERIC(ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFString;
|
>
>
>
>
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFObject.h"
#ifdef OF_WINDOWS
# include <windows.h>
#endif
OF_ASSUME_NONNULL_BEGIN
@class OFArray OF_GENERIC(ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFString;
|
︙ | | | ︙ | |
169
170
171
172
173
174
175
176
177
178
179
180
|
- (nullable OFArray OF_GENERIC(OFString *) *)backtrace;
@end
#ifdef __cplusplus
extern "C" {
#endif
extern OFString *of_strerror(int errNo);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|
>
>
>
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
- (nullable OFArray OF_GENERIC(OFString *) *)backtrace;
@end
#ifdef __cplusplus
extern "C" {
#endif
extern OFString *of_strerror(int errNo);
#ifdef OF_WINDOWS
extern OFString *of_windows_status_to_string(LSTATUS status);
#endif
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|
Modified src/exceptions/OFException.m
from [9c72a41f8e]
to [168ff4f79b].
︙ | | | ︙ | |
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
@throw [OFUnlockFailedException exception];
}
# endif
#endif
return ret;
}
#ifdef HAVE__UNWIND_BACKTRACE
static _Unwind_Reason_Code
backtrace_callback(struct _Unwind_Context *ctx, void *data)
{
struct backtrace_ctx *bt = data;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
@throw [OFUnlockFailedException exception];
}
# endif
#endif
return ret;
}
#ifdef OF_WINDOWS
OFString *
of_windows_status_to_string(LSTATUS status)
{
void *buffer;
OFString *string;
if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, status, 0, (LPWSTR)&buffer, 0,
NULL) != 0) {
@try {
string = [OFString stringWithUTF16String: buffer];
} @finally {
LocalFree(buffer);
}
} else
string = [OFString stringWithFormat: @"Status code %u", status];
return string;
}
#endif
#ifdef HAVE__UNWIND_BACKTRACE
static _Unwind_Reason_Code
backtrace_callback(struct _Unwind_Context *ctx, void *data)
{
struct backtrace_ctx *bt = data;
|
︙ | | | ︙ | |
Added src/exceptions/OFGetWindowsRegistryValueFailedException.h version [121d7bf3eb].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFException.h"
#import "OFWindowsRegistryKey.h"
#include <windows.h>
OF_ASSUME_NONNULL_BEGIN
/*!
* @class OFGetWindowsRegistryValueFailedException \
* OFGetWindowsRegistryValueFailedException.h \
* ObjFW/OFGetWindowsRegistryValueFailedException.h
*
* @brief An exception indicating that getting a Windows registry value failed.
*/
@interface OFGetWindowsRegistryValueFailedException: OFException
{
OFWindowsRegistryKey *_registryKey;
OFString *_Nullable _value, *_Nullable _subkeyPath;
DWORD _flags;
LSTATUS _status;
}
/*!
* @brief The registry key on which getting the value at the key path failed.
*/
@property (readonly, nonatomic) OFWindowsRegistryKey *registryKey;
/*!
* @brief The value which could not be retrieved.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *value;
/*!
* @brief The subkey path at which getting the value failed.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *subkeyPath;
/*!
* @brief The flags with which getting the value failed.
*/
@property (readonly, nonatomic) DWORD flags;
/*!
* @brief The status returned by RegGetValueEx().
*/
@property (readonly, nonatomic) LSTATUS status;
/*!
* @brief Creates a new, autoreleased get Windows registry value failed
* exception.
*
* @param registryKey The registry key on which getting the value at the sub
* key path failed
* @param value The value which could not be retrieved
* @param subkeyPath The subkey path at which getting the value failed
* @param flags The flags with which getting the value failed
* @param status The status returned by RegGetValueEx()
* @return A new, autoreleased get Windows registry value failed exception
*/
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Initializes an already allocated get Windows registry value failed
* exception.
*
* @param registryKey The registry key on which getting the value at the sub
* key path failed
* @param value The value which could not be retrieved
* @param subkeyPath The subkey path at which getting the value failed
* @param flags The flags with which getting the value failed
* @param status The status returned by RegGetValueEx()
* @return An initialized get Windows registry value failed exception
*/
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
Added src/exceptions/OFGetWindowsRegistryValueFailedException.m version [632c3fd548].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFGetWindowsRegistryValueFailedException.h"
@implementation OFGetWindowsRegistryValueFailedException
@synthesize registryKey = _registryKey, value = _value;
@synthesize subkeyPath = _subkeyPath, flags = _flags, status = _status;
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (OFString *)value
subkeyPath: (OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status
{
return [[[self alloc] initWithRegistryKey: registryKey
value: value
subkeyPath: subkeyPath
flags: flags
status: status] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (OFString *)value
subkeyPath: (OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status
{
self = [super init];
@try {
_registryKey = [registryKey retain];
_value = [value copy];
_subkeyPath = [subkeyPath copy];
_flags = flags;
_status = status;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_registryKey release];
[_value release];
[_subkeyPath release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to get value %@ at subkey path %@: %@",
_value, _subkeyPath, of_windows_status_to_string(_status)];
}
@end
|
Modified src/exceptions/OFOpenWindowsRegistryKeyFailedException.m
from [1c8f2244f2]
to [d20d506b04].
︙ | | | ︙ | |
73
74
75
76
77
78
79
80
81
82
83
|
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to open subkey at path %@: Status code %u!",
_path, _status];
}
@end
|
|
|
|
73
74
75
76
77
78
79
80
81
82
83
|
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to open subkey at path %@: %@",
_path, of_windows_status_to_string(_status)];
}
@end
|
Deleted src/exceptions/OFReadWindowsRegistryValueFailedException.h version [aa62c3dfb2].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFException.h"
#import "OFWindowsRegistryKey.h"
#include <windows.h>
OF_ASSUME_NONNULL_BEGIN
/*!
* @class OFReadWindowsRegistryValueFailedException \
* OFReadWindowsRegistryValueFailedException.h \
* ObjFW/OFReadWindowsRegistryValueFailedException.h
*
* @brief An exception indicating that reading a Windows registry value failed.
*/
@interface OFReadWindowsRegistryValueFailedException: OFException
{
OFWindowsRegistryKey *_registryKey;
OFString *_Nullable _value, *_Nullable _subkeyPath;
DWORD _flags;
LSTATUS _status;
}
/*!
* @brief The registry key on which reading the value at the key path failed.
*/
@property (readonly, nonatomic) OFWindowsRegistryKey *registryKey;
/*!
* @brief The value for which reading failed.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *value;
/*!
* @brief The subkey path at which reading the value failed.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *subkeyPath;
/*!
* @brief The flags with which reading the value failed.
*/
@property (readonly, nonatomic) DWORD flags;
/*!
* @brief The status returned by RegGetValueEx().
*/
@property (readonly, nonatomic) LSTATUS status;
/*!
* @brief Creates a new, autoreleased read Windows registry value failed
* exception.
*
* @param registryKey The registry key on which reading the value at the sub
* key path failed
* @param value The value for which reading failed
* @param subkeyPath The subkey path at which reading the value failed
* @param flags The flags with which reading the value failed
* @param status The status returned by RegGetValueEx()
* @return A new, autoreleased read Windows registry value failed exception
*/
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Initializes an already allocated read Windows registry value failed
* exception.
*
* @param registryKey The registry key on which reading the value at the sub
* key path failed
* @param value The value for which reading failed
* @param subkeyPath The subkey path at which reading the value failed
* @param flags The flags with which reading the value failed
* @param status The status returned by RegGetValueEx()
* @return An initialized read Windows registry value failed exception
*/
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
Deleted src/exceptions/OFReadWindowsRegistryValueFailedException.m version [e8e1f7712a].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFReadWindowsRegistryValueFailedException.h"
@implementation OFReadWindowsRegistryValueFailedException
@synthesize registryKey = _registryKey, value = _value;
@synthesize subkeyPath = _subkeyPath, flags = _flags, status = _status;
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status
{
return [[[self alloc] initWithRegistryKey: registryKey
value: value
subkeyPath: subkeyPath
flags: flags
status: status] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
subkeyPath: (nullable OFString *)subkeyPath
flags: (DWORD)flags
status: (LSTATUS)status
{
self = [super init];
@try {
_registryKey = [registryKey retain];
_value = [value copy];
_subkeyPath = [subkeyPath copy];
_flags = flags;
_status = status;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_registryKey release];
[_value release];
[_subkeyPath release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to read value %@ at subkey path %@: Status code %u!",
_value, _subkeyPath, _status];
}
@end
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
Added src/exceptions/OFSetWindowsRegistryValueFailedException.h version [0bcbc634fb].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFException.h"
#import "OFWindowsRegistryKey.h"
#include <windows.h>
OF_ASSUME_NONNULL_BEGIN
/*!
* @class OFSetWindowsRegistryValueFailedException \
* OFSetWindowsRegistryValueFailedException.h \
* ObjFW/OFSetWindowsRegistryValueFailedException.h
*
* @brief An exception indicating that setting a Windows registry value failed.
*/
@interface OFSetWindowsRegistryValueFailedException: OFException
{
OFWindowsRegistryKey *_registryKey;
OFString *_Nullable _value;
OFData *_Nullable _data;
DWORD _type;
LSTATUS _status;
}
/*!
* @brief The registry key on which setting the value failed.
*/
@property (readonly, nonatomic) OFWindowsRegistryKey *registryKey;
/*!
* @brief The value which could not be set.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *value;
/*!
* @brief The data to which the value could not be set.
*/
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFData *data;
/*!
* @brief The type for the value that could not be set.
*/
@property (readonly, nonatomic) DWORD type;
/*!
* @brief The status returned by RegSetValueEx().
*/
@property (readonly, nonatomic) LSTATUS status;
/*!
* @brief Creates a new, autoreleased set Windows registry value failed
* exception.
*
* @param registryKey The registry key on which setting the value failed
* @param value The value which could not be set
* @param data The data to which the value could not be set
* @param type The type for the value that could not be set
* @param status The status returned by RegSetValueEx()
* @return A new, autoreleased set Windows registry value failed exception
*/
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
data: (nullable OFData *)data
type: (DWORD)type
status: (LSTATUS)status;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Initializes an already allocated set Windows registry value failed
* exception.
*
* @param registryKey The registry key on which setting the value failed
* @param value The value which could not be set
* @param data The data to which the value could not be set
* @param type The type for the value that could not be set
* @param status The status returned by RegSetValueEx()
* @return An initialized set Windows registry value failed exception
*/
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (nullable OFString *)value
data: (nullable OFData *)data
type: (DWORD)type
status: (LSTATUS)status OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
Added src/exceptions/OFSetWindowsRegistryValueFailedException.m version [d9423d7851].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFSetWindowsRegistryValueFailedException.h"
#import "OFData.h"
@implementation OFSetWindowsRegistryValueFailedException
@synthesize registryKey = _registryKey, value = _value, data = _data;
@synthesize type = _type, status = _status;
+ (instancetype)exceptionWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (OFString *)value
data: (OFData *)data
type: (DWORD)type
status: (LSTATUS)status
{
return [[[self alloc] initWithRegistryKey: registryKey
value: value
data: data
type: type
status: status] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithRegistryKey: (OFWindowsRegistryKey *)registryKey
value: (OFString *)value
data: (OFData *)data
type: (DWORD)type
status: (LSTATUS)status
{
self = [super init];
@try {
_registryKey = [registryKey retain];
_value = [value copy];
_data = [data copy];
_type = type;
_status = status;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_registryKey release];
[_value release];
[_data release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to set value %@ of type %u: %@",
_value, _type, of_windows_status_to_string(_status)];
}
@end
|
Modified src/socket.h
from [e3ee93c786]
to [2b0e7e9e52].
︙ | | | ︙ | |
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#include "platform.h"
#ifdef OF_WINDOWS
# ifdef __MINGW32__
# include <_mingw.h>
# ifdef __MINGW64_VERSION_MAJOR
# include <winsock2.h>
# endif
# endif
# include <windows.h>
# include <ws2tcpip.h>
#endif
/*! @file */
#ifdef OF_MORPHOS
|
<
<
<
<
<
<
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#ifdef OF_HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#include "platform.h"
#ifdef OF_WINDOWS
# include <windows.h>
# include <ws2tcpip.h>
#endif
/*! @file */
#ifdef OF_MORPHOS
|
︙ | | | ︙ | |
Modified src/threading.h
from [005e79a6d9]
to [dfd5b7db22].
︙ | | | ︙ | |
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
typedef pthread_t of_thread_t;
typedef pthread_key_t of_tlskey_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_cond_t of_condition_t;
typedef pthread_once_t of_once_t;
# define OF_ONCE_INIT PTHREAD_ONCE_INIT
#elif defined(OF_WINDOWS)
/*
* winsock2.h needs to be included before windows.h. Not including it here
* would make it impossible to use sockets after threading.h has been
* imported.
*/
# ifdef OF_HAVE_SOCKETS
# include <winsock2.h>
# endif
# include <windows.h>
typedef HANDLE of_thread_t;
typedef DWORD of_tlskey_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef struct {
HANDLE event;
int count;
|
<
<
<
<
<
<
<
<
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
typedef pthread_t of_thread_t;
typedef pthread_key_t of_tlskey_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_cond_t of_condition_t;
typedef pthread_once_t of_once_t;
# define OF_ONCE_INIT PTHREAD_ONCE_INIT
#elif defined(OF_WINDOWS)
# include <windows.h>
typedef HANDLE of_thread_t;
typedef DWORD of_tlskey_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef struct {
HANDLE event;
int count;
|
︙ | | | ︙ | |
Modified tests/Makefile
from [bfd5569012]
to [90c0cff21c].
︙ | | | ︙ | |
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
PBKDF2Tests.m \
RuntimeTests.m \
ScryptTests.m \
TestsAppDelegate.m \
${USE_SRCS_FILES} \
${USE_SRCS_PLUGINS} \
${USE_SRCS_SOCKETS} \
${USE_SRCS_THREADS}
SRCS_FILES = OFHMACTests.m \
OFINIFileTests.m \
OFMD5HashTests.m \
OFRIPEMD160HashTests.m \
OFSerializationTests.m \
OFSHA1HashTests.m \
OFSHA224HashTests.m \
OFSHA256HashTests.m \
OFSHA384HashTests.m \
OFSHA512HashTests.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFDNSResolverTests.m \
${OFHTTPCLIENTTESTS_M} \
OFHTTPCookieTests.m \
OFHTTPCookieManagerTests.m \
OFKernelEventObserverTests.m \
OFTCPSocketTests.m \
OFUDPSocketTests.m \
SocketTests.m
SRCS_THREADS = OFThreadTests.m
IOS_USER ?= mobile
IOS_TMP ?= /tmp/objfw-test
include ../buildsys.mk
post-all: ${RUN_TESTS}
|
|
>
>
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
PBKDF2Tests.m \
RuntimeTests.m \
ScryptTests.m \
TestsAppDelegate.m \
${USE_SRCS_FILES} \
${USE_SRCS_PLUGINS} \
${USE_SRCS_SOCKETS} \
${USE_SRCS_THREADS} \
${USE_SRCS_WINDOWS}
SRCS_FILES = OFHMACTests.m \
OFINIFileTests.m \
OFMD5HashTests.m \
OFRIPEMD160HashTests.m \
OFSerializationTests.m \
OFSHA1HashTests.m \
OFSHA224HashTests.m \
OFSHA256HashTests.m \
OFSHA384HashTests.m \
OFSHA512HashTests.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFDNSResolverTests.m \
${OFHTTPCLIENTTESTS_M} \
OFHTTPCookieTests.m \
OFHTTPCookieManagerTests.m \
OFKernelEventObserverTests.m \
OFTCPSocketTests.m \
OFUDPSocketTests.m \
SocketTests.m
SRCS_THREADS = OFThreadTests.m
SRCS_WINDOWS = OFWindowsRegistryKeyTests.m
IOS_USER ?= mobile
IOS_TMP ?= /tmp/objfw-test
include ../buildsys.mk
post-all: ${RUN_TESTS}
|
︙ | | | ︙ | |
Modified tests/OFArrayTests.m
from [d25eebe497]
to [95d9e60793].
︙ | | | ︙ | |
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
[[a[0] objectAtIndex: 2] isEqual: c_ary[2]] &&
[[a[1] objectAtIndex: 0] isEqual: c_ary[0]] &&
[[a[1] objectAtIndex: 1] isEqual: c_ary[1]] &&
[[a[1] objectAtIndex: 2] isEqual: c_ary[2]])
TEST(@"-[containsObject:]",
[a[0] containsObject: c_ary[1]] &&
![a[0] containsObject: @"nonexistant"])
TEST(@"-[containsObjectIdenticalTo:]",
[a[0] containsObjectIdenticalTo: c_ary[1]] &&
![a[0] containsObjectIdenticalTo:
[OFString stringWithString: c_ary[1]]])
TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1)
|
|
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
[[a[0] objectAtIndex: 2] isEqual: c_ary[2]] &&
[[a[1] objectAtIndex: 0] isEqual: c_ary[0]] &&
[[a[1] objectAtIndex: 1] isEqual: c_ary[1]] &&
[[a[1] objectAtIndex: 2] isEqual: c_ary[2]])
TEST(@"-[containsObject:]",
[a[0] containsObject: c_ary[1]] &&
![a[0] containsObject: @"nonexistent"])
TEST(@"-[containsObjectIdenticalTo:]",
[a[0] containsObjectIdenticalTo: c_ary[1]] &&
![a[0] containsObjectIdenticalTo:
[OFString stringWithString: c_ary[1]]])
TEST(@"-[indexOfObject:]", [a[0] indexOfObject: c_ary[1]] == 1)
|
︙ | | | ︙ | |
Modified tests/OFDictionaryTests.m
from [50c573af26]
to [c9013fa964].
︙ | | | ︙ | |
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
EXPECT_EXCEPTION(@"Catching -[setValue:forKey:] on immutable "
@"dictionary", OFUndefinedKeyException,
[[dictionaryClass dictionary] setValue: @"x"
forKey: @"x"])
TEST(@"-[containsObject:]",
[mutDict containsObject: values[0]] &&
![mutDict containsObject: @"nonexistant"])
TEST(@"-[containsObjectIdenticalTo:]",
[mutDict containsObjectIdenticalTo: values[0]] &&
![mutDict containsObjectIdenticalTo:
[OFString stringWithString: values[0]]])
TEST(@"-[description]",
|
|
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
EXPECT_EXCEPTION(@"Catching -[setValue:forKey:] on immutable "
@"dictionary", OFUndefinedKeyException,
[[dictionaryClass dictionary] setValue: @"x"
forKey: @"x"])
TEST(@"-[containsObject:]",
[mutDict containsObject: values[0]] &&
![mutDict containsObject: @"nonexistent"])
TEST(@"-[containsObjectIdenticalTo:]",
[mutDict containsObjectIdenticalTo: values[0]] &&
![mutDict containsObjectIdenticalTo:
[OFString stringWithString: values[0]]])
TEST(@"-[description]",
|
︙ | | | ︙ | |
Modified tests/OFListTests.m
from [2139933e28]
to [691f37d095].
︙ | | | ︙ | |
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
afterListObject: [list firstListObject]->next] &&
[[list lastListObject]->object isEqual: strings[2]])
TEST(@"-[count]", [list count] == 3)
TEST(@"-[containsObject:]",
[list containsObject: strings[1]] &&
![list containsObject: @"nonexistant"])
TEST(@"-[containsObjectIdenticalTo:]",
[list containsObjectIdenticalTo: strings[1]] &&
![list containsObjectIdenticalTo:
[OFString stringWithString: strings[1]]])
TEST(@"-[copy]", (list = [[list copy] autorelease]) &&
|
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
afterListObject: [list firstListObject]->next] &&
[[list lastListObject]->object isEqual: strings[2]])
TEST(@"-[count]", [list count] == 3)
TEST(@"-[containsObject:]",
[list containsObject: strings[1]] &&
![list containsObject: @"nonexistent"])
TEST(@"-[containsObjectIdenticalTo:]",
[list containsObjectIdenticalTo: strings[1]] &&
![list containsObjectIdenticalTo:
[OFString stringWithString: strings[1]]])
TEST(@"-[copy]", (list = [[list copy] autorelease]) &&
|
︙ | | | ︙ | |
Added tests/OFWindowsRegistryKeyTests.m version [f053bc7fab].
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFWindowsRegistryKey.h"
#import "OFData.h"
#import "OFAutoreleasePool.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFWindowsRegistryKey";
@implementation TestsAppDelegate (OFWindowsRegistryKeyTests)
- (void)windowsRegistryKeyTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFData *data = [OFData dataWithItems: "abcdef"
count: 6];
OFWindowsRegistryKey *softwareKey, *ObjFWKey;
DWORD type;
OFString *string;
TEST(@"+[OFWindowsRegistryKey classesRootKey]",
[OFWindowsRegistryKey classesRootKey])
TEST(@"+[OFWindowsRegistryKey currentConfigKey]",
[OFWindowsRegistryKey currentConfigKey])
TEST(@"+[OFWindowsRegistryKey currentUserKey]",
[OFWindowsRegistryKey currentUserKey])
TEST(@"+[OFWindowsRegistryKey localMachineKey]",
[OFWindowsRegistryKey localMachineKey])
TEST(@"+[OFWindowsRegistryKey usersKey]",
[OFWindowsRegistryKey usersKey])
TEST(@"-[openSubkeyAtPath:securityAndAccessRights:]",
(softwareKey = [[OFWindowsRegistryKey currentUserKey]
openSubkeyAtPath: @"Software"
securityAndAccessRights: KEY_ALL_ACCESS]) &&
[[OFWindowsRegistryKey currentUserKey]
openSubkeyAtPath: @"nonexistent"
securityAndAccessRights: KEY_ALL_ACCESS] == nil)
TEST(@"-[createSubkeyAtPath:securityAndAccessRights:]",
(ObjFWKey = [softwareKey createSubkeyAtPath: @"ObjFW"
securityAndAccessRights: KEY_ALL_ACCESS]))
TEST(@"-[setData:forValue:type:]",
R([ObjFWKey setData: data
forValue: @"data"
type: REG_BINARY]))
TEST(@"-[dataForValue:subkeyPath:flags:type:]",
[[softwareKey dataForValue: @"data"
subkeyPath: @"ObjFW"
flags: RRF_RT_REG_BINARY
type: &type] isEqual: data] &&
type == REG_BINARY)
TEST(@"-[setString:forValue:type:]",
R([ObjFWKey setString: @"foobar"
forValue: @"string"]) &&
R([ObjFWKey setString: @"%PATH%;foo"
forValue: @"expand"
type: REG_EXPAND_SZ]))
TEST(@"-[stringForValue:subkeyPath:]",
[[softwareKey stringForValue: @"string"
subkeyPath: @"ObjFW"] isEqual: @"foobar"] &&
[[softwareKey stringForValue: @"expand"
subkeyPath: @"ObjFW"
flags: RRF_RT_REG_EXPAND_SZ | RRF_NOEXPAND
type: &type] isEqual: @"%PATH%;foo"] &&
type == REG_EXPAND_SZ &&
(string = [ObjFWKey stringForValue: @"expand"
subkeyPath: nil]) &&
![string isEqual: @"%PATH%;foo"] &&
[string hasSuffix: @";foo"])
TEST(@"-[deleteValue:]", R([ObjFWKey deleteValue: @"data"]))
TEST(@"-[deleteSubkeyAtPath:]",
R([softwareKey deleteSubkeyAtPath: @"ObjFW"]))
[pool drain];
}
@end
|
Modified tests/RuntimeTests.m
from [02c8b72579]
to [5f5cb31934].
︙ | | | ︙ | |
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
@implementation TestsAppDelegate (RuntimeTests)
- (void)runtimeTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
RuntimeTest *rt = [[[RuntimeTest alloc] init] autorelease];
OFString *t, *foo;
EXPECT_EXCEPTION(@"Calling a non-existant method via super",
OFNotImplementedException, [rt superTest])
TEST(@"Calling a method via a super with self == nil",
[rt nilSuperTest] == nil)
t = [OFMutableString stringWithString: @"foo"];
foo = @"foo";
|
|
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
@implementation TestsAppDelegate (RuntimeTests)
- (void)runtimeTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
RuntimeTest *rt = [[[RuntimeTest alloc] init] autorelease];
OFString *t, *foo;
EXPECT_EXCEPTION(@"Calling a non-existent method via super",
OFNotImplementedException, [rt superTest])
TEST(@"Calling a method via a super with self == nil",
[rt nilSuperTest] == nil)
t = [OFMutableString stringWithString: @"foo"];
foo = @"foo";
|
︙ | | | ︙ | |
Modified tests/TestsAppDelegate.h
from [a00c4cc310]
to [2ad1959841].
︙ | | | ︙ | |
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
@interface TestsAppDelegate (OFURLTests)
- (void)URLTests;
@end
@interface TestsAppDelegate (OFValueTests)
- (void)valueTests;
@end
@interface TestsAppDelegate (OFXMLElementBuilderTests)
- (void)XMLElementBuilderTests;
@end
@interface TestsAppDelegate (OFXMLNodeTests)
- (void)XMLNodeTests;
|
>
>
>
>
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
@interface TestsAppDelegate (OFURLTests)
- (void)URLTests;
@end
@interface TestsAppDelegate (OFValueTests)
- (void)valueTests;
@end
@interface TestsAppDelegate (OFWindowsRegistryKeyTests)
- (void)windowsRegistryKeyTests;
@end
@interface TestsAppDelegate (OFXMLElementBuilderTests)
- (void)XMLElementBuilderTests;
@end
@interface TestsAppDelegate (OFXMLNodeTests)
- (void)XMLNodeTests;
|
︙ | | | ︙ | |
Modified tests/TestsAppDelegate.m
from [df82488231]
to [feef55dc03].
︙ | | | ︙ | |
438
439
440
441
442
443
444
445
446
447
448
449
450
451
|
#endif
[self JSONTests];
[self propertyListTests];
[self ASN1DERValueTests];
#if defined(OF_HAVE_PLUGINS)
[self pluginTests];
#endif
#ifdef OF_HAVE_SOCKETS
[self DNSResolverTests];
#endif
[self systemInfoTests];
[self localeTests];
|
>
>
>
|
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
#endif
[self JSONTests];
[self propertyListTests];
[self ASN1DERValueTests];
#if defined(OF_HAVE_PLUGINS)
[self pluginTests];
#endif
#ifdef OF_WINDOWS
[self windowsRegistryKeyTests];
#endif
#ifdef OF_HAVE_SOCKETS
[self DNSResolverTests];
#endif
[self systemInfoTests];
[self localeTests];
|
︙ | | | ︙ | |