xeckt / reggie Goto Github PK
View Code? Open in Web Editor NEWWrapper for Go's Registry package.
License: MIT License
Wrapper for Go's Registry package.
License: MIT License
When using the Traverse()
function with only it's implicit behaviour (currently in dev branch only), eventually the traversal will raise a runtime error
and panic.
Reproducible with the following code:
func main() {
r := reggie.New()
r.RootKey = registry.CURRENT_USER
r.Path = `SOFTWARE`
r.Permission = registry.ALL_ACCESS
err := r.GetKeysValues()
if err != nil {
fmt.Println(err)
return
}
err = reggie.Traverse(r, func(reg *reggie.Reg) {
if reg != nil {
fmt.Printf("\nPath: %s", reg.Path)
}
})
if err != nil {
fmt.Println(err)
}
}
What seems to happen is the SubKey
struct becomes <nil>
. This was identified through some basic print debugging:
func (s *SubKey) OpenKey(populateKeyValues bool) (*Reg, error) {
fmt.Println("OPENING KEY", s)
k := Reg{
RootKey: s.Key.RootKey,
Path: s.Key.Path,
Permission: s.Key.Permission,
SubKeys: make(map[string]*SubKey),
}
...
The error that generates
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x56035e]
Output given just before error (giving last two keys opened)
Path: SOFTWARE\ej-technologies\exe4j
DEBUG: &{0xc0001538c0 map[]} 2147483649 &{2147483649 SOFTWARE\ej-technologies\exe4j\jvms 983103 848 map[]} map[] map[] SOFTWARE\ej-technologies\exe4j\jvms 0
OPENING KEY &{0xc0001538c0 map[]}
{2147483649 SOFTWARE\ej-technologies\exe4j\jvms 983103 0 map[]}
{2147483649 SOFTWARE\ej-technologies\exe4j\jvms 983103 0 map[c:/program files/runemate/jre/bin/java.exe:0xc000168bc0]}
Path: SOFTWARE\ej-technologies\exe4j\jvms
DEBUG: &{0xc000153c20 map[LastWriteTime:[208 96 190 223 149 172 216 1] Version:11.0.14]} 2147483649 &{2147483649 SOFTWARE\ej-technologies\exe4j\jvms\c:/program files/runemate/jre/bin/java.exe 983103 860 map[]} map[LastWriteTime:[
208 96 190 223 149 172 216 1] Version:11.0.14] map[] SOFTWARE\ej-technologies\exe4j\jvms\c:/program files/runemate/jre/bin/java.exe 0
OPENING KEY <nil>
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.