From 4434d9e27f8e6e4dcebca781ba3a76a8a3340d1a Mon Sep 17 00:00:00 2001 From: MOHAN KUMAR R Date: Tue, 17 Dec 2024 13:34:24 +0530 Subject: [PATCH] added GetHandleInformation sys call --- windows/syscall_windows.go | 1 + windows/zsyscall_windows.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go index 4a3254386..d6183a234 100644 --- a/windows/syscall_windows.go +++ b/windows/syscall_windows.go @@ -167,6 +167,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW //sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW //sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) +//sys GetHandleInformation (handle Handle, flags *uint32) (err error) //sys DisconnectNamedPipe(pipe Handle) (err error) //sys GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) //sys GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index 01c0716c2..31c86171b 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -272,6 +272,7 @@ var ( procGetFileType = modkernel32.NewProc("GetFileType") procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW") procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW") + procGetHandleInformation = modkernel32.NewProc("GetHandleInformation ") procGetLargePageMinimum = modkernel32.NewProc("GetLargePageMinimum") procGetLastError = modkernel32.NewProc("GetLastError") procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW") @@ -2384,6 +2385,14 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( return } +func GetHandleInformation(handle Handle, flags *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetHandleInformation.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(flags)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func GetLargePageMinimum() (size uintptr) { r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0) size = uintptr(r0)