github.com/iDigitalFlame/xmt@v0.5.4/device/winapi/const.go (about)

     1  //go:build windows
     2  // +build windows
     3  
     4  // Copyright (C) 2020 - 2023 iDigitalFlame
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    18  //
    19  
    20  package winapi
    21  
    22  import (
    23  	"syscall"
    24  
    25  	// Importing unsafe to use the linkname call
    26  	_ "unsafe"
    27  )
    28  
    29  // Windows API Specific syscall error values.
    30  const (
    31  	ErrNoData             syscall.Errno = 232
    32  	ErrPipeBusy           syscall.Errno = 231
    33  	ErrIoPending          syscall.Errno = 997
    34  	ErrBrokenPipe         syscall.Errno = 109
    35  	ErrSemTimeout         syscall.Errno = 121
    36  	ErrBadPathname        syscall.Errno = 161
    37  	ErrInvalidName        syscall.Errno = 123
    38  	ErrNoMoreFiles        syscall.Errno = 18
    39  	ErrIoIncomplete       syscall.Errno = 996
    40  	ErrFileNotFound       syscall.Errno = 2
    41  	ErrPipeConnected      syscall.Errno = 535
    42  	ErrOperationAborted   syscall.Errno = 995
    43  	ErrInsufficientBuffer syscall.Errno = 122
    44  )
    45  
    46  const (
    47  	// CurrentThread returns the handle for the current thread. It is a pseudo
    48  	// handle that does not need to be closed.
    49  	CurrentThread = ^uintptr(2 - 1)
    50  	// CurrentProcess returns the handle for the current process. It is a pseudo
    51  	// handle that does not need to be closed.
    52  	CurrentProcess = ^uintptr(0)
    53  	layeredPtr     = ^uintptr(19)
    54  	invalid        = ^uintptr(0)
    55  )
    56  
    57  // The runtime already loads these and we barely use them, so let's just load
    58  // them here.
    59  
    60  //go:linkname funcLoadLibrary runtime._LoadLibraryW
    61  var funcLoadLibrary uintptr
    62  
    63  //go:linkname funcAddDllDirectory runtime._AddDllDirectory
    64  var funcAddDllDirectory uintptr