Overview
Comment: | OFWindowsRegistryKey: Throw on non-existing subkey |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
215aa66007a92177b5ee401630c7984a |
User & Date: | js on 2022-07-01 10:34:50 |
Other Links: | manifest | tags |
Context
2022-07-09
| ||
18:02 | Fix OFWindowsRegistryKeyTests check-in: b33e210a7d user: js tags: trunk | |
2022-07-01
| ||
10:34 | OFWindowsRegistryKey: Throw on non-existing subkey check-in: 215aa66007 user: js tags: trunk | |
10:19 | OFWindowsRegistryKey: Support for DWORDs/QWORDs check-in: 111c97b5b3 user: js tags: trunk | |
Changes
Modified src/OFWindowsRegistryKey.h from [65a8b2cfd8] to [c114c8ff33].
︙ | ︙ | |||
72 73 74 75 76 77 78 | /** * @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` | | < | | | < | | | | 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 | /** * @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 */ - (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 */ - (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()` |
︙ | ︙ |
Modified src/OFWindowsRegistryKey.m from [74c71171af] to [d93d6521e9].
︙ | ︙ | |||
112 113 114 115 116 117 118 | status = RegOpenKeyExW(_hKey, path.UTF16String, options, securityAndAccessRights, &subKey); else status = RegOpenKeyExA(_hKey, [path cStringWithEncoding: [OFLocale encoding]], options, securityAndAccessRights, &subKey); | | < < < < < < | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | status = RegOpenKeyExW(_hKey, path.UTF16String, options, securityAndAccessRights, &subKey); else status = RegOpenKeyExA(_hKey, [path cStringWithEncoding: [OFLocale encoding]], options, securityAndAccessRights, &subKey); if (status != ERROR_SUCCESS) @throw [OFOpenWindowsRegistryKeyFailedException exceptionWithRegistryKey: self path: path options: options securityAndAccessRights: securityAndAccessRights status: status]; objc_autoreleasePoolPop(pool); return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey close: true] autorelease]; } |
︙ | ︙ | |||
369 370 371 372 373 374 375 | - (uint32_t)DWORDForValueNamed: (OFString *)name { void *pool = objc_autoreleasePoolPush(); DWORD type, ret; OFData *data = [self dataForValueNamed: name type: &type]; if (data == nil) | < | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | - (uint32_t)DWORDForValueNamed: (OFString *)name { void *pool = objc_autoreleasePoolPush(); DWORD type, ret; OFData *data = [self dataForValueNamed: name type: &type]; if (data == nil) @throw [OFUndefinedKeyException exceptionWithObject: self key: name value: nil]; if (type != REG_DWORD) @throw [OFInvalidEncodingException exception]; |
︙ | ︙ | |||
403 404 405 406 407 408 409 | { void *pool = objc_autoreleasePoolPush(); DWORD type; uint64_t ret; OFData *data = [self dataForValueNamed: name type: &type]; if (data == nil) | < | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | { void *pool = objc_autoreleasePoolPush(); DWORD type; uint64_t ret; OFData *data = [self dataForValueNamed: name type: &type]; if (data == nil) @throw [OFUndefinedKeyException exceptionWithObject: self key: name value: nil]; if (type != REG_QWORD) @throw [OFInvalidEncodingException exception]; |
︙ | ︙ |