Author: fireball Date: Tue Nov 2 14:01:04 2010 New Revision: 49430
URL: http://svn.reactos.org/svn/reactos?rev=49430&view=rev Log: - Fix RosBuildShellHookWndList() declaration and its usage in user32. Fixes weird crashes "here and there" (c) ROS forum.
Modified: branches/arwinss/reactos/dll/win32/user32/hook.c branches/arwinss/reactos/include/reactos/wine/rosuser.h
Modified: branches/arwinss/reactos/dll/win32/user32/hook.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/hook.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/hook.c [iso-8859-1] Tue Nov 2 14:01:04 2010 @@ -415,16 +415,19 @@
if (id == WH_SHELL) { - HWND *hook_windows = RosUserBuildShellHookHwndList(); - if (hook_windows) + HWND hook_windows[4]; // FIXME: Not a good way, but dynamic allocation all the time is stupid too + UINT cbListSize = sizeof(hook_windows); + if (!RosUserBuildShellHookHwndList(hook_windows, &cbListSize)) + { + ERR("Not enough hook windows array size!\n"); + } + else { INT wm_shellhook = RegisterWindowMessageW(L"SHELLHOOK"); - HWND* cursor = hook_windows; - - for (; *cursor; cursor++) - PostMessage(*cursor, wm_shellhook, code, wparam); - - HeapFree(GetProcessHeap(), 0, hook_windows); + INT wnd_num; + + for (wnd_num = 0; wnd_num < cbListSize / sizeof(HWND); wnd_num++) + PostMessage(hook_windows[wnd_num], wm_shellhook, code, wparam); } }
Modified: branches/arwinss/reactos/include/reactos/wine/rosuser.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos/... ============================================================================== --- branches/arwinss/reactos/include/reactos/wine/rosuser.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/wine/rosuser.h [iso-8859-1] Tue Nov 2 14:01:04 2010 @@ -164,6 +164,15 @@ APIENTRY RosUserGetAsyncKeyboardState(BYTE key_state_table[]);
+BOOL NTAPI +RosUserRegisterShellHookWindow(HWND hWnd); + +BOOL NTAPI +RosUserDeRegisterShellHookWindow(HWND hWnd); + +BOOL NTAPI +RosUserBuildShellHookHwndList(HWND *list, UINT *cbSize); + VOID NTAPI SwmAddWindow(HWND hWnd, RECT *WindowRect, DWORD style, DWORD ex_style);