summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gio/gwin32mount.c8
-rw-r--r--gio/gwin32registrykey.c2
-rw-r--r--gio/gwin32volumemonitor.c24
-rw-r--r--gio/win32/gwinhttpvfs.c14
-rw-r--r--glib/gbacktrace.c18
-rw-r--r--glib/gmessages.c21
-rw-r--r--glib/gutils.c20
-rw-r--r--glib/gwin32.c35
8 files changed, 85 insertions, 57 deletions
diff --git a/gio/gwin32mount.c b/gio/gwin32mount.c
index 5b4847a9d..83d8695a1 100644
--- a/gio/gwin32mount.c
+++ b/gio/gwin32mount.c
@@ -131,6 +131,9 @@ _g_win32_mount_new (GVolumeMonitor *volume_monitor,
{
GWin32Mount *mount;
const gchar *drive = path; //fixme
+ WCHAR *drive_utf16;
+
+ drive_utf16 = g_utf8_to_utf16 (drive, -1, NULL, NULL, NULL);
#if 0
/* No volume for mount: Ignore internal things */
@@ -141,7 +144,7 @@ _g_win32_mount_new (GVolumeMonitor *volume_monitor,
mount = g_object_new (G_TYPE_WIN32_MOUNT, NULL);
mount->volume_monitor = volume_monitor != NULL ? g_object_ref (volume_monitor) : NULL;
mount->mount_path = g_strdup (path);
- mount->drive_type = GetDriveType (drive);
+ mount->drive_type = GetDriveTypeW (drive_utf16);
mount->can_eject = FALSE; /* TODO */
mount->name = _win32_get_displayname (drive);
@@ -151,6 +154,9 @@ _g_win32_mount_new (GVolumeMonitor *volume_monitor,
if (volume != NULL)
_g_win32_volume_set_mount (volume, mount);
#endif
+
+ g_free (drive_utf16);
+
return mount;
}
diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
index 6b24fdd90..29895217d 100644
--- a/gio/gwin32registrykey.c
+++ b/gio/gwin32registrykey.c
@@ -2484,7 +2484,7 @@ g_win32_registry_key_watch (GWin32RegistryKey *key,
if (g_once_init_enter (&nt_notify_change_multiple_keys))
{
NtNotifyChangeMultipleKeysFunc func;
- HMODULE ntdll = GetModuleHandle ("ntdll.dll");
+ HMODULE ntdll = GetModuleHandleW (L"ntdll.dll");
if (ntdll != NULL)
func = (NtNotifyChangeMultipleKeysFunc) GetProcAddress (ntdll, "NtNotifyChangeMultipleKeys");
diff --git a/gio/gwin32volumemonitor.c b/gio/gwin32volumemonitor.c
index 83d6d3260..c6657a357 100644
--- a/gio/gwin32volumemonitor.c
+++ b/gio/gwin32volumemonitor.c
@@ -68,13 +68,13 @@ get_viewable_logical_drives (void)
DWORD no_drives;
gboolean hklm_present = FALSE;
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
- "Software\\Microsoft\\Windows\\"
- "CurrentVersion\\Policies\\Explorer",
- 0, KEY_READ, &key) == ERROR_SUCCESS)
+ if (RegOpenKeyExW (HKEY_LOCAL_MACHINE,
+ L"Software\\Microsoft\\Windows\\"
+ L"CurrentVersion\\Policies\\Explorer",
+ 0, KEY_READ, &key) == ERROR_SUCCESS)
{
- if (RegQueryValueEx (key, "NoDrives", NULL, &var_type,
- (LPBYTE) &no_drives, &no_drives_size) == ERROR_SUCCESS)
+ if (RegQueryValueExW (key, L"NoDrives", NULL, &var_type,
+ (LPBYTE) &no_drives, &no_drives_size) == ERROR_SUCCESS)
{
/* We need the bits that are set in viewable_drives, and
* unset in no_drives.
@@ -88,13 +88,13 @@ get_viewable_logical_drives (void)
/* If the key is present in HKLM then the one in HKCU should be ignored */
if (!hklm_present)
{
- if (RegOpenKeyEx (HKEY_CURRENT_USER,
- "Software\\Microsoft\\Windows\\"
- "CurrentVersion\\Policies\\Explorer",
- 0, KEY_READ, &key) == ERROR_SUCCESS)
+ if (RegOpenKeyExW (HKEY_CURRENT_USER,
+ L"Software\\Microsoft\\Windows\\"
+ L"CurrentVersion\\Policies\\Explorer",
+ 0, KEY_READ, &key) == ERROR_SUCCESS)
{
- if (RegQueryValueEx (key, "NoDrives", NULL, &var_type,
- (LPBYTE) &no_drives, &no_drives_size) == ERROR_SUCCESS)
+ if (RegQueryValueExW (key, L"NoDrives", NULL, &var_type,
+ (LPBYTE) &no_drives, &no_drives_size) == ERROR_SUCCESS)
{
viewable_drives = viewable_drives & ~no_drives;
}
diff --git a/gio/win32/gwinhttpvfs.c b/gio/win32/gwinhttpvfs.c
index 3dfac259e..03feaf983 100644
--- a/gio/win32/gwinhttpvfs.c
+++ b/gio/win32/gwinhttpvfs.c
@@ -39,20 +39,20 @@ static void
lookup_funcs (void)
{
HMODULE winhttp = NULL;
- char winhttp_dll[MAX_PATH + 100];
+ WCHAR winhttp_dll[MAX_PATH + 100];
int n;
if (lookup_done)
return;
- n = GetSystemDirectory (winhttp_dll, MAX_PATH);
+ n = GetSystemDirectoryW (winhttp_dll, MAX_PATH);
if (n > 0 && n < MAX_PATH)
{
- if (winhttp_dll[n-1] != '\\' &&
- winhttp_dll[n-1] != '/')
- strcat (winhttp_dll, "\\");
- strcat (winhttp_dll, "winhttp.dll");
- winhttp = LoadLibrary (winhttp_dll);
+ if (winhttp_dll[n-1] != L'\\' &&
+ winhttp_dll[n-1] != L'/')
+ wcscat (winhttp_dll, L"\\");
+ wcscat (winhttp_dll, L"winhttp.dll");
+ winhttp = LoadLibraryW (winhttp_dll);
}
if (winhttp != NULL)
diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c
index 479ae4281..61810735f 100644
--- a/glib/gbacktrace.c
+++ b/glib/gbacktrace.c
@@ -66,6 +66,7 @@
#include "gtypes.h"
#include "gmain.h"
#include "gprintfint.h"
+#include "gunicode.h"
#include "gutils.h"
#ifndef G_OS_WIN32
@@ -206,9 +207,20 @@ g_on_error_query (const gchar *prg_name)
/* MessageBox is allowed on UWP apps only when building against
* the debug CRT, which will set -D_DEBUG */
#if defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP)
- MessageBox (NULL, "g_on_error_query called, program terminating",
- (prg_name && *prg_name) ? prg_name : NULL,
- MB_OK|MB_ICONERROR);
+ {
+ WCHAR *caption = NULL;
+
+ if (prg_name && *prg_name)
+ {
+ caption = g_utf8_to_utf16 (prg_name, -1, NULL, NULL, NULL);
+ }
+
+ MessageBoxW (NULL, L"g_on_error_query called, program terminating",
+ caption,
+ MB_OK|MB_ICONERROR);
+
+ g_free (caption);
+ }
#else
printf ("g_on_error_query called, program '%s' terminating\n",
(prg_name && *prg_name) ? prg_name : "(null)");
diff --git a/glib/gmessages.c b/glib/gmessages.c
index ec21d5d1d..e03e6e932 100644
--- a/glib/gmessages.c
+++ b/glib/gmessages.c
@@ -1395,10 +1395,14 @@ g_logv (const gchar *log_domain,
#if defined(G_OS_WIN32) && (defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP))
if (win32_keep_fatal_message)
{
- gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
+ WCHAR *wide_msg;
- MessageBox (NULL, locale_msg, NULL,
- MB_ICONERROR|MB_SETFOREGROUND);
+ wide_msg = g_utf8_to_utf16 (fatal_msg_buf, -1, NULL, NULL, NULL);
+
+ MessageBoxW (NULL, wide_msg, NULL,
+ MB_ICONERROR | MB_SETFOREGROUND);
+
+ g_free (wide_msg);
}
#endif
@@ -2789,12 +2793,13 @@ handled:
#if defined(G_OS_WIN32) && (defined(_DEBUG) || !defined(G_WINAPI_ONLY_APP))
if (!g_test_initialized ())
{
- gchar *locale_msg = NULL;
+ WCHAR *wide_msg;
+
+ wide_msg = g_utf8_to_utf16 (fatal_msg_buf, -1, NULL, NULL, NULL);
+
+ MessageBoxW (NULL, wide_msg, NULL, MB_ICONERROR | MB_SETFOREGROUND);
- locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
- MessageBox (NULL, locale_msg, NULL,
- MB_ICONERROR | MB_SETFOREGROUND);
- g_free (locale_msg);
+ g_free (wide_msg);
}
#endif /* !G_OS_WIN32 */
diff --git a/glib/gutils.c b/glib/gutils.c
index 15c0c0037..d3e4e1953 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -1964,7 +1964,7 @@ load_user_special_dirs (void)
wchar_t *wcp;
- p_SHGetKnownFolderPath = (t_SHGetKnownFolderPath) GetProcAddress (GetModuleHandle ("shell32.dll"),
+ p_SHGetKnownFolderPath = (t_SHGetKnownFolderPath) GetProcAddress (GetModuleHandleW (L"shell32.dll"),
"SHGetKnownFolderPath");
g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = get_special_folder (CSIDL_DESKTOPDIRECTORY);
@@ -2295,26 +2295,14 @@ get_module_for_address (gconstpointer address)
{
/* Holds the g_utils_global lock */
- static gboolean beenhere = FALSE;
- typedef BOOL (WINAPI *t_GetModuleHandleExA) (DWORD, LPCTSTR, HMODULE *);
- static t_GetModuleHandleExA p_GetModuleHandleExA = NULL;
HMODULE hmodule = NULL;
if (!address)
return NULL;
- if (!beenhere)
- {
- p_GetModuleHandleExA =
- (t_GetModuleHandleExA) GetProcAddress (GetModuleHandle ("kernel32.dll"),
- "GetModuleHandleExA");
- beenhere = TRUE;
- }
-
- if (p_GetModuleHandleExA == NULL ||
- !(*p_GetModuleHandleExA) (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
- GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
- address, &hmodule))
+ if (!GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ address, &hmodule))
{
MEMORY_BASIC_INFORMATION mbi;
VirtualQuery (address, &mbi, sizeof (mbi));
diff --git a/glib/gwin32.c b/glib/gwin32.c
index fddb1d21f..b62f19461 100644
--- a/glib/gwin32.c
+++ b/glib/gwin32.c
@@ -107,12 +107,15 @@ g_win32_ftruncate (gint fd,
gchar *
g_win32_getlocale (void)
{
+ gchar *result;
LCID lcid;
LANGID langid;
const gchar *ev;
gint primary, sub;
- char iso639[10];
- char iso3166[10];
+ WCHAR iso639[10];
+ gchar *iso639_utf8;
+ WCHAR iso3166[10];
+ gchar *iso3166_utf8;
const gchar *script = NULL;
/* Let the user override the system settings through environment
@@ -127,8 +130,8 @@ g_win32_getlocale (void)
lcid = GetThreadLocale ();
- if (!GetLocaleInfo (lcid, LOCALE_SISO639LANGNAME, iso639, sizeof (iso639)) ||
- !GetLocaleInfo (lcid, LOCALE_SISO3166CTRYNAME, iso3166, sizeof (iso3166)))
+ if (!GetLocaleInfoW (lcid, LOCALE_SISO639LANGNAME, iso639, sizeof (iso639)) ||
+ !GetLocaleInfoW (lcid, LOCALE_SISO3166CTRYNAME, iso3166, sizeof (iso3166)))
return g_strdup ("C");
/* Strip off the sorting rules, keep only the language part. */
@@ -173,7 +176,16 @@ g_win32_getlocale (void)
}
break;
}
- return g_strconcat (iso639, "_", iso3166, script, NULL);
+
+ iso639_utf8 = g_utf16_to_utf8 (iso639, -1, NULL, NULL, NULL);
+ iso3166_utf8 = g_utf16_to_utf8 (iso3166, -1, NULL, NULL, NULL);
+
+ result = g_strconcat (iso639_utf8, "_", iso3166_utf8, script, NULL);
+
+ g_free (iso3166_utf8);
+ g_free (iso639_utf8);
+
+ return result;
}
/**
@@ -1062,10 +1074,11 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
{
EXCEPTION_RECORD *er;
char debugger[MAX_PATH + 1];
+ WCHAR *debugger_utf16;
const char *debugger_env = NULL;
const char *catch_list;
gboolean catch = FALSE;
- STARTUPINFO si;
+ STARTUPINFOW si;
PROCESS_INFORMATION pi;
HANDLE event;
SECURITY_ATTRIBUTES sa;
@@ -1165,11 +1178,13 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
CloseHandle (event);
return EXCEPTION_CONTINUE_SEARCH;
}
+ debugger[MAX_PATH] = '\0';
+
+ debugger_utf16 = g_utf8_to_utf16 (debugger, -1, NULL, NULL, NULL);
/* Run the debugger */
- debugger[MAX_PATH] = '\0';
- if (0 != CreateProcessA (NULL,
- debugger,
+ if (0 != CreateProcessW (NULL,
+ debugger_utf16,
NULL,
NULL,
TRUE,
@@ -1190,6 +1205,8 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
WaitForSingleObject (event, 60000);
}
+ g_free (debugger_utf16);
+
CloseHandle (event);
/* Now the debugger is present, and we can try