diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-10-28 09:12:20 -0400 |
commit | a16e30d162c1c7408db7821e7b9513cefa09c6ca (patch) | |
tree | af752ba9ba44c547df39bb0af9bff79f610ba9d5 /src/internal/syscall/windows/registry/key.go | |
parent | 91e4d2d57bc341dd82c98247117114c851380aef (diff) | |
parent | cf6cfba4d5358404dd890f6025e573a4b2156543 (diff) | |
download | go-git-dev.link.tar.gz |
[dev.link] all: merge branch 'master' into dev.linkdev.link
Clean merge.
Change-Id: Ia7b2808bc649790198d34c226a61d9e569084dc5
Diffstat (limited to 'src/internal/syscall/windows/registry/key.go')
-rw-r--r-- | src/internal/syscall/windows/registry/key.go | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/internal/syscall/windows/registry/key.go b/src/internal/syscall/windows/registry/key.go index cc3d0c774b..612c48f084 100644 --- a/src/internal/syscall/windows/registry/key.go +++ b/src/internal/syscall/windows/registry/key.go @@ -25,10 +25,7 @@ // package registry -import ( - "io" - "syscall" -) +import "syscall" const ( // Registry key security and access rights. @@ -90,20 +87,13 @@ func OpenKey(k Key, path string, access uint32) (Key, error) { } // ReadSubKeyNames returns the names of subkeys of key k. -// The parameter n controls the number of returned names, -// analogous to the way os.File.Readdirnames works. -func (k Key) ReadSubKeyNames(n int) ([]string, error) { +func (k Key) ReadSubKeyNames() ([]string, error) { names := make([]string, 0) // Registry key size limit is 255 bytes and described there: // https://msdn.microsoft.com/library/windows/desktop/ms724872.aspx buf := make([]uint16, 256) //plus extra room for terminating zero byte loopItems: for i := uint32(0); ; i++ { - if n > 0 { - if len(names) == n { - return names, nil - } - } l := uint32(len(buf)) for { err := syscall.RegEnumKeyEx(syscall.Handle(k), i, &buf[0], &l, nil, nil, nil, nil) @@ -123,9 +113,6 @@ loopItems: } names = append(names, syscall.UTF16ToString(buf[:l])) } - if n > len(names) { - return names, io.EOF - } return names, nil } |