Author: fireball
Date: Wed Feb  9 13:10:50 2011
New Revision: 50631

URL: http://svn.reactos.org/svn/reactos?rev=50631&view=rev
Log:
[VENDOR/WINE]
- Import Wine-1.3.13 gdi32, user32, winex11.drv, server.
- IMPORTANT: user32 translatable resources were NOT imported.

Modified:
    vendor/wine/dlls/gdi32/current/font.c
    vendor/wine/dlls/gdi32/current/tests/clipping.c
    vendor/wine/dlls/gdi32/current/tests/font.c
    vendor/wine/dlls/user32/current/clipboard.c
    vendor/wine/dlls/user32/current/cursoricon.c
    vendor/wine/dlls/user32/current/mdi.c
    vendor/wine/dlls/user32/current/tests/clipboard.c
    vendor/wine/dlls/user32/current/tests/edit.c
    vendor/wine/dlls/winex11.drv/current/clipboard.c
    vendor/wine/dlls/winex11.drv/current/dib.c
    vendor/wine/dlls/winex11.drv/current/window.c
    vendor/wine/dlls/winex11.drv/current/xrender.c
    vendor/wine/server/current/mapping.c
    vendor/wine/server/current/registry.c
    vendor/wine/server/current/sock.c

Modified: vendor/wine/dlls/gdi32/current/font.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/font.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/font.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/font.c [iso-8859-1] Wed Feb  9 13:10:50 2011
@@ -1553,7 +1553,7 @@
     return ret;
 }
 
-static LPSTR FONT_GetCharsByRangeA(UINT firstChar, UINT lastChar, PINT 
pByteLen)
+static LPSTR FONT_GetCharsByRangeA(HDC hdc, UINT firstChar, UINT lastChar, 
PINT pByteLen)
 {
     INT i, count = lastChar - firstChar + 1;
     UINT c;
@@ -1561,6 +1561,24 @@
 
     if (count <= 0)
         return NULL;
+
+    switch (GdiGetCodePage(hdc))
+    {
+    case 932:
+    case 936:
+    case 949:
+    case 950:
+    case 1361:
+        if (lastChar > 0xffff)
+            return NULL;
+        if ((firstChar ^ lastChar) > 0xff)
+            return NULL;
+        break;
+    default:
+        if (lastChar > 0xff)
+            return NULL;
+        break;
+    }
 
     str = HeapAlloc(GetProcessHeap(), 0, count * 2 + 1);
     if (str == NULL)
@@ -1620,7 +1638,7 @@
     LPWSTR wstr;
     BOOL ret = TRUE;
 
-    str = FONT_GetCharsByRangeA(firstChar, lastChar, &i);
+    str = FONT_GetCharsByRangeA(hdc, firstChar, lastChar, &i);
     if(str == NULL)
         return FALSE;
 
@@ -2014,7 +2032,16 @@
                 rc.right = x + width.x;
                 rc.top = y - tm.tmAscent;
                 rc.bottom = y + tm.tmDescent;
-                dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, 
NULL, 0, NULL);
+
+                if(flags & ETO_CLIPPED)
+                {
+                    rc.left = max(lprect->left, rc.left);
+                    rc.right = min(lprect->right, rc.right);
+                    rc.top = max(lprect->top, rc.top);
+                    rc.bottom = min(lprect->bottom, rc.bottom);
+                }
+                if(rc.left < rc.right && rc.top < rc.bottom)
+                    dc->funcs->pExtTextOut(dc->physDev, 0, 0, ETO_OPAQUE, &rc, 
NULL, 0, NULL);
             }
         }
     }
@@ -2324,7 +2351,7 @@
     LPWSTR wstr;
     BOOL ret = TRUE;
 
-    str = FONT_GetCharsByRangeA(firstChar, lastChar, &i);
+    str = FONT_GetCharsByRangeA(hdc, firstChar, lastChar, &i);
     if (str == NULL)
         return FALSE;
 
