ObjFW  Check-in [e8ae6a2ca1]

Overview
Comment:OFWindowsRegistryKey: Allow retrieving the type
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e8ae6a2ca1511cb22b7dd991fb29e1172bf3baa0743b682bb6c7f4d294a7dc4d
User & Date: js on 2018-07-10 20:44:30
Other Links: manifest | tags
Context
2018-07-10
21:09
OFWindowsRegistryKey: Add convenience methods check-in: 710622bc64 user: js tags: trunk
20:44
OFWindowsRegistryKey: Allow retrieving the type check-in: e8ae6a2ca1 user: js tags: trunk
2018-07-09
00:22
Add OFWindowsRegistryKey check-in: 5586022d34 user: js tags: trunk
Changes

Modified src/OFWindowsRegistryKey.h from [428ab2c96c] to [277603e273].

105
106
107
108
109
110
111

112
113
114
115
116

117
118
119

/*!
 * @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.

 * @return The string for the specified value
 */
- (nullable OFString *)stringForValue: (nullable OFString *)value
			   subKeyPath: (nullable OFString *)subKeyPath
				flags: (DWORD)flags;

@end

OF_ASSUME_NONNULL_END







>




|
>



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

/*!
 * @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;
@end

OF_ASSUME_NONNULL_END

Modified src/OFWindowsRegistryKey.m from [8b00d015e4] to [1ce505ad65].

143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
							close: true]
	    autorelease];
}

- (OFString *)stringForValue: (OFString *)value
		  subKeyPath: (OFString *)subKeyPath
		       flags: (DWORD)flags

{
	void *pool = objc_autoreleasePoolPush();
	of_char16_t stackBuffer[256], *buffer = stackBuffer;
	DWORD length = sizeof(stackBuffer);
	LSTATUS status;
	OFString *ret;

	if ((status = RegGetValueW(_hKey, [subKeyPath UTF16String],
	    [value UTF16String], flags | RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ,
	    NULL, buffer, &length)) != ERROR_SUCCESS) {
		OFObject *tmp;

		if (status == ERROR_FILE_NOT_FOUND) {
			objc_autoreleasePoolPop(pool);
			return nil;
		}








>









|







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
							close: true]
	    autorelease];
}

- (OFString *)stringForValue: (OFString *)value
		  subKeyPath: (OFString *)subKeyPath
		       flags: (DWORD)flags
			type: (LPDWORD)type
{
	void *pool = objc_autoreleasePoolPush();
	of_char16_t stackBuffer[256], *buffer = stackBuffer;
	DWORD length = sizeof(stackBuffer);
	LSTATUS status;
	OFString *ret;

	if ((status = RegGetValueW(_hKey, [subKeyPath UTF16String],
	    [value UTF16String], flags | RRF_RT_REG_SZ | RRF_RT_REG_EXPAND_SZ,
	    type, buffer, &length)) != ERROR_SUCCESS) {
		OFObject *tmp;

		if (status == ERROR_FILE_NOT_FOUND) {
			objc_autoreleasePoolPop(pool);
			return nil;
		}