Update continuity dependency
This change ensures that Windows security info is copied. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
		
							
								
								
									
										27
									
								
								vendor/github.com/Microsoft/go-winio/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								vendor/github.com/Microsoft/go-winio/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -11,12 +11,27 @@ package.
 | 
			
		||||
 | 
			
		||||
Please see the LICENSE file for licensing information.
 | 
			
		||||
 | 
			
		||||
This project has adopted the [Microsoft Open Source Code of
 | 
			
		||||
Conduct](https://opensource.microsoft.com/codeofconduct/). For more information
 | 
			
		||||
see the [Code of Conduct
 | 
			
		||||
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact
 | 
			
		||||
[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional
 | 
			
		||||
questions or comments.
 | 
			
		||||
## Contributing
 | 
			
		||||
 | 
			
		||||
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA)
 | 
			
		||||
declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
 | 
			
		||||
 | 
			
		||||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR
 | 
			
		||||
appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
 | 
			
		||||
 | 
			
		||||
We also require that contributors sign their commits using git commit -s or git commit --signoff to certify they either authored the work themselves
 | 
			
		||||
or otherwise have permission to use it in this project. Please see https://developercertificate.org/ for more info, as well as to make sure that you can
 | 
			
		||||
attest to the rules listed. Our CI uses the DCO Github app to ensure that all commits in a given PR are signed-off.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Code of Conduct
 | 
			
		||||
 | 
			
		||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
 | 
			
		||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
 | 
			
		||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Special Thanks
 | 
			
		||||
Thanks to natefinch for the inspiration for this library. See https://github.com/natefinch/npipe
 | 
			
		||||
for another named pipe implementation.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										74
									
								
								vendor/github.com/Microsoft/go-winio/backuptar/tar.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										74
									
								
								vendor/github.com/Microsoft/go-winio/backuptar/tar.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -5,7 +5,6 @@ package backuptar
 | 
			
		||||
import (
 | 
			
		||||
	"archive/tar"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
@@ -42,19 +41,14 @@ const (
 | 
			
		||||
	hdrCreationTime = "LIBARCHIVE.creationtime"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func writeZeroes(w io.Writer, count int64) error {
 | 
			
		||||
	buf := make([]byte, 8192)
 | 
			
		||||
	c := len(buf)
 | 
			
		||||
	for i := int64(0); i < count; i += int64(c) {
 | 
			
		||||
		if int64(c) > count-i {
 | 
			
		||||
			c = int(count - i)
 | 
			
		||||
		}
 | 
			
		||||
		_, err := w.Write(buf[:c])
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
// zeroReader is an io.Reader that always returns 0s.
 | 
			
		||||
type zeroReader struct{}
 | 
			
		||||
 | 
			
		||||
func (zr zeroReader) Read(b []byte) (int, error) {
 | 
			
		||||
	for i := range b {
 | 
			
		||||
		b[i] = 0
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
	return len(b), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func copySparse(t *tar.Writer, br *winio.BackupStreamReader) error {
 | 
			
		||||
@@ -71,16 +65,26 @@ func copySparse(t *tar.Writer, br *winio.BackupStreamReader) error {
 | 
			
		||||
			return fmt.Errorf("unexpected stream %d", bhdr.Id)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// We can't seek backwards, since we have already written that data to the tar.Writer.
 | 
			
		||||
		if bhdr.Offset < curOffset {
 | 
			
		||||
			return fmt.Errorf("cannot seek back from %d to %d", curOffset, bhdr.Offset)
 | 
			
		||||
		}
 | 
			
		||||
		// archive/tar does not support writing sparse files
 | 
			
		||||
		// so just write zeroes to catch up to the current offset.
 | 
			
		||||
		err = writeZeroes(t, bhdr.Offset-curOffset)
 | 
			
		||||
		if _, err := io.CopyN(t, zeroReader{}, bhdr.Offset-curOffset); err != nil {
 | 
			
		||||
			return fmt.Errorf("seek to offset %d: %s", bhdr.Offset, err)
 | 
			
		||||
		}
 | 
			
		||||
		if bhdr.Size == 0 {
 | 
			
		||||
			// A sparse block with size = 0 is used to mark the end of the sparse blocks.
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
		n, err := io.Copy(t, br)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		if n != bhdr.Size {
 | 
			
		||||
			return fmt.Errorf("copied %d bytes instead of %d at offset %d", n, bhdr.Size, bhdr.Offset)
 | 
			
		||||
		}
 | 
			
		||||
		curOffset = bhdr.Offset + n
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
@@ -221,20 +225,44 @@ func WriteTarFileFromBackupStream(t *tar.Writer, r io.Reader, name string, size
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// The logic for copying file contents is fairly complicated due to the need for handling sparse files,
 | 
			
		||||
	// and the weird ways they are represented by BackupRead. A normal file will always either have a data stream
 | 
			
		||||
	// with size and content, or no data stream at all (if empty). However, for a sparse file, the content can also
 | 
			
		||||
	// be represented using a series of sparse block streams following the data stream. Additionally, the way sparse
 | 
			
		||||
	// files are handled by BackupRead has changed in the OS recently. The specifics of the representation are described
 | 
			
		||||
	// in the list at the bottom of this block comment.
 | 
			
		||||
	//
 | 
			
		||||
	// Sparse files can be represented in four different ways, based on the specifics of the file.
 | 
			
		||||
	// - Size = 0:
 | 
			
		||||
	//     Previously: BackupRead yields no data stream and no sparse block streams.
 | 
			
		||||
	//     Recently: BackupRead yields a data stream with size = 0. There are no following sparse block streams.
 | 
			
		||||
	// - Size > 0, no allocated ranges:
 | 
			
		||||
	//     BackupRead yields a data stream with size = 0. Following is a single sparse block stream with
 | 
			
		||||
	//     size = 0 and offset = <file size>.
 | 
			
		||||
	// - Size > 0, one allocated range:
 | 
			
		||||
	//     BackupRead yields a data stream with size = <file size> containing the file contents. There are no
 | 
			
		||||
	//     sparse block streams. This is the case if you take a normal file with contents and simply set the
 | 
			
		||||
	//     sparse flag on it.
 | 
			
		||||
	// - Size > 0, multiple allocated ranges:
 | 
			
		||||
	//     BackupRead yields a data stream with size = 0. Following are sparse block streams for each allocated
 | 
			
		||||
	//     range of the file containing the range contents. Finally there is a sparse block stream with
 | 
			
		||||
	//     size = 0 and offset = <file size>.
 | 
			
		||||
 | 
			
		||||
	if dataHdr != nil {
 | 
			
		||||
		// A data stream was found. Copy the data.
 | 
			
		||||
		if (dataHdr.Attributes & winio.StreamSparseAttributes) == 0 {
 | 
			
		||||
		// We assume that we will either have a data stream size > 0 XOR have sparse block streams.
 | 
			
		||||
		if dataHdr.Size > 0 || (dataHdr.Attributes&winio.StreamSparseAttributes) == 0 {
 | 
			
		||||
			if size != dataHdr.Size {
 | 
			
		||||
				return fmt.Errorf("%s: mismatch between file size %d and header size %d", name, size, dataHdr.Size)
 | 
			
		||||
			}
 | 
			
		||||
			_, err = io.Copy(t, br)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			if _, err = io.Copy(t, br); err != nil {
 | 
			
		||||
				return fmt.Errorf("%s: copying contents from data stream: %s", name, err)
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			err = copySparse(t, br)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
		} else if size > 0 {
 | 
			
		||||
			// As of a recent OS change, BackupRead now returns a data stream for empty sparse files.
 | 
			
		||||
			// These files have no sparse block streams, so skip the copySparse call if file size = 0.
 | 
			
		||||
			if err = copySparse(t, br); err != nil {
 | 
			
		||||
				return fmt.Errorf("%s: copying contents from sparse block stream: %s", name, err)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -279,7 +307,7 @@ func WriteTarFileFromBackupStream(t *tar.Writer, r io.Reader, name string, size
 | 
			
		||||
			} else {
 | 
			
		||||
				// Unsupported for now, since the size of the alternate stream is not present
 | 
			
		||||
				// in the backup stream until after the data has been read.
 | 
			
		||||
				return errors.New("tar of sparse alternate data streams is unsupported")
 | 
			
		||||
				return fmt.Errorf("%s: tar of sparse alternate data streams is unsupported", name)
 | 
			
		||||
			}
 | 
			
		||||
		case winio.BackupEaData, winio.BackupLink, winio.BackupPropertyData, winio.BackupObjectId, winio.BackupTxfsData:
 | 
			
		||||
			// ignore these streams
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/github.com/Microsoft/go-winio/pkg/etw/provider.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/Microsoft/go-winio/pkg/etw/provider.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -83,15 +83,6 @@ func providerCallback(sourceID guid.GUID, state ProviderState, level Level, matc
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// providerCallbackAdapter acts as the first-level callback from the C/ETW side
 | 
			
		||||
// for provider notifications. Because Go has trouble with callback arguments of
 | 
			
		||||
// different size, it has only pointer-sized arguments, which are then cast to
 | 
			
		||||
// the appropriate types when calling providerCallback.
 | 
			
		||||
func providerCallbackAdapter(sourceID *guid.GUID, state uintptr, level uintptr, matchAnyKeyword uintptr, matchAllKeyword uintptr, filterData uintptr, i uintptr) uintptr {
 | 
			
		||||
	providerCallback(*sourceID, ProviderState(state), Level(level), uint64(matchAnyKeyword), uint64(matchAllKeyword), filterData, i)
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// providerIDFromName generates a provider ID based on the provider name. It
 | 
			
		||||
// uses the same algorithm as used by .NET's EventSource class, which is based
 | 
			
		||||
// on RFC 4122. More information on the algorithm can be found here:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								vendor/github.com/Microsoft/go-winio/pkg/etw/wrapper_32.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/Microsoft/go-winio/pkg/etw/wrapper_32.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,6 +4,7 @@
 | 
			
		||||
package etw
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Microsoft/go-winio/pkg/guid"
 | 
			
		||||
	"golang.org/x/sys/windows"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -50,3 +51,17 @@ func eventSetInformation(
 | 
			
		||||
		information,
 | 
			
		||||
		length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// providerCallbackAdapter acts as the first-level callback from the C/ETW side
 | 
			
		||||
// for provider notifications. Because Go has trouble with callback arguments of
 | 
			
		||||
// different size, it has only pointer-sized arguments, which are then cast to
 | 
			
		||||
// the appropriate types when calling providerCallback.
 | 
			
		||||
// For x86, the matchAny and matchAll keywords need to be assembled from two
 | 
			
		||||
// 32-bit integers, because the max size of an argument is uintptr, but those
 | 
			
		||||
// two arguments are actually 64-bit integers.
 | 
			
		||||
func providerCallbackAdapter(sourceID *guid.GUID, state uint32, level uint32, matchAnyKeyword_low uint32, matchAnyKeyword_high uint32, matchAllKeyword_low uint32, matchAllKeyword_high uint32, filterData uintptr, i uintptr) uintptr {
 | 
			
		||||
	matchAnyKeyword := uint64(matchAnyKeyword_high)<<32 | uint64(matchAnyKeyword_low)
 | 
			
		||||
	matchAllKeyword := uint64(matchAllKeyword_high)<<32 | uint64(matchAllKeyword_low)
 | 
			
		||||
	providerCallback(*sourceID, ProviderState(state), Level(level), uint64(matchAnyKeyword), uint64(matchAllKeyword), filterData, i)
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/Microsoft/go-winio/pkg/etw/wrapper_64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/Microsoft/go-winio/pkg/etw/wrapper_64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,6 +4,7 @@
 | 
			
		||||
package etw
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Microsoft/go-winio/pkg/guid"
 | 
			
		||||
	"golang.org/x/sys/windows"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -40,3 +41,12 @@ func eventSetInformation(
 | 
			
		||||
		information,
 | 
			
		||||
		length)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// providerCallbackAdapter acts as the first-level callback from the C/ETW side
 | 
			
		||||
// for provider notifications. Because Go has trouble with callback arguments of
 | 
			
		||||
// different size, it has only pointer-sized arguments, which are then cast to
 | 
			
		||||
// the appropriate types when calling providerCallback.
 | 
			
		||||
func providerCallbackAdapter(sourceID *guid.GUID, state uintptr, level uintptr, matchAnyKeyword uintptr, matchAllKeyword uintptr, filterData uintptr, i uintptr) uintptr {
 | 
			
		||||
	providerCallback(*sourceID, ProviderState(state), Level(level), uint64(matchAnyKeyword), uint64(matchAllKeyword), filterData, i)
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/github.com/Microsoft/go-winio/pkg/security/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/Microsoft/go-winio/pkg/security/syscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,6 +2,6 @@ package security
 | 
			
		||||
 | 
			
		||||
//go:generate go run mksyscall_windows.go -output zsyscall_windows.go syscall_windows.go
 | 
			
		||||
 | 
			
		||||
//sys getSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, ppsidOwner **uintptr, ppsidGroup **uintptr, ppDacl *uintptr, ppSacl *uintptr, ppSecurityDescriptor *uintptr) (err error) [failretval!=0] = advapi32.GetSecurityInfo
 | 
			
		||||
//sys setSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, psidOwner uintptr, psidGroup uintptr, pDacl uintptr, pSacl uintptr) (err error) [failretval!=0] = advapi32.SetSecurityInfo
 | 
			
		||||
//sys setEntriesInAcl(count uintptr, pListOfEEs uintptr, oldAcl uintptr, newAcl *uintptr) (err error) [failretval!=0] = advapi32.SetEntriesInAclW
 | 
			
		||||
//sys getSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, ppsidOwner **uintptr, ppsidGroup **uintptr, ppDacl *uintptr, ppSacl *uintptr, ppSecurityDescriptor *uintptr) (win32err error) = advapi32.GetSecurityInfo
 | 
			
		||||
//sys setSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, psidOwner uintptr, psidGroup uintptr, pDacl uintptr, pSacl uintptr) (win32err error) = advapi32.SetSecurityInfo
 | 
			
		||||
//sys setEntriesInAcl(count uintptr, pListOfEEs uintptr, oldAcl uintptr, newAcl *uintptr) (win32err error) = advapi32.SetEntriesInAclW
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								vendor/github.com/Microsoft/go-winio/pkg/security/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								vendor/github.com/Microsoft/go-winio/pkg/security/zsyscall_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -45,26 +45,26 @@ var (
 | 
			
		||||
	procSetSecurityInfo  = modadvapi32.NewProc("SetSecurityInfo")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func getSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, ppsidOwner **uintptr, ppsidGroup **uintptr, ppDacl *uintptr, ppSacl *uintptr, ppSecurityDescriptor *uintptr) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(si), uintptr(unsafe.Pointer(ppsidOwner)), uintptr(unsafe.Pointer(ppsidGroup)), uintptr(unsafe.Pointer(ppDacl)), uintptr(unsafe.Pointer(ppSacl)), uintptr(unsafe.Pointer(ppSecurityDescriptor)), 0)
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func getSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, ppsidOwner **uintptr, ppsidGroup **uintptr, ppDacl *uintptr, ppSacl *uintptr, ppSecurityDescriptor *uintptr) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(si), uintptr(unsafe.Pointer(ppsidOwner)), uintptr(unsafe.Pointer(ppsidGroup)), uintptr(unsafe.Pointer(ppDacl)), uintptr(unsafe.Pointer(ppSacl)), uintptr(unsafe.Pointer(ppSecurityDescriptor)), 0)
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func setEntriesInAcl(count uintptr, pListOfEEs uintptr, oldAcl uintptr, newAcl *uintptr) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(count), uintptr(pListOfEEs), uintptr(oldAcl), uintptr(unsafe.Pointer(newAcl)), 0, 0)
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func setEntriesInAcl(count uintptr, pListOfEEs uintptr, oldAcl uintptr, newAcl *uintptr) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(count), uintptr(pListOfEEs), uintptr(oldAcl), uintptr(unsafe.Pointer(newAcl)), 0, 0)
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func setSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, psidOwner uintptr, psidGroup uintptr, pDacl uintptr, pSacl uintptr) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(si), uintptr(psidOwner), uintptr(psidGroup), uintptr(pDacl), uintptr(pSacl), 0, 0)
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func setSecurityInfo(handle syscall.Handle, objectType uint32, si uint32, psidOwner uintptr, psidGroup uintptr, pDacl uintptr, pSacl uintptr) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(si), uintptr(psidOwner), uintptr(psidGroup), uintptr(pDacl), uintptr(pSacl), 0, 0)
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/Microsoft/go-winio/vhd/vhd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/Microsoft/go-winio/vhd/vhd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,11 +13,11 @@ import (
 | 
			
		||||
 | 
			
		||||
//go:generate go run mksyscall_windows.go -output zvhd_windows.go vhd.go
 | 
			
		||||
 | 
			
		||||
//sys createVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, securityDescriptor *uintptr, createVirtualDiskFlags uint32, providerSpecificFlags uint32, parameters *CreateVirtualDiskParameters, overlapped *syscall.Overlapped, handle *syscall.Handle) (err error) [failretval != 0] = virtdisk.CreateVirtualDisk
 | 
			
		||||
//sys openVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, openVirtualDiskFlags uint32, parameters *OpenVirtualDiskParameters, handle *syscall.Handle) (err error) [failretval != 0] = virtdisk.OpenVirtualDisk
 | 
			
		||||
//sys attachVirtualDisk(handle syscall.Handle, securityDescriptor *uintptr, attachVirtualDiskFlag uint32, providerSpecificFlags uint32, parameters *AttachVirtualDiskParameters, overlapped *syscall.Overlapped) (err error) [failretval != 0] = virtdisk.AttachVirtualDisk
 | 
			
		||||
//sys detachVirtualDisk(handle syscall.Handle, detachVirtualDiskFlags uint32, providerSpecificFlags uint32) (err error) [failretval != 0] = virtdisk.DetachVirtualDisk
 | 
			
		||||
//sys getVirtualDiskPhysicalPath(handle syscall.Handle, diskPathSizeInBytes *uint32, buffer *uint16) (err error) [failretval != 0] = virtdisk.GetVirtualDiskPhysicalPath
 | 
			
		||||
//sys createVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, securityDescriptor *uintptr, createVirtualDiskFlags uint32, providerSpecificFlags uint32, parameters *CreateVirtualDiskParameters, overlapped *syscall.Overlapped, handle *syscall.Handle) (win32err error) = virtdisk.CreateVirtualDisk
 | 
			
		||||
//sys openVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, openVirtualDiskFlags uint32, parameters *OpenVirtualDiskParameters, handle *syscall.Handle) (win32err error) = virtdisk.OpenVirtualDisk
 | 
			
		||||
//sys attachVirtualDisk(handle syscall.Handle, securityDescriptor *uintptr, attachVirtualDiskFlag uint32, providerSpecificFlags uint32, parameters *AttachVirtualDiskParameters, overlapped *syscall.Overlapped) (win32err error) = virtdisk.AttachVirtualDisk
 | 
			
		||||
//sys detachVirtualDisk(handle syscall.Handle, detachVirtualDiskFlags uint32, providerSpecificFlags uint32) (win32err error) = virtdisk.DetachVirtualDisk
 | 
			
		||||
//sys getVirtualDiskPhysicalPath(handle syscall.Handle, diskPathSizeInBytes *uint32, buffer *uint16) (win32err error) = virtdisk.GetVirtualDiskPhysicalPath
 | 
			
		||||
 | 
			
		||||
type (
 | 
			
		||||
	CreateVirtualDiskFlag uint32
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										52
									
								
								vendor/github.com/Microsoft/go-winio/vhd/zvhd_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								vendor/github.com/Microsoft/go-winio/vhd/zvhd_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -47,60 +47,60 @@ var (
 | 
			
		||||
	procOpenVirtualDisk            = modvirtdisk.NewProc("OpenVirtualDisk")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func attachVirtualDisk(handle syscall.Handle, securityDescriptor *uintptr, attachVirtualDiskFlag uint32, providerSpecificFlags uint32, parameters *AttachVirtualDiskParameters, overlapped *syscall.Overlapped) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall6(procAttachVirtualDisk.Addr(), 6, uintptr(handle), uintptr(unsafe.Pointer(securityDescriptor)), uintptr(attachVirtualDiskFlag), uintptr(providerSpecificFlags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(overlapped)))
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func attachVirtualDisk(handle syscall.Handle, securityDescriptor *uintptr, attachVirtualDiskFlag uint32, providerSpecificFlags uint32, parameters *AttachVirtualDiskParameters, overlapped *syscall.Overlapped) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall6(procAttachVirtualDisk.Addr(), 6, uintptr(handle), uintptr(unsafe.Pointer(securityDescriptor)), uintptr(attachVirtualDiskFlag), uintptr(providerSpecificFlags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(overlapped)))
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func createVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, securityDescriptor *uintptr, createVirtualDiskFlags uint32, providerSpecificFlags uint32, parameters *CreateVirtualDiskParameters, overlapped *syscall.Overlapped, handle *syscall.Handle) (err error) {
 | 
			
		||||
func createVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, securityDescriptor *uintptr, createVirtualDiskFlags uint32, providerSpecificFlags uint32, parameters *CreateVirtualDiskParameters, overlapped *syscall.Overlapped, handle *syscall.Handle) (win32err error) {
 | 
			
		||||
	var _p0 *uint16
 | 
			
		||||
	_p0, err = syscall.UTF16PtrFromString(path)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
	_p0, win32err = syscall.UTF16PtrFromString(path)
 | 
			
		||||
	if win32err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	return _createVirtualDisk(virtualStorageType, _p0, virtualDiskAccessMask, securityDescriptor, createVirtualDiskFlags, providerSpecificFlags, parameters, overlapped, handle)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _createVirtualDisk(virtualStorageType *VirtualStorageType, path *uint16, virtualDiskAccessMask uint32, securityDescriptor *uintptr, createVirtualDiskFlags uint32, providerSpecificFlags uint32, parameters *CreateVirtualDiskParameters, overlapped *syscall.Overlapped, handle *syscall.Handle) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall9(procCreateVirtualDisk.Addr(), 9, uintptr(unsafe.Pointer(virtualStorageType)), uintptr(unsafe.Pointer(path)), uintptr(virtualDiskAccessMask), uintptr(unsafe.Pointer(securityDescriptor)), uintptr(createVirtualDiskFlags), uintptr(providerSpecificFlags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(handle)))
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func _createVirtualDisk(virtualStorageType *VirtualStorageType, path *uint16, virtualDiskAccessMask uint32, securityDescriptor *uintptr, createVirtualDiskFlags uint32, providerSpecificFlags uint32, parameters *CreateVirtualDiskParameters, overlapped *syscall.Overlapped, handle *syscall.Handle) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall9(procCreateVirtualDisk.Addr(), 9, uintptr(unsafe.Pointer(virtualStorageType)), uintptr(unsafe.Pointer(path)), uintptr(virtualDiskAccessMask), uintptr(unsafe.Pointer(securityDescriptor)), uintptr(createVirtualDiskFlags), uintptr(providerSpecificFlags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(handle)))
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func detachVirtualDisk(handle syscall.Handle, detachVirtualDiskFlags uint32, providerSpecificFlags uint32) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall(procDetachVirtualDisk.Addr(), 3, uintptr(handle), uintptr(detachVirtualDiskFlags), uintptr(providerSpecificFlags))
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func detachVirtualDisk(handle syscall.Handle, detachVirtualDiskFlags uint32, providerSpecificFlags uint32) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall(procDetachVirtualDisk.Addr(), 3, uintptr(handle), uintptr(detachVirtualDiskFlags), uintptr(providerSpecificFlags))
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getVirtualDiskPhysicalPath(handle syscall.Handle, diskPathSizeInBytes *uint32, buffer *uint16) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall(procGetVirtualDiskPhysicalPath.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(diskPathSizeInBytes)), uintptr(unsafe.Pointer(buffer)))
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func getVirtualDiskPhysicalPath(handle syscall.Handle, diskPathSizeInBytes *uint32, buffer *uint16) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall(procGetVirtualDiskPhysicalPath.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(diskPathSizeInBytes)), uintptr(unsafe.Pointer(buffer)))
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func openVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, openVirtualDiskFlags uint32, parameters *OpenVirtualDiskParameters, handle *syscall.Handle) (err error) {
 | 
			
		||||
func openVirtualDisk(virtualStorageType *VirtualStorageType, path string, virtualDiskAccessMask uint32, openVirtualDiskFlags uint32, parameters *OpenVirtualDiskParameters, handle *syscall.Handle) (win32err error) {
 | 
			
		||||
	var _p0 *uint16
 | 
			
		||||
	_p0, err = syscall.UTF16PtrFromString(path)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
	_p0, win32err = syscall.UTF16PtrFromString(path)
 | 
			
		||||
	if win32err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	return _openVirtualDisk(virtualStorageType, _p0, virtualDiskAccessMask, openVirtualDiskFlags, parameters, handle)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _openVirtualDisk(virtualStorageType *VirtualStorageType, path *uint16, virtualDiskAccessMask uint32, openVirtualDiskFlags uint32, parameters *OpenVirtualDiskParameters, handle *syscall.Handle) (err error) {
 | 
			
		||||
	r1, _, e1 := syscall.Syscall6(procOpenVirtualDisk.Addr(), 6, uintptr(unsafe.Pointer(virtualStorageType)), uintptr(unsafe.Pointer(path)), uintptr(virtualDiskAccessMask), uintptr(openVirtualDiskFlags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(handle)))
 | 
			
		||||
	if r1 != 0 {
 | 
			
		||||
		err = errnoErr(e1)
 | 
			
		||||
func _openVirtualDisk(virtualStorageType *VirtualStorageType, path *uint16, virtualDiskAccessMask uint32, openVirtualDiskFlags uint32, parameters *OpenVirtualDiskParameters, handle *syscall.Handle) (win32err error) {
 | 
			
		||||
	r0, _, _ := syscall.Syscall6(procOpenVirtualDisk.Addr(), 6, uintptr(unsafe.Pointer(virtualStorageType)), uintptr(unsafe.Pointer(path)), uintptr(virtualDiskAccessMask), uintptr(openVirtualDiskFlags), uintptr(unsafe.Pointer(parameters)), uintptr(unsafe.Pointer(handle)))
 | 
			
		||||
	if r0 != 0 {
 | 
			
		||||
		win32err = syscall.Errno(r0)
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user