mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
Use wide char API if available, and store dll name in UTF-8.
2005-04-08 Tor Lillqvist <tml@novell.com> * glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API if available, and store dll name in UTF-8.
This commit is contained in:
committed by
Tor Lillqvist
parent
4fe1315d5e
commit
153215759c
@@ -1,3 +1,8 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
2005-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gfileutils.c (get_contents_stdio): Avoid memory
|
||||
|
@@ -1,3 +1,8 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
2005-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gfileutils.c (get_contents_stdio): Avoid memory
|
||||
|
@@ -1,3 +1,8 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
2005-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gfileutils.c (get_contents_stdio): Avoid memory
|
||||
|
@@ -1,3 +1,8 @@
|
||||
2005-04-08 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use wide char API
|
||||
if available, and store dll name in UTF-8.
|
||||
|
||||
2005-04-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gfileutils.c (get_contents_stdio): Avoid memory
|
||||
|
@@ -367,24 +367,38 @@ G_END_DECLS
|
||||
#ifndef G_PLATFORM_WIN32
|
||||
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
|
||||
#else
|
||||
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \
|
||||
static char *dll_name; \
|
||||
\
|
||||
BOOL WINAPI \
|
||||
DllMain (HINSTANCE hinstDLL, \
|
||||
DWORD fdwReason, \
|
||||
LPVOID lpvReserved) \
|
||||
{ \
|
||||
char bfr[1000]; \
|
||||
switch (fdwReason) \
|
||||
{ \
|
||||
case DLL_PROCESS_ATTACH: \
|
||||
GetModuleFileName ((HMODULE) hinstDLL, bfr, sizeof (bfr)); \
|
||||
dll_name = g_path_get_basename (bfr); \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
return TRUE; \
|
||||
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \
|
||||
static char *dll_name; \
|
||||
\
|
||||
BOOL WINAPI \
|
||||
DllMain (HINSTANCE hinstDLL, \
|
||||
DWORD fdwReason, \
|
||||
LPVOID lpvReserved) \
|
||||
{ \
|
||||
wchar_t wcbfr[1000]; \
|
||||
char cpbfr[1000]; \
|
||||
char *tem; \
|
||||
switch (fdwReason) \
|
||||
{ \
|
||||
case DLL_PROCESS_ATTACH: \
|
||||
if (GetVersion () < 0x80000000) \
|
||||
{ \
|
||||
GetModuleFileNameW ((HMODULE) hinstDLL, wcbfr, G_N_ELEMENTS (wcbfr)); \
|
||||
tem = g_utf16_to_utf8 (wcbfr, -1, NULL, NULL, NULL); \
|
||||
dll_name = g_path_get_basename (tem); \
|
||||
g_free (tem); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
GetModuleFileNameA ((HMODULE) hinstDLL, cpbfr, G_N_ELEMENTS (cpbfr)); \
|
||||
tem = g_locale_to_utf8 (cpbfr, -1, NULL, NULL, NULL); \
|
||||
dll_name = g_path_get_basename (tem); \
|
||||
g_free (tem); \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
return TRUE; \
|
||||
}
|
||||
#endif /* G_PLATFORM_WIN32 */
|
||||
|
||||
|
Reference in New Issue
Block a user