aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2026-02-17 16:13:41 +1100
committerAlex Brainman <alex.brainman@gmail.com>2026-02-19 20:07:04 -0800
commitf3755d9eba1147eb2cc3257689764f0cd8aac77b (patch)
tree078cf01c8e4af3516154a8d716d36a9e058f8d1b /src
parent09c3cfbc208fbd3ee8a06885e7efa53cdd56be7a (diff)
downloadgo-f3755d9eba1147eb2cc3257689764f0cd8aac77b.tar.xz
internal/syscall/windows: use byte instead of bool for all BOOLEAN Windows data types
According to https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types BOOLEAN is defined as BYTE, and BYTE is equivalent to Go byte. This CL corrects CL 713480. It adjusts FILE_DISPOSITION_INFO.DeleteFile, FILE_DISPOSITION_INFORMATION.DeleteFile, FILE_RENAME_INFORMATION.ReplaceIfExists and FILE_LINK_INFORMATION.ReplaceIfExists to use byte instead of bool type. Updates #75922 Change-Id: Ifadc9696becb076b1403ca2e780d973e3d3dad69 Reviewed-on: https://go-review.googlesource.com/c/go/+/746061 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/internal/syscall/windows/at_windows.go6
-rw-r--r--src/internal/syscall/windows/types_windows.go8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/internal/syscall/windows/at_windows.go b/src/internal/syscall/windows/at_windows.go
index f1360872f5..a5601493d8 100644
--- a/src/internal/syscall/windows/at_windows.go
+++ b/src/internal/syscall/windows/at_windows.go
@@ -355,7 +355,7 @@ func deleteatFallback(h syscall.Handle) error {
h,
FileDispositionInfo,
unsafe.Pointer(&FILE_DISPOSITION_INFO{
- DeleteFile: true,
+ DeleteFile: 1,
}),
uint32(unsafe.Sizeof(FILE_DISPOSITION_INFO{})),
)
@@ -416,7 +416,7 @@ func Renameat(olddirfd syscall.Handle, oldpath string, newdirfd syscall.Handle,
//
// Try again.
renameInfo := FILE_RENAME_INFORMATION{
- ReplaceIfExists: true,
+ ReplaceIfExists: 1,
RootDirectory: newdirfd,
}
copy(renameInfo.FileName[:], p16)
@@ -602,7 +602,7 @@ func symlinkat(oldname string, newdirfd syscall.Handle, newname string, flags Sy
h,
&IO_STATUS_BLOCK{},
unsafe.Pointer(&FILE_DISPOSITION_INFORMATION{
- DeleteFile: true,
+ DeleteFile: 1,
}),
uint32(unsafe.Sizeof(FILE_DISPOSITION_INFORMATION{})),
FileDispositionInformation,
diff --git a/src/internal/syscall/windows/types_windows.go b/src/internal/syscall/windows/types_windows.go
index 21aeb8faf9..a3d92b2b35 100644
--- a/src/internal/syscall/windows/types_windows.go
+++ b/src/internal/syscall/windows/types_windows.go
@@ -219,12 +219,12 @@ const (
// https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_disposition_info
type FILE_DISPOSITION_INFO struct {
- DeleteFile bool
+ DeleteFile byte
}
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information
type FILE_DISPOSITION_INFORMATION struct {
- DeleteFile bool
+ DeleteFile byte
}
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_disposition_information_ex
@@ -250,7 +250,7 @@ const (
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_rename_information
type FILE_RENAME_INFORMATION struct {
- ReplaceIfExists bool
+ ReplaceIfExists byte
RootDirectory syscall.Handle
FileNameLength uint32
FileName [syscall.MAX_PATH]uint16
@@ -266,7 +266,7 @@ type FILE_RENAME_INFORMATION_EX struct {
// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_link_information
type FILE_LINK_INFORMATION struct {
- ReplaceIfExists bool
+ ReplaceIfExists byte
RootDirectory syscall.Handle
FileNameLength uint32
FileName [syscall.MAX_PATH]uint16