api_windows_x32.go 996 B

123456789101112131415161718192021222324252627282930313233
  1. //go:build windows && (386 || arm || mips || mipsle)
  2. package yu_file
  3. import (
  4. yu_sys "gogs.qqck.cn/s/tools/sys"
  5. "time"
  6. )
  7. func Openfile(name string, dwDesiredAccess, dwShareMode, dwCreationDisposition, dwFlagsAndAttributes uintptr) uintptr {
  8. _open:
  9. j_fd, _, j_errno := yu_sys.CreateFileW.Call(yu_sys.S{yu_sys.Unicode, name}, dwDesiredAccess, dwShareMode, 0, dwCreationDisposition, dwFlagsAndAttributes, 0)
  10. if j_errno == error_SHARING_VIOLATION {
  11. time.Sleep(time.Microsecond)
  12. goto _open
  13. } else if int32(j_fd) == -1 {
  14. return 0
  15. }
  16. return j_fd
  17. }
  18. // func setFilePointerEx(fd uintptr, set int64, newFilePointer *int64, whence uintptr) bool {
  19. // var j_r1 uintptr
  20. // if newFilePointer == nil {
  21. // j_r1, _, _ = syscall.SyscallN(addrSetFilePointerEx, fd, uintptr(set), 0, whence)
  22. // } else {
  23. // j_r1, _, _ = syscall.SyscallN(addrSetFilePointerEx, fd, uintptr(set), uintptr(unsafe.Pointer(newFilePointer)), whence)
  24. // }
  25. // if j_r1 == 0 {
  26. // return false
  27. // }
  28. // return true
  29. // }