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

fireball at svn.reactos.org fireball at svn.reactos.org
Sat Mar 6 11:03:37 CET 2010


Author: fireball
Date: Sat Mar  6 11:03:37 2010
New Revision: 45910

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

Modified:
    vendor/wine/dlls/gdi32/current/bitmap.c
    vendor/wine/dlls/gdi32/current/dc.c
    vendor/wine/dlls/gdi32/current/gdiobj.c
    vendor/wine/dlls/gdi32/current/tests/Makefile.in
    vendor/wine/dlls/gdi32/current/tests/bitmap.c
    vendor/wine/dlls/gdi32/current/tests/dc.c
    vendor/wine/dlls/user32/current/dialog.c
    vendor/wine/dlls/user32/current/edit.c
    vendor/wine/dlls/user32/current/input.c
    vendor/wine/dlls/user32/current/message.c
    vendor/wine/dlls/user32/current/painting.c
    vendor/wine/dlls/user32/current/spy.c
    vendor/wine/dlls/user32/current/tests/Makefile.in
    vendor/wine/dlls/user32/current/tests/dialog.c
    vendor/wine/dlls/user32/current/tests/edit.c
    vendor/wine/dlls/user32/current/tests/msg.c
    vendor/wine/dlls/user32/current/tests/scroll.c
    vendor/wine/dlls/user32/current/tests/win.c
    vendor/wine/dlls/user32/current/win.c
    vendor/wine/dlls/winex11.drv/current/bitblt.c
    vendor/wine/dlls/winex11.drv/current/dib.c
    vendor/wine/dlls/winex11.drv/current/ime.c
    vendor/wine/dlls/winex11.drv/current/keyboard.c
    vendor/wine/dlls/winex11.drv/current/window.c
    vendor/wine/dlls/winex11.drv/current/x11drv.h
    vendor/wine/dlls/winex11.drv/current/xdnd.c
    vendor/wine/dlls/winex11.drv/current/xim.c
    vendor/wine/dlls/winex11.drv/current/xrender.c
    vendor/wine/server/current/console.c
    vendor/wine/server/current/debugger.c
    vendor/wine/server/current/queue.c
    vendor/wine/server/current/registry.c
    vendor/wine/server/current/thread.c
    vendor/wine/server/current/thread.h
    vendor/wine/server/current/trace.c

Modified: vendor/wine/dlls/gdi32/current/bitmap.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/bitmap.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/bitmap.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/bitmap.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -678,7 +678,9 @@
     {
 	if (count >= sizeof(DIBSECTION))
 	{
-            memcpy( buffer, bmp->dib, sizeof(DIBSECTION) );
+            DIBSECTION *dib = buffer;
+            *dib = *bmp->dib;
+            dib->dsBmih.biHeight = abs( dib->dsBmih.biHeight );
             ret = sizeof(DIBSECTION);
 	}
 	else /* if (count >= sizeof(BITMAP)) */

Modified: vendor/wine/dlls/gdi32/current/dc.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/dc.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/dc.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/dc.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -819,7 +819,7 @@
     if (dc->hookProc && !dc->hookProc( hdc, DCHC_DELETEDC, dc->dwHookData, 0 ))
     {
         release_dc_ptr( dc );
-        return FALSE;
+        return TRUE;
     }
 
     while (dc->saveLevel)

Modified: vendor/wine/dlls/gdi32/current/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/gdiobj.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/gdiobj.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/gdiobj.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -89,7 +89,8 @@
 
 static const LOGFONTW AnsiFixedFont =
 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
-  0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} };
+  0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
+  {'C','o','u','r','i','e','r','\0'} };
 
 static const LOGFONTW AnsiVarFont =
 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
@@ -635,6 +636,50 @@
 static GDIOBJHDR *large_handles[MAX_LARGE_HANDLES];
 static int next_large_handle;
 
+static const char *gdi_obj_type( unsigned type )
+{
+    switch ( type )
+    {
+        case OBJ_PEN: return "OBJ_PEN";
+        case OBJ_BRUSH: return "OBJ_BRUSH";
+        case OBJ_DC: return "OBJ_DC";
+        case OBJ_METADC: return "OBJ_METADC";
+        case OBJ_PAL: return "OBJ_PAL";
+        case OBJ_FONT: return "OBJ_FONT";
+        case OBJ_BITMAP: return "OBJ_BITMAP";
+        case OBJ_REGION: return "OBJ_REGION";
+        case OBJ_METAFILE: return "OBJ_METAFILE";
+        case OBJ_MEMDC: return "OBJ_MEMDC";
+        case OBJ_EXTPEN: return "OBJ_EXTPEN";
+        case OBJ_ENHMETADC: return "OBJ_ENHMETADC";
+        case OBJ_ENHMETAFILE: return "OBJ_ENHMETAFILE";
+        case OBJ_COLORSPACE: return "OBJ_COLORSPACE";
+        default: return "UNKNOWN";
+    }
+}
+
+static void dump_gdi_objects( void )
+{
+    int i;
+
+    TRACE( "%u objects:\n", MAX_LARGE_HANDLES );
+
+    EnterCriticalSection( &gdi_section );
+    for (i = 0; i < MAX_LARGE_HANDLES; i++)
+    {
+        if (!large_handles[i])
+        {
+            TRACE( "index %d handle %p FREE\n", i, (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2) );
+            continue;
+        }
+        TRACE( "handle %p obj %p type %s selcount %u deleted %u\n",
+               (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2),
+               large_handles[i], gdi_obj_type( large_handles[i]->type ),
+               large_handles[i]->selcount, large_handles[i]->deleted );
+    }
+    LeaveCriticalSection( &gdi_section );
+}
+
 /***********************************************************************
  *           alloc_gdi_handle
  *
@@ -658,6 +703,9 @@
     for (i = 0; i <= next_large_handle; i++)
         if (!large_handles[i]) goto found;
     LeaveCriticalSection( &gdi_section );
+
+    ERR( "out of GDI object handles, expect a crash\n" );
+    if (TRACE_ON(gdi)) dump_gdi_objects();
     return 0;
 
  found:

Modified: vendor/wine/dlls/gdi32/current/tests/Makefile.in
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/Makefile.in?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/Makefile.in [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/Makefile.in [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -5,7 +5,7 @@
 TESTDLL   = gdi32.dll
 IMPORTS   = user32 gdi32 kernel32
 
-CTESTS = \
+C_SRCS = \
 	bitmap.c \
 	brush.c \
 	clipping.c \

Modified: vendor/wine/dlls/gdi32/current/tests/bitmap.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/bitmap.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/bitmap.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/bitmap.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -301,7 +301,7 @@
 
     ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
     ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
-    ok(bm.bmHeight == bmih->biHeight, "wrong bm.bmHeight %d\n", bm.bmHeight);
+    ok(bm.bmHeight == abs(bmih->biHeight), "wrong bm.bmHeight %d\n", bm.bmHeight);
     dib_width_bytes = DIB_GetWidthBytes(bm.bmWidth, bm.bmBitsPixel);
     bm_width_bytes = BITMAP_GetWidthBytes(bm.bmWidth, bm.bmBitsPixel);
     if (bm.bmWidthBytes != dib_width_bytes) /* Win2k bug */
@@ -332,7 +332,7 @@
     ret = GetObject(hbm, sizeof(*bma) * 2, bma);
     ok(ret == sizeof(*bma) || broken(ret == sizeof(*bma) * 2 /* Win9x */), "wrong size %d\n", ret);
     ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
-    ok(bm.bmHeight == bmih->biHeight, "wrong bm.bmHeight %d\n", bm.bmHeight);
+    ok(bm.bmHeight == abs(bmih->biHeight), "wrong bm.bmHeight %d\n", bm.bmHeight);
     ok(bm.bmBits == bits, "wrong bm.bmBits %p != %p\n", bm.bmBits, bits);
 
     ret = GetObject(hbm, sizeof(bm) / 2, &bm);
@@ -363,20 +363,22 @@
     ds.dsBmih.biSizeImage = 0;
 
     ok(ds.dsBmih.biSize == bmih->biSize, "%u != %u\n", ds.dsBmih.biSize, bmih->biSize);