@@ -2468,16 +2495,15 @@
                                  LPGLYPHMETRICS lpgm, DWORD cbBuffer,
                                  LPVOID lpBuffer, const MAT2 *lpmat2 )
 {
-    LPWSTR p = NULL;
-    DWORD ret;
-    UINT c;
-
     if (!lpmat2) return GDI_ERROR;
 
     if(!(fuFormat & GGO_GLYPH_INDEX)) {
+        UINT cp;
         int len;
         char mbchs[2];
-        if(uChar > 0xff) { /* but, 2 bytes character only */
+
+        cp = GdiGetCodePage(hdc);
+        if (IsDBCSLeadByteEx(cp, uChar >> 8)) {
             len = 2;
             mbchs[0] = (uChar & 0xff00) >> 8;
             mbchs[1] = (uChar & 0xff);
@@ -2485,14 +2511,11 @@
             len = 1;
             mbchs[0] = (uChar & 0xff);
         }
-        p = FONT_mbtowc(hdc, mbchs, len, NULL, NULL);
-       c = p[0];
-    } else
-        c = uChar;
-    ret = GetGlyphOutlineW(hdc, c, fuFormat, lpgm, cbBuffer, lpBuffer,
-                          lpmat2);
-    HeapFree(GetProcessHeap(), 0, p);
-    return ret;
+        MultiByteToWideChar(cp, 0, mbchs, len, (LPWSTR)&uChar, 1);
+    }
+
+    return GetGlyphOutlineW(hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer,
+                            lpmat2);
 }
 
 /***********************************************************************
@@ -3010,7 +3033,7 @@
     LPWSTR wstr;
     BOOL ret = TRUE;
 
-    str = FONT_GetCharsByRangeA(first, last, &i);
+    str = FONT_GetCharsByRangeA(hdc, first, last, &i);
     if (str == NULL)
         return FALSE;
 

Modified: vendor/wine/dlls/gdi32/current/tests/clipping.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/clipping.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/clipping.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/clipping.c [iso-8859-1] Wed Feb  9 
13:10:50 2011
@@ -353,9 +353,110 @@
     ReleaseDC(NULL, hdc);
 }
 
+static void test_memory_dc_clipping(void)
+{
+    HDC hdc;
+    HRGN hrgn, hrgn_empty;
+    HBITMAP hbmp;
+    RECT rc;
+    int ret;
+
+    hdc = CreateCompatibleDC(0);
+    hrgn_empty = CreateRectRgn(0, 0, 0, 0);
+    hrgn = CreateRectRgn(0, 0, 0, 0);
+    hbmp = CreateCompatibleBitmap(hdc, 100, 100);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 0, "expected 0, got %d\n", ret);
+
+    ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 1, "expected 1, got %d\n", ret);
+
+    ret = GetRgnBox(hrgn, &rc);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+    ok(rc.left == 0 && rc.top == 0 && rc.right == 1 && rc.bottom == 1,
+       "expected 0,0-1,1, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, 
rc.bottom);
+
+    ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 0, "expected 0, got %d\n", ret);
+
+    SelectObject(hdc, hbmp);
+
+    ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 1, "expected 1, got %d\n", ret);
+
+    ret = GetRgnBox(hrgn, &rc);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+    ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100,
+       "expected 0,0-100,100, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, 
rc.bottom);
+
+    DeleteDC(hdc);
+    DeleteObject(hrgn);
+    DeleteObject(hrgn_empty);
+    DeleteObject(hbmp);
+}
+
+static void test_window_dc_clipping(void)
+{
+    HDC hdc;
+    HRGN hrgn, hrgn_empty;
+    HWND hwnd;
+    RECT rc;
+    int ret, screen_width, screen_height;
+
+    screen_width = GetSystemMetrics(SM_CXSCREEN);
+    screen_height = GetSystemMetrics(SM_CYSCREEN);
+
+    trace("screen resolution %d x %d\n", screen_width, screen_height);
+
+    hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
+                           -100, -100, screen_width * 2, screen_height * 2, 0, 
0, 0, NULL);
+    hdc = GetWindowDC(0);
+    hrgn_empty = CreateRectRgn(0, 0, 0, 0);
+    hrgn = CreateRectRgn(0, 0, 0, 0);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 0, "expected 0, got %d\n", ret);
+
+    ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 1, "expected 1, got %d\n", ret);
+
+    ret = GetRgnBox(hrgn, &rc);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+    ok(rc.left == 0 && rc.top == 0 && rc.right == screen_width && rc.bottom == 
screen_height,
+       "expected 0,0-%d,%d, got %d,%d-%d,%d\n", screen_width, screen_height,
+        rc.left, rc.top, rc.right, rc.bottom);
+
+    ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
+    ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+
+    ret = GetClipRgn(hdc, hrgn);
+    ok(ret == 0, "expected 0, got %d\n", ret);
+
+    DeleteDC(hdc);
+    DeleteObject(hrgn);
+    DeleteObject(hrgn_empty);
+    DestroyWindow(hwnd);
+}
+
+
 START_TEST(clipping)
 {
     test_GetRandomRgn();
     test_ExtCreateRegion();
     test_GetClipRgn();
-}
+    test_memory_dc_clipping();
+    test_window_dc_clipping();
+}

Modified: vendor/wine/dlls/gdi32/current/tests/font.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/font.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/font.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/font.c [iso-8859-1] Wed Feb  9 
13:10:50 2011
@@ -50,6 +50,7 @@
 static BOOL  (WINAPI *pRemoveFontMemResourceEx)(HANDLE);
 
 static HMODULE hgdi32 = 0;
+static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
 
 static void init(void)
 {
@@ -410,7 +411,6 @@
     INT width_orig, height_orig, lfWidth;
     XFORM xform;
     GLYPHMETRICS gm;
-    MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
     MAT2 mat2 = { {0x8000,0}, {0,0}, {0,0}, {0x8000,0} };
     POINT pt;
     INT ret;
@@ -670,6 +670,7 @@
         int weight, height, ascent, descent, int_leading, ext_leading;
         int ave_char_width, max_char_width, dpi;
         DWORD ansi_bitfield;
+        WORD skip_lang_id;
     } fd[] =
     {
         { "MS Sans Serif", FW_NORMAL, 13, 11, 2, 2, 0, 5, 11, 96, FS_LATIN1 | 
FS_LATIN2 | FS_CYRILLIC },
@@ -741,19 +742,23 @@
         { "Small Fonts", FW_NORMAL, 3, 2, 1, 0, 0, 1, 2, 96, FS_LATIN1 },
         { "Small Fonts", FW_NORMAL, 3, 2, 1, 0, 0, 1, 8, 96, FS_LATIN2 | 
FS_CYRILLIC },
         { "Small Fonts", FW_NORMAL, 3, 2, 1, 0, 0, 2, 4, 96, FS_JISJAPAN },
-        { "Small Fonts", FW_NORMAL, 5, 4, 1, 1, 0, 3, 4, 96, FS_LATIN1 },
+        { "Small Fonts", FW_NORMAL, 5, 4, 1, 1, 0, 3, 4, 96, FS_LATIN1, 
LANG_ARABIC },
         { "Small Fonts", FW_NORMAL, 5, 4, 1, 1, 0, 2, 8, 96, FS_LATIN2 | 
FS_CYRILLIC },
         { "Small Fonts", FW_NORMAL, 5, 4, 1, 0, 0, 3, 6, 96, FS_JISJAPAN },
-        { "Small Fonts", FW_NORMAL, 6, 5, 1, 1, 0, 3, 13, 96, FS_LATIN1 },
+        { "Small Fonts", FW_NORMAL, 6, 5, 1, 1, 0, 3, 13, 96, FS_LATIN1, 
LANG_ARABIC },
         { "Small Fonts", FW_NORMAL, 6, 5, 1, 1, 0, 3, 8, 96, FS_LATIN2 | 
FS_CYRILLIC },
+        { "Small Fonts", FW_NORMAL, 6, 5, 1, 1, 0, 3, 8, 96, FS_ARABIC },
         { "Small Fonts", FW_NORMAL, 6, 5, 1, 0, 0, 4, 8, 96, FS_JISJAPAN },
-        { "Small Fonts", FW_NORMAL, 8, 7, 1, 1, 0, 4, 7, 96, FS_LATIN1 },
+        { "Small Fonts", FW_NORMAL, 8, 7, 1, 1, 0, 4, 7, 96, FS_LATIN1, 
LANG_ARABIC },
         { "Small Fonts", FW_NORMAL, 8, 7, 1, 1, 0, 4, 8, 96, FS_LATIN2 | 
FS_CYRILLIC },
+        { "Small Fonts", FW_NORMAL, 8, 7, 1, 1, 0, 4, 8, 96, FS_ARABIC },
         { "Small Fonts", FW_NORMAL, 8, 7, 1, 0, 0, 5, 10, 96, FS_JISJAPAN },
-        { "Small Fonts", FW_NORMAL, 10, 8, 2, 2, 0, 4, 8, 96, FS_LATIN1 | 
FS_LATIN2 },
+        { "Small Fonts", FW_NORMAL, 10, 8, 2, 2, 0, 4, 8, 96, FS_LATIN1 | 
FS_LATIN2, LANG_ARABIC },
         { "Small Fonts", FW_NORMAL, 10, 8, 2, 2, 0, 5, 8, 96, FS_CYRILLIC },
+        { "Small Fonts", FW_NORMAL, 10, 8, 2, 2, 0, 4, 9, 96, FS_ARABIC },
         { "Small Fonts", FW_NORMAL, 10, 8, 2, 0, 0, 6, 12, 96, FS_JISJAPAN },
-        { "Small Fonts", FW_NORMAL, 11, 9, 2, 2, 0, 5, 9, 96, FS_LATIN1 | 
FS_LATIN2 | FS_CYRILLIC },
+        { "Small Fonts", FW_NORMAL, 11, 9, 2, 2, 0, 5, 9, 96, FS_LATIN1 | 
FS_LATIN2 | FS_CYRILLIC, LANG_ARABIC },
+        { "Small Fonts", FW_NORMAL, 11, 9, 2, 2, 0, 4, 10, 96, FS_ARABIC },
         { "Small Fonts", FW_NORMAL, 11, 9, 2, 0, 0, 7, 14, 96, FS_JISJAPAN },
 
         { "Small Fonts", FW_NORMAL, 3, 2, 1, 0, 0, 1, 2, 120, FS_LATIN1 | 
FS_JISJAPAN },
@@ -783,6 +788,9 @@
     HFONT hfont, old_hfont;
     TEXTMETRIC tm;
     INT ret, i;
+    WORD system_lang_id;
+
+    system_lang_id = PRIMARYLANGID(GetSystemDefaultLangID());
 
     hdc = CreateCompatibleDC(0);
     assert(hdc);
@@ -818,18 +826,24 @@
             if(fd[i].dpi == tm.tmDigitizedAspectX)
             {
                 trace("found font %s, height %d charset %x dpi %d\n", 
lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
-                ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmWeight, fd[i].weight);
-                ok(tm.tmHeight == fd[i].height, "%s(%d): tm.tmHeight %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmHeight, fd[i].height);
-                ok(tm.tmAscent == fd[i].ascent, "%s(%d): tm.tmAscent %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmAscent, fd[i].ascent);
-                ok(tm.tmDescent == fd[i].descent, "%s(%d): tm.tmDescent %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmDescent, fd[i].descent);
-                ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): 
tm.tmInternalLeading %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmInternalLeading, fd[i].int_leading);
-                ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): 
tm.tmExternalLeading %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmExternalLeading, fd[i].ext_leading);
-                ok(tm.tmAveCharWidth == fd[i].ave_char_width, "%s(%d): 
tm.tmAveCharWidth %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmAveCharWidth, fd[i].ave_char_width);
-
-                /* Don't run the max char width test on System/ANSI_CHARSET.  
We have extra characters in our font
-                   that make the max width bigger */
-                if(strcmp(lf.lfFaceName, "System") || lf.lfCharSet != 
ANSI_CHARSET)
-                    ok(tm.tmMaxCharWidth == fd[i].max_char_width, "%s(%d): 
tm.tmMaxCharWidth %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmMaxCharWidth, fd[i].max_char_width);
+                if (fd[i].skip_lang_id == 0 || system_lang_id != 
fd[i].skip_lang_id)
+                {
+                    ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmWeight, fd[i].weight);
+                    ok(tm.tmHeight == fd[i].height, "%s(%d): tm.tmHeight %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmHeight, fd[i].height);
+                    ok(tm.tmAscent == fd[i].ascent, "%s(%d): tm.tmAscent %d != 
%d\n", fd[i].face_name, fd[i].height, tm.tmAscent, fd[i].ascent);
+                    ok(tm.tmDescent == fd[i].descent, "%s(%d): tm.tmDescent %d 
!= %d\n", fd[i].face_name, fd[i].height, tm.tmDescent, fd[i].descent);
+                    ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): 
tm.tmInternalLeading %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmInternalLeading, fd[i].int_leading);
+                    ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): 
tm.tmExternalLeading %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmExternalLeading, fd[i].ext_leading);
+                    ok(tm.tmAveCharWidth == fd[i].ave_char_width, "%s(%d): 
tm.tmAveCharWidth %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmAveCharWidth, fd[i].ave_char_width);
+
+                    /* Don't run the max char width test on 
System/ANSI_CHARSET.  We have extra characters in our font
+                       that make the max width bigger */
+                    if(strcmp(lf.lfFaceName, "System") || lf.lfCharSet != 
ANSI_CHARSET)
+                        ok(tm.tmMaxCharWidth == fd[i].max_char_width, "%s(%d): 
tm.tmMaxCharWidth %d != %d\n", fd[i].face_name, fd[i].height, 
tm.tmMaxCharWidth, fd[i].max_char_width);
+                }
+                else
+                    skip("Skipping font metrics test for system langid 0x%x\n",
+                         system_lang_id);
             }
             SelectObject(hdc, old_hfont);
             DeleteObject(hfont);
