From e7d7ae166f491e8716d931177f9b527479e85541 Mon Sep 17 00:00:00 2001 From: "munkyu.im" Date: Wed, 7 Mar 2012 15:59:04 +0900 Subject: [Title]convert utf8 to cp949 (CreateFile) [Type] [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- block/raw-win32.c | 6 ++++-- net/tap-win32.c | 2 +- os-win32.c | 2 +- qemu-char.c | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/block/raw-win32.c b/block/raw-win32.c index e4b0b75b70..0bbc41bd51 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -96,7 +96,8 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags) overlapped |= FILE_FLAG_NO_BUFFERING; if (!(flags & BDRV_O_CACHE_WB)) overlapped |= FILE_FLAG_WRITE_THROUGH; - s->hfile = CreateFile(filename, access_flags, + s->hfile = CreateFile(g_win32_locale_filename_from_utf8(filename), + access_flags, FILE_SHARE_READ, NULL, OPEN_EXISTING, overlapped, NULL); if (s->hfile == INVALID_HANDLE_VALUE) { @@ -386,7 +387,8 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) overlapped |= FILE_FLAG_NO_BUFFERING; if (!(flags & BDRV_O_CACHE_WB)) overlapped |= FILE_FLAG_WRITE_THROUGH; - s->hfile = CreateFile(filename, access_flags, + s->hfile = CreateFile(g_win32_locale_filename_from_utf8(filename), + access_flags, FILE_SHARE_READ, NULL, create_flags, overlapped, NULL); if (s->hfile == INVALID_HANDLE_VALUE) { diff --git a/net/tap-win32.c b/net/tap-win32.c index 596132e272..b859b4c3e0 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -593,7 +593,7 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle, TAPSUFFIX); handle = CreateFile ( - device_path, + g_win32_locale_filename_from_utf8(device_path), GENERIC_READ | GENERIC_WRITE, 0, 0, diff --git a/os-win32.c b/os-win32.c index 8ad5fa1fc3..444cf70cba 100644 --- a/os-win32.c +++ b/os-win32.c @@ -129,7 +129,7 @@ int qemu_create_pidfile(const char *filename) BOOL ret; memset(&overlap, 0, sizeof(overlap)); - file = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, + file = CreateFile(g_win32_locale_filename_from_utf8(filename), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (file == INVALID_HANDLE_VALUE) { diff --git a/qemu-char.c b/qemu-char.c index 27abcb9186..6c9eee53c3 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1523,7 +1523,8 @@ static int win_chr_init(CharDriverState *chr, const char *filename) goto fail; } - s->hcom = CreateFile(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, + s->hcom = CreateFile(g_win32_locale_filename_from_utf8(filename), + GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); if (s->hcom == INVALID_HANDLE_VALUE) { fprintf(stderr, "Failed CreateFile (%lu)\n", GetLastError()); @@ -1813,7 +1814,7 @@ static int qemu_chr_open_win_file_out(QemuOpts *opts, CharDriverState **_chr) const char *file_out = qemu_opt_get(opts, "path"); HANDLE fd_out; - fd_out = CreateFile(file_out, GENERIC_WRITE, FILE_SHARE_READ, NULL, + fd_out = CreateFile(g_win32_locale_filename_from_utf8(file_out), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (fd_out == INVALID_HANDLE_VALUE) { return -EIO; -- cgit v1.2.3