{"record":{"id":"eacf7fdbcfc41891","repo":"ramensoftware/windhawk","slug":"regenumvalue","errorCode":null,"errorMessage":"RegEnumValue","messagePattern":"RegEnumValue","errorType":"error_code","errorClass":"SettingsError","httpStatus":null,"severity":"error","filePath":"src/windhawk-core/windows/src/registry.rs","lineNumber":580,"sourceCode":"            // SAFETY: name_buf has name_len units; the data out params are\n            // null (we re-read each value by name to type it uniformly).\n            let rc = unsafe {\n                RegEnumValueW(\n                    hkey,\n                    index,\n                    name_buf.as_mut_ptr(),\n                    &mut name_len,\n                    std::ptr::null(),\n                    std::ptr::null_mut(),\n                    std::ptr::null_mut(),\n                    std::ptr::null_mut(),\n                )\n            };\n            if rc == ERROR_NO_MORE_ITEMS {\n                break;\n            }\n            if rc != ERROR_SUCCESS {\n                return Err(self.err(\"enum\", rc, \"RegEnumValue\"));\n            }\n            name_buf.truncate(name_len as usize);\n            let name = from_wide(&name_buf);\n            if let Some((t, bytes)) = self.query_raw(&name)? {\n                let value = if t == REG_SZ {\n                    TreeValue::Str(decode_sz(&bytes))\n                } else if t == REG_DWORD {\n                    match decode_dword(&bytes) {\n                        Some(i) => TreeValue::Int(i),\n                        None => {\n                            index += 1;\n                            continue;\n                        }\n                    }\n                } else if t == REG_BINARY {\n                    TreeValue::Binary(bytes)\n                } else {\n                    index += 1;","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/ramensoftware/windhawk/blob/61d99ed8e182e1af1b60109612b6763ad1b4b74e/src/windhawk-core/windows/src/registry.rs#L562-L598","documentation":"This error is raised when `RegEnumValueW` returns a code other than ERROR_SUCCESS or ERROR_NO_MORE_ITEMS while iterating a registry key's values. It aborts the value enumeration of settings stored in the registry, wrapping the raw Win32 return code in a SettingsError.","triggerScenarios":"Enumerating values of a key whose handle became invalid (ERROR_KEY_DELETED / ERROR_INVALID_HANDLE), or a key with a value whose metadata cannot be read due to registry corruption or concurrent modification.","commonSituations":"Another process deletes or rewrites the key while settings are being listed; registry hives corrupted; handle opened with insufficient rights to query values.","solutions":["Re-open the key and retry the enumeration","Check the wrapped Win32 return code for the specific failure","Ensure the key handle was opened with KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS rights","Avoid deleting values from the key concurrently with enumeration"],"exampleFix":"// before\nlet values = settings.enum_values()?;\n// after\nlet values = match settings.enum_values() {\n    Ok(v) => v,\n    Err(e) => { log::warn!(\"registry enum failed: {e}; reopening key\"); reopen_and_retry()? }\n};","handlingStrategy":"retry","validationCode":"// ensure the key exists and is readable before enumerating\n// (RegQueryInfoKey on the same handle first is the Win32-level guard)","typeGuard":null,"tryCatchPattern":"match settings.enum_values() {\n    Ok(v) => v,\n    Err(e) => { warn!(\"enum failed ({e}); reopening key\"); reopen_key()?.enum_values()? }\n}","preventionTips":["Open the key with KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS","Avoid concurrent writes/deletes on the key during enumeration","Re-open stale handles instead of reusing them across sessions"],"tags":["windows","registry","win32","enumeration"],"backgroundTag":"database-query-failed","analyzedSha":"61d99ed8e182e1af1b60109612b6763ad1b4b74e","analyzedAt":"2026-09-12T14:02:41.115Z","contentChangedAt":"2026-09-12T14:02:41.115Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}