Commit in reactos on MAIN
lib/user32/windows/nonclient.c+30-151.57 -> 1.58
subsys/win32k/ntuser/message.c+22-231.67 -> 1.68
+52-38
2 modified files
1. reverted my last change to SendMessageTimeout() which was wrong
2. fixed UserGetWindowIcon(), SendMessageTimeout() usually overwrites the result variable, even if it failed!

reactos/lib/user32/windows
nonclient.c 1.57 -> 1.58
diff -u -r1.57 -r1.58
--- nonclient.c	20 May 2004 14:53:14 -0000	1.57
+++ nonclient.c	22 May 2004 09:22:41 -0000	1.58
@@ -147,23 +147,38 @@
 HICON 
 UserGetWindowIcon(HWND hwnd)
 {
-  HICON Ret = 0;
+  HICON Ret;
   
-  SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret);
-  if (!Ret)
-    SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret);
-  if (!Ret)
-    SendMessageTimeoutW(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret);
-  if (!Ret)
-    Ret = (HICON)GetClassLongW(hwnd, GCL_HICONSM);
-  if (!Ret)
-    Ret = (HICON)GetClassLongW(hwnd, GCL_HICON);
-  if (!Ret)
-    SendMessageTimeoutW(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&Ret);
-  if (!Ret)
-    Ret = LoadIconW(0, IDI_APPLICATION);
+  if(SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret) && Ret)
+  {
+    return Ret;
+  }
+  if(SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret) && Ret)
+  {
+    return Ret;
+  }
+  if(SendMessageTimeoutW(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret) && Ret)
+  {
+    return Ret;
+  }
+  if((Ret = (HICON)GetClassLongW(hwnd, GCL_HICONSM)))
+  {
+    return Ret;
+  }
+  if((Ret = (HICON)GetClassLongW(hwnd, GCL_HICON)))
+  {
+    return Ret;
+  }
+  if(SendMessageTimeoutW(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&Ret) && Ret)
+  {
+    return Ret;
+  }
+  if((Ret = LoadIconW(0, IDI_APPLICATION)))
+  {
+    return Ret;
+  }
   
-  return Ret;
+  return NULL;
 }
 
 BOOL

reactos/subsys/win32k/ntuser
message.c 1.67 -> 1.68
diff -u -r1.67 -r1.68
--- message.c	22 May 2004 08:27:15 -0000	1.67
+++ message.c	22 May 2004 09:22:41 -0000	1.68
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: message.c,v 1.67 2004/05/22 08:27:15 weiden Exp $
+/* $Id: message.c,v 1.68 2004/05/22 09:22:41 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -38,6 +38,7 @@
 {
   UINT uFlags;
   UINT uTimeout;
+  ULONG_PTR Result;
 } DOSENDMESSAGE, *PDOSENDMESSAGE;
 
 /* FUNCTIONS *****************************************************************/
@@ -1116,10 +1117,10 @@
                WPARAM wParam,
                LPARAM lParam)
 {
-  LRESULT Result = 0;
+  ULONG_PTR Result = 0;
   if(IntSendMessageTimeout(hWnd, Msg, wParam, lParam, SMTO_NORMAL, 0, &Result))
   {
-    return Result;
+    return (LRESULT)Result;
   }
   return 0;
 }
@@ -1133,7 +1134,7 @@
                             UINT uTimeout,
                             ULONG_PTR *uResult)
 {
-  LRESULT Result;
+  ULONG_PTR Result;
   NTSTATUS Status;
   PWINDOW_OBJECT Window;
   PMSGMEMORY MsgMemoryEntry;
@@ -1180,26 +1181,28 @@
         }
       if (0xFFFF0000 != ((DWORD) Window->WndProcW & 0xFFFF0000))
         {
-          Result = IntCallWindowProc(Window->WndProcW, FALSE, hWnd, Msg, wParam,
-                                     lParamPacked,lParamBufferSize);
+          Result = (ULONG_PTR)IntCallWindowProc(Window->WndProcW, FALSE, hWnd, Msg, wParam,
+                                                lParamPacked,lParamBufferSize);
         }
       else
         {
-          Result = IntCallWindowProc(Window->WndProcA, TRUE, hWnd, Msg, wParam,
-                                     lParamPacked,lParamBufferSize);
+          Result = (ULONG_PTR)IntCallWindowProc(Window->WndProcA, TRUE, hWnd, Msg, wParam,
+                                                lParamPacked,lParamBufferSize);
         }
+      
+      if(uResult)
+      {
+        *uResult = Result;
+      }
+      
       if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam)))
         {
           IntReleaseWindowObject(Window);
           DPRINT1("Failed to unpack message parameters\n");
-          if(uResult)
-            *uResult = Result;
           return TRUE;
         }
 
       IntReleaseWindowObject(Window);
-      if(uResult)
-        *uResult = Result;
       return TRUE;
     }
   
@@ -1211,19 +1214,15 @@
   }
   
   Status = MsqSendMessage(Window->MessageQueue, hWnd, Msg, wParam, lParam, 
-                          uTimeout, (uFlags & SMTO_BLOCK), &Result);
+                          uTimeout, (uFlags & SMTO_BLOCK), uResult);
   if(Status == STATUS_TIMEOUT)
   {
     IntReleaseWindowObject(Window);
-    if(uResult)
-      *uResult = Result;
     SetLastWin32Error(ERROR_TIMEOUT);
     return FALSE;
   }
 
   IntReleaseWindowObject(Window);
-  if(uResult)
-    *uResult = Result;
   return TRUE;
 }
 
@@ -1278,7 +1277,7 @@
                      WPARAM wParam,
                      LPARAM lParam)
 {
-  LRESULT Result;
+  ULONG_PTR Result;
   PWINDOW_OBJECT Window;
   
   if(hWnd == HWND_BROADCAST)
@@ -1307,7 +1306,7 @@
   
   IntReleaseWindowObject(Window);
   
-  return Result;
+  return (LRESULT)Result;
 }
 
 LRESULT FASTCALL
@@ -1407,7 +1406,7 @@
       {
         Result = IntSendMessageTimeout(KernelModeMsg.hwnd, KernelModeMsg.message,
                                        KernelModeMsg.wParam, KernelModeMsg.lParam,
-                                       dsm->uFlags, dsm->uTimeout, &Result);
+                                       dsm->uFlags, dsm->uTimeout, &dsm->Result);
       }
       Status = CopyMsgToUserMem(&UserModeMsg, &KernelModeMsg);
       if (! NT_SUCCESS(Status))
@@ -1424,7 +1423,7 @@
       SetLastWin32Error(ERROR_INVALID_PARAMETER);
     }
 
-  return Result;
+  return (LRESULT)Result;
 }
 
 LRESULT STDCALL
@@ -1443,11 +1442,11 @@
   dsm.uFlags = uFlags;
   dsm.uTimeout = uTimeout;
   Result = IntDoSendMessage(hWnd, Msg, wParam, lParam, &dsm, UnsafeInfo);
-  if(uResult)
+  if(uResult != NULL && Result != 0)
   {
     NTSTATUS Status;
     
-    Status = MmCopyToCaller(uResult, &Result, sizeof(ULONG_PTR));
+    Status = MmCopyToCaller(uResult, &dsm.Result, sizeof(ULONG_PTR));
     if(!NT_SUCCESS(Status))
     {
       SetLastWin32Error(ERROR_INVALID_PARAMETER);
CVSspam 0.2.8