Index: src/OFWindowsRegistryKey.h ================================================================== --- src/OFWindowsRegistryKey.h +++ src/OFWindowsRegistryKey.h @@ -71,11 +71,23 @@ /*! * @brief Opens the sub key at the specified path. * * @param path The path of the sub key to open - * @param options Please refer to the `RegOpenKeyEx()` documentation + * @param securityAndAccessRights Please refer to the `RegOpenKeyEx()` + * documentation + * @return The sub key with the specified path, or nil if it does not exist + */ +- (nullable OFWindowsRegistryKey *) + openSubKeyWithPath: (OFString *)path + securityAndAccessRights: (REGSAM)securityAndAccessRights; + +/*! + * @brief Opens the sub key at the specified path. + * + * @param path The path of the sub key to open + * @param options Please refer to the `RegOpenKeyEx()` documentation. Usually 0. * @param securityAndAccessRights Please refer to the `RegOpenKeyEx()` * documentation * @return The sub key with the specified path, or nil if it does not exist */ - (nullable OFWindowsRegistryKey *) @@ -86,25 +98,50 @@ /*! * @brief Creates a sub key at the specified path or opens it if it already * exists. * * @param path The path of the sub key to create - * @param options Please refer to the `RegCreateKeyEx()` documentation + * @param securityAndAccessRights Please refer to the `RegCreateKeyEx()` + * documentation + * @return The sub key with the specified path + */ +- (OFWindowsRegistryKey *) + createSubKeyWithPath: (OFString *)path + securityAndAccessRights: (REGSAM)securityAndAccessRights; + +/*! + * @brief Creates a sub key at the specified path or opens it if it already + * exists. + * + * @param path The path of the sub key to create + * @param options Please refer to the `RegCreateKeyEx()` documentation. + * Usually 0. * @param securityAndAccessRights Please refer to the `RegCreateKeyEx()` * documentation * @param securityAttributes Please refer to the `RegCreateKeyEx()` - * documentation - * @param disposition Please refer to the `RegCreateKeyEx()` documentation + * documentation. Usually NULL. + * @param disposition Whether the key was created or already existed. Please + * refer to the `RegCreateKeyEx()` documentation. * @return The sub key with the specified path */ - (OFWindowsRegistryKey *) createSubKeyWithPath: (OFString *)path options: (DWORD)options securityAndAccessRights: (REGSAM)securityAndAccessRights securityAttributes: (nullable LPSECURITY_ATTRIBUTES)securityAttributes disposition: (nullable LPDWORD)disposition; +/*! + * @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 + * @return The string for the specified value + */ +- (nullable OFString *)stringForValue: (nullable OFString *)value + subKeyPath: (nullable OFString *)subKeyPath; + /*! * @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 Index: src/OFWindowsRegistryKey.m ================================================================== --- src/OFWindowsRegistryKey.m +++ src/OFWindowsRegistryKey.m @@ -82,10 +82,18 @@ if (_close) RegCloseKey(_hKey); [super dealloc]; } + +- (OFWindowsRegistryKey *)openSubKeyWithPath: (OFString *)path + securityAndAccessRights: (REGSAM)securityAndAccessRights +{ + return [self openSubKeyWithPath: path + options: 0 + securityAndAccessRights: securityAndAccessRights]; +} - (OFWindowsRegistryKey *)openSubKeyWithPath: (OFString *)path options: (DWORD)options securityAndAccessRights: (REGSAM)securityAndAccessRights { @@ -112,10 +120,21 @@ return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey close: true] autorelease]; } + +- (OFWindowsRegistryKey *) + createSubKeyWithPath: (OFString *)path + securityAndAccessRights: (REGSAM)securityAndAccessRights +{ + return [self createSubKeyWithPath: path + options: 0 + securityAndAccessRights: securityAndAccessRights + securityAttributes: NULL + disposition: NULL]; +} - (OFWindowsRegistryKey *) createSubKeyWithPath: (OFString *)path options: (DWORD)options securityAndAccessRights: (REGSAM)securityAndAccessRights @@ -141,10 +160,19 @@ return [[[OFWindowsRegistryKey alloc] of_initWithHKey: subKey close: true] autorelease]; } + +- (OFString *)stringForValue: (OFString *)value + subKeyPath: (OFString *)subKeyPath +{ + return [self stringForValue: value + subKeyPath: subKeyPath + flags: 0 + type: NULL]; +} - (OFString *)stringForValue: (OFString *)value subKeyPath: (OFString *)subKeyPath flags: (DWORD)flags type: (LPDWORD)type