Getting error 87 (INVALID_PARAMETER) when executing RegGetValueA

My code:

        HKEY hKey;
        char *path = "SYSTEM\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles\\0001";
        LONG result1 = RegOpenKeyExA(HKEY_LOCAL_MACHINE, path, 0, KEY_ALL_ACCESS, &hKey);
        QString q = QString::number(result1);

        if (result1 == ERROR_SUCCESS) {
            LPDWORD b {};
            char *buffer[250];
            LONG result12 = RegGetValueA(hKey, path, "HwProfileGuid", RRF_RT_REG_SZ, NULL, &buffer, b);

            if (result12 == ERROR_SUCCESS) {

                QMessageBox messageBox1;
                messageBox1.critical(0,"Error", "Sucesso");
                messageBox1.setFixedSize(500,200);
            } else {
                QString q = QString::number(result12);
                QMessageBox messageBox2;
                messageBox2.critical(0,"Error", q);
                messageBox2.setFixedSize(500,200);
            }


        } else {
            QMessageBox messageBox2;
            messageBox2.critical(0,"Error", q);
            messageBox2.setFixedSize(500,200);
        }

I am a beginner and I am unsure of what parameter is the invalid one, I would really aprecciate some help.



Read more here: https://stackoverflow.com/questions/67386715/getting-error-87-invalid-parameter-when-executing-reggetvaluea

Content Attribution

This content was originally published by El_Sapo_Pepe at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: