From 3976f06fdc3ba368ab0c4df34ff750d432366f8b Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Sun, 27 Jan 2019 04:21:24 +0000 Subject: [PATCH] Specify argument types and all parameters when calling SendMessageW from wpt font installation code This avoids a ValueError seen on Windows/arm64 when calling SendMessageW. bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1522696 gecko-commit: 684d038b8eead6588ed32b16621a1b75138783d3 gecko-integration-branch: central gecko-reviewers: jgraham --- tools/wptrunner/wptrunner/font.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/wptrunner/wptrunner/font.py b/tools/wptrunner/wptrunner/font.py index a370f5f5a3b61c..51c5578a3c9ba8 100644 --- a/tools/wptrunner/wptrunner/font.py +++ b/tools/wptrunner/wptrunner/font.py @@ -92,8 +92,14 @@ def install_windows_font(self, _, font_path): gdi32 = ctypes.WinDLL('gdi32') if gdi32.AddFontResourceW(font_path): - return bool(ctypes.windll.user32.SendMessageW(hwnd_broadcast, - wm_fontchange)) + from ctypes import wintypes + wparam = 0 + lparam = 0 + SendMessageW = ctypes.windll.user32.SendMessageW + SendMessageW.argtypes = [wintypes.HANDLE, wintypes.UINT, + wintypes.WPARAM, wintypes.LPARAM] + return bool(SendMessageW(hwnd_broadcast, wm_fontchange, + wparam, lparam)) def remove_linux_font(self, font_name, _): if self.created_dir: @@ -120,5 +126,11 @@ def remove_windows_font(self, _, font_path): gdi32 = ctypes.WinDLL('gdi32') if gdi32.RemoveFontResourceW(font_path): - return bool(ctypes.windll.user32.SendMessageW(hwnd_broadcast, - wm_fontchange)) + from ctypes import wintypes + wparam = 0 + lparam = 0 + SendMessageW = ctypes.windll.user32.SendMessageW + SendMessageW.argtypes = [wintypes.HANDLE, wintypes.UINT, + wintypes.WPARAM, wintypes.LPARAM] + return bool(SendMessageW(hwnd_broadcast, wm_fontchange, + wparam, lparam))