From 73e74b5916eb6c1976d7b4ba1cde663ed17de08c Mon Sep 17 00:00:00 2001 From: Vihas Makwana <121151420+VihasMakwana@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:02:09 +0530 Subject: [PATCH] [windows] - Fix permissions for GetProcessMemoryInfo (#185) 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: https://github.com/elastic/beats/issues/41407 --- sigar_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigar_windows.go b/sigar_windows.go index 7d9652686..5c66bcd18 100644 --- a/sigar_windows.go +++ b/sigar_windows.go @@ -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) }