Differences From Artifact [c6d5abaa71]:
- File src/OFWindowsRegistryKey.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 8550) [annotate] [blame] [check-ins using] [more...]
To Artifact [752886f486]:
- File
src/OFWindowsRegistryKey.m
— part of check-in
[94f1f0f479]
at
2020-04-21 22:47:25
on branch trunk
— OFWindowsRegistryKey: Compatibility with Win XP
This requires a slight API change to OFWindowsRegistryKey, as the
previous API was depending on RegGetValueW(), which is not available on
Windows XP. (user: js, size: 8189) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
165 166 167 168 169 170 171 | return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey close: true] autorelease]; } - (OFData *)dataForValue: (OFString *)value | < < | | | | 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 type: (LPDWORD)type { void *pool = objc_autoreleasePoolPush(); BYTE stackBuffer[256], *buffer = stackBuffer; DWORD length = sizeof(stackBuffer); OFMutableData *ret = nil; LSTATUS status; for (;;) { 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 | buffer = ret.mutableItems; continue; default: @throw [OFGetWindowsRegistryValueFailedException exceptionWithRegistryKey: self value: value | < < | 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 status: status]; } } } - (void)setData: (OFData *)data forValue: (OFString *)value |
︙ | ︙ | |||
239 240 241 242 243 244 245 | value: value data: data type: type status: status]; } - (OFString *)stringForValue: (OFString *)value | < < < < < < < | 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 { return [self stringForValue: value type: NULL]; } - (OFString *)stringForValue: (OFString *)value type: (LPDWORD)type { void *pool = objc_autoreleasePoolPush(); OFData *data = [self dataForValue: value type: type]; const of_char16_t *UTF16String; size_t length; OFString *ret; if (data == nil) return nil; |
︙ | ︙ |