~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/utils/symlink/zsymlink_windows_amd64.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// mksyscall_windows.pl symlink/symlink_windows.go
 
2
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
 
3
 
 
4
package symlink
 
5
 
 
6
import "unsafe"
 
7
import "syscall"
 
8
 
 
9
var (
 
10
        modkernel32 = syscall.NewLazyDLL("kernel32.dll")
 
11
 
 
12
        procCreateSymbolicLinkW       = modkernel32.NewProc("CreateSymbolicLinkW")
 
13
        procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW")
 
14
)
 
15
 
 
16
func createSymbolicLink(symlinkname *uint16, targetname *uint16, flags uint32) (err error) {
 
17
        r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkname)), uintptr(unsafe.Pointer(targetname)), uintptr(flags))
 
18
        if r1 == 0 {
 
19
                if e1 != 0 {
 
20
                        err = error(e1)
 
21
                } else {
 
22
                        err = syscall.EINVAL
 
23
                }
 
24
        }
 
25
        return
 
26
}
 
27
 
 
28
func getFinalPathNameByHandle(handle syscall.Handle, buf *uint16, buflen uint32, flags uint32) (n uint32, err error) {
 
29
        r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(flags), 0, 0)
 
30
        n = uint32(r0)
 
31
        if n == 0 {
 
32
                if e1 != 0 {
 
33
                        err = error(e1)
 
34
                } else {
 
35
                        err = syscall.EINVAL
 
36
                }
 
37
        }
 
38
        return
 
39
}