Implement Lazy Loading of NameTable

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2023-07-10 13:59:57 +02:00
committed by Jan-Otto Kröpke
parent 9b5bc37a42
commit 11218a95d0
3 changed files with 50 additions and 45 deletions

View File

@@ -175,9 +175,6 @@ type PerfCounter struct {
SecondValue int64
}
// Error value returned by RegQueryValueEx if the buffer isn't sufficiently large
const errorMoreData = syscall.Errno(syscall.ERROR_MORE_DATA)
var (
bufLenGlobal = uint32(400000)
bufLenCostly = uint32(2000000)
@@ -223,7 +220,7 @@ func queryRawData(query string) ([]byte, error) {
(*byte)(unsafe.Pointer(&buffer[0])),
&bufLen)
if err == errorMoreData {
if err == error(syscall.ERROR_MORE_DATA) {
newBuffer := make([]byte, len(buffer)+16384)
copy(newBuffer, buffer)
buffer = newBuffer