From 1ebd55585524c1bf9aaecc80fbd80b72d7b36810 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 21 Sep 2009 01:22:32 +0000 Subject: [PATCH] - Working with Michael Martin to fix the LoadMenu callback bug. MenuName is a variable string buffer and not a pointer. The minimum size is always four bytes. Initialization of the structure, zero out the memory, allowing Intersource check to function as it should. To make it Intersource, use the first word character in the buffer. svn path=/trunk/; revision=43101 --- reactos/dll/win32/user32/windows/menu.c | 5 ++++- reactos/subsystems/win32/win32k/ntuser/callback.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/user32/windows/menu.c b/reactos/dll/win32/user32/windows/menu.c index 169a9c8c4ce..7b37f9f6ec4 100644 --- a/reactos/dll/win32/user32/windows/menu.c +++ b/reactos/dll/win32/user32/windows/menu.c @@ -3967,7 +3967,10 @@ User32CallLoadMenuFromKernel(PVOID Arguments, ULONG ArgumentLength) Common = (PLOADMENU_CALLBACK_ARGUMENTS) Arguments; - Result = (LRESULT)LoadMenuW(Common->hModule, IS_INTRESOURCE(Common->MenuName) ? Common->MenuName : (LPCWSTR)&Common->MenuName); + Result = (LRESULT)LoadMenuW( Common->hModule, + IS_INTRESOURCE(Common->MenuName) ? + MAKEINTRESOURCE(Common->MenuName[0]) : + (LPCWSTR)&Common->MenuName); return ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS); } diff --git a/reactos/subsystems/win32/win32k/ntuser/callback.c b/reactos/subsystems/win32/win32k/ntuser/callback.c index 6fbf4235613..efd390a1f60 100644 --- a/reactos/subsystems/win32/win32k/ntuser/callback.c +++ b/reactos/subsystems/win32/win32k/ntuser/callback.c @@ -662,11 +662,13 @@ co_IntCallLoadMenu( HINSTANCE hModule, Argument = IntCbAllocateMemory(ArgumentLength); if (NULL == Argument) { - DPRINT1("EventProc callback failed: out of memory\n"); + DPRINT1("LoadMenu callback failed: out of memory\n"); return 0; } Common = (PLOADMENU_CALLBACK_ARGUMENTS) Argument; + // Help Intersource check and MenuName is now 4 bytes + so zero it. + RtlZeroMemory(Common, ArgumentLength); Common->hModule = hModule; if (pMenuName->Length)