Skip to content

Commit e8190d9

Browse files
tklausergopherbot
authored andcommitted
windows: don't check non-existent return code in GetStartupInfo
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]>
1 parent ad02017 commit e8190d9

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

Diff for: windows/syscall_windows.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
216216
//sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath
217217
//sys TerminateProcess(handle Handle, exitcode uint32) (err error)
218218
//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error)
219-
//sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW
219+
//sys getStartupInfo(startupInfo *StartupInfo) = GetStartupInfoW
220220
//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)
221221
//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)
222222
//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff]
@@ -1628,6 +1628,11 @@ func SetConsoleCursorPosition(console Handle, position Coord) error {
16281628
return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position))))
16291629
}
16301630

1631+
func GetStartupInfo(startupInfo *StartupInfo) error {
1632+
getStartupInfo(startupInfo)
1633+
return nil
1634+
}
1635+
16311636
func (s NTStatus) Errno() syscall.Errno {
16321637
return rtlNtStatusToDosErrorNoTeb(s)
16331638
}

Diff for: windows/syscall_windows_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -1173,3 +1173,12 @@ func TestTimePeriod(t *testing.T) {
11731173
t.Fatal(err)
11741174
}
11751175
}
1176+
1177+
func TestGetStartupInfo(t *testing.T) {
1178+
var si windows.StartupInfo
1179+
err := windows.GetStartupInfo(&si)
1180+
if err != nil {
1181+
// see https://go.dev/issue/31316
1182+
t.Fatalf("GetStartupInfo: got error %v, want nil", err)
1183+
}
1184+
}

Diff for: windows/zsyscall_windows.go

+2-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)