mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-03 15:47:35 -04:00
windows: add GetFileInformationByHandleEx function
Change-Id: I950762ef59c665d027641b4410ac30697edad22d Reviewed-on: https://go-review.googlesource.com/c/sys/+/171939 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Alex Brainman
parent
9773273309
commit
16da32be82
@@ -146,6 +146,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||||||
//sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW
|
//sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW
|
||||||
//sys FindClose(handle Handle) (err error)
|
//sys FindClose(handle Handle) (err error)
|
||||||
//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error)
|
//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error)
|
||||||
|
//sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error)
|
||||||
//sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW
|
//sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW
|
||||||
//sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW
|
//sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW
|
||||||
//sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW
|
//sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ var (
|
|||||||
procFindNextFileW = modkernel32.NewProc("FindNextFileW")
|
procFindNextFileW = modkernel32.NewProc("FindNextFileW")
|
||||||
procFindClose = modkernel32.NewProc("FindClose")
|
procFindClose = modkernel32.NewProc("FindClose")
|
||||||
procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
|
procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
|
||||||
|
procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx")
|
||||||
procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
|
procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
|
||||||
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
|
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
|
||||||
procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
|
procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
|
||||||
@@ -772,6 +773,18 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
|
||||||
|
r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
|
||||||
|
if r1 == 0 {
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
} else {
|
||||||
|
err = syscall.EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
|
func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
|
r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
|
||||||
n = uint32(r0)
|
n = uint32(r0)
|
||||||
|
|||||||
Reference in New Issue
Block a user