// Code generated by 'go generate'; DO NOT EDIT. package elevate import ( "syscall" "unsafe" "golang.org/x/sys/windows" ) var _ unsafe.Pointer // Do the interface allocations only once for common // Errno values. const ( errnoERROR_IO_PENDING = 997 ) var ( errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) errERROR_EINVAL error = syscall.EINVAL ) // errnoErr returns common boxed Errno values, to prevent // allocations at runtime. func errnoErr(e syscall.Errno) error { switch e { case 0: return errERROR_EINVAL case errnoERROR_IO_PENDING: return errERROR_IO_PENDING } // TODO: add more here, after collecting data on the common // error values see on Windows. (perhaps when running // all.bat?) return e } var ( modntdll = windows.NewLazySystemDLL("ntdll.dll") modole32 = windows.NewLazySystemDLL("ole32.dll") procRtlGetCurrentPeb = modntdll.NewProc("RtlGetCurrentPeb") procRtlInitUnicodeString = modntdll.NewProc("RtlInitUnicodeString") procCoGetObject = modole32.NewProc("CoGetObject") procCoInitializeEx = modole32.NewProc("CoInitializeEx") procCoUninitialize = modole32.NewProc("CoUninitialize") ) func rtlGetCurrentPeb() (peb *cPEB) { r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) peb = (*cPEB)(unsafe.Pointer(r0)) return } func rtlInitUnicodeString(destinationString *cUNICODE_STRING, sourceString *uint16) { syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) return } func coGetObject(name *uint16, bindOpts *cBIND_OPTS3, guid *windows.GUID, functionTable ***[0xffff]uintptr) (ret error) { r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } return } func coInitializeEx(reserved uintptr, coInit uint32) (ret error) { r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0) if r0 != 0 { ret = syscall.Errno(r0) } return } func coUninitialize() { syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) return }