forked from cloudfoundry/gosigar
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProcStatus.PPID value is wrong on Windows #53
Labels
Comments
andrewkroh
added a commit
to andrewkroh/gosigar
that referenced
this issue
Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token. - Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis. - Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704. - Implements `Uptime.Get` for Windows. - Implements `Swap.Get` for Windows based on page file metrics. - Removes cgo usage for Windows.
andrewkroh
added a commit
to andrewkroh/gosigar
that referenced
this issue
Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token. - Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis. - Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704. - Implements `Uptime.Get` for Windows. - Implements `Swap.Get` for Windows based on page file metrics. - Removes cgo usage for Windows. - Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
andrewkroh
added a commit
to andrewkroh/gosigar
that referenced
this issue
Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token. - Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis. - Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704. - Implements `Uptime.Get` for Windows. - Implements `Swap.Get` for Windows based on page file metrics. - Removes cgo usage for Windows. - Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
andrewkroh
added a commit
to andrewkroh/gosigar
that referenced
this issue
Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token. - Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis. - Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704. - Implements `Uptime.Get` for Windows. - Implements `Swap.Get` for Windows based on page file metrics. - Removes cgo usage for Windows. - Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
ruflin
pushed a commit
that referenced
this issue
Oct 28, 2016
- Fixes #53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token. - Fixes #6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis. - Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704. - Implements `Uptime.Get` for Windows. - Implements `Swap.Get` for Windows based on page file metrics. - Removes cgo usage for Windows. - Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The ppid is obtained by calling
CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, <pid>)
and obtaining the PPID from the first process returned byProcess32First
. HoweverCreateToolhelp32Snapshot
ignores thepid
parameter when used with theTH32CS_SNAPPROCESS
flag. It returns a snapshot of all processes and you must iterate over the processes usingProcess32Next
.Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682489(v=vs.85).aspx
The text was updated successfully, but these errors were encountered: