diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-17 18:06:05 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-17 18:06:05 +0100 |
commit | 98a3813111c2e8f4c6bec480dbb21ec8eb1f24cc (patch) | |
tree | 9653fc824685bd2667be40f86c5f5b29289720c5 /updater | |
parent | version: bump (diff) | |
download | wireguard-windows-98a3813111c2e8f4c6bec480dbb21ec8eb1f24cc.tar.xz wireguard-windows-98a3813111c2e8f4c6bec480dbb21ec8eb1f24cc.zip |
updater: SetFileInformationByHandle moved into x/sys
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'updater')
-rw-r--r-- | updater/msirunner_windows.go | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/updater/msirunner_windows.go b/updater/msirunner_windows.go index e016dc78..4ae18c01 100644 --- a/updater/msirunner_windows.go +++ b/updater/msirunner_windows.go @@ -32,16 +32,6 @@ func (t *tempFile) ExclusivePath() string { return t.Name() } -//TODO: remove when https://go-review.googlesource.com/c/sys/+/270757 is merged -const fileDispositionInfo = 4 - -func setFileInformationByHandle(handle windows.Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(windows.NewLazySystemDLL("kernel32.dll").NewProc("SetFileInformationByHandle").Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0) - if r1 == 0 { - err = e1 - } - return -} func (t *tempFile) Delete() error { if t.originalHandle == 0 { @@ -52,7 +42,7 @@ func (t *tempFile) Delete() error { return windows.DeleteFile(name16) //TODO: how does this deal with reparse points? } disposition := uint32(1) - err := setFileInformationByHandle(t.originalHandle, fileDispositionInfo, (*byte)(unsafe.Pointer(&disposition)), uint32(unsafe.Sizeof(disposition))) + err := windows.SetFileInformationByHandle(t.originalHandle, windows.FileDispositionInfo, (*byte)(unsafe.Pointer(&disposition)), uint32(unsafe.Sizeof(disposition))) t.originalHandle = 0 t.Close() return err |