ObjFW  Diff

Differences From Artifact [c6d5abaa71]:

To Artifact [752886f486]:


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







-
-



-
+





-
-
+
+








	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;
	BYTE stackBuffer[256], *buffer = stackBuffer;
	DWORD length = sizeof(stackBuffer);
	OFMutableData *ret = nil;
	LSTATUS status;

	for (;;) {
		status = RegGetValueW(_hKey, subkeyPath.UTF16String,
		    value.UTF16String, flags, type, buffer, &length);
		status = RegQueryValueExW(_hKey, value.UTF16String, NULL, type,
		    buffer, &length);

		switch (status) {
		case ERROR_SUCCESS:
			if (buffer == stackBuffer) {
				objc_autoreleasePoolPop(pool);

				return [OFData dataWithItems: buffer
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
209
210
211
212
213
214
215


216
217
218
219
220
221
222







-
-







			buffer = ret.mutableItems;

			continue;
		default:
			@throw [OFGetWindowsRegistryValueFailedException
			    exceptionWithRegistryKey: self
					       value: value
					  subkeyPath: subkeyPath
					       flags: flags
					      status: status];
		}
	}
}

- (void)setData: (OFData *)data
       forValue: (OFString *)value
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
235
236
237
238
239
240
241

242
243


244
245
246
247


248
249
250
251


252
253
254
255
256
257
258







-


-
-




-
-




-
-







				       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;