@@ -908,16 +922,36 @@
     DWORD nb;
     static const struct
     {
+        UINT first;
+        UINT last;
+    } range[] =
+    {
+        {0xff, 0xff},
+        {0x100, 0x100},
+        {0xff, 0x100},
+        {0x1ff, 0xff00},
+        {0xffff, 0xffff},
+        {0x10000, 0x10000},
+        {0xffff, 0x10000},
+        {0xffffff, 0xffffff},
+        {0x1000000, 0x1000000},
+        {0xffffff, 0x1000000},
+        {0xffffffff, 0xffffffff}
+    };
+    static const struct
+    {
         UINT cs;
         UINT a;
         UINT w;
+        BOOL r[sizeof range / sizeof range[0]];
     } c[] =
     {
-        {SHIFTJIS_CHARSET, 0x82a0, 0x3042},
-        {HANGEUL_CHARSET, 0x8141, 0xac02},
-        {JOHAB_CHARSET, 0x8446, 0x3135},
-        {GB2312_CHARSET, 0x8141, 0x4e04},
-        {CHINESEBIG5_CHARSET, 0xa142, 0x3001}
+        {ANSI_CHARSET, 0x30, 0x30, {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, 
FALSE, FALSE, FALSE, FALSE}},
+        {SHIFTJIS_CHARSET, 0x82a0, 0x3042, {TRUE, TRUE, FALSE, FALSE, TRUE, 
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {HANGEUL_CHARSET, 0x8141, 0xac02, {TRUE, TRUE, FALSE, FALSE, TRUE, 
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {JOHAB_CHARSET, 0x8446, 0x3135, {TRUE, TRUE, FALSE, FALSE, TRUE, 
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {GB2312_CHARSET, 0x8141, 0x4e04, {TRUE, TRUE, FALSE, FALSE, TRUE, 
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}},
+        {CHINESEBIG5_CHARSET, 0xa142, 0x3001, {TRUE, TRUE, FALSE, FALSE, TRUE, 
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}}
     };
     UINT i;
 
@@ -963,7 +997,7 @@
     {
         ABC a[2], w[2];
         ABC full[256];
-        UINT code = 0x41;
+        UINT code = 0x41, j;
 
         lf.lfFaceName[0] = '\0';
         lf.lfCharSet = c[i].cs;
@@ -990,6 +1024,13 @@
         ok(ret, "GetCharABCWidthsA should have succeeded\n");
         ok(memcmp(&a[0], &full[code], sizeof(ABC)) == 0,
            "GetCharABCWidthsA info should match. codepage = %u\n", c[i].cs);
+
+        for (j = 0; j < sizeof range / sizeof range[0]; ++j)
+        {
+            ret = pGetCharABCWidthsA(hdc, range[j].first, range[j].last, full);
+            ok(ret == c[i].r[j], "GetCharABCWidthsA %x - %x should have %s\n",
+               range[j].first, range[j].last, c[i].r[j] ? "succeeded" : 
"failed");
+        }
 
         hfont = SelectObject(hdc, hfont);
         DeleteObject(hfont);
@@ -2134,7 +2175,6 @@
     GLYPHMETRICS gm1, gm2;
     LOGFONTA lf2 = *lf;
     WORD idx;
-    MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
 
     if(!pGetGlyphIndicesA)
         return;
@@ -3055,12 +3095,26 @@
 
 static void test_GetGlyphOutline(void)
 {
-    MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
     HDC hdc;
-    GLYPHMETRICS gm;
+    GLYPHMETRICS gm, gm2;
     LOGFONTA lf;
     HFONT hfont, old_hfont;
-    INT ret;
+    INT ret, ret2;
+    static const struct
+    {
+        UINT cs;
+        UINT a;
+        UINT w;
+    } c[] =
+    {
+        {ANSI_CHARSET, 0x30, 0x30},
+        {SHIFTJIS_CHARSET, 0x82a0, 0x3042},
+        {HANGEUL_CHARSET, 0x8141, 0xac02},
+        {JOHAB_CHARSET, 0x8446, 0x3135},
+        {GB2312_CHARSET, 0x8141, 0x4e04},
+        {CHINESEBIG5_CHARSET, 0xa142, 0x3001}
+    };
+    UINT i;
 
     if (!is_truetype_font_installed("Tahoma"))
     {
@@ -3124,6 +3178,32 @@
 
     SelectObject(hdc, old_hfont);
     DeleteObject(hfont);
+
+    for (i = 0; i < sizeof c / sizeof c[0]; ++i)
+    {
+        lf.lfFaceName[0] = '\0';
+        lf.lfCharSet = c[i].cs;
+        lf.lfPitchAndFamily = 0;
+        if (EnumFontFamiliesEx(hdc, &lf, create_font_proc, (LPARAM)&hfont, 0))
+        {
+            skip("TrueType font for charset %u is not installed\n", c[i].cs);
+            continue;
+        }
+
+        old_hfont = SelectObject(hdc, hfont);
+
+        ret = GetGlyphOutlineA(hdc, 0x8041, GGO_BITMAP, &gm, 0, NULL, &mat);
+        ret2 = GetGlyphOutlineA(hdc, 0x41, GGO_BITMAP, &gm2, 0, NULL, &mat);
+        ok(ret == ret2 && memcmp(&gm, &gm2, sizeof gm) == 0, "%d %d\n", ret, 
ret2);
+
+        ret = GetGlyphOutlineA(hdc, c[i].a, GGO_BITMAP, &gm, 0, NULL, &mat);
+        ret2 = GetGlyphOutlineW(hdc, c[i].w, GGO_BITMAP, &gm2, 0, NULL, &mat);
+        ok(ret == ret2 && memcmp(&gm, &gm2, sizeof gm) == 0, "%d %d\n", ret, 
ret2);
+
+        hfont = SelectObject(hdc, old_hfont);
+        DeleteObject(hfont);
+    }
+
     DeleteDC(hdc);
 }
 

Modified: vendor/wine/dlls/user32/current/clipboard.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/clipboard.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/clipboard.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/clipboard.c [iso-8859-1] Wed Feb  9 
13:10:50 2011
@@ -291,7 +291,7 @@
 {
     BOOL bRet = FALSE;
 
-    TRACE("(%d)\n", bCBHasChanged);
+    TRACE("() Changed=%d\n", bCBHasChanged);
 
     if (CLIPBOARD_CloseClipboard())
     {
@@ -301,10 +301,10 @@
 
             USER_Driver->pEndClipboardUpdate();
 
+            bCBHasChanged = FALSE;
+
             if (hWndViewer)
                 SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, (WPARAM) 
GetClipboardOwner(), 0);
-
-            bCBHasChanged = FALSE;
         }
 
         bRet = TRUE;

Modified: vendor/wine/dlls/user32/current/cursoricon.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/cursoricon.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/cursoricon.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/cursoricon.c [iso-8859-1] Wed Feb  9 
13:10:50 2011
@@ -413,7 +413,7 @@
  * Find the icon closest to the requested size and bit depth.
  */
 static int CURSORICON_FindBestIcon( LPCVOID dir, fnGetCIEntry get_entry,
-                                    int width, int height, int depth )
+                                    int width, int height, int depth, UINT 
loadflags )
 {
     int i, cx, cy, bits, bestEntry = -1;
     UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
@@ -422,7 +422,20 @@
     /* Find Best Fit */
     iTotalDiff = 0xFFFFFFFF;
     iColorDiff = 0xFFFFFFFF;
-    for ( i = 0; get_entry( dir, i, &cx, &cy, &bits ); i++ )
+
+    if (loadflags & LR_DEFAULTSIZE)
+    {
+        if (!width) width = GetSystemMetrics( SM_CXICON );
+        if (!height) height = GetSystemMetrics( SM_CYICON );
+    }
+    else if (!width && !height)
+    {
+        /* use the size of the first entry */
+        if (!get_entry( dir, 0, &width, &height, &bits )) return -1;
+        iTotalDiff = 0;
+    }
+
+    for ( i = 0; iTotalDiff && get_entry( dir, i, &cx, &cy, &bits ); i++ )
     {
         iTempXDiff = abs(width - cx);
         iTempYDiff = abs(height - cy);
@@ -475,9 +488,21 @@
  * FIXME: parameter 'color' ignored.
  */
 static int CURSORICON_FindBestCursor( LPCVOID dir, fnGetCIEntry get_entry,
-                                      int width, int height, int depth )
+                                      int width, int height, int depth, UINT 
loadflags )
 {
     int i, maxwidth, maxheight, cx, cy, bits, bestEntry = -1;
+
+    if (loadflags & LR_DEFAULTSIZE)
+    {
+        if (!width) width = GetSystemMetrics( SM_CXCURSOR );
+        if (!height) height = GetSystemMetrics( SM_CYCURSOR );
+    }
+    else if (!width && !height)
+    {
+        /* use the first entry */
+        if (!get_entry( dir, 0, &width, &height, &bits )) return -1;
+        return 0;
+    }
 
     /* Double height to account for AND and XOR masks */
 
@@ -530,22 +555,24 @@
 }
 
 static const CURSORICONDIRENTRY *CURSORICON_FindBestIconRes( const 
CURSORICONDIR * dir,
-                                      int width, int height, int depth )
+                                                             int width, int 
height, int depth,
+                                                             UINT loadflags )
 {
     int n;
 
     n = CURSORICON_FindBestIcon( dir, CURSORICON_GetResIconEntry,
-                                 width, height, depth );
+                                 width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
 }
 
 static const CURSORICONDIRENTRY *CURSORICON_FindBestCursorRes( const 
CURSORICONDIR *dir,
-                                      int width, int height, int depth )
+                                                               int width, int 
height, int depth,
+                                                               UINT loadflags )
 {
     int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetResCursorEntry,
-                                   width, height, depth );
+                                       width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
@@ -570,20 +597,22 @@
 }
 
 static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestCursorFile( const 
CURSORICONFILEDIR *dir,
-                                      int width, int height, int depth )
-{
-    int n = CURSORICON_FindBestCursor( (LPCVOID) dir, CURSORICON_GetFileEntry,
-                                       width, height, depth );
+                                                                    int width, 
int height, int depth,
+                                                                    UINT 
loadflags )
+{
+    int n = CURSORICON_FindBestCursor( dir, CURSORICON_GetFileEntry,
+                                       width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
 }
 
 static const CURSORICONFILEDIRENTRY *CURSORICON_FindBestIconFile( const 
CURSORICONFILEDIR *dir,
-                                      int width, int height, int depth )
-{
-    int n = CURSORICON_FindBestIcon((LPCVOID) dir, CURSORICON_GetFileEntry,
-                                     width, height, depth );
+                                                                  int width, 
int height, int depth,
+                                                                  UINT 
loadflags )
+{
+    int n = CURSORICON_FindBestIcon( dir, CURSORICON_GetFileEntry,
+                                     width, height, depth, loadflags );
     if ( n < 0 )
         return NULL;
     return &dir->idEntries[n];
@@ -778,8 +807,16 @@
           return 0;
     }
 
-    if (!width) width = bmi->bmiHeader.biWidth;
-    if (!height) height = bmi->bmiHeader.biHeight/2;
+    if (cFlag & LR_DEFAULTSIZE)
+    {
+        if (!width) width = GetSystemMetrics( bIcon ? SM_CXICON : SM_CXCURSOR 
);
+        if (!height) height = GetSystemMetrics( bIcon ? SM_CYICON : 
SM_CYCURSOR );
+    }
+    else
+    {
+        if (!width) width = bmi->bmiHeader.biWidth;
+        if (!height) height = bmi->bmiHeader.biHeight/2;
+    }
     do_stretch = (bmi->bmiHeader.biHeight/2 != height) ||
                  (bmi->bmiHeader.biWidth != width);
 
@@ -945,7 +982,7 @@
  *            \- CHUNK:icon
  */
 static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD 
bits_size,
-    INT width, INT height, INT depth )
+                                             INT width, INT height, INT depth, 
UINT loadflags )
 {
     struct cursoricon_object *info;
     ani_header header = {0};
@@ -1003,7 +1040,7 @@
         const BITMAPINFO *bmi;
 
         entry = CURSORICON_FindBestIconFile((const CURSORICONFILEDIR *) 
icon_data,
-            width, height, depth );
+                                            width, height, depth, loadflags );
 
         bmi = (const BITMAPINFO *) (icon_data + entry->dwDIBOffset);
         info->hotspot.x = entry->xHotspot;
@@ -1131,8 +1168,7 @@
     /* Check for .ani. */
     if (memcmp( bits, "RIFF", 4 ) == 0)
     {
-        hIcon = CURSORICON_CreateIconFromANI( bits, filesize, width, height,
-            depth );
+        hIcon = CURSORICON_CreateIconFromANI( bits, filesize, width, height, 
depth, loadflags );
         goto end;
     }
 
@@ -1144,9 +1180,9 @@
         goto end;
 
     if ( fCursor )
-        entry = CURSORICON_FindBestCursorFile( dir, width, height, depth );
+        entry = CURSORICON_FindBestCursorFile( dir, width, height, depth, 
loadflags );
     else
-        entry = CURSORICON_FindBestIconFile( dir, width, height, depth );
+        entry = CURSORICON_FindBestIconFile( dir, width, height, depth, 
loadflags );
 
     if ( !entry )
         goto end;
@@ -1207,9 +1243,9 @@
     if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
     if (!(dir = LockResource( handle ))) return 0;
     if (fCursor)
-        dirEntry = CURSORICON_FindBestCursorRes( dir, width, height, depth );
+        dirEntry = CURSORICON_FindBestCursorRes( dir, width, height, depth, 
loadflags );
     else
-        dirEntry = CURSORICON_FindBestIconRes( dir, width, height, depth );
+        dirEntry = CURSORICON_FindBestIconRes( dir, width, height, depth, 
loadflags );
     if (!dirEntry) return 0;
     wResId = dirEntry->wResId;
     FreeResource( handle );
@@ -1548,9 +1584,9 @@
         ReleaseDC(0, hdc);
 
         if( bIcon )
-            entry = CURSORICON_FindBestIconRes( dir, width, height, depth );
+            entry = CURSORICON_FindBestIconRes( dir, width, height, depth, 
LR_DEFAULTSIZE );
         else
-            entry = CURSORICON_FindBestCursorRes( dir, width, height, depth );
+            entry = CURSORICON_FindBestCursorRes( dir, width, height, depth, 
LR_DEFAULTSIZE );
 
         if( entry ) retVal = entry->wResId;
     }
@@ -1563,9 +1599,7 @@
  */
 INT WINAPI LookupIconIdFromDirectory( LPBYTE dir, BOOL bIcon )
 {
-    return LookupIconIdFromDirectoryEx( dir, bIcon,
-           bIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR),
-           bIcon ? GetSystemMetrics(SM_CYICON) : 
GetSystemMetrics(SM_CYCURSOR), bIcon ? 0 : LR_MONOCHROME );
+    return LookupIconIdFromDirectoryEx( dir, bIcon, 0, 0, bIcon ? 0 : 
LR_MONOCHROME );
 }
 
 /***********************************************************************
@@ -2273,15 +2307,6 @@
     TRACE_(resource)("(%p,%s,%d,%d,%d,0x%08x)\n",
                      hinst,debugstr_w(name),type,desiredx,desiredy,loadflags);
 
-    if (loadflags & LR_DEFAULTSIZE) {
-        if (type == IMAGE_ICON) {
-            if (!desiredx) desiredx = GetSystemMetrics(SM_CXICON);
-            if (!desiredy) desiredy = GetSystemMetrics(SM_CYICON);
-        } else if (type == IMAGE_CURSOR) {
-            if (!desiredx) desiredx = GetSystemMetrics(SM_CXCURSOR);
-            if (!desiredy) desiredy = GetSystemMetrics(SM_CYCURSOR);
-        }
-    }
     if (loadflags & LR_LOADFROMFILE) loadflags &= ~LR_SHARED;
     switch (type) {
     case IMAGE_BITMAP:

Modified: vendor/wine/dlls/user32/current/mdi.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/mdi.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/mdi.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/mdi.c [iso-8859-1] Wed Feb  9 13:10:50 2011
@@ -866,7 +866,7 @@
     if (!hIcon)
         hIcon = (HICON)SendMessageW(hChild, WM_GETICON, ICON_BIG, 0);
     if (!hIcon)
-        hIcon = LoadImageW(0, MAKEINTRESOURCEW(IDI_WINLOGO), IMAGE_ICON, 0, 0, 
LR_DEFAULTCOLOR);
+        hIcon = LoadImageW(0, MAKEINTRESOURCEW(IDI_WINLOGO), IMAGE_ICON, 
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
     if (hIcon)
     {
       HDC hMemDC;

Modified: vendor/wine/dlls/user32/current/tests/clipboard.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/clipboard.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/clipboard.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/clipboard.c [iso-8859-1] Wed Feb  9 
13:10:50 2011
@@ -216,6 +216,7 @@
     HENHMETAFILE emf;
     BOOL r;
     UINT cf;
+    HANDLE data;
 
     htext = create_text();
     emf = create_emf();
@@ -235,15 +236,21 @@
     ok(r, "gle %d\n", GetLastError());
     cf = EnumClipboardFormats(0);
     ok(cf == CF_TEXT, "cf %08x\n", cf);
+    data = GetClipboardData(cf);
+    ok(data != NULL, "couldn't get data, cf %08x\n", cf);
 
     cf = EnumClipboardFormats(cf);
     ok(cf == CF_ENHMETAFILE, "cf %08x\n", cf);
+    data = GetClipboardData(cf);
+    ok(data != NULL, "couldn't get data, cf %08x\n", cf);
 
     cf = EnumClipboardFormats(cf);
     todo_wine ok(cf == CF_LOCALE, "cf %08x\n", cf);
     if(cf == CF_LOCALE)
         cf = EnumClipboardFormats(cf);
     ok(cf == CF_OEMTEXT, "cf %08x\n", cf);
+    data = GetClipboardData(cf);
+    ok(data != NULL, "couldn't get data, cf %08x\n", cf);
 
     cf = EnumClipboardFormats(cf);
     ok(cf == CF_UNICODETEXT ||
@@ -253,6 +260,8 @@
     if(cf == CF_UNICODETEXT)
         cf = EnumClipboardFormats(cf);
     ok(cf == CF_METAFILEPICT, "cf %08x\n", cf);
+    data = GetClipboardData(cf);
+    todo_wine ok(data != NULL, "couldn't get data, cf %08x\n", cf);
 
     cf = EnumClipboardFormats(cf);
     ok(cf == 0, "cf %08x\n", cf);

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=50631&r1=50630&r2=50631&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] Wed Feb  9 
13:10:50 2011
@@ -837,9 +837,14 @@
 {
     HWND hWnd;
     HWND hParent;
-    int len;
+    HDC hDC;
+    int len, dpi;
     static const char *str = "this is a long string.";
     static const char *str2 = "this is a long string.\r\nthis is a long 
string.\r\nthis is a long string.\r\nthis is a long string.";
+
+    hDC = GetDC(NULL);
+    dpi = GetDeviceCaps(hDC, LOGPIXELSY);
+    ReleaseDC(NULL, hDC);
 
     trace("EDIT: Test notifications\n");
 
@@ -947,7 +952,7 @@
               "EDIT",
               NULL,
               ES_MULTILINE,
-              10, 10, 50, 50,
+              10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
               hParent, NULL, NULL, NULL);
     assert(hWnd);
 
@@ -992,7 +997,7 @@
               "EDIT",
               NULL,
               ES_MULTILINE | ES_AUTOHSCROLL,
-              10, 10, 50, 50,
+              10, 10, (50 * dpi) / 96, (50 * dpi) / 96,
               hParent, NULL, NULL, NULL);
     assert(hWnd);
 
@@ -1527,6 +1532,7 @@
     ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins)); 
 
     SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, 
MAKELONG(EC_USEFONTINFO,EC_USEFONTINFO));
+    SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
     margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
     ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
     ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins)); 
@@ -2212,9 +2218,15 @@
 {
     HWND hwEdit;
     HFONT hfont;
+    HDC hDC;
     LOGFONT lf;
     LONG r;
     char szLocalString[MAXLEN];
+    int dpi;
+
+    hDC = GetDC(NULL);
+    dpi = GetDeviceCaps(hDC, LOGPIXELSY);
+    ReleaseDC(NULL, hDC);
 
     memset(&lf,0,sizeof(LOGFONTA));
     strcpy(lf.lfFaceName,"Arial");
@@ -2224,7 +2236,8 @@
 
     trace("EDIT: Oversized font (Multi line)\n");
     hwEdit= CreateWindow("EDIT", NULL, ES_MULTILINE|ES_AUTOHSCROLL,
-                           0, 0, 150, 50, NULL, NULL, hinst, NULL);
+                           0, 0, (150 * dpi) / 96, (50 * dpi) / 96, NULL, NULL,
+                           hinst, NULL);
 
     SendMessage(hwEdit,WM_SETFONT,(WPARAM)hfont,0);
 

Modified: vendor/wine/dlls/winex11.drv/current/clipboard.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/clipboard.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/clipboard.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/clipboard.c [iso-8859-1] Wed Feb  9 
13:10:50 2011
@@ -86,10 +86,8 @@
 WINE_DEFAULT_DEBUG_CHANNEL(clipboard);
 
 /* Maximum wait time for selection notify */
-#define SELECTION_RETRIES 500  /* wait for .1 seconds */
+#define SELECTION_RETRIES 500  /* wait for .5 seconds */
 #define SELECTION_WAIT    1000 /* us */
-/* Minimum seconds that must lapse between owner queries */
-#define OWNERQUERYLAPSETIME 1
 
 /* Selection masks */
 #define S_NOSELECTION    0
@@ -179,6 +177,7 @@
 static BOOL X11DRV_CLIPBOARD_RenderSynthesizedFormat(Display *display, 
LPWINE_CLIPDATA lpData);
 static BOOL X11DRV_CLIPBOARD_RenderSynthesizedDIB(Display *display);
 static BOOL X11DRV_CLIPBOARD_RenderSynthesizedBitmap(Display *display);
+static BOOL X11DRV_CLIPBOARD_RenderSynthesizedEnhMetaFile(Display *display);
 static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent 
*event, BOOL bIsMultiple );
 
 /* Clipboard formats
@@ -887,12 +886,15 @@
                     break;
 
                 case CF_ENHMETAFILE:
+                    bret = X11DRV_CLIPBOARD_RenderSynthesizedEnhMetaFile( 
display );
+                    break;
+
                 case CF_METAFILEPICT:
-                   FIXME("Synthesizing wFormatID(0x%08x) not implemented\n", 
wFormatID);
+                    FIXME("Synthesizing CF_METAFILEPICT not implemented\n");
                     break;
 
                 default:
-                   FIXME("Called to synthesize unknown format\n");
+                    FIXME("Called to synthesize unknown format 0x%08x\n", 
wFormatID);
                     break;
             }
         }
@@ -1058,21 +1060,23 @@
         if (lpSource->hData || X11DRV_CLIPBOARD_RenderFormat(display, 
lpSource))
         {
             HDC hdc;
-            HBITMAP hData;
+            HBITMAP hData = NULL;
             unsigned int offset;
             LPBITMAPINFOHEADER lpbmih;
 
             hdc = GetDC(NULL);
             lpbmih = GlobalLock(lpSource->hData);
-
-            offset = sizeof(BITMAPINFOHEADER)
-                  + ((lpbmih->biBitCount <= 8) ? (sizeof(RGBQUAD) *
-                    (1 << lpbmih->biBitCount)) : 0);
-
-            hData = CreateDIBitmap(hdc, lpbmih, CBM_INIT, (LPBYTE)lpbmih +
-                offset, (LPBITMAPINFO) lpbmih, DIB_RGB_COLORS);
-
-            GlobalUnlock(lpSource->hData);
+            if (lpbmih)
+            {
+                offset = sizeof(BITMAPINFOHEADER)
+                      + ((lpbmih->biBitCount <= 8) ? (sizeof(RGBQUAD) *
+                        (1 << lpbmih->biBitCount)) : 0);
+
+                hData = CreateDIBitmap(hdc, lpbmih, CBM_INIT, (LPBYTE)lpbmih +
+                    offset, (LPBITMAPINFO) lpbmih, DIB_RGB_COLORS);
+
+                GlobalUnlock(lpSource->hData);
+            }
             ReleaseDC(NULL, hdc);
 
             if (hData)
@@ -1084,6 +1088,53 @@
     }
 
     return bret;
+}
+
+
+/**************************************************************************
+ *                      X11DRV_CLIPBOARD_RenderSynthesizedEnhMetaFile
+ */
+static BOOL X11DRV_CLIPBOARD_RenderSynthesizedEnhMetaFile(Display *display)
+{
+    LPWINE_CLIPDATA lpSource = NULL;
+
+    TRACE("\n");
+
+    if ((lpSource = X11DRV_CLIPBOARD_LookupData(CF_ENHMETAFILE)) && 
lpSource->hData)
+        return TRUE;
+    /* If we have a MF pict and it's not synthesized or it has been rendered */
+    else if ((lpSource = X11DRV_CLIPBOARD_LookupData(CF_METAFILEPICT)) &&
+        (!(lpSource->wFlags & CF_FLAG_SYNTHESIZED) || lpSource->hData))
+    {
+        /* Render source if required */
+        if (lpSource->hData || X11DRV_CLIPBOARD_RenderFormat(display, 
lpSource))
+        {
+            METAFILEPICT *pmfp;
+            HENHMETAFILE hData = NULL;
+
+            pmfp = GlobalLock(lpSource->hData);
+            if (pmfp)
+            {
+                UINT size_mf_bits = GetMetaFileBitsEx(pmfp->hMF, 0, NULL);
+                void *mf_bits = HeapAlloc(GetProcessHeap(), 0, size_mf_bits);
+                if (mf_bits)
+                {
+                    GetMetaFileBitsEx(pmfp->hMF, size_mf_bits, mf_bits);
+                    hData = SetWinMetaFileBits(size_mf_bits, mf_bits, NULL, 
pmfp);
+                    HeapFree(GetProcessHeap(), 0, mf_bits);
+                }
+                GlobalUnlock(lpSource->hData);
+            }
+
+            if (hData)
+            {
+                X11DRV_CLIPBOARD_InsertClipboardData(CF_ENHMETAFILE, hData, 0, 
NULL, TRUE);
+                return TRUE;
+            }
+        }
+    }
+
+    return FALSE;
 }
 
 
@@ -1495,7 +1546,6 @@
     *lpBytes = j; /* Number of bytes in string */
 
 done:
-    HeapFree(GetProcessHeap(), 0, text);
     GlobalUnlock(lpData->hData);
 
     return lpstr;

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=50631&r1=50630&r2=50631&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] Wed Feb  9 13:10:50 
2011
@@ -4728,6 +4728,24 @@
 }
 #endif /* HAVE_LIBXXSHM */
 
