弃用过期函数,修复Process Name获取问题
This commit is contained in:
Meta
2022-03-26 16:17:44 +08:00
parent 24583009c4
commit 0d068e7b5f
2 changed files with 5 additions and 37 deletions

View File

@ -174,7 +174,7 @@ func newSearcher(isV4, isTCP bool) *searcher {
func getTransportTable(fn uintptr, family int, class int) ([]byte, error) {
for size, buf := uint32(8), make([]byte, 8); ; {
ptr := unsafe.Pointer(&buf[0])
err, _, _ := syscall.SyscallN(fn, 6, uintptr(ptr), uintptr(unsafe.Pointer(&size)), 0, uintptr(family), uintptr(class), 0)
err, _, _ := syscall.SyscallN(fn, uintptr(ptr), uintptr(unsafe.Pointer(&size)), 0, uintptr(family), uintptr(class), 0)
switch err {
case 0:
@ -205,14 +205,12 @@ func getExecPathFromPID(pid uint32) (string, error) {
if err != nil {
return "", err
}
defer func(handle windows.Handle) {
_ = windows.CloseHandle(handle)
}(h)
defer windows.CloseHandle(h)
buf := make([]uint16, syscall.MAX_LONG_PATH)
size := uint32(len(buf))
r1, _, err := syscall.SyscallN(
queryProcName, 4,
queryProcName,
uintptr(h),
uintptr(1),
uintptr(unsafe.Pointer(&buf[0])),