Skip to content

Commit

Permalink
windows: don't check non-existent return code in GetStartupInfo
Browse files Browse the repository at this point in the history
Same as CL 520275 did in package syscall.

For golang/go#31316

Change-Id: Ie9d8fed7f40b9e562534d5e91488b4ba1ac44f34
Reviewed-on: https://go-review.googlesource.com/c/sys/+/520295
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Auto-Submit: Tobias Klauser <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Run-TryBot: Tobias Klauser <[email protected]>
  • Loading branch information
tklauser authored and gopherbot committed Aug 17, 2023
1 parent ad02017 commit e8190d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion windows/syscall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath
//sys TerminateProcess(handle Handle, exitcode uint32) (err error)
//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error)
//sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW
//sys getStartupInfo(startupInfo *StartupInfo) = GetStartupInfoW
//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)
//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)
//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff]
Expand Down Expand Up @@ -1628,6 +1628,11 @@ func SetConsoleCursorPosition(console Handle, position Coord) error {
return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position))))
}

func GetStartupInfo(startupInfo *StartupInfo) error {
getStartupInfo(startupInfo)
return nil
}

func (s NTStatus) Errno() syscall.Errno {
return rtlNtStatusToDosErrorNoTeb(s)
}
Expand Down
9 changes: 9 additions & 0 deletions windows/syscall_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,3 +1173,12 @@ func TestTimePeriod(t *testing.T) {
t.Fatal(err)
}
}

func TestGetStartupInfo(t *testing.T) {
var si windows.StartupInfo
err := windows.GetStartupInfo(&si)
if err != nil {
// see https://go.dev/issue/31316
t.Fatalf("GetStartupInfo: got error %v, want nil", err)
}
}
7 changes: 2 additions & 5 deletions windows/zsyscall_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8190d9

Please sign in to comment.