qga: Support Unicode paths in guest-file-open on win32
commitbad0227d3ac4f706673df9690b77840ed89dec40
authorJonathon Reinhart <jreinhart@cc-sw.com>
Wed, 1 Aug 2018 23:10:59 +0000 (1 19:10 -0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 30 Oct 2018 21:48:49 +0000 (30 16:48 -0500)
tree2bb54567750727f580b29b8f3d94fbe27e0a52fe
parenta2e002ff7913ce93aa0f7dbedd2123dce5f1a9cd
qga: Support Unicode paths in guest-file-open on win32

Currently, the win32 port of QEMU Guest Agent does not properly handle Unicode
paths. The JSON decoder produces a valid UTF-8 path string, but this is passed
directly to CreateFileA, which is expecting an ANSI string and not UTF-8. This
leads to mangled filenames.

This patch follows the example of qmp_guest_set_user_password() and uses
g_utf8_to_utf16() to convert the string to UTF-16 and calls CreateFileW()
explicitly.

Signed-off-by: Jonathon Reinhart <jreinhart@cc-sw.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qga/commands-win32.c