-    ok(ds.dsBmih.biWidth == bmih->biWidth, "%u != %u\n", ds.dsBmih.biWidth, bmih->biWidth);
-    ok(ds.dsBmih.biHeight == bmih->biHeight, "%u != %u\n", ds.dsBmih.biHeight, bmih->biHeight);
+    ok(ds.dsBmih.biWidth == bmih->biWidth, "%d != %d\n", ds.dsBmih.biWidth, bmih->biWidth);
+    ok(ds.dsBmih.biHeight == abs(bmih->biHeight) ||
+       broken(ds.dsBmih.biHeight == bmih->biHeight), /* Win9x/WinMe */
+       "%d != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
     ok(ds.dsBmih.biPlanes == bmih->biPlanes, "%u != %u\n", ds.dsBmih.biPlanes, bmih->biPlanes);
     ok(ds.dsBmih.biBitCount == bmih->biBitCount, "%u != %u\n", ds.dsBmih.biBitCount, bmih->biBitCount);
     ok(ds.dsBmih.biCompression == bmih->biCompression, "%u != %u\n", ds.dsBmih.biCompression, bmih->biCompression);
     ok(ds.dsBmih.biSizeImage == bmih->biSizeImage, "%u != %u\n", ds.dsBmih.biSizeImage, bmih->biSizeImage);
-    ok(ds.dsBmih.biXPelsPerMeter == bmih->biXPelsPerMeter, "%u != %u\n", ds.dsBmih.biXPelsPerMeter, bmih->biXPelsPerMeter);
-    ok(ds.dsBmih.biYPelsPerMeter == bmih->biYPelsPerMeter, "%u != %u\n", ds.dsBmih.biYPelsPerMeter, bmih->biYPelsPerMeter);
+    ok(ds.dsBmih.biXPelsPerMeter == bmih->biXPelsPerMeter, "%d != %d\n", ds.dsBmih.biXPelsPerMeter, bmih->biXPelsPerMeter);
+    ok(ds.dsBmih.biYPelsPerMeter == bmih->biYPelsPerMeter, "%d != %d\n", ds.dsBmih.biYPelsPerMeter, bmih->biYPelsPerMeter);
 
     memset(&ds, 0xAA, sizeof(ds));
     ret = GetObject(hbm, sizeof(ds) - 4, &ds);
     ok(ret == sizeof(ds.dsBm) || broken(ret == (sizeof(ds) - 4) /* Win9x */), "wrong size %d\n", ret);
-    ok(ds.dsBm.bmWidth == bmih->biWidth, "%u != %u\n", ds.dsBmih.biWidth, bmih->biWidth);
-    ok(ds.dsBm.bmHeight == bmih->biHeight, "%u != %u\n", ds.dsBmih.biHeight, bmih->biHeight);
+    ok(ds.dsBm.bmWidth == bmih->biWidth, "%d != %d\n", ds.dsBmih.biWidth, bmih->biWidth);
+    ok(ds.dsBm.bmHeight == abs(bmih->biHeight), "%d != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
     ok(ds.dsBm.bmBits == bits, "%p != %p\n", ds.dsBm.bmBits, bits);
 
     ret = GetObject(hbm, 0, &ds);
@@ -525,6 +527,14 @@
     test_dib_info(hdib, bits, &pbmi->bmiHeader);
     DeleteObject(hdib);
 
+    /* Test a top-down DIB. */
+    pbmi->bmiHeader.biHeight = -100;
+    hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
+    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    test_dib_info(hdib, bits, &pbmi->bmiHeader);
+    DeleteObject(hdib);
+
+    pbmi->bmiHeader.biHeight = 100;
     pbmi->bmiHeader.biBitCount = 8;
     pbmi->bmiHeader.biCompression = BI_RLE8;
     SetLastError(0xdeadbeef);

Modified: vendor/wine/dlls/gdi32/current/tests/dc.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/dc.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/dc.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/dc.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -69,7 +69,7 @@
     assert(hrgn != 0);
 
     hdc = GetDC(hwnd);
-    ok(hdc != NULL, "CreateDC rets %p\n", hdc);
+    ok(hdc != NULL, "GetDC failed\n");
 
     ret = GetClipBox(hdc, &rc_clip);
     ok(ret == SIMPLEREGION, "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
@@ -328,6 +328,152 @@
     ReleaseDC( 0, hdc );
 }
 
+static void test_DeleteDC(void)
+{
+    HWND hwnd;
+    HDC hdc, hdc_test;
+    WNDCLASSEX cls;
+    int ret;
+
+    /* window DC */
+    hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
+                           0, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowExA failed\n");
+
+    hdc = GetDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
+
+    hdc = GetWindowDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
+
+    DestroyWindow(hwnd);
+
+    /* desktop window DC */
+    hwnd = GetDesktopWindow();
+    ok(hwnd != 0, "GetDesktopWindow failed\n");
+
+    hdc = GetDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
+
+    hdc = GetWindowDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
+
+    /* CS_CLASSDC */
+    memset(&cls, 0, sizeof(cls));
+    cls.cbSize = sizeof(cls);
+    cls.style = CS_CLASSDC;
+    cls.hInstance = GetModuleHandle(0);
+    cls.lpszClassName = "Wine class DC";
+    cls.lpfnWndProc = DefWindowProcA;
+    ret = RegisterClassExA(&cls);
+    ok(ret, "RegisterClassExA failed\n");
+
+    hwnd = CreateWindowExA(0, "Wine class DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
+                           0, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowExA failed\n");
+
+    hdc = GetDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = ReleaseDC(hwnd, hdc);
+    ok(ret, "ReleaseDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+
+    hdc_test = hdc;
+
+    hdc = GetWindowDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
+
+    DestroyWindow(hwnd);
+
+    ret = GetObjectType(hdc_test);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+
+    ret = UnregisterClassA("Wine class DC", GetModuleHandle(NULL));
+    ok(ret, "UnregisterClassA failed\n");
+
+    ret = GetObjectType(hdc_test);
+todo_wine
+    ok(!ret, "GetObjectType should fail for a deleted DC\n");
+
+    /* CS_OWNDC */
+    memset(&cls, 0, sizeof(cls));
+    cls.cbSize = sizeof(cls);
+    cls.style = CS_OWNDC;
+    cls.hInstance = GetModuleHandle(0);
+    cls.lpszClassName = "Wine own DC";
+    cls.lpfnWndProc = DefWindowProcA;
+    ret = RegisterClassExA(&cls);
+    ok(ret, "RegisterClassExA failed\n");
+
+    hwnd = CreateWindowExA(0, "Wine own DC", NULL, WS_POPUP|WS_VISIBLE, 0,0,100,100,
+                           0, 0, 0, NULL);
+    ok(hwnd != 0, "CreateWindowExA failed\n");
+
+    hdc = GetDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = ReleaseDC(hwnd, hdc);
+    ok(ret, "ReleaseDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+
+    hdc = GetWindowDC(hwnd);
+    ok(hdc != 0, "GetDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(ret == OBJ_DC, "expected OBJ_DC, got %d\n", ret);
+    ret = DeleteDC(hdc);
+    ok(ret, "DeleteDC failed\n");
+    ret = GetObjectType(hdc);
+    ok(!ret || broken(ret) /* win9x */, "GetObjectType should fail for a deleted DC\n");
+
+    DestroyWindow(hwnd);
+
+    ret = UnregisterClassA("Wine own DC", GetModuleHandle(NULL));
+    ok(ret, "UnregisterClassA failed\n");
+}
+
 START_TEST(dc)
 {
     test_savedc();
@@ -335,4 +481,5 @@
     test_GdiConvertToDevmodeW();
     test_CreateCompatibleDC();
     test_DC_bitmap();
-}
+    test_DeleteDC();
+}

Modified: vendor/wine/dlls/user32/current/dialog.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/dialog.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/dialog.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/dialog.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -690,11 +690,14 @@
 
         if (dlgProc)
         {
-            if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ) &&
+            HWND focus = GetNextDlgTabItem( hwnd, 0, FALSE );
+            if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) &&
                 ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE)))
             {
-                /* By returning TRUE, app has requested a default focus assignment */
-                dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
+                /* By returning TRUE, app has requested a default focus assignment.
+                 * WM_INITDIALOG may have changed the tab order, so find the first
+                 * tabstop control again. */
+                dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
                 if( dlgInfo->hwndFocus )
                     SetFocus( dlgInfo->hwndFocus );
             }
@@ -812,6 +815,12 @@
                 DispatchMessageW( &msg );
             }
             if (dlgInfo->flags & DF_END) break;
+
+            if (bFirstEmpty && msg.message == WM_TIMER)
+            {
+                ShowWindow( hwnd, SW_SHOWNORMAL );
+                bFirstEmpty = FALSE;
+            }
         }
     }
     if (dlgInfo->flags & DF_OWNERENABLED) DIALOG_EnableOwner( owner );

Modified: vendor/wine/dlls/user32/current/edit.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/edit.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/edit.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/edit.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -1632,13 +1632,16 @@
 	    INT vlc = get_vertical_line_count(es);
 	    /* check if we are going to move too far */
 	    if(es->y_offset + dy > es->line_count - vlc)
-		dy = es->line_count - vlc - es->y_offset;
+		dy = max(es->line_count - vlc, 0) - es->y_offset;
 
 	    /* Notification is done in EDIT_EM_LineScroll */
-	    if(dy)
+	    if(dy) {
 		EDIT_EM_LineScroll(es, 0, dy);
-	}
-	return MAKELONG(dy, TRUE);
+		return MAKELONG(dy, TRUE);
+	    }
+
+	}
+	return (LRESULT)FALSE;
 }
 
 

Modified: vendor/wine/dlls/user32/current/input.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/input.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/input.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/input.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -134,7 +134,7 @@
                 break;
 
             case INPUT_KEYBOARD:
-                TRACE("keyboard: vk %x, scan %x, flags %x, time %u, info %lx\n",
+                TRACE("keyboard: vk %X, scan %x, flags %x, time %u, info %lx\n",
                       inputs[i].u.ki.wVk, inputs[i].u.ki.wScan, inputs[i].u.ki.dwFlags,
                       inputs[i].u.ki.time, inputs[i].u.ki.dwExtraInfo);
                 break;
@@ -657,7 +657,7 @@
  */
 UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl)
 {
-    TRACE_(keyboard)("(%d, %d, %p)\n", code, maptype, hkl);
+    TRACE_(keyboard)("(%X, %d, %p)\n", code, maptype, hkl);
 
     return USER_Driver->pMapVirtualKeyEx(code, maptype, hkl);
 }
@@ -869,7 +869,7 @@
 BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
 {
     static int once;
-    if (!once++) FIXME_(keyboard)("(%p,%d,0x%08x,%d): stub\n",hwnd,id,modifiers,vk);
+    if (!once++) FIXME_(keyboard)("(%p,%d,0x%08x,%X): stub\n",hwnd,id,modifiers,vk);
     return TRUE;
 }
 

Modified: vendor/wine/dlls/user32/current/message.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/message.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/message.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/message.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -2034,8 +2034,7 @@
     if (!(buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size ))) return FALSE;
 
     if (!first && !last) last = ~0;
-    if (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST || hwnd == HWND_BOTTOM)
-        hwnd = (HWND)-1;
+    if (hwnd == HWND_BROADCAST) hwnd = HWND_TOPMOST;
 
     for (;;)
     {
@@ -2999,7 +2998,7 @@
     if (msg->message < WM_KEYFIRST || msg->message > WM_KEYLAST) return FALSE;
     if (msg->message != WM_KEYDOWN && msg->message != WM_SYSKEYDOWN) return TRUE;
 
-    TRACE_(key)("Translating key %s (%04lx), scancode %04x\n",
+    TRACE_(key)("Translating key %s (%04lX), scancode %04x\n",
                 SPY_GetVKeyName(msg->wParam), msg->wParam, HIWORD(msg->lParam));
 
     switch (msg->wParam)

Modified: vendor/wine/dlls/user32/current/painting.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/painting.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/painting.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/painting.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -296,6 +296,7 @@
                 {
                     win->dce = dce;
                     dce->hwnd = hwnd;
+                    dce->count++;
                     list_add_tail( &dce_list, &dce->entry );
                 }
                 WIN_ReleasePtr( win );
@@ -495,7 +496,7 @@
          * (between GetDC and ReleaseDC)
          */
         USER_Lock();
-        if (dce->count)
+        if (dce->count > 1)
         {
             WARN("Application trying to delete a busy DC %p\n", dce->hdc);
             retv = FALSE;

Modified: vendor/wine/dlls/user32/current/spy.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/spy.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/spy.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/spy.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -1166,10 +1166,10 @@
     NULL,               /* 0x19 */
     NULL,               /* 0x1A */
     "VK_ESCAPE",        /* 0x1B */
-    NULL,               /* 0x1C */
-    NULL,               /* 0x1D */
-    NULL,               /* 0x1E */
-    NULL,               /* 0x1F */
+    "VK_CONVERT",       /* 0x1C */
+    "VK_NONCONVERT",    /* 0x1D */
+    "VK_ACCEPT",        /* 0x1E */
+    "VK_MODECHANGE",    /* 0x1F */
     "VK_SPACE",         /* 0x20 */
     "VK_PRIOR",         /* 0x21 */
     "VK_NEXT",          /* 0x22 */
@@ -1233,7 +1233,7 @@
     "VK_RWIN",          /* 0x5C */
     "VK_APPS",          /* 0x5D */
     NULL,               /* 0x5E */
-    NULL,               /* 0x5F */
+    "VK_SLEEP",         /* 0x5F */
     "VK_NUMPAD0",       /* 0x60 */
     "VK_NUMPAD1",       /* 0x61 */
     "VK_NUMPAD2",       /* 0x62 */
@@ -1284,11 +1284,11 @@
     NULL,               /* 0x8F */
     "VK_NUMLOCK",       /* 0x90 */
     "VK_SCROLL",        /* 0x91 */
-    NULL,               /* 0x92 */
-    NULL,               /* 0x93 */
-    NULL,               /* 0x94 */
-    NULL,               /* 0x95 */
-    NULL,               /* 0x96 */
+    "VK_OEM_NEC_EQUAL",       /* 0x92 aka. VK_OEM_FJ_JISHO */
+    "VK_OEM_FJ_MASSHOU",      /* 0x93 */
+    "VK_OEM_FJ_TOUROKU",      /* 0x94 */
+    "VK_OEM_FJ_LOYA",         /* 0x95 */
+    "VK_OEM_FJ_ROYA",         /* 0x96 */
     NULL,               /* 0x97 */
     NULL,               /* 0x98 */
     NULL,               /* 0x99 */

Modified: vendor/wine/dlls/user32/current/tests/Makefile.in
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/Makefile.in?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/Makefile.in [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/Makefile.in [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -5,7 +5,7 @@
 TESTDLL   = user32.dll
 IMPORTS   = user32 gdi32 advapi32 kernel32
 
-CTESTS = \
+C_SRCS = \
 	broadcast.c \
 	class.c \
 	clipboard.c \

Modified: vendor/wine/dlls/user32/current/tests/dialog.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/dialog.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/dialog.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/dialog.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -852,8 +852,8 @@
     ok ((g_hwndInitialFocusT1 == g_hwndButton2),
        "Error in initial focus when WM_INITDIALOG returned TRUE: "
        "Expected the second button (%p), got %s (%p).\n",
-       g_hwndButton2, GetHwndString(g_hwndInitialFocusT2),
-       g_hwndInitialFocusT2);
+       g_hwndButton2, GetHwndString(g_hwndInitialFocusT1),
+       g_hwndInitialFocusT1);
 
     ok ((g_hwndInitialFocusT2 == g_hwndButton2),
        "Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
@@ -926,6 +926,21 @@
     return FALSE;
 }
 
+static INT_PTR CALLBACK TestInitDialogHandleProc (HWND hDlg, UINT uiMsg,
+        WPARAM wParam, LPARAM lParam)
+{
+    if (uiMsg == WM_INITDIALOG)
+    {
+        HWND expected = GetNextDlgTabItem(hDlg, NULL, FALSE);
+        ok(expected == (HWND)wParam,
+           "Expected wParam to be the handle to the first tabstop control (%p), got %p\n",
+           expected, (HWND)wParam);
+
+        EndDialog(hDlg, LOWORD(SendMessage(hDlg, DM_GETDEFID, 0, 0)));
+        return TRUE;
+    }
+    return FALSE;
+}
 
 static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg,
                                               WPARAM wParam, LPARAM lParam)
@@ -977,6 +992,9 @@
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE ||
        broken(GetLastError() == 0xdeadbeef),
        "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
+
+    ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0);
+    ok(ret == IDOK, "Expected IDOK\n");
 
     ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0);
     ok(ret == IDOK, "Expected IDOK\n");
@@ -1139,6 +1157,55 @@
     DestroyWindow(hDlg);
 }
 
+static INT_PTR CALLBACK timer_message_dlg_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    static int count;
+    BOOL visible;
+
+    switch (msg)
+    {
+        case WM_INITDIALOG:
+            visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE;
+            ok(!visible, "Dialog should not be visible.\n");
+            SetTimer(wnd, 1, 100, NULL);
+            Sleep(200);
+            return FALSE;
+
+        case WM_COMMAND:
+            if (LOWORD(wparam) != IDCANCEL) return FALSE;
+            EndDialog(wnd, LOWORD(wparam));
+            return TRUE;
+
+        case WM_TIMER:
+            if (wparam != 1) return FALSE;
+            visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE;
+            if (!count++)
+            {
+                ok(!visible, "Dialog should not be visible.\n");
+                PostMessage(wnd, WM_USER, 0, 0);
+            }
+            else
+            {
+                ok(visible, "Dialog should be visible.\n");
+                PostMessage(wnd, WM_COMMAND, IDCANCEL, 0);
+            }
+            return TRUE;
+
+        case WM_USER:
+            visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE;
+            ok(visible, "Dialog should be visible.\n");
+            return TRUE;
+
+        default:
+            return FALSE;
+    }
+}
+
+static void test_timer_message(void)
+{
+    DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
+}
+
 START_TEST(dialog)
 {
     g_hinst = GetModuleHandleA (0);
@@ -1154,4 +1221,5 @@
     test_DisabledDialogTest();
     test_MessageBoxFontTest();
     test_SaveRestoreFocus();
-}
+    test_timer_message();
+}

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=45910&r1=45909&r2=45910&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 Mar  6 11:03:37 2010
@@ -1314,6 +1314,57 @@
     ok( (r == 65535) || (r == 4294967295UL),
         "got limit %u (expected 65535 or 4294967295)\n", r);
     DestroyWindow(hwEdit);
+}
+
+/* Test EM_SCROLL */
+static void test_edit_control_scroll(void)
+{
+    static const char *single_line_str = "a";
+    static const char *multiline_str = "Test\r\nText";
+    HWND hwEdit;
+    LONG ret;
+
+    /* Check the return value when EM_SCROLL doesn't scroll
+     * anything. Should not return true unless any lines were actually
+     * scrolled. */
+    hwEdit = CreateWindow(
+              "EDIT",
+              single_line_str,
+              WS_VSCROLL | ES_MULTILINE,
+              1, 1, 100, 100,
+              NULL, NULL, hinst, NULL);
+
+    assert(hwEdit);
+
+    ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
+    ok(!ret, "Returned %x, expected 0.\n", ret);
+
+    ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
+    ok(!ret, "Returned %x, expected 0.\n", ret);
+
+    ret = SendMessage(hwEdit, EM_SCROLL, SB_LINEUP, 0);
+    ok(!ret, "Returned %x, expected 0.\n", ret);
+
+    ret = SendMessage(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
+    ok(!ret, "Returned %x, expected 0.\n", ret);
+
+    DestroyWindow (hwEdit);
+
+    /* SB_PAGEDOWN while at the beginning of a buffer with few lines
+       should not cause EM_SCROLL to return a negative value of
+       scrolled lines that would put us "before" the beginning. */
+    hwEdit = CreateWindow(
+                "EDIT",
+                multiline_str,
+                WS_VSCROLL | ES_MULTILINE,
+                0, 0, 100, 100,
+                NULL, NULL, hinst, NULL);
+    assert(hwEdit);
+
+    ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
+    ok(!ret, "Returned %x, expected 0.\n", ret);
+
+    DestroyWindow (hwEdit);
 }
 
 static void test_margins(void)
@@ -2319,6 +2370,7 @@
     test_edit_control_5();
     test_edit_control_6();
     test_edit_control_limittext();
+    test_edit_control_scroll();
     test_margins();
     test_margins_font_change();
     test_text_position();

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=45910&r1=45909&r2=45910&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 Mar  6 11:03:37 2010
@@ -12080,6 +12080,13 @@
          { 0,            0,            FALSE },
          { 0,            WAIT_TIMEOUT, FALSE },
          { 0,            0,            FALSE },
+         { 0,            0,            FALSE },
+/* 15 */ { 0,            0,            FALSE },
+         { WAIT_TIMEOUT, 0,            FALSE },
+         { WAIT_TIMEOUT, 0,            FALSE },
+         { WAIT_TIMEOUT, 0,            FALSE },
+         { WAIT_TIMEOUT, 0,            FALSE },
+/* 20 */ { WAIT_TIMEOUT, 0,            FALSE },
 };
 
 static DWORD CALLBACK do_wait_idle_child_thread( void *arg )
@@ -12205,6 +12212,41 @@
         WaitForSingleObject( thread, 10000 );
         CloseHandle( thread );
         break;
+    case 14:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, HWND_TOPMOST, 0, 0, PM_NOREMOVE );
+        break;
+    case 15:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, HWND_BROADCAST, 0, 0, PM_NOREMOVE );
+        break;
+    case 16:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, HWND_BOTTOM, 0, 0, PM_NOREMOVE );
+        break;
+    case 17:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, (HWND)0xdeadbeef, 0, 0, PM_NOREMOVE );
+        break;
+    case 18:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, HWND_NOTOPMOST, 0, 0, PM_NOREMOVE );
+        break;
+    case 19:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, HWND_MESSAGE, 0, 0, PM_NOREMOVE );
+        break;
+    case 20:
+        SetEvent( start_event );
+        Sleep( 200 );
+        PeekMessage( &msg, GetDesktopWindow(), 0, 0, PM_NOREMOVE );
+        break;
     }
     WaitForSingleObject( end_event, 2000 );
     CloseHandle( start_event );

Modified: vendor/wine/dlls/user32/current/tests/scroll.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/scroll.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/scroll.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/scroll.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -411,8 +411,8 @@
       WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL,
       CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
 
-    if ( !ok( hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n" ) )
-        return;
+    ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n");
+    if (!hMainWnd) return;
 
     assert( hScroll );
 

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=45910&r1=45909&r2=45910&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 Mar  6 11:03:37 2010
@@ -3424,6 +3424,14 @@
     check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME|WS_EX_STATICEDGE, WS_CHILD, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
     check_window_style(WS_CAPTION, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE);
     check_window_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE);
+
+    if (pGetLayeredWindowAttributes)
+    {
+        check_window_style(0, WS_EX_LAYERED, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_LAYERED|WS_EX_WINDOWEDGE);
+        check_window_style(0, WS_EX_LAYERED|WS_EX_TRANSPARENT, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_WINDOWEDGE);
+        check_window_style(0, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW, WS_CLIPSIBLINGS|WS_CAPTION,
+                                                      WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE);
+    }
 }
 
 static void test_scrollwindow( HWND hwnd)

Modified: vendor/wine/dlls/user32/current/win.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/win.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/win.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/win.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -3392,29 +3392,33 @@
             cy = info->psize->cy;
             flags &= ~SWP_NOSIZE;
         }
-        TRACE( "moving window %p pos %d,%d %dx%x\n", hwnd, x, y, cx, cy );
+        TRACE( "moving window %p pos %d,%d %dx%d\n", hwnd, x, y, cx, cy );
         SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
     }
 
     if (info->hdcSrc)
     {
-        RECT rect;
-        HDC hdc = GetDCEx( hwnd, 0, DCX_CACHE );
+        HDC hdc = GetWindowDC( hwnd );
 
         if (hdc)
         {
             int x = 0, y = 0;
-
-            GetClientRect( hwnd, &rect );
+            RECT rect;
+
+            GetWindowRect( hwnd, &rect );
+            OffsetRect( &rect, -rect.left, -rect.top);
             if (info->pptSrc)
             {
                 x = info->pptSrc->x;
                 y = info->pptSrc->y;
             }
-            /* FIXME: intersect rect with info->prcDirty */
-            TRACE( "copying window %p pos %d,%d\n", hwnd, x, y );
-            BitBlt( hdc, rect.left, rect.top, rect.right, rect.bottom,
-                    info->hdcSrc, rect.left + x, rect.top + y, SRCCOPY );
+
+            if (!info->prcDirty || (info->prcDirty && IntersectRect(&rect, &rect, info->prcDirty)))
+            {
+                TRACE( "copying window %p pos %d,%d\n", hwnd, x, y );
+                BitBlt( hdc, rect.left, rect.top, rect.right, rect.bottom,
+                        info->hdcSrc, rect.left + x, rect.top + y, SRCCOPY );
+            }
             ReleaseDC( hwnd, hdc );
         }
     }

Modified: vendor/wine/dlls/winex11.drv/current/bitblt.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/bitblt.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/bitblt.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/bitblt.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -1308,7 +1308,7 @@
 
     bytesToCopy = width * bytesPerPixel;
 
-    if (srcDib.dsBmih.biHeight < 0)
+    if (physDevSrc->bitmap->topdown)
     {
       srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel];
       srcRowOffset = srcDib.dsBm.bmWidthBytes;
@@ -1319,7 +1319,7 @@
         + xSrc*bytesPerPixel];
       srcRowOffset = -srcDib.dsBm.bmWidthBytes;
     }
-    if (dstDib.dsBmih.biHeight < 0)
+    if (physDevDst->bitmap->topdown)
     {
       dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel];
       dstRowOffset = dstDib.dsBm.bmWidthBytes;

Modified: vendor/wine/dlls/winex11.drv/current/dib.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/dib.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/dib.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/dib.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -4054,7 +4054,7 @@
       UINT y;
 
       TRACE("syncing compatible set bits to app bits\n");
-      if ((tmpheight < 0) ^ (ds.dsBmih.biHeight < 0))
+      if ((tmpheight < 0) ^ physBitmap->topdown)
       {
           dbits += dstwidthb * (lines-1);
           dstwidthb = -dstwidthb;
@@ -4249,7 +4249,7 @@
   descr.palentry    = NULL;
   descr.infoWidth   = dibSection.dsBmih.biWidth;
   descr.infoBpp     = dibSection.dsBmih.biBitCount;
-  descr.lines       = dibSection.dsBmih.biHeight;
+  descr.lines       = physBitmap->topdown ? -dibSection.dsBmih.biHeight : dibSection.dsBmih.biHeight;
   descr.image       = physBitmap->image;
   descr.colorMap    = colorMap;
   descr.nColorMap   = nColorMap;
@@ -4726,12 +4726,17 @@
 {
     X_PHYSBITMAP *physBitmap;
     DIBSECTION dib;
+    WORD bpp, compr;
+    LONG w, h;
 #ifdef HAVE_LIBXXSHM
     int major, minor;
     Bool pixmaps;
 #endif
 
+    DIB_GetBitmapInfo( &bmi->bmiHeader, &w, &h, &bpp, &compr );
+
     if (!(physBitmap = X11DRV_init_phys_bitmap( hbitmap ))) return 0;
+    if (h < 0) physBitmap->topdown = TRUE;
     physBitmap->status = DIB_Status_None;
 
     GetObjectW( hbitmap, sizeof(dib), &dib );

Modified: vendor/wine/dlls/winex11.drv/current/ime.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/ime.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/ime.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/ime.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -717,30 +717,36 @@
                     }
                     break;
                 case IMC_SETOPENSTATUS:
-                {
-                    LPIMEPRIVATE myPrivate;
                     TRACE("IMC_SETOPENSTATUS\n");
 
-                    myPrivate = ImmLockIMCC(lpIMC->hPrivate);
-                    if (lpIMC->fOpen != myPrivate->bInternalState &&
-                        myPrivate->bInComposition)
+                    /* Indirectly called from XIM callbacks */
+                    if (ImmGetIMCCLockCount(lpIMC->hPrivate) > 0)
                     {
-                        if(lpIMC->fOpen == FALSE)
+                        bRet = TRUE;
+                        break;
+                    }
+
+                    bRet = X11DRV_SetPreeditState(lpIMC->hWnd, lpIMC->fOpen);
+                    if (bRet)
+                    {
+                        if (!lpIMC->fOpen)
                         {
-                            X11DRV_ForceXIMReset(lpIMC->hWnd);
-                            GenerateIMEMessage(hIMC,WM_IME_ENDCOMPOSITION,0,0);
-                            myPrivate->bInComposition = FALSE;
-                        }
-                        else
-                        {
-                            GenerateIMEMessage(hIMC,WM_IME_STARTCOMPOSITION,0,0);
-                            GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, 0, 0);
+                            LPIMEPRIVATE myPrivate;
+
+                            myPrivate = ImmLockIMCC(lpIMC->hPrivate);
+                            if (myPrivate->bInComposition)
+                            {
+                                X11DRV_ForceXIMReset(lpIMC->hWnd);
+                                GenerateIMEMessage(hIMC, WM_IME_ENDCOMPOSITION, 0, 0);
+                                myPrivate->bInComposition = FALSE;
+                            }
+                            ImmUnlockIMCC(lpIMC->hPrivate);
                         }
                     }
-                    myPrivate->bInternalState = lpIMC->fOpen;
-                    bRet = TRUE;
-                }
-                break;
+                    else
+                        lpIMC->fOpen = !lpIMC->fOpen;
+
+                    break;
                 default: FIXME("Unknown\n"); break;
             }
             break;
@@ -951,35 +957,36 @@
 
 /* Interfaces to XIM and other parts of winex11drv */
 
-void IME_SetOpenStatus(BOOL fOpen)
-{
+void IME_SetOpenStatus(BOOL fOpen, BOOL force)
+{
+    HIMC imc;
     LPINPUTCONTEXT lpIMC;
     LPIMEPRIVATE myPrivate;
 
-    lpIMC = LockRealIMC(FROM_X11);
+    imc = RealIMC(FROM_X11);
+    lpIMC = ImmLockIMC(imc);
     if (lpIMC == NULL)
         return;
 
     myPrivate = ImmLockIMCC(lpIMC->hPrivate);
 
-    if (myPrivate->bInternalState && fOpen == FALSE)
+    if (!fOpen && myPrivate->bInComposition)
     {
         ShowWindow(myPrivate->hwndDefault, SW_HIDE);
         ImmDestroyIMCC(lpIMC->hCompStr);
         lpIMC->hCompStr = ImeCreateBlankCompStr();
-    }
+        myPrivate->bInComposition = FALSE;
+        GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0);
+    }
+
+    if (lpIMC->fOpen && fOpen)
+        ImmSetOpenStatus(imc, FALSE);
+
+    if (fOpen || force)
+        ImmSetOpenStatus(imc, fOpen);
 
     ImmUnlockIMCC(lpIMC->hPrivate);
-    UnlockRealIMC(FROM_X11);
-
-    if (myPrivate->bInComposition && fOpen == FALSE)
-    {
-        GenerateIMEMessage(FROM_X11, WM_IME_ENDCOMPOSITION, 0, 0);
-        myPrivate->bInComposition = FALSE;
-    }
-
-    if (!myPrivate->bInternalState && fOpen == TRUE)
-        ImmSetOpenStatus(RealIMC(FROM_X11), fOpen);
+    ImmUnlockIMC(imc);
 }
 
 INT IME_GetCursorPos(void)
@@ -1048,10 +1055,14 @@
 
 void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen)
 {
+    HIMC imc;
     LPINPUTCONTEXT lpIMC;
     HIMCC newCompStr;
-
-    lpIMC = LockRealIMC(FROM_X11);
+    LPIMEPRIVATE myPrivate;
+    BOOL fOpen;
+
+    imc = RealIMC(FROM_X11);
+    lpIMC = ImmLockIMC(imc);
     if (lpIMC == NULL)
         return;
 
@@ -1059,9 +1070,19 @@
     ImmDestroyIMCC(lpIMC->hCompStr);
     lpIMC->hCompStr = newCompStr;
 
-    GenerateIMEMessage(FROM_X11, WM_IME_COMPOSITION, 0, GCS_RESULTSTR);
-
-    UnlockRealIMC(FROM_X11);
+    myPrivate = ImmLockIMCC(lpIMC->hPrivate);
+    fOpen = lpIMC->fOpen;
+    ImmSetOpenStatus(imc, TRUE);
+    if (!myPrivate->bInComposition)
+        GenerateIMEMessage(imc, WM_IME_STARTCOMPOSITION, 0, 0);
+    GenerateIMEMessage(imc, WM_IME_COMPOSITION, 0, GCS_RESULTSTR);
+    if (!myPrivate->bInComposition)
+        GenerateIMEMessage(imc, WM_IME_ENDCOMPOSITION, 0, 0);
+    if (!fOpen)
+        ImmSetOpenStatus(imc, FALSE);
+    ImmUnlockIMCC(lpIMC->hPrivate);
+
+    ImmUnlockIMC(imc);
 }
 
 /*****
@@ -1290,7 +1311,7 @@
             FIXME("WM_IME_NOTIFY:IMN_SETSENTENCEMODE\n");
             break;
         case IMN_SETOPENSTATUS:
-            FIXME("WM_IME_NOTIFY:IMN_SETOPENSTATUS\n");
+            TRACE("WM_IME_NOTIFY:IMN_SETOPENSTATUS\n");
             break;
         case IMN_SETCANDIDATEPOS:
             FIXME("WM_IME_NOTIFY:IMN_SETCANDIDATEPOS\n");

Modified: vendor/wine/dlls/winex11.drv/current/keyboard.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/keyboard.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/keyboard.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/keyboard.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -51,6 +51,12 @@
 #include "wine/unicode.h"
 #include "wine/debug.h"
 
+/* log format (add 0-padding as appropriate):
+    keycode  %u  as in output from xev
+    keysym   %lx as in X11/keysymdef.h
+    vkey     %X  as in winuser.h
+    scancode %x
+*/
 WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
 WINE_DECLARE_DEBUG_CHANNEL(key);
 
@@ -1145,7 +1151,7 @@
     if ((e->state & ControlMask) && (keysym == XK_Break))
         return VK_CANCEL;
 
-    TRACE_(key)("e->keycode = %x\n", e->keycode);
+    TRACE_(key)("e->keycode = %u\n", e->keycode);
 
     return keyc2vkey[e->keycode];
 }
