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>
This commit is contained in:
Alex Brainman
2026-02-17 16:13:41 +11:00
parent 09c3cfbc20
commit f3755d9eba
2 changed files with 7 additions and 7 deletions

View File

@@ -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,

View File

@@ -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