Commit 8836c115 authored by jan.koester's avatar jan.koester
Browse files

inital support regedit

parent 686450e9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ if(INIPARSER_FOUND)
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
    set(regeditsrc regconf.cpp)
    set(regeditsrc regedit/regedit.cpp)
    
    add_library(regedit SHARED ${regeditsrc})

+8 −10
Original line number Diff line number Diff line
@@ -40,10 +40,6 @@


namespace confplus {   
    
    // Basis-Schlüssel in der Registry unter HKEY_CURRENT_USER
    const char* REGISTRY_BASE_PATH = "SOFTWARE\\ConfPlus\\Config";
    
    // --- Implementierung der Registry-Klasse ---
    
    Registry::Registry(){}
@@ -71,14 +67,15 @@ namespace confplus {

        LONG lRes = RegCreateKeyExA(
            HKEY_CURRENT_USER,      
            REGISTRY_BASE_PATH,     
            path,     
            0, NULL, REG_OPTION_NON_VOLATILE, 
            KEY_ALL_ACCESS,         
            NULL, &hKey, &dwDisposition
        );

        if (lRes != ERROR_SUCCESS) {
            throw Exception("Failed to create/open registry key.");
            ConfException e;
            throw e[ConfException::Error]<< "Failed to create/open registry key.";
        }

        // TODO: Hier die Iterationslogik über conf->getAllKeys() und RegSetValueExA 
@@ -95,14 +92,14 @@ namespace confplus {

        LONG lRes = RegOpenKeyExA(
            HKEY_CURRENT_USER, 
            REGISTRY_BASE_PATH, 
            path, 
            0, 
            KEY_READ, 
            &hKey
        );

        if (lRes != ERROR_SUCCESS) {
            std::cerr << "Registry key not found: " << REGISTRY_BASE_PATH << std::endl;
            std::cerr << "Registry key not found: " << path << std::endl;
            return;
        }

@@ -116,7 +113,8 @@ namespace confplus {

        if (lRes != ERROR_SUCCESS) {
            RegCloseKey(hKey);
            throw Exception("Failed to query registry key info.");
            ConfException e;
            throw e[ConfException::Error] << "Failed to query registry key info.";;
        }

        // Buffer allozieren (+1 für Nullterminierung)