| // Code generated by 'go generate'; DO NOT EDIT. |
| |
| package main |
| |
| import ( |
| "syscall" |
| "unsafe" |
| ) |
| |
| 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 ( |
| modhook = syscall.NewLazyDLL("hook.dll") |
| |
| procGetHandleInformationWithGarbageUpperBits = modhook.NewProc("GetHandleInformationWithGarbageUpperBits") |
| procIsValidCodePageWithGarbageUpperBits = modhook.NewProc("IsValidCodePageWithGarbageUpperBits") |
| procRegOpenKeyExWWithGarbageUpperBits = modhook.NewProc("RegOpenKeyExWWithGarbageUpperBits") |
| ) |
| |
| func getHandleInformationWithGarbageUpperBits(handle syscall.Handle, flags *uint32) (err error) { |
| r1, _, e1 := syscall.SyscallN(procGetHandleInformationWithGarbageUpperBits.Addr(), uintptr(handle), uintptr(unsafe.Pointer(flags))) |
| if uint32(r1) == 0 { |
| err = errnoErr(e1) |
| } |
| return |
| } |
| |
| func isValidCodePageWithGarbageUpperBits(codePage uint32) (ok bool) { |
| r0, _, _ := syscall.SyscallN(procIsValidCodePageWithGarbageUpperBits.Addr(), uintptr(codePage)) |
| ok = uint32(r0) != 0 |
| return |
| } |
| |
| func regOpenKeyExWithGarbageUpperBits(key syscall.Handle, subkey *uint16, options uint32, desiredAccess uint32, result *syscall.Handle) (regerrno error) { |
| r0, _, _ := syscall.SyscallN(procRegOpenKeyExWWithGarbageUpperBits.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result))) |
| if uint32(r0) != 0 { |
| regerrno = syscall.Errno(uint32(r0)) |
| } |
| return |
| } |