+static Bool X11DRV_DIB_QueryXShm( Bool *pixmaps )
+{
+    static Bool have_xshm, have_xshm_pixmaps;
+    static BOOL initialized;
+
+    if (!initialized)
+    {
+#ifdef HAVE_LIBXXSHM
+        int major, minor;
+
+        have_xshm = XShmQueryVersion( gdi_display, &major, &minor, 
&have_xshm_pixmaps );
+#endif
+        initialized = TRUE;
+    }
+
+    *pixmaps = have_xshm_pixmaps;
+    return have_xshm;
+}
 
 /***********************************************************************
  *           X11DRV_CreateDIBSection   (X11DRV.@)
@@ -4740,7 +4758,6 @@
     WORD bpp, compr;
     LONG w, h;
 #ifdef HAVE_LIBXXSHM
-    int major, minor;
     Bool pixmaps;
 #endif
 
@@ -4780,7 +4797,7 @@
 #ifdef HAVE_LIBXXSHM
     physBitmap->shminfo.shmid = -1;
 
-    if (XShmQueryVersion( gdi_display, &major, &minor, &pixmaps )
+    if (X11DRV_DIB_QueryXShm( &pixmaps )
             && (physBitmap->image = X11DRV_XShmCreateImage( dib.dsBm.bmWidth, 
dib.dsBm.bmHeight,
                                                             
physBitmap->pixmap_depth, &physBitmap->shminfo )))
     {

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=50631&r1=50630&r2=50631&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] Wed Feb  9 
13:10:50 2011
@@ -1605,7 +1605,7 @@
     RECT dst_rect = *new_rect;
     HDC hdc_src, hdc_dst;
     INT code;
-    HRGN rgn = 0;
+    HRGN rgn;
     HWND parent = 0;
 
     if (!data->whole_window)
@@ -1624,6 +1624,9 @@
         hdc_src = hdc_dst = GetDCEx( data->hwnd, 0, DCX_CACHE );
     }
 
+    rgn = CreateRectRgnIndirect( &dst_rect );
+    SelectClipRgn( hdc_dst, rgn );
+    DeleteObject( rgn );
     ExcludeUpdateRgn( hdc_dst, data->hwnd );
 
     code = X11DRV_START_EXPOSURES;
@@ -1636,6 +1639,7 @@
             dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top,
             hdc_src, src_rect.left, src_rect.top, SRCCOPY );
 
+    rgn = 0;
     code = X11DRV_END_EXPOSURES;
     ExtEscape( hdc_dst, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 
sizeof(rgn), (LPSTR)&rgn );
 

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=50631&r1=50630&r2=50631&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] Wed Feb  9 
13:10:50 2011
@@ -1066,7 +1066,11 @@
     lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth );
     lfsz.devsize.cx = X11DRV_XWStoDS( physDev, lfsz.lf.lfWidth );
     lfsz.devsize.cy = X11DRV_YWStoDS( physDev, lfsz.lf.lfHeight );
-    GetWorldTransform( physDev->hdc, &lfsz.xform );
+
+    GetTransform( physDev->hdc, 0x204, &lfsz.xform );
+    TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12,
+          lfsz.xform.eM21, lfsz.xform.eM22);
+
     /* Not used fields, would break hashing */
     lfsz.xform.eDx = lfsz.xform.eDy = 0;
 

