[wing] Add wing_is_wow_64 util method
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [wing] Add wing_is_wow_64 util method
- Date: Tue, 3 May 2016 07:38:51 +0000 (UTC)
commit e7d9db55e8abd824800a75f4c40d3f17d9301383
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date: Mon May 2 10:10:29 2016 -0700
Add wing_is_wow_64 util method
This method gets whether the process is wow 64
wing/Makefile.sources | 2 ++
wing/wing.h | 1 +
wing/wingutils.c | 37 +++++++++++++++++++++++++++++++++++++
wing/wingutils.h | 31 +++++++++++++++++++++++++++++++
4 files changed, 71 insertions(+), 0 deletions(-)
---
diff --git a/wing/Makefile.sources b/wing/Makefile.sources
index 844d2ea..875ca95 100644
--- a/wing/Makefile.sources
+++ b/wing/Makefile.sources
@@ -11,6 +11,7 @@ WING_BASE_sources = \
wingservice.c \
wingservice-private.h \
wingservicemanager.c \
+ wingutils.c \
$(NULL)
WING_BASE_headers = \
@@ -21,4 +22,5 @@ WING_BASE_headers = \
wingnamedpipelistener.h \
wingservice.h \
wingservicemanager.h \
+ wingutils.h \
$(NULL)
diff --git a/wing/wing.h b/wing/wing.h
index f567ff4..1350a24 100644
--- a/wing/wing.h
+++ b/wing/wing.h
@@ -26,5 +26,6 @@
#include <wing/wingnamedpipeconnection.h>
#include <wing/wingservice.h>
#include <wing/wingservicemanager.h>
+#include <wing/wingutils.h>
#endif /* __WING_H__ */
diff --git a/wing/wingutils.c b/wing/wingutils.c
new file mode 100644
index 0000000..9d603bf
--- /dev/null
+++ b/wing/wingutils.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016 NICE s.r.l.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "wingutils.h"
+
+#include <windows.h>
+
+gboolean
+wing_is_wow_64 (void)
+{
+ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+ LPFN_ISWOW64PROCESS fnIsWow64Process;
+ BOOL is_wow_64 = FALSE;
+
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress (GetModuleHandle (TEXT ("kernel32")),
"IsWow64Process");
+ if (fnIsWow64Process != NULL)
+ {
+ if (!fnIsWow64Process (GetCurrentProcess (), &is_wow_64))
+ return FALSE;
+ }
+
+ return is_wow_64;
+}
diff --git a/wing/wingutils.h b/wing/wingutils.h
new file mode 100644
index 0000000..f3e2135
--- /dev/null
+++ b/wing/wingutils.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 NICE s.r.l.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WING_SERVICE_H
+#define WING_SERVICE_H
+
+#include <glib.h>
+#include <wing/wingversionmacros.h>
+
+G_BEGIN_DECLS
+
+WING_AVAILABLE_IN_ALL
+gboolean wing_is_wow_64 (void);
+
+G_END_DECLS
+
+#endif /* WING_SERVICE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]