Commit Graph
5 Commits
Author SHA1 Message Date
Hamza El-Saawy 3c9576c934 Update go1.21 and CI (#315)
* Update to go 1.21

Use `atomic.Bool` stdlib instead of including our own.

Include `tools\mkwinsyscall` updates from go-winio/283 to switch to
`syscallN`.
Note: removed `// TODO` about `print`/`ln`, since the latter adds spaces
between args when printing, which is undesired.

Also update CI to run steps on windows-2022 instead of windows-2019,
similar to our hcsshim CI.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>

* PR: simplify type checking

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>

---------

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
2024-04-09 16:07:04 -04:00
Hamza El-Saawy 35837cff61 Update mkwinsyscall and make stand alone tool (#248)
* Add latest mkwinsyscall file

Copied file from:
https://github.com/golang/sys/blob/bc2c85ada10aa9b6aa9607e9ac9ad0761b95cf1d/windows/mkwinsyscall/mkwinsyscall.go

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>

* Update to match hcsshim mksyscall_windows

Added hr error return type, cmdline flags for winio import, utf16, and
sorting.

Generated file has build constrain comment.

Input files can be specified with a glob pattern.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>

* PR: update comment, use glob

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
2022-06-16 14:05:19 -04:00
Danny Canter 7de02db153 Fix 'OpenVirtualDiskParameters' BOOL fields (#226)
* Fix 'OpenVirtualDiskParameters' BOOL fields

While reworking the vhd package I'd mistakingly replaced some of the fields
in the OpenVersion2 structure with the incorrect types. They're defined as
Windows BOOLS which is just a type alias for an int, and I'd put their type as
go bools.

As the type is already passed into some functions, to avoid a breaking change just
convert the incorrect type to a new structure with the correct definition internally.
Truthfully this turns out a bit better as supplying a bool makes more sense and is
more go friendly.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2022-02-14 21:11:00 -08:00
Kevin Parsons 9f0ab2cc0a Fix syscall error handling in vhd and pkg/security
These packages had incorrect error handling for their generated syscall
bindings. The functions they were calling returned errors directly, but
the binding was written such that the generated code was calling
GetLastError instead.

Thankfully, this did not affect the detection of whether or not an error
had occurred, it only caused the value returned in the case of an error
to be not the right error code.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2021-04-26 15:08:11 -07:00
Paul "TBBle" Hampson 1390d1a07b Pull sync generated syscalls
This moves all the current users of
$GOROOT/src/syscall/mksyscall_windows.go to instead use
golang.org/x/sys/windows/mkwinsyscall, as directed by the version of the
former in Go 1.15.

It also syncs the local forks of mksyscall_windows.go with the latest
version of golang.org/x/sys/windows/mkwinsyscall/mkwinsyscall.go, so
that the local patches can be easily seen in a side-by-side comparison.
Significant changes compared to the in-tree forked versions:
* *bool parameters are read back through a temp-var, not directly like
  other pointer parameters.
* ?-suffixed function names support testing for function presence before
  calling. This replaces a local implementation of this in
  pkg/security, which was not actually used anyway. The upstream version
  correctly supports functions that don't already have an error return.
* `errnoErr(0)` is now useful, so each call of `errnoErr` doesn't need
  to be protected with a check for 0 first.
* The generated functions are now sorted. This of course produced a
  *lot* of churn in the generated files.

vhd\vhd.go was changed to generate syscalls into zvhd_windows.go, since
regeneration removes the build tag added by hand in
9d8277341f.

After all that, I also ran
```
go generate . .\pkg\etw\ .\pkg\process\ .\pkg\security\ .\vhd\
```
to update all the existing generated code.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-02-11 22:47:40 +11:00