Modified: vendor/wine/server/current/mapping.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/server/current/mapping.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/server/current/mapping.c [iso-8859-1] (original)
+++ vendor/wine/server/current/mapping.c [iso-8859-1] Wed Feb  9 13:10:50 2011
@@ -26,6 +26,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
 #include <unistd.h>
 
 #include "ntstatus.h"
@@ -161,13 +164,47 @@
     return 0;
 }
 
+/* check if the current directory allows exec mappings */
+static int check_current_dir_for_exec(void)
+{
+    int fd;
+    char tmpfn[] = "anonmap.XXXXXX";
+    void *ret = MAP_FAILED;
+
+    fd = mkstemps( tmpfn, 0 );
+    if (fd == -1) return 0;
+    if (grow_file( fd, 1 ))
+    {
+        ret = mmap( NULL, get_page_size(), PROT_READ | PROT_EXEC, MAP_PRIVATE, 
fd, 0 );
+        if (ret != MAP_FAILED) munmap( ret, get_page_size() );
+    }
+    close( fd );
+    unlink( tmpfn );
+    return (ret != MAP_FAILED);
+}
+
 /* create a temp file for anonymous mappings */
 static int create_temp_file( file_pos_t size )
 {
-    char tmpfn[16];
+    static int temp_dir_fd = -1;
+    char tmpfn[] = "anonmap.XXXXXX";
     int fd;
 
-    sprintf( tmpfn, "anonmap.XXXXXX" );  /* create it in the server directory 
*/
+    if (temp_dir_fd == -1)
+    {
+        temp_dir_fd = server_dir_fd;
+        if (!check_current_dir_for_exec())
+        {
+            /* the server dir is noexec, try the config dir instead */
+            fchdir( config_dir_fd );
+            if (check_current_dir_for_exec())
+                temp_dir_fd = config_dir_fd;
+            else  /* neither works, fall back to server dir */
+                fchdir( server_dir_fd );
+        }
+    }
+    else if (temp_dir_fd != server_dir_fd) fchdir( temp_dir_fd );
+
     fd = mkstemps( tmpfn, 0 );
     if (fd != -1)
     {
@@ -179,6 +216,8 @@
         unlink( tmpfn );
     }
     else file_set_error();
+
+    if (temp_dir_fd != server_dir_fd) fchdir( server_dir_fd );
     return fd;
 }
 

