if (!SearchPathA(NULL, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
{
- printf ("please add the path to %s to your PATH environment variable\n", daemon_name);
- printf ("or start the daemon manually\n\n");
- goto out;
+ // Look in directory containing dbus shared library
+ HMODULE hmod = _dbus_win_get_dll_hmodule();
+ char dbus_module_path[MAX_PATH];
+ DWORD rc = GetModuleFileNameA(hmod, dbus_module_path, sizeof(dbus_module_path));
+ if (rc > 0)
+ {
+ char *ext_idx = strrchr(dbus_module_path, '\\');
+ if (ext_idx)
+ *ext_idx = '\0';
+ if (!SearchPathA(dbus_module_path, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
+ {
+ printf ("please add the path to %s to your PATH environment variable\n", daemon_name);
+ printf ("or start the daemon manually\n\n");
+ goto out;
+ }
+ }
}
+
// Create process
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);