diff options
Diffstat (limited to 'vendor/modernc.org/libc/libc_windows.go')
-rw-r--r-- | vendor/modernc.org/libc/libc_windows.go | 1247 |
1 files changed, 1234 insertions, 13 deletions
diff --git a/vendor/modernc.org/libc/libc_windows.go b/vendor/modernc.org/libc/libc_windows.go index fc36dc5a5..309d49935 100644 --- a/vendor/modernc.org/libc/libc_windows.go +++ b/vendor/modernc.org/libc/libc_windows.go @@ -21,6 +21,7 @@ import ( "unicode/utf16" "unsafe" + "github.com/ncruces/go-strftime" "modernc.org/libc/errno" "modernc.org/libc/fcntl" "modernc.org/libc/limits" @@ -36,6 +37,7 @@ var X__imp__environ = EnvironP() var X__imp__wenviron = uintptr(unsafe.Pointer(&wenviron)) var X_imp___environ = EnvironP() var X_iob [stdio.X_IOB_ENTRIES]stdio.FILE +var Xin6addr_any [16]byte var Xtimezone long // extern long timezone; @@ -52,6 +54,13 @@ func init() { } } +func X__p__wenviron(t *TLS) uintptr { + if !wenvValid { + bootWinEnviron(t) + } + return uintptr(unsafe.Pointer(&wenviron)) +} + func winGetObject(stream uintptr) interface{} { if fd, ok := iobMap[stream]; ok { f, _ := fdToFile(fd) @@ -153,6 +162,7 @@ var ( procSleepEx = modkernel32.NewProc("SleepEx") procSystemTimeToFileTime = modkernel32.NewProc("SystemTimeToFileTime") procTerminateThread = modkernel32.NewProc("TerminateThread") + procTryEnterCriticalSection = modkernel32.NewProc("TryEnterCriticalSection") procUnlockFile = modkernel32.NewProc("UnlockFile") procUnlockFileEx = modkernel32.NewProc("UnlockFileEx") procWaitForSingleObjectEx = modkernel32.NewProc("WaitForSingleObjectEx") @@ -203,6 +213,14 @@ var ( userenvapi = syscall.NewLazyDLL("userenv.dll") procGetProfilesDirectoryW = userenvapi.NewProc("GetProfilesDirectoryW") + + modcrt = syscall.NewLazyDLL("msvcrt.dll") + procAccess = modcrt.NewProc("_access") + procGmtime = modcrt.NewProc("gmtime") + procGmtime64 = modcrt.NewProc("_gmtime64") + procStat64i32 = modcrt.NewProc("_stat64i32") + procStrftime = modcrt.NewProc("strftime") + procStrtod = modcrt.NewProc("strtod") ) var ( @@ -344,6 +362,9 @@ func fwrite(fd int32, b []byte) (int, error) { // int fprintf(FILE *stream, const char *format, ...); func Xfprintf(t *TLS, stream, format, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v args=%v, (%v:)", t, args, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -356,12 +377,18 @@ func Xfprintf(t *TLS, stream, format, args uintptr) int32 { // int usleep(useconds_t usec); func Xusleep(t *TLS, usec types.Useconds_t) int32 { + if __ccgo_strace { + trc("t=%v usec=%v, (%v:)", t, usec, origin(2)) + } gotime.Sleep(gotime.Microsecond * gotime.Duration(usec)) return 0 } // int getrusage(int who, struct rusage *usage); func Xgetrusage(t *TLS, who int32, usage uintptr) int32 { + if __ccgo_strace { + trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 { // t.setErrno(err) @@ -373,16 +400,25 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 { // int lstat(const char *pathname, struct stat *statbuf); func Xlstat(t *TLS, pathname, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) + } return Xlstat64(t, pathname, statbuf) } // int stat(const char *pathname, struct stat *statbuf); func Xstat(t *TLS, pathname, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2)) + } return Xstat64(t, pathname, statbuf) } // int chdir(const char *path); func Xchdir(t *TLS, path uintptr) int32 { + if __ccgo_strace { + trc("t=%v path=%v, (%v:)", t, path, origin(2)) + } err := syscall.Chdir(GoString(path)) if err != nil { t.setErrno(err) @@ -445,6 +481,9 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr { // // ); func X_wopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2)) + } var mode types.Mode_t if args != 0 { mode = *(*types.Mode_t)(unsafe.Pointer(args)) @@ -469,11 +508,17 @@ func X_wopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { // int open(const char *pathname, int flags, ...); func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2)) + } return Xopen64(t, pathname, flags, args) } // int open(const char *pathname, int flags, ...); func Xopen64(t *TLS, pathname uintptr, flags int32, cmode uintptr) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v flags=%v cmode=%v, (%v:)", t, pathname, flags, cmode, origin(2)) + } var mode types.Mode_t if cmode != 0 { @@ -500,6 +545,9 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, cmode uintptr) int32 { // off_t lseek(int fd, off_t offset, int whence); func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t { + if __ccgo_strace { + trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) + } return types.Off_t(Xlseek64(t, fd, offset, whence)) } @@ -520,6 +568,9 @@ var fsyncStatbuf stat.Stat // int fsync(int fd); func Xfsync(t *TLS, fd int32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v, (%v:)", t, fd, origin(2)) + } f, ok := fdToFile(fd) if !ok { @@ -540,6 +591,9 @@ func Xfsync(t *TLS, fd int32) int32 { // long sysconf(int name); func Xsysconf(t *TLS, name int32) long { + if __ccgo_strace { + trc("t=%v name=%v, (%v:)", t, name, origin(2)) + } panic(todo("")) // switch name { // case unistd.X_SC_PAGESIZE: @@ -551,6 +605,9 @@ func Xsysconf(t *TLS, name int32) long { // int close(int fd); func Xclose(t *TLS, fd int32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v, (%v:)", t, fd, origin(2)) + } f, ok := fdToFile(fd) if !ok { @@ -572,6 +629,9 @@ func Xclose(t *TLS, fd int32) int32 { // char *getcwd(char *buf, size_t size); func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr { + if __ccgo_strace { + trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2)) + } b := make([]uint16, size) n, err := syscall.GetCurrentDirectory(uint32(len(b)), &b[0]) @@ -597,16 +657,25 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr { // int fstat(int fd, struct stat *statbuf); func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2)) + } return Xfstat64(t, fd, statbuf) } // int ftruncate(int fd, off_t length); func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 { + if __ccgo_strace { + trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2)) + } return Xftruncate64(t, fd, length) } // int fcntl(int fd, int cmd, ... /* arg */ ); func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2)) + } return Xfcntl64(t, fd, cmd, args) } @@ -618,6 +687,9 @@ func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 { // // ); func Xread(t *TLS, fd int32, buf uintptr, count uint32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2)) + } f, ok := fdToFile(fd) if !ok { t.setErrno(errno.EBADF) @@ -638,6 +710,13 @@ func Xread(t *TLS, fd int32, buf uintptr, count uint32) int32 { return int32(n) } +func X_read(t *TLS, fd int32, buf uintptr, count uint32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2)) + } + return Xread(t, fd, buf, count) +} + // int _write( // https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/write?view=msvc-160 // // int fd, @@ -646,6 +725,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count uint32) int32 { // // ); func Xwrite(t *TLS, fd int32, buf uintptr, count uint32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2)) + } f, ok := fdToFile(fd) if !ok { t.setErrno(errno.EBADF) @@ -669,8 +751,18 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count uint32) int32 { return int32(n) } +func X_write(t *TLS, fd int32, buf uintptr, count uint32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2)) + } + return Xwrite(t, fd, buf, count) +} + // int fchmod(int fd, mode_t mode); func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 { + if __ccgo_strace { + trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 { // t.setErrno(err) @@ -701,6 +793,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 { // int munmap(void *addr, size_t length); func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 { + if __ccgo_strace { + trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 { // t.setErrno(err) @@ -712,6 +807,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 { // int gettimeofday(struct timeval *tv, struct timezone *tz); func Xgettimeofday(t *TLS, tv, tz uintptr) int32 { + if __ccgo_strace { + trc("t=%v tz=%v, (%v:)", t, tz, origin(2)) + } panic(todo("")) // if tz != 0 { // panic(todo("")) @@ -746,6 +844,9 @@ func Xsetsockopt(t *TLS, _ ...interface{}) int32 { // int ioctl(int fd, unsigned long request, ...); func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2)) + } panic(todo("")) // var argp uintptr // if va != 0 { @@ -762,6 +863,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 { // int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 { + if __ccgo_strace { + trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2)) + } panic(todo("")) // n, err := unix.Select( // int(nfds), @@ -780,6 +884,9 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) // int mkfifo(const char *pathname, mode_t mode); func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) + } panic(todo("")) // if err := unix.Mkfifo(GoString(pathname), mode); err != nil { // t.setErrno(err) @@ -791,6 +898,9 @@ func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 { // mode_t umask(mode_t mask); func Xumask(t *TLS, mask types.Mode_t) types.Mode_t { + if __ccgo_strace { + trc("t=%v mask=%v, (%v:)", t, mask, origin(2)) + } panic(todo("")) // n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0) // return types.Mode_t(n) @@ -798,6 +908,9 @@ func Xumask(t *TLS, mask types.Mode_t) types.Mode_t { // int execvp(const char *file, char *const argv[]); func Xexecvp(t *TLS, file, argv uintptr) int32 { + if __ccgo_strace { + trc("t=%v argv=%v, (%v:)", t, argv, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 { // t.setErrno(err) @@ -809,6 +922,9 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 { // pid_t waitpid(pid_t pid, int *wstatus, int options); func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t { + if __ccgo_strace { + trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2)) + } panic(todo("")) // n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0) // if err != 0 { @@ -821,6 +937,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid // int uname(struct utsname *buf); func Xuname(t *TLS, buf uintptr) int32 { + if __ccgo_strace { + trc("t=%v buf=%v, (%v:)", t, buf, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_UNAME, buf, 0, 0); err != 0 { // t.setErrno(err) @@ -832,16 +951,25 @@ func Xuname(t *TLS, buf uintptr) int32 { // int getrlimit(int resource, struct rlimit *rlim); func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 { + if __ccgo_strace { + trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) + } return Xgetrlimit64(t, resource, rlim) } // int setrlimit(int resource, const struct rlimit *rlim); func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 { + if __ccgo_strace { + trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) + } return Xsetrlimit64(t, resource, rlim) } // int setrlimit(int resource, const struct rlimit *rlim); func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { + if __ccgo_strace { + trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2)) + } panic(todo("")) // if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 { // t.setErrno(err) @@ -858,11 +986,17 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 { // pid_t getpid(void); func Xgetpid(t *TLS) int32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } return int32(os.Getpid()) } // int system(const char *command); func Xsystem(t *TLS, command uintptr) int32 { + if __ccgo_strace { + trc("t=%v command=%v, (%v:)", t, command, origin(2)) + } s := GoString(command) if command == 0 { panic(todo("")) @@ -897,6 +1031,9 @@ func Xsystem(t *TLS, command uintptr) int32 { // struct passwd *getpwuid(uid_t uid); func Xgetpwuid(t *TLS, uid uint32) uintptr { + if __ccgo_strace { + trc("t=%v uid=%v, (%v:)", t, uid, origin(2)) + } panic(todo("")) // f, err := os.Open("/etc/passwd") // if err != nil { @@ -955,26 +1092,41 @@ func Xgetpwuid(t *TLS, uid uint32) uintptr { // int setvbuf(FILE *stream, char *buf, int mode, size_t size); func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 { + if __ccgo_strace { + trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2)) + } return 0 //TODO } // int raise(int sig); func Xraise(t *TLS, sig int32) int32 { + if __ccgo_strace { + trc("t=%v sig=%v, (%v:)", t, sig, origin(2)) + } panic(todo("")) } // int backtrace(void **buffer, int size); func Xbacktrace(t *TLS, buf uintptr, size int32) int32 { + if __ccgo_strace { + trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2)) + } panic(todo("")) } // void backtrace_symbols_fd(void *const *buffer, int size, int fd); func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) { + if __ccgo_strace { + trc("t=%v buffer=%v fd=%v, (%v:)", t, buffer, fd, origin(2)) + } panic(todo("")) } // int fileno(FILE *stream); func Xfileno(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } if stream == 0 { t.setErrno(errno.EBADF) return -1 @@ -1152,11 +1304,17 @@ func Xfileno(t *TLS, stream uintptr) int32 { // int mkstemps(char *template, int suffixlen); func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 { + if __ccgo_strace { + trc("t=%v template=%v suffixlen=%v, (%v:)", t, template, suffixlen, origin(2)) + } return Xmkstemps64(t, template, suffixlen) } // int mkstemps(char *template, int suffixlen); func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 { + if __ccgo_strace { + trc("t=%v template=%v suffixlen=%v, (%v:)", t, template, suffixlen, origin(2)) + } panic(todo("")) // len := uintptr(Xstrlen(t, template)) // x := template + uintptr(len-6) - uintptr(suffixlen) @@ -1178,6 +1336,9 @@ func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 { // int mkstemp(char *template); func Xmkstemp64(t *TLS, template uintptr) int32 { + if __ccgo_strace { + trc("t=%v template=%v, (%v:)", t, template, origin(2)) + } return Xmkstemps64(t, template, 0) } @@ -1240,6 +1401,9 @@ type ftstream struct { // FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **)); func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr { + if __ccgo_strace { + trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2)) + } panic(todo("")) // f := &ftstream{} // @@ -1345,11 +1509,17 @@ func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintp // FTSENT *fts_read(FTS *ftsp); func Xfts_read(t *TLS, ftsp uintptr) uintptr { + if __ccgo_strace { + trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2)) + } return Xfts64_read(t, ftsp) } // FTSENT *fts_read(FTS *ftsp); func Xfts64_read(t *TLS, ftsp uintptr) uintptr { + if __ccgo_strace { + trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2)) + } panic(todo("")) // f := winGetObject(ftsp).(*ftstream) // if f.x == len(f.s) { @@ -1367,11 +1537,17 @@ func Xfts64_read(t *TLS, ftsp uintptr) uintptr { // int fts_close(FTS *ftsp); func Xfts_close(t *TLS, ftsp uintptr) int32 { + if __ccgo_strace { + trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2)) + } return Xfts64_close(t, ftsp) } // int fts_close(FTS *ftsp); func Xfts64_close(t *TLS, ftsp uintptr) int32 { + if __ccgo_strace { + trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2)) + } panic(todo("")) // winGetObject(ftsp).(*ftstream).close(t) // removeObject(ftsp) @@ -1380,6 +1556,9 @@ func Xfts64_close(t *TLS, ftsp uintptr) int32 { // void tzset (void); func Xtzset(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } //TODO } @@ -1387,37 +1566,58 @@ var strerrorBuf [256]byte // char *strerror(int errnum); func Xstrerror(t *TLS, errnum int32) uintptr { + if __ccgo_strace { + trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2)) + } copy((*RawMem)(unsafe.Pointer(&strerrorBuf[0]))[:len(strerrorBuf):len(strerrorBuf)], fmt.Sprintf("errno %d\x00", errnum)) return uintptr(unsafe.Pointer(&strerrorBuf[0])) } // void *dlopen(const char *filename, int flags); func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr { + if __ccgo_strace { + trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2)) + } panic(todo("")) } // char *dlerror(void); func Xdlerror(t *TLS) uintptr { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } // int dlclose(void *handle); func Xdlclose(t *TLS, handle uintptr) int32 { + if __ccgo_strace { + trc("t=%v handle=%v, (%v:)", t, handle, origin(2)) + } panic(todo("")) } // void *dlsym(void *handle, const char *symbol); func Xdlsym(t *TLS, handle, symbol uintptr) uintptr { + if __ccgo_strace { + trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2)) + } panic(todo("")) } // void perror(const char *s); func Xperror(t *TLS, s uintptr) { + if __ccgo_strace { + trc("t=%v s=%v, (%v:)", t, s, origin(2)) + } panic(todo("")) } // int pclose(FILE *stream); func Xpclose(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } panic(todo("")) } @@ -1425,17 +1625,26 @@ var gai_strerrorBuf [100]byte // const char *gai_strerror(int errcode); func Xgai_strerror(t *TLS, errcode int32) uintptr { + if __ccgo_strace { + trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2)) + } copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode)) return uintptr(unsafe.Pointer(&gai_strerrorBuf)) } // int tcgetattr(int fd, struct termios *termios_p); func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2)) + } panic(todo("")) } // int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 { + if __ccgo_strace { + trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2)) + } panic(todo("")) } @@ -1446,22 +1655,34 @@ func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 { // int cfsetospeed(struct termios *termios_p, speed_t speed); func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 { + if __ccgo_strace { + trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2)) + } panic(todo("")) } // int cfsetispeed(struct termios *termios_p, speed_t speed); func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 { + if __ccgo_strace { + trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2)) + } panic(todo("")) } // pid_t fork(void); func Xfork(t *TLS) int32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } t.setErrno(errno.ENOSYS) return -1 } // char *setlocale(int category, const char *locale); func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr { + if __ccgo_strace { + trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2)) + } return 0 //TODO } @@ -1472,11 +1693,17 @@ func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr { // FILE *popen(const char *command, const char *type); func Xpopen(t *TLS, command, type1 uintptr) uintptr { + if __ccgo_strace { + trc("t=%v type1=%v, (%v:)", t, type1, origin(2)) + } panic(todo("")) } // char *realpath(const char *path, char *resolved_path); func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr { + if __ccgo_strace { + trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2)) + } s, err := filepath.EvalSymlinks(GoString(path)) if err != nil { if os.IsNotExist(err) { @@ -1505,6 +1732,9 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr { // struct tm *gmtime_r(const time_t *timep, struct tm *result); func Xgmtime_r(t *TLS, timep, result uintptr) uintptr { + if __ccgo_strace { + trc("t=%v result=%v, (%v:)", t, result, origin(2)) + } panic(todo("")) } @@ -1518,6 +1748,9 @@ func Xgmtime_r(t *TLS, timep, result uintptr) uintptr { // } func Xabort(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) // if dmesgs { // dmesg("%v:\n%s", origin(1), debug.Stack()) @@ -1538,6 +1771,9 @@ func Xabort(t *TLS) { // int fflush(FILE *stream); func Xfflush(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1553,6 +1789,9 @@ func Xfflush(t *TLS, stream uintptr) int32 { // size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { + if __ccgo_strace { + trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1578,6 +1817,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types // size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t { + if __ccgo_strace { + trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2)) + } if ptr == 0 || size == 0 { return 0 } @@ -1605,6 +1847,9 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type // int fclose(FILE *stream); func Xfclose(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1615,6 +1860,9 @@ func Xfclose(t *TLS, stream uintptr) int32 { // int fputc(int c, FILE *stream); func Xfputc(t *TLS, c int32, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1628,6 +1876,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 { // int fseek(FILE *stream, long offset, int whence); func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 { + if __ccgo_strace { + trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1649,6 +1900,9 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 { // long ftell(FILE *stream); func Xftell(t *TLS, stream uintptr) long { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1669,6 +1923,9 @@ func Xftell(t *TLS, stream uintptr) long { // int ferror(FILE *stream); func Xferror(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1680,6 +1937,9 @@ func Xferror(t *TLS, stream uintptr) int32 { // int getc(FILE *stream); func Xfgetc(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1696,16 +1956,25 @@ func Xfgetc(t *TLS, stream uintptr) int32 { // int ungetc(int c, FILE *stream); func Xungetc(t *TLS, c int32, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2)) + } panic(todo("")) } // int fscanf(FILE *stream, const char *format, ...); func Xfscanf(t *TLS, stream, format, va uintptr) int32 { + if __ccgo_strace { + trc("t=%v va=%v, (%v:)", t, va, origin(2)) + } panic(todo("")) } // int fputs(const char *s, FILE *stream); func Xfputs(t *TLS, s, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -1821,51 +2090,81 @@ func Xfputs(t *TLS, s, stream uintptr) int32 { // _CRTIMP extern int *__cdecl _errno(void); // /usr/share/mingw-w64/include/errno.h:17: func X_errno(t *TLS) uintptr { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } return t.errnop } // int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg); func X__ms_vfscanf(t *TLS, stream, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } panic(todo("")) } // int vsscanf(const char *str, const char *format, va_list ap); func X__ms_vsscanf(t *TLS, str, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } panic(todo("")) } // int vscanf(const char *format, va_list ap); func X__ms_vscanf(t *TLS, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } panic(todo("")) } // int vsnprintf(char *str, size_t size, const char *format, va_list ap); func X__ms_vsnprintf(t *TLS, str uintptr, size types.Size_t, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v str=%v size=%v ap=%v, (%v:)", t, str, size, ap, origin(2)) + } return Xvsnprintf(t, str, size, format, ap) } // int vfwscanf(FILE *stream, const wchar_t *format, va_list argptr;); func X__ms_vfwscanf(t *TLS, stream uintptr, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2)) + } panic(todo("")) } // int vwscanf(const wchar_t * restrict format, va_list arg); func X__ms_vwscanf(t *TLS, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } panic(todo("")) } // int _vsnwprintf(wchar_t *buffer, size_t count, const wchar_t *format, va_list argptr); func X_vsnwprintf(t *TLS, buffer uintptr, count types.Size_t, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v buffer=%v count=%v ap=%v, (%v:)", t, buffer, count, ap, origin(2)) + } panic(todo("")) } // int vswscanf(const wchar_t *buffer, const wchar_t *format, va_list arglist); func X__ms_vswscanf(t *TLS, stream uintptr, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2)) + } panic(todo("")) } // __acrt_iob_func func X__acrt_iob_func(t *TLS, fd uint32) uintptr { + if __ccgo_strace { + trc("t=%v fd=%v, (%v:)", t, fd, origin(2)) + } f, ok := fdToFile(int32(fd)) if !ok { @@ -1881,6 +2180,9 @@ func X__acrt_iob_func(t *TLS, fd uint32) uintptr { // // ); func XSetEvent(t *TLS, hEvent uintptr) int32 { + if __ccgo_strace { + trc("t=%v hEvent=%v, (%v:)", t, hEvent, origin(2)) + } r0, _, err := syscall.Syscall(procSetEvent.Addr(), 1, hEvent, 0, 0) if r0 == 0 { t.setErrno(err) @@ -1895,6 +2197,9 @@ func XSetEvent(t *TLS, hEvent uintptr) int32 { // // ); func X_stricmp(t *TLS, string1, string2 uintptr) int32 { + if __ccgo_strace { + trc("t=%v string2=%v, (%v:)", t, string2, origin(2)) + } var s1 = strings.ToLower(GoString(string1)) var s2 = strings.ToLower(GoString(string2)) return int32(strings.Compare(s1, s2)) @@ -1908,6 +2213,9 @@ func X_stricmp(t *TLS, string1, string2 uintptr) int32 { // // ); func XHeapFree(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 { + if __ccgo_strace { + trc("t=%v hHeap=%v dwFlags=%v lpMem=%v, (%v:)", t, hHeap, dwFlags, lpMem, origin(2)) + } r0, _, err := syscall.Syscall(procHeapFree.Addr(), 3, hHeap, uintptr(dwFlags), lpMem) if err != 0 { t.setErrno(err) @@ -1917,6 +2225,9 @@ func XHeapFree(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 { // HANDLE GetProcessHeap(); func XGetProcessHeap(t *TLS) uintptr { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, err := syscall.Syscall(procGetProcessHeap.Addr(), 0, 0, 0, 0) if r0 == 0 { t.setErrno(err) @@ -1932,6 +2243,9 @@ func XGetProcessHeap(t *TLS) uintptr { // // ); func XHeapAlloc(t *TLS, hHeap uintptr, dwFlags uint32, dwBytes types.Size_t) uintptr { + if __ccgo_strace { + trc("t=%v hHeap=%v dwFlags=%v dwBytes=%v, (%v:)", t, hHeap, dwFlags, dwBytes, origin(2)) + } r0, _, err := syscall.Syscall(procHeapAlloc.Addr(), 3, hHeap, uintptr(dwFlags), uintptr(dwBytes)) if r0 == 0 { t.setErrno(err) @@ -1977,6 +2291,9 @@ func XWspiapiGetAddrInfo(t *TLS, _ ...interface{}) int32 { // // ); func Xwcscmp(t *TLS, string1, string2 uintptr) int32 { + if __ccgo_strace { + trc("t=%v string2=%v, (%v:)", t, string2, origin(2)) + } var s1 = goWideString(string1) var s2 = goWideString(string2) return int32(strings.Compare(s1, s2)) @@ -1984,6 +2301,9 @@ func Xwcscmp(t *TLS, string1, string2 uintptr) int32 { // BOOL IsDebuggerPresent(); func XIsDebuggerPresent(t *TLS) int32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } @@ -1997,6 +2317,9 @@ func XExitProcess(t *TLS, _ ...interface{}) int32 { // // ); func XGetVersionExW(t *TLS, lpVersionInformation uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpVersionInformation=%v, (%v:)", t, lpVersionInformation, origin(2)) + } r0, _, err := syscall.Syscall(procGetVersionExW.Addr(), 1, lpVersionInformation, 0, 0) if r0 == 0 { t.setErrno(err) @@ -2021,6 +2344,9 @@ func XGetVolumeNameForVolumeMountPointW(t *TLS, _ ...interface{}) int32 { // // ); func Xwcslen(t *TLS, str uintptr) types.Size_t { + if __ccgo_strace { + trc("t=%v str=%v, (%v:)", t, str, origin(2)) + } r0, _, _ := syscall.Syscall(procLstrlenW.Addr(), 1, str, 0, 0) return types.Size_t(r0) } @@ -2031,6 +2357,9 @@ func Xwcslen(t *TLS, str uintptr) types.Size_t { // // ); func XGetStdHandle(t *TLS, nStdHandle uint32) uintptr { + if __ccgo_strace { + trc("t=%v nStdHandle=%v, (%v:)", t, nStdHandle, origin(2)) + } h, err := syscall.GetStdHandle(int(nStdHandle)) if err != nil { panic("no console") @@ -2044,6 +2373,9 @@ func XGetStdHandle(t *TLS, nStdHandle uint32) uintptr { // // ); func XCloseHandle(t *TLS, hObject uintptr) int32 { + if __ccgo_strace { + trc("t=%v hObject=%v, (%v:)", t, hObject, origin(2)) + } r := syscall.CloseHandle(syscall.Handle(hObject)) if r != nil { return errno.EINVAL @@ -2053,6 +2385,9 @@ func XCloseHandle(t *TLS, hObject uintptr) int32 { // DWORD GetLastError(); func XGetLastError(t *TLS) uint32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } var rv = *(*int32)(unsafe.Pointer(t.errnop)) return uint32(rv) @@ -2069,6 +2404,9 @@ func XGetLastError(t *TLS) uint32 { // // ); func XSetFilePointer(t *TLS, hFile uintptr, lDistanceToMove long, lpDistanceToMoveHigh uintptr, dwMoveMethod uint32) uint32 { + if __ccgo_strace { + trc("t=%v hFile=%v lDistanceToMove=%v lpDistanceToMoveHigh=%v dwMoveMethod=%v, (%v:)", t, hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod, origin(2)) + } r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, hFile, uintptr(lDistanceToMove), lpDistanceToMoveHigh, uintptr(dwMoveMethod), 0, 0) var uOff = uint32(r0) if uOff == 0xffffffff { @@ -2087,6 +2425,9 @@ func XSetFilePointer(t *TLS, hFile uintptr, lDistanceToMove long, lpDistanceToMo // // ); func XSetEndOfFile(t *TLS, hFile uintptr) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v, (%v:)", t, hFile, origin(2)) + } err := syscall.SetEndOfFile(syscall.Handle(hFile)) if err != nil { t.setErrno(err) @@ -2105,6 +2446,9 @@ func XSetEndOfFile(t *TLS, hFile uintptr) int32 { // // ); func XReadFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToRead uint32, lpNumberOfBytesRead, lpOverlapped uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nNumberOfBytesToRead=%v lpOverlapped=%v, (%v:)", t, lpBuffer, nNumberOfBytesToRead, lpOverlapped, origin(2)) + } r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, hFile, lpBuffer, uintptr(nNumberOfBytesToRead), uintptr(lpNumberOfBytesRead), uintptr(lpOverlapped), 0) if r1 == 0 { @@ -2128,6 +2472,9 @@ func XReadFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToRead uint32, lpN // // ); func XWriteFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToWrite uint32, lpNumberOfBytesWritten, lpOverlapped uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nNumberOfBytesToWrite=%v lpOverlapped=%v, (%v:)", t, lpBuffer, nNumberOfBytesToWrite, lpOverlapped, origin(2)) + } r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, hFile, lpBuffer, uintptr(nNumberOfBytesToWrite), lpNumberOfBytesWritten, lpOverlapped, 0) if r1 == 0 { @@ -2147,6 +2494,9 @@ func XWriteFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToWrite uint32, l // // ); func XGetFileAttributesW(t *TLS, lpFileName uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2)) + } attrs, err := syscall.GetFileAttributes((*uint16)(unsafe.Pointer(lpFileName))) if attrs == syscall.INVALID_FILE_ATTRIBUTES { if err != nil { @@ -2170,6 +2520,9 @@ func XGetFileAttributesW(t *TLS, lpFileName uintptr) uint32 { // // ); func XCreateFileW(t *TLS, lpFileName uintptr, dwDesiredAccess, dwShareMode uint32, lpSecurityAttributes uintptr, dwCreationDisposition, dwFlagsAndAttributes uint32, hTemplateFile uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpFileName=%v dwShareMode=%v lpSecurityAttributes=%v dwFlagsAndAttributes=%v hTemplateFile=%v, (%v:)", t, lpFileName, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, hTemplateFile, origin(2)) + } r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, lpFileName, uintptr(dwDesiredAccess), uintptr(dwShareMode), lpSecurityAttributes, uintptr(dwCreationDisposition), uintptr(dwFlagsAndAttributes), hTemplateFile, 0, 0) @@ -2197,6 +2550,9 @@ func XCreateFileW(t *TLS, lpFileName uintptr, dwDesiredAccess, dwShareMode uint3 // // ); func XDuplicateHandle(t *TLS, hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle uintptr, dwDesiredAccess uint32, bInheritHandle int32, dwOptions uint32) int32 { + if __ccgo_strace { + trc("t=%v lpTargetHandle=%v dwDesiredAccess=%v bInheritHandle=%v dwOptions=%v, (%v:)", t, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions, origin(2)) + } r0, _, err := syscall.Syscall9(procDuplicateHandle.Addr(), 7, hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, uintptr(dwDesiredAccess), uintptr(bInheritHandle), uintptr(dwOptions), 0, 0) if r0 == 0 { @@ -2207,6 +2563,9 @@ func XDuplicateHandle(t *TLS, hSourceProcessHandle, hSourceHandle, hTargetProces // HANDLE GetCurrentProcess(); func XGetCurrentProcess(t *TLS) uintptr { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, e1 := syscall.Syscall(procGetCurrentProcess.Addr(), 0, 0, 0, 0) if r0 == 0 { if e1 != 0 { @@ -2224,6 +2583,9 @@ func XGetCurrentProcess(t *TLS) uintptr { // // ); func XFlushFileBuffers(t *TLS, hFile uintptr) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v, (%v:)", t, hFile, origin(2)) + } err := syscall.FlushFileBuffers(syscall.Handle(hFile)) if err != nil { t.setErrno(err) @@ -2239,6 +2601,9 @@ func XFlushFileBuffers(t *TLS, hFile uintptr) int32 { // // ); func XGetFileType(t *TLS, hFile uintptr) uint32 { + if __ccgo_strace { + trc("t=%v hFile=%v, (%v:)", t, hFile, origin(2)) + } n, err := syscall.GetFileType(syscall.Handle(hFile)) if err != nil { t.setErrno(err) @@ -2253,6 +2618,9 @@ func XGetFileType(t *TLS, hFile uintptr) uint32 { // // ); func XGetConsoleMode(t *TLS, hConsoleHandle, lpMode uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpMode=%v, (%v:)", t, lpMode, origin(2)) + } err := syscall.GetConsoleMode(syscall.Handle(hConsoleHandle), (*uint32)(unsafe.Pointer(lpMode))) if err != nil { t.setErrno(err) @@ -2268,6 +2636,9 @@ func XGetConsoleMode(t *TLS, hConsoleHandle, lpMode uintptr) int32 { // // ); func XGetCommState(t *TLS, hFile, lpDCB uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpDCB=%v, (%v:)", t, lpDCB, origin(2)) + } r1, _, err := syscall.Syscall(procGetCommState.Addr(), 2, hFile, lpDCB, 0) if r1 == 0 { t.setErrno(err) @@ -2284,6 +2655,9 @@ func XGetCommState(t *TLS, hFile, lpDCB uintptr) int32 { // // ); func X_wcsnicmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 { + if __ccgo_strace { + trc("t=%v string2=%v count=%v, (%v:)", t, string2, count, origin(2)) + } var s1 = strings.ToLower(goWideString(string1)) var l1 = len(s1) @@ -2316,6 +2690,9 @@ func X_wcsnicmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 { // // ); func XReadConsoleW(t *TLS, hConsoleInput, lpBuffer uintptr, nNumberOfCharsToRead uint32, lpNumberOfCharsRead, pInputControl uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nNumberOfCharsToRead=%v pInputControl=%v, (%v:)", t, lpBuffer, nNumberOfCharsToRead, pInputControl, origin(2)) + } rv, _, err := syscall.Syscall6(procReadConsoleW.Addr(), 5, hConsoleInput, lpBuffer, uintptr(nNumberOfCharsToRead), lpNumberOfCharsRead, pInputControl, 0) @@ -2336,6 +2713,9 @@ func XReadConsoleW(t *TLS, hConsoleInput, lpBuffer uintptr, nNumberOfCharsToRead // // ); func XWriteConsoleW(t *TLS, hConsoleOutput, lpBuffer uintptr, nNumberOfCharsToWrite uint32, lpNumberOfCharsWritten, lpReserved uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nNumberOfCharsToWrite=%v lpReserved=%v, (%v:)", t, lpBuffer, nNumberOfCharsToWrite, lpReserved, origin(2)) + } rv, _, err := syscall.Syscall6(procWriteConsoleW.Addr(), 5, hConsoleOutput, lpBuffer, uintptr(nNumberOfCharsToWrite), lpNumberOfCharsWritten, lpReserved, 0) if rv == 0 { @@ -2351,6 +2731,9 @@ func XWriteConsoleW(t *TLS, hConsoleOutput, lpBuffer uintptr, nNumberOfCharsToWr // // ); func XWaitForSingleObject(t *TLS, hHandle uintptr, dwMilliseconds uint32) uint32 { + if __ccgo_strace { + trc("t=%v hHandle=%v dwMilliseconds=%v, (%v:)", t, hHandle, dwMilliseconds, origin(2)) + } rv, err := syscall.WaitForSingleObject(syscall.Handle(hHandle), dwMilliseconds) if err != nil { t.setErrno(err) @@ -2364,6 +2747,9 @@ func XWaitForSingleObject(t *TLS, hHandle uintptr, dwMilliseconds uint32) uint32 // // ); func XResetEvent(t *TLS, hEvent uintptr) int32 { + if __ccgo_strace { + trc("t=%v hEvent=%v, (%v:)", t, hEvent, origin(2)) + } rv, _, err := syscall.Syscall(procResetEvent.Addr(), 1, hEvent, 0, 0) if rv == 0 { t.setErrno(err) @@ -2380,6 +2766,9 @@ func XResetEvent(t *TLS, hEvent uintptr) int32 { // // ); func XPeekConsoleInputW(t *TLS, hConsoleInput, lpBuffer uintptr, nLength uint32, lpNumberOfEventsRead uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nLength=%v lpNumberOfEventsRead=%v, (%v:)", t, lpBuffer, nLength, lpNumberOfEventsRead, origin(2)) + } r0, _, err := syscall.Syscall6(procPeekConsoleInputW.Addr(), 4, hConsoleInput, lpBuffer, uintptr(nLength), lpNumberOfEventsRead, 0, 0) if r0 == 0 { t.setErrno(err) @@ -2395,11 +2784,17 @@ func XPeekConsoleInputW(t *TLS, hConsoleInput, lpBuffer uintptr, nLength uint32, // // ); func XwsprintfA(t *TLS, buf, format, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v args=%v, (%v:)", t, args, origin(2)) + } return Xsprintf(t, buf, format, args) } // UINT WINAPI GetConsoleCP(void); func XGetConsoleCP(t *TLS) uint32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, err := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) if r0 == 0 { t.setErrno(err) @@ -2426,6 +2821,9 @@ func XGetConsoleCP(t *TLS) uint32 { // // ); func XCreateEventW(t *TLS, lpEventAttributes uintptr, bManualReset, bInitialState int32, lpName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpEventAttributes=%v bInitialState=%v lpName=%v, (%v:)", t, lpEventAttributes, bInitialState, lpName, origin(2)) + } r0, _, err := syscall.Syscall6(procCreateEventW.Addr(), 4, lpEventAttributes, uintptr(bManualReset), uintptr(bInitialState), lpName, 0, 0) if r0 == 0 { @@ -2467,6 +2865,9 @@ func ThreadProc(p uintptr) uintptr { // // ); func XCreateThread(t *TLS, lpThreadAttributes uintptr, dwStackSize types.Size_t, lpStartAddress, lpParameter uintptr, dwCreationFlags uint32, lpThreadId uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpThreadAttributes=%v dwStackSize=%v lpParameter=%v dwCreationFlags=%v lpThreadId=%v, (%v:)", t, lpThreadAttributes, dwStackSize, lpParameter, dwCreationFlags, lpThreadId, origin(2)) + } f := (*struct{ f func(*TLS, uintptr) uint32 })(unsafe.Pointer(&struct{ uintptr }{lpStartAddress})).f var tAdp = ThreadAdapter{threadFunc: f, tls: NewTLS(), param: lpParameter} tAdp.token = addObject(&tAdp) @@ -2486,6 +2887,9 @@ func XCreateThread(t *TLS, lpThreadAttributes uintptr, dwStackSize types.Size_t, // // ); func XSetThreadPriority(t *TLS, hThread uintptr, nPriority int32) int32 { + if __ccgo_strace { + trc("t=%v hThread=%v nPriority=%v, (%v:)", t, hThread, nPriority, origin(2)) + } //r0, _, err := syscall.Syscall(procSetThreadPriority.Addr(), 2, hThread, uintptr(nPriority), 0) //if r0 == 0 { @@ -2502,6 +2906,9 @@ func XSetThreadPriority(t *TLS, hThread uintptr, nPriority int32) int32 { // // ); func XSetConsoleMode(t *TLS, hConsoleHandle uintptr, dwMode uint32) int32 { + if __ccgo_strace { + trc("t=%v hConsoleHandle=%v dwMode=%v, (%v:)", t, hConsoleHandle, dwMode, origin(2)) + } rv, _, err := syscall.Syscall(procSetConsoleMode.Addr(), 2, hConsoleHandle, uintptr(dwMode), 0) if rv == 0 { t.setErrno(err) @@ -2523,6 +2930,9 @@ func XClearCommError(t *TLS, _ ...interface{}) int32 { // // ); func XDeleteCriticalSection(t *TLS, lpCriticalSection uintptr) { + if __ccgo_strace { + trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2)) + } syscall.Syscall(procDeleteCriticalSection.Addr(), 1, lpCriticalSection, 0, 0) } @@ -2532,15 +2942,37 @@ func XDeleteCriticalSection(t *TLS, lpCriticalSection uintptr) { // // ); func XEnterCriticalSection(t *TLS, lpCriticalSection uintptr) { + if __ccgo_strace { + trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2)) + } syscall.Syscall(procEnterCriticalSection.Addr(), 1, lpCriticalSection, 0, 0) } +// BOOL TryEnterCriticalSection( +// +// LPCRITICAL_SECTION lpCriticalSection +// +// ); +func XTryEnterCriticalSection(t *TLS, lpCriticalSection uintptr) (r int32) { + if __ccgo_strace { + trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2)) + } + r0, _, err := syscall.SyscallN(procTryEnterCriticalSection.Addr(), lpCriticalSection) + if err != 0 { + t.setErrno(err) + } + return int32(r0) +} + // void LeaveCriticalSection( // // LPCRITICAL_SECTION lpCriticalSection // // ); func XLeaveCriticalSection(t *TLS, lpCriticalSection uintptr) { + if __ccgo_strace { + trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2)) + } syscall.Syscall(procLeaveCriticalSection.Addr(), 1, lpCriticalSection, 0, 0) } @@ -2562,6 +2994,9 @@ func XSetCommTimeouts(t *TLS, _ ...interface{}) int32 { // // ); func XInitializeCriticalSection(t *TLS, lpCriticalSection uintptr) { + if __ccgo_strace { + trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2)) + } // InitializeCriticalSection always succeeds, even in low memory situations. syscall.Syscall(procInitializeCriticalSection.Addr(), 1, lpCriticalSection, 0, 0) } @@ -2593,6 +3028,9 @@ func XGetCommModemStatus(t *TLS, _ ...interface{}) int32 { // // ); func XMoveFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpNewFileName=%v, (%v:)", t, lpNewFileName, origin(2)) + } r0, _, err := syscall.Syscall(procMoveFileW.Addr(), 2, lpExistingFileName, lpNewFileName, 0) if err != 0 { t.setErrno(err) @@ -2609,6 +3047,9 @@ func XMoveFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr) int32 { // // ); func XGetFullPathNameW(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffer, lpFilePart uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v nBufferLength=%v lpFilePart=%v, (%v:)", t, lpFileName, nBufferLength, lpFilePart, origin(2)) + } r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, lpFileName, uintptr(nBufferLength), uintptr(lpBuffer), uintptr(lpFilePart), 0, 0) n := uint32(r0) if n == 0 { @@ -2627,6 +3068,9 @@ func XGetFullPathNameW(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffe // // ); func XCharLowerW(t *TLS, lpsz uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpsz=%v, (%v:)", t, lpsz, origin(2)) + } panic(todo("")) } @@ -2637,6 +3081,9 @@ func XCharLowerW(t *TLS, lpsz uintptr) uintptr { // // ); func XCreateDirectoryW(t *TLS, lpPathName, lpSecurityAttributes uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpSecurityAttributes=%v, (%v:)", t, lpSecurityAttributes, origin(2)) + } err := syscall.CreateDirectory((*uint16)(unsafe.Pointer(lpPathName)), (*syscall.SecurityAttributes)(unsafe.Pointer(lpSecurityAttributes))) if err != nil { @@ -2653,6 +3100,9 @@ func XCreateDirectoryW(t *TLS, lpPathName, lpSecurityAttributes uintptr) int32 { // // ); func XSetFileAttributesW(t *TLS, lpFileName uintptr, dwFileAttributes uint32) int32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v dwFileAttributes=%v, (%v:)", t, lpFileName, dwFileAttributes, origin(2)) + } err := syscall.SetFileAttributes((*uint16)(unsafe.Pointer(lpFileName)), dwFileAttributes) if err != nil { t.setErrno(err) @@ -2670,6 +3120,9 @@ func XSetFileAttributesW(t *TLS, lpFileName uintptr, dwFileAttributes uint32) in // // ); func XGetTempFileNameW(t *TLS, lpPathName, lpPrefixString uintptr, uUnique uint32, lpTempFileName uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpPrefixString=%v uUnique=%v lpTempFileName=%v, (%v:)", t, lpPrefixString, uUnique, lpTempFileName, origin(2)) + } r0, _, e1 := syscall.Syscall6(procGetTempFileNameW.Addr(), 4, lpPathName, lpPrefixString, uintptr(uUnique), lpTempFileName, 0, 0) if r0 == 0 { t.setErrno(e1) @@ -2685,6 +3138,9 @@ func XGetTempFileNameW(t *TLS, lpPathName, lpPrefixString uintptr, uUnique uint3 // // ); func XCopyFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr, bFailIfExists int32) int32 { + if __ccgo_strace { + trc("t=%v lpNewFileName=%v bFailIfExists=%v, (%v:)", t, lpNewFileName, bFailIfExists, origin(2)) + } r0, _, e1 := syscall.Syscall(procCopyFileW.Addr(), 3, lpExistingFileName, lpNewFileName, uintptr(bFailIfExists)) if r0 == 0 { t.setErrno(e1) @@ -2698,6 +3154,9 @@ func XCopyFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr, bFailIfExists // // ); func XDeleteFileW(t *TLS, lpFileName uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2)) + } err := syscall.DeleteFile((*uint16)(unsafe.Pointer(lpFileName))) if err != nil { t.setErrno(err) @@ -2712,6 +3171,9 @@ func XDeleteFileW(t *TLS, lpFileName uintptr) int32 { // // ); func XRemoveDirectoryW(t *TLS, lpPathName uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpPathName=%v, (%v:)", t, lpPathName, origin(2)) + } err := syscall.RemoveDirectory((*uint16)(unsafe.Pointer(lpPathName))) if err != nil { t.setErrno(err) @@ -2722,6 +3184,9 @@ func XRemoveDirectoryW(t *TLS, lpPathName uintptr) int32 { // HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData); func XFindFirstFileW(t *TLS, lpFileName, lpFindFileData uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpFindFileData=%v, (%v:)", t, lpFindFileData, origin(2)) + } r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, lpFileName, lpFindFileData, 0) handle := syscall.Handle(r0) if handle == syscall.InvalidHandle { @@ -2745,6 +3210,9 @@ func XFindFirstFileW(t *TLS, lpFileName, lpFindFileData uintptr) uintptr { // // ); func XFindFirstFileExW(t *TLS, lpFileName uintptr, fInfoLevelId int32, lpFindFileData uintptr, fSearchOp int32, lpSearchFilter uintptr, dwAdditionalFlags uint32) uintptr { + if __ccgo_strace { + trc("t=%v lpFileName=%v fInfoLevelId=%v lpFindFileData=%v fSearchOp=%v lpSearchFilter=%v dwAdditionalFlags=%v, (%v:)", t, lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags, origin(2)) + } r0, _, e1 := syscall.Syscall6(procFindFirstFileExW.Addr(), 6, lpFileName, uintptr(fInfoLevelId), lpFindFileData, uintptr(fSearchOp), lpSearchFilter, uintptr(dwAdditionalFlags)) handle := syscall.Handle(r0) if handle == syscall.InvalidHandle { @@ -2759,6 +3227,9 @@ func XFindFirstFileExW(t *TLS, lpFileName uintptr, fInfoLevelId int32, lpFindFil // BOOL FindClose(HANDLE hFindFile); func XFindClose(t *TLS, hFindFile uintptr) int32 { + if __ccgo_strace { + trc("t=%v hFindFile=%v, (%v:)", t, hFindFile, origin(2)) + } r0, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, hFindFile, 0, 0) if r0 == 0 { if e1 != 0 { @@ -2777,6 +3248,9 @@ func XFindClose(t *TLS, hFindFile uintptr) int32 { // // ); func XFindNextFileW(t *TLS, hFindFile, lpFindFileData uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFindFileData=%v, (%v:)", t, lpFindFileData, origin(2)) + } r0, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, hFindFile, lpFindFileData, 0) if r0 == 0 { if e1 != 0 { @@ -2795,6 +3269,9 @@ func XFindNextFileW(t *TLS, hFindFile, lpFindFileData uintptr) int32 { // // ); func XGetLogicalDriveStringsA(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 { + if __ccgo_strace { + trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2)) + } r0, _, err := syscall.Syscall(procGetLogicalDriveStringsA.Addr(), 2, uintptr(nBufferLength), lpBuffer, 0) if err != 0 { t.setErrno(err) @@ -2815,6 +3292,9 @@ func XGetLogicalDriveStringsA(t *TLS, nBufferLength uint32, lpBuffer uintptr) ui // // ); func XGetVolumeInformationA(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr, nVolumeNameSize uint32, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer uintptr, nFileSystemNameSize uint32) int32 { + if __ccgo_strace { + trc("t=%v lpVolumeNameBuffer=%v nVolumeNameSize=%v lpFileSystemNameBuffer=%v nFileSystemNameSize=%v, (%v:)", t, lpVolumeNameBuffer, nVolumeNameSize, lpFileSystemNameBuffer, nFileSystemNameSize, origin(2)) + } r0, _, err := syscall.Syscall9(procGetVolumeInformationA.Addr(), 8, lpRootPathName, lpVolumeNameBuffer, @@ -2840,6 +3320,9 @@ func XGetVolumeInformationA(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr, // // ); func XCreateHardLinkW(t *TLS, lpFileName, lpExistingFileName, lpSecurityAttributes uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpSecurityAttributes=%v, (%v:)", t, lpSecurityAttributes, origin(2)) + } r0, _, err := syscall.Syscall(procCreateHardLinkW.Addr(), 1, lpFileName, lpExistingFileName, lpSecurityAttributes) if err != 0 { t.setErrno(err) @@ -2860,6 +3343,9 @@ func XCreateHardLinkW(t *TLS, lpFileName, lpExistingFileName, lpSecurityAttribut // // ); func XDeviceIoControl(t *TLS, hDevice uintptr, dwIoControlCode uint32, lpInBuffer uintptr, nInBufferSize uint32, lpOutBuffer uintptr, nOutBufferSize uint32, lpBytesReturned, lpOverlapped uintptr) int32 { + if __ccgo_strace { + trc("t=%v hDevice=%v dwIoControlCode=%v lpInBuffer=%v nInBufferSize=%v lpOutBuffer=%v nOutBufferSize=%v lpOverlapped=%v, (%v:)", t, hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpOverlapped, origin(2)) + } r0, _, err := syscall.Syscall9(procDeviceIoControl.Addr(), 8, hDevice, uintptr(dwIoControlCode), lpInBuffer, uintptr(nInBufferSize), lpOutBuffer, uintptr(nOutBufferSize), lpBytesReturned, lpOverlapped, 0) if r0 == 0 { @@ -2876,6 +3362,9 @@ func XDeviceIoControl(t *TLS, hDevice uintptr, dwIoControlCode uint32, lpInBuffe // // ); func Xwcsncmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 { + if __ccgo_strace { + trc("t=%v string2=%v count=%v, (%v:)", t, string2, count, origin(2)) + } var s1 = goWideString(string1) var l1 = len(s1) var s2 = goWideString(string2) @@ -2908,6 +3397,9 @@ func Xwcsncmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 { // // ); func XMultiByteToWideChar(t *TLS, CodePage uint32, dwFlags uint32, lpMultiByteStr uintptr, cbMultiByte int32, lpWideCharStr uintptr, cchWideChar int32) int32 { + if __ccgo_strace { + trc("t=%v CodePage=%v dwFlags=%v lpMultiByteStr=%v cbMultiByte=%v lpWideCharStr=%v cchWideChar=%v, (%v:)", t, CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar, origin(2)) + } r1, _, _ := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(CodePage), uintptr(dwFlags), uintptr(lpMultiByteStr), uintptr(cbMultiByte), uintptr(lpWideCharStr), uintptr(cchWideChar)) @@ -2920,6 +3412,9 @@ func XMultiByteToWideChar(t *TLS, CodePage uint32, dwFlags uint32, lpMultiByteSt // // ); func XOutputDebugStringW(t *TLS, lpOutputString uintptr) { + if __ccgo_strace { + trc("t=%v lpOutputString=%v, (%v:)", t, lpOutputString, origin(2)) + } panic(todo("")) } @@ -2937,6 +3432,9 @@ func XMessageBeep(t *TLS, _ ...interface{}) int32 { // // ); func X_InterlockedCompareExchange(t *TLS, Destination uintptr, Exchange, Comparand long) long { + if __ccgo_strace { + trc("t=%v Destination=%v Comparand=%v, (%v:)", t, Destination, Comparand, origin(2)) + } // The function returns the initial value of the Destination parameter. var v = *(*int32)(unsafe.Pointer(Destination)) @@ -2946,11 +3444,17 @@ func X_InterlockedCompareExchange(t *TLS, Destination uintptr, Exchange, Compara // int rename(const char *oldpath, const char *newpath); func Xrename(t *TLS, oldpath, newpath uintptr) int32 { + if __ccgo_strace { + trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2)) + } panic(todo("")) } // BOOL AreFileApisANSI(); func XAreFileApisANSI(t *TLS) int32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, _ := syscall.Syscall(procAreFileApisANSI.Addr(), 0, 0, 0, 0) return int32(r0) @@ -2996,6 +3500,9 @@ func XCreateFileA(t *TLS, lpFileName uintptr, dwDesiredAccess, dwShareMode uint3 // // ); func XCreateFileMappingA(t *TLS, hFile, lpFileMappingAttributes uintptr, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow uint32, lpName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpFileMappingAttributes=%v dwMaximumSizeLow=%v lpName=%v, (%v:)", t, lpFileMappingAttributes, dwMaximumSizeLow, lpName, origin(2)) + } panic(todo("")) } @@ -3010,6 +3517,9 @@ func XCreateFileMappingA(t *TLS, hFile, lpFileMappingAttributes uintptr, flProte // // ); func XCreateFileMappingW(t *TLS, hFile, lpFileMappingAttributes uintptr, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow uint32, lpName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpFileMappingAttributes=%v dwMaximumSizeLow=%v lpName=%v, (%v:)", t, lpFileMappingAttributes, dwMaximumSizeLow, lpName, origin(2)) + } h, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, hFile, lpFileMappingAttributes, uintptr(flProtect), uintptr(dwMaximumSizeHigh), uintptr(dwMaximumSizeLow), lpName) if h == 0 { @@ -3030,6 +3540,9 @@ func XCreateFileMappingW(t *TLS, hFile, lpFileMappingAttributes uintptr, flProte // // ); func XCreateMutexW(t *TLS, lpMutexAttributes uintptr, bInitialOwner int32, lpName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpMutexAttributes=%v bInitialOwner=%v lpName=%v, (%v:)", t, lpMutexAttributes, bInitialOwner, lpName, origin(2)) + } panic(todo("")) } @@ -3039,6 +3552,9 @@ func XCreateMutexW(t *TLS, lpMutexAttributes uintptr, bInitialOwner int32, lpNam // // ); func XDeleteFileA(t *TLS, lpFileName uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2)) + } panic(todo("")) } @@ -3054,6 +3570,9 @@ func XDeleteFileA(t *TLS, lpFileName uintptr) int32 { // // ); func XFormatMessageA(t *TLS, dwFlagsAndAttributes uint32, lpSource uintptr, dwMessageId, dwLanguageId uint32, lpBuffer uintptr, nSize uint32, Arguments uintptr) uint32 { + if __ccgo_strace { + trc("t=%v dwFlagsAndAttributes=%v lpSource=%v dwLanguageId=%v lpBuffer=%v nSize=%v Arguments=%v, (%v:)", t, dwFlagsAndAttributes, lpSource, dwLanguageId, lpBuffer, nSize, Arguments, origin(2)) + } panic(todo("")) } @@ -3069,6 +3588,9 @@ func XFormatMessageA(t *TLS, dwFlagsAndAttributes uint32, lpSource uintptr, dwMe // // ); func XFormatMessageW(t *TLS, dwFlags uint32, lpSource uintptr, dwMessageId, dwLanguageId uint32, lpBuffer uintptr, nSize uint32, Arguments uintptr) uint32 { + if __ccgo_strace { + trc("t=%v dwFlags=%v lpSource=%v dwLanguageId=%v lpBuffer=%v nSize=%v Arguments=%v, (%v:)", t, dwFlags, lpSource, dwLanguageId, lpBuffer, nSize, Arguments, origin(2)) + } r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(dwFlags), lpSource, uintptr(dwMessageId), uintptr(dwLanguageId), lpBuffer, uintptr(nSize), Arguments, 0, 0) @@ -3085,11 +3607,17 @@ func XFormatMessageW(t *TLS, dwFlags uint32, lpSource uintptr, dwMessageId, dwLa // BOOL FreeLibrary(HMODULE hLibModule); func XFreeLibrary(t *TLS, hLibModule uintptr) int32 { + if __ccgo_strace { + trc("t=%v hLibModule=%v, (%v:)", t, hLibModule, origin(2)) + } panic(todo("")) } // DWORD GetCurrentProcessId(); func XGetCurrentProcessId(t *TLS) uint32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) pid := uint32(r0) return pid @@ -3105,6 +3633,9 @@ func XGetCurrentProcessId(t *TLS) uint32 { // // ); func XGetDiskFreeSpaceA(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpTotalNumberOfClusters=%v, (%v:)", t, lpTotalNumberOfClusters, origin(2)) + } panic(todo("")) } @@ -3118,6 +3649,9 @@ func XGetDiskFreeSpaceA(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerS // // ); func XGetDiskFreeSpaceW(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpTotalNumberOfClusters=%v, (%v:)", t, lpTotalNumberOfClusters, origin(2)) + } panic(todo("")) } @@ -3127,6 +3661,9 @@ func XGetDiskFreeSpaceW(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerS // // ); func XGetFileAttributesA(t *TLS, lpFileName uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2)) + } r0, _, err := syscall.Syscall(procGetFileAttributesA.Addr(), 1, lpFileName, 0, 0) if err != 0 { t.setErrno(err) @@ -3142,6 +3679,9 @@ func XGetFileAttributesA(t *TLS, lpFileName uintptr) uint32 { // // ); func XGetFileAttributesExW(t *TLS, lpFileName uintptr, fInfoLevelId uint32, lpFileInformation uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v fInfoLevelId=%v lpFileInformation=%v, (%v:)", t, lpFileName, fInfoLevelId, lpFileInformation, origin(2)) + } r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, lpFileName, uintptr(fInfoLevelId), lpFileInformation) if r1 == 0 { if e1 != 0 { @@ -3161,6 +3701,9 @@ func XGetFileAttributesExW(t *TLS, lpFileName uintptr, fInfoLevelId uint32, lpFi // // ); func XGetFileSize(t *TLS, hFile, lpFileSizeHigh uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpFileSizeHigh=%v, (%v:)", t, lpFileSizeHigh, origin(2)) + } r1, _, e1 := syscall.Syscall(procGetFileSize.Addr(), 2, hFile, lpFileSizeHigh, 0) if r1 == math.MaxUint32 { if lpFileSizeHigh == 0 { @@ -3188,11 +3731,17 @@ func XGetFileSize(t *TLS, hFile, lpFileSizeHigh uintptr) uint32 { // // ); func XGetFullPathNameA(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffer, lpFilePart uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v nBufferLength=%v lpFilePart=%v, (%v:)", t, lpFileName, nBufferLength, lpFilePart, origin(2)) + } panic(todo("")) } // FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName); func XGetProcAddress(t *TLS, hModule, lpProcName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpProcName=%v, (%v:)", t, lpProcName, origin(2)) + } return 0 @@ -3211,6 +3760,9 @@ func XGetProcAddress(t *TLS, hModule, lpProcName uintptr) uintptr { // // ); func XRtlGetVersion(t *TLS, lpVersionInformation uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpVersionInformation=%v, (%v:)", t, lpVersionInformation, origin(2)) + } panic(todo("")) } @@ -3220,11 +3772,17 @@ func XRtlGetVersion(t *TLS, lpVersionInformation uintptr) uintptr { // // ); func XGetSystemInfo(t *TLS, lpSystemInfo uintptr) { + if __ccgo_strace { + trc("t=%v lpSystemInfo=%v, (%v:)", t, lpSystemInfo, origin(2)) + } syscall.Syscall(procGetSystemInfo.Addr(), 1, lpSystemInfo, 0, 0) } // void GetSystemTime(LPSYSTEMTIME lpSystemTime); func XGetSystemTime(t *TLS, lpSystemTime uintptr) { + if __ccgo_strace { + trc("t=%v lpSystemTime=%v, (%v:)", t, lpSystemTime, origin(2)) + } syscall.Syscall(procGetSystemTime.Addr(), 1, lpSystemTime, 0, 0) } @@ -3234,6 +3792,9 @@ func XGetSystemTime(t *TLS, lpSystemTime uintptr) { // // ); func XGetSystemTimeAsFileTime(t *TLS, lpSystemTimeAsFileTime uintptr) { + if __ccgo_strace { + trc("t=%v lpSystemTimeAsFileTime=%v, (%v:)", t, lpSystemTimeAsFileTime, origin(2)) + } syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, lpSystemTimeAsFileTime, 0, 0) } @@ -3244,6 +3805,9 @@ func XGetSystemTimeAsFileTime(t *TLS, lpSystemTimeAsFileTime uintptr) { // // ); func XGetTempPathA(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 { + if __ccgo_strace { + trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2)) + } panic(todo("")) } @@ -3254,6 +3818,9 @@ func XGetTempPathA(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 { // // ); func XGetTempPathW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 { + if __ccgo_strace { + trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2)) + } rv, err := syscall.GetTempPath(nBufferLength, (*uint16)(unsafe.Pointer(lpBuffer))) if err != nil { t.setErrno(err) @@ -3263,6 +3830,9 @@ func XGetTempPathW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 { // DWORD GetTickCount(); func XGetTickCount(t *TLS) uint32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, _ := syscall.Syscall(procGetTickCount.Addr(), 0, 0, 0, 0) return uint32(r0) } @@ -3273,6 +3843,9 @@ func XGetTickCount(t *TLS) uint32 { // // ); func XGetVersionExA(t *TLS, lpVersionInformation uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpVersionInformation=%v, (%v:)", t, lpVersionInformation, origin(2)) + } r0, _, err := syscall.Syscall(procGetVersionExA.Addr(), 1, lpVersionInformation, 0, 0) if r0 == 0 { t.setErrno(err) @@ -3288,6 +3861,9 @@ func XGetVersionExA(t *TLS, lpVersionInformation uintptr) int32 { // // ); func XHeapCreate(t *TLS, flOptions uint32, dwInitialSize, dwMaximumSize types.Size_t) uintptr { + if __ccgo_strace { + trc("t=%v flOptions=%v dwMaximumSize=%v, (%v:)", t, flOptions, dwMaximumSize, origin(2)) + } panic(todo("")) } @@ -3297,6 +3873,9 @@ func XHeapCreate(t *TLS, flOptions uint32, dwInitialSize, dwMaximumSize types.Si // // ); func XHeapDestroy(t *TLS, hHeap uintptr) int32 { + if __ccgo_strace { + trc("t=%v hHeap=%v, (%v:)", t, hHeap, origin(2)) + } panic(todo("")) } @@ -3309,6 +3888,9 @@ func XHeapDestroy(t *TLS, hHeap uintptr) int32 { // // ); func XHeapReAlloc(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr, dwBytes types.Size_t) uintptr { + if __ccgo_strace { + trc("t=%v hHeap=%v dwFlags=%v lpMem=%v dwBytes=%v, (%v:)", t, hHeap, dwFlags, lpMem, dwBytes, origin(2)) + } panic(todo("")) } @@ -3320,6 +3902,9 @@ func XHeapReAlloc(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr, dwBytes // // ); func XHeapSize(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) types.Size_t { + if __ccgo_strace { + trc("t=%v hHeap=%v dwFlags=%v lpMem=%v, (%v:)", t, hHeap, dwFlags, lpMem, origin(2)) + } panic(todo("")) } @@ -3331,6 +3916,9 @@ func XHeapSize(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) types.Size_ // // ); func XHeapValidate(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 { + if __ccgo_strace { + trc("t=%v hHeap=%v dwFlags=%v lpMem=%v, (%v:)", t, hHeap, dwFlags, lpMem, origin(2)) + } panic(todo("")) } @@ -3341,11 +3929,17 @@ func XHeapValidate(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 { // // ); func XHeapCompact(t *TLS, hHeap uintptr, dwFlags uint32) types.Size_t { + if __ccgo_strace { + trc("t=%v hHeap=%v dwFlags=%v, (%v:)", t, hHeap, dwFlags, origin(2)) + } panic(todo("")) } // HMODULE LoadLibraryA(LPCSTR lpLibFileName); func XLoadLibraryA(t *TLS, lpLibFileName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpLibFileName=%v, (%v:)", t, lpLibFileName, origin(2)) + } panic(todo("")) } @@ -3355,6 +3949,9 @@ func XLoadLibraryA(t *TLS, lpLibFileName uintptr) uintptr { // // ); func XLoadLibraryW(t *TLS, lpLibFileName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpLibFileName=%v, (%v:)", t, lpLibFileName, origin(2)) + } panic(todo("")) } @@ -3364,6 +3961,9 @@ func XLoadLibraryW(t *TLS, lpLibFileName uintptr) uintptr { // // ); func XLocalFree(t *TLS, hMem uintptr) uintptr { + if __ccgo_strace { + trc("t=%v hMem=%v, (%v:)", t, hMem, origin(2)) + } h, err := syscall.LocalFree(syscall.Handle(hMem)) if h != 0 { if err != nil { @@ -3386,6 +3986,9 @@ func XLocalFree(t *TLS, hMem uintptr) uintptr { // // ); func XLockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh uint32) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v nNumberOfBytesToLockHigh=%v, (%v:)", t, hFile, nNumberOfBytesToLockHigh, origin(2)) + } r1, _, e1 := syscall.Syscall6(procLockFile.Addr(), 5, hFile, uintptr(dwFileOffsetLow), uintptr(dwFileOffsetHigh), uintptr(nNumberOfBytesToLockLow), uintptr(nNumberOfBytesToLockHigh), 0) @@ -3412,6 +4015,9 @@ func XLockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumber // // ); func XLockFileEx(t *TLS, hFile uintptr, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh uint32, lpOverlapped uintptr) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v nNumberOfBytesToLockHigh=%v lpOverlapped=%v, (%v:)", t, hFile, nNumberOfBytesToLockHigh, lpOverlapped, origin(2)) + } r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, hFile, uintptr(dwFlags), uintptr(dwReserved), uintptr(nNumberOfBytesToLockLow), uintptr(nNumberOfBytesToLockHigh), lpOverlapped) if r1 == 0 { @@ -3435,6 +4041,9 @@ func XLockFileEx(t *TLS, hFile uintptr, dwFlags, dwReserved, nNumberOfBytesToLoc // // ); func XMapViewOfFile(t *TLS, hFileMappingObject uintptr, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow uint32, dwNumberOfBytesToMap types.Size_t) uintptr { + if __ccgo_strace { + trc("t=%v hFileMappingObject=%v dwFileOffsetLow=%v dwNumberOfBytesToMap=%v, (%v:)", t, hFileMappingObject, dwFileOffsetLow, dwNumberOfBytesToMap, origin(2)) + } h, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, hFileMappingObject, uintptr(dwDesiredAccess), uintptr(dwFileOffsetHigh), uintptr(dwFileOffsetLow), uintptr(dwNumberOfBytesToMap), 0) if h == 0 { @@ -3453,6 +4062,9 @@ func XMapViewOfFile(t *TLS, hFileMappingObject uintptr, dwDesiredAccess, dwFileO // // ); func XQueryPerformanceCounter(t *TLS, lpPerformanceCount uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpPerformanceCount=%v, (%v:)", t, lpPerformanceCount, origin(2)) + } r0, _, _ := syscall.Syscall(procQueryPerformanceCounter.Addr(), 1, lpPerformanceCount, 0, 0) return int32(r0) } @@ -3463,11 +4075,17 @@ func XQueryPerformanceCounter(t *TLS, lpPerformanceCount uintptr) int32 { // // ); func XSleep(t *TLS, dwMilliseconds uint32) { + if __ccgo_strace { + trc("t=%v dwMilliseconds=%v, (%v:)", t, dwMilliseconds, origin(2)) + } gotime.Sleep(gotime.Duration(dwMilliseconds) * gotime.Millisecond) } // BOOL SystemTimeToFileTime(const SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime); func XSystemTimeToFileTime(t *TLS, lpSystemTime, lpFileTime uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileTime=%v, (%v:)", t, lpFileTime, origin(2)) + } r0, _, _ := syscall.Syscall(procSystemTimeToFileTime.Addr(), 2, lpSystemTime, lpFileTime, 0) return int32(r0) } @@ -3482,6 +4100,9 @@ func XSystemTimeToFileTime(t *TLS, lpSystemTime, lpFileTime uintptr) int32 { // // ); func XUnlockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh uint32) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v nNumberOfBytesToUnlockHigh=%v, (%v:)", t, hFile, nNumberOfBytesToUnlockHigh, origin(2)) + } r1, _, e1 := syscall.Syscall6(procUnlockFile.Addr(), 5, hFile, uintptr(dwFileOffsetLow), uintptr(dwFileOffsetHigh), uintptr(nNumberOfBytesToUnlockLow), uintptr(nNumberOfBytesToUnlockHigh), 0) if r1 == 0 { @@ -3505,6 +4126,9 @@ func XUnlockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumb // // ); func XUnlockFileEx(t *TLS, hFile uintptr, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh uint32, lpOverlapped uintptr) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v nNumberOfBytesToUnlockHigh=%v lpOverlapped=%v, (%v:)", t, hFile, nNumberOfBytesToUnlockHigh, lpOverlapped, origin(2)) + } r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, hFile, uintptr(dwReserved), uintptr(nNumberOfBytesToUnlockLow), uintptr(nNumberOfBytesToUnlockHigh), lpOverlapped, 0) if r1 == 0 { @@ -3524,6 +4148,9 @@ func XUnlockFileEx(t *TLS, hFile uintptr, dwReserved, nNumberOfBytesToUnlockLow, // // ); func XUnmapViewOfFile(t *TLS, lpBaseAddress uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBaseAddress=%v, (%v:)", t, lpBaseAddress, origin(2)) + } err := syscall.UnmapViewOfFile(lpBaseAddress) if err != nil { t.setErrno(err) @@ -3545,6 +4172,9 @@ func XUnmapViewOfFile(t *TLS, lpBaseAddress uintptr) int32 { // // ); func XWideCharToMultiByte(t *TLS, CodePage uint32, dwFlags uint32, lpWideCharStr uintptr, cchWideChar int32, lpMultiByteStr uintptr, cbMultiByte int32, lpDefaultChar, lpUsedDefaultChar uintptr) int32 { + if __ccgo_strace { + trc("t=%v CodePage=%v dwFlags=%v lpWideCharStr=%v cchWideChar=%v lpMultiByteStr=%v cbMultiByte=%v lpUsedDefaultChar=%v, (%v:)", t, CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpUsedDefaultChar, origin(2)) + } r1, _, _ := syscall.Syscall9(procWideCharToMultiByte.Addr(), 8, uintptr(CodePage), uintptr(dwFlags), lpWideCharStr, uintptr(cchWideChar), lpMultiByteStr, uintptr(cbMultiByte), @@ -3558,6 +4188,9 @@ func XWideCharToMultiByte(t *TLS, CodePage uint32, dwFlags uint32, lpWideCharStr // // ) func XOutputDebugStringA(t *TLS, lpOutputString uintptr) { + if __ccgo_strace { + trc("t=%v lpOutputString=%v, (%v:)", t, lpOutputString, origin(2)) + } panic(todo("")) } @@ -3568,6 +4201,9 @@ func XOutputDebugStringA(t *TLS, lpOutputString uintptr) { // // ); func XFlushViewOfFile(t *TLS, lpBaseAddress uintptr, dwNumberOfBytesToFlush types.Size_t) int32 { + if __ccgo_strace { + trc("t=%v lpBaseAddress=%v dwNumberOfBytesToFlush=%v, (%v:)", t, lpBaseAddress, dwNumberOfBytesToFlush, origin(2)) + } err := syscall.FlushViewOfFile(lpBaseAddress, uintptr(dwNumberOfBytesToFlush)) if err != nil { t.setErrno(err) @@ -3605,6 +4241,9 @@ func WindowsTickToUnixSeconds(windowsTicks int64) int64 { // int _stat64(const char *path, struct __stat64 *buffer); func X_stat64(t *TLS, path, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v buffer=%v, (%v:)", t, buffer, origin(2)) + } var fa syscall.Win32FileAttributeData r1, _, e1 := syscall.Syscall(procGetFileAttributesExA.Addr(), 3, path, syscall.GetFileExInfoStandard, (uintptr)(unsafe.Pointer(&fa))) @@ -3658,6 +4297,9 @@ func WindowsAttrbiutesToStat(fa uint32) uint16 { // // ); func X_chsize(t *TLS, fd int32, size long) int32 { + if __ccgo_strace { + trc("t=%v fd=%v size=%v, (%v:)", t, fd, size, origin(2)) + } f, ok := fdToFile(fd) if !ok { @@ -3676,6 +4318,9 @@ func X_chsize(t *TLS, fd int32, size long) int32 { // int _snprintf(char *str, size_t size, const char *format, ...); func X_snprintf(t *TLS, str uintptr, size types.Size_t, format, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v str=%v size=%v args=%v, (%v:)", t, str, size, args, origin(2)) + } return Xsnprintf(t, str, size, format, args) } @@ -3711,6 +4356,9 @@ func win32FindDataToFileInfo(t *TLS, fdata *stat.X_finddata64i32_t, wfd *syscall // // ); func X_findfirst64i32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t { + if __ccgo_strace { + trc("t=%v fileinfo=%v, (%v:)", t, fileinfo, origin(2)) + } // Note: this is the 'narrow' character findfirst -- expects output // as mbcs -- conversion below -- via ToFileInfo @@ -3746,6 +4394,9 @@ func X_findfirst64i32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t { // // ); func X_findnext64i32(t *TLS, handle types.Intptr_t, fileinfo uintptr) int32 { + if __ccgo_strace { + trc("t=%v handle=%v fileinfo=%v, (%v:)", t, handle, fileinfo, origin(2)) + } var fdata = (*stat.X_finddata64i32_t)(unsafe.Pointer(fileinfo)) var wfd syscall.Win32finddata @@ -3769,6 +4420,9 @@ func X_findnext64i32(t *TLS, handle types.Intptr_t, fileinfo uintptr) int32 { // // ); func X_findclose(t *TLS, handle types.Intptr_t) int32 { + if __ccgo_strace { + trc("t=%v handle=%v, (%v:)", t, handle, origin(2)) + } err := syscall.FindClose(syscall.Handle(handle)) if err != nil { @@ -3786,6 +4440,9 @@ func X_findclose(t *TLS, handle types.Intptr_t) int32 { // // ); func XGetEnvironmentVariableA(t *TLS, lpName, lpBuffer uintptr, nSize uint32) uint32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nSize=%v, (%v:)", t, lpBuffer, nSize, origin(2)) + } r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableA.Addr(), 3, lpName, lpBuffer, uintptr(nSize)) n := uint32(r0) if n == 0 { @@ -3805,6 +4462,9 @@ func XGetEnvironmentVariableA(t *TLS, lpName, lpBuffer uintptr, nSize uint32) ui // // ); func X_fstat64(t *TLS, fd int32, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2)) + } f, ok := fdToFile(fd) if !ok { @@ -3842,6 +4502,9 @@ func X_fstat64(t *TLS, fd int32, buffer uintptr) int32 { // // ); func XCreateEventA(t *TLS, lpEventAttributes uintptr, bManualReset, bInitialState int32, lpName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpEventAttributes=%v bInitialState=%v lpName=%v, (%v:)", t, lpEventAttributes, bInitialState, lpName, origin(2)) + } r0, _, err := syscall.Syscall6(procCreateEventA.Addr(), 4, lpEventAttributes, uintptr(bManualReset), uintptr(bInitialState), lpName, 0, 0) if r0 == 0 { @@ -3856,6 +4519,9 @@ func XCreateEventA(t *TLS, lpEventAttributes uintptr, bManualReset, bInitialStat // // ); func XCancelSynchronousIo(t *TLS, hThread uintptr) int32 { + if __ccgo_strace { + trc("t=%v hThread=%v, (%v:)", t, hThread, origin(2)) + } panic(todo("")) } @@ -3868,6 +4534,9 @@ func X_endthreadex(t *TLS, _ ...interface{}) { // and gets that via the go callback. This is safe because the thread is calling into go // not a cdecl function which would expect the stack setup of cdecl. func X_beginthread(t *TLS, procAddr uintptr, stack_sz uint32, args uintptr) int32 { + if __ccgo_strace { + trc("t=%v procAddr=%v stack_sz=%v args=%v, (%v:)", t, procAddr, stack_sz, args, origin(2)) + } f := (*struct{ f func(*TLS, uintptr) uint32 })(unsafe.Pointer(&struct{ uintptr }{procAddr})).f var tAdp = ThreadAdapter{threadFunc: f, tls: NewTLS(), param: args} tAdp.token = addObject(&tAdp) @@ -3905,6 +4574,9 @@ func X_beginthreadex(t *TLS, _ uintptr, stack_sz uint32, procAddr uintptr, args // DWORD GetCurrentThreadId(); func XGetCurrentThreadId(t *TLS) uint32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) return uint32(r0) //return uint32(t.ID) @@ -3917,6 +4589,9 @@ func XGetCurrentThreadId(t *TLS) uint32 { // // ); func XGetExitCodeThread(t *TLS, hThread, lpExitCode uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpExitCode=%v, (%v:)", t, lpExitCode, origin(2)) + } r0, _, _ := syscall.Syscall(procGetExitCodeThread.Addr(), 2, hThread, lpExitCode, 0) return int32(r0) } @@ -3929,6 +4604,9 @@ func XGetExitCodeThread(t *TLS, hThread, lpExitCode uintptr) int32 { // // ); func XWaitForSingleObjectEx(t *TLS, hHandle uintptr, dwMilliseconds uint32, bAlertable int32) uint32 { + if __ccgo_strace { + trc("t=%v hHandle=%v dwMilliseconds=%v bAlertable=%v, (%v:)", t, hHandle, dwMilliseconds, bAlertable, origin(2)) + } rv, _, _ := syscall.Syscall(procWaitForSingleObjectEx.Addr(), 3, hHandle, uintptr(dwMilliseconds), uintptr(bAlertable)) return uint32(rv) } @@ -3943,6 +4621,9 @@ func XWaitForSingleObjectEx(t *TLS, hHandle uintptr, dwMilliseconds uint32, bAle // // ); func XMsgWaitForMultipleObjectsEx(t *TLS, nCount uint32, pHandles uintptr, dwMilliseconds, dwWakeMask, dwFlags uint32) uint32 { + if __ccgo_strace { + trc("t=%v nCount=%v pHandles=%v dwFlags=%v, (%v:)", t, nCount, pHandles, dwFlags, origin(2)) + } r0, _, err := syscall.Syscall6(procMsgWaitForMultipleObjectsEx.Addr(), 5, uintptr(nCount), pHandles, @@ -3969,6 +4650,9 @@ func XMessageBoxW(t *TLS, _ ...interface{}) int32 { // // ); func XGetModuleFileNameW(t *TLS, hModule, lpFileName uintptr, nSize uint32) uint32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v nSize=%v, (%v:)", t, lpFileName, nSize, origin(2)) + } r0, _, err := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, hModule, lpFileName, uintptr(nSize)) if r0 == 0 { t.setErrno(err) @@ -3984,6 +4668,9 @@ func XGetModuleFileNameW(t *TLS, hModule, lpFileName uintptr, nSize uint32) uint // // ); func XNetGetDCName(t *TLS, ServerName, DomainName, Buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v Buffer=%v, (%v:)", t, Buffer, origin(2)) + } r0, _, err := syscall.Syscall(procNetGetDCName.Addr(), 3, ServerName, DomainName, Buffer) if err != 0 { t.setErrno(err) @@ -4000,6 +4687,9 @@ func XNetGetDCName(t *TLS, ServerName, DomainName, Buffer uintptr) int32 { // // ); func XNetUserGetInfo(t *TLS, servername, username uintptr, level uint32, bufptr uintptr) uint32 { + if __ccgo_strace { + trc("t=%v username=%v level=%v bufptr=%v, (%v:)", t, username, level, bufptr, origin(2)) + } r0, _, err := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, servername, username, @@ -4025,6 +4715,9 @@ func XlstrlenW(t *TLS, _ ...interface{}) int32 { // // ); func XGetProfilesDirectoryW(t *TLS, lpProfileDir, lpcchSize uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpcchSize=%v, (%v:)", t, lpcchSize, origin(2)) + } r0, _, err := syscall.Syscall(procGetProfilesDirectoryW.Addr(), 2, lpProfileDir, lpcchSize, 0) if err != 0 { t.setErrno(err) @@ -4047,6 +4740,9 @@ func XNetApiBufferFree(t *TLS, _ ...interface{}) int32 { // // ); func XGetPrivateProfileStringA(t *TLS, lpAppName, lpKeyName, lpDefault, lpReturnedString uintptr, nSize uint32, lpFileName uintptr) uint32 { + if __ccgo_strace { + trc("t=%v lpReturnedString=%v nSize=%v lpFileName=%v, (%v:)", t, lpReturnedString, nSize, lpFileName, origin(2)) + } r0, _, err := syscall.Syscall6(procGetPrivateProfileStringA.Addr(), 4, lpAppName, lpKeyName, @@ -4075,6 +4771,9 @@ func XGetWindowsDirectoryA(t *TLS, _ ...interface{}) int32 { // // ); func XGetFileSecurityW(t *TLS, lpFileName uintptr, RequestedInformation uint32, pSecurityDescriptor uintptr, nLength uint32, lpnLengthNeeded uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v RequestedInformation=%v pSecurityDescriptor=%v nLength=%v lpnLengthNeeded=%v, (%v:)", t, lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded, origin(2)) + } r0, _, err := syscall.Syscall6(procGetFileSecurityW.Addr(), 5, lpFileName, uintptr(RequestedInformation), pSecurityDescriptor, uintptr(nLength), lpnLengthNeeded, 0) if err != 0 { t.setErrno(err) @@ -4090,6 +4789,9 @@ func XGetFileSecurityW(t *TLS, lpFileName uintptr, RequestedInformation uint32, // // ); func XGetSecurityDescriptorOwner(t *TLS, pSecurityDescriptor, pOwner, lpbOwnerDefaulted uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpbOwnerDefaulted=%v, (%v:)", t, lpbOwnerDefaulted, origin(2)) + } r0, _, err := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, pSecurityDescriptor, pOwner, lpbOwnerDefaulted) if err != 0 { t.setErrno(err) @@ -4104,6 +4806,9 @@ func XGetSecurityDescriptorOwner(t *TLS, pSecurityDescriptor, pOwner, lpbOwnerDe // // ); func XGetSidIdentifierAuthority(t *TLS, pSid uintptr) uintptr { + if __ccgo_strace { + trc("t=%v pSid=%v, (%v:)", t, pSid, origin(2)) + } r0, _, err := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, pSid, 0, 0) if err != 0 { t.setErrno(err) @@ -4117,6 +4822,9 @@ func XGetSidIdentifierAuthority(t *TLS, pSid uintptr) uintptr { // // ); func XImpersonateSelf(t *TLS, ImpersonationLevel int32) int32 { + if __ccgo_strace { + trc("t=%v ImpersonationLevel=%v, (%v:)", t, ImpersonationLevel, origin(2)) + } r0, _, err := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(ImpersonationLevel), 0, 0) if err != 0 { t.setErrno(err) @@ -4133,6 +4841,9 @@ func XImpersonateSelf(t *TLS, ImpersonationLevel int32) int32 { // // ); func XOpenThreadToken(t *TLS, ThreadHandle uintptr, DesiredAccess uint32, OpenAsSelf int32, TokenHandle uintptr) int32 { + if __ccgo_strace { + trc("t=%v ThreadHandle=%v DesiredAccess=%v OpenAsSelf=%v TokenHandle=%v, (%v:)", t, ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle, origin(2)) + } r0, _, err := syscall.Syscall6(procOpenThreadToken.Addr(), 4, ThreadHandle, uintptr(DesiredAccess), uintptr(OpenAsSelf), TokenHandle, 0, 0) if err != 0 { t.setErrno(err) @@ -4142,6 +4853,9 @@ func XOpenThreadToken(t *TLS, ThreadHandle uintptr, DesiredAccess uint32, OpenAs // HANDLE GetCurrentThread(); func XGetCurrentThread(t *TLS) uintptr { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, err := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0) if err != 0 { t.setErrno(err) @@ -4151,6 +4865,9 @@ func XGetCurrentThread(t *TLS) uintptr { // BOOL RevertToSelf(); func XRevertToSelf(t *TLS) int32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, err := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) if err != 0 { t.setErrno(err) @@ -4171,6 +4888,9 @@ func XRevertToSelf(t *TLS) int32 { // // ); func XAccessCheck(t *TLS, pSecurityDescriptor, ClientToken uintptr, DesiredAccess uint32, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus uintptr) int32 { + if __ccgo_strace { + trc("t=%v ClientToken=%v DesiredAccess=%v AccessStatus=%v, (%v:)", t, ClientToken, DesiredAccess, AccessStatus, origin(2)) + } r0, _, err := syscall.Syscall9(procAccessCheck.Addr(), 8, pSecurityDescriptor, ClientToken, @@ -4195,6 +4915,9 @@ func XAccessCheck(t *TLS, pSecurityDescriptor, ClientToken uintptr, DesiredAcces // // ); func Xwcsicmp(t *TLS, string1, string2 uintptr) int32 { + if __ccgo_strace { + trc("t=%v string2=%v, (%v:)", t, string2, origin(2)) + } var s1 = strings.ToLower(goWideString(string1)) var s2 = strings.ToLower(goWideString(string2)) return int32(strings.Compare(s1, s2)) @@ -4206,6 +4929,9 @@ func Xwcsicmp(t *TLS, string1, string2 uintptr) int32 { // // ); func XSetCurrentDirectoryW(t *TLS, lpPathName uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpPathName=%v, (%v:)", t, lpPathName, origin(2)) + } err := syscall.SetCurrentDirectory((*uint16)(unsafe.Pointer(lpPathName))) if err != nil { t.setErrno(err) @@ -4221,6 +4947,9 @@ func XSetCurrentDirectoryW(t *TLS, lpPathName uintptr) int32 { // // ); func XGetCurrentDirectoryW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 { + if __ccgo_strace { + trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2)) + } n, err := syscall.GetCurrentDirectory(nBufferLength, (*uint16)(unsafe.Pointer(lpBuffer))) if err != nil { t.setErrno(err) @@ -4235,6 +4964,9 @@ func XGetCurrentDirectoryW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint3 // // ); func XGetFileInformationByHandle(t *TLS, hFile, lpFileInformation uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileInformation=%v, (%v:)", t, lpFileInformation, origin(2)) + } r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, hFile, lpFileInformation, 0) if r1 == 0 { if e1 != 0 { @@ -4259,6 +4991,9 @@ func XGetFileInformationByHandle(t *TLS, hFile, lpFileInformation uintptr) int32 // // ); func XGetVolumeInformationW(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr, nVolumeNameSize uint32, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer uintptr, nFileSystemNameSize uint32) int32 { + if __ccgo_strace { + trc("t=%v lpVolumeNameBuffer=%v nVolumeNameSize=%v lpFileSystemNameBuffer=%v nFileSystemNameSize=%v, (%v:)", t, lpVolumeNameBuffer, nVolumeNameSize, lpFileSystemNameBuffer, nFileSystemNameSize, origin(2)) + } r0, _, err := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, lpRootPathName, lpVolumeNameBuffer, @@ -4283,6 +5018,9 @@ func XGetVolumeInformationW(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr, // // ); func Xwcschr(t *TLS, str uintptr, c wchar_t) uintptr { + if __ccgo_strace { + trc("t=%v str=%v c=%v, (%v:)", t, str, c, origin(2)) + } var source = str for { var buf = *(*uint16)(unsafe.Pointer(source)) @@ -4307,6 +5045,9 @@ func Xwcschr(t *TLS, str uintptr, c wchar_t) uintptr { // // ); func XSetFileTime(t *TLS, hFile uintptr, lpCreationTime, lpLastAccessTime, lpLastWriteTime uintptr) int32 { + if __ccgo_strace { + trc("t=%v hFile=%v lpLastWriteTime=%v, (%v:)", t, hFile, lpLastWriteTime, origin(2)) + } panic(todo("")) } @@ -4323,6 +5064,9 @@ func XSetFileTime(t *TLS, hFile uintptr, lpCreationTime, lpLastAccessTime, lpLas // // ); func XGetNamedSecurityInfoW(t *TLS, pObjectName uintptr, ObjectType, SecurityInfo uint32, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor uintptr) uint32 { + if __ccgo_strace { + trc("t=%v pObjectName=%v SecurityInfo=%v ppSecurityDescriptor=%v, (%v:)", t, pObjectName, SecurityInfo, ppSecurityDescriptor, origin(2)) + } panic(todo("")) } @@ -4334,6 +5078,9 @@ func XGetNamedSecurityInfoW(t *TLS, pObjectName uintptr, ObjectType, SecurityInf // // ); func XOpenProcessToken(t *TLS, ProcessHandle uintptr, DesiredAccess uint32, TokenHandle uintptr) int32 { + if __ccgo_strace { + trc("t=%v ProcessHandle=%v DesiredAccess=%v TokenHandle=%v, (%v:)", t, ProcessHandle, DesiredAccess, TokenHandle, origin(2)) + } panic(todo("")) } @@ -4347,6 +5094,9 @@ func XOpenProcessToken(t *TLS, ProcessHandle uintptr, DesiredAccess uint32, Toke // // ); func XGetTokenInformation(t *TLS, TokenHandle uintptr, TokenInformationClass uint32, TokenInformation uintptr, TokenInformationLength uint32, ReturnLength uintptr) int32 { + if __ccgo_strace { + trc("t=%v TokenHandle=%v TokenInformationClass=%v TokenInformation=%v TokenInformationLength=%v ReturnLength=%v, (%v:)", t, TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength, origin(2)) + } panic(todo("")) } @@ -4357,6 +5107,9 @@ func XGetTokenInformation(t *TLS, TokenHandle uintptr, TokenInformationClass uin // // ); func XEqualSid(t *TLS, pSid1, pSid2 uintptr) int32 { + if __ccgo_strace { + trc("t=%v pSid2=%v, (%v:)", t, pSid2, origin(2)) + } panic(todo("")) } @@ -4367,6 +5120,9 @@ func XEqualSid(t *TLS, pSid1, pSid2 uintptr) int32 { // // ); func XWSAStartup(t *TLS, wVersionRequired uint16, lpWSAData uintptr) int32 { + if __ccgo_strace { + trc("t=%v wVersionRequired=%v lpWSAData=%v, (%v:)", t, wVersionRequired, lpWSAData, origin(2)) + } r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(wVersionRequired), lpWSAData, 0) if r0 != 0 { t.setErrno(r0) @@ -4376,6 +5132,9 @@ func XWSAStartup(t *TLS, wVersionRequired uint16, lpWSAData uintptr) int32 { // HMODULE GetModuleHandleA(LPCSTR lpModuleName); func XGetModuleHandleA(t *TLS, lpModuleName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpModuleName=%v, (%v:)", t, lpModuleName, origin(2)) + } r0, _, err := syscall.Syscall(procGetModuleHandleA.Addr(), 1, lpModuleName, 0, 0) if r0 == 0 { t.setErrno(err) @@ -4389,6 +5148,9 @@ func XGetModuleHandleA(t *TLS, lpModuleName uintptr) uintptr { // // ); func XGetModuleHandleW(t *TLS, lpModuleName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v lpModuleName=%v, (%v:)", t, lpModuleName, origin(2)) + } r0, _, err := syscall.Syscall(procGetModuleHandleW.Addr(), 1, lpModuleName, 0, 0) if r0 == 0 { t.setErrno(err) @@ -4404,6 +5166,9 @@ func XGetModuleHandleW(t *TLS, lpModuleName uintptr) uintptr { // // ); func XGetEnvironmentVariableW(t *TLS, lpName, lpBuffer uintptr, nSize uint32) uint32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nSize=%v, (%v:)", t, lpBuffer, nSize, origin(2)) + } r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, lpName, lpBuffer, uintptr(nSize)) n := uint32(r0) if n == 0 { @@ -4423,6 +5188,9 @@ func XGetEnvironmentVariableW(t *TLS, lpName, lpBuffer uintptr, nSize uint32) ui // // ); func XlstrcmpiA(t *TLS, lpString1, lpString2 uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpString2=%v, (%v:)", t, lpString2, origin(2)) + } var s1 = strings.ToLower(GoString(lpString1)) var s2 = strings.ToLower(GoString(lpString2)) return int32(strings.Compare(s1, s2)) @@ -4434,6 +5202,9 @@ func XGetModuleFileNameA(t *TLS, _ ...interface{}) int32 { // UINT GetACP(); func XGetACP(t *TLS) uint32 { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) return uint32(r0) } @@ -4445,6 +5216,9 @@ func XGetACP(t *TLS) uint32 { // // ); func XGetUserNameW(t *TLS, lpBuffer, pcbBuffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v pcbBuffer=%v, (%v:)", t, pcbBuffer, origin(2)) + } u, err := user.Current() if err != nil { panic(todo("")) @@ -4473,6 +5247,9 @@ func XGetUserNameW(t *TLS, lpBuffer, pcbBuffer uintptr) int32 { // // ); func XLoadLibraryExW(t *TLS, lpLibFileName, hFile uintptr, dwFlags uint32) uintptr { + if __ccgo_strace { + trc("t=%v hFile=%v dwFlags=%v, (%v:)", t, hFile, dwFlags, origin(2)) + } return 0 // If the function fails, the return value is NULL. } @@ -4483,6 +5260,9 @@ func XLoadLibraryExW(t *TLS, lpLibFileName, hFile uintptr, dwFlags uint32) uintp // // ); func Xwcscpy(t *TLS, strDestination, strSource uintptr) uintptr { + if __ccgo_strace { + trc("t=%v strSource=%v, (%v:)", t, strSource, origin(2)) + } if strSource == 0 { return 0 } @@ -4509,6 +5289,9 @@ func XwsprintfW(t *TLS, _ ...interface{}) int32 { // // ); func XRegisterClassW(t *TLS, lpWndClass uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpWndClass=%v, (%v:)", t, lpWndClass, origin(2)) + } r0, _, err := syscall.Syscall(procRegisterClassW.Addr(), 1, lpWndClass, 0, 0) if r0 == 0 { t.setErrno(err) @@ -4531,6 +5314,9 @@ func XDestroyWindow(t *TLS, _ ...interface{}) int32 { // // ); func XUnregisterClassW(t *TLS, lpClassName, hInstance uintptr) int32 { + if __ccgo_strace { + trc("t=%v hInstance=%v, (%v:)", t, hInstance, origin(2)) + } r0, _, err := syscall.Syscall(procUnregisterClassW.Addr(), 2, lpClassName, hInstance, 0) if r0 == 0 { t.setErrno(err) @@ -4563,6 +5349,9 @@ func XSetTimer(t *TLS, _ ...interface{}) int32 { // // ); func XCreateWindowExW(t *TLS, dwExStyle uint32, lpClassName, lpWindowName uintptr, dwStyle uint32, x, y, nWidth, nHeight int32, hWndParent, hMenu, hInstance, lpParam uintptr) uintptr { + if __ccgo_strace { + trc("t=%v dwExStyle=%v lpWindowName=%v dwStyle=%v nHeight=%v lpParam=%v, (%v:)", t, dwExStyle, lpWindowName, dwStyle, nHeight, lpParam, origin(2)) + } r0, _, err := syscall.Syscall12(procCreateWindowExW.Addr(), 12, uintptr(dwExStyle), lpClassName, @@ -4593,6 +5382,9 @@ func XCreateWindowExW(t *TLS, dwExStyle uint32, lpClassName, lpWindowName uintpt // // ); func XPeekMessageW(t *TLS, lpMsg, hWnd uintptr, wMsgFilterMin, wMsgFilterMax, wRemoveMsg uint32) int32 { + if __ccgo_strace { + trc("t=%v hWnd=%v wRemoveMsg=%v, (%v:)", t, hWnd, wRemoveMsg, origin(2)) + } r0, _, err := syscall.Syscall6(procPeekMessageW.Addr(), 5, lpMsg, hWnd, @@ -4630,6 +5422,9 @@ func XDispatchMessageW(t *TLS, _ ...interface{}) int32 { // // ); func XSleepEx(t *TLS, dwMilliseconds uint32, bAlertable int32) uint32 { + if __ccgo_strace { + trc("t=%v dwMilliseconds=%v bAlertable=%v, (%v:)", t, dwMilliseconds, bAlertable, origin(2)) + } r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(dwMilliseconds), uintptr(bAlertable), 0) return uint32(r0) } @@ -4643,6 +5438,9 @@ func XSleepEx(t *TLS, dwMilliseconds uint32, bAlertable int32) uint32 { // // ); func XCreatePipe(t *TLS, hReadPipe, hWritePipe, lpPipeAttributes uintptr, nSize uint32) int32 { + if __ccgo_strace { + trc("t=%v lpPipeAttributes=%v nSize=%v, (%v:)", t, lpPipeAttributes, nSize, origin(2)) + } r0, _, err := syscall.Syscall6(procCreatePipe.Addr(), 4, hReadPipe, hWritePipe, lpPipeAttributes, uintptr(nSize), 0, 0) if r0 == 0 { t.setErrno(err) @@ -4687,6 +5485,9 @@ func XCreateProcessW(t *TLS, lpApplicationName, lpCommandLine, lpProcessAttribut // // ); func XWaitForInputIdle(t *TLS, hProcess uintptr, dwMilliseconds uint32) int32 { + if __ccgo_strace { + trc("t=%v hProcess=%v dwMilliseconds=%v, (%v:)", t, hProcess, dwMilliseconds, origin(2)) + } r0, _, _ := syscall.Syscall(procWaitForInputIdle.Addr(), 2, hProcess, uintptr(dwMilliseconds), 0) return int32(r0) } @@ -4702,6 +5503,9 @@ func XWaitForInputIdle(t *TLS, hProcess uintptr, dwMilliseconds uint32) int32 { // // ); func XSearchPathW(t *TLS, lpPath, lpFileName, lpExtension uintptr, nBufferLength uint32, lpBuffer, lpFilePart uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpExtension=%v nBufferLength=%v lpFilePart=%v, (%v:)", t, lpExtension, nBufferLength, lpFilePart, origin(2)) + } r0, _, err := syscall.Syscall6(procSearchPathW.Addr(), 6, lpPath, lpFileName, lpExtension, uintptr(nBufferLength), lpBuffer, lpFilePart) if r0 == 0 { t.setErrno(err) @@ -4720,6 +5524,9 @@ func XGetShortPathNameW(t *TLS, _ ...interface{}) int32 { // // ); func XGetExitCodeProcess(t *TLS, hProcess, lpExitCode uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpExitCode=%v, (%v:)", t, lpExitCode, origin(2)) + } r0, _, err := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, hProcess, lpExitCode, 0) if r0 == 0 { t.setErrno(err) @@ -4738,6 +5545,9 @@ func XGetExitCodeProcess(t *TLS, hProcess, lpExitCode uintptr) int32 { // // ); func XPeekNamedPipe(t *TLS, hNamedPipe, lpBuffer uintptr, nBufferSize uint32, lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpBuffer=%v nBufferSize=%v lpBytesLeftThisMessage=%v, (%v:)", t, lpBuffer, nBufferSize, lpBytesLeftThisMessage, origin(2)) + } r0, _, err := syscall.Syscall6(procPeekNamedPipe.Addr(), 6, hNamedPipe, lpBuffer, uintptr(nBufferSize), lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage) if r0 == 0 { t.setErrno(err) @@ -4752,6 +5562,9 @@ func XPeekNamedPipe(t *TLS, hNamedPipe, lpBuffer uintptr, nBufferSize uint32, lp // // ); func X_InterlockedExchange(t *TLS, Target uintptr, Value long) long { + if __ccgo_strace { + trc("t=%v Target=%v Value=%v, (%v:)", t, Target, Value, origin(2)) + } old := atomic.SwapInt32((*int32)(unsafe.Pointer(Target)), Value) return old } @@ -4763,6 +5576,9 @@ func X_InterlockedExchange(t *TLS, Target uintptr, Value long) long { // // ); func XTerminateThread(t *TLS, hThread uintptr, dwExitCode uint32) int32 { + if __ccgo_strace { + trc("t=%v hThread=%v dwExitCode=%v, (%v:)", t, hThread, dwExitCode, origin(2)) + } r0, _, err := syscall.Syscall(procTerminateThread.Addr(), 2, hThread, uintptr(dwExitCode), 0) if err != 0 { t.setErrno(err) @@ -4777,6 +5593,9 @@ func XTerminateThread(t *TLS, hThread uintptr, dwExitCode uint32) int32 { // // ); func XGetComputerNameW(t *TLS, lpBuffer, nSize uintptr) int32 { + if __ccgo_strace { + trc("t=%v nSize=%v, (%v:)", t, nSize, origin(2)) + } panic(todo("")) } @@ -4850,6 +5669,9 @@ func X_controlfp(t *TLS, _ ...interface{}) uint32 { // // ); func XQueryPerformanceFrequency(t *TLS, lpFrequency uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFrequency=%v, (%v:)", t, lpFrequency, origin(2)) + } r1, _, err := syscall.Syscall(procQueryPerformanceFrequency.Addr(), 1, lpFrequency, 0, 0) if r1 == 0 { @@ -4871,6 +5693,9 @@ func inDST(t gotime.Time) bool { // void _ftime( struct _timeb *timeptr ); func X_ftime(t *TLS, timeptr uintptr) { + if __ccgo_strace { + trc("t=%v timeptr=%v, (%v:)", t, timeptr, origin(2)) + } var tm = gotime.Now() var tPtr = (*time.X__timeb64)(unsafe.Pointer(timeptr)) tPtr.Ftime = tm.Unix() @@ -4882,10 +5707,6 @@ func X_ftime(t *TLS, timeptr uintptr) { tPtr.Ftimezone = int16(offset) } -func Xgmtime(t *TLS, _ ...interface{}) uintptr { - panic(todo("")) -} - func XDdeInitializeW(t *TLS, _ ...interface{}) uint32 { panic(todo("")) } @@ -4913,6 +5734,9 @@ func XDdeQueryStringW(t *TLS, _ ...interface{}) int32 { // // ); func X_wcsicmp(t *TLS, string1, string2 uintptr) int32 { + if __ccgo_strace { + trc("t=%v string2=%v, (%v:)", t, string2, origin(2)) + } return Xwcsicmp(t, string1, string2) } @@ -4981,6 +5805,9 @@ func XDdeGetLastError(t *TLS, _ ...interface{}) uint32 { // // ); func XDdeClientTransaction(t *TLS, pData uintptr, cbData uint32, hConv uintptr, hszItem uintptr, wFmt, wType, dwTimeout uint32, pdwResult uintptr) uintptr { + if __ccgo_strace { + trc("t=%v pData=%v cbData=%v hConv=%v hszItem=%v dwTimeout=%v pdwResult=%v, (%v:)", t, pData, cbData, hConv, hszItem, dwTimeout, pdwResult, origin(2)) + } panic(todo("")) } @@ -5049,39 +5876,66 @@ func XRegSetValueExW(t *TLS, _ ...interface{}) int32 { // // ); func X__mingw_vsnwprintf(t *TLS, buffer uintptr, count types.Size_t, format, va uintptr) int32 { + if __ccgo_strace { + trc("t=%v buffer=%v count=%v va=%v, (%v:)", t, buffer, count, va, origin(2)) + } panic(todo("")) } // int vprintf(const char *format, va_list ap); -func X__mingw_vprintf(t *TLS, s, ap uintptr) int32 { return Xvprintf(t, s, ap) } + +func X__mingw_vprintf(t *TLS, s, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } + return Xvprintf(t, s, ap) +} // int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg); func X__mingw_vfscanf(t *TLS, stream, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } panic(todo("")) } // int vsscanf(const char *str, const char *format, va_list ap); func X__mingw_vsscanf(t *TLS, str, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } return Xsscanf(t, str, format, ap) } // int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg); func X__mingw_vfprintf(t *TLS, f uintptr, format, va uintptr) int32 { + if __ccgo_strace { + trc("t=%v f=%v va=%v, (%v:)", t, f, va, origin(2)) + } return Xvfprintf(t, f, format, va) } // int vsprintf(char * restrict s, const char * restrict format, va_list arg); func X__mingw_vsprintf(t *TLS, s, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } return Xvsprintf(t, s, format, ap) } // int vsnprintf(char *str, size_t size, const char *format, va_list ap); func X__mingw_vsnprintf(t *TLS, str uintptr, size types.Size_t, format, ap uintptr) int32 { - panic(todo("")) + if __ccgo_strace { + trc("t=%v str=%v size=%v ap=%v, (%v:)", t, str, size, ap, origin(2)) + } + return Xvsnprintf(t, str, size, format, ap) } // int putchar(int char) func X_putchar(t *TLS, c int32) int32 { + if __ccgo_strace { + trc("t=%v c=%v, (%v:)", t, c, origin(2)) + } if _, err := fwrite(unistd.STDOUT_FILENO, []byte{byte(c)}); err != nil { return -1 } @@ -5090,21 +5944,33 @@ func X_putchar(t *TLS, c int32) int32 { // int vfwscanf(FILE *stream, const wchar_t *format, va_list argptr;); func X__mingw_vfwscanf(t *TLS, stream uintptr, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2)) + } panic(todo("")) } // int vswscanf(const wchar_t *buffer, const wchar_t *format, va_list arglist); func X__mingw_vswscanf(t *TLS, stream uintptr, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2)) + } panic(todo("")) } // int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg); func X__mingw_vfwprintf(t *TLS, stream, format, ap uintptr) int32 { + if __ccgo_strace { + trc("t=%v ap=%v, (%v:)", t, ap, origin(2)) + } panic(todo("")) } // int putchar(int c); func Xputchar(t *TLS, c int32) int32 { + if __ccgo_strace { + trc("t=%v c=%v, (%v:)", t, c, origin(2)) + } panic(todo("")) } @@ -5116,11 +5982,17 @@ func Xputchar(t *TLS, c int32) int32 { // // ); func X_assert(t *TLS, message, filename uintptr, line uint32) { + if __ccgo_strace { + trc("t=%v filename=%v line=%v, (%v:)", t, filename, line, origin(2)) + } panic(todo("")) } // char *strdup(const char *s); func X_strdup(t *TLS, s uintptr) uintptr { + if __ccgo_strace { + trc("t=%v s=%v, (%v:)", t, s, origin(2)) + } panic(todo("")) } @@ -5131,6 +6003,9 @@ func X_strdup(t *TLS, s uintptr) uintptr { // // ); func X_access(t *TLS, pathname uintptr, mode int32) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) + } var path = GoString(pathname) @@ -5177,6 +6052,9 @@ func X_access(t *TLS, pathname uintptr, mode int32) int32 { // // ); func XSetConsoleCtrlHandler(t *TLS, HandlerRoutine uintptr, Add int32) int32 { + if __ccgo_strace { + trc("t=%v HandlerRoutine=%v Add=%v, (%v:)", t, HandlerRoutine, Add, origin(2)) + } //var fcc = &struct { // f func(*TLS, uint32) int32 @@ -5198,11 +6076,17 @@ func XSetConsoleCtrlHandler(t *TLS, HandlerRoutine uintptr, Add int32) int32 { // DebugBreak func XDebugBreak(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } // int _isatty( int fd ); func X_isatty(t *TLS, fd int32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v, (%v:)", t, fd, origin(2)) + } f, ok := fdToFile(fd) if !ok { @@ -5233,6 +6117,9 @@ func X_isatty(t *TLS, fd int32) int32 { // // ); func XSetConsoleTextAttribute(t *TLS, hConsoleOutput uintptr, wAttributes uint16) int32 { + if __ccgo_strace { + trc("t=%v hConsoleOutput=%v wAttributes=%v, (%v:)", t, hConsoleOutput, wAttributes, origin(2)) + } r1, _, _ := syscall.Syscall(procSetConsoleTextAttribute.Addr(), 2, hConsoleOutput, uintptr(wAttributes), 0) return int32(r1) } @@ -5244,6 +6131,9 @@ func XSetConsoleTextAttribute(t *TLS, hConsoleOutput uintptr, wAttributes uint16 // // ); func XGetConsoleScreenBufferInfo(t *TLS, hConsoleOutput, lpConsoleScreenBufferInfo uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpConsoleScreenBufferInfo=%v, (%v:)", t, lpConsoleScreenBufferInfo, origin(2)) + } r1, _, _ := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, hConsoleOutput, lpConsoleScreenBufferInfo, 0) return int32(r1) } @@ -5255,6 +6145,9 @@ func XGetConsoleScreenBufferInfo(t *TLS, hConsoleOutput, lpConsoleScreenBufferIn // // ); func X_popen(t *TLS, command, mode uintptr) uintptr { + if __ccgo_strace { + trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) + } panic(todo("")) } @@ -5264,18 +6157,30 @@ func X_popen(t *TLS, command, mode uintptr) uintptr { // // ); func X_wunlink(t *TLS, filename uintptr) int32 { + if __ccgo_strace { + trc("t=%v filename=%v, (%v:)", t, filename, origin(2)) + } panic(todo("")) } func Xclosedir(tls *TLS, dir uintptr) int32 { + if __ccgo_strace { + trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2)) + } panic(todo("")) } func Xopendir(tls *TLS, name uintptr) uintptr { + if __ccgo_strace { + trc("tls=%v name=%v, (%v:)", tls, name, origin(2)) + } panic(todo("")) } func Xreaddir(tls *TLS, dir uintptr) uintptr { + if __ccgo_strace { + trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2)) + } panic(todo("")) } @@ -5285,21 +6190,33 @@ func Xreaddir(tls *TLS, dir uintptr) uintptr { // // ); func X_unlink(t *TLS, filename uintptr) int32 { + if __ccgo_strace { + trc("t=%v filename=%v, (%v:)", t, filename, origin(2)) + } panic(todo("")) } // int pclose(FILE *stream); func X_pclose(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } panic(todo("")) } // int setmode (int fd, int mode); func Xsetmode(t *TLS, fd, mode int32) int32 { + if __ccgo_strace { + trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) + } return X_setmode(t, fd, mode) } // int _setmode (int fd, int mode); func X_setmode(t *TLS, fd, mode int32) int32 { + if __ccgo_strace { + trc("t=%v mode=%v, (%v:)", t, mode, origin(2)) + } _, ok := fdToFile(fd) if !ok { @@ -5320,16 +6237,25 @@ func X_setmode(t *TLS, fd, mode int32) int32 { // int _mkdir(const char *dirname); func X_mkdir(t *TLS, dirname uintptr) int32 { + if __ccgo_strace { + trc("t=%v dirname=%v, (%v:)", t, dirname, origin(2)) + } panic(todo("")) } // int _chmod( const char *filename, int pmode ); func X_chmod(t *TLS, filename uintptr, pmode int32) int32 { + if __ccgo_strace { + trc("t=%v filename=%v pmode=%v, (%v:)", t, filename, pmode, origin(2)) + } panic(todo("")) } // int _fileno(FILE *stream); func X_fileno(t *TLS, stream uintptr) int32 { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } f, ok := winGetObject(stream).(*file) if !ok { t.setErrno(errno.EBADF) @@ -5340,11 +6266,17 @@ func X_fileno(t *TLS, stream uintptr) int32 { // void rewind(FILE *stream); func Xrewind(t *TLS, stream uintptr) { + if __ccgo_strace { + trc("t=%v stream=%v, (%v:)", t, stream, origin(2)) + } Xfseek(t, stream, 0, unistd.SEEK_SET) } // __atomic_load_n func X__atomic_load_n(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } @@ -5355,16 +6287,25 @@ func X__atomic_store_n(t *TLS, _ ...interface{}) int32 { // __builtin_add_overflow func X__builtin_add_overflow(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } // __builtin_mul_overflow func X__builtin_mul_overflow(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } // __builtin_sub_overflow func X__builtin_sub_overflow(t *TLS) { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } panic(todo("")) } @@ -5426,6 +6367,9 @@ func goWideStringNZ(p uintptr) string { // LPWSTR GetCommandLineW(); func XGetCommandLineW(t *TLS) uintptr { + if __ccgo_strace { + trc("t=%v, (%v:)", t, origin(2)) + } return uintptr(unsafe.Pointer(syscall.GetCommandLine())) } @@ -5438,6 +6382,9 @@ func XGetCommandLineW(t *TLS) uintptr { // // ); func XAddAccessDeniedAce(t *TLS, pAcl uintptr, dwAceRevision, AccessMask uint32, pSid uintptr) int32 { + if __ccgo_strace { + trc("t=%v pAcl=%v AccessMask=%v pSid=%v, (%v:)", t, pAcl, AccessMask, pSid, origin(2)) + } panic(todo("")) } @@ -5451,6 +6398,9 @@ func XAddAccessDeniedAce(t *TLS, pAcl uintptr, dwAceRevision, AccessMask uint32, // // ); func XAddAce(t *TLS, pAcl uintptr, dwAceRevision, dwStartingAceIndex uint32, pAceList uintptr, nAceListLength uint32) int32 { + if __ccgo_strace { + trc("t=%v pAcl=%v dwStartingAceIndex=%v pAceList=%v nAceListLength=%v, (%v:)", t, pAcl, dwStartingAceIndex, pAceList, nAceListLength, origin(2)) + } panic(todo("")) } @@ -5462,6 +6412,9 @@ func XAddAce(t *TLS, pAcl uintptr, dwAceRevision, dwStartingAceIndex uint32, pAc // // ); func XGetAce(t *TLS, pAcl uintptr, dwAceIndex uint32, pAce uintptr) int32 { + if __ccgo_strace { + trc("t=%v pAcl=%v dwAceIndex=%v pAce=%v, (%v:)", t, pAcl, dwAceIndex, pAce, origin(2)) + } panic(todo("")) } @@ -5474,6 +6427,9 @@ func XGetAce(t *TLS, pAcl uintptr, dwAceIndex uint32, pAce uintptr) int32 { // // ); func XGetAclInformation(t *TLS, pAcl, pAclInformation uintptr, nAclInformationLength, dwAclInformationClass uint32) int32 { + if __ccgo_strace { + trc("t=%v pAclInformation=%v dwAclInformationClass=%v, (%v:)", t, pAclInformation, dwAclInformationClass, origin(2)) + } r0, _, err := syscall.Syscall6(procGetAclInformation.Addr(), 4, pAclInformation, pAclInformation, @@ -5498,6 +6454,9 @@ func XGetAclInformation(t *TLS, pAcl, pAclInformation uintptr, nAclInformationLe // // ); func XGetFileSecurityA(t *TLS, lpFileName uintptr, RequestedInformation uint32, pSecurityDescriptor uintptr, nLength uint32, lpnLengthNeeded uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpFileName=%v RequestedInformation=%v pSecurityDescriptor=%v nLength=%v lpnLengthNeeded=%v, (%v:)", t, lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded, origin(2)) + } r0, _, err := syscall.Syscall6(procGetFileSecurityA.Addr(), 5, lpFileName, uintptr(RequestedInformation), @@ -5518,6 +6477,9 @@ func XGetFileSecurityA(t *TLS, lpFileName uintptr, RequestedInformation uint32, // // ); func XGetLengthSid(t *TLS, pSid uintptr) uint32 { + if __ccgo_strace { + trc("t=%v pSid=%v, (%v:)", t, pSid, origin(2)) + } panic(todo("")) } @@ -5530,6 +6492,9 @@ func XGetLengthSid(t *TLS, pSid uintptr) uint32 { // // ); func XGetSecurityDescriptorDacl(t *TLS, pSecurityDescriptor, lpbDaclPresent, pDacl, lpbDaclDefaulted uintptr) int32 { + if __ccgo_strace { + trc("t=%v lpbDaclDefaulted=%v, (%v:)", t, lpbDaclDefaulted, origin(2)) + } r0, _, err := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, pSecurityDescriptor, lpbDaclPresent, @@ -5550,6 +6515,9 @@ func XGetSecurityDescriptorDacl(t *TLS, pSecurityDescriptor, lpbDaclPresent, pDa // // ); func XGetSidLengthRequired(t *TLS, nSubAuthorityCount uint8) int32 { + if __ccgo_strace { + trc("t=%v nSubAuthorityCount=%v, (%v:)", t, nSubAuthorityCount, origin(2)) + } r0, _, err := syscall.Syscall(procGetSidLengthRequired.Addr(), 1, uintptr(nSubAuthorityCount), 0, 0) if err != 0 { t.setErrno(err) @@ -5564,6 +6532,9 @@ func XGetSidLengthRequired(t *TLS, nSubAuthorityCount uint8) int32 { // // ); func XGetSidSubAuthority(t *TLS, pSid uintptr, nSubAuthority uint32) uintptr { + if __ccgo_strace { + trc("t=%v pSid=%v nSubAuthority=%v, (%v:)", t, pSid, nSubAuthority, origin(2)) + } r0, _, err := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, pSid, uintptr(nSubAuthority), 0) if err != 0 { t.setErrno(err) @@ -5579,6 +6550,9 @@ func XGetSidSubAuthority(t *TLS, pSid uintptr, nSubAuthority uint32) uintptr { // // ); func XInitializeAcl(t *TLS, pAcl uintptr, nAclLength, dwAclRevision uint32) int32 { + if __ccgo_strace { + trc("t=%v pAcl=%v dwAclRevision=%v, (%v:)", t, pAcl, dwAclRevision, origin(2)) + } panic(todo("")) } @@ -5590,6 +6564,9 @@ func XInitializeAcl(t *TLS, pAcl uintptr, nAclLength, dwAclRevision uint32) int3 // // ); func XInitializeSid(t *TLS, Sid, pIdentifierAuthority uintptr, nSubAuthorityCount uint8) int32 { + if __ccgo_strace { + trc("t=%v pIdentifierAuthority=%v nSubAuthorityCount=%v, (%v:)", t, pIdentifierAuthority, nSubAuthorityCount, origin(2)) + } r0, _, err := syscall.Syscall(procInitializeSid.Addr(), 3, Sid, pIdentifierAuthority, uintptr(nSubAuthorityCount)) if err != 0 { t.setErrno(err) @@ -5606,6 +6583,9 @@ func XInitializeSid(t *TLS, Sid, pIdentifierAuthority uintptr, nSubAuthorityCoun // // ); func XRaiseException(t *TLS, dwExceptionCode, dwExceptionFlags, nNumberOfArguments uint32, lpArguments uintptr) { + if __ccgo_strace { + trc("t=%v nNumberOfArguments=%v lpArguments=%v, (%v:)", t, nNumberOfArguments, lpArguments, origin(2)) + } panic(todo("")) } @@ -5615,6 +6595,9 @@ func XRaiseException(t *TLS, dwExceptionCode, dwExceptionFlags, nNumberOfArgumen // // ); func XSetErrorMode(t *TLS, uMode uint32) int32 { + if __ccgo_strace { + trc("t=%v uMode=%v, (%v:)", t, uMode, origin(2)) + } panic(todo("")) } @@ -5630,6 +6613,9 @@ func XSetErrorMode(t *TLS, uMode uint32) int32 { // // ); func XSetNamedSecurityInfoA(t *TLS, pObjectName uintptr, ObjectType, SecurityInfo uint32, psidOwner, psidGroup, pDacl, pSacl uintptr) uint32 { + if __ccgo_strace { + trc("t=%v pObjectName=%v SecurityInfo=%v pSacl=%v, (%v:)", t, pObjectName, SecurityInfo, pSacl, origin(2)) + } panic(todo("")) } @@ -5679,6 +6665,9 @@ func X_set_abort_behavior(t *TLS, _ ...interface{}) uint32 { // // ); func XOpenEventA(t *TLS, dwDesiredAccess uint32, bInheritHandle uint32, lpName uintptr) uintptr { + if __ccgo_strace { + trc("t=%v dwDesiredAccess=%v bInheritHandle=%v lpName=%v, (%v:)", t, dwDesiredAccess, bInheritHandle, lpName, origin(2)) + } r0, _, err := syscall.Syscall(procOpenEventA.Addr(), 3, uintptr(dwDesiredAccess), uintptr(bInheritHandle), lpName) if r0 == 0 { t.setErrno(err) @@ -5692,16 +6681,25 @@ func XOpenEventA(t *TLS, dwDesiredAccess uint32, bInheritHandle uint32, lpName u // // ); func X_msize(t *TLS, memblock uintptr) types.Size_t { + if __ccgo_strace { + trc("t=%v memblock=%v, (%v:)", t, memblock, origin(2)) + } return types.Size_t(UsableSize(memblock)) } // unsigned long _byteswap_ulong ( unsigned long val ); func X_byteswap_ulong(t *TLS, val ulong) ulong { + if __ccgo_strace { + trc("t=%v val=%v, (%v:)", t, val, origin(2)) + } return X__builtin_bswap32(t, val) } // unsigned __int64 _byteswap_uint64 ( unsigned __int64 val ); func X_byteswap_uint64(t *TLS, val uint64) uint64 { + if __ccgo_strace { + trc("t=%v val=%v, (%v:)", t, val, origin(2)) + } return X__builtin_bswap64(t, val) } @@ -5711,6 +6709,9 @@ func X_byteswap_uint64(t *TLS, val uint64) uint64 { // // ); func X_commit(t *TLS, fd int32) int32 { + if __ccgo_strace { + trc("t=%v fd=%v, (%v:)", t, fd, origin(2)) + } return Xfsync(t, fd) } @@ -5721,6 +6722,9 @@ func X_commit(t *TLS, fd int32) int32 { // // ); func X_stati64(t *TLS, path, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v buffer=%v, (%v:)", t, buffer, origin(2)) + } panic(todo("")) } @@ -5731,6 +6735,9 @@ func X_stati64(t *TLS, path, buffer uintptr) int32 { // // ); func X_fstati64(t *TLS, fd int32, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2)) + } panic(todo("")) } @@ -5741,6 +6748,9 @@ func X_fstati64(t *TLS, fd int32, buffer uintptr) int32 { // // ); func X_findnext32(t *TLS, handle types.Intptr_t, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v handle=%v buffer=%v, (%v:)", t, handle, buffer, origin(2)) + } panic(todo("")) } @@ -5751,6 +6761,9 @@ func X_findnext32(t *TLS, handle types.Intptr_t, buffer uintptr) int32 { // // ); func X_findfirst32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t { + if __ccgo_strace { + trc("t=%v fileinfo=%v, (%v:)", t, fileinfo, origin(2)) + } panic(todo("")) } @@ -5785,6 +6798,9 @@ func X_findfirst32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t { // long strtol(const char *nptr, char **endptr, int base); func Xstrtol(t *TLS, nptr, endptr uintptr, base int32) long { + if __ccgo_strace { + trc("t=%v endptr=%v base=%v, (%v:)", t, endptr, base, origin(2)) + } var s uintptr = nptr var acc ulong @@ -5919,6 +6935,9 @@ func Xstrtol(t *TLS, nptr, endptr uintptr, base int32) long { // unsigned long int strtoul(const char *nptr, char **endptr, int base); func Xstrtoul(t *TLS, nptr, endptr uintptr, base int32) ulong { + if __ccgo_strace { + trc("t=%v endptr=%v base=%v, (%v:)", t, endptr, base, origin(2)) + } var s uintptr = nptr var acc ulong var c byte @@ -6024,6 +7043,9 @@ func Xstrtoul(t *TLS, nptr, endptr uintptr, base int32) ulong { // int __isoc99_sscanf(const char *str, const char *format, ...); func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 { + if __ccgo_strace { + trc("t=%v va=%v, (%v:)", t, va, origin(2)) + } r := scanf(strings.NewReader(GoString(str)), format, va) // if dmesgs { // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) @@ -6033,6 +7055,9 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 { // int sscanf(const char *str, const char *format, ...); func Xsscanf(t *TLS, str, format, va uintptr) int32 { + if __ccgo_strace { + trc("t=%v va=%v, (%v:)", t, va, origin(2)) + } r := scanf(strings.NewReader(GoString(str)), format, va) // if dmesgs { // dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r) @@ -6040,11 +7065,10 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 { return r } -func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ - panic(todo("")) -} - func Xrint(tls *TLS, x float64) float64 { + if __ccgo_strace { + trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) + } switch { case x == 0: // also +0 and -0 return 0 @@ -6061,21 +7085,37 @@ func Xrint(tls *TLS, x float64) float64 { // FILE *fdopen(int fd, const char *mode); func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr { + if __ccgo_strace { + trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2)) + } panic(todo("")) } // struct tm *_gmtime64( const __time64_t *sourceTime ); func X_gmtime64(t *TLS, sourceTime uintptr) uintptr { - panic(todo("")) + if __ccgo_strace { + trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2)) + } + r0, _, err := syscall.SyscallN(procGmtime64.Addr(), uintptr(sourceTime)) + if err != 0 { + t.setErrno(err) + } + return uintptr(r0) } // __time64_t _mktime64(struct tm *timeptr); func X_mktime64(t *TLS, timeptr uintptr) time.X__time64_t { + if __ccgo_strace { + trc("t=%v timeptr=%v, (%v:)", t, timeptr, origin(2)) + } return time.X__time64_t(Xmktime(t, timeptr)) } // char * gai_strerrorA(int ecode); func Xgai_strerrorA(t *TLS, ecode int32) uintptr { + if __ccgo_strace { + trc("t=%v ecode=%v, (%v:)", t, ecode, origin(2)) + } panic(todo("")) } @@ -6097,6 +7137,9 @@ type __timeb64 struct { // void _ftime64( struct __timeb64 *timeptr ); func X_ftime64(t *TLS, timeptr uintptr) { + if __ccgo_strace { + trc("t=%v timeptr=%v, (%v:)", t, timeptr, origin(2)) + } tm := gotime.Now() (*__timeb64)(unsafe.Pointer(timeptr)).time = types.X__time64_t(tm.Unix()) @@ -6107,18 +7150,30 @@ func X_ftime64(t *TLS, timeptr uintptr) { } func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ + if __ccgo_strace { + trc("tls=%v m=%v, (%v:)", tls, m, origin(2)) + } return *(*int32)(unsafe.Pointer(m)) & 15 } func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ + if __ccgo_strace { + trc("tls=%v a=%v, (%v:)", tls, a, origin(2)) + } return *(*int32)(unsafe.Pointer(a)) } func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ + if __ccgo_strace { + trc("tls=%v a=%v, (%v:)", tls, a, origin(2)) + } return *(*int32)(unsafe.Pointer(a)) & int32(3) } func Xchmod(t *TLS, pathname uintptr, mode int32) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) + } panic(todo("%q %#o", GoString(pathname), mode)) } @@ -6142,6 +7197,9 @@ func Xchmod(t *TLS, pathname uintptr, mode int32) int32 { // // ); func XGetComputerNameExW(t *TLS, nameType int32, lpBuffer, nSize uintptr) int32 { + if __ccgo_strace { + trc("t=%v nameType=%v nSize=%v, (%v:)", t, nameType, nSize, origin(2)) + } r0, _, err := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nameType), lpBuffer, nSize) if err != 0 { t.setErrno(err) @@ -6155,7 +7213,13 @@ func XGetComputerNameExW(t *TLS, nameType int32, lpBuffer, nSize uintptr) int32 // double y // // ); -func X_copysign(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) } + +func X_copysign(t *TLS, x, y float64) float64 { + if __ccgo_strace { + trc("t=%v y=%v, (%v:)", t, y, origin(2)) + } + return Xcopysign(t, x, y) +} // int _wtoi( // @@ -6163,6 +7227,9 @@ func X_copysign(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) } // // ); func X_wtoi(t *TLS, str uintptr) int32 { + if __ccgo_strace { + trc("t=%v str=%v, (%v:)", t, str, origin(2)) + } panic(todo("")) } @@ -6187,6 +7254,9 @@ func allocW(t *TLS, v string) (r uintptr) { // // ); func X_wgetenv(t *TLS, varname uintptr) uintptr { + if __ccgo_strace { + trc("t=%v varname=%v, (%v:)", t, varname, origin(2)) + } if !wenvValid { bootWinEnviron(t) } @@ -6210,6 +7280,9 @@ func X_wgetenv(t *TLS, varname uintptr) uintptr { // // ); func X_wputenv(t *TLS, envstring uintptr) int32 { + if __ccgo_strace { + trc("t=%v envstring=%v, (%v:)", t, envstring, origin(2)) + } if !wenvValid { bootWinEnviron(t) } @@ -6253,7 +7326,12 @@ func bootWinEnviron(t *TLS) { wenvValid = true } -func Xfabsl(t *TLS, x float64) float64 { return math.Abs(x) } +func Xfabsl(t *TLS, x float64) float64 { + if __ccgo_strace { + trc("t=%v x=%v, (%v:)", t, x, origin(2)) + } + return math.Abs(x) +} func X__stdio_common_vfprintf(t *TLS, args ...interface{}) int32 { panic("TODO") } func X__stdio_common_vfprintf_p(t *TLS, args ...interface{}) int32 { panic("TODO") } @@ -6270,3 +7348,146 @@ func X__stdio_common_vsscanf(t *TLS, args ...interface{}) int32 { panic("TO func X__stdio_common_vswprintf(t *TLS, args ...interface{}) int32 { panic("TODO") } func X__stdio_common_vswprintf_s(t *TLS, args ...interface{}) int32 { panic("TODO") } func X__stdio_common_vswscanf(t *TLS, args ...interface{}) int32 { panic("TODO") } + +func X_lseeki64(t *TLS, fd int32, offset int64, whence int32) int64 { + if __ccgo_strace { + trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2)) + } + + f, ok := fdToFile(fd) + if !ok { + t.setErrno(errno.EBADF) + return -1 + } + + n, err := syscall.Seek(f.Handle, offset, int(whence)) + if err != nil { + if dmesgs { + dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), f._fd, offset, whenceStr(whence), n) + } + t.setErrno(err) + return -1 + } + + if dmesgs { + dmesg("%v: fd %v, off %#x, whence %v: ok", origin(1), f._fd, offset, whenceStr(whence)) + } + return n +} + +func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */ + if __ccgo_strace { + trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) + } + return Bool32(uint32(c)-uint32('a') < uint32(26)) +} + +func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */ + if __ccgo_strace { + trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) + } + return Bool32(uint32(c)-uint32('A') < uint32(26)) +} + +// int access(const char *pathname, int mode); +func Xaccess(t *TLS, pathname uintptr, mode int32) int32 { + if __ccgo_strace { + trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2)) + } + r0, _, err := syscall.SyscallN(procAccess.Addr(), uintptr(pathname), uintptr(mode)) + if err != 0 { + t.setErrno(err) + } + return int32(r0) +} + +// int _vscprintf(const char *format, va_list argptr); +func X_vscprintf(t *TLS, format uintptr, argptr uintptr) int32 { + if __ccgo_strace { + trc("t=%v format=%v argptr=%v, (%v:)", t, format, argptr, origin(2)) + } + + return int32(len(printf(format, argptr))) +} + +// int _stat32i64(const char *path, struct _stat32i64 *buffer); +func X_stat64i32(t *TLS, path uintptr, buffer uintptr) int32 { + if __ccgo_strace { + trc("t=%v path=%v buffer=%v, (%v:)", t, path, buffer, origin(2)) + } + r0, _, err := syscall.SyscallN(procStat64i32.Addr(), uintptr(path), uintptr(buffer)) + if err != 0 { + t.setErrno(err) + } + return int32(r0) +} + +func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 { + return byte(a_load_8(ptr)) +} + +// struct tm *gmtime( const time_t *sourceTime ); +func Xgmtime(t *TLS, sourceTime uintptr) uintptr { + if __ccgo_strace { + trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2)) + } + r0, _, err := syscall.SyscallN(procGmtime.Addr(), uintptr(sourceTime)) + if err != 0 { + t.setErrno(err) + } + return uintptr(r0) +} + +// size_t strftime( +// +// char *strDest, +// size_t maxsize, +// const char *format, +// const struct tm *timeptr +// +// ); +func Xstrftime(tls *TLS, s uintptr, n size_t, f uintptr, tm uintptr) (r size_t) { + if __ccgo_strace { + trc("tls=%v s=%v n=%v f=%v tm=%v, (%v:)", tls, s, n, f, tm, origin(2)) + defer func() { trc("-> %v", r) }() + } + tt := gotime.Date( + int((*time.Tm)(unsafe.Pointer(tm)).Ftm_year+1900), + gotime.Month((*time.Tm)(unsafe.Pointer(tm)).Ftm_mon+1), + int((*time.Tm)(unsafe.Pointer(tm)).Ftm_mday), + int((*time.Tm)(unsafe.Pointer(tm)).Ftm_hour), + int((*time.Tm)(unsafe.Pointer(tm)).Ftm_min), + int((*time.Tm)(unsafe.Pointer(tm)).Ftm_sec), + 0, + gotime.UTC, + ) + fmt := GoString(f) + var result string + if fmt != "" { + result = strftime.Format(fmt, tt) + } + switch r = size_t(len(result)); { + case r > n: + r = 0 + default: + copy((*RawMem)(unsafe.Pointer(s))[:r:r], result) + *(*byte)(unsafe.Pointer(s + uintptr(r))) = 0 + } + return r + +} + +func X__mingw_strtod(t *TLS, s uintptr, p uintptr) float64 { + return Xstrtod(t, s, p) +} + +func Xstrtod(t *TLS, s uintptr, p uintptr) float64 { + if __ccgo_strace { + trc("tls=%v s=%v p=%v, (%v:)", t, s, p, origin(2)) + } + r0, _, err := syscall.SyscallN(procStrtod.Addr(), uintptr(s), uintptr(p)) + if err != 0 { + t.setErrno(err) + } + return math.Float64frombits(uint64(r0)) +} |