Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Imported upstream version 1.9.83

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
  • Loading branch information...
commit b7cd19718557d68f51b6310f1d0520b71d07efcb 1 parent cb0feff
Stefan Naewe authored
View
3  AUTHORS.txt
@@ -2,7 +2,7 @@
STLSoft - Authors
; Created: 29th March 2002
-; Updated: 7th May 2009
+; Updated: 19th May 2009
============================================================================
@@ -69,6 +69,7 @@ Bug reports, fixes and suggestions (for which we are very grateful):
Robert Kreger
Rupert Kittinger
Ryan Ginstrom
+ Sam Fisher
Sean Kelly
Sergey Nikulov
Shawn Poulson
View
36 CHANGES.txt
@@ -2,7 +2,7 @@
STLSoft - Changes
; Created: 29th March 2002
-; Updated: 15th May 2009
+; Updated: 19th May 2009
============================================================================
@@ -18,6 +18,40 @@ STLSoft - Changes
============================================================================
+Changes for 1.9.83 (19th May 2009)
+
+Summary:
+========
+
+ * fixed defects in winstl::basic_reg_value::value_sz()/value_multi_sz()
+ * fixed defects in exception-safety in winstl::basic_reg_value and winstl::basic_reg_key
+ * various minor fixes and documentation mods
+
+Changes:
+========
+
+ WinSTL:
+ =======
+
+ ~ include/winstl/registry/reg_key.hpp:
+ ~ corrected exception-safety defect (by reversing the order of m_name and m_hkey)
+ ~ added required dependency on <functional>
+ ~ documentation simplification
+
+ ~ include/winstl/registry/reg_traits.hpp:
+ + added reg_dup_key()
+ - deprecated key_dup()
+ ~ linearising behaviour between operating systems
+ ~ tightening type-conversions
+ ~ documentation simplification
+
+ ~ include/winstl/registry/reg_value.hpp:
+ ~ modifications to value_multi_sz() and value_sz() to avoid possible race conditions (with registry changes made by other processes)
+ ~ corrected exception-safety defect (by reversing the order of m_name and m_hkey)
+ ~ documentation simplification
+
+============================================================================
+
Changes for 1.9.82 (15th May 2009)
Summary:
View
10 HISTORY.txt
@@ -2,11 +2,19 @@
STLSoft - History
; Created: 29th March 2002
-; Updated: 15th May 2009
+; Updated: 19th May 2009
============================================================================
+19th May 2009 - 1.9.83 released
+-------------------------------
+
+ * fixed defects in winstl::basic_reg_value::value_sz()/value_multi_sz()
+ * fixed defects in exception-safety in winstl::basic_reg_value and winstl::basic_reg_key
+ * various minor fixes and documentation mods
+
+
15th May 2009 - 1.9.82 released
-------------------------------
View
6 INSTALL.txt
@@ -2,15 +2,15 @@
STLSoft - Install
; Created: 29th March 2002
-; Updated: 15th May 2009
+; Updated: 19th May 2009
============================================================================
STLSoft is a 100% header-only library, and so requires no building.
It is recommended that you define an STLSOFT environment variable. For
- example, if you install to /usr/local/stlsoft/stlsoft-1.9.82, then you
- should set STLSOFT to /usr/local/stlsoft/stlsoft-1.9.82. In that case,
+ example, if you install to /usr/local/stlsoft/stlsoft-1.9.83, then you
+ should set STLSOFT to /usr/local/stlsoft/stlsoft-1.9.83. In that case,
the file stlsoft/stlsoft.h will be located in
$STLSOFT/include/stlsoft/stlsoft.h
View
4 NEWS.txt
@@ -2,13 +2,15 @@
STLSoft - News
; Created: 29th March 2002
-; Updated: 15th May 2009
+; Updated: 19th May 2009
============================================================================
News:
+ 19th May 2009 - Release of STLSoft 1.9.83
+
15th May 2009 - Release of STLSoft 1.9.82
7th May 2009 - Release of STLSoft 1.9.81
View
11 include/stlsoft/stlsoft.h
@@ -6,7 +6,7 @@
* types.
*
* Created: 15th January 2002
- * Updated: 15th May 2009
+ * Updated: 19th May 2009
*
* Home: http://stlsoft.org/
*
@@ -54,8 +54,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_H_STLSOFT_MAJOR 3
# define STLSOFT_VER_STLSOFT_H_STLSOFT_MINOR 21
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 2
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 387
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 3
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 388
#else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* # include "./internal/doxygen_defs.h" */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
@@ -246,12 +246,13 @@
# define _STLSOFT_VER_1_9_80 0x010950ff /*!< Version 1.9.80 (5th May 2009) */
# define _STLSOFT_VER_1_9_81 0x010951ff /*!< Version 1.9.81 (??? May 2009) */
# define _STLSOFT_VER_1_9_82 0x010952ff /*!< Version 1.9.82 (14th May 2009) */
+# define _STLSOFT_VER_1_9_83 0x010953ff /*!< Version 1.9.83 (19th May 2009) */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
#define _STLSOFT_VER_MAJOR 1
#define _STLSOFT_VER_MINOR 9
-#define _STLSOFT_VER_REVISION 82
-#define _STLSOFT_VER _STLSOFT_VER_1_9_82
+#define _STLSOFT_VER_REVISION 83
+#define _STLSOFT_VER _STLSOFT_VER_1_9_83
/* /////////////////////////////////////////////////////////////////////////
* Basic macros
View
167 include/winstl/registry/reg_key.hpp
@@ -5,11 +5,11 @@
* and Unicode specialisations thereof.
*
* Created: 19th January 2002
- * Updated: 22nd September 2008
+ * Updated: 19th May 2009
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2002-2008, Matthew Wilson and Synesis Software
+ * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_KEY_MAJOR 3
# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_KEY_MINOR 9
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_KEY_REVISION 4
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_KEY_EDIT 128
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_KEY_REVISION 6
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_KEY_EDIT 131
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -105,6 +105,10 @@
# define STLSOFT_INCL_NUMERIC
# include <numeric>
#endif /* !STLSOFT_INCL_NUMERIC */
+#ifndef STLSOFT_INCL_FUNCTIONAL
+# define STLSOFT_INCL_FUNCTIONAL
+# include <functional>
+#endif /* !STLSOFT_INCL_FUNCTIONAL */
#ifdef STLSOFT_UNITTEST
# include <winstl/registry/reg_value.hpp>
@@ -136,7 +140,7 @@ namespace winstl_project
* Classes
*/
-/** \brief Represents a registry key, and provides methods for manipulating its
+/** Represents a registry key, and provides methods for manipulating its
* values and sub-keys.
*
* \ingroup group__library__windows_registry
@@ -162,19 +166,19 @@ class basic_reg_key
/// \name Member Types
/// @{
public:
- /// \brief The character type
+ /// The character type
typedef C char_type;
- /// \brief The traits type
+ /// The traits type
typedef T traits_type;
- /// \brief The allocator type
+ /// The allocator type
typedef A allocator_type;
- /// \brief The current parameterisation of the type
+ /// The current parameterisation of the type
typedef basic_reg_key<C, T, A> class_type;
- /// \brief The size type
+ /// The size type
typedef ss_typename_type_k traits_type::size_type size_type;
- /// \brief The string type
+ /// The string type
typedef ss_typename_type_k traits_type::string_type string_type;
- /// \brief The key type
+ /// The key type
#if defined(STLSOFT_COMPILER_IS_MSVC) && \
_MSC_VER == 1100
/* WSCB: VC5 has an internal compiler error if use traits_type::hkey_type */
@@ -182,18 +186,18 @@ class basic_reg_key
#else /* ? compiler */
typedef ss_typename_type_k traits_type::hkey_type hkey_type;
#endif /* compiler */
- /// \brief The Boolean type
+ /// The Boolean type
typedef ws_bool_t bool_type;
- /// \brief The type of the key's values
+ /// The type of the key's values
typedef basic_reg_value<C, T, A> key_value_type;
#if 0
- /// \brief The type of the sub-key collection
+ /// The type of the sub-key collection
typedef basic_reg_key_sequence<C, T, A> subkeys_collection_type;
- /// \brief The type of the value collection
+ /// The type of the value collection
typedef basic_reg_value_sequence<C, T, A> value_collection_type;
#endif /* 0 */
private:
- /// \brief The results type of the Registry API
+ /// The results type of the Registry API
typedef ss_typename_type_k traits_type::result_type result_type;
public:
typedef hkey_type resource_type;
@@ -212,11 +216,11 @@ class basic_reg_key
_MSC_VER == 1300)
public:
#endif /* compiler */
- basic_reg_key(hkey_type *hkey, string_type const& keyName, REGSAM accessMask);
+ basic_reg_key(hkey_type* hkey, string_type const& keyName, REGSAM accessMask);
public:
- /// \brief Default constructor
+ /// Default constructor
basic_reg_key();
- /** \brief Construct from the named sub-key of the given parent
+ /** Construct from the named sub-key of the given parent
*
* \param hkeyParent A handle to the parent key, whose named subkey is
* to be opened.
@@ -233,12 +237,12 @@ class basic_reg_key
* value returned from the get_key_handle() method.
*/
basic_reg_key(hkey_type hkeyParent, char_type const* keyName, REGSAM accessMask = KEY_ALL_ACCESS)
- : m_hkey(open_key_(hkeyParent, keyName, accessMask))
- , m_name(keyName)
+ : m_name(keyName)
+ , m_hkey(open_key_(hkeyParent, keyName, accessMask))
, m_accessMask(accessMask)
{} // Implementation is within class, otherwise VC5 will not link
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Construct from the named sub-key of the given parent
+ /** Construct from the named sub-key of the given parent
*
* \param hkeyParent A handle to the parent key, whose named subkey is
* to be opened.
@@ -256,12 +260,12 @@ class basic_reg_key
*/
template <ss_typename_param_k S>
basic_reg_key(hkey_type hkeyParent, S const& keyName, REGSAM accessMask = KEY_ALL_ACCESS)
- : m_hkey(open_key_(hkeyParent, stlsoft_ns_qual(c_str_ptr)(keyName), accessMask))
- , m_name(keyName)
+ : m_name(keyName)
+ , m_hkey(open_key_(hkeyParent, stlsoft_ns_qual(c_str_ptr)(keyName), accessMask))
, m_accessMask(accessMask)
{} // Implementation is within class, otherwise VC5 will not link
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Construct from the named sub-key of the given parent
+ /** Construct from the named sub-key of the given parent
*
* \param keyParent A handle to the parent key, whose named subkey is
* to be opened.
@@ -278,12 +282,12 @@ class basic_reg_key
* value returned from the get_key_handle() method.
*/
basic_reg_key(class_type const& keyParent, char_type const* keyName, REGSAM accessMask = KEY_ALL_ACCESS)
- : m_hkey(open_key_(keyParent.get_key_handle(), keyName, accessMask))
- , m_name(keyName)
+ : m_name(keyName)
+ , m_hkey(open_key_(keyParent.get_key_handle(), keyName, accessMask))
, m_accessMask(accessMask)
{} // Implementation is within class, otherwise VC5 will not link
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Construct from the named sub-key of the given parent
+ /** Construct from the named sub-key of the given parent
*
* \param keyParent A handle to the parent key, whose named subkey is
* to be opened.
@@ -301,12 +305,12 @@ class basic_reg_key
*/
template <ss_typename_param_k S>
basic_reg_key(class_type const& keyParent, S const& keyName, REGSAM accessMask = KEY_ALL_ACCESS)
- : m_hkey(open_key_(keyParent.get_key_handle(), stlsoft_ns_qual(c_str_ptr)(keyName), accessMask))
- , m_name(keyName)
+ : m_name(keyName)
+ , m_hkey(open_key_(keyParent.get_key_handle(), stlsoft_ns_qual(c_str_ptr)(keyName), accessMask))
, m_accessMask(accessMask)
{} // Implementation is within class, otherwise VC5 will not link
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Constructs an instance as a (logical) copy of another.
+ /** Constructs an instance as a (logical) copy of another.
*
* \param rhs Instance whose key will be opened by the new instance.
*
@@ -320,7 +324,7 @@ class basic_reg_key
* value returned from the get_key_handle() method.
*/
basic_reg_key(class_type const& rhs);
- /** \brief Constructs an instance as a (logical) copy of another, but with different permissions.
+ /** Constructs an instance as a (logical) copy of another, but with different permissions.
*
* \param rhs Instance whose key will be opened by the new instance.
* \param accessMask The permissions for the new instance.
@@ -336,28 +340,28 @@ class basic_reg_key
*/
basic_reg_key(class_type const& rhs, REGSAM accessMask);
- /// \brief Destructor
+ /// Destructor
///
/// Releases any resources allocated by the instance, including closing the
/// underlying registry key.
~basic_reg_key() stlsoft_throw_0();
- /// \brief Copy assignment operator
+ /// Copy assignment operator
class_type& operator =(class_type const& rhs);
/// @}
/// \name Attributes
/// @{
public:
- /// \brief The name of the key
+ /// The name of the key
string_type const &name() const;
- /// \brief The registry class of the key
+ /// The registry class of the key
string_type reg_class() const;
- /// \brief The number of sub-keys
+ /// The number of sub-keys
///
/// \note This is not a constant-time operation
size_type num_sub_keys() const;
- /// \brief The number of values
+ /// The number of values
///
/// \note This is not a constant-time operation
size_type num_values() const;
@@ -378,14 +382,14 @@ class basic_reg_key
return this->has_value_(stlsoft_ns_qual(c_str_ptr)(valueName));
}
- /** \brief The handle to the underlying Registry API key.
+ /** The handle to the underlying Registry API key.
*
* \note If \ref page__exception_agnostic "exception handling is not enabled",
* then this method will return <code>NULL</code> in the case where an
* instance constructor failed to open the key with the requested permissions.
*/
hkey_type get_key_handle() const;
- /// \brief The handle to the underlying Registry API key.
+ /// The handle to the underlying Registry API key.
///
/// \note Equivalent to get_key_handle()
hkey_type get() const;
@@ -395,14 +399,14 @@ class basic_reg_key
value_collection_type values() const;
#endif /* 0 */
- /// \brief The access mask associated with the key
+ /// The access mask associated with the key
REGSAM get_access_mask() const;
/// @}
/// \name Sub-key operations
/// @{
public:
- /// \brief Opens the named sub-key of this key
+ /// Opens the named sub-key of this key
class_type open_sub_key(char_type const* subKeyName, REGSAM accessMask = KEY_ALL_ACCESS);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
template <ss_typename_param_k S>
@@ -412,7 +416,7 @@ class basic_reg_key
}
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Creates a named sub-key of this key
+ /** Creates a named sub-key of this key
*
* \param subKeyName Name of the subkey to created. If <code>NULL</code> or the
* empty string, then the function returns a copy of the callee.
@@ -427,7 +431,7 @@ class basic_reg_key
*/
class_type create_sub_key(char_type const* subKeyName, REGSAM accessMask = KEY_ALL_ACCESS);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Creates a named sub-key of this key
+ /** Creates a named sub-key of this key
*
* \param subKeyName Name of the subkey to created. If <code>NULL</code> or the
* empty string, then the function returns a copy of the callee.
@@ -447,7 +451,7 @@ class basic_reg_key
}
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Creates a named sub-key of a given key
+ /** Creates a named sub-key of a given key
*
* \param hkey The parent registry key.
* \param subKeyName Name of the subkey to created. If <code>NULL</code> or the
@@ -463,7 +467,7 @@ class basic_reg_key
*/
static class_type create_key(HKEY hkey, char_type const* subKeyName, REGSAM accessMask = KEY_ALL_ACCESS);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Creates a named sub-key of this key
+ /** Creates a named sub-key of this key
*
* \param key The parent registry key.
* \param subKeyName Name of the subkey to created. If <code>NULL</code> or the
@@ -485,7 +489,7 @@ class basic_reg_key
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Deletes the named sub-key of this key
+ /** Deletes the named sub-key of this key
*
* \param subKeyName The name of the sub-key to be deleted.
*
@@ -502,7 +506,7 @@ class basic_reg_key
*/
bool_type delete_sub_key(char_type const* subKeyName);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Deletes the named sub-key of this key
+ /** Deletes the named sub-key of this key
*
* \param subKeyName The name of the sub-key to be deleted.
*
@@ -525,7 +529,7 @@ class basic_reg_key
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
/// @}
- /// \brief Returns a duplicate of the key's handle, if any.
+ /// Returns a duplicate of the key's handle, if any.
///
/// \param accessMask The access mask for the
/// \param res A pointer to a variable (of type result_type) into
@@ -541,7 +545,7 @@ class basic_reg_key
/// \name Value operations
/// @{
public:
- /** \brief Sets the named value to the value of the given 32-bit integer.
+ /** Sets the named value to the value of the given 32-bit integer.
*
* \exception winstl::registry_exception If \ref page__exception_agnostic "exception handling is enabled",
* an instance of \link winstl::registry_exception registry_exception\endlink
@@ -549,7 +553,7 @@ class basic_reg_key
*/
bool_type set_value(char_type const* valueName, DWORD value);
#ifdef STLSOFT_CF_64BIT_INT_SUPPORT
- /** \brief Sets the named value to the value of the given 64-bit integer.
+ /** Sets the named value to the value of the given 64-bit integer.
*
* \exception winstl::registry_exception If \ref page__exception_agnostic "exception handling is enabled",
* an instance of \link winstl::registry_exception registry_exception\endlink
@@ -557,7 +561,7 @@ class basic_reg_key
*/
bool_type set_value(char_type const* valueName, ws_uint64_t value);
#endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
- /** \brief Sets the named value to the value of the given string.
+ /** Sets the named value to the value of the given string.
///
/// \param valueName The name of the value.
/// \param value The value of the value
@@ -568,7 +572,7 @@ class basic_reg_key
* will be thrown if the value cannot be set.
*/
bool_type set_value(char_type const* valueName, char_type const* value, ws_uint_t type = REG_SZ);
- /** \brief Sets the named value to the values of the given string array.
+ /** Sets the named value to the values of the given string array.
///
/// \param valueName The name of the value.
/// \param values The string array.
@@ -579,7 +583,7 @@ class basic_reg_key
* will be thrown if the value cannot be set.
*/
bool_type set_value(char_type const* valueName, char_type const** values, size_type numValues);
- /** \brief Sets the named value to the given binary value.
+ /** Sets the named value to the given binary value.
*
* \exception winstl::registry_exception If \ref page__exception_agnostic "exception handling is enabled",
* an instance of \link winstl::registry_exception registry_exception\endlink
@@ -588,7 +592,7 @@ class basic_reg_key
bool_type set_value(char_type const* valueName, void const* value, size_type cbValue);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Sets the named value to the value of the given 32-bit integer.
+ /** Sets the named value to the value of the given 32-bit integer.
*
* \exception winstl::registry_exception If \ref page__exception_agnostic "exception handling is enabled",
* an instance of \link winstl::registry_exception registry_exception\endlink
@@ -602,7 +606,7 @@ class basic_reg_key
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
#ifdef STLSOFT_CF_64BIT_INT_SUPPORT
# ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Sets the named value to the value of the given 64-bit integer.
+ /** Sets the named value to the value of the given 64-bit integer.
*
* \exception winstl::registry_exception If \ref page__exception_agnostic "exception handling is enabled",
* an instance of \link winstl::registry_exception registry_exception\endlink
@@ -616,7 +620,7 @@ class basic_reg_key
# endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
#endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Sets the named value to the value of the given string.
+ /** Sets the named value to the value of the given string.
///
/// \param valueName The name of the value.
/// \param value The value of the value
@@ -633,7 +637,7 @@ class basic_reg_key
}
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Sets the named value to the values of the given string array.
+ /** Sets the named value to the values of the given string array.
///
/// \param valueName The name of the value.
/// \param values The string array.
@@ -650,7 +654,7 @@ class basic_reg_key
}
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Sets the named value to the given binary value.
+ /** Sets the named value to the given binary value.
*
* \exception winstl::registry_exception If \ref page__exception_agnostic "exception handling is enabled",
* an instance of \link winstl::registry_exception registry_exception\endlink
@@ -662,7 +666,7 @@ class basic_reg_key
return set_value_(stlsoft_ns_qual(c_str_ptr)(valueName), value, cbValue);
}
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Sets the named value to the given integer (stored as an unsigned value).
+ /** Sets the named value to the given integer (stored as an unsigned value).
///
/// \note This method is provided solely to disambiguate between the DWORD and ws_uint64_t overloads
/// when using integer literals.
@@ -673,7 +677,7 @@ class basic_reg_key
*/
bool_type set_value(char_type const* valueName, int value);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Sets the named value to the given integer (stored as an unsigned value).
+ /** Sets the named value to the given integer (stored as an unsigned value).
///
/// \note This method is provided solely to disambiguate between the DWORD and ws_uint64_t overloads
/// when using integer literals.
@@ -688,7 +692,7 @@ class basic_reg_key
return set_value_(stlsoft_ns_qual(c_str_ptr)(valueName), value);
}
#endif /* STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT */
- /** \brief Deletes the named value.
+ /** Deletes the named value.
*
* \param valueName The name of the value to be deleted.
*
@@ -705,7 +709,7 @@ class basic_reg_key
*/
bool_type delete_value(char_type const* valueName);
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Deletes the named value.
+ /** Deletes the named value.
*
* \param valueName The name of the value to be deleted.
*
@@ -732,13 +736,13 @@ class basic_reg_key
size_type get_value_data_size(char_type const* valueName) const;
#endif /* 0 */
- /** \brief Returns the named value.
+ /** Returns the named value.
///
/// \return An instance of basic_reg_value.
*/
key_value_type get_value(char_type const* valueName) const;
#ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
- /** \brief Returns the named value.
+ /** Returns the named value.
///
/// \return An instance of basic_reg_value.
*/
@@ -794,7 +798,7 @@ class basic_reg_key
/// \name Operations
/// @{
public:
- /** \brief Efficiently swaps the contents between two instances
+ /** Efficiently swaps the contents between two instances
///
/// \param rhs The parameter whose contents will be swapped.
*/
@@ -804,24 +808,24 @@ class basic_reg_key
/// \name Members
/// @{
private:
- hkey_type m_hkey; // The key handle
string_type m_name; // The key name
+ hkey_type m_hkey; // The key handle
REGSAM m_accessMask; // The security access mask
/// @}
};
/* Typedefs to commonly encountered types. */
-/** \brief Specialisation of the basic_reg_key template for the ANSI character type \c char
+/** Specialisation of the basic_reg_key template for the ANSI character type \c char
*
* \ingroup group__library__windows_registry
*/
typedef basic_reg_key<ws_char_a_t, reg_traits<ws_char_a_t>, processheap_allocator<ws_char_a_t> > reg_key_a;
-/** \brief Specialisation of the basic_reg_key template for the Unicode character type \c wchar_t
+/** Specialisation of the basic_reg_key template for the Unicode character type \c wchar_t
*
* \ingroup group__library__windows_registry
*/
typedef basic_reg_key<ws_char_w_t, reg_traits<ws_char_w_t>, processheap_allocator<ws_char_w_t> > reg_key_w;
-/** \brief Specialisation of the basic_reg_key template for the Win32 character type \c TCHAR
+/** Specialisation of the basic_reg_key template for the Win32 character type \c TCHAR
*
* \ingroup group__library__windows_registry
*/
@@ -833,7 +837,7 @@ typedef basic_reg_key<TCHAR, reg_traits<TCHAR>, processheap_allocator<TCHAR> >
/* get_handle */
-/** \brief [\ref group__concept__shims "Shim" function] Returns the corresponding registry handle of an instance of winstl::basic_reg_key basic_reg_key.
+/** [\ref group__concept__shims "Shim" function] Returns the corresponding registry handle of an instance of winstl::basic_reg_key basic_reg_key.
*
* \ingroup group__library__windows_registry
*
@@ -850,7 +854,7 @@ inline HKEY get_handle(basic_reg_key<C, T, A> const& key)
return key.get_key_handle();
}
-/** \brief [\ref group__concept__shims "Shim" function] Returns the corresponding registry handle of an instance of winstl::basic_reg_key basic_reg_key.
+/** [\ref group__concept__shims "Shim" function] Returns the corresponding registry handle of an instance of winstl::basic_reg_key basic_reg_key.
*
* \ingroup group__library__shims__hkey_attribute
*
@@ -962,28 +966,29 @@ inline /* static */ ss_typename_type_ret_k basic_reg_key<C, T, A>::hkey_type bas
// Construction
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
inline basic_reg_key<C, T, A>::basic_reg_key()
- : m_hkey(NULL)
+ : m_name()
+ , m_hkey(NULL)
, m_accessMask(KEY_READ)
{}
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
-inline basic_reg_key<C, T, A>::basic_reg_key(ss_typename_type_k basic_reg_key<C, T, A>::hkey_type *hkey, ss_typename_type_k basic_reg_key<C, T, A>::string_type const& keyName, REGSAM accessMask)
- : m_hkey(*hkey)
- , m_name(keyName)
+inline basic_reg_key<C, T, A>::basic_reg_key(ss_typename_type_k basic_reg_key<C, T, A>::hkey_type* hkey, ss_typename_type_k basic_reg_key<C, T, A>::string_type const& keyName, REGSAM accessMask)
+ : m_name(keyName)
+ , m_hkey(*hkey)
, m_accessMask(accessMask)
{}
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
inline basic_reg_key<C, T, A>::basic_reg_key(class_type const& rhs)
- : m_hkey(dup_key_(rhs.m_hkey, rhs.get_access_mask()))
- , m_name(rhs.m_name)
+ : m_name(rhs.m_name)
+ , m_hkey(dup_key_(rhs.m_hkey, rhs.get_access_mask()))
, m_accessMask(rhs.m_accessMask)
{}
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
inline basic_reg_key<C, T, A>::basic_reg_key(class_type const& rhs, REGSAM accessMask)
- : m_hkey(dup_key_(rhs.m_hkey, accessMask))
- , m_name(rhs.m_name)
+ : m_name(rhs.m_name)
+ , m_hkey(dup_key_(rhs.m_hkey, accessMask))
, m_accessMask(accessMask)
{}
View
86 include/winstl/registry/reg_traits.hpp
@@ -5,7 +5,7 @@
* and Unicode specialisations thereof.
*
* Created: 19th January 2002
- * Updated: 15th May 2009
+ * Updated: 19th May 2009
*
* Thanks to: Sam Fisher for requesting reg_delete_tree().
*
@@ -52,9 +52,9 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_MAJOR 3
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_MINOR 4
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_REVISION 2
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_EDIT 73
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_MINOR 5
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_REVISION 1
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_TRAITS_EDIT 76
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -96,7 +96,7 @@ namespace winstl_project
/* ////////////////////////////////////////////////////////////////////// */
#ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
-/** \brief Traits for accessing the correct registry functions for a given character type
+/** Traits for accessing the correct registry functions for a given character type
*
* \ingroup group__library__windows_registry
*
@@ -112,35 +112,41 @@ struct reg_traits
/// \name Member Types
/// @{
public:
- /// \brief The character type
+ /// The character type
typedef C char_type;
- /// \brief The size type
+ /// The size type
typedef ws_size_t size_type;
- /// \brief The difference type
+ /// The difference type
typedef ws_ptrdiff_t difference_type;
- /// \brief The registry key type
+ /// The registry key type
typedef HKEY hkey_type;
- /// \brief The string type
+ /// The string type
typedef reg_string_t string_type; // Placeholder only
- /// \brief The time type
+ /// The time type
typedef FILETIME time_type;
- /// \brief The API result type (LONG)
+ /// The API result type (LONG)
typedef LONG result_type;
/// @}
/// \name Operations
/// @{
public:
- /// \brief Duplicates a registry key
+ /// Duplicates a registry key
+ ///
+ /// \deprecated Use reg_dup_key() instead
static hkey_type key_dup( hkey_type hkey
, REGSAM samDesired = KEY_ALL_ACCESS
, result_type* result = NULL);
- /// \brief Opens a registry sub-key
+ /// Duplicates a registry key
+ static hkey_type reg_dup_key( hkey_type hkey
+ , REGSAM samDesired = KEY_ALL_ACCESS
+ , result_type* result = NULL);
+ /// Opens a registry sub-key
static result_type reg_open_key( hkey_type hkey,
char_type const* sub_key_name,
hkey_type* hkey_result,
REGSAM samDesired = KEY_ALL_ACCESS);
- /// \brief Opens a registry sub-key
+ /// Opens a registry sub-key
static result_type reg_create_key( hkey_type hkey,
char_type const* sub_key_name,
hkey_type* hkey_result,
@@ -150,22 +156,22 @@ struct reg_traits
hkey_type* hkey_result,
ws_bool_t& bCreated,
REGSAM samDesired = KEY_ALL_ACCESS);
- /// \brief Destroys a registry sub-key
+ /// Destroys a registry sub-key
static result_type reg_delete_key( hkey_type hkey,
char_type const* sub_key_name);
- /// \brief Queries a registry key value
+ /// Queries a registry key value
static result_type reg_query_value(hkey_type hkey,
char_type const* valueName,
ws_dword_t& valueType,
void* data,
size_type &cbData);
- /// \brief Sets the value of the named value.
+ /// Sets the value of the named value.
static result_type reg_set_value( hkey_type hkey
, char_type const* valueName
, ws_dword_t valueType
, void const* data
, size_type cbData);
- /// \brief Deletes the named value.
+ /// Deletes the named value.
static result_type reg_delete_value(hkey_type hkey
, char_type const* valueName);
@@ -175,7 +181,7 @@ struct reg_traits
, char_type const* sub_key_name
);
- /// \brief Queries a registry key's characteristics
+ /// Queries a registry key's characteristics
static result_type reg_query_info( hkey_type hkey,
char_type* key_class,
size_type* cch_key_class,
@@ -187,13 +193,13 @@ struct reg_traits
size_type* cb_value_data_max,
size_type* cb_security_descriptor_max,
time_type* time_last_write);
- /// \brief Enumerates a registry key's sub-keys
+ /// Enumerates a registry key's sub-keys
static result_type reg_enum_key( hkey_type hkey,
ws_dword_t index,
char_type* key_name,
size_type* cch_key_name,
time_type* time_last_write = NULL);
- /// \brief [DEPRECATED] Enumerates a registry key's sub-keys
+ /// [DEPRECATED] Enumerates a registry key's sub-keys
///
/// \deprecated This is deprecated in favour of reg_enum_key(hkey_type, ws_dword_t, char_type*, size_type*, time_type *)
static result_type reg_enum_key( hkey_type hkey,
@@ -203,7 +209,7 @@ struct reg_traits
char_type* key_class,
size_type* cch_key_class,
time_type* time_last_write);
- /// \brief Enumerates a registry key's values
+ /// Enumerates a registry key's values
static result_type reg_enum_value( hkey_type hkey,
ws_dword_t index,
char_type* valueName,
@@ -211,7 +217,7 @@ struct reg_traits
ws_dword_t* valueType,
void* data,
size_type &cbData);
- /// \brief Enumerates a registry key's values
+ /// Enumerates a registry key's values
static result_type reg_enum_value( hkey_type hkey,
ws_dword_t index,
char_type* valueName,
@@ -240,6 +246,10 @@ struct reg_traits<ws_char_a_t>
public:
static hkey_type key_dup(hkey_type hkey, REGSAM samDesired, result_type *result = NULL)
{
+ return reg_dup_key(hkey, samDesired, result);
+ }
+ static hkey_type reg_dup_key(hkey_type hkey, REGSAM samDesired, result_type *result = NULL)
+ {
hkey_type hkeyDup;
result_type res = ::RegOpenKeyExA(hkey, "", 0, samDesired, &hkeyDup);
@@ -323,6 +333,12 @@ struct reg_traits<ws_char_a_t>
size_type* cb_security_descriptor_max,
time_type* time_last_write)
{
+ if( NULL == cch_key_class &&
+ NULL != key_class)
+ {
+ return ERROR_INVALID_PARAMETER;
+ }
+
return ::RegQueryInfoKeyA(hkey, key_class, reinterpret_cast<LPDWORD>(cch_key_class), NULL, reinterpret_cast<LPDWORD>(c_sub_keys), reinterpret_cast<LPDWORD>(cch_sub_key_max), reinterpret_cast<LPDWORD>(cch_key_class_max), reinterpret_cast<LPDWORD>(c_values), reinterpret_cast<LPDWORD>(cch_valueName_max), reinterpret_cast<LPDWORD>(cb_value_data_max), reinterpret_cast<LPDWORD>(cb_security_descriptor_max), time_last_write);
}
@@ -378,7 +394,7 @@ struct reg_traits<ws_char_a_t>
if(NULL == hinst)
{
- r = ::GetLastError();
+ r = static_cast<result_type>(::GetLastError());
}
else
{
@@ -392,11 +408,11 @@ struct reg_traits<ws_char_a_t>
if(NULL == u.fp)
{
- r = ::GetLastError();
+ r = static_cast<result_type>(::GetLastError());
}
else
{
- r = (*u.pfn)(a1, a2);
+ r = static_cast<result_type>((*u.pfn)(a1, a2));
}
::FreeLibrary(hinst);
@@ -422,6 +438,10 @@ struct reg_traits<ws_char_w_t>
public:
static hkey_type key_dup(hkey_type hkey, REGSAM samDesired, result_type *result = NULL)
{
+ return reg_dup_key(hkey, samDesired, result);
+ }
+ static hkey_type reg_dup_key(hkey_type hkey, REGSAM samDesired, result_type *result = NULL)
+ {
hkey_type hkeyDup;
result_type res = ::RegOpenKeyExW(hkey, L"", 0, samDesired, &hkeyDup);
@@ -505,6 +525,12 @@ struct reg_traits<ws_char_w_t>
size_type* cb_security_descriptor_max,
time_type* time_last_write)
{
+ if( NULL == cch_key_class &&
+ NULL != key_class)
+ {
+ return ERROR_INVALID_PARAMETER;
+ }
+
return ::RegQueryInfoKeyW(hkey, key_class, reinterpret_cast<LPDWORD>(cch_key_class), NULL, reinterpret_cast<LPDWORD>(c_sub_keys), reinterpret_cast<LPDWORD>(cch_sub_key_max), reinterpret_cast<LPDWORD>(cch_key_class_max), reinterpret_cast<LPDWORD>(c_values), reinterpret_cast<LPDWORD>(cch_valueName_max), reinterpret_cast<LPDWORD>(cb_value_data_max), reinterpret_cast<LPDWORD>(cb_security_descriptor_max), time_last_write);
}
@@ -560,7 +586,7 @@ struct reg_traits<ws_char_w_t>
if(NULL == hinst)
{
- r = ::GetLastError();
+ r = static_cast<result_type>(::GetLastError());
}
else
{
@@ -574,11 +600,11 @@ struct reg_traits<ws_char_w_t>
if(NULL == u.fp)
{
- r = ::GetLastError();
+ r = static_cast<result_type>(::GetLastError());
}
else
{
- r = (*u.pfn)(a1, a2);
+ r = static_cast<result_type>((*u.pfn)(a1, a2));
}
::FreeLibrary(hinst);
View
137 include/winstl/registry/reg_value.hpp
@@ -1,8 +1,8 @@
/* /////////////////////////////////////////////////////////////////////////
* File: winstl/registry/reg_value.hpp
*
- * Purpose: Contains the basic_reg_value class template, and ANSI
- * and Unicode specialisations thereof.
+ * Purpose: Contains the basic_reg_value class template, and multibyte
+ * and wide string specialisations thereof.
*
* Notes: The original implementation of the class had the const_iterator
* and value_type as nested classes. Unfortunately, Visual C++ 5 &
@@ -10,13 +10,17 @@
* regretably now implemented as independent classes.
*
* Created: 19th January 2002
- * Updated: 19th April 2009
+ * Updated: 18th May 2009
*
- * Thanks: To Diego Chanoux for spotting a bug in the value_sz() method.
+ * Thanks: To Diego Chanoux for spotting a defect in the value_sz() method.
*
* To Austin Ziegler for the value_multi_sz() method, and for
* fixes to defects evident on x64.
*
+ * To Sam Fisher for spotting the defect in the value_sz() and
+ * value_multi_sz() methods when accessing a zero-size value that
+ * has one or more non-zero-sized peer values. Ouch!
+ *
* Home: http://stlsoft.org/
*
* Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
@@ -62,8 +66,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_VALUE_MAJOR 3
# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_VALUE_MINOR 4
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_VALUE_REVISION 4
-# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_VALUE_EDIT 103
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_VALUE_REVISION 6
+# define WINSTL_VER_WINSTL_REGISTRY_HPP_REG_VALUE_EDIT 106
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -137,7 +141,7 @@ namespace winstl_project
/* ////////////////////////////////////////////////////////////////////// */
-/** \brief Represents a binary registry value
+/** Represents a binary registry value
*
* \ingroup group__library__windows_registry
*/
@@ -153,24 +157,24 @@ class reg_blob
, CCH_REG_API_AUTO_BUFFER
> buffer_type;
public:
- /// \brief The allocator type
+ /// The allocator type
typedef A allocator_type;
- /// \brief The current parameterisation of the type
+ /// The current parameterisation of the type
typedef reg_blob<A> class_type;
- /// \brief The value type
+ /// The value type
typedef ws_byte_t value_type;
- /// \brief The non-mutable (const) reference type
+ /// The non-mutable (const) reference type
typedef value_type const& const_reference;
- /// \brief The non-mutable (const) pointer type
+ /// The non-mutable (const) pointer type
typedef value_type const* const_pointer;
- /// \brief The non-mutating (const) iterator type
+ /// The non-mutating (const) iterator type
typedef value_type const* const_iterator;
- /// \brief The size type
+ /// The size type
typedef ws_size_t size_type;
- /// \brief The difference type
+ /// The difference type
typedef ws_ptrdiff_t difference_type;
#if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
- /// \brief The non-mutating (const) reverse iterator type
+ /// The non-mutating (const) reverse iterator type
typedef const_reverse_iterator_base < const_iterator
, value_type const
, const_reference
@@ -183,46 +187,46 @@ class reg_blob
/// \name Construction
/// @{
public:
- /// \brief Default constructor
+ /// Default constructor
reg_blob();
- /// \brief Copies the contents of the given pointer.
+ /// Copies the contents of the given pointer.
///
/// \param data Pointer to the bytes to be copied into the instance.
/// \param n Number of bytes pointed to by \c data.
reg_blob(value_type const* data, size_type n);
- /// \brief Copy constructor
+ /// Copy constructor
reg_blob(class_type const& rhs);
- /// \brief Destructor
+ /// Destructor
~reg_blob() stlsoft_throw_0();
/// @}
/// \name Attributes
/// @{
public:
- /// \brief Number of bytes in the blob.
+ /// Number of bytes in the blob.
size_type size() const;
- /// \brief Pointer to the first byte in the blob.
+ /// Pointer to the first byte in the blob.
const_pointer data() const;
/// @}
/// \name Iteration
/// @{
public:
- /// \brief Begins the iteration
+ /// Begins the iteration
///
/// \return An iterator representing the start of the sequence
const_iterator begin() const;
- /// \brief Ends the iteration
+ /// Ends the iteration
///
/// \return An iterator representing the end of the sequence
const_iterator end() const;
#if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
- /// \brief Begins the reverse iteration
+ /// Begins the reverse iteration
///
/// \return An iterator representing the start of the reverse sequence
const_reverse_iterator rbegin() const;
- /// \brief Ends the reverse iteration
+ /// Ends the reverse iteration
///
/// \return An iterator representing the end of the reverse sequence
const_reverse_iterator rend() const;
@@ -242,7 +246,7 @@ class reg_blob
/// @}
};
-/** \brief Represents a registry value, providing methods for accessing the value in different types.
+/** Represents a registry value, providing methods for accessing the value in different types.
*
* \ingroup group__library__windows_registry
*
@@ -267,23 +271,23 @@ class basic_reg_value
/// \name Member Types
/// @{
public:
- /// \brief The character type
+ /// The character type
typedef C char_type;
- /// \brief The traits type
+ /// The traits type
typedef T traits_type;
- /// \brief The allocator type
+ /// The allocator type
typedef A allocator_type;
- /// \brief The current parameterisation of the type
+ /// The current parameterisation of the type
typedef basic_reg_value<C, T, A> class_type;
- /// \brief The size type
+ /// The size type
typedef ss_typename_type_k traits_type::size_type size_type;
- /// \brief The string type
+ /// The string type
typedef ss_typename_type_k traits_type::string_type string_type;
#ifndef WINSTL_REG_VALUE_NO_MULTI_SZ
- /// \brief The string vector type
+ /// The string vector type
typedef stlsoft_ns_qual_std(vector)<string_type> strings_type;
#endif /* !WINSTL_REG_VALUE_NO_MULTI_SZ */
- /// \brief The key type
+ /// The key type
#if defined(STLSOFT_CF_THROW_BAD_ALLOC) && \
defined(STLSOFT_COMPILER_IS_MSVC) && \
_MSC_VER == 1100
@@ -292,7 +296,7 @@ class basic_reg_value
#else /* ? compiler */
typedef ss_typename_type_k traits_type::hkey_type hkey_type;
#endif /* compiler */
- /// \brief The blob type
+ /// The blob type
typedef reg_blob<A> blob_type;
private:
typedef stlsoft_ns_qual(auto_buffer_old)< char_type
@@ -308,16 +312,16 @@ class basic_reg_value
, CCH_REG_API_AUTO_BUFFER
> byte_buffer_type_;
private:
- /// \brief The results type of the Registry API
+ /// The results type of the Registry API
typedef ss_typename_type_k traits_type::result_type result_type;
/// @}
/// \name Construction
/// @{
public:
- /// \brief Default constructor
+ /// Default constructor
basic_reg_value();
- /// \brief Copy constructor
+ /// Copy constructor
basic_reg_value(class_type const& rhs);
protected:
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
@@ -325,25 +329,25 @@ class basic_reg_value
friend class basic_reg_key<C, T, A>;
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
- /// \brief Internal constructor, used by basic_reg_key and basic_reg_value_sequence.
+ /// Internal constructor, used by basic_reg_key and basic_reg_value_sequence.
basic_reg_value(hkey_type hkeyParent, string_type const& value_name)
- : m_hkey(dup_key_(hkeyParent, KEY_READ))
- , m_name(value_name)
+ : m_name(value_name)
+ , m_hkey(dup_key_(hkeyParent, KEY_READ))
, m_type(REG_NONE)
, m_bTypeRetrieved(ws_false_v)
{} // Implementation provided here, as otherwise VC5 will not link
public:
- /// \brief Destructor
+ /// Destructor
~basic_reg_value() stlsoft_throw_0();
- /// \brief Copy assignment operator
+ /// Copy assignment operator
class_type& operator =(class_type const& rhs);
/// @}
/// \name Attributes
/// @{
public:
- /// \brief Returns the type of the value
+ /// Returns the type of the value
///
/// \retval REG_NONE No value type
/// \retval REG_SZ A Unicode nul terminated string
@@ -361,27 +365,27 @@ class basic_reg_value
/// \retval REG_QWORD_LITTLE_ENDIAN A 64-bit number (same as REG_QWORD)
ws_dword_t type() const;
- /// \brief The name of the value
+ /// The name of the value
string_type name() const;
- /// \brief The registry value in \c REG_SZ form
+ /// The registry value in \c REG_SZ form
///
/// This method does <i>not</i> expand environment strings
string_type value_sz() const;
- /// \brief The registry value in \c REG_EXPAND_SZ form
+ /// The registry value in \c REG_EXPAND_SZ form
///
/// This method <i>does</i> expand environment strings
string_type value_expand_sz() const;
- /// \brief The registry value as a 32-bit integer
+ /// The registry value as a 32-bit integer
ws_dword_t value_dword() const;
- /// \brief The registry value as a translated (from little-endian) 32-bit integer
+ /// The registry value as a translated (from little-endian) 32-bit integer
ws_dword_t value_dword_littleendian() const;
- /// \brief The registry value as a translated (from big-endian) 32-bit integer
+ /// The registry value as a translated (from big-endian) 32-bit integer
ws_dword_t value_dword_bigendian() const;
- /// \brief The registry value as a binary value
+ /// The registry value as a binary value
blob_type value_binary() const;
#ifndef WINSTL_REG_VALUE_NO_MULTI_SZ
- /// \brief The registry value in \c REG_MULTI_SZ form
+ /// The registry value in \c REG_MULTI_SZ form
strings_type value_multi_sz() const;
#endif /* !WINSTL_REG_VALUE_NO_MULTI_SZ */
/// @}
@@ -396,25 +400,25 @@ class basic_reg_value
/// \name Members
/// @{
private:
- hkey_type m_hkey; // The parent key of the value
string_type m_name; // The name of the value
+ hkey_type m_hkey; // The parent key of the value
ss_mutable_k ws_dword_t m_type; // The type of the value
ss_mutable_k ws_bool_t m_bTypeRetrieved; // Facilitates lazy evaluation of the type
/// @}
};
/* Typedefs to commonly encountered types. */
-/** \brief Specialisation of the basic_reg_value template for the ANSI character type \c char
+/** Specialisation of the basic_reg_value template for the ANSI character type \c char
*
* \ingroup group__library__windows_registry
*/
typedef basic_reg_value<ws_char_a_t, reg_traits<ws_char_a_t>, processheap_allocator<ws_char_a_t> > reg_value_a;
-/** \brief Specialisation of the basic_reg_value template for the Unicode character type \c wchar_t
+/** Specialisation of the basic_reg_value template for the Unicode character type \c wchar_t
*
* \ingroup group__library__windows_registry
*/
typedef basic_reg_value<ws_char_w_t, reg_traits<ws_char_w_t>, processheap_allocator<ws_char_w_t> > reg_value_w;
-/** \brief Specialisation of the basic_reg_value template for the Win32 character type \c TCHAR
+/** Specialisation of the basic_reg_value template for the Win32 character type \c TCHAR
*
* \ingroup group__library__windows_registry
*/
@@ -435,15 +439,16 @@ typedef basic_reg_value<TCHAR, reg_traits<TCHAR>, processheap_allocator<TCHAR> >
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
inline basic_reg_value<C, T, A>::basic_reg_value()
- : m_hkey(NULL)
+ : m_name()
+ , m_hkey(NULL)
, m_type(REG_NONE)
, m_bTypeRetrieved(ws_false_v)
{}
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
inline basic_reg_value<C, T, A>::basic_reg_value(class_type const& rhs)
- : m_hkey(dup_key_(rhs.m_hkey, KEY_READ))
- , m_name(rhs.m_name)
+ : m_name(rhs.m_name)
+ , m_hkey(dup_key_(rhs.m_hkey, KEY_READ))
, m_type(rhs.m_type)
, m_bTypeRetrieved(rhs.m_bTypeRetrieved)
{}
@@ -451,8 +456,8 @@ inline basic_reg_value<C, T, A>::basic_reg_value(class_type const& rhs)
#if 0
template <ss_typename_param_k C, ss_typename_param_k T, ss_typename_param_k A>
inline basic_reg_value<C, T, A>::basic_reg_value(basic_reg_value<C, T, A>::hkey_type hkeyParent, basic_reg_value<C, T, A>::string_type const& value_name)
- : m_hkey(dup_key_(hkeyParent))
- , m_name(value_name)
+ : m_name(value_name)
+ , m_hkey(dup_key_(hkeyParent))
, m_type(REG_NONE)
, m_bTypeRetrieved(ws_false_v)
{}
@@ -581,7 +586,7 @@ inline ss_typename_type_ret_k basic_reg_value<C, T, A>::string_type basic_reg_va
}
#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
}
- else if(data_size > 0)
+ else if(data_size > 0) // Are there _any_ values have non-zero size
{
char_buffer_type_ buffer(1 + data_size);
ws_dword_t dw;
@@ -604,7 +609,7 @@ inline ss_typename_type_ret_k basic_reg_value<C, T, A>::string_type basic_reg_va
}
#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
}
- else
+ else if(data_size > 0) // We do a second check here because the requested value might have 0-size, and because registry contents can be changed by other processes
{
WINSTL_ASSERT(0 != data_size);
@@ -774,7 +779,7 @@ inline ss_typename_type_ret_k basic_reg_value<C, T, A>::strings_type basic_reg_v
}
#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
}
- else if(data_size > 0)
+ else if(data_size > 0) // Are there _any_ values have non-zero size
{
char_buffer_type_ buffer(1 + data_size);
ws_dword_t dw;
@@ -797,7 +802,7 @@ inline ss_typename_type_ret_k basic_reg_value<C, T, A>::strings_type basic_reg_v
}
#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
}
- else
+ else if(data_size > 0) // We do a second check here because the requested value might have 0-size, and because registry contents can be changed by other processes
{
buffer[data_size / sizeof(char_type)] = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.