Sha256: a70fd5f1c23e9727e883c07dbe69f6dc154bb87823496b6c24bef0288eb0d36d

Contents?: true

Size: 1.96 KB

Versions: 16

Compression:

Stored size: 1.96 KB

Contents

/**
 * @file
 * Declares utility functions for interacting with the Windows registry.
 */
#pragma once

#include <string>
#include <vector>
#include <stdexcept>

namespace leatherman { namespace windows {

    /**
     * Exception thrown when registry lookupfails.
     */
    struct registry_exception : std::runtime_error
    {
        /**
         * Constructs a registry_exception.
         * @param message The exception message.
         */
        explicit registry_exception(std::string const& message);
    };

    namespace registry {
        /**
         * HKEY Classes, derived from
         * http://msdn.microsoft.com/en-us/library/windows/desktop/ms724868(v=vs.85).aspxs
         */
        enum class HKEY {
            CLASSES_ROOT, CURRENT_CONFIG, CURRENT_USER, LOCAL_MACHINE,
            PERFORMANCE_DATA, PERFORMANCE_NLSTEXT, PERFORMANCE_TEXT, USERS
        };

        /**
         * Retrieve a string value from the registry.
         * @param hkey The registry key handle.
         * @param subkey The name of the registry key.
         * @param value The name of the registry value.
         * @return A string value corresponding to a REG_SZ or REG_EXPAND_SZ type.
         *         Returns an empty string if the value doesn't exist or isn't a string type.
         */
        std::string get_registry_string(HKEY hkey, std::string const& subkey, std::string const& value);

        /**
         * Retrieve a vector of string values from the registry.
         * @param hkey The registry key handle.
         * @param subkey The name of the registry key.
         * @param value The name of the registry value.
         * @return An array of string values corresponding to the REG_MULTI_SZ type.
         *         Returns an empty vector if the value doesn't exist or isn't a composite string type.
         */
        std::vector<std::string> get_registry_strings(HKEY hkey, std::string const& subkey, std::string const& value);
    }

}}  // namespace leatherman::windows

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.12.1.cfacter.20181031 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.6.cfacter.20181031 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.12.1.cfacter.20181023 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.5.cfacter.20181022 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.12.0.cfacter.20181004 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.12.0.cfacter.20181001 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.12.0.cfacter.20180918 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.4.cfacter.20180821 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.3.cfacter.20180716 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.2.cfacter.20180612 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.9.6.cfacter.20180612 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.2.cfacter.20180606 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.9.6.cfacter.20180606 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
facter-3.11.0.cfacter.20180319 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp
cfacter-3.11.0.rc.20180314 ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp