56
49
static char *orbit_net_id = NULL;
57
50
static gboolean orbit_use_http_iors = FALSE;
58
51
static char *orbit_ipsock = NULL;
59
static char *orbit_ipname = NULL;
52
static const char *orbit_ipname = NULL;
60
53
static char *orbit_debug_options = NULL;
61
54
static char *orbit_naming_ref = NULL;
62
55
static GSList *orbit_initref_list = NULL;
1482
1475
#ifdef G_OS_WIN32
1484
const gchar *ORBit_win32_typelib_dir;
1485
const gchar *ORBit_win32_system_rcfile;
1487
/* DllMain function needed to fetch the DLL name and deduce the
1488
* installation directory from that, and then form the pathnames for
1489
* the typelib directory and system orbitrc file.
1477
/* DllMain function used to store the DLL handle */
1478
static HMODULE hmodule;
1479
G_LOCK_DEFINE_STATIC (mutex);
1481
/* Silence gcc warnings about no prototype */
1482
BOOL WINAPI DllMain (HINSTANCE hinstDLL,
1484
LPVOID lpvReserved);
1485
const gchar *ORBit_win32_get_typelib_dir (void);
1486
const gchar *ORBit_win32_get_system_rcfile (void);
1492
1489
DllMain (HINSTANCE hinstDLL,
1493
1490
DWORD fdwReason,
1494
1491
LPVOID lpvReserved)
1496
wchar_t wcbfr[1000];
1498
char *dll_name = NULL;
1501
switch (fdwReason) {
1502
case DLL_PROCESS_ATTACH:
1503
/* GLib 2.6 uses UTF-8 file names */
1504
if (GetVersion () < 0x80000000) {
1505
/* NT-based Windows has wide char API */
1506
if (GetModuleFileNameW ((HMODULE) hinstDLL,
1507
wcbfr, G_N_ELEMENTS (wcbfr)))
1508
dll_name = g_utf16_to_utf8 (wcbfr, -1,
1512
if (GetModuleFileNameA ((HMODULE) hinstDLL,
1513
cpbfr, G_N_ELEMENTS (cpbfr)))
1514
dll_name = g_locale_to_utf8 (cpbfr, -1,
1519
gchar *p = strrchr (dll_name, '\\');
1524
p = strrchr (dll_name, '\\');
1525
if (p && (g_ascii_strcasecmp (p + 1, "bin") == 0))
1530
prefix = g_strdup ("");
1533
ORBit_win32_typelib_dir = g_strconcat (prefix,
1536
ORBit_win32_system_rcfile = g_strconcat (prefix,
1493
switch (fdwReason) {
1494
case DLL_PROCESS_ATTACH:
1501
static const char *typelib_dir = NULL;
1502
static const char *system_rcfile = NULL;
1510
if (typelib_dir != NULL) {
1515
prefix = g_win32_get_package_installation_directory_of_module (hmodule);
1517
if (prefix == NULL) {
1518
/* Just to not crash... */
1519
prefix = g_strdup ("");
1522
typelib_dir = g_strconcat (prefix,
1526
system_rcfile = g_strconcat (prefix,
1535
ORBit_win32_get_typelib_dir (void)
1542
ORBit_win32_get_system_rcfile (void)
1545
return system_rcfile;