From 60dada364b78dc5cbf7f533e3ffce0fa53b56910 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 4 Nov 2013 04:26:40 +0000 Subject: [PATCH] - Fix condition when lParam is null and not allow it to go into exception. svn path=/trunk/; revision=60865 --- reactos/win32ss/user/ntuser/message.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/reactos/win32ss/user/ntuser/message.c b/reactos/win32ss/user/ntuser/message.c index 6d01944aceb..5e6c26ea687 100644 --- a/reactos/win32ss/user/ntuser/message.c +++ b/reactos/win32ss/user/ntuser/message.c @@ -174,7 +174,14 @@ MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam) } else if (MMS_SIZE_LPARAMSZ == MsgMemoryEntry->Size) { - Size = (UINT) ((wcslen((PWSTR) lParam) + 1) * sizeof(WCHAR)); + // WM_SETTEXT and WM_SETTINGCHANGE can be null! + if (!lParam) + { + TRACE("lParam is NULL!\n"); + Size = 0; + } + else + Size = (UINT) ((wcslen((PWSTR) lParam) + 1) * sizeof(WCHAR)); } else if (MMS_SIZE_SPECIAL == MsgMemoryEntry->Size) { @@ -436,6 +443,7 @@ CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEnt /* Copy data if required */ if (0 != (MsgMemoryEntry->Flags & MMS_FLAG_READ)) { + TRACE("Copy Message %d from usermode buffer\n", KernelModeMsg->message); Status = MmCopyFromCaller(KernelMem, (PVOID) UserModeMsg->lParam, Size); if (! NT_SUCCESS(Status)) {