[ros-diffs] [jimtabor] 43101: - 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.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Mon Sep 21 03:22:33 CEST 2009


Author: jimtabor
Date: Mon Sep 21 03:22:32 2009
New Revision: 43101

URL: http://svn.reactos.org/svn/reactos?rev=43101&view=rev
Log:
- 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.

Modified:
    trunk/reactos/dll/win32/user32/windows/menu.c
    trunk/reactos/subsystems/win32/win32k/ntuser/callback.c

Modified: trunk/reactos/dll/win32/user32/windows/menu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/menu.c?rev=43101&r1=43100&r2=43101&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Mon Sep 21 03:22:32 2009
@@ -3967,7 +3967,10 @@
 
   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);
 }

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/callback.c?rev=43101&r1=43100&r2=43101&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Mon Sep 21 03:22:32 2009
@@ -662,11 +662,13 @@
    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)




More information about the Ros-diffs mailing list