[evolution-data-server] [Win32] Use common Win32 init function in book/cal subprocesses



commit 6210ab1503aaccd6b7f474a9e20582f3cb1c8a2a
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 5 17:09:00 2015 +0200

    [Win32] Use common Win32 init function in book/cal subprocesses

 .../evolution-addressbook-factory-subprocess.c     |   40 +-------------------
 .../evolution-calendar-factory-subprocess.c        |   40 +-------------------
 2 files changed, 4 insertions(+), 76 deletions(-)
---
diff --git a/addressbook/libedata-book/evolution-addressbook-factory-subprocess.c 
b/addressbook/libedata-book/evolution-addressbook-factory-subprocess.c
index f54ae65..388d524 100644
--- a/addressbook/libedata-book/evolution-addressbook-factory-subprocess.c
+++ b/addressbook/libedata-book/evolution-addressbook-factory-subprocess.c
@@ -27,19 +27,9 @@
 #include <gtk/gtk.h>
 #endif
 
-#ifdef G_OS_WIN32
-#include <windows.h>
-#include <conio.h>
-#ifndef PROCESS_DEP_ENABLE
-#define PROCESS_DEP_ENABLE 0x00000001
-#endif
-#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
-#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
-#endif
-#endif
-
 #include <e-dbus-subprocess-backend.h>
 #include <libebackend/libebackend.h>
+#include <libedataserver/libedataserver.h>
 #include <libedata-book/libedata-book.h>
 
 typedef struct _SubprocessData SubprocessData;
@@ -164,33 +154,7 @@ main (gint argc,
        GError *error = NULL;
 
 #ifdef G_OS_WIN32
-       /* Reduce risks */
-       {
-               typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
-               t_SetDllDirectoryA p_SetDllDirectoryA;
-
-               p_SetDllDirectoryA = GetProcAddress (
-                       GetModuleHandle ("kernel32.dll"),
-                       "SetDllDirectoryA");
-
-               if (p_SetDllDirectoryA != NULL)
-                       p_SetDllDirectoryA ("");
-       }
-#ifndef _WIN64
-       {
-               typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
-               t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
-
-               p_SetProcessDEPPolicy = GetProcAddress (
-                       GetModuleHandle ("kernel32.dll"),
-                       "SetProcessDEPPolicy");
-
-               if (p_SetProcessDEPPolicy != NULL)
-                       p_SetProcessDEPPolicy (
-                               PROCESS_DEP_ENABLE |
-                               PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
-       }
-#endif
+       e_util_win32_initialize ();
 #endif
 
        setlocale (LC_ALL, "");
diff --git a/calendar/libedata-cal/evolution-calendar-factory-subprocess.c 
b/calendar/libedata-cal/evolution-calendar-factory-subprocess.c
index 51858d3..8485084 100644
--- a/calendar/libedata-cal/evolution-calendar-factory-subprocess.c
+++ b/calendar/libedata-cal/evolution-calendar-factory-subprocess.c
@@ -24,19 +24,9 @@
 #include <gtk/gtk.h>
 #endif
 
-#ifdef G_OS_WIN32
-#include <windows.h>
-#include <conio.h>
-#ifndef PROCESS_DEP_ENABLE
-#define PROCESS_DEP_ENABLE 0x00000001
-#endif
-#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
-#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
-#endif
-#endif
-
 #include <e-dbus-subprocess-backend.h>
 #include <libebackend/libebackend.h>
+#include <libedataserver/libedataserver.h>
 #include <libedata-cal/libedata-cal.h>
 
 typedef struct _SubprocessData SubprocessData;
@@ -161,33 +151,7 @@ main (gint argc,
        GError *error = NULL;
 
 #ifdef G_OS_WIN32
-       /* Reduce risks */
-       {
-               typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
-               t_SetDllDirectoryA p_SetDllDirectoryA;
-
-               p_SetDllDirectoryA = GetProcAddress (
-                       GetModuleHandle ("kernel32.dll"),
-                       "SetDllDirectoryA");
-
-               if (p_SetDllDirectoryA != NULL)
-                       p_SetDllDirectoryA ("");
-       }
-#ifndef _WIN64
-       {
-               typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
-               t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
-
-               p_SetProcessDEPPolicy = GetProcAddress (
-                       GetModuleHandle ("kernel32.dll"),
-                       "SetProcessDEPPolicy");
-
-               if (p_SetProcessDEPPolicy != NULL)
-                       p_SetProcessDEPPolicy (
-                               PROCESS_DEP_ENABLE |
-                               PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
-       }
-#endif
+       e_util_win32_initialize ();
 #endif
 
        setlocale (LC_ALL, "");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]