Refine WireGuard client routing and authentication UI

This commit is contained in:
opsx committed 2026-10-21 21:10:53 +08:00
1 parent eabb3e4472
commit 41fb9d5631
33 files changed
+1709 -469

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
//go:build windows
package main
import (
"os"
"syscall"
"golang.org/x/sys/windows"
)
func openRecord(path string) (*os.File, error) {
name, err := windows.UTF16PtrFromString(path)
if err != nil {
return nil, err
}
handle, err := windows.CreateFile(name, windows.GENERIC_READ, windows.FILE_SHARE_READ,
nil, windows.OPEN_EXISTING, windows.FILE_FLAG_OPEN_REPARSE_POINT, 0)
if err != nil {
return nil, err
}
var data windows.ByHandleFileInformation
if err := windows.GetFileInformationByHandle(handle, &data); err != nil {
windows.CloseHandle(handle)
return nil, err
}
if data.FileAttributes&windows.FILE_ATTRIBUTE_REPARSE_POINT != 0 {
windows.CloseHandle(handle)
return nil, syscall.EINVAL
}
return os.NewFile(uintptr(handle), path), nil
}