@@ -1231,7 +1237,7 @@
     {
         vk_hook = wVk = VK_PACKET;
         lParam = MAKELPARAM(1 /* repeat count */, wScan);
-        TRACE_(key)(" message=0x%04x wParam=0x%04x lParam=0x%08lx\n",
+        TRACE_(key)("message=0x%04x wParam=0x%04X lParam=0x%08lx\n",
                     message, wVk, lParam);
     }
 
@@ -1263,7 +1269,7 @@
 
         lParam = MAKELPARAM(1 /* repeat count */, flags);
 
-        TRACE_(key)(" message=0x%04x wParam=0x%04x, lParam=0x%08lx, InputKeyState=0x%x\n",
+        TRACE_(key)(" message=0x%04x wParam=0x%04X, lParam=0x%08lx, InputKeyState=0x%x\n",
                     message, wVk, lParam, key_state_table[wVk]);
     }
 
@@ -1299,7 +1305,7 @@
 
         if (!state) flags |= KEYEVENTF_KEYUP;
 
-        TRACE("Adjusting state for vkey %#.2x. State before %#.2x\n",
+        TRACE("Adjusting state for vkey %#.2X. State before %#.2x\n",
               vkey, key_state_table[vkey & 0xff]);
 
         /* Fake key being pressed inside wine */
@@ -1377,7 +1383,7 @@
     DWORD event_time = EVENT_x11_time_to_win32_time(event->time);
     Status status = 0;
 
-    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode 0x%04x\n",
+    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode %u\n",
 		event->type, event->window, event->state, event->keycode);
 
     wine_tsx11_lock();
@@ -1402,7 +1408,7 @@
         ascii_chars = XLookupString(event, buf, sizeof(buf), &keysym, NULL);
     wine_tsx11_unlock();
 
-    TRACE_(key)("nbyte = %d, status 0x%x\n", ascii_chars, status);
+    TRACE_(key)("nbyte = %d, status %d\n", ascii_chars, status);
 
     if (status == XLookupChars)
     {
@@ -1432,7 +1438,7 @@
         wine_tsx11_unlock();
 	if (!ksname)
 	  ksname = "No Name";
-	TRACE_(key)("%s : keysym=%lX (%s), # of chars=%d / %s\n",
+	TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
                     (event->type == KeyPress) ? "KeyPress" : "KeyRelease",
                     keysym, ksname, ascii_chars, debugstr_an(Str, ascii_chars));
     }
@@ -1445,7 +1451,7 @@
     if (!vkey && ascii_chars) vkey = VK_NONAME;
     wine_tsx11_unlock();
 
-    TRACE_(key)("keycode 0x%x converted to vkey 0x%x\n",
+    TRACE_(key)("keycode %u converted to vkey 0x%X\n",
                 event->keycode, vkey);
 
     if (!vkey) return;
@@ -1525,7 +1531,7 @@
             if (!use_xkb || !XkbTranslateKeySym(display, &keysym, 0, &ckey[keyc][i], 1, NULL))
 #endif
             {
-                TRACE("XKB could not translate keysym %ld\n", keysym);
+                TRACE("XKB could not translate keysym %04lx\n", keysym);
                 /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent
                  * with appropriate ShiftMask and Mode_switch, use XLookupString
                  * to get character in the local encoding.
@@ -1577,7 +1583,7 @@
           char str[5];
           for (i = 0; i < 4; i++) str[i] = ckey[keyc][i] ? ckey[keyc][i] : ' ';
           str[4] = 0;
-          TRACE_(key)("mismatch for keysym 0x%04lX, keycode %d, got %s\n", keysym, keyc, str );
+          TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, str);
           mismatch++;
           score -= syms;
 	}
@@ -1822,11 +1828,11 @@
 	      }
 	    }
         }
-        TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
+        TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
         keyc2vkey[e2.keycode] = vkey;
         keyc2scan[e2.keycode] = scan;
         if ((vkey & 0xff) && vkey_used[(vkey & 0xff)])
-            WARN("vkey %04x is being used by more than one keycode\n", vkey);
+            WARN("vkey %04X is being used by more than one keycode\n", vkey);
         vkey_used[(vkey & 0xff)] = 1;
     } /* for */
 
@@ -1874,7 +1880,7 @@
 
         if (vkey)
         {
-            TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
+            TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
             keyc2vkey[e2.keycode] = vkey;
         }
     } /* for */
@@ -1912,7 +1918,7 @@
 
         if (TRACE_ON(keyboard))
         {
-            TRACE("spare virtual key %X assigned to keycode %X:\n",
+            TRACE("spare virtual key %04X assigned to keycode %u:\n",
                              vkey, e2.keycode);
             TRACE("(");
             for (i = 0; i < keysyms_per_keycode; i += 1)
@@ -1923,12 +1929,12 @@
                 ksname = XKeysymToString(keysym);
                 if (!ksname)
                     ksname = "NoSymbol";
-                TRACE( "%lX (%s) ", keysym, ksname);
+                TRACE( "%lx (%s) ", keysym, ksname);
             }
             TRACE(")\n");
         }
 
-        TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
+        TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
         keyc2vkey[e2.keycode] = vkey;
         vkey_used[vkey] = 1;
     } /* for */
@@ -1944,7 +1950,7 @@
 
 	/* should make sure the scancode is unassigned here, but >=0x60 currently always is */
 
-	TRACE_(key)("assigning scancode %02x to unidentified keycode %02x (%s)\n",scan,keyc,ksname);
+	TRACE_(key)("assigning scancode %02x to unidentified keycode %u (%s)\n",scan,keyc,ksname);
 	keyc2scan[keyc]=scan++;
       }
 
@@ -1976,7 +1982,7 @@
     retval = ((key_state_table[key] & 0x40) ? 0x0001 : 0) |
              ((key_state_table[key] & 0x80) ? 0x8000 : 0);
     key_state_table[key] &= ~0x40;
-    TRACE_(key)("(%x) -> %x\n", key, retval);
+    TRACE_(key)("(%X) -> %x\n", key, retval);
     return retval;
 }
 
@@ -2127,8 +2133,7 @@
     }
     wine_tsx11_unlock();
 
-    TRACE("'%c'(%#lx, %lu): got keycode %#.2x (%d)\n",
-            cChar, keysym, keysym, keycode, keycode);
+    TRACE("'%c'(%lx): got keycode %u\n", cChar, keysym, keycode);
 
     /* keycode -> (keyc2vkey) vkey */
     ret = keyc2vkey[keycode];
@@ -2298,7 +2303,7 @@
                           wine_tsx11_unlock();
 			  return 0; /* whatever */
 			}
-			TRACE("Found keycode %d (0x%2X)\n",e.keycode,e.keycode);
+			TRACE("Found keycode %u\n",e.keycode);
 
                         len = XLookupString(&e, s, sizeof(s), &keysym, NULL);
                         wine_tsx11_unlock();
@@ -2357,7 +2362,7 @@
   }
 
   ansi = X11DRV_MapVirtualKeyEx(vkey, MAPVK_VK_TO_CHAR, X11DRV_GetKeyboardLayout(0));
-  TRACE("scan 0x%04x, vkey 0x%04x, ANSI 0x%04x\n", scanCode, vkey, ansi);
+  TRACE("scan 0x%04x, vkey 0x%04X, ANSI 0x%04x\n", scanCode, vkey, ansi);
 
   /* first get the name of the "regular" keys which is the Upper case
      value of the keycap imprint.                                     */
@@ -2400,7 +2405,7 @@
       keys = XKeycodeToKeysym(display, keyc, 0);
       name = XKeysymToString(keys);
       wine_tsx11_unlock();
-      TRACE("found scan=%04x keyc=%04x keysym=%04x string=%s\n",
+      TRACE("found scan=%04x keyc=%u keysym=%04x string=%s\n",
             scanCode, keyc, (int)keys, name);
       if (lpBuffer && nSize && name)
           return MultiByteToWideChar(CP_UNIXCP, 0, name, -1, lpBuffer, nSize);
@@ -2408,7 +2413,7 @@
 
   /* Finally issue WARN for unknown keys   */
 
-  WARN("(%08x,%p,%d): unsupported key, vkey=%04x, ansi=%04x\n",lParam,lpBuffer,nSize,vkey,ansi);
+  WARN("(%08x,%p,%d): unsupported key, vkey=%04X, ansi=%04x\n",lParam,lpBuffer,nSize,vkey,ansi);
   if (lpBuffer && nSize)
     *lpBuffer = 0;
   return 0;
@@ -2609,9 +2614,9 @@
         wine_tsx11_unlock();
 	return 0;
       }
-    else TRACE("Found keycode %d (0x%2X)\n",e.keycode,e.keycode);
-
-    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode 0x%04x\n",
+    else TRACE("Found keycode %u\n",e.keycode);
+
+    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode %u\n",
 		e.type, e.window, e.state, e.keycode);
 
     /* Clients should pass only KeyPress events to XmbLookupString,
@@ -2647,7 +2652,7 @@
         ksname = XKeysymToString(keysym);
         wine_tsx11_unlock();
         if (!ksname) ksname = "No Name";
-        TRACE_(key)("%s : keysym=%lX (%s), # of chars=%d / %s\n",
+        TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
                     (e.type == KeyPress) ? "KeyPress" : "KeyRelease",
                     keysym, ksname, ret, debugstr_an(lpChar, ret));
     }
@@ -2706,9 +2711,9 @@
 		ksname = "No Name";
 	    if ((keysym >> 8) != 0xff)
 		{
-		WARN("no char for keysym %04lX (%s) :\n",
+		WARN("no char for keysym %04lx (%s) :\n",
                     keysym, ksname);
-		WARN("virtKey=%X, scanCode=%X, keycode=%X, state=%X\n",
+		WARN("virtKey=%X, scanCode=%X, keycode=%u, state=%X\n",
                     virtKey, scanCode, e.keycode, e.state);
 		}
 	    }

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=45910&r1=45909&r2=45910&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 Mar  6 11:03:37 2010
@@ -142,6 +142,31 @@
 }
 
 
+struct has_popup_result
+{
+    HWND hwnd;
+    BOOL found;
+};
+
+static BOOL CALLBACK has_popup( HWND hwnd, LPARAM lparam )
+{
+    struct has_popup_result *result = (struct has_popup_result *)lparam;
+
+    if (hwnd == result->hwnd) return FALSE;  /* popups are always above owner */
+    result->found = (GetWindow( hwnd, GW_OWNER ) == result->hwnd);
+    return !result->found;
+}
+
+static BOOL has_owned_popups( HWND hwnd )
+{
+    struct has_popup_result result;
+
+    result.hwnd = hwnd;
+    result.found = FALSE;
+    EnumWindows( has_popup, (LPARAM)&result );
+    return result.found;
+}
+
 /***********************************************************************
  *		is_window_managed
  *
@@ -181,6 +206,8 @@
     /* application windows are managed */
     ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
     if (ex_style & WS_EX_APPWINDOW) return TRUE;
+    /* windows that own popups are managed */
+    if (has_owned_popups( hwnd )) return TRUE;
     /* default: not managed */
     return FALSE;
 }
@@ -917,7 +944,7 @@
 {
     long i;
     Atom protocols[3];
-    Atom dndVersion = 4;
+    Atom dndVersion = WINE_XDND_VERSION;
     XClassHint *class_hints;
     char *process_name = get_process_name();
 
@@ -966,13 +993,41 @@
 
 
 /***********************************************************************
+ *              get_owner_whole_window
+ *
+ * Retrieve an owner's window, creating it if necessary.
+ */
+static Window get_owner_whole_window( HWND owner )
+{
+    struct x11drv_win_data *data;
+
+    if (!owner) return 0;
+
+    if (!(data = X11DRV_get_win_data( owner )))
+    {
+        if (GetWindowThreadProcessId( owner, NULL ) != GetCurrentThreadId() ||
+            !(data = X11DRV_create_win_data( owner )))
+            return (Window)GetPropA( owner, whole_window_prop );
+    }
+    else if (!data->managed)  /* make it managed */
+    {
+        SetWindowPos( owner, 0, 0, 0, 0, 0,
+                      SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE |
+                      SWP_NOREDRAW | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_STATECHANGED );
+    }
+    return data->whole_window;
+}
+
+
+/***********************************************************************
  *              set_wm_hints
  *
  * Set the window manager hints for a newly-created window
  */
 static void set_wm_hints( Display *display, struct x11drv_win_data *data )
 {
-    Window group_leader;
+    Window group_leader = data->whole_window;
+    Window owner_win = 0;
     Atom window_type;
     MwmHints mwm_hints;
     DWORD style, ex_style;
@@ -990,20 +1045,12 @@
         style = GetWindowLongW( data->hwnd, GWL_STYLE );
         ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
         owner = get_window_owner( data->hwnd );
-    }
-
-    /* transient for hint */
-    if (owner)
-    {
-        Window owner_win = X11DRV_get_whole_window( owner );
-        wine_tsx11_lock();
-        XSetTransientForHint( display, data->whole_window, owner_win );
-        wine_tsx11_unlock();
-        group_leader = owner_win;
-    }
-    else group_leader = data->whole_window;
+        if ((owner_win = get_owner_whole_window( owner ))) group_leader = owner_win;
+    }
 
     wine_tsx11_lock();
