Commit Graph
276 Commits
Author SHA1 Message Date
Paul "TBBle" Hampson ef753e60d2 Implement winio.GetFileStandardInfo
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-02-11 22:50:55 +11:00
Paul "TBBle" Hampson bfd546865c Replace local *FileInformationByHandleEx with x/sys/windows
We also get pre-defined constants instead of carrying our own copies.

However, this changes the public API winio.FileBasicInfo from using
syscall.Filetime to using windows.Filetime, as visible in
backuptar/tar.go.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-02-11 22:50:55 +11:00
Paul "TBBle" Hampson bc48b61dc9 Make local mksyscall_windows.go forks less forked
At this point points of difference between the three local
mksyscall_windows.go implementations and
golang.org/x/sys/windows/mkwinsyscall v0.0.0-20210104204734-6f8348627aad
are:
- pkg/etw: Deduplicates imported functions due to multiple calling APIs
- pkg/security and vhd: Forced UTF-16 mode, not checking A/W suffix. I
  also removed cosmetic differences between these two implementations.

`go generate` reports no changes with these updates.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-02-11 22:50:55 +11: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
Kathryn Baldauf 68cdd9bd9d Merge pull request #191 from uhthomas/master
Add build guards for all Windows imports
2021-02-10 17:11:08 -08:00
Thomas e09292102f Add noop mains for non windows builds 2021-02-11 00:05:48 +00:00
Thomas d4c02ad896 Add missing build constraints 2021-02-10 23:54:19 +00:00
Thomas f0d2c76ab3 Fix missing platform/architecture separation 2021-02-10 23:09:41 +00:00
Thomas eb9d8c9346 Separate platform from architecture build constraints 2021-02-10 23:05:19 +00:00
Kevin Parsons 2aa35e1d77 Merge pull request #195 from thaJeztah/better_exec
Use golang.org/x/sys/execabs instead of os/exec
2021-02-10 00:38:31 -08:00
Sebastiaan van Stijn f2a56450f4 Use golang.org/x/sys/execabs instead of os/exec
On Windows, the os/exec.{Command,CommandContext,LookPath} functions resolve command
names that have neither path separators nor file extension (e.g., "git") by first
looking in the current working directory before looking in the PATH environment
variable.
Go maintainers intended to match cmd.exe's historical behavior.

However, this is pretty much never the intended behavior and as an abundance of
precaution this patch prevents that when executing commands.