Modified: vendor/wine/server/current/registry.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/server/current/registry.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/server/current/registry.c [iso-8859-1] (original)
+++ vendor/wine/server/current/registry.c [iso-8859-1] Wed Feb  9 13:10:50 2011
@@ -331,7 +331,9 @@
     if (access & GENERIC_WRITE)   access |= KEY_WRITE;
     if (access & GENERIC_EXECUTE) access |= KEY_EXECUTE;
     if (access & GENERIC_ALL)     access |= KEY_ALL_ACCESS;
-    return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | 
GENERIC_ALL);
+    /* filter the WOW64 masks, as they aren't real access bits */
+    return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | 
GENERIC_ALL |
+                      KEY_WOW64_64KEY | KEY_WOW64_32KEY);
 }
 
 /* close the notification associated with a handle */

Modified: vendor/wine/server/current/sock.c
URL: 
http://svn.reactos.org/svn/reactos/vendor/wine/server/current/sock.c?rev=50631&r1=50630&r2=50631&view=diff
==============================================================================
--- vendor/wine/server/current/sock.c [iso-8859-1] (original)
+++ vendor/wine/server/current/sock.c [iso-8859-1] Wed Feb  9 13:10:50 2011
@@ -388,18 +388,18 @@
 
     if (sock->state & FD_CONNECT)
     {
-        /* connecting */
-        if (event & POLLOUT)
+        if (event & (POLLERR|POLLHUP))
+        {
+            /* we didn't get connected? */
+            sock->state &= ~FD_CONNECT;
+            event &= ~POLLOUT;
+            error = sock_error( fd );
+        }
+        else if (event & POLLOUT)
         {
             /* we got connected */
             sock->state |= FD_WINE_CONNECTED|FD_READ|FD_WRITE;
             sock->state &= ~FD_CONNECT;
-        }
-        else if (event & (POLLERR|POLLHUP))
-        {
-            /* we didn't get connected? */
-            sock->state &= ~FD_CONNECT;
-            error = sock_error( fd );
         }
     }
     else if (sock->state & FD_WINE_LISTENING)


Reply via email to