summaryrefslogtreecommitdiff
path: root/util/oslib-win32.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-05-31 11:33:02 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-05-31 11:33:02 -0500
commit0a1f348c429a6af0ba6448e5b3ae08dbc8e28696 (patch)
treef9d29b9f471c378a0ac0bfd9a442342535ea1a08 /util/oslib-win32.c
parent6c8df7a33ade90c8c96b01655520c7e9b69b46c0 (diff)
parentf2e3978b5a72870b061d29948075dccc0a72db8e (diff)
downloadqemu-0a1f348c429a6af0ba6448e5b3ae08dbc8e28696.tar.gz
Merge remote-tracking branch 'mdroth/qga-pull-2013-05-30' into staging
# By Laszlo Ersek # Via Michael Roth * mdroth/qga-pull-2013-05-30: Makefile: create ".../var/run" when installing the POSIX guest agent qga: save state directory in ga_install_service() qga: remove undefined behavior in ga_install_service() qga: create state directory on win32 configure: don't save any fixed local_statedir for win32 qga: determine default state dir and pidfile dynamically osdep: add qemu_get_local_state_pathname() Message-id: 1369940341-9043-1-git-send-email-mdroth@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'util/oslib-win32.c')
-rw-r--r--util/oslib-win32.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index df2ecbdffb..961fbf5e3d 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -26,12 +26,17 @@
* THE SOFTWARE.
*/
#include <windows.h>
+#include <glib.h>
+#include <stdlib.h>
#include "config-host.h"
#include "sysemu/sysemu.h"
#include "qemu/main-loop.h"
#include "trace.h"
#include "qemu/sockets.h"
+/* this must come after including "trace.h" */
+#include <shlobj.h>
+
void *qemu_oom_check(void *ptr)
{
if (ptr == NULL) {
@@ -160,3 +165,20 @@ int qemu_get_thread_id(void)
{
return GetCurrentThreadId();
}
+
+char *
+qemu_get_local_state_pathname(const char *relative_pathname)
+{
+ HRESULT result;
+ char base_path[MAX_PATH+1] = "";
+
+ result = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL,
+ /* SHGFP_TYPE_CURRENT */ 0, base_path);
+ if (result != S_OK) {
+ /* misconfigured environment */
+ g_critical("CSIDL_COMMON_APPDATA unavailable: %ld", (long)result);
+ abort();
+ }
+ return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", base_path,
+ relative_pathname);
+}