//go:build windows package yu_file import yu_sys "gogs.qqck.cn/s/tools/sys" const ( error_FILE_NOT_FOUND = 0x2 // 系统找不到指定的文件 error_SHARING_VIOLATION = 0x20 // 进程无法访问文件,因为另一个程序正在使用此文件 ) func getFileSizeEx(fd uintptr) (size int64, success bool) { success = yu_sys.GetFileSizeEx.CallBool(fd, &size) return } func readFileBuf(fd uintptr, buf []byte) (result int64) { j_len := len(buf) if j_len < 1 { return } yu_sys.ReadFile.Call(fd, buf, j_len, &result, 0) return } func readFileSize(fd uintptr, size int) []byte { if size < 1 { return nil } j_buf := make([]byte, size) if !yu_sys.ReadFile.CallBool(fd, j_buf, size, &size, 0) { return nil } return j_buf[:size] } func writeFile(fd uintptr, buf []byte) bool { if len(buf) < 1 { return true } j_len := 0 return yu_sys.WriteFile.CallBool(fd, buf, len(buf), &j_len, 0) }