Stefan Leichter Stefan.Leichter@camline.com writes:
- RegOpenKeyA(HKEY_LOCAL_MACHINE, "Hardware\Description\System", &desc_sys);
- RegOpenKeyA(HKEY_LOCAL_MACHINE, "Hardware\Devicemap\Serialcomm", &sercom);
- RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\Ports", &sw_ports);
You need to check for failure and handle it properly. I doubt you'll be able to open these keys on Win9x for instance.
- result = RegOpenKeyA(HKEY_LOCAL_MACHINE, "System\Select", &sub_key1);
- if(ERROR_SUCCESS == result) {
size = sizeof(count1);
result = RegQueryValueExA( sub_key1, "Current", NULL, NULL, (LPBYTE) &count1, &size);
RegCloseKey(sub_key1);
- }
- if(ERROR_SUCCESS == result) {
sprintf(sub_key1_name, "System\\ControlSet%03d\\Enum\\ACPI", count1);
RegOpenKeyA(HKEY_LOCAL_MACHINE, sub_key1_name, &acpi);
- }
Do you really have an app that accesses ControlSetxxx directly? CurrentControlSet is a lot easier to work with.