Skip to content

Commit

Permalink
Merge branch 'master' into cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke authored Aug 5, 2024
2 parents 0c2e7d9 + dffc53e commit d0ff717
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/headers/wtsapi32/wtsapi32.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,17 @@ func WTSCloseServer(server syscall.Handle) error {
}

func WTSFreeMemoryEx(class WTSTypeClass, pMemory uintptr, NumberOfEntries uint32) error {
_, _, err := procWTSFreeMemoryEx.Call(
r1, _, err := procWTSFreeMemoryEx.Call(
uintptr(class),
pMemory,
uintptr(NumberOfEntries),
)

return err
if r1 != 1 {
return fmt.Errorf("failed to free memory: %w", err)
}

return nil
}

func WTSEnumerateSessionsEx(server syscall.Handle, logger log.Logger) ([]WTSSession, error) {
Expand All @@ -169,7 +173,7 @@ func WTSEnumerateSessionsEx(server syscall.Handle, logger log.Logger) ([]WTSSess
defer func(class WTSTypeClass, pMemory uintptr, NumberOfEntries uint32) {
err := WTSFreeMemoryEx(class, pMemory, NumberOfEntries)
if err != nil {
_ = level.Error(logger).Log("msg", "failed to free memory", "err", err)
_ = level.Error(logger).Log("msg", "failed to free memory", "err", fmt.Errorf("WTSEnumerateSessionsEx: %w", err))
}
}(WTSTypeSessionInfoLevel1, sessionInfoPointer, count)
}
Expand Down

0 comments on commit d0ff717

Please sign in to comment.