This patch was prompted by the [Go 1.15.7 security fixes](https://blog.golang.org/path-security).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-10 09:21:40 +01:00
Kathryn Baldauf a38e1dc8bb Merge pull request #188 from TBBle/correct-GetVolumeInformation-return-handling
Correct GetVolumeInformation return type handling
2021-02-09 18:46:35 -08:00
Kathryn Baldauf 90a22c612d Merge pull request #194 from thaJeztah/bump_deps
go.mod: sirupsen/logrus v1.7.0, golang.org/x/sys
2021-02-09 18:38:52 -08:00
Danny Canter 644af44635 Merge pull request #189 from dcantah/attach-v1
Remove error if ATTACH_VIRTUAL_DISK_PARAMETERS wasn't version 2
2021-02-09 17:46:10 -08:00
Danny Canter 69491f048a Merge pull request #196 from katiewasnothere/add_codeowners
Add codeowners file so containerplat is auto added as reviewers
2021-02-09 15:35:45 -08:00
Kathryn Baldauf ea4a03d185 Add codeowners file so containerplat is auto added as reviewers
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2021-02-09 15:18:39 -08:00
Sebastiaan van Stijn 6734ca5406 go.mod: sirupsen/logrus v1.7.0, golang.org/x/sys
full diff: https://github.com/sirupsen/logrus/compare/v1.4.2...v1.7.0

logrus v1.7.0 removes dependency on github.com/konsorten/go-windows-terminal-sequences

Features:

* a new buffer pool management API has been added
* a set of `<LogLevel>Fn()` functions have been added

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-09 11:02:59 +01:00
Kevin Parsons ac908d2e8e Merge pull request #192 from kylewo/add-provider-group
Add ability to set provider group
2021-01-27 14:52:50 -08:00
Kyle Wojtaszek 652abba813 Removing unneeded NewProviderWithGroup function 2021-01-27 14:43:00 -08:00
Kyle Wojtaszek 30844eed75 Add ability to set provider group 2021-01-27 13:12:37 -08:00
Thomas Way 9d8277341f Add build guards for all Windows imports 2021-01-21 23:24:01 +00:00
Daniel Canter 83fd17628f Remove error if ATTACH_VIRTUAL_DISK_PARAMETERS wasn't version 2
* Version 2 didn't exist in RS5 so it's a bit silly to error out in this case.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-01-18 02:50:23 -08:00
Paul "TBBle" Hampson 0966e1ad56 Correct GetVolumeInformation return type handling
The _docs_ say it returns 0 for failure, non-zero for success.

This implementation is looking for <0 as HRESULT failure, and deriving
an Errno from that.

The new tests fail with GetFileSystemType as it was defined, e.g.,
```
--- FAIL: TestGetFSTypeOfValidButAbsentDrive (0.00s)
    fs_windows_test.go:41: GetFileSystemType a:\ unexpectedly succeeded
```
when I definitely do not have an A:\ drive.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-01-16 17:11:37 +11:00
Danny Canter d1ffc52c73 Merge pull request #179 from dcantah/virtdisk
Add new virtdisk calls/refactor vhd package
2020-11-30 08:25:21 -08:00
Daniel Canter e9604c63ae Add new virtdisk calls/refactor vhd package
This change adds bindings for AttachVirtualDisk and GetVirtualDiskPhysicalPath, some helper functions including
one to create a differencing vhd, exports the create and open parameters, exports the create flags and adds a couple
of missing flags. This will be used mainly to go hand in hand with the new computestorage calls added to hcsshim as all of the
vhd creation and setup needs to be done manually for these calls. https://github.com/microsoft/hcsshim/pull/881.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2020-11-30 08:23:06 -08:00
Kevin Parsons f314918fc7 Merge pull request #181 from gbbr/spellfix
Correct spelling in PipeConfig {Input,Output}BufferSize doc.
2020-11-23 13:18:15 -08:00
Gabriel Aszalos 68390cf0c2 Correct spelling in PipeConfig {Input,Output}BufferSize doc.
Signed-off-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
2020-11-23 23:01:29 +02:00
Kevin Parsons a6ab492b63 Merge pull request #182 from thaJeztah/bump_pkg_errors
go.mod: github.com/pkg/errors v0.9.1
2020-11-23 12:59:39 -08:00
Sebastiaan van Stijn 00446faf93 go.mod: github.com/pkg/errors v0.9.1
update to pkg/errors v0.9.1 for compatibility with Go 1.13
error (un)wrapping.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-23 21:09:12 +01:00
Kevin Parsons 5b44b70ab3 Merge pull request #175 from TBBle/defork_achive_tar
Replace archive/tar fork with use of archive/tar
2020-09-08 11:26:39 -07:00
Paul "TBBle" Hampson cb5cf8987b Replace archive/tar fork with use of archive/tar
Since Go 1.6, archive/tar has gained public support for custom PAX
Records, so there's no need to maintain a fork of this library anymore.

We do end up with a fork of the PAX timestamp parsing/formatting
functions, but they are much less likely to change.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-17 00:45:58 +10:00
Justin 3fe6c52628 Merge pull request #168 from maxifom/duration_inconsistency
Duration order consistency when multiplying number by time unit
2020-01-13 09:10:25 -08:00
Maxim Fominykh 06bcafdc24 Duration order consistency when multiplying number by time unit 2020-01-11 05:26:35 +05:00
Justin 1f03480c53 Merge pull request #166 from paruizfi/master
Expose pipe  access level to caller
2019-12-19 07:30:15 -08:00
Pablo Ruiz Fischer Bennetts 3886dbb163 Expanded dial to allow to provide access level
Enable anonymous access

Remove non-context overload

Remove error being rethrown
2019-12-04 10:15:56 -08:00
Kevin Parsons fc70bd9a86 Merge pull request #160 from kevpar/pkg-process
Add new process package
2019-09-18 19:51:22 -07:00
Kevin Parsons f272bf30b3 Add new process package
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-09-18 18:03:14 -07:00
Justin 6c72808b55 Merge pull request #157 from jterry75/fix_detachvhd
Fix regression in DetachVhd
2019-08-06 12:59:04 -07:00
Justin Terry (VM) 5adf6781fa Fix regression in DetachVhd
When opening a disk it for deatch using 'Version == 2' parameters it is
required that the'accessMask == VirtualDiskAccessNone'. Also updates the
virtual disk 'flag' parameter to match the set specified by the product when
activating the layer.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2019-08-06 11:28:36 -07:00
Justin a969fb018b Merge pull request #153 from microsoft/guid
guid package improvements
2019-07-19 05:48:51 -07:00
Kevin Parsons c20fb68775 etw: Add test for provider name to GUID conversion
Also simplified the name to GUID conversion code, and improved the
comments.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-07-10 15:12:20 -07:00
Kevin Parsons 177d2ec7ea guid: Add V5 GUID support
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-07-10 15:08:22 -07:00
Kevin Parsons c5294c98c0 guid: Improve version and variant handling
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-07-10 15:03:44 -07:00
Justin 881e3d4642 Merge pull request #152 from ehotinger/ehotinger/fs
Updates the error message in GetFileSystemType
2019-07-02 11:31:43 -07:00
Eric Hotinger 28396ed851 Updates the error message in GetFileSystemType to match the function's
casing and exports the error.

Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
2019-07-01 14:25:30 -07:00
Justin 7cdfd71a95 Merge pull request #146 from microsoft/fix-makeopenfile
Fix interface-wrapped nil returned by MakeOpenFile
2019-06-28 11:17:19 -07:00
Justin 69f028c26d Merge pull request #150 from ehotinger/ehotinger/fs
Adds a file system helper file for determining the file system type.
2019-06-25 13:50:08 -07:00
Eric Hotinger 9fe4f5c769 Adds a file system helper file for determining the file system type.
Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
2019-06-25 13:42:09 -07:00
Justin d2ef9cfdac Merge pull request #149 from microsoft/etw-logrus-time
etwlogrus: Pass through entry time as ETW field
2019-06-25 10:40:15 -07:00
Kevin Parsons 09baa54393 etwlogrus: Pass through entry time as ETW field
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-06-25 10:36:45 -07:00