111
111
*full_prefix = NULL;
112
112
*cp_prefix = NULL;
114
if (G_WIN32_HAVE_WIDECHAR_API ()) {
115
/* NT-based Windows has wide char API */
116
if (GetModuleFileNameW ((HMODULE) hmodule, wcbfr, G_N_ELEMENTS (wcbfr))) {
117
*full_prefix = g_utf16_to_utf8 (wcbfr, -1,
119
if (GetShortPathNameW (wcbfr, wcbfr, G_N_ELEMENTS (wcbfr)) &&
120
/* Short pathnames always contain only
121
* ASCII, I think, but just in case, be
124
WideCharToMultiByte (CP_ACP, 0, wcbfr, -1,
125
cpbfr, G_N_ELEMENTS (cpbfr),
127
*cp_prefix = g_strdup (cpbfr);
128
else if (*full_prefix)
129
*cp_prefix = g_locale_from_utf8 (*full_prefix, -1,
134
if (GetModuleFileNameA ((HMODULE) hmodule, cpbfr, G_N_ELEMENTS (cpbfr))) {
135
*full_prefix = g_locale_to_utf8 (cpbfr, -1,
114
if (GetModuleFileNameW ((HMODULE) hmodule, wcbfr, G_N_ELEMENTS (wcbfr))) {
115
*full_prefix = g_utf16_to_utf8 (wcbfr, -1,
117
if (GetShortPathNameW (wcbfr, wcbfr, G_N_ELEMENTS (wcbfr)) &&
118
/* Short pathnames always contain only
119
* ASCII, I think, but just in case, be
122
WideCharToMultiByte (CP_ACP, 0, wcbfr, -1,
123
cpbfr, G_N_ELEMENTS (cpbfr),
125
*cp_prefix = g_strdup (cpbfr);
126
else if (*full_prefix)
127
*cp_prefix = g_locale_from_utf8 (*full_prefix, -1,
136
128
NULL, NULL, NULL);
137
*cp_prefix = g_strdup (cpbfr);
141
131
if (*full_prefix != NULL) {