localspl: Fix MONITOR2.cbSize calculation when converting from MONITOREX.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2019-09-09 14:57:45 +08:00 committed by Alexandre Julliard
parent e620a3f359
commit 24a16c0037
2 changed files with 4 additions and 2 deletions

View File

@ -777,7 +777,7 @@ LPMONITOREX WINAPI InitializePrintMonitor(LPWSTR regroot)
{
static MONITOREX mymonitorex =
{
sizeof(MONITOREX) - sizeof(DWORD),
sizeof(MONITOR),
{
localmon_EnumPortsW,
localmon_OpenPortW,

View File

@ -504,7 +504,9 @@ static monitor_t * monitor_load(LPCWSTR name, LPWSTR dllname)
if (pmonitorEx)
{
/* Layout of MONITOREX and MONITOR2 mostly matches */
memcpy(&pm->monitor, pmonitorEx, min(pmonitorEx->dwMonitorSize + sizeof(DWORD), sizeof(pm->monitor)));
memcpy(&pm->monitor, pmonitorEx, min(pmonitorEx->dwMonitorSize + sizeof(void *), sizeof(pm->monitor)));
/* MONITOREX.dwMonitorSize doesn't include the size field, while MONITOR2.cbSize does */
pm->monitor.cbSize += sizeof(void *);
pm->old_XcvOpenPort = pmonitorEx->Monitor.pfnXcvOpenPort;
pm->monitor.pfnXcvOpenPort = NULL;
}