STARTUPINFOA si;
char *arg_string, *env_string;
BOOL result;
+ char exe_path[MAX_PATH];
#ifdef DBUS_WINCE
if (argv && argv[0])
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);
-#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);
+ result = CreateProcessA (exe_path, arg_string, NULL, NULL, FALSE, 0,
+ (LPVOID)env_string, NULL, &si, &pi);
free (arg_string);
if (env_string)
free (env_string);