github.com/mhilton/juju-juju@v0.0.0-20150901100907-a94dd2c73455/service/windows/securestring/zsecurestring_windows.go (about)

     1  // mksyscall_windows.pl securestring.go
     2  // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
     3  
     4  package securestring
     5  
     6  //import "unsafe"
     7  import "syscall"
     8  
     9  var (
    10  	modcrypt32 = syscall.NewLazyDLL("crypt32.dll")
    11  
    12  	procCryptProtectData   = modcrypt32.NewProc("CryptProtectData")
    13  	procCryptUnprotectData = modcrypt32.NewProc("CryptUnprotectData")
    14  )
    15  
    16  func protectData(input uintptr, szDataDescr uint32, entropy uintptr, reserved uint32, prompt uint32, flags uint, output uintptr) (err error) {
    17  	r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(input), uintptr(szDataDescr), uintptr(entropy), uintptr(reserved), uintptr(prompt), uintptr(flags), uintptr(output), 0, 0)
    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 unprotectData(input uintptr, szDataDescr uint32, entropy uintptr, reserved uint32, prompt uint32, flags uint, output uintptr) (err error) {
    29  	r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(input), uintptr(szDataDescr), uintptr(entropy), uintptr(reserved), uintptr(prompt), uintptr(flags), uintptr(output), 0, 0)
    30  	if r1 == 0 {
    31  		if e1 != 0 {
    32  			err = error(e1)
    33  		} else {
    34  			err = syscall.EINVAL
    35  		}
    36  	}
    37  	return
    38  }