Commit 99df99b0 authored by jan.koester's avatar jan.koester
Browse files

inital support regedit

parent d7f704cb
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -281,6 +281,36 @@ namespace confplus {
        
        HKEY hRootKey;
        DWORD dwDisposition;
        std::string fullPath(path);
        HKEY hRootKey = HKEY_CURRENT_USER; // Standard-Root-Key
        std::string subKeyPath = fullPath;
        
        // 1. Root-Key und Subkey-Pfad parsen
        size_t slashPos = fullPath.find('\\');

        if (slashPos != std::string::npos) {
            std::string rootKeyName = fullPath.substr(0, slashPos);
            
            // Konvertierung der Root-Key-Namen
            if (rootKeyName == "HKEY_LOCAL_MACHINE" || rootKeyName == "HKLM") {
                hRootKey = HKEY_LOCAL_MACHINE;
            } else if (rootKeyName == "HKEY_CURRENT_USER" || rootKeyName == "HKCU") {
                hRootKey = HKEY_CURRENT_USER;
            } else if (rootKeyName == "HKEY_CLASSES_ROOT" || rootKeyName == "HKCR") {
                hRootKey = HKEY_CLASSES_ROOT;
            } else if (rootKeyName == "HKEY_USERS" || rootKeyName == "HKU") {
                hRootKey = HKEY_USERS;
            } else if (rootKeyName == "HKEY_CURRENT_CONFIG" || rootKeyName == "HKCC") {
                hRootKey = HKEY_CURRENT_CONFIG;
            } else {
                // Der Pfad beginnt nicht mit einem bekannten Root-Key. 
                // Behandle den gesamten Pfad als relativ zum Standard-Root-Key (HKEY_CURRENT_USER).
                goto OpenKey;
            }
            
            // Subkey-Pfad ist der Rest nach dem ersten '\'
            subKeyPath = fullPath.substr(slashPos + 1);
        }

        LONG lRes = RegCreateKeyExA(
            REGISTRY_ROOT_KEY, // Nutzt den globalen Root-Key