|
|
@@ -113,12 +113,10 @@ func OpenRemoteKey(pcname string, k Key) (Key, error) {
|
|
|
// 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) {
|
|
|
- ki, err := k.Stat()
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- names := make([]string, 0, ki.SubKeyCount)
|
|
|
- buf := make([]uint16, ki.MaxSubKeyLen+1) // extra room for terminating zero byte
|
|
|
+ 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 {
|