github.com/afumu/libc@v0.0.6/libc_windows_386.go (about)

     1  // Copyright 2020 The Libc Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package libc // import "github.com/afumu/libc"
     6  
     7  import (
     8  	"os"
     9  	"strings"
    10  	"syscall"
    11  	"unsafe"
    12  
    13  	"github.com/afumu/libc/errno"
    14  	"github.com/afumu/libc/sys/stat"
    15  	"github.com/afumu/libc/sys/types"
    16  )
    17  
    18  // int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
    19  func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
    20  	panic(todo(""))
    21  	// // 	musl/arch/x32/ksigaction.h
    22  	// //
    23  	// //	struct k_sigaction {
    24  	// //		void (*handler)(int);
    25  	// //		unsigned long flags;
    26  	// //		void (*restorer)(void);
    27  	// //		unsigned mask[2];
    28  	// //	};
    29  	// type k_sigaction struct {
    30  	// 	handler  uintptr
    31  	// 	flags    ulong
    32  	// 	restorer uintptr
    33  	// 	mask     [2]uint32
    34  	// }
    35  
    36  	// var kact, koldact uintptr
    37  	// if act != 0 {
    38  	// 	kact = t.Alloc(int(unsafe.Sizeof(k_sigaction{})))
    39  	// 	defer Xfree(t, kact)
    40  	// 	*(*k_sigaction)(unsafe.Pointer(kact)) = k_sigaction{
    41  	// 		handler:  (*signal.Sigaction)(unsafe.Pointer(act)).F__sigaction_handler.Fsa_handler,
    42  	// 		flags:    ulong((*signal.Sigaction)(unsafe.Pointer(act)).Fsa_flags),
    43  	// 		restorer: (*signal.Sigaction)(unsafe.Pointer(act)).Fsa_restorer,
    44  	// 	}
    45  	// 	Xmemcpy(t, kact+unsafe.Offsetof(k_sigaction{}.mask), act+unsafe.Offsetof(signal.Sigaction{}.Fsa_mask), types.Size_t(unsafe.Sizeof(k_sigaction{}.mask)))
    46  	// }
    47  	// if oldact != 0 {
    48  	// 	panic(todo(""))
    49  	// }
    50  
    51  	// if _, _, err := unix.Syscall6(unix.SYS_RT_SIGACTION, uintptr(signal.SIGABRT), kact, koldact, unsafe.Sizeof(k_sigaction{}.mask), 0, 0); err != 0 {
    52  	// 	t.setErrno(err)
    53  	// 	return -1
    54  	// }
    55  
    56  	// if oldact != 0 {
    57  	// 	panic(todo(""))
    58  	// }
    59  
    60  	// return 0
    61  }
    62  
    63  // int fcntl(int fd, int cmd, ... /* arg */ );
    64  func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
    65  	panic(todo(""))
    66  	// 	var arg uintptr
    67  	// 	if args != 0 {
    68  	// 		arg = *(*uintptr)(unsafe.Pointer(args))
    69  	// 	}
    70  	// 	n, _, err := unix.Syscall(unix.SYS_FCNTL64, uintptr(fd), uintptr(cmd), arg)
    71  	// 	if err != 0 {
    72  	// 		if dmesgs {
    73  	// 			dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd)
    74  	// 		}
    75  	// 		t.setErrno(err)
    76  	// 		return -1
    77  	// 	}
    78  	//
    79  	// 	if dmesgs {
    80  	// 		dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n)
    81  	// 	}
    82  	// 	return int32(n)
    83  }
    84  
    85  // int lstat(const char *pathname, struct stat *statbuf);
    86  func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
    87  	panic(todo(""))
    88  	// 	if _, _, err := unix.Syscall(unix.SYS_LSTAT64, pathname, statbuf, 0); err != 0 {
    89  	// 		if dmesgs {
    90  	// 			dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
    91  	// 		}
    92  	// 		t.setErrno(err)
    93  	// 		return -1
    94  	// 	}
    95  	//
    96  	// 	if dmesgs {
    97  	// 		dmesg("%v: %q: ok", origin(1), GoString(pathname))
    98  	// 	}
    99  	// 	return 0
   100  }
   101  
   102  // int stat(const char *pathname, struct stat *statbuf);
   103  func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
   104  	panic(todo(""))
   105  	// 	if _, _, err := unix.Syscall(unix.SYS_STAT64, pathname, statbuf, 0); err != 0 {
   106  	// 		if dmesgs {
   107  	// 			dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
   108  	// 		}
   109  	// 		t.setErrno(err)
   110  	// 		return -1
   111  	// 	}
   112  	//
   113  	// 	if dmesgs {
   114  	// 		dmesg("%v: %q: ok", origin(1), GoString(pathname))
   115  	// 	}
   116  	// 	return 0
   117  }
   118  
   119  // int fstat(int fd, struct stat *statbuf);
   120  func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
   121  	panic(todo(""))
   122  	// 	if _, _, err := unix.Syscall(unix.SYS_FSTAT64, uintptr(fd), statbuf, 0); err != 0 {
   123  	// 		if dmesgs {
   124  	// 			dmesg("%v: fd %d: %v", origin(1), fd, err)
   125  	// 		}
   126  	// 		t.setErrno(err)
   127  	// 		return -1
   128  	// 	}
   129  	//
   130  	// 	if dmesgs {
   131  	// 		dmesg("%v: %d, size %#x: ok\n%+v", origin(1), fd, (*stat.Stat)(unsafe.Pointer(statbuf)).Fst_size, (*stat.Stat)(unsafe.Pointer(statbuf)))
   132  	// 	}
   133  	// 	return 0
   134  }
   135  
   136  // void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
   137  func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
   138  	panic(todo(""))
   139  	// 	var arg uintptr
   140  	// 	if args != 0 {
   141  	// 		arg = *(*uintptr)(unsafe.Pointer(args))
   142  	// 	}
   143  	// 	data, _, err := unix.Syscall6(unix.SYS_MREMAP, old_address, uintptr(old_size), uintptr(new_size), uintptr(flags), arg, 0)
   144  	// 	if err != 0 {
   145  	// 		if dmesgs {
   146  	// 			dmesg("%v: %v", origin(1), err)
   147  	// 		}
   148  	// 		t.setErrno(err)
   149  	// 		return ^uintptr(0) // (void*)-1
   150  	// 	}
   151  	//
   152  	// 	if dmesgs {
   153  	// 		dmesg("%v: %#x", origin(1), data)
   154  	// 	}
   155  	// 	return data
   156  }
   157  
   158  func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
   159  	return Xmmap64(t, addr, length, prot, flags, fd, offset)
   160  }
   161  
   162  // void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
   163  func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
   164  	panic(todo(""))
   165  	// 	data, _, err := unix.Syscall6(unix.SYS_MMAP2, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset>>12))
   166  	// 	if err != 0 {
   167  	// 		if dmesgs {
   168  	// 			dmesg("%v: %v", origin(1), err)
   169  	// 		}
   170  	// 		t.setErrno(err)
   171  	// 		return ^uintptr(0) // (void*)-1
   172  	// 	}
   173  	//
   174  	// 	if dmesgs {
   175  	// 		dmesg("%v: %#x", origin(1), data)
   176  	// 	}
   177  	// 	return data
   178  }
   179  
   180  // int ftruncate(int fd, off_t length);
   181  func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
   182  	panic(todo(""))
   183  	// 	if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE64, uintptr(fd), uintptr(length), uintptr(length>>32)); err != 0 {
   184  	// 		if dmesgs {
   185  	// 			dmesg("%v: fd %d: %v", origin(1), fd, err)
   186  	// 		}
   187  	// 		t.setErrno(err)
   188  	// 		return -1
   189  	// 	}
   190  	//
   191  	// 	if dmesgs {
   192  	// 		dmesg("%v: %d %#x: ok", origin(1), fd, length)
   193  	// 	}
   194  	// 	return 0
   195  }
   196  
   197  // off64_t lseek64(int fd, off64_t offset, int whence);
   198  func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
   199  	panic(todo(""))
   200  	// 	bp := t.Alloc(int(unsafe.Sizeof(types.X__loff_t(0))))
   201  	// 	defer t.Free(int(unsafe.Sizeof(types.X__loff_t(0))))
   202  	// 	if _, _, err := unix.Syscall6(unix.SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), bp, uintptr(whence), 0); err != 0 {
   203  	// 		if dmesgs {
   204  	// 			dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
   205  	// 		}
   206  	// 		t.setErrno(err)
   207  	// 		return -1
   208  	// 	}
   209  	//
   210  	// 	if dmesgs {
   211  	// 		dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), *(*types.Off_t)(unsafe.Pointer(bp)))
   212  	// 	}
   213  	// 	return *(*types.Off_t)(unsafe.Pointer(bp))
   214  }
   215  
   216  // int utime(const char *filename, const struct utimbuf *times);
   217  func Xutime(t *TLS, filename, times uintptr) int32 {
   218  	panic(todo(""))
   219  	// 	if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
   220  	// 		t.setErrno(err)
   221  	// 		return -1
   222  	// 	}
   223  	//
   224  	// 	return 0
   225  }
   226  
   227  // unsigned int alarm(unsigned int seconds);
   228  func Xalarm(t *TLS, seconds uint32) uint32 {
   229  	panic(todo(""))
   230  	// 	n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
   231  	// 	if err != 0 {
   232  	// 		panic(todo(""))
   233  	// 	}
   234  	//
   235  	// 	return uint32(n)
   236  }
   237  
   238  // int getrlimit(int resource, struct rlimit *rlim);
   239  func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
   240  	panic(todo(""))
   241  	// 	if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
   242  	// 		t.setErrno(err)
   243  	// 		return -1
   244  	// 	}
   245  	//
   246  	// 	return 0
   247  }
   248  
   249  // time_t time(time_t *tloc);
   250  func Xtime(t *TLS, tloc uintptr) types.Time_t {
   251  	panic(todo(""))
   252  	// 	n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
   253  	// 	if err != 0 {
   254  	// 		t.setErrno(err)
   255  	// 		return types.Time_t(-1)
   256  	// 	}
   257  	//
   258  	// 	if tloc != 0 {
   259  	// 		*(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n)
   260  	// 	}
   261  	// 	return types.Time_t(n)
   262  }
   263  
   264  // int mkdir(const char *path, mode_t mode);
   265  func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
   266  	panic(todo(""))
   267  	// 	if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
   268  	// 		t.setErrno(err)
   269  	// 		return -1
   270  	// 	}
   271  	//
   272  	// 	if dmesgs {
   273  	// 		dmesg("%v: %q: ok", origin(1), GoString(path))
   274  	// 	}
   275  	// 	return 0
   276  }
   277  
   278  // int symlink(const char *target, const char *linkpath);
   279  func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
   280  	panic(todo(""))
   281  	// 	if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
   282  	// 		t.setErrno(err)
   283  	// 		return -1
   284  	// 	}
   285  	//
   286  	// 	if dmesgs {
   287  	// 		dmesg("%v: %q %q: ok", origin(1), GoString(target), GoString(linkpath))
   288  	// 	}
   289  	// 	return 0
   290  }
   291  
   292  // int utimes(const char *filename, const struct timeval times[2]);
   293  func Xutimes(t *TLS, filename, times uintptr) int32 {
   294  	panic(todo(""))
   295  	// 	if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
   296  	// 		t.setErrno(err)
   297  	// 		return -1
   298  	// 	}
   299  	//
   300  	// 	if dmesgs {
   301  	// 		dmesg("%v: %q: ok", origin(1), GoString(filename))
   302  	// 	}
   303  	// 	return 0
   304  }
   305  
   306  // int unlink(const char *pathname);
   307  func Xunlink(t *TLS, pathname uintptr) int32 {
   308  	err := syscall.DeleteFile((*uint16)(unsafe.Pointer(pathname)))
   309  	if err != nil {
   310  		t.setErrno(err)
   311  		return -1
   312  	}
   313  
   314  	if dmesgs {
   315  		dmesg("%v: %q: ok", origin(1), GoString(pathname))
   316  	}
   317  
   318  	return 0
   319  
   320  }
   321  
   322  // int access(const char *pathname, int mode);
   323  func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
   324  	panic(todo(""))
   325  	// 	if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
   326  	// 		if dmesgs {
   327  	// 			dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
   328  	// 		}
   329  	// 		t.setErrno(err)
   330  	// 		return -1
   331  	// 	}
   332  	//
   333  	// 	if dmesgs {
   334  	// 		dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
   335  	// 	}
   336  	// 	return 0
   337  }
   338  
   339  // int rmdir(const char *pathname);
   340  func Xrmdir(t *TLS, pathname uintptr) int32 {
   341  	panic(todo(""))
   342  	// 	if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
   343  	// 		t.setErrno(err)
   344  	// 		return -1
   345  	// 	}
   346  	//
   347  	// 	if dmesgs {
   348  	// 		dmesg("%v: %q: ok", origin(1), GoString(pathname))
   349  	// 	}
   350  	// 	return 0
   351  }
   352  
   353  // int mknod(const char *pathname, mode_t mode, dev_t dev);
   354  func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
   355  	panic(todo(""))
   356  	// 	if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
   357  	// 		t.setErrno(err)
   358  	// 		return -1
   359  	// 	}
   360  	//
   361  	// 	return 0
   362  }
   363  
   364  // // int chown(const char *pathname, uid_t owner, gid_t group);
   365  // func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
   366  // 	panic(todo(""))
   367  // 	// 	if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
   368  // 	// 		t.setErrno(err)
   369  // 	// 		return -1
   370  // 	// 	}
   371  // 	//
   372  // 	// 	return 0
   373  // }
   374  
   375  // int link(const char *oldpath, const char *newpath);
   376  func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
   377  	panic(todo(""))
   378  	// 	if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
   379  	// 		t.setErrno(err)
   380  	// 		return -1
   381  	// 	}
   382  	//
   383  	// 	return 0
   384  }
   385  
   386  // int pipe(int pipefd[2]);
   387  func Xpipe(t *TLS, pipefd uintptr) int32 {
   388  	panic(todo(""))
   389  	// 	if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
   390  	// 		t.setErrno(err)
   391  	// 		return -1
   392  	// 	}
   393  	//
   394  	// 	return 0
   395  }
   396  
   397  // int dup2(int oldfd, int newfd);
   398  func Xdup2(t *TLS, oldfd, newfd int32) int32 {
   399  	panic(todo(""))
   400  	// 	n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
   401  	// 	if err != 0 {
   402  	// 		t.setErrno(err)
   403  	// 		return -1
   404  	// 	}
   405  	//
   406  	// 	return int32(n)
   407  }
   408  
   409  // ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
   410  func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
   411  	panic(todo(""))
   412  	// 	n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
   413  	// 	if err != 0 {
   414  	// 		t.setErrno(err)
   415  	// 		return -1
   416  	// 	}
   417  	//
   418  	// 	return types.Ssize_t(n)
   419  }
   420  
   421  // FILE *fopen64(const char *pathname, const char *mode);
   422  func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
   423  
   424  	m := strings.ReplaceAll(GoString(mode), "b", "")
   425  	var flags int
   426  	switch m {
   427  	case "r":
   428  		flags = os.O_RDONLY
   429  	case "r+":
   430  		flags = os.O_RDWR
   431  	case "w":
   432  		flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
   433  	case "w+":
   434  		flags = os.O_RDWR | os.O_CREATE | os.O_TRUNC
   435  	case "a":
   436  		flags = os.O_WRONLY | os.O_CREATE | os.O_APPEND
   437  	case "a+":
   438  		flags = os.O_RDWR | os.O_CREATE | os.O_APPEND
   439  	default:
   440  		panic(m)
   441  	}
   442  	//TODO- flags |= fcntl.O_LARGEFILE
   443  	h, err := syscall.Open(GoString(pathname), int(flags), uint32(0666))
   444  	if err != nil {
   445  		t.setErrno(err)
   446  		return 0
   447  	}
   448  
   449  	p, _ := wrapFdHandle(h)
   450  	if p != 0 {
   451  		return p
   452  	}
   453  	_ = syscall.Close(h)
   454  	t.setErrno(errno.ENOMEM)
   455  	return 0
   456  }
   457  
   458  func Xrecv(t *TLS, sockfd uint32, buf uintptr, len, flags int32) int32 {
   459  	panic(todo(""))
   460  }
   461  
   462  func Xsend(t *TLS, sockfd uint32, buf uintptr, len, flags int32) int32 {
   463  	panic(todo(""))
   464  }
   465  
   466  func Xshutdown(t *TLS, sockfd uint32, how int32) int32 {
   467  	panic(todo(""))
   468  	// 	if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
   469  	// 		t.setErrno(err)
   470  	// 		return -1
   471  	// 	}
   472  	//
   473  	// 	return 0
   474  }
   475  
   476  func Xgetpeername(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) int32 {
   477  	panic(todo(""))
   478  }
   479  
   480  func Xgetsockname(t *TLS, sockfd uint32, addr, addrlen uintptr) int32 {
   481  	panic(todo(""))
   482  }
   483  
   484  func Xsocket(t *TLS, domain, type1, protocol int32) uint32 {
   485  	panic(todo(""))
   486  }
   487  
   488  func Xbind(t *TLS, sockfd uint32, addr uintptr, addrlen int32) int32 {
   489  	panic(todo(""))
   490  }
   491  
   492  func Xconnect(t *TLS, sockfd uint32, addr uintptr, addrlen int32) int32 {
   493  	panic(todo(""))
   494  }
   495  
   496  func Xlisten(t *TLS, sockfd uint32, backlog int32) int32 {
   497  	panic(todo(""))
   498  }
   499  
   500  func Xaccept(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) uint32 {
   501  	panic(todo(""))
   502  }
   503  
   504  // struct tm *_localtime32( const __time32_t *sourceTime );
   505  func X_localtime32(t *TLS, sourceTime uintptr) uintptr {
   506  	panic(todo(""))
   507  }
   508  
   509  // struct tm *_gmtime32( const __time32_t *sourceTime );
   510  func X_gmtime32(t *TLS, sourceTime uintptr) uintptr {
   511  	panic(todo(""))
   512  }
   513  
   514  // LONG SetWindowLongW(
   515  //
   516  //	HWND hWnd,
   517  //	int  nIndex,
   518  //	LONG dwNewLong
   519  //
   520  // );
   521  func XSetWindowLongW(t *TLS, hwnd uintptr, nIndex int32, dwNewLong long) long {
   522  	panic(todo(""))
   523  }
   524  
   525  // LONG GetWindowLongW(
   526  //
   527  //	HWND hWnd,
   528  //	int  nIndex
   529  //
   530  // );
   531  func XGetWindowLongW(t *TLS, hwnd uintptr, nIndex int32) long {
   532  	panic(todo(""))
   533  }
   534  
   535  // LRESULT LRESULT DefWindowProcW(
   536  //
   537  //	HWND   hWnd,
   538  //	UINT   Msg,
   539  //	WPARAM wParam,
   540  //	LPARAM lParam
   541  //
   542  // );
   543  func XDefWindowProcW(t *TLS, _ ...interface{}) int32 {
   544  	panic(todo(""))
   545  }
   546  
   547  func XSendMessageTimeoutW(t *TLS, _ ...interface{}) int32 {
   548  	panic(todo(""))
   549  }
   550  
   551  // int _fstat(
   552  //
   553  //	int fd,
   554  //	struct __stat *buffer
   555  //
   556  // );
   557  func X_fstat(t *TLS, fd int32, buffer uintptr) int32 {
   558  	f, ok := fdToFile(fd)
   559  	if !ok {
   560  		t.setErrno(EBADF)
   561  		return -1
   562  	}
   563  
   564  	var d syscall.ByHandleFileInformation
   565  	err := syscall.GetFileInformationByHandle(f.Handle, &d)
   566  	if err != nil {
   567  		t.setErrno(EBADF)
   568  		return -1
   569  	}
   570  
   571  	var bStat32 = (*stat.X_stat32)(unsafe.Pointer(buffer))
   572  	var accessTime = int64(d.LastAccessTime.HighDateTime)<<32 + int64(d.LastAccessTime.LowDateTime)
   573  	bStat32.Fst_atime = int32(WindowsTickToUnixSeconds(accessTime))
   574  	var modTime = int64(d.LastWriteTime.HighDateTime)<<32 + int64(d.LastWriteTime.LowDateTime)
   575  	bStat32.Fst_mtime = int32(WindowsTickToUnixSeconds(modTime))
   576  	var crTime = int64(d.CreationTime.HighDateTime)<<32 + int64(d.CreationTime.LowDateTime)
   577  	bStat32.Fst_ctime = int32(WindowsTickToUnixSeconds(crTime))
   578  	var fSz = int64(d.FileSizeHigh)<<32 + int64(d.FileSizeLow)
   579  	bStat32.Fst_size = int32(fSz)
   580  	bStat32.Fst_mode = WindowsAttrbiutesToStat(d.FileAttributes)
   581  
   582  	return 0
   583  }