util/oslib-win32: Use UTF-16 filesystem API

* Introduces qemu_fopen, qemu_access wrappers, and modifies qemu_open to
  support converting stored UTF-8 paths to UTF-16 to use Unicode
  filesystem API on Windows platform.
* Migrates several native open, fopen, and access calls to their
  qemu_* counterparts to resolve Unicode path handling issues on
  Windows.
This commit is contained in:
Silent
2021-10-24 21:09:12 +02:00
committed by GitHub
parent 5a80cfa2d9
commit 5ae39a321a
15 changed files with 225 additions and 69 deletions

View File

@ -593,6 +593,21 @@ int qemu_lock_fd_test(int fd, int64_t start, int64_t len, bool exclusive);
bool qemu_has_ofd_lock(void);
#endif
#ifdef _WIN32
FILE *qemu_fopen(const char *filename, const char *mode);
int qemu_access(const char *pathname, int mode);
#else
static inline FILE *qemu_fopen(const char *filename, const char *mode)
{
return fopen(filename, mode);
}
static inline int qemu_access(const char *pathname, int mode)
{
return access(pathname, mode);
}
#endif
#if defined(__HAIKU__) && defined(__i386__)
#define FMT_pid "%ld"
#elif defined(WIN64)