[ros-diffs] [fireball] 49429: - Fix RosUserBuildShellhookWndList() implementation in win32k.

fireball at svn.reactos.org fireball at svn.reactos.org
Tue Nov 2 13:57:45 UTC 2010


Author: fireball
Date: Tue Nov  2 13:57:43 2010
New Revision: 49429

URL: http://svn.reactos.org/svn/reactos?rev=49429&view=rev
Log:
- Fix RosUserBuildShellhookWndList() implementation in win32k.

Modified:
    branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
    branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c

Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db?rev=49429&r1=49428&r2=49429&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Tue Nov  2 13:57:43 2010
@@ -84,7 +84,7 @@
 RosUserGetAsyncKeyState            1
 RosUserRegisterShellHookWindow     1
 RosUserDeRegisterShellHookWindow   1
-RosUserBuildShellHookHwndList      0
+RosUserBuildShellHookHwndList      2
 SwmAddWindow                       4
 SwmAddDesktopWindow                3
 SwmRemoveWindow                    1

Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c?rev=49429&r1=49428&r2=49429&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] Tue Nov  2 13:57:43 2010
@@ -242,15 +242,15 @@
     return FALSE;
 }
 
-HWND * NTAPI
-RosUserBuildShellHookHwndList()
+BOOL NTAPI
+RosUserBuildShellHookHwndList(HWND *list, UINT *cbSize)
 {
     //PPROCESSINFO process = PsGetCurrentProcessWin32Process();
     //struct desktop *desktop;
     struct list *entry, *shell_hooks;
     PSHELL_HOOK_WINDOW hook_entry;
     ULONG entries=0;
-    HWND* list = NULL;
+    NTSTATUS Status = STATUS_SUCCESS;
 
     UserEnterExclusive();
 
@@ -266,22 +266,47 @@
         {
             //release_object( desktop );
             UserLeave();
-            return NULL;
-        }
-
-        list = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(HWND) * (entries + 1)); /* alloc one extra for nullterm */
-        if (list)
-        {
-            HWND* cursor = list;
-
-            LIST_FOR_EACH(entry, shell_hooks)
+            return FALSE;
+        }
+
+        /* Check if enough user buffer was provided */
+        if (*cbSize < sizeof(HWND) * entries)
+        {
+            *cbSize = sizeof(HWND) * entries;
+            //release_object( desktop );
+            UserLeave();
+            return FALSE;
+        }
+
+        /* Fill the list */
+        _SEH2_TRY
+        {
+            if (list)
             {
-                hook_entry = LIST_ENTRY( entry, SHELL_HOOK_WINDOW, ListEntry );
-
-                *cursor++ = hook_entry->hWnd;
+                HWND* cursor = list;
+
+                LIST_FOR_EACH(entry, shell_hooks)
+                {
+                    hook_entry = LIST_ENTRY( entry, SHELL_HOOK_WINDOW, ListEntry );
+
+                    *cursor++ = hook_entry->hWnd;
+                }
+
+                *cbSize = sizeof(HWND) * entries;
             }
-
-            *cursor = NULL; /* nullterm list */
+        }
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+        {
+            Status = _SEH2_GetExceptionCode();
+        }
+        _SEH2_END;
+
+        /* Return error in case of exception */
+        if (!NT_SUCCESS(Status))
+        {
+            //release_object( desktop );
+            UserLeave();
+            return FALSE;
         }
 
         //release_object( desktop );
@@ -289,7 +314,7 @@
 
     UserLeave();
 
-    return list;
+    return TRUE;
 }
 
 /* EOF */




More information about the Ros-diffs mailing list