Closed Xeckt closed 11 months ago
So it seems the problem is rooted in the filepath.Base()
function. I ran into a problematic registry key tree:
ej-technologies -> [key]
-- exe4j -> [ej-technologies subkey]
--- jvms -> [exe4j subkey]
---- c:/program files/[redacted]/jre/bin/java.exe -> [jvms subkey - PROBLEM]
Now I don't know what kind of animal put a key name as a filepath and not as a REG_SZ
value inside the key but here we are. I will have to rework how the Traverse() function handles key names. In this example the traverse function will pickup java.exe
as the subkey.Path
sk, err := r.SubKeys[filepath.Base(s.Key.Path)].OpenKey(true)
This also explains why the error also appears with the below tree.
Fixed with commit e302858220f6078521a3c02880bf3e33a5ec8281
When using the
Traverse()
function with only it's implicit behaviour (currently in dev branch only), eventually the traversal will raise aruntime error
and panic.Reproducible with the following code:
What seems to happen is the
SubKey
struct becomes<nil>
. This was identified through some basic print debugging:The error that generates
Output given just before error (giving last two keys opened)
You can see that the opening key has a pointer during traversal of multiple registry keys, but eventually turns
<nil>
when working its way down.The reason why is unknown but this is something that urgently needs a stable fix.
Sigh, what a problematic error.