+
+    if (owner_win) XSetTransientForHint( display, data->whole_window, owner_win );
 
     /* size hints */
     set_size_hints( display, data, style );

Modified: vendor/wine/dlls/winex11.drv/current/x11drv.h
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/x11drv.h?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/x11drv.h [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/x11drv.h [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -64,6 +64,8 @@
 #define MAX_PIXELFORMATS 8
 #define MAX_DASHLEN 16
 
+#define WINE_XDND_VERSION 4
+
 struct tagCURSORICONINFO;
 
 extern void CDECL wine_tsx11_lock(void);
@@ -125,6 +127,7 @@
     int         *colorMap;          /* color map info */
     int          nColorMap;
     BOOL         trueColor;
+    BOOL         topdown;
     CRITICAL_SECTION lock;          /* GDI access lock */
     enum x11drv_shm_mode shm_mode;
 #ifdef HAVE_LIBXXSHM
@@ -300,7 +303,7 @@
 
 /* IME support */
 extern void IME_UnregisterClasses(void);
-extern void IME_SetOpenStatus(BOOL fOpen);
+extern void IME_SetOpenStatus(BOOL fOpen, BOOL force);
 extern INT IME_GetCursorPos(void);
 extern void IME_SetCursorPos(DWORD pos);
 extern void IME_UpdateAssociation(HWND focus);
@@ -809,6 +812,7 @@
 extern void X11DRV_SetupXIM(void) DECLSPEC_HIDDEN;
 extern void X11DRV_XIMLookupChars( const char *str, DWORD count ) DECLSPEC_HIDDEN;
 extern void X11DRV_ForceXIMReset(HWND hwnd) DECLSPEC_HIDDEN;
+extern BOOL X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen);
 
 /* FIXME: private functions imported from user32 */
 extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode );

Modified: vendor/wine/dlls/winex11.drv/current/xdnd.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/xdnd.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/xdnd.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/xdnd.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -87,13 +87,21 @@
  */
 void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event )
 {
+    int version;
     Atom *xdndtypes;
     unsigned long count = 0;
 
-    TRACE("ver(%ld) check-XdndTypeList(%ld) data=%ld,%ld,%ld,%ld,%ld\n",
-          (event->data.l[1] & 0xFF000000) >> 24, (event->data.l[1] & 1),
+    version = (event->data.l[1] & 0xFF000000) >> 24;
+    TRACE("ver(%d) check-XdndTypeList(%ld) data=%ld,%ld,%ld,%ld,%ld\n",
+          version, (event->data.l[1] & 1),
           event->data.l[0], event->data.l[1], event->data.l[2],
           event->data.l[3], event->data.l[4]);
+
+    if (version > WINE_XDND_VERSION)
+    {
+        TRACE("Ignores unsupported version\n");
+        return;
+    }
 
     /* If the source supports more than 3 data types we retrieve
      * the entire list. */

Modified: vendor/wine/dlls/winex11.drv/current/xim.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/xim.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/xim.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/xim.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -32,7 +32,7 @@
 #include "imm.h"
 #include "wine/debug.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
+WINE_DEFAULT_DEBUG_CHANNEL(xim);
 
 #ifndef HAVE_XICCALLBACK_CALLBACK
 #define XICCallback XIMCallback
@@ -120,10 +120,30 @@
     HeapFree(GetProcessHeap(), 0, wcOutput);
 }
 
+static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data)
+{
+    const struct x11drv_win_data * const win_data = (struct x11drv_win_data *)p;
+    const XIMPreeditState state = ((XIMPreeditStateNotifyCallbackStruct *)data)->state;
+
+    TRACE("xic = %p, win = %lx, state = %lu\n", xic, win_data->whole_window, state);
+    switch (state)
+    {
+    case XIMPreeditEnable:
+        IME_SetOpenStatus(TRUE, TRUE);
+        break;
+    case XIMPreeditDisable:
+        IME_SetOpenStatus(FALSE, TRUE);
+        break;
+    default:
+        break;
+    }
+    return TRUE;
+}
+
 static int XIMPreEditStartCallback(XIC ic, XPointer client_data, XPointer call_data)
 {
     TRACE("PreEditStartCallback %p\n",ic);
-    IME_SetOpenStatus(TRUE);
+    IME_SetOpenStatus(TRUE, FALSE);
     ximInComposeMode = TRUE;
     return -1;
 }
@@ -137,7 +157,7 @@
     dwCompStringSize = 0;
     dwCompStringLength = 0;
     CompositionString = NULL;
-    IME_SetOpenStatus(FALSE);
+    IME_SetOpenStatus(FALSE, FALSE);
 }
 
 static void XIMPreEditDrawCallback(XIM ic, XPointer client_data,
@@ -243,6 +263,51 @@
         wine_tsx11_unlock();
     }
 }
+
+BOOL X11DRV_SetPreeditState(HWND hwnd, BOOL fOpen)
+{
+    XIC ic;
+    XIMPreeditState state;
+    XVaNestedList attr_set, attr_get;
+    BOOL ret;
+
+    ic = X11DRV_get_ic(hwnd);
+    if (!ic)
+        return FALSE;
+
+    if (fOpen)
+        state = XIMPreeditEnable;
+    else
+        state = XIMPreeditDisable;
+
+    ret = FALSE;
+    wine_tsx11_lock();
+
+    attr_set = XVaCreateNestedList(0, XNPreeditState, state, NULL);
+    if (attr_set == NULL)
+        goto error1;
+
+    attr_get = XVaCreateNestedList(0, XNPreeditState, &state, NULL);
+    if (attr_get == NULL)
+        goto error2;
+
+    if (XSetICValues(ic, XNPreeditAttributes, attr_set, NULL) != NULL)
+        goto error3;
+
+    /* SCIM claims it supports XNPreeditState, but seems to ignore */
+    state = XIMPreeditUnKnown;
+    ret = XGetICValues(ic, XNPreeditAttributes, attr_get, NULL) == NULL &&
+          ((fOpen && state == XIMPreeditEnable) ||
+           (!fOpen && state == XIMPreeditDisable));
+error3:
+    XFree(attr_get);
+error2:
+    XFree(attr_set);
+error1:
+    wine_tsx11_unlock();
+    return ret;
+}
+
 
 /***********************************************************************
  *           X11DRV_InitXIM
@@ -446,7 +511,7 @@
     XVaNestedList status = NULL;
     XIC xic;
     XICCallback destroy = {(XPointer)data, (XICProc)X11DRV_DestroyIC};
-    XICCallback P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB;
+    XICCallback P_StateNotifyCB, P_StartCB, P_DoneCB, P_DrawCB, P_CaretCB;
     LANGID langid = PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale()));
     Window win = data->whole_window;
     XFontSet fontSet = x11drv_thread_data()->font_set;
@@ -472,10 +537,12 @@
     }
 
     /* create callbacks */
+    P_StateNotifyCB.client_data = (XPointer)data;
     P_StartCB.client_data = NULL;
     P_DoneCB.client_data = NULL;
     P_DrawCB.client_data = NULL;
     P_CaretCB.client_data = NULL;
+    P_StateNotifyCB.callback = (XICProc)XIMPreEditStateNotifyCallback;
     P_StartCB.callback = (XICProc)XIMPreEditStartCallback;
     P_DoneCB.callback = (XICProc)XIMPreEditDoneCallback;
     P_DrawCB.callback = (XICProc)XIMPreEditDrawCallback;
@@ -486,6 +553,7 @@
         preedit = XVaCreateNestedList(0,
                         XNFontSet, fontSet,
                         XNSpotLocation, &spot,
+                        XNPreeditStateNotifyCallback, &P_StateNotifyCB,
                         XNPreeditStartCallback, &P_StartCB,
                         XNPreeditDoneCallback, &P_DoneCB,
                         XNPreeditDrawCallback, &P_DrawCB,
@@ -496,6 +564,7 @@
     else
     {
         preedit = XVaCreateNestedList(0,
+                        XNPreeditStateNotifyCallback, &P_StateNotifyCB,
                         XNPreeditStartCallback, &P_StartCB,
                         XNPreeditDoneCallback, &P_DoneCB,
                         XNPreeditDrawCallback, &P_DrawCB,

Modified: vendor/wine/dlls/winex11.drv/current/xrender.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/xrender.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/xrender.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/xrender.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -1862,7 +1862,7 @@
     if(xscale != 1.0 || yscale != 1.0)
     {
         if(mask_pict)
-            set_xrender_transformation(mask_pict, xscale, yscale, x_offset, y_offset);
+            set_xrender_transformation(mask_pict, xscale, yscale, x_src + x_offset, y_src + y_offset);
         else
             set_xrender_transformation(src_pict, xscale, yscale, x_src + x_offset, y_src + y_offset);
 
@@ -1871,11 +1871,16 @@
     else
     {
         if(mask_pict)
+        {
             set_xrender_transformation(mask_pict, 1, 1, 0, 0);
+            /* Note since the 'source data' is in the mask picture, we have to pass x_src / y_src using mask_x / mask_y */
+            pXRenderComposite(gdi_display, op, src_pict, mask_pict, dst_pict, 0, 0, x_src, y_src, 0, 0, width, height);
+        }
         else
+        {
             set_xrender_transformation(src_pict, 1, 1, 0, 0);
-
-        pXRenderComposite(gdi_display, op, src_pict, mask_pict, dst_pict, x_src, y_src, 0, 0, 0, 0, width, height);
+            pXRenderComposite(gdi_display, op, src_pict, mask_pict, dst_pict, x_src, y_src, 0, 0, 0, 0, width, height);
+        }
     }
 }
 
@@ -1948,10 +1953,10 @@
 
     /* If the source is a 1x1 bitmap, tiling is equivalent to stretching, but
         tiling is much faster. Therefore, we do no stretching in this case. */
-    repeat_src = dib.dsBmih.biWidth == 1 && abs(dib.dsBmih.biHeight) == 1;
+    repeat_src = dib.dsBmih.biWidth == 1 && dib.dsBmih.biHeight == 1;
 
     if (xSrc < 0 || ySrc < 0 || widthSrc < 0 || heightSrc < 0 || xSrc + widthSrc > dib.dsBmih.biWidth
-        || ySrc + heightSrc > abs(dib.dsBmih.biHeight))
+        || ySrc + heightSrc > dib.dsBmih.biHeight)
     {
         WARN("Invalid src coords: (%d,%d), size %dx%d\n", xSrc, ySrc, widthSrc, heightSrc);
         SetLastError(ERROR_INVALID_PARAMETER);
@@ -1964,7 +1969,7 @@
     }
     dstbits = data = HeapAlloc(GetProcessHeap(), 0, heightSrc * widthSrc * 4);
 
-    if(dib.dsBmih.biHeight < 0) { /* top-down dib */
+    if (devSrc->bitmap->topdown) { /* top-down dib */
         top_down = TRUE;
         dstbits += widthSrc * (heightSrc - 1);
         y2 = ySrc;

Modified: vendor/wine/server/current/console.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/console.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/console.c [iso-8859-1] (original)
+++ vendor/wine/server/current/console.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -294,7 +294,7 @@
     console_input->win           = 0;
     console_input->event         = create_event( NULL, NULL, 0, 1, 0, NULL );
 
-    if (!console_input->history || !console_input->evt)
+    if (!console_input->history || !console_input->evt || !console_input->event)
     {
 	release_object( console_input );
 	return NULL;

Modified: vendor/wine/server/current/debugger.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/debugger.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/debugger.c [iso-8859-1] (original)
+++ vendor/wine/server/current/debugger.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -420,15 +420,9 @@
 /* attach a process to a debugger thread and suspend it */
 static int debugger_attach( struct process *process, struct thread *debugger )
 {
-    struct thread *thread;
-
     if (process->debugger) goto error;  /* already being debugged */
     if (!is_process_init_done( process )) goto error;  /* still starting up */
     if (list_empty( &process->thread_list )) goto error;  /* no thread running in the process */
-
-    /* make sure we don't create a debugging loop */
-    for (thread = debugger; thread; thread = thread->process->debugger)
-        if (thread->process == process) goto error;
 
     /* don't let a debugger debug its console... won't work */
     if (debugger->process->console && console_get_renderer(debugger->process->console)->process == process)

Modified: vendor/wine/server/current/queue.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/queue.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/queue.c [iso-8859-1] (original)
+++ vendor/wine/server/current/queue.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -636,7 +636,7 @@
 static int match_window( user_handle_t win, user_handle_t msg_win )
 {
     if (!win) return 1;
-    if (win == (user_handle_t)-1) return !msg_win;
+    if (win == -1 || win == 1) return !msg_win;
     if (msg_win == win) return 1;
     return is_child_window( win, msg_win );
 }
@@ -1819,6 +1819,7 @@
         return;
     }
 
+    if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event );
     queue->wake_mask = req->wake_mask;
     queue->changed_mask = req->changed_mask;
     set_error( STATUS_PENDING );  /* FIXME */

Modified: vendor/wine/server/current/registry.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/registry.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/registry.c [iso-8859-1] (original)
+++ vendor/wine/server/current/registry.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -84,6 +84,8 @@
 #define KEY_DELETED  0x0002  /* key has been deleted */
 #define KEY_DIRTY    0x0004  /* key has been modified */
 #define KEY_SYMLINK  0x0008  /* key is a symbolic link */
+#define KEY_WOW64    0x0010  /* key contains a Wow6432Node subkey */
+#define KEY_WOWSHARE 0x0020  /* key is a Wow64 shared key (used for Software\Classes) */
 
 /* a key value */
 struct key_value
@@ -109,6 +111,7 @@
 static struct timeout_user *save_timeout_user;  /* saving timer */
 
 static const WCHAR root_name[] = { '\\','R','e','g','i','s','t','r','y','\\' };
+static const WCHAR wow6432node[] = {'W','o','w','6','4','3','2','N','o','d','e'};
 static const WCHAR symlink_value[] = {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e'};
 static const struct unicode_str symlink_str = { symlink_value, sizeof(symlink_value) };
 
@@ -166,6 +169,12 @@
 };
 
 
+static inline int is_wow6432node( const WCHAR *name, unsigned int len )
+{
+    return (len == sizeof(wow6432node) &&
+            !memicmpW( name, wow6432node, sizeof(wow6432node)/sizeof(WCHAR) ));
+}
+
 /*
  * The registry text file format v2 used by this code is similar to the one
  * used by REGEDIT import/export functionality, with the following differences:
@@ -528,6 +537,7 @@
         for (i = ++parent->last_subkey; i > index; i--)
             parent->subkeys[i] = parent->subkeys[i-1];
         parent->subkeys[index] = key;
+        if (is_wow6432node( key->name, key->namelen )) parent->flags |= KEY_WOW64;
     }
     return key;
 }
@@ -546,6 +556,7 @@
     parent->last_subkey--;
     key->flags |= KEY_DELETED;
     key->parent = NULL;
+    if (is_wow6432node( key->name, key->namelen )) parent->flags &= ~KEY_WOW64;
     release_object( key );
 
     /* try to shrink the array */
@@ -587,6 +598,22 @@
     return NULL;
 }
 
+/* return the wow64 variant of the key, or the key itself if none */
+static struct key *find_wow64_subkey( struct key *key, const struct unicode_str *name )
+{
+    static const struct unicode_str wow6432node_str = { wow6432node, sizeof(wow6432node) };
+    int index;
+
+    if (!(key->flags & KEY_WOW64)) return key;
+    if (!is_wow6432node( name->str, name->len ))
+    {
+        key = find_subkey( key, &wow6432node_str, &index );
+        assert( key );  /* if KEY_WOW64 is set we must find it */
+    }
+    return key;
+}
+
+
 /* follow a symlink and return the resolved key */
 static struct key *follow_symlink( struct key *key, int iteration )
 {
@@ -617,9 +644,137 @@
     return key;
 }
 
+/* open a key until we find an element that doesn't exist */
+/* helper for open_key and create_key */
+static struct key *open_key_prefix( struct key *key, const struct unicode_str *name,
+                                    unsigned int access, struct unicode_str *token, int *index )
+{
+    token->str = NULL;
+    if (!get_path_token( name, token )) return NULL;
+    if (access & KEY_WOW64_32KEY) key = find_wow64_subkey( key, token );
+    while (token->len)
+    {
+        struct key *subkey;
+        if (!(subkey = find_subkey( key, token, index )))
+        {
+            if ((key->flags & KEY_WOWSHARE) && !(access & KEY_WOW64_64KEY))
+            {
+                /* try in the 64-bit parent */
+                key = key->parent;
+                subkey = find_subkey( key, token, index );
+            }
+        }
+        if (!subkey) break;
+        key = subkey;
+        get_path_token( name, token );
+        if (!token->len) break;
+        if (!(access & KEY_WOW64_64KEY)) key = find_wow64_subkey( key, token );
+        if (!(key = follow_symlink( key, 0 )))
+        {
+            set_error( STATUS_OBJECT_NAME_NOT_FOUND );
+            return NULL;
+        }
+    }
+    return key;
+}
+
 /* open a subkey */
-static struct key *open_key( struct key *key, const struct unicode_str *name, unsigned int attributes )
-{
+static struct key *open_key( struct key *key, const struct unicode_str *name, unsigned int access,
+                             unsigned int attributes )
+{
+    int index;
+    struct unicode_str token;
+
+    if (!(key = open_key_prefix( key, name, access, &token, &index ))) return NULL;
+
+    if (token.len)
+    {
+        set_error( STATUS_OBJECT_NAME_NOT_FOUND );
+        return NULL;
+    }
+    if (!(access & KEY_WOW64_64KEY)) key = find_wow64_subkey( key, &token );
+    if (!(attributes & OBJ_OPENLINK) && !(key = follow_symlink( key, 0 )))
+    {
+        set_error( STATUS_OBJECT_NAME_NOT_FOUND );
+        return NULL;
+    }
+    if (debug_level > 1) dump_operation( key, NULL, "Open" );
+    grab_object( key );
+    return key;
+}
+
+/* create a subkey */
+static struct key *create_key( struct key *key, const struct unicode_str *name,
+                               const struct unicode_str *class, unsigned int options,
+                               unsigned int access, unsigned int attributes, int *created )
+{
+    int index;
+    struct unicode_str token, next;
+
+    if (key->flags & KEY_DELETED) /* we cannot create a subkey under a deleted key */
+    {
+        set_error( STATUS_KEY_DELETED );
+        return NULL;
+    }
+
+    *created = 0;
+    if (!(key = open_key_prefix( key, name, access, &token, &index ))) return NULL;
+
+    if (!token.len)  /* the key already exists */
+    {
+        if (!(access & KEY_WOW64_64KEY)) key = find_wow64_subkey( key, &token );
+        if (options & REG_OPTION_CREATE_LINK)
+        {
+            set_error( STATUS_OBJECT_NAME_COLLISION );
+            return NULL;
+        }
+        if (!(attributes & OBJ_OPENLINK) && !(key = follow_symlink( key, 0 )))
+        {
+            set_error( STATUS_OBJECT_NAME_NOT_FOUND );
+            return NULL;
+        }
+        if (debug_level > 1) dump_operation( key, NULL, "Open" );
+        grab_object( key );
+        return key;
+    }
+
+    /* token must be the last path component at this point */
+    next = token;
+    get_path_token( name, &next );
+    if (next.len)
+    {
+        set_error( STATUS_OBJECT_NAME_NOT_FOUND );
+        return NULL;
+    }
+
+    if ((key->flags & KEY_VOLATILE) && !(options & REG_OPTION_VOLATILE))
+    {
+        set_error( STATUS_CHILD_MUST_BE_VOLATILE );
+        return NULL;
+    }
+    *created = 1;
+    make_dirty( key );
+    if (!(key = alloc_subkey( key, &token, index, current_time ))) return NULL;
+
+    if (options & REG_OPTION_CREATE_LINK) key->flags |= KEY_SYMLINK;
+    if (options & REG_OPTION_VOLATILE) key->flags |= KEY_VOLATILE;
+    else key->flags |= KEY_DIRTY;
+
+    if (debug_level > 1) dump_operation( key, NULL, "Create" );
+    if (class && class->len)
+    {
+        key->classlen = class->len;
+        free(key->class);
+        if (!(key->class = memdup( class->str, key->classlen ))) key->classlen = 0;
+    }
+    grab_object( key );
+    return key;
+}
+
+/* recursively create a subkey (for internal use only) */
+static struct key *create_key_recursive( struct key *key, const struct unicode_str *name, timeout_t modif )
+{
+    struct key *base;
     int index;
     struct unicode_str token;
 
@@ -627,113 +782,34 @@
     if (!get_path_token( name, &token )) return NULL;
     while (token.len)
     {
-        if (!(key = find_subkey( key, &token, &index )))
-        {
-            set_error( STATUS_OBJECT_NAME_NOT_FOUND );
-            return NULL;
-        }
-        get_path_token( name, &token );
-        if (!token.len) break;
-        if (!(key = follow_symlink( key, 0 )))
-        {
-            set_error( STATUS_OBJECT_NAME_NOT_FOUND );
-            return NULL;
-        }
-    }
-
-    if (!(attributes & OBJ_OPENLINK) && !(key = follow_symlink( key, 0 )))
-    {
-        set_error( STATUS_OBJECT_NAME_NOT_FOUND );
-        return NULL;
-    }
-    if (debug_level > 1) dump_operation( key, NULL, "Open" );
-    grab_object( key );
-    return key;
-}
-
-/* create a subkey */
-static struct key *create_key( struct key *key, const struct unicode_str *name,
-                               const struct unicode_str *class, int flags, unsigned int options,
-                               unsigned int attributes, timeout_t modif, int *created )
-{
-    struct key *base;
-    int index;
-    struct unicode_str token;
-
-    if (key->flags & KEY_DELETED) /* we cannot create a subkey under a deleted key */
-    {
-        set_error( STATUS_KEY_DELETED );
-        return NULL;
-    }
-
-    token.str = NULL;
-    if (!get_path_token( name, &token )) return NULL;
-    *created = 0;
-    while (token.len)
-    {
         struct key *subkey;
         if (!(subkey = find_subkey( key, &token, &index ))) break;
         key = subkey;
-        get_path_token( name, &token );
-        if (!token.len) break;
-        if (!(subkey = follow_symlink( subkey, 0 )))
+        if (!(key = follow_symlink( key, 0 )))
         {
             set_error( STATUS_OBJECT_NAME_NOT_FOUND );
             return NULL;
         }
-    }
-
-    /* create the remaining part */
-
-    if (!token.len)
-    {
-        if (options & REG_OPTION_CREATE_LINK)
-        {
-            set_error( STATUS_OBJECT_NAME_COLLISION );
-            return NULL;
-        }
-        if (!(attributes & OBJ_OPENLINK) && !(key = follow_symlink( key, 0 )))
-        {
-            set_error( STATUS_OBJECT_NAME_NOT_FOUND );
-            return NULL;
-        }
-        goto done;
-    }
-    if (options & REG_OPTION_VOLATILE)
-    {
-        flags = (flags & ~KEY_DIRTY) | KEY_VOLATILE;
-    }
-    else if (key->flags & KEY_VOLATILE)
-    {
-        set_error( STATUS_CHILD_MUST_BE_VOLATILE );
-        return NULL;
-    }
-    *created = 1;
-    if (flags & KEY_DIRTY) make_dirty( key );
-    if (!(key = alloc_subkey( key, &token, index, modif ))) return NULL;
-    base = key;
-    for (;;)
-    {
-        key->flags |= flags;
         get_path_token( name, &token );
-        if (!token.len) break;
-        /* we know the index is always 0 in a new key */
-        if (!(key = alloc_subkey( key, &token, 0, modif )))
-        {
-            free_subkey( base, index );
-            return NULL;
-        }
-    }
-    if (options & REG_OPTION_CREATE_LINK) key->flags |= KEY_SYMLINK;
-
- done:
-    if (debug_level > 1) dump_operation( key, NULL, "Create" );
-    if (class && class->len)
-    {
-        key->classlen = class->len;
-        free(key->class);
-        if (!(key->class = memdup( class->str, key->classlen ))) key->classlen = 0;
-    }
+    }
+
+    if (token.len)
+    {
+        if (!(key = alloc_subkey( key, &token, index, modif ))) return NULL;
+        base = key;
+        for (;;)
+        {
+            get_path_token( name, &token );
+            if (!token.len) break;
+            /* we know the index is always 0 in a new key */
+            if (!(key = alloc_subkey( key, &token, 0, modif )))
+            {
+                free_subkey( base, index );
+                return NULL;
+            }
+        }
+    }
+
     grab_object( key );
     return key;
 }
@@ -1191,7 +1267,7 @@
 }
 
 /* load and create a key from the input file */
-static struct key *load_key( struct key *base, const char *buffer, int flags,
+static struct key *load_key( struct key *base, const char *buffer,
                              int prefix_len, struct file_load_info *info )
 {
     WCHAR *p;
@@ -1227,7 +1303,7 @@
     }
     name.str = p;
     name.len = len - (p - info->tmp + 1) * sizeof(WCHAR);
-    return create_key( base, &name, NULL, flags, 0, 0, modif, &res );
+    return create_key_recursive( base, &name, modif );
 }
 
 /* load a key option from the input file */
@@ -1440,7 +1516,7 @@
         case '[':   /* new key */
             if (subkey) release_object( subkey );
             if (prefix_len == -1) prefix_len = get_prefix_len( key, p + 1, &info );
-            if (!(subkey = load_key( key, p + 1, key->flags, prefix_len, &info )))
+            if (!(subkey = load_key( key, p + 1, prefix_len, &info )))
                 file_read_error( "Error creating key", &info );
             break;
         case '@':   /* default value */
@@ -1538,15 +1614,17 @@
 {
     static const WCHAR HKLM[] = { 'M','a','c','h','i','n','e' };
     static const WCHAR HKU_default[] = { 'U','s','e','r','\\','.','D','e','f','a','u','l','t' };
+    static const WCHAR classes[] = {'S','o','f','t','w','a','r','e','\\',
+                                    'C','l','a','s','s','e','s','\\',
+                                    'W','o','w','6','4','3','2','N','o','d','e'};
     static const struct unicode_str root_name = { NULL, 0 };
     static const struct unicode_str HKLM_name = { HKLM, sizeof(HKLM) };
     static const struct unicode_str HKU_name = { HKU_default, sizeof(HKU_default) };
+    static const struct unicode_str classes_name = { classes, sizeof(classes) };
 
     WCHAR *current_user_path;
     struct unicode_str current_user_str;
-
-    struct key *key;
-    int dummy;
+    struct key *key, *hklm, *hkcu;
 
     /* switch to the config dir */
 
@@ -1559,15 +1637,14 @@
 
     /* load system.reg into Registry\Machine */
 
-    if (!(key = create_key( root_key, &HKLM_name, NULL, 0, 0, 0, current_time, &dummy )))
+    if (!(hklm = create_key_recursive( root_key, &HKLM_name, current_time )))
         fatal_error( "could not create Machine registry key\n" );
 
-    load_init_registry_from_file( "system.reg", key );
-    release_object( key );
+    load_init_registry_from_file( "system.reg", hklm );
 
     /* load userdef.reg into Registry\User\.Default */
 
-    if (!(key = create_key( root_key, &HKU_name, NULL, 0, 0, 0, current_time, &dummy )))
+    if (!(key = create_key_recursive( root_key, &HKU_name, current_time )))
         fatal_error( "could not create User\\.Default registry key\n" );
 
     load_init_registry_from_file( "userdef.reg", key );
@@ -1578,11 +1655,24 @@
     /* FIXME: match default user in token.c. should get from process token instead */
     current_user_path = format_user_registry_path( security_interactive_sid, &current_user_str );
     if (!current_user_path ||
-        !(key = create_key( root_key, &current_user_str, NULL, 0, 0, 0, current_time, &dummy )))
+        !(hkcu = create_key_recursive( root_key, &current_user_str, current_time )))
         fatal_error( "could not create HKEY_CURRENT_USER registry key\n" );
     free( current_user_path );
-    load_init_registry_from_file( "user.reg", key );
-    release_object( key );
+    load_init_registry_from_file( "user.reg", hkcu );
+
+    /* set the shared flag on Software\Classes\Wow6432Node */
+    if (sizeof(void *) > sizeof(int))
+    {
+        if ((key = create_key_recursive( hklm, &classes_name, current_time )))
+        {
+            key->flags |= KEY_WOWSHARE;
+            release_object( key );
+        }
+        /* FIXME: handle HKCU too */
+    }
+
+    release_object( hklm );
+    release_object( hkcu );
 
     /* start the periodic save timer */
     set_periodic_save_timer();
@@ -1751,6 +1841,8 @@
     struct unicode_str name, class;
     unsigned int access = req->access;
 
+    if (!is_wow64_thread( current )) access = (access & ~KEY_WOW64_32KEY) | KEY_WOW64_64KEY;
+
     reply->hkey = 0;
 
     if (req->namelen > get_req_data_size())
@@ -1771,8 +1863,8 @@
     /* NOTE: no access rights are required from the parent handle to create a key */
     if ((parent = get_parent_hkey_obj( req->parent )))
     {
-        if ((key = create_key( parent, &name, &class, KEY_DIRTY, req->options,
-                               req->attributes, current_time, &reply->created )))
+        if ((key = create_key( parent, &name, &class, req->options, access,
+                               req->attributes, &reply->created )))
         {
             reply->hkey = alloc_handle( current->process, key, access, req->attributes );
             release_object( key );
@@ -1788,12 +1880,14 @@
     struct unicode_str name;
     unsigned int access = req->access;
 
+    if (!is_wow64_thread( current )) access = (access & ~KEY_WOW64_32KEY) | KEY_WOW64_64KEY;
+
     reply->hkey = 0;
     /* NOTE: no access rights are required to open the parent key, only the child key */
     if ((parent = get_parent_hkey_obj( req->parent )))
     {
         get_req_path( &name, !req->parent );
-        if ((key = open_key( parent, &name, req->attributes )))
+        if ((key = open_key( parent, &name, access, req->attributes )))
         {
             reply->hkey = alloc_handle( current->process, key, access, req->attributes );
             release_object( key );
@@ -1927,7 +2021,7 @@
     {
         int dummy;
         get_req_path( &name, !req->hkey );
-        if ((key = create_key( parent, &name, NULL, KEY_DIRTY, 0, 0, current_time, &dummy )))
+        if ((key = create_key( parent, &name, NULL, 0, KEY_WOW64_64KEY, 0, &dummy )))
         {
             load_registry( key, req->file );
             release_object( key );

Modified: vendor/wine/server/current/thread.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/thread.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/thread.c [iso-8859-1] (original)
+++ vendor/wine/server/current/thread.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -67,6 +67,7 @@
 #else
 #error Unsupported CPU
 #endif
+#define CPU_64BIT_MASK CPU_FLAG(CPU_x86_64)
 
 /* thread queues */
 
@@ -408,6 +409,12 @@
     return NULL;
 }
 
+/* determine if the thread is wow64 (32-bit client running on 64-bit server) */
+int is_wow64_thread( struct thread *thread )
+{
+    return (supported_cpus & CPU_64BIT_MASK) && !(CPU_FLAG(thread->process->cpu) & CPU_64BIT_MASK);
+}
+
 int set_thread_affinity( struct thread *thread, affinity_t affinity )
 {
     int ret = 0;

Modified: vendor/wine/server/current/thread.h
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/thread.h?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/thread.h [iso-8859-1] (original)
+++ vendor/wine/server/current/thread.h [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -118,6 +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 int is_wow64_thread( struct thread *thread );
 extern int set_thread_affinity( struct thread *thread, affinity_t affinity );
 
 /* ptrace functions */

Modified: vendor/wine/server/current/trace.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/server/current/trace.c?rev=45910&r1=45909&r2=45910&view=diff
==============================================================================
--- vendor/wine/server/current/trace.c [iso-8859-1] (original)
+++ vendor/wine/server/current/trace.c [iso-8859-1] Sat Mar  6 11:03:37 2010
@@ -438,7 +438,7 @@
                      ctx.debug.i386_regs.dr3, ctx.debug.i386_regs.dr6, ctx.debug.i386_regs.dr7 );
         if (ctx.flags & SERVER_CTX_FLOATING_POINT)
         {
-            fprintf( stderr, "fp.ctrl=%08x,fp.status=%08x,fp.tag=%08x,fp.err_off=%08x,fp.err_sel=%08x",
+            fprintf( stderr, ",fp.ctrl=%08x,fp.status=%08x,fp.tag=%08x,fp.err_off=%08x,fp.err_sel=%08x",
                      ctx.fp.i386_regs.ctrl, ctx.fp.i386_regs.status, ctx.fp.i386_regs.tag,
                      ctx.fp.i386_regs.err_off, ctx.fp.i386_regs.err_sel );
             fprintf( stderr, ",fp.data_off=%08x,fp.data_sel=%08x,fp.cr0npx=%08x",




More information about the Ros-diffs mailing list