github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/syscall/syscall_windows.go (about) 1 // +build js 2 3 package syscall 4 5 import "runtime" 6 7 var minusOne = -1 8 9 func Syscall(trap, nargs, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { 10 printWarning() 11 return uintptr(minusOne), 0, EACCES 12 } 13 14 func Syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { 15 printWarning() 16 return uintptr(minusOne), 0, EACCES 17 } 18 19 func Syscall9(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) { 20 printWarning() 21 return uintptr(minusOne), 0, EACCES 22 } 23 24 func Syscall12(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 uintptr) (r1, r2 uintptr, err Errno) { 25 printWarning() 26 return uintptr(minusOne), 0, EACCES 27 } 28 29 func Syscall15(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2 uintptr, err Errno) { 30 printWarning() 31 return uintptr(minusOne), 0, EACCES 32 } 33 34 func Syscall18(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 uintptr) (r1, r2 uintptr, err Errno) { 35 printWarning() 36 return uintptr(minusOne), 0, EACCES 37 } 38 39 func loadlibrary(filename *uint16) (handle uintptr, err Errno) { 40 printWarning() 41 return uintptr(minusOne), EACCES 42 } 43 44 func getprocaddress(handle uintptr, procname *uint8) (proc uintptr, err Errno) { 45 printWarning() 46 return uintptr(minusOne), EACCES 47 } 48 49 func (d *LazyDLL) Load() error { 50 return &DLLError{Msg: "system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md"} 51 } 52 53 func (p *LazyProc) Find() error { 54 return &DLLError{Msg: "system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md"} 55 } 56 57 func getStdHandle(h int) (fd Handle) { 58 if h == STD_OUTPUT_HANDLE { 59 return 1 60 } 61 if h == STD_ERROR_HANDLE { 62 return 2 63 } 64 return 0 65 } 66 67 func GetConsoleMode(console Handle, mode *uint32) (err error) { 68 return DummyError{} 69 } 70 71 func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { 72 if handle == 1 || handle == 2 { 73 printToConsole(buf) 74 *done = uint32(len(buf)) 75 return nil 76 } 77 printWarning() 78 return nil 79 } 80 81 func ExitProcess(exitcode uint32) { 82 runtime.Goexit() 83 } 84 85 func GetCommandLine() (cmd *uint16) { 86 return 87 } 88 89 func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { 90 return nil, DummyError{} 91 } 92 93 func Getenv(key string) (value string, found bool) { 94 return "", false 95 } 96 97 func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { 98 return 0, DummyError{} 99 } 100 101 type DummyError struct{} 102 103 func (e DummyError) Error() string { 104 return "" 105 }