[rename] renamed kdbus related macros
[platform/upstream/dbus.git] / dbus / dbus-spawn-win.c
index a7416cb..cd8ca66 100644 (file)
@@ -42,6 +42,7 @@
 #include "dbus-protocol.h"
 
 #define WIN32_LEAN_AND_MEAN
+#include <windows.h>
 //#define STRICT
 //#include <windows.h>
 //#undef STRICT
@@ -62,7 +63,7 @@ struct DBusBabysitter
     int refcount;
 
     HANDLE start_sync_event;
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
 
     HANDLE end_sync_event;
 #endif
@@ -108,7 +109,7 @@ _dbus_babysitter_new (void)
       return NULL;
     }
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
   sitter->end_sync_event = CreateEvent (NULL, FALSE, FALSE, NULL);
   if (sitter->end_sync_event == NULL)
     {
@@ -249,7 +250,7 @@ _dbus_babysitter_unref (DBusBabysitter *sitter)
           sitter->start_sync_event = NULL;
         }
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
       if (sitter->end_sync_event != NULL)
         {
           CloseHandle (sitter->end_sync_event);
@@ -544,7 +545,6 @@ spawn_program (char* name, char** argv, char** envp)
   STARTUPINFOA si;
   char *arg_string, *env_string;
   BOOL result;
-  char exe_path[MAX_PATH];
 
 #ifdef DBUS_WINCE
   if (argv && argv[0])
@@ -559,45 +559,14 @@ spawn_program (char* name, char** argv, char** envp)
 
   env_string = build_env_string(envp);
 
-#ifndef DBUS_WINCE
-  // handle relative pathes
-  if (strlen(name) > 2 && name[0] != '\\' && name[0] != '/' && name[1] != ':')
-    {
-      _dbus_verbose ("babysitter: spawning %s", name);
-      char install_root[2*MAX_PATH];
-      LPSTR lpFile;
-      char *p;
-      if (!_dbus_get_install_root (install_root, sizeof(install_root)))
-        return INVALID_HANDLE_VALUE;
-
-      strcat(install_root,name);
-
-      // add exe extension, if not present
-      p = strrchr(name,'.');
-      if (!p)
-        strcat(install_root,".exe");
-
-      // convert '/' into '\\'
-      while((p = strchr(install_root,'/')) != 0)
-        *p = '\\';
-
-      // separate path from filename
-      p = strrchr(install_root,'\\');
-      // no complete path: error condition
-      if (!p)
-        return INVALID_HANDLE_VALUE;
-      *p = 0;
-      if (!SearchPathA(install_root, p+1, NULL, sizeof(exe_path), exe_path, &lpFile))
-        return INVALID_HANDLE_VALUE;
-    }
-  else
-#endif
-    strncpy(exe_path,name,MAX_PATH);
-
   memset (&si, 0, sizeof (si));
   si.cb = sizeof (si);
-  result = CreateProcessA (exe_path, arg_string, NULL, NULL, FALSE, 0,
-               (LPVOID)env_string, NULL, &si, &pi);
+#ifdef DBUS_WINCE
+  result = CreateProcessA (name, arg_string, NULL, NULL, FALSE, 0,
+#else
+  result = CreateProcessA (NULL, arg_string, NULL, NULL, FALSE, 0,
+#endif
+                          (LPVOID)env_string, NULL, &si, &pi);
   free (arg_string);
   if (env_string)
     free (env_string);
@@ -659,7 +628,7 @@ babysitter (void *parameter)
       sitter->child_handle = NULL;
     }
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
   SetEvent (sitter->end_sync_event);
 #endif
 
@@ -784,7 +753,7 @@ _dbus_babysitter_set_result_function  (DBusBabysitter             *sitter,
   sitter->finished_data = user_data;
 }
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
 
 static char *
 get_test_exec (const char *exe,