...

Source file src/github.com/Microsoft/go-winio/pkg/bindfilter/zsyscall_windows.go

Documentation: github.com/Microsoft/go-winio/pkg/bindfilter

     1  //go:build windows
     2  
     3  // Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
     4  
     5  package bindfilter
     6  
     7  import (
     8  	"syscall"
     9  	"unsafe"
    10  
    11  	"golang.org/x/sys/windows"
    12  )
    13  
    14  var _ unsafe.Pointer
    15  
    16  // Do the interface allocations only once for common
    17  // Errno values.
    18  const (
    19  	errnoERROR_IO_PENDING = 997
    20  )
    21  
    22  var (
    23  	errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
    24  	errERROR_EINVAL     error = syscall.EINVAL
    25  )
    26  
    27  // errnoErr returns common boxed Errno values, to prevent
    28  // allocations at runtime.
    29  func errnoErr(e syscall.Errno) error {
    30  	switch e {
    31  	case 0:
    32  		return errERROR_EINVAL
    33  	case errnoERROR_IO_PENDING:
    34  		return errERROR_IO_PENDING
    35  	}
    36  	// TODO: add more here, after collecting data on the common
    37  	// error values see on Windows. (perhaps when running
    38  	// all.bat?)
    39  	return e
    40  }
    41  
    42  var (
    43  	modbindfltapi = windows.NewLazySystemDLL("bindfltapi.dll")
    44  
    45  	procBfGetMappings   = modbindfltapi.NewProc("BfGetMappings")
    46  	procBfRemoveMapping = modbindfltapi.NewProc("BfRemoveMapping")
    47  	procBfSetupFilter   = modbindfltapi.NewProc("BfSetupFilter")
    48  )
    49  
    50  func bfGetMappings(flags uint32, jobHandle windows.Handle, virtRootPath *uint16, sid *windows.SID, bufferSize *uint32, outBuffer *byte) (hr error) {
    51  	hr = procBfGetMappings.Find()
    52  	if hr != nil {
    53  		return
    54  	}
    55  	r0, _, _ := syscall.Syscall6(procBfGetMappings.Addr(), 6, uintptr(flags), uintptr(jobHandle), uintptr(unsafe.Pointer(virtRootPath)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(bufferSize)), uintptr(unsafe.Pointer(outBuffer)))
    56  	if int32(r0) < 0 {
    57  		if r0&0x1fff0000 == 0x00070000 {
    58  			r0 &= 0xffff
    59  		}
    60  		hr = syscall.Errno(r0)
    61  	}
    62  	return
    63  }
    64  
    65  func bfRemoveMapping(jobHandle windows.Handle, virtRootPath string) (hr error) {
    66  	var _p0 *uint16
    67  	_p0, hr = syscall.UTF16PtrFromString(virtRootPath)
    68  	if hr != nil {
    69  		return
    70  	}
    71  	return _bfRemoveMapping(jobHandle, _p0)
    72  }
    73  
    74  func _bfRemoveMapping(jobHandle windows.Handle, virtRootPath *uint16) (hr error) {
    75  	hr = procBfRemoveMapping.Find()
    76  	if hr != nil {
    77  		return
    78  	}
    79  	r0, _, _ := syscall.Syscall(procBfRemoveMapping.Addr(), 2, uintptr(jobHandle), uintptr(unsafe.Pointer(virtRootPath)), 0)
    80  	if int32(r0) < 0 {
    81  		if r0&0x1fff0000 == 0x00070000 {
    82  			r0 &= 0xffff
    83  		}
    84  		hr = syscall.Errno(r0)
    85  	}
    86  	return
    87  }
    88  
    89  func bfSetupFilter(jobHandle windows.Handle, flags uint32, virtRootPath string, virtTargetPath string, virtExceptions **uint16, virtExceptionPathCount uint32) (hr error) {
    90  	var _p0 *uint16
    91  	_p0, hr = syscall.UTF16PtrFromString(virtRootPath)
    92  	if hr != nil {
    93  		return
    94  	}
    95  	var _p1 *uint16
    96  	_p1, hr = syscall.UTF16PtrFromString(virtTargetPath)
    97  	if hr != nil {
    98  		return
    99  	}
   100  	return _bfSetupFilter(jobHandle, flags, _p0, _p1, virtExceptions, virtExceptionPathCount)
   101  }
   102  
   103  func _bfSetupFilter(jobHandle windows.Handle, flags uint32, virtRootPath *uint16, virtTargetPath *uint16, virtExceptions **uint16, virtExceptionPathCount uint32) (hr error) {
   104  	hr = procBfSetupFilter.Find()
   105  	if hr != nil {
   106  		return
   107  	}
   108  	r0, _, _ := syscall.Syscall6(procBfSetupFilter.Addr(), 6, uintptr(jobHandle), uintptr(flags), uintptr(unsafe.Pointer(virtRootPath)), uintptr(unsafe.Pointer(virtTargetPath)), uintptr(unsafe.Pointer(virtExceptions)), uintptr(virtExceptionPathCount))
   109  	if int32(r0) < 0 {
   110  		if r0&0x1fff0000 == 0x00070000 {
   111  			r0 &= 0xffff
   112  		}
   113  		hr = syscall.Errno(r0)
   114  	}
   115  	return
   116  }
   117  

View as plain text