Skip to content

Commit

Permalink
[windows] - Fix permissions for GetProcessMemoryInfo (#185)
Browse files Browse the repository at this point in the history
As per https://learn.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getprocessmemoryinfo,
GetProcessMemoryInfo doesn't need PROCESS_VM_READ. Hence, remove
it and only use PROCESS_QUERY_LIMITED_INFORMATION.

Relates: elastic/beats#41407
  • Loading branch information
VihasMakwana authored Dec 13, 2024
1 parent 0b9c34c commit 73e74b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sigar_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func getProcCredName(pid int) (string, error) {
}

func (self *ProcMem) Get(pid int) error {
handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess|windows.PROCESS_VM_READ, false, uint32(pid))
handle, err := syscall.OpenProcess(processQueryLimitedInfoAccess, false, uint32(pid))
if err != nil {
return errors.Wrapf(err, "OpenProcess failed for pid=%v", pid)
}
Expand Down

0 comments on commit 73e74b5

Please sign in to comment.