mirror of
https://github.com/golang/go.git
synced 2026-04-02 09:20:29 +09:00
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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user