Index: src/OFWindowsRegistryKey.h ================================================================== --- src/OFWindowsRegistryKey.h +++ src/OFWindowsRegistryKey.h @@ -74,30 +74,28 @@ * @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 + * @return The subkey with the specified path */ -- (nullable OFWindowsRegistryKey *) - openSubkeyAtPath: (OFString *)path - securityAndAccessRights: (REGSAM)securityAndAccessRights; +- (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 + * @return The subkey with the specified path */ -- (nullable OFWindowsRegistryKey *) - openSubkeyAtPath: (OFString *)path - options: (DWORD)options - securityAndAccessRights: (REGSAM)securityAndAccessRights; +- (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. * Index: src/OFWindowsRegistryKey.m ================================================================== --- src/OFWindowsRegistryKey.m +++ src/OFWindowsRegistryKey.m @@ -114,23 +114,17 @@ else status = RegOpenKeyExA(_hKey, [path cStringWithEncoding: [OFLocale encoding]], options, securityAndAccessRights, &subKey); - if (status != ERROR_SUCCESS) { - if (status == ERROR_FILE_NOT_FOUND) { - objc_autoreleasePoolPop(pool); - return nil; - } - + 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] @@ -371,11 +365,10 @@ void *pool = objc_autoreleasePoolPush(); DWORD type, ret; OFData *data = [self dataForValueNamed: name type: &type]; if (data == nil) - /* TODO: This exception is not ideal. */ @throw [OFUndefinedKeyException exceptionWithObject: self key: name value: nil]; if (type != REG_DWORD) @@ -405,11 +398,10 @@ DWORD type; uint64_t ret; OFData *data = [self dataForValueNamed: name type: &type]; if (data == nil) - /* TODO: This exception is not ideal. */ @throw [OFUndefinedKeyException exceptionWithObject: self key: name value: nil]; if (type != REG_QWORD)