[ros-diffs] [fireball] 45455: [vendor/wine] - Import Wine-1.1.38 gdi32, user32, winex11.drv, wineserver.

fireball at svn.reactos.org fireball at svn.reactos.org
Sat Feb 6 11:06:44 CET 2010


Author: fireball
Date: Sat Feb  6 11:06:43 2010
New Revision: 45455

URL: http://svn.reactos.org/svn/reactos?rev=45455&view=rev
Log:
[vendor/wine]
- Import Wine-1.1.38 gdi32, user32, winex11.drv, wineserver.

Modified:
    vendor/wine/dlls/gdi32/current/gdi32.spec
    vendor/wine/dlls/gdi32/current/gdiobj.c
    vendor/wine/dlls/gdi32/current/mfdrv/objects.c
    vendor/wine/dlls/user32/current/class.c
    vendor/wine/dlls/user32/current/combo.c
    vendor/wine/dlls/user32/current/controls.h
    vendor/wine/dlls/user32/current/cursoricon.c
    vendor/wine/dlls/user32/current/defwnd.c
    vendor/wine/dlls/user32/current/dialog.c
    vendor/wine/dlls/user32/current/hook.c
    vendor/wine/dlls/user32/current/message.c
    vendor/wine/dlls/user32/current/misc.c
    vendor/wine/dlls/user32/current/msgbox.c
    vendor/wine/dlls/user32/current/property.c
    vendor/wine/dlls/user32/current/resource.c
    vendor/wine/dlls/user32/current/tests/combo.c
    vendor/wine/dlls/user32/current/tests/edit.c
    vendor/wine/dlls/user32/current/tests/msg.c
    vendor/wine/dlls/user32/current/tests/win.c
    vendor/wine/dlls/user32/current/win.c
    vendor/wine/dlls/winex11.drv/current/window.c
    vendor/wine/server/current/process.c
    vendor/wine/server/current/thread.c
    vendor/wine/server/current/thread.h

Modified: vendor/wine/dlls/gdi32/current/gdi32.spec
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/gdi32.spec?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/gdi32.spec [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/gdi32.spec [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -193,7 +193,7 @@
 @ stdcall GdiGetSpoolMessage(ptr long ptr long)
 @ stdcall GdiGradientFill(long ptr long ptr long long) 
 @ stdcall GdiInitSpool()
-# @ stub GdiInitializeLanguagePack
+@ stdcall GdiInitializeLanguagePack(long)
 @ stdcall GdiIsMetaFileDC(long)
 @ stdcall GdiIsMetaPrintDC(long)
 @ stdcall GdiIsPlayMetafileDC(long)

Modified: vendor/wine/dlls/gdi32/current/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/gdiobj.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/gdiobj.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/gdiobj.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -1164,6 +1164,14 @@
     /* Nothing to do */
 }
 
+/***********************************************************************
+ *           GdiInitializeLanguagePack    (GDI32.@)
+ */
+DWORD WINAPI GdiInitializeLanguagePack( DWORD arg )
+{
+    FIXME("stub\n");
+    return 0;
+}
 
 /***********************************************************************
  *           GdiFlush    (GDI32.@)
@@ -1199,7 +1207,7 @@
  */
 BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca)
 {
-        FIXME("GetColorAdjustment, stub\n");
+        FIXME("stub\n");
         return 0;
 }
 
@@ -1228,6 +1236,6 @@
  */
 BOOL WINAPI SetColorAdjustment(HDC hdc, const COLORADJUSTMENT* lpca)
 {
-        FIXME("SetColorAdjustment, stub\n");
+        FIXME("stub\n");
         return 0;
 }

Modified: vendor/wine/dlls/gdi32/current/mfdrv/objects.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/mfdrv/objects.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/mfdrv/objects.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/mfdrv/objects.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -365,6 +365,7 @@
     char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)];
     METARECORD *mr = (METARECORD *)&buffer;
     LOGFONT16 *font16;
+    INT written;
 
     mr->rdSize = (sizeof(METARECORD) + sizeof(LOGFONT16) - 2) / 2;
     mr->rdFunction = META_CREATEFONTINDIRECT;
@@ -383,8 +384,9 @@
     font16->lfClipPrecision  = logfont->lfClipPrecision;
     font16->lfQuality        = logfont->lfQuality;
     font16->lfPitchAndFamily = logfont->lfPitchAndFamily;
-    WideCharToMultiByte( CP_ACP, 0, logfont->lfFaceName, -1, font16->lfFaceName, LF_FACESIZE, NULL, NULL );
-    font16->lfFaceName[LF_FACESIZE-1] = 0;
+    written = WideCharToMultiByte( CP_ACP, 0, logfont->lfFaceName, -1, font16->lfFaceName, LF_FACESIZE - 1, NULL, NULL );
+    /* Zero pad the facename buffer, so that we don't write uninitialized data to disk */
+    memset(font16->lfFaceName + written, 0, LF_FACESIZE - written);
 
     if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * 2)))
         return 0;

Modified: vendor/wine/dlls/user32/current/class.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/class.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/class.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/class.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -176,7 +176,7 @@
  */
 static inline LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
 {
-    if (!HIWORD(classPtr->menuName)) return (LPSTR)classPtr->menuName;
+    if (IS_INTRESOURCE(classPtr->menuName)) return (LPSTR)classPtr->menuName;
     return (LPSTR)(classPtr->menuName + strlenW(classPtr->menuName) + 1);
 }
 
@@ -199,8 +199,8 @@
  */
 static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
 {
-    if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
-    if (HIWORD(name))
+    if (!IS_INTRESOURCE(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
+    if (!IS_INTRESOURCE(name))
     {
         DWORD lenA = strlen(name) + 1;
         DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 );
@@ -219,8 +219,8 @@
  */
 static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
 {
-    if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
-    if (HIWORD(name))
+    if (!IS_INTRESOURCE(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
+    if (!IS_INTRESOURCE(name))
     {
         DWORD lenW = strlenW(name) + 1;
         DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL );

Modified: vendor/wine/dlls/user32/current/combo.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/combo.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/combo.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/combo.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -1910,8 +1910,14 @@
 	case WM_GETFONT:
 		return  (LRESULT)lphc->hFont;
 	case WM_SETFOCUS:
-		if( lphc->wState & CBF_EDIT )
-		    SetFocus( lphc->hWndEdit );
+               if( lphc->wState & CBF_EDIT ) {
+                   SetFocus( lphc->hWndEdit );
+                   /* The first time focus is received, select all the text */
+                   if( !(lphc->wState & CBF_BEENFOCUSED) ) {
+                       SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
+                       lphc->wState |= CBF_BEENFOCUSED;
+                   }
+               }
 		else
 		    COMBO_SetFocus( lphc );
 		return  TRUE;

Modified: vendor/wine/dlls/user32/current/controls.h
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/controls.h?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/controls.h [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/controls.h [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -199,6 +199,7 @@
 #define CBF_SELCHANGE           0x0400
 #define CBF_NOEDITNOTIFY        0x1000
 #define CBF_NOLBSELECT          0x2000  /* do not change current selection */
+#define CBF_BEENFOCUSED         0x4000  /* has it ever had focus           */
 #define CBF_EUI                 0x8000
 
 /* combo state struct */

Modified: vendor/wine/dlls/user32/current/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/cursoricon.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/cursoricon.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/cursoricon.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -2467,7 +2467,7 @@
     HANDLE res;
     LPWSTR u_name;
 
-    if (!HIWORD(name))
+    if (IS_INTRESOURCE(name))
         return LoadImageW(hinst, (LPCWSTR)name, type, desiredx, desiredy, loadflags);
 
     __TRY {

Modified: vendor/wine/dlls/user32/current/defwnd.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/defwnd.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/defwnd.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/defwnd.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -563,7 +563,7 @@
         else if( wParam == VK_F10 )
         {
             if (GetKeyState(VK_SHIFT) & 0x8000)
-                SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, MAKELPARAM(-1, -1) );
+                SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, -1 );
             iF10Key = 1;
         }
         else if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
@@ -835,7 +835,7 @@
             CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
             /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
              * may have child window IDs instead of window name */
-            if (HIWORD(cs->lpszName))
+            if (!IS_INTRESOURCE(cs->lpszName))
                 DEFWND_SetTextA( hwnd, cs->lpszName );
             result = 1;
         }
@@ -982,7 +982,7 @@
             CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
             /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
              * may have child window IDs instead of window name */
-            if (HIWORD(cs->lpszName))
+            if (!IS_INTRESOURCE(cs->lpszName))
                 DEFWND_SetTextW( hwnd, cs->lpszName );
             result = 1;
         }

Modified: vendor/wine/dlls/user32/current/dialog.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/dialog.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/dialog.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/dialog.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -288,14 +288,14 @@
             LPSTR class_tmp = NULL;
             LPSTR caption_tmp = NULL;
 
-            if (HIWORD(class))
+            if (!IS_INTRESOURCE(class))
             {
                 DWORD len = WideCharToMultiByte( CP_ACP, 0, info.className, -1, NULL, 0, NULL, NULL );
                 class_tmp = HeapAlloc( GetProcessHeap(), 0, len );
                 WideCharToMultiByte( CP_ACP, 0, info.className, -1, class_tmp, len, NULL, NULL );
                 class = class_tmp;
             }
-            if (HIWORD(caption))
+            if (!IS_INTRESOURCE(caption))
             {
                 DWORD len = WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, NULL, 0, NULL, NULL );
                 caption_tmp = HeapAlloc( GetProcessHeap(), 0, len );
@@ -634,14 +634,14 @@
         LPSTR class_tmp = NULL;
         LPSTR caption_tmp = NULL;
 
-        if (HIWORD(class))
+        if (!IS_INTRESOURCE(class))
         {
             DWORD len = WideCharToMultiByte( CP_ACP, 0, template.className, -1, NULL, 0, NULL, NULL );
             class_tmp = HeapAlloc( GetProcessHeap(), 0, len );
             WideCharToMultiByte( CP_ACP, 0, template.className, -1, class_tmp, len, NULL, NULL );
             class = class_tmp;
         }
-        if (HIWORD(caption))
+        if (!IS_INTRESOURCE(caption))
         {
             DWORD len = WideCharToMultiByte( CP_ACP, 0, template.caption, -1, NULL, 0, NULL, NULL );
             caption_tmp = HeapAlloc( GetProcessHeap(), 0, len );

Modified: vendor/wine/dlls/user32/current/hook.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/hook.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/hook.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/hook.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -222,12 +222,12 @@
         cbtcwW.hwndInsertAfter = cbtcwA->hwndInsertAfter;
         csW = *(CREATESTRUCTW *)cbtcwA->lpcs;
 
-        if (HIWORD(cbtcwA->lpcs->lpszName))
+        if (!IS_INTRESOURCE(cbtcwA->lpcs->lpszName))
         {
             RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName);
             csW.lpszName = nameW = usBuffer.Buffer;
         }
-        if (HIWORD(cbtcwA->lpcs->lpszClass))
+        if (!IS_INTRESOURCE(cbtcwA->lpcs->lpszClass))
         {
             RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszClass);
             csW.lpszClass = classW = usBuffer.Buffer;
@@ -262,14 +262,14 @@
         cbtcwA.hwndInsertAfter = cbtcwW->hwndInsertAfter;
         csA = *(CREATESTRUCTA *)cbtcwW->lpcs;
 
-        if (HIWORD(cbtcwW->lpcs->lpszName)) {
+        if (!IS_INTRESOURCE(cbtcwW->lpcs->lpszName)) {
             len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, NULL, 0, NULL, NULL );
             nameA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
             WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, nameA, len, NULL, NULL );
             csA.lpszName = nameA;
         }
 
-        if (HIWORD(cbtcwW->lpcs->lpszClass)) {
+        if (!IS_INTRESOURCE(cbtcwW->lpcs->lpszClass)) {
             len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, NULL, 0, NULL, NULL );
             classA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
             WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, classA, len, NULL, NULL );

Modified: vendor/wine/dlls/user32/current/message.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/message.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/message.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/message.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -545,8 +545,8 @@
     {
         CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
         push_data( data, cs, sizeof(*cs) );
-        if (HIWORD(cs->lpszName)) push_string( data, cs->lpszName );
-        if (HIWORD(cs->lpszClass)) push_string( data, cs->lpszClass );
+        if (!IS_INTRESOURCE(cs->lpszName)) push_string( data, cs->lpszName );
+        if (!IS_INTRESOURCE(cs->lpszClass)) push_string( data, cs->lpszClass );
         return sizeof(*cs);
     }
     case WM_GETTEXT:
@@ -689,8 +689,8 @@
     {
         MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lparam;
         push_data( data, cs, sizeof(*cs) );
-        if (HIWORD(cs->szTitle)) push_string( data, cs->szTitle );
-        if (HIWORD(cs->szClass)) push_string( data, cs->szClass );
+        if (!IS_INTRESOURCE(cs->szTitle)) push_string( data, cs->szTitle );
+        if (!IS_INTRESOURCE(cs->szClass)) push_string( data, cs->szClass );
         return sizeof(*cs);
     }
     case WM_MDIGETACTIVE:
@@ -784,14 +784,14 @@
         WCHAR *str = (WCHAR *)(cs + 1);
         if (size < sizeof(*cs)) return FALSE;
         size -= sizeof(*cs);
-        if (HIWORD(cs->lpszName))
+        if (!IS_INTRESOURCE(cs->lpszName))
         {
             if (!check_string( str, size )) return FALSE;
             cs->lpszName = str;
             size -= (strlenW(str) + 1) * sizeof(WCHAR);
             str += strlenW(str) + 1;
         }
-        if (HIWORD(cs->lpszClass))
+        if (!IS_INTRESOURCE(cs->lpszClass))
         {
             if (!check_string( str, size )) return FALSE;
             cs->lpszClass = str;
@@ -956,14 +956,14 @@
         WCHAR *str = (WCHAR *)(cs + 1);
         if (size < sizeof(*cs)) return FALSE;
         size -= sizeof(*cs);
-        if (HIWORD(cs->szTitle))
+        if (!IS_INTRESOURCE(cs->szTitle))
         {
             if (!check_string( str, size )) return FALSE;
             cs->szTitle = str;
             size -= (strlenW(str) + 1) * sizeof(WCHAR);
             str += strlenW(str) + 1;
         }
-        if (HIWORD(cs->szClass))
+        if (!IS_INTRESOURCE(cs->szClass))
         {
             if (!check_string( str, size )) return FALSE;
             cs->szClass = str;

Modified: vendor/wine/dlls/user32/current/misc.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/misc.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/misc.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/misc.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -277,6 +277,8 @@
 static const WCHAR primary_device_name[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
 static const WCHAR primary_device_string[] = {'X','1','1',' ','W','i','n','d','o','w','i','n','g',' ',
                                               'S','y','s','t','e','m',0};
+static const WCHAR primary_device_deviceid[] = {'P','C','I','\\','V','E','N','_','0','0','0','0','&',
+                                                'D','E','V','_','0','0','0','0',0};
 
 /***********************************************************************
  *		EnumDisplayDevicesA (USER32.@)
@@ -331,7 +333,7 @@
         DISPLAY_DEVICE_VGA_COMPATIBLE;
 
     if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(lpDisplayDevice->DeviceID))
-        lpDisplayDevice->DeviceID[0] = 0;
+        memcpy(lpDisplayDevice->DeviceID, primary_device_deviceid, sizeof(primary_device_deviceid));
     if(lpDisplayDevice->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(lpDisplayDevice->DeviceKey))
         lpDisplayDevice->DeviceKey[0] = 0;
 

Modified: vendor/wine/dlls/user32/current/msgbox.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/msgbox.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/msgbox.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/msgbox.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -92,7 +92,7 @@
     /* set text font */
     SendDlgItemMessageW (hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)hFont, 0);
 
-    if (HIWORD(lpmb->lpszCaption)) {
+    if (!IS_INTRESOURCE(lpmb->lpszCaption)) {
        SetWindowTextW(hwnd, lpmb->lpszCaption);
     } else {
         UINT len = LoadStringW( lpmb->hInstance, LOWORD(lpmb->lpszCaption), (LPWSTR)&ptr, 0 );
@@ -107,9 +107,7 @@
             buffer = NULL;
         }
     }
-    if (HIWORD(lpmb->lpszText)) {
-       lpszText = lpmb->lpszText;
-    } else {
+    if (IS_INTRESOURCE(lpmb->lpszText)) {
         UINT len = LoadStringW( lpmb->hInstance, LOWORD(lpmb->lpszText), (LPWSTR)&ptr, 0 );
         lpszText = buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
         if (buffer)
@@ -117,6 +115,8 @@
             memcpy( buffer, ptr, len * sizeof(WCHAR) );
             buffer[len] = 0;
         }
+    } else {
+       lpszText = lpmb->lpszText;
     }
 
     TRACE_(msgbox)("%s\n", debugstr_w(lpszText));
@@ -460,21 +460,21 @@
     UNICODE_STRING textW, captionW, iconW;
     int ret;
 
-    if (HIWORD(msgbox->lpszText))
+    if (IS_INTRESOURCE(msgbox->lpszText))
+        textW.Buffer = (LPWSTR)msgbox->lpszText;
+    else
         RtlCreateUnicodeStringFromAsciiz(&textW, msgbox->lpszText);
+    if (IS_INTRESOURCE(msgbox->lpszCaption))
+        captionW.Buffer = (LPWSTR)msgbox->lpszCaption;
     else
-        textW.Buffer = (LPWSTR)msgbox->lpszText;
-    if (HIWORD(msgbox->lpszCaption))
         RtlCreateUnicodeStringFromAsciiz(&captionW, msgbox->lpszCaption);
-    else
-        captionW.Buffer = (LPWSTR)msgbox->lpszCaption;
 
     if (msgbox->dwStyle & MB_USERICON)
     {
-        if (HIWORD(msgbox->lpszIcon))
+        if (IS_INTRESOURCE(msgbox->lpszIcon))
+            iconW.Buffer = (LPWSTR)msgbox->lpszIcon;
+        else
             RtlCreateUnicodeStringFromAsciiz(&iconW, msgbox->lpszIcon);
-        else
-            iconW.Buffer = (LPWSTR)msgbox->lpszIcon;
     }
     else
         iconW.Buffer = NULL;
@@ -492,9 +492,9 @@
 
     ret = MessageBoxIndirectW(&msgboxW);
 
-    if (HIWORD(textW.Buffer)) RtlFreeUnicodeString(&textW);
-    if (HIWORD(captionW.Buffer)) RtlFreeUnicodeString(&captionW);
-    if (HIWORD(iconW.Buffer)) RtlFreeUnicodeString(&iconW);
+    if (!IS_INTRESOURCE(textW.Buffer)) RtlFreeUnicodeString(&textW);
+    if (!IS_INTRESOURCE(captionW.Buffer)) RtlFreeUnicodeString(&captionW);
+    if (!IS_INTRESOURCE(iconW.Buffer)) RtlFreeUnicodeString(&iconW);
     return ret;
 }
 

Modified: vendor/wine/dlls/user32/current/property.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/property.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/property.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/property.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -118,7 +118,7 @@
 {
     WCHAR buffer[ATOM_BUFFER_SIZE];
 
-    if (!HIWORD(str)) return GetPropW( hwnd, (LPCWSTR)str );
+    if (IS_INTRESOURCE(str)) return GetPropW( hwnd, (LPCWSTR)str );
     if (!MultiByteToWideChar( CP_ACP, 0, str, -1, buffer, ATOM_BUFFER_SIZE )) return 0;
     return GetPropW( hwnd, buffer );
 }
@@ -134,7 +134,7 @@
     SERVER_START_REQ( get_window_property )
     {
         req->window = wine_server_user_handle( hwnd );
-        if (!HIWORD(str)) req->atom = LOWORD(str);
+        if (IS_INTRESOURCE(str)) req->atom = LOWORD(str);
         else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
         if (!wine_server_call_err( req )) ret = reply->data;
     }
@@ -150,7 +150,7 @@
 {
     WCHAR buffer[ATOM_BUFFER_SIZE];
 
-    if (!HIWORD(str)) return SetPropW( hwnd, (LPCWSTR)str, handle );
+    if (IS_INTRESOURCE(str)) return SetPropW( hwnd, (LPCWSTR)str, handle );
     if (!MultiByteToWideChar( CP_ACP, 0, str, -1, buffer, ATOM_BUFFER_SIZE )) return FALSE;
     return SetPropW( hwnd, buffer, handle );
 }
@@ -167,7 +167,7 @@
     {
         req->window = wine_server_user_handle( hwnd );
         req->data   = (ULONG_PTR)handle;
-        if (!HIWORD(str)) req->atom = LOWORD(str);
+        if (IS_INTRESOURCE(str)) req->atom = LOWORD(str);
         else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
         ret = !wine_server_call_err( req );
     }
@@ -183,7 +183,7 @@
 {
     WCHAR buffer[ATOM_BUFFER_SIZE];
 
-    if (!HIWORD(str)) return RemovePropW( hwnd, (LPCWSTR)str );
+    if (IS_INTRESOURCE(str)) return RemovePropW( hwnd, (LPCWSTR)str );
     if (!MultiByteToWideChar( CP_ACP, 0, str, -1, buffer, ATOM_BUFFER_SIZE )) return 0;
     return RemovePropW( hwnd, buffer );
 }
@@ -199,7 +199,7 @@
     SERVER_START_REQ( remove_window_property )
     {
         req->window = wine_server_user_handle( hwnd );
-        if (!HIWORD(str)) req->atom = LOWORD(str);
+        if (IS_INTRESOURCE(str)) req->atom = LOWORD(str);
         else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
         if (!wine_server_call_err( req )) ret = reply->data;
     }

Modified: vendor/wine/dlls/user32/current/resource.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/resource.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/resource.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/resource.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -83,7 +83,7 @@
     LPWSTR uni;
     HACCEL result = 0;
 
-    if (!HIWORD(lpTableName)) return LoadAcceleratorsW( instance, (LPCWSTR)lpTableName );
+    if (IS_INTRESOURCE(lpTableName)) return LoadAcceleratorsW( instance, (LPCWSTR)lpTableName );
 
     len = MultiByteToWideChar( CP_ACP, 0, lpTableName, -1, NULL, 0 );
     if ((uni = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))

Modified: vendor/wine/dlls/user32/current/tests/combo.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/combo.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/combo.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/combo.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -401,6 +401,106 @@
     DestroyWindow(hCombo);
 }
 
+static void test_editselection(void)
+{
+    HWND hCombo;
+    INT start,end;
+    HWND hEdit;
+    COMBOBOXINFO cbInfo;
+    BOOL ret;
+    DWORD len;
+    BOOL (WINAPI *pGetComboBoxInfo)(HWND, PCOMBOBOXINFO);
+    char edit[20];
+
+    pGetComboBoxInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo");
+    if (!pGetComboBoxInfo){
+        win_skip("GetComboBoxInfo is not available\n");
+        return;
+    }
+
+    /* Build a combo */
+    hCombo = build_combo(CBS_SIMPLE);
+    cbInfo.cbSize = sizeof(COMBOBOXINFO);
+    SetLastError(0xdeadbeef);
+    ret = pGetComboBoxInfo(hCombo, &cbInfo);
+    ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+       GetLastError());
+    hEdit = cbInfo.hwndItem;
+
+    /* Initially combo selection is empty*/
+    len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+    ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
+
+    /* Set some text, and press a key to replace it */
+    edit[0] = 0x00;
+    SendMessage(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason1");
+    SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+    ok(strcmp(edit, "Jason1")==0, "Unexpected text retrieved %s\n", edit);
+
+    /* Now what is the selection - still empty */
+    SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
+    len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+    ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
+
+    /* Give it focus, and it gets selected */
+    SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
+    SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
+    len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+    ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==6, "Unexpected end position for selection %d\n", HIWORD(len));
+
+    /* Now emulate a key press */
+    edit[0] = 0x00;
+    SendMessage(hCombo, WM_CHAR, 'A', 0x1c0001);
+    SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+    ok(strcmp(edit, "A")==0, "Unexpected text retrieved %s\n", edit);
+
+    len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+    ok(LOWORD(len)==1, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==1, "Unexpected end position for selection %d\n", HIWORD(len));
+
+    /* Now what happens when it gets more focus a second time - it doesnt reselect */
+    SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
+    len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+    ok(LOWORD(len)==1, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==1, "Unexpected end position for selection %d\n", HIWORD(len));
+    DestroyWindow(hCombo);
+
+    /* Start again - Build a combo */
+    hCombo = build_combo(CBS_SIMPLE);
+    cbInfo.cbSize = sizeof(COMBOBOXINFO);
+    SetLastError(0xdeadbeef);
+    ret = pGetComboBoxInfo(hCombo, &cbInfo);
+    ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+       GetLastError());
+    hEdit = cbInfo.hwndItem;
+
+    /* Set some text and give focus so it gets selected */
+    edit[0] = 0x00;
+    SendMessage(hCombo, WM_SETTEXT, 0, (LPARAM)"Jason2");
+    SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+    ok(strcmp(edit, "Jason2")==0, "Unexpected text retrieved %s\n", edit);
+
+    SendMessage(hCombo, WM_SETFOCUS, 0, (LPARAM)hEdit);
+
+    /* Now what is the selection */
+    SendMessage(hCombo, CB_GETEDITSEL, (WPARAM)&start, (WPARAM)&end);
+    len = SendMessage(hCombo, CB_GETEDITSEL, 0,0);
+    ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==6, "Unexpected end position for selection %d\n", HIWORD(len));
+
+    /* Now change the selection to the apparently invalid start -1, end -1 and
+       show it means no selection (ie start -1) but cursor at end              */
+    SendMessage(hCombo, CB_SETEDITSEL, 0, -1);
+    edit[0] = 0x00;
+    SendMessage(hCombo, WM_CHAR, 'A', 0x1c0001);
+    SendMessage(hCombo, WM_GETTEXT, sizeof(edit), (LPARAM)edit);
+    ok(strcmp(edit, "Jason2A")==0, "Unexpected text retrieved %s\n", edit);
+    DestroyWindow(hCombo);
+}
+
 START_TEST(combo)
 {
     hMainWnd = CreateWindow("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
@@ -414,6 +514,7 @@
     test_WM_LBUTTONDOWN();
     test_changesize(CBS_DROPDOWN);
     test_changesize(CBS_DROPDOWNLIST);
+    test_editselection();
 
     DestroyWindow(hMainWnd);
 }

Modified: vendor/wine/dlls/user32/current/tests/edit.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/edit.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/edit.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/edit.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -868,6 +868,14 @@
     len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
     ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
     test_notify(1, 0, 1);
+
+    len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
+    ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
+    SendMessage(hParent, WM_SETFOCUS, 0, (LPARAM)hWnd);
+    len = SendMessageA(hWnd, EM_GETSEL, 0, 0);
+    ok(LOWORD(len)==0, "Unexpected start position for selection %d\n", LOWORD(len));
+    ok(HIWORD(len)==0, "Unexpected end position for selection %d\n", HIWORD(len));
 
     SendMessageA(hWnd, EM_SETLIMITTEXT, 5, 0);
 

Modified: vendor/wine/dlls/user32/current/tests/msg.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/msg.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/msg.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/msg.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -6910,7 +6910,7 @@
     { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 1 }, /* XP */
     { WM_SYSKEYDOWN, wparam|lparam, VK_F10, 1 },
     { WM_SYSKEYDOWN, sent|wparam|lparam, VK_F10, 0x00000001 },
-    { WM_CONTEXTMENU, sent|defwinproc|lparam, /*hwnd*/0, MAKELPARAM(-1, -1) },
+    { WM_CONTEXTMENU, sent|defwinproc|lparam, /*hwnd*/0, -1 },
     { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 0xc0000001 }, /* XP */
     { WM_SYSKEYUP, wparam|lparam, VK_F10, 0xc0000001 },
     { WM_SYSKEYUP, sent|wparam|lparam, VK_F10, 0xc0000001 },

Modified: vendor/wine/dlls/user32/current/tests/win.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/win.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/win.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/win.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -444,6 +444,12 @@
 
     ret = SetParent( test, child );
     ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop );
+    check_parents( test, child, child, 0, 0, hwndMain, test );
+
+    ShowWindow( test, SW_SHOW );
+    ret = SetParent( test, test );
+    ok( ret == NULL, "SetParent return value %p expected %p\n", ret, NULL );
+    ok( GetWindowLongA( test, GWL_STYLE ) & WS_VISIBLE, "window is not visible after SetParent\n" );
     check_parents( test, child, child, 0, 0, hwndMain, test );
     DestroyWindow( test );
 
@@ -2720,11 +2726,17 @@
 
             /* check that re-setting the capture for the menu fails */
             set_cap_wnd = SetCapture(cap_wnd);
-            ok(!set_cap_wnd, "SetCapture should have failed!\n");
+            ok(!set_cap_wnd || broken(set_cap_wnd == cap_wnd), /* nt4 */
+               "SetCapture should have failed!\n");
+            if (set_cap_wnd)
+            {
+                DestroyWindow(hWnd);
+                break;
+            }
 
             /* check that SetCapture fails for another window and that it does not touch the error code */
             set_cap_wnd = SetCapture(hWnd);
-            ok(!set_cap_wnd, "ReleaseCapture should have failed!\n");
+            ok(!set_cap_wnd, "SetCapture should have failed!\n");
 
             /* check that ReleaseCapture fails and does not touch the error code */
             status = ReleaseCapture();
@@ -2764,8 +2776,10 @@
     HINSTANCE hInstance = GetModuleHandleA( NULL );
 
     if (!pGetGUIThreadInfo)
+    {
         win_skip("GetGUIThreadInfo is not available\n");
-
+        return;
+    }
     wclass.lpszClassName = "TestCapture4Class";
     wclass.style         = CS_HREDRAW | CS_VREDRAW;
     wclass.lpfnWndProc   = test_capture_4_proc;
@@ -2980,6 +2994,7 @@
         if (msg.message == WM_TIMER || ignore_message(msg.message)) continue;
         ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE,
            "hwnd %p message %04x\n", msg.hwnd, msg.message);
+        DispatchMessage(&msg);
     }
     ret = peek_message(&msg);
     ok( !ret, "message %04x available\n", msg.message);

Modified: vendor/wine/dlls/user32/current/win.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/win.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/win.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/win.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -143,6 +143,7 @@
  */
 void release_user_handle_ptr( void *ptr )
 {
+    assert( ptr && ptr != OBJ_OTHER_PROCESS );
     USER_Unlock();
 }
 
@@ -2700,6 +2701,12 @@
     if (!(full_handle = WIN_IsCurrentThread( hwnd )))
         return (HWND)SendMessageW( hwnd, WM_WINE_SETPARENT, (WPARAM)parent, 0 );
 
+    if (full_handle == parent)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return 0;
+    }
+
     /* Windows hides the window first, then shows it again
      * including the WM_SHOWWINDOW messages and all */
     was_visible = ShowWindow( hwnd, SW_HIDE );
@@ -3309,7 +3316,7 @@
  */
 BOOL WINAPI SwitchDesktop( HDESK hDesktop)
 {
-    FIXME("SwitchDesktop(hwnd %p) stub!\n", hDesktop);
+    FIXME("(hwnd %p) stub!\n", hDesktop);
     return TRUE;
 }
 

Modified: vendor/wine/dlls/winex11.drv/current/window.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/window.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/window.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/window.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -1326,6 +1326,15 @@
     data->configure_serial = NextRequest( display );
     XReconfigureWMWindow( display, data->whole_window,
                           DefaultScreen(display), mask, &changes );
+#ifdef HAVE_LIBXSHAPE
+    if (data->shaped)
+    {
+        int x_offset = old_whole_rect->left - data->whole_rect.left;
+        int y_offset = old_whole_rect->top - data->whole_rect.top;
+        if (x_offset || y_offset)
+            XShapeOffsetShape( display, data->whole_window, ShapeBounding, x_offset, y_offset );
+    }
+#endif
     wine_tsx11_unlock();
 
     TRACE( "win %p/%lx pos %d,%d,%dx%d after %lx changes=%x serial=%lu\n",
@@ -1444,6 +1453,7 @@
     COLORREF key;
     BYTE alpha;
     DWORD layered_flags;
+    HRGN win_rgn;
 
     if (!data->managed && is_window_managed( data->hwnd, SWP_NOACTIVATE, &data->window_rect ))
     {
@@ -1451,6 +1461,14 @@
         data->managed = TRUE;
         SetPropA( data->hwnd, managed_prop, (HANDLE)1 );
     }
+
+    if ((win_rgn = CreateRectRgn( 0, 0, 0, 0 )) &&
+        GetWindowRgn( data->hwnd, win_rgn ) == ERROR)
+    {
+        DeleteObject( win_rgn );
+        win_rgn = 0;
+    }
+    data->shaped = (win_rgn != 0);
 
     mask = get_window_attributes( display, data, &attr );
 
@@ -1471,7 +1489,7 @@
     if (data->whole_window) XSaveContext( display, data->whole_window, winContext, (char *)data->hwnd );
     wine_tsx11_unlock();
 
-    if (!data->whole_window) return 0;
+    if (!data->whole_window) goto done;
 
     if (!create_client_window( display, data, NULL ))
     {
@@ -1480,7 +1498,7 @@
         XDestroyWindow( display, data->whole_window );
         data->whole_window = 0;
         wine_tsx11_unlock();
-        return 0;
+        goto done;
     }
 
     set_initial_wm_hints( display, data );
@@ -1493,7 +1511,7 @@
     sync_window_text( display, data->whole_window, text );
 
     /* set the window region */
-    sync_window_region( display, data, (HRGN)1 );
+    if (win_rgn) sync_window_region( display, data, win_rgn );
 
     /* set the window opacity */
     if (!GetLayeredWindowAttributes( data->hwnd, &key, &alpha, &layered_flags )) layered_flags = 0;
@@ -1502,6 +1520,8 @@
     wine_tsx11_lock();
     XFlush( display );  /* make sure the window exists before we start painting to it */
     wine_tsx11_unlock();
+done:
+    if (win_rgn) DeleteObject( win_rgn );
     return data->whole_window;
 }
 

Modified: vendor/wine/server/current/process.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/process.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/server/current/process.c [iso-8859-1] (original)
+++ vendor/wine/server/current/process.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -562,23 +562,17 @@
 /* terminate a process with the given exit code */
 static void terminate_process( struct process *process, struct thread *skip, int exit_code )
 {
-    struct list *ptr;
-
-    if (skip && skip->process == process)  /* move it to the end of the list */
-    {
-        assert( skip->state != TERMINATED );
-        list_remove( &skip->proc_entry );
-        list_add_tail( &process->thread_list, &skip->proc_entry );
-    }
+    struct thread *thread;
 
     grab_object( process );  /* make sure it doesn't get freed when threads die */
-    while ((ptr = list_head( &process->thread_list )))
-    {
-        struct thread *thread = LIST_ENTRY( ptr, struct thread, proc_entry );
-
+restart:
+    LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry )
+    {
         if (exit_code) thread->exit_code = exit_code;
-        if (thread == skip) break;
+        if (thread == skip) continue;
+        if (thread->state == TERMINATED) continue;
         kill_thread( thread, 1 );
+        goto restart;
     }
     release_object( process );
 }

Modified: vendor/wine/server/current/thread.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/thread.c?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/server/current/thread.c [iso-8859-1] (original)
+++ vendor/wine/server/current/thread.c [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -222,6 +222,7 @@
 
     thread->process = (struct process *)grab_object( process );
     thread->desktop = process->desktop;
+    thread->affinity = process->affinity;
     if (!current) current = thread;
 
     list_add_head( &thread_list, &thread->entry );
@@ -407,13 +408,9 @@
     return NULL;
 }
 
-void set_thread_affinity( struct thread *thread, affinity_t affinity )
-{
-    if ((affinity & thread->process->affinity) != affinity)
-    {
-        set_error( STATUS_INVALID_PARAMETER );
-        return;
-    }
+int set_thread_affinity( struct thread *thread, affinity_t affinity )
+{
+    int ret = 0;
 #ifdef HAVE_SCHED_SETAFFINITY
     if (thread->unix_tid != -1)
     {
@@ -425,15 +422,11 @@
         for (i = 0, mask = 1; mask; i++, mask <<= 1)
             if (affinity & mask) CPU_SET( i, &set );
 
-        if (!sched_setaffinity( thread->unix_tid, sizeof(set), &set ))
-            thread->affinity = affinity;
-        else
-            file_set_error();
-    }
-    else set_error( STATUS_ACCESS_DENIED );
-#else
-    thread->affinity = affinity;
+        ret = sched_setaffinity( thread->unix_tid, sizeof(set), &set );
+    }
 #endif
+    if (!ret) thread->affinity = affinity;
+    return ret;
 }
 
 #define THREAD_PRIORITY_REALTIME_HIGHEST 6
@@ -460,7 +453,14 @@
             set_error( STATUS_INVALID_PARAMETER );
     }
     if (req->mask & SET_THREAD_INFO_AFFINITY)
-        set_thread_affinity( thread, req->affinity );
+    {
+        if ((req->affinity & thread->process->affinity) != req->affinity)
+            set_error( STATUS_INVALID_PARAMETER );
+        else if (thread->state == TERMINATED)
+            set_error( STATUS_ACCESS_DENIED );
+        else if (set_thread_affinity( thread, req->affinity ))
+            file_set_error();
+    }
     if (req->mask & SET_THREAD_INFO_TOKEN)
         security_set_thread_token( thread, req->token );
 }
@@ -1158,6 +1158,7 @@
         generate_debug_event( current, CREATE_THREAD_DEBUG_EVENT, &req->entry );
     }
     debug_level = max( debug_level, req->debug_level );
+    set_thread_affinity( current, current->affinity );
 
     reply->pid     = get_process_id( process );
     reply->tid     = get_thread_id( current );

Modified: vendor/wine/server/current/thread.h
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/thread.h?rev=45455&r1=45454&r2=45455&view=diff
==============================================================================
--- vendor/wine/server/current/thread.h [iso-8859-1] (original)
+++ vendor/wine/server/current/thread.h [iso-8859-1] Sat Feb  6 11:06:43 2010
@@ -118,7 +118,7 @@
 extern int thread_get_inflight_fd( struct thread *thread, int client );
 extern struct thread_snapshot *thread_snap( int *count );
 extern struct token *thread_get_impersonation_token( struct thread *thread );
-extern void set_thread_affinity( struct thread *thread, affinity_t affinity );
+extern int set_thread_affinity( struct thread *thread, affinity_t affinity );
 
 /* ptrace functions */
 




More information about the Ros-diffs mailing list