ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2009
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
26 participants
641 discussions
Start a n
N
ew thread
[fireball] 43499: - Update user32_winetest to Wine-1.1.31.
by fireball@svn.reactos.org
Author: fireball Date: Thu Oct 15 22:00:27 2009 New Revision: 43499 URL:
http://svn.reactos.org/svn/reactos?rev=43499&view=rev
Log: - Update user32_winetest to Wine-1.1.31. Modified: trunk/rostests/winetests/user32/class.c trunk/rostests/winetests/user32/cursoricon.c trunk/rostests/winetests/user32/dde.c trunk/rostests/winetests/user32/dialog.c trunk/rostests/winetests/user32/input.c trunk/rostests/winetests/user32/msg.c trunk/rostests/winetests/user32/resource.rc trunk/rostests/winetests/user32/sysparams.c trunk/rostests/winetests/user32/text.c trunk/rostests/winetests/user32/win.c Modified: trunk/rostests/winetests/user32/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/class.c?…
============================================================================== --- trunk/rostests/winetests/user32/class.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/class.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -598,8 +598,8 @@ HWND hwnd; int i; - pDefWindowProcA = GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcA"); - pDefWindowProcW = GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcW"); + pDefWindowProcA = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcA"); + pDefWindowProcW = (void *)GetProcAddress(GetModuleHandle("user32.dll"), "DefWindowProcW"); for (i = 0; i < 4; i++) { Modified: trunk/rostests/winetests/user32/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/cursoric…
============================================================================== --- trunk/rostests/winetests/user32/cursoricon.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/cursoricon.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -1039,6 +1039,8 @@ HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color)); if (!hicon) return; SetPixelV(hdc, 0, 0, background); + SetPixelV(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1, background); + SetPixelV(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), background); DrawIcon(hdc, 0, 0, hicon); result = GetPixel(hdc, 0, 0); @@ -1047,6 +1049,21 @@ "Overlaying Mask %d on Color %06X with DrawIcon. " "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n", maskvalue, color, modern_expected, legacy_expected, result, line); + + result = GetPixel(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1); + + ok (color_match(result, modern_expected) || /* Windows 2000 and up */ + broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */ + "Overlaying Mask %d on Color %06X with DrawIcon. " + "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n", + maskvalue, color, modern_expected, legacy_expected, result, line); + + result = GetPixel(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); + + ok (color_match(result, background), + "Overlaying Mask %d on Color %06X with DrawIcon. " + "Expected unchanged background color %06X. Got %06X from line %d\n", + maskvalue, color, background, result, line); } static void test_DrawIcon(void) @@ -1070,8 +1087,8 @@ memset(&bitmapInfo, 0, sizeof(bitmapInfo)); bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bitmapInfo.bmiHeader.biWidth = 1; - bitmapInfo.bmiHeader.biHeight = 1; + bitmapInfo.bmiHeader.biWidth = GetSystemMetrics(SM_CXICON)+1; + bitmapInfo.bmiHeader.biHeight = GetSystemMetrics(SM_CYICON)+1; bitmapInfo.bmiHeader.biBitCount = 32; bitmapInfo.bmiHeader.biPlanes = 1; bitmapInfo.bmiHeader.biCompression = BI_RGB; @@ -1212,6 +1229,130 @@ DeleteDC(hdcDst); } +static void check_DrawState_Size(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, HBRUSH hbr, UINT flags, int line) +{ + COLORREF result, background; + BOOL passed[2]; + HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color)); + background = 0x00FFFFFF; + /* Set color of the 2 pixels that will be checked afterwards */ + SetPixelV(hdc, 0, 0, background); + SetPixelV(hdc, 2, 2, background); + + /* Let DrawState calculate the size of the icon (it's 1x1) */ + DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, (DST_ICON | flags )); + + result = GetPixel(hdc, 0, 0); + passed[0] = color_match(result, background); + result = GetPixel(hdc, 2, 2); + passed[0] = passed[0] & color_match(result, background); + + /* Check if manually specifying the icon size DOESN'T work */ + + /* IMPORTANT: For Icons, DrawState wants the size of the source image, not the + * size in which it should be ultimately drawn. Therefore giving + * width/height 2x2 if the icon is only 1x1 pixels in size should + * result in drawing it with size 1x1. The size parameters must be + * ignored if a Icon has to be drawn! */ + DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 2, 2, (DST_ICON | flags )); + + result = GetPixel(hdc, 0, 0); + passed[1] = color_match(result, background); + result = GetPixel(hdc, 2, 2); + passed[1] = passed[0] & color_match(result, background); + + if(!passed[0]&&!passed[1]) + ok (passed[1], + "DrawState failed to draw a 1x1 Icon in the correct size, independent of the " + "width and height settings passed to it, for Icon with: Overlaying Mask %d on " + "Color %06X with flags %08X. Line %d\n", + maskvalue, color, (DST_ICON | flags), line); + else if(!passed[1]) + ok (passed[1], + "DrawState failed to draw a 1x1 Icon in the correct size, if the width and height " + "parameters passed to it are bigger than the real Icon size, for Icon with: Overlaying " + "Mask %d on Color %06X with flags %08X. Line %d\n", + maskvalue, color, (DST_ICON | flags), line); + else + ok (passed[0], + "DrawState failed to draw a 1x1 Icon in the correct size, if the width and height " + "parameters passed to it are 0, for Icon with: Overlaying Mask %d on " + "Color %06X with flags %08X. Line %d\n", + maskvalue, color, (DST_ICON | flags), line); +} + +static void check_DrawState_Color(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, HBRUSH hbr, UINT flags, + COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line) +{ + COLORREF result; + HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color)); + if (!hicon) return; + /* Set color of the pixel that will be checked afterwards */ + SetPixelV(hdc, 1, 1, background); + + DrawState(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, ( DST_ICON | flags )); + + /* Check the color of the pixel is correct */ + result = GetPixel(hdc, 1, 1); + + ok (color_match(result, modern_expected) || /* Windows 2000 and up */ + broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */ + "DrawState drawing Icon with Overlaying Mask %d on Color %06X with flags %08X. " + "Expected a close match to %06X (modern) or %06X (legacy). Got %06X from line %d\n", + maskvalue, color, (DST_ICON | flags), modern_expected, legacy_expected, result, line); +} + +static void test_DrawState(void) +{ + BITMAPINFO bitmapInfo; + HDC hdcDst = NULL; + HBITMAP bmpDst = NULL; + HBITMAP bmpOld = NULL; + UINT32 bits = 0; + + hdcDst = CreateCompatibleDC(0); + ok(hdcDst != 0, "CreateCompatibleDC(0) failed to return a valid DC\n"); + if (!hdcDst) + return; + + if(GetDeviceCaps(hdcDst, BITSPIXEL) <= 8) + { + skip("Windows will distort DrawIconEx colors at 8-bpp and less due to palletizing.\n"); + goto cleanup; + } + + memset(&bitmapInfo, 0, sizeof(bitmapInfo)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = 3; + bitmapInfo.bmiHeader.biHeight = 3; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + bitmapInfo.bmiHeader.biSizeImage = sizeof(UINT32); + bmpDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0); + ok (bmpDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n"); + if (!bmpDst || !bits) + goto cleanup; + bmpOld = SelectObject(hdcDst, bmpDst); + + /* potential flags to test with DrawState are: */ + /* DSS_DISABLED embosses the icon */ + /* DSS_MONO draw Icon using a brush as parameter 5 */ + /* DSS_NORMAL draw Icon without any modifications */ + /* DSS_UNION draw the Icon dithered */ + + check_DrawState_Size(hdcDst, FALSE, 0x00A0B0C0, 32, 0, DSS_NORMAL, __LINE__); + check_DrawState_Color(hdcDst, FALSE, 0x00A0B0C0, 32, 0, DSS_NORMAL, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__); + +cleanup: + if(bmpOld) + SelectObject(hdcDst, bmpOld); + if(bmpDst) + DeleteObject(bmpDst); + if(hdcDst) + DeleteDC(hdcDst); +} + static void test_DestroyCursor(void) { static const BYTE bmp_bits[4096]; @@ -1321,6 +1462,7 @@ test_CreateIconFromResource(); test_DrawIcon(); test_DrawIconEx(); + test_DrawState(); test_DestroyCursor(); do_parent(); test_child_process(); Modified: trunk/rostests/winetests/user32/dde.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/dde.c?re…
============================================================================== --- trunk/rostests/winetests/user32/dde.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/dde.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -2390,23 +2390,33 @@ test_end_to_end_server(proc.hProcess, proc.hThread, TRUE); - sprintf(buffer, "%s dde endw", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, FALSE); - - sprintf(buffer, "%s dde enda", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, FALSE); - - sprintf(buffer, "%s dde endw", argv[0]); - CreateProcessA(NULL, buffer, NULL, NULL, FALSE, - CREATE_SUSPENDED, NULL, NULL, &startup, &proc); - - test_end_to_end_server(proc.hProcess, proc.hThread, TRUE); + /* Don't bother testing W interfaces on Win9x/WinMe */ + SetLastError(0xdeadbeef); + lstrcmpW(NULL, NULL); + if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + win_skip("Skipping W-interface tests\n"); + } + else + { + sprintf(buffer, "%s dde endw", argv[0]); + CreateProcessA(NULL, buffer, NULL, NULL, FALSE, + CREATE_SUSPENDED, NULL, NULL, &startup, &proc); + + test_end_to_end_server(proc.hProcess, proc.hThread, FALSE); + + sprintf(buffer, "%s dde enda", argv[0]); + CreateProcessA(NULL, buffer, NULL, NULL, FALSE, + CREATE_SUSPENDED, NULL, NULL, &startup, &proc); + + test_end_to_end_server(proc.hProcess, proc.hThread, FALSE); + + sprintf(buffer, "%s dde endw", argv[0]); + CreateProcessA(NULL, buffer, NULL, NULL, FALSE, + CREATE_SUSPENDED, NULL, NULL, &startup, &proc); + + test_end_to_end_server(proc.hProcess, proc.hThread, TRUE); + } test_dde_aw_transaction(); Modified: trunk/rostests/winetests/user32/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/dialog.c…
============================================================================== --- trunk/rostests/winetests/user32/dialog.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/dialog.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -930,6 +930,19 @@ return FALSE; } + +static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg, + WPARAM wParam, LPARAM lParam) +{ + switch (uiMsg) + { + case WM_INITDIALOG: + EndDialog(hDlg, LOWORD(SendMessage(hDlg, DM_GETDEFID, 0, 0))); + return TRUE; + } + return FALSE; +} + static void test_DialogBoxParamA(void) { INT_PTR ret; @@ -965,8 +978,12 @@ SetLastError(0xdeadbeef); ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0); ok(ret == 0, "DefDlgProcA returned %ld, expected 0\n", ret); - ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, + 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, TestDefButtonDlgProc, 0); + ok(ret == IDOK, "Expected IDOK\n"); } static void test_DisabledDialogTest(void) Modified: trunk/rostests/winetests/user32/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/input.c?…
============================================================================== --- trunk/rostests/winetests/user32/input.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/input.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -72,12 +72,13 @@ LONG last_hook_syskey_down; LONG last_hook_syskey_up; BOOL expect_alt; + BOOL sendinput_broken; } key_status; static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t); static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD); -#define MAXKEYEVENTS 10 +#define MAXKEYEVENTS 12 #define MAXKEYMESSAGES MAXKEYEVENTS /* assuming a key event generates one and only one message */ @@ -891,6 +892,11 @@ HWND window; HHOOK hook; + if (GetKeyboardLayout(0) != (HKL)(ULONG_PTR)0x04090409) + { + skip("Skipping Input_blackbox test on non-US keyboard\n"); + return; + } window = CreateWindow("Static", NULL, WS_POPUP|WS_HSCROLL|WS_VSCROLL |WS_VISIBLE, 0, 0, 200, 60, NULL, NULL, NULL, NULL); @@ -950,6 +956,7 @@ key_status.last_hook_syskey_down = -1; key_status.last_hook_syskey_up = -1; key_status.expect_alt = FALSE; + key_status.sendinput_broken = FALSE; } static void test_unicode_keys(HWND hwnd, HHOOK hook) @@ -968,38 +975,42 @@ inputs[0].u.ki.dwFlags = KEYEVENTF_UNICODE; reset_key_status(); - SendInput(1, (INPUT*)inputs, sizeof(INPUT)); + pSendInput(1, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hwnd, 0, 0, PM_REMOVE)){ if(msg.message == WM_KEYDOWN && msg.wParam == VK_PACKET){ TranslateMessage(&msg); } DispatchMessageW(&msg); } - ok(key_status.last_key_down == VK_PACKET, - "Last keydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_down); - ok(key_status.last_char == 0x3c0, - "Last char msg wparam should have been 0x3c0 (was: 0x%x)\n", key_status.last_char); - if(hook) - ok(key_status.last_hook_down == 0x3c0, - "Last hookdown msg should have been 0x3c0, was: 0x%x\n", key_status.last_hook_down); + if(!key_status.sendinput_broken){ + ok(key_status.last_key_down == VK_PACKET, + "Last keydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_down); + ok(key_status.last_char == 0x3c0, + "Last char msg wparam should have been 0x3c0 (was: 0x%x)\n", key_status.last_char); + if(hook) + ok(key_status.last_hook_down == 0x3c0, + "Last hookdown msg should have been 0x3c0, was: 0x%x\n", key_status.last_hook_down); + } inputs[1].u.ki.wVk = 0; inputs[1].u.ki.wScan = 0x3c0; inputs[1].u.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; reset_key_status(); - SendInput(1, (INPUT*)(inputs+1), sizeof(INPUT)); + pSendInput(1, (INPUT*)(inputs+1), sizeof(INPUT)); while(PeekMessageW(&msg, hwnd, 0, 0, PM_REMOVE)){ if(msg.message == WM_KEYDOWN && msg.wParam == VK_PACKET){ TranslateMessage(&msg); } DispatchMessageW(&msg); } - ok(key_status.last_key_up == VK_PACKET, - "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_up); - if(hook) - ok(key_status.last_hook_up == 0x3c0, - "Last hookup msg should have been 0x3c0, was: 0x%x\n", key_status.last_hook_up); + if(!key_status.sendinput_broken){ + ok(key_status.last_key_up == VK_PACKET, + "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_up); + if(hook) + ok(key_status.last_hook_up == 0x3c0, + "Last hookup msg should have been 0x3c0, was: 0x%x\n", key_status.last_hook_up); + } /* holding alt, pressing & releasing a unicode character, releasing alt */ inputs[0].u.ki.wVk = VK_LMENU; @@ -1012,20 +1023,22 @@ reset_key_status(); key_status.expect_alt = TRUE; - SendInput(2, (INPUT*)inputs, sizeof(INPUT)); + pSendInput(2, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hwnd, 0, 0, PM_REMOVE)){ if(msg.message == WM_SYSKEYDOWN && msg.wParam == VK_PACKET){ TranslateMessage(&msg); } DispatchMessageW(&msg); } - ok(key_status.last_syskey_down == VK_PACKET, - "Last syskeydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_syskey_down); - ok(key_status.last_syschar == 0x3041, - "Last syschar msg should have been 0x3041 (was: 0x%x)\n", key_status.last_syschar); - if(hook) - ok(key_status.last_hook_syskey_down == 0x3041, - "Last hooksysdown msg should have been 0x3041, was: 0x%x\n", key_status.last_hook_syskey_down); + if(!key_status.sendinput_broken){ + ok(key_status.last_syskey_down == VK_PACKET, + "Last syskeydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_syskey_down); + ok(key_status.last_syschar == 0x3041, + "Last syschar msg should have been 0x3041 (was: 0x%x)\n", key_status.last_syschar); + if(hook) + ok(key_status.last_hook_syskey_down == 0x3041, + "Last hooksysdown msg should have been 0x3041, was: 0x%x\n", key_status.last_hook_syskey_down); + } inputs[1].u.ki.wVk = 0; inputs[1].u.ki.wScan = 0x3041; @@ -1037,18 +1050,20 @@ reset_key_status(); key_status.expect_alt = TRUE; - SendInput(2, (INPUT*)inputs, sizeof(INPUT)); + pSendInput(2, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hwnd, 0, 0, PM_REMOVE)){ if(msg.message == WM_SYSKEYDOWN && msg.wParam == VK_PACKET){ TranslateMessage(&msg); } DispatchMessageW(&msg); } - ok(key_status.last_key_up == VK_PACKET, - "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_up); - if(hook) - ok(key_status.last_hook_up == 0x3041, - "Last hook up msg should have been 0x3041, was: 0x%x\n", key_status.last_hook_up); + if(!key_status.sendinput_broken){ + ok(key_status.last_key_up == VK_PACKET, + "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_up); + if(hook) + ok(key_status.last_hook_up == 0x3041, + "Last hook up msg should have been 0x3041, was: 0x%x\n", key_status.last_hook_up); + } } static LRESULT CALLBACK unicode_wnd_proc( HWND hWnd, UINT msg, WPARAM wParam, @@ -1081,8 +1096,16 @@ { if(nCode == HC_ACTION){ LPKBDLLHOOKSTRUCT info = (LPKBDLLHOOKSTRUCT)lParam; - ok(info->vkCode == VK_PACKET || (key_status.expect_alt && info->vkCode == VK_LMENU), "vkCode should have been VK_PACKET[%04x], was: %04x\n", VK_PACKET, info->vkCode); - key_status.expect_alt = FALSE; + if(!info->vkCode){ + key_status.sendinput_broken = TRUE; + win_skip("SendInput doesn't support unicode on this platform\n"); + }else{ + if(key_status.expect_alt){ + ok(info->vkCode == VK_LMENU, "vkCode should have been VK_LMENU[0x%04x], was: 0x%x\n", VK_LMENU, info->vkCode); + key_status.expect_alt = FALSE; + }else + ok(info->vkCode == VK_PACKET, "vkCode should have been VK_PACKET[0x%04x], was: 0x%x\n", VK_PACKET, info->vkCode); + } switch(wParam){ case WM_KEYDOWN: key_status.last_hook_down = info->scanCode; Modified: trunk/rostests/winetests/user32/msg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?re…
============================================================================== --- trunk/rostests/winetests/user32/msg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/msg.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -5257,7 +5257,7 @@ static LRESULT CALLBACK button_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -5458,7 +5458,7 @@ static LRESULT CALLBACK static_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -5553,7 +5553,7 @@ static LRESULT CALLBACK combobox_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -7813,6 +7813,12 @@ { } +static VOID CALLBACK tfunc_crash(HWND hwnd, UINT uMsg, UINT_PTR id, DWORD dwTime) +{ + /* Crash on purpose */ + *(volatile int *)0 = 2; +} + #define TIMER_ID 0x19 static DWORD WINAPI timer_thread_proc(LPVOID x) @@ -7834,6 +7840,7 @@ { struct timer_info info; DWORD id; + MSG msg; info.hWnd = CreateWindow ("TestWindowClass", NULL, WS_OVERLAPPEDWINDOW , @@ -7854,6 +7861,26 @@ CloseHandle(info.handles[1]); ok( KillTimer(info.hWnd, TIMER_ID), "KillTimer failed\n"); + + ok(DestroyWindow(info.hWnd), "failed to destroy window\n"); + + /* Test timer callback with crash */ + SetLastError(0xdeadbeef); + info.hWnd = CreateWindowW(testWindowClassW, NULL, + WS_OVERLAPPEDWINDOW , + CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0, + NULL, NULL, 0); + if ((!info.hWnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) || /* Win9x/Me */ + (!pGetMenuInfo)) /* Win95/NT4 */ + { + win_skip("Test would crash on Win9x/WinMe/NT4\n"); + DestroyWindow(info.hWnd); + return; + } + info.id = SetTimer(info.hWnd, TIMER_ID, 0, tfunc_crash); + ok(info.id, "SetTimer failed\n"); + Sleep(150); + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg); ok(DestroyWindow(info.hWnd), "failed to destroy window\n"); } @@ -8984,7 +9011,7 @@ static LRESULT CALLBACK edit_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -11724,6 +11751,171 @@ DestroyWindow( hwnd); } +#define clear_clipboard(hwnd) clear_clipboard_(__LINE__, (hwnd)) +static void clear_clipboard_(int line, HWND hWnd) +{ + BOOL succ; + succ = OpenClipboard(hWnd); + ok_(__FILE__, line)(succ, "OpenClipboard failed, err=%u\n", GetLastError()); + succ = EmptyClipboard(); + ok_(__FILE__, line)(succ, "EmptyClipboard failed, err=%u\n", GetLastError()); + succ = CloseClipboard(); + ok_(__FILE__, line)(succ, "CloseClipboard failed, err=%u\n", GetLastError()); +} + +#define expect_HWND(expected, got) expect_HWND_(__LINE__, (expected), (got)) +static void expect_HWND_(int line, HWND expected, HWND got) +{ + ok_(__FILE__, line)(got==expected, "Expected %p, got %p\n", expected, got); +} + +static WNDPROC pOldViewerProc; + +static LRESULT CALLBACK recursive_viewer_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static BOOL recursion_guard; + + if (message == WM_DRAWCLIPBOARD && !recursion_guard) + { + recursion_guard = TRUE; + clear_clipboard(hWnd); + recursion_guard = FALSE; + } + return CallWindowProcA(pOldViewerProc, hWnd, message, wParam, lParam); +} + +static void test_clipboard_viewers(void) +{ + static struct message wm_change_cb_chain[] = + { + { WM_CHANGECBCHAIN, sent|wparam|lparam, 0, 0 }, + { 0 } + }; + static const struct message wm_clipboard_destroyed[] = + { + { WM_DESTROYCLIPBOARD, sent|wparam|lparam, 0, 0 }, + { 0 } + }; + static struct message wm_clipboard_changed[] = + { + { WM_DRAWCLIPBOARD, sent|wparam|lparam, 0, 0 }, + { 0 } + }; + static struct message wm_clipboard_changed_and_owned[] = + { + { WM_DESTROYCLIPBOARD, sent|wparam|lparam, 0, 0 }, + { WM_DRAWCLIPBOARD, sent|wparam|lparam, 0, 0 }, + { 0 } + }; + + HINSTANCE hInst = GetModuleHandleA(NULL); + HWND hWnd1, hWnd2, hWnd3; + HWND hOrigViewer; + HWND hRet; + + hWnd1 = CreateWindowExA(0, "TestWindowClass", "Clipboard viewer test wnd 1", + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + GetDesktopWindow(), NULL, hInst, NULL); + hWnd2 = CreateWindowExA(0, "SimpleWindowClass", "Clipboard viewer test wnd 2", + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + GetDesktopWindow(), NULL, hInst, NULL); + hWnd3 = CreateWindowExA(0, "SimpleWindowClass", "Clipboard viewer test wnd 3", + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + GetDesktopWindow(), NULL, hInst, NULL); + trace("clipbd viewers: hWnd1=%p, hWnd2=%p, hWnd3=%p\n", hWnd1, hWnd2, hWnd3); + assert(hWnd1 && hWnd2 && hWnd3); + + flush_sequence(); + + /* Test getting the clipboard viewer and setting the viewer to NULL. */ + hOrigViewer = GetClipboardViewer(); + hRet = SetClipboardViewer(NULL); + ok_sequence(WmEmptySeq, "set viewer to NULL", FALSE); + expect_HWND(hOrigViewer, hRet); + expect_HWND(NULL, GetClipboardViewer()); + + /* Test registering hWnd1 as a viewer. */ + hRet = SetClipboardViewer(hWnd1); + wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner(); + ok_sequence(wm_clipboard_changed, "set viewer NULL->1", FALSE); + expect_HWND(NULL, hRet); + expect_HWND(hWnd1, GetClipboardViewer()); + + /* Test that changing the clipboard actually refreshes the registered viewer. */ + clear_clipboard(hWnd1); + wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner(); + ok_sequence(wm_clipboard_changed, "clear clipbd (viewer=owner=1)", FALSE); + + /* Again, but with different owner. */ + clear_clipboard(hWnd2); + wm_clipboard_changed_and_owned[1].wParam = (WPARAM) GetClipboardOwner(); + ok_sequence(wm_clipboard_changed_and_owned, "clear clipbd (viewer=1, owner=2)", FALSE); + + /* Test re-registering same window. */ + hRet = SetClipboardViewer(hWnd1); + wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner(); + ok_sequence(wm_clipboard_changed, "set viewer 1->1", FALSE); + expect_HWND(hWnd1, hRet); + expect_HWND(hWnd1, GetClipboardViewer()); + + /* Test ChangeClipboardChain. */ + ChangeClipboardChain(hWnd2, hWnd3); + wm_change_cb_chain[0].wParam = (WPARAM) hWnd2; + wm_change_cb_chain[0].lParam = (LPARAM) hWnd3; + ok_sequence(wm_change_cb_chain, "change chain (viewer=1, remove=2, next=3)", FALSE); + expect_HWND(hWnd1, GetClipboardViewer()); + + ChangeClipboardChain(hWnd2, NULL); + wm_change_cb_chain[0].wParam = (WPARAM) hWnd2; + wm_change_cb_chain[0].lParam = 0; + ok_sequence(wm_change_cb_chain, "change chain (viewer=1, remove=2, next=NULL)", FALSE); + expect_HWND(hWnd1, GetClipboardViewer()); + + ChangeClipboardChain(NULL, hWnd2); + ok_sequence(WmEmptySeq, "change chain (viewer=1, remove=NULL, next=2)", TRUE); + expect_HWND(hWnd1, GetClipboardViewer()); + + /* Actually change clipboard viewer with ChangeClipboardChain. */ + ChangeClipboardChain(hWnd1, hWnd2); + ok_sequence(WmEmptySeq, "change chain (viewer=remove=1, next=2)", FALSE); + expect_HWND(hWnd2, GetClipboardViewer()); + + /* Test that no refresh messages are sent when viewer has unregistered. */ + clear_clipboard(hWnd2); + ok_sequence(WmEmptySeq, "clear clipd (viewer=2, owner=1)", FALSE); + + /* Register hWnd1 again. */ + ChangeClipboardChain(hWnd2, hWnd1); + ok_sequence(WmEmptySeq, "change chain (viewer=remove=2, next=1)", FALSE); + expect_HWND(hWnd1, GetClipboardViewer()); + + /* Subclass hWnd1 so that when it receives a WM_DRAWCLIPBOARD message, it + * changes the clipboard. When this happens, the system shouldn't send + * another WM_DRAWCLIPBOARD (as this could cause an infinite loop). + */ + pOldViewerProc = (WNDPROC) SetWindowLongPtrA(hWnd1, GWLP_WNDPROC, (LONG_PTR) recursive_viewer_proc); + clear_clipboard(hWnd2); + /* The clipboard owner is changed in recursive_viewer_proc: */ + wm_clipboard_changed[0].wParam = (WPARAM) hWnd2; + ok_sequence(wm_clipboard_changed, "recursive clear clipbd (viewer=1, owner=2)", TRUE); + + /* Test unregistering. */ + ChangeClipboardChain(hWnd1, NULL); + ok_sequence(WmEmptySeq, "change chain (viewer=remove=1, next=NULL)", FALSE); + expect_HWND(NULL, GetClipboardViewer()); + + clear_clipboard(hWnd1); + ok_sequence(wm_clipboard_destroyed, "clear clipbd (no viewer, owner=1)", FALSE); + + DestroyWindow(hWnd1); + DestroyWindow(hWnd2); + DestroyWindow(hWnd3); + SetClipboardViewer(hOrigViewer); +} + static void test_PostMessage(void) { static const struct @@ -11787,7 +11979,7 @@ START_TEST(msg) { BOOL ret; - FARPROC pIsWinEventHookInstalled = 0;/*GetProcAddress(user32, "IsWinEventHookInstalled");*/ + BOOL (WINAPI *pIsWinEventHookInstalled)(DWORD)= 0;/*GetProcAddress(user32, "IsWinEventHookInstalled");*/ init_procs(); @@ -11867,6 +12059,7 @@ test_menu_messages(); test_paintingloop(); test_defwinproc(); + test_clipboard_viewers(); /* keep it the last test, under Windows it tends to break the tests * which rely on active/foreground windows being correct. */ Modified: trunk/rostests/winetests/user32/resource.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/resource…
============================================================================== --- trunk/rostests/winetests/user32/resource.rc [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/resource.rc [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -98,6 +98,13 @@ PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 END +TEST_EMPTY_DIALOG DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN +END + MULTI_EDIT_DIALOG DIALOG DISCARDABLE 0, 0, 160, 75 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER CAPTION "Multiple Edit Test" Modified: trunk/rostests/winetests/user32/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/sysparam…
============================================================================== --- trunk/rostests/winetests/user32/sysparams.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/sysparams.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -942,7 +942,8 @@ rc=SystemParametersInfoA( SPI_GETSCREENSAVEACTIVE, 0, &v, 0 ); ok(rc!=0,"%d: rc=%d err=%d\n",i,rc,GetLastError()); - eq( v, vals[i], "SPI_{GET,SET}SCREENSAVEACTIVE", "%d" ); + ok(v == vals[i] || broken(! v) /* Win 7 */, + "SPI_{GET,SET}SCREENSAVEACTIVE: got %d instead of %d\n", v, vals[i]); } rc=SystemParametersInfoA( SPI_SETSCREENSAVEACTIVE, old_b, 0, SPIF_UPDATEINIFILE ); Modified: trunk/rostests/winetests/user32/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/text.c?r…
============================================================================== --- trunk/rostests/winetests/user32/text.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/text.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -80,7 +80,7 @@ ok( textheight, "DrawTextA error %u\n", GetLastError()); trace("MM_HIENGLISH rect.bottom %d\n", rect.bottom); - todo_wine ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with " + ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with " "DT_CALCRECT should return a negative rectangle bottom. " "(bot=%d)\n", rect.bottom); Modified: trunk/rostests/winetests/user32/win.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/win.c?re…
============================================================================== --- trunk/rostests/winetests/user32/win.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/win.c [iso-8859-1] Thu Oct 15 22:00:27 2009 @@ -3216,6 +3216,59 @@ 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); +} + +static void test_scrollwindow( HWND hwnd) +{ + HDC hdc; + RECT rc, rc2, rc3; + COLORREF colr; + + ShowWindow( hwnd, SW_SHOW); + UpdateWindow( hwnd); + flush_events( TRUE ); + GetClientRect( hwnd, &rc); + hdc = GetDC( hwnd); + /* test ScrollWindow(Ex) with no clip rectangle */ + /* paint the lower half of the window black */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH)); + /* paint the upper half of the window white */ + rc2.bottom = rc2.top; + rc2.top =0; + FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH)); + /* scroll lower half up */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, NULL, NULL, NULL, SW_ERASE); + flush_events(FALSE); + /* expected: black should have scrolled to the upper half */ + colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2, rc2.bottom / 4 ); + ok ( colr == 0, "pixel should be black, color is %08x\n", colr); + /* Repeat that test of ScrollWindow(Ex) now with clip rectangle */ + /* paint the lower half of the window black */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH)); + /* paint the upper half of the window white */ + rc2.bottom = rc2.top; + rc2.top =0; + FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH)); + /* scroll lower half up */ + rc2 = rc; + rc2.top = ( rc2.top + rc2.bottom) / 2; + rc3 = rc; + rc3.left = rc3.right / 4; + rc3.right -= rc3.right / 4; + ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, &rc3, NULL, NULL, SW_ERASE); + flush_events(FALSE); + /* expected: black should have scrolled to the upper half */ + colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2, rc2.bottom / 4 ); + ok ( colr == 0, "pixel should be black, color is %08x\n", colr); + + /* clean up */ + ReleaseDC( hwnd, hdc); } static void test_scrollvalidate( HWND parent) @@ -5724,6 +5777,7 @@ test_mouse_input(hwndMain); test_validatergn(hwndMain); test_nccalcscroll( hwndMain); + test_scrollwindow( hwndMain); test_scrollvalidate( hwndMain); test_scrolldc( hwndMain); test_scroll();
15 years, 2 months
1
0
0
0
[tkreuzer] 43498: add init.c to the build
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Oct 15 21:58:43 2009 New Revision: 43498 URL:
http://svn.reactos.org/svn/reactos?rev=43498&view=rev
Log: add init.c to the build Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Thu Oct 15 21:58:43 2009 @@ -412,6 +412,7 @@ </if> <if property="ARCH" value="amd64"> <directory name="amd64"> + <file>init.c</file> <file>page.c</file> </directory> </if>
15 years, 2 months
1
0
0
0
[tkreuzer] 43497: EPROCESS.Session is a PVOID not an ULONG
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Oct 15 21:55:06 2009 New Revision: 43497 URL:
http://svn.reactos.org/svn/reactos?rev=43497&view=rev
Log: EPROCESS.Session is a PVOID not an ULONG Modified: branches/ros-amd64-bringup/reactos/include/ndk/pstypes.h Modified: branches/ros-amd64-bringup/reactos/include/ndk/pstypes.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
============================================================================== --- branches/ros-amd64-bringup/reactos/include/ndk/pstypes.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/ndk/pstypes.h [iso-8859-1] Thu Oct 15 21:55:06 2009 @@ -1283,7 +1283,7 @@ HARDWARE_PTE PageDirectoryPte; ULONGLONG Filler; }; - ULONG Session; + PVOID Session; CHAR ImageFileName[16]; LIST_ENTRY JobLinks; PVOID LockedPagesList;
15 years, 2 months
1
0
0
0
[fireball] 43496: - Update gdi32_winetest to Wine-1.1.31 keeping a bitmap font test skipping hack.
by fireball@svn.reactos.org
Author: fireball Date: Thu Oct 15 21:50:01 2009 New Revision: 43496 URL:
http://svn.reactos.org/svn/reactos?rev=43496&view=rev
Log: - Update gdi32_winetest to Wine-1.1.31 keeping a bitmap font test skipping hack. Modified: trunk/rostests/winetests/gdi32/bitmap.c trunk/rostests/winetests/gdi32/clipping.c trunk/rostests/winetests/gdi32/font.c trunk/rostests/winetests/gdi32/gdiobj.c trunk/rostests/winetests/gdi32/mapping.c trunk/rostests/winetests/gdi32/metafile.c Modified: trunk/rostests/winetests/gdi32/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/bitmap.c?…
============================================================================== --- trunk/rostests/winetests/gdi32/bitmap.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdi32/bitmap.c [iso-8859-1] Thu Oct 15 21:50:01 2009 @@ -780,7 +780,9 @@ BitBlt(hdcmem2, 0, 0, 16,16, hdcmem, 0, 0, SRCCOPY); ok(bits32[0] == 0xff00, "lower left pixel is %08x\n", bits32[0]); - ok(bits32[17] == 0xff00ff, "bottom but one, left pixel is %08x\n", bits32[17]); + ok(bits32[17] == 0xff00ff || + broken(bits32[17] == 0x00ff00), /* Intermittent on Win9x/ME */ + "bottom but one, left pixel is %08x\n", bits32[17]); SelectObject(hdcmem2, oldbm2); test_dib_info(hdib2, bits32, &pbmi->bmiHeader); @@ -1954,7 +1956,9 @@ ok(bm.bmWidthBytes == BITMAP_GetWidthBytes(bm.bmWidth, bm.bmBitsPixel), "wrong bmWidthBytes %d\n", bm.bmWidthBytes); ok(bm.bmPlanes == planes, "wrong bmPlanes %u\n", bm.bmPlanes); if(depths[i] == 15) { - ok(bm.bmBitsPixel == 16, "wrong bmBitsPixel %d(15 bpp special)\n", bm.bmBitsPixel); + ok(bm.bmBitsPixel == 16 || + broken(bm.bmBitsPixel == 15), /* Win9x/WinME */ + "wrong bmBitsPixel %d(15 bpp special)\n", bm.bmBitsPixel); } else { ok(bm.bmBitsPixel == depths[i], "wrong bmBitsPixel %d\n", bm.bmBitsPixel); } @@ -2248,6 +2252,469 @@ ReleaseDC(NULL, screen_dc); } +static BOOL compare_buffers_no_alpha(UINT32 *a, UINT32 *b, int length) +{ + int i; + for(i = 0; i < length; i++) + if((a[i] & 0x00FFFFFF) != (b[i] & 0x00FFFFFF)) + return FALSE; + return TRUE; +} + +static void check_BitBlt_pixel(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32 *srcBuffer, + DWORD dwRop, UINT32 expected, int line) +{ + *srcBuffer = 0xFEDCBA98; + *dstBuffer = 0x89ABCDEF; + Rectangle(hdcSrc, 0, 0, 1, 1); /* A null operation to ensure dibs are coerced to X11 */ + BitBlt(hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, dwRop); + ok(expected == *dstBuffer, + "BitBlt with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n", + dwRop, expected, *dstBuffer, line); +} + +static void test_BitBlt(void) +{ + HBITMAP bmpDst, bmpSrc; + HBITMAP oldDst, oldSrc; + HDC hdcScreen, hdcDst, hdcSrc; + UINT32 *dstBuffer, *srcBuffer; + HBRUSH hBrush, hOldBrush; + BITMAPINFO bitmapInfo; + + memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = 1; + bitmapInfo.bmiHeader.biHeight = 1; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + bitmapInfo.bmiHeader.biSizeImage = sizeof(UINT32); + + hdcScreen = CreateCompatibleDC(0); + hdcDst = CreateCompatibleDC(hdcScreen); + hdcSrc = CreateCompatibleDC(hdcDst); + + /* Setup the destination dib section */ + bmpDst = CreateDIBSection(hdcScreen, &bitmapInfo, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + hBrush = CreateSolidBrush(0x012345678); + hOldBrush = SelectObject(hdcDst, hBrush); + + /* Setup the source dib section */ + bmpSrc = CreateDIBSection(hdcScreen, &bitmapInfo, DIB_RGB_COLORS, (void**)&srcBuffer, + NULL, 0); + oldSrc = SelectObject(hdcSrc, bmpSrc); + + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCCOPY, 0xFEDCBA98, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCPAINT, 0xFFFFFFFF, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCAND, 0x88888888, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCINVERT, 0x77777777, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCERASE, 0x76543210, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, NOTSRCCOPY, 0x01234567, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, NOTSRCERASE, 0x00000000, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, MERGECOPY, 0x00581210, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, MERGEPAINT, 0x89ABCDEF, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATCOPY, 0x00785634, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATPAINT, 0x89FBDFFF, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATINVERT, 0x89D39BDB, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, DSTINVERT, 0x76543210, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, BLACKNESS, 0x00000000, __LINE__); + check_BitBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, WHITENESS, 0xFFFFFFFF, __LINE__); + + /* Tidy up */ + SelectObject(hdcSrc, oldSrc); + DeleteObject(bmpSrc); + DeleteDC(hdcSrc); + + SelectObject(hdcDst, hOldBrush); + DeleteObject(hBrush); + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + DeleteDC(hdcDst); + + + DeleteDC(hdcScreen); +} + +static void check_StretchBlt_pixel(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32 *srcBuffer, + DWORD dwRop, UINT32 expected, int line) +{ + *srcBuffer = 0xFEDCBA98; + *dstBuffer = 0x89ABCDEF; + StretchBlt(hdcDst, 0, 0, 2, 1, hdcSrc, 0, 0, 1, 1, dwRop); + ok(expected == *dstBuffer, + "StretchBlt with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n", + dwRop, expected, *dstBuffer, line); +} + +static void check_StretchBlt_stretch(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32 *srcBuffer, + int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, + int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, + UINT32 expected[4], UINT32 legacy_expected[4], int line) +{ + memset(dstBuffer, 0, 16); + StretchBlt(hdcDst, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, + hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, SRCCOPY); + ok(memcmp(dstBuffer, expected, 16) == 0 || + broken(compare_buffers_no_alpha(dstBuffer, legacy_expected, 4)), + "StretchBlt expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X } " + "stretching { %d, %d, %d, %d } to { %d, %d, %d, %d } from line %d\n", + expected[0], expected[1], expected[2], expected[3], + dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3], + nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, line); +} + +static void test_StretchBlt(void) +{ + HBITMAP bmpDst, bmpSrc; + HBITMAP oldDst, oldSrc; + HDC hdcScreen, hdcDst, hdcSrc; + UINT32 *dstBuffer, *srcBuffer; + HBRUSH hBrush, hOldBrush; + BITMAPINFO biDst, biSrc; + UINT32 expected[4], legacy_expected[4]; + + memset(&biDst, 0, sizeof(BITMAPINFO)); + biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + biDst.bmiHeader.biWidth = 2; + biDst.bmiHeader.biHeight = -2; + biDst.bmiHeader.biPlanes = 1; + biDst.bmiHeader.biBitCount = 32; + biDst.bmiHeader.biCompression = BI_RGB; + memcpy(&biSrc, &biDst, sizeof(BITMAPINFO)); + + hdcScreen = CreateCompatibleDC(0); + hdcDst = CreateCompatibleDC(hdcScreen); + hdcSrc = CreateCompatibleDC(hdcDst); + + /* Pixel Tests */ + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + bmpSrc = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&srcBuffer, + NULL, 0); + oldSrc = SelectObject(hdcSrc, bmpSrc); + + hBrush = CreateSolidBrush(0x012345678); + hOldBrush = SelectObject(hdcDst, hBrush); + + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCCOPY, 0xFEDCBA98, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCPAINT, 0xFFFFFFFF, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCAND, 0x88888888, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCINVERT, 0x77777777, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCERASE, 0x76543210, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, NOTSRCCOPY, 0x01234567, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, NOTSRCERASE, 0x00000000, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, MERGECOPY, 0x00581210, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, MERGEPAINT, 0x89ABCDEF, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATCOPY, 0x00785634, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATPAINT, 0x89FBDFFF, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATINVERT, 0x89D39BDB, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, DSTINVERT, 0x76543210, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, BLACKNESS, 0x00000000, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, WHITENESS, 0xFFFFFFFF, __LINE__); + + SelectObject(hdcDst, hOldBrush); + DeleteObject(hBrush); + + /* Top-down to top-down tests */ + srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE; + srcBuffer[2] = 0xFEDCBA98, srcBuffer[3] = 0x76543210; + + expected[0] = 0xCAFED00D, expected[1] = 0xFEEDFACE; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 1, 1, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0xCAFED00D; + expected[2] = 0xCAFED00D, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 1, 1, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0x76543210, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEEDFACE, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x76543210, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEEDFACE, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 1, 1, -2, -2, 0, 0, 2, 2, expected, expected, __LINE__); + + /* This result seems broken. One might expect the following result: + * 0xCAFED00D 0xFEEDFACE + * 0xFEDCBA98 0x76543210 + */ + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + legacy_expected[0] = 0xCAFED00D, legacy_expected[1] = 0x00000000; + legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000; + todo_wine check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 1, 1, -2, -2, 1, 1, -2, -2, expected, + legacy_expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 1, 1, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + + /* Top-down to bottom-up tests */ + biDst.bmiHeader.biHeight = 2; + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + expected[0] = 0xFEDCBA98, expected[1] = 0x76543210; + expected[2] = 0xCAFED00D, expected[3] = 0xFEEDFACE; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xFEEDFACE, expected[1] = 0xCAFED00D; + expected[2] = 0x76543210, expected[3] = 0xFEDCBA98; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + SelectObject(hdcSrc, oldSrc); + DeleteObject(bmpSrc); + + /* Bottom-up to bottom-up tests */ + biSrc.bmiHeader.biHeight = 2; + bmpSrc = CreateDIBSection(hdcScreen, &biSrc, DIB_RGB_COLORS, (void**)&srcBuffer, + NULL, 0); + srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE; + srcBuffer[2] = 0xFEDCBA98, srcBuffer[3] = 0x76543210; + oldSrc = SelectObject(hdcSrc, bmpSrc); + + expected[0] = 0xCAFED00D, expected[1] = 0xFEEDFACE; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0x76543210, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEEDFACE, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + + /* Bottom-up to top-down tests */ + biDst.bmiHeader.biHeight = -2; + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + expected[0] = 0xFEDCBA98, expected[1] = 0x76543210; + expected[2] = 0xCAFED00D, expected[3] = 0xFEEDFACE; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xFEEDFACE, expected[1] = 0xCAFED00D; + expected[2] = 0x76543210, expected[3] = 0xFEDCBA98; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + /* Tidy up */ + SelectObject(hdcSrc, oldSrc); + DeleteObject(bmpSrc); + DeleteDC(hdcSrc); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + DeleteDC(hdcDst); + + DeleteDC(hdcScreen); +} + +static void check_StretchDIBits_pixel(HDC hdcDst, UINT32 *dstBuffer, UINT32 *srcBuffer, + DWORD dwRop, UINT32 expected, int line) +{ + const UINT32 buffer[2] = { 0xFEDCBA98, 0 }; + BITMAPINFO bitmapInfo; + + memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = 2; + bitmapInfo.bmiHeader.biHeight = 1; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + bitmapInfo.bmiHeader.biSizeImage = sizeof(buffer); + + *dstBuffer = 0x89ABCDEF; + + StretchDIBits(hdcDst, 0, 0, 2, 1, 0, 0, 1, 1, &buffer, &bitmapInfo, DIB_RGB_COLORS, dwRop); + ok(expected == *dstBuffer, + "StretchDIBits with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n", + dwRop, expected, *dstBuffer, line); +} + +static void check_StretchDIBits_stretch(HDC hdcDst, UINT32 *dstBuffer, UINT32 *srcBuffer, + int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, + int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, + UINT32 expected[4], UINT32 legacy_expected[4], int line) +{ + BITMAPINFO bitmapInfo; + + memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = 2; + bitmapInfo.bmiHeader.biHeight = -2; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + + memset(dstBuffer, 0, 16); + StretchDIBits(hdcDst, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, + nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + srcBuffer, &bitmapInfo, DIB_RGB_COLORS, SRCCOPY); + ok(memcmp(dstBuffer, expected, 16) == 0 || /* Win2k/XP */ + broken(compare_buffers_no_alpha(dstBuffer, legacy_expected, 4)) || /* Win9X/ME */ + broken(nWidthSrc < 0 || nHeightSrc < 0), /* Win9X/ME */ + "StretchDIBits expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X } " + "stretching { %d, %d, %d, %d } to { %d, %d, %d, %d } from line %d\n", + expected[0], expected[1], expected[2], expected[3], + dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3], + nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, line); +} + +static void test_StretchDIBits(void) +{ + HBITMAP bmpDst; + HBITMAP oldDst; + HDC hdcScreen, hdcDst; + UINT32 *dstBuffer, srcBuffer[4]; + HBRUSH hBrush, hOldBrush; + BITMAPINFO biDst; + UINT32 expected[4], legacy_expected[4]; + + memset(&biDst, 0, sizeof(BITMAPINFO)); + biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + biDst.bmiHeader.biWidth = 2; + biDst.bmiHeader.biHeight = -2; + biDst.bmiHeader.biPlanes = 1; + biDst.bmiHeader.biBitCount = 32; + biDst.bmiHeader.biCompression = BI_RGB; + + hdcScreen = CreateCompatibleDC(0); + hdcDst = CreateCompatibleDC(hdcScreen); + + /* Pixel Tests */ + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + hBrush = CreateSolidBrush(0x012345678); + hOldBrush = SelectObject(hdcDst, hBrush); + + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCCOPY, 0xFEDCBA98, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCPAINT, 0xFFFFFFFF, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCAND, 0x88888888, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCINVERT, 0x77777777, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCERASE, 0x76543210, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, NOTSRCCOPY, 0x01234567, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, NOTSRCERASE, 0x00000000, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, MERGECOPY, 0x00581210, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, MERGEPAINT, 0x89ABCDEF, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, PATCOPY, 0x00785634, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, PATPAINT, 0x89FBDFFF, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, PATINVERT, 0x89D39BDB, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, DSTINVERT, 0x76543210, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, BLACKNESS, 0x00000000, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, WHITENESS, 0xFFFFFFFF, __LINE__); + + SelectObject(hdcDst, hOldBrush); + DeleteObject(hBrush); + + /* Top-down destination tests */ + srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE; + srcBuffer[2] = 0xFEDCBA98, srcBuffer[3] = 0x76543210; + + expected[0] = 0xCAFED00D, expected[1] = 0xFEEDFACE; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + legacy_expected[0] = 0xFEDCBA98, legacy_expected[1] = 0x00000000; + legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000; + todo_wine check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 1, 1, expected, legacy_expected, __LINE__); + + expected[0] = 0xFEDCBA98, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEDCBA98, expected[3] = 0xFEDCBA98; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 1, 1, expected, expected, __LINE__); + + expected[0] = 0x42441000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + legacy_expected[0] = 0x00543210, legacy_expected[1] = 0x00000000; + legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000; + todo_wine check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 2, 2, expected, legacy_expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 1, 1, -2, -2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0xCAFED00D; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 1, 1, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + + /* Bottom up destination tests */ + biDst.bmiHeader.biHeight = 2; + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + expected[0] = 0xFEDCBA98, expected[1] = 0x76543210; + expected[2] = 0xCAFED00D, expected[3] = 0xFEEDFACE; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + /* Tidy up */ + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + DeleteDC(hdcDst); + + DeleteDC(hdcScreen); +} + static void test_GdiAlphaBlend(void) { /* test out-of-bound parameters for GdiAlphaBlend */ @@ -2310,6 +2777,10 @@ ScaleWindowExtEx(hdcSrc, 10, 1, 10, 1, NULL); expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -1, 0, 30, 30, blend), TRUE, BOOL, "%d"); expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 30, 30, blend), TRUE, BOOL, "%d"); + + SetLastError(0xdeadbeef); + expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, NULL, 0, 0, 20, 20, blend), FALSE, BOOL, "%d"); + expect_eq(GetLastError(), 0xdeadbeef, int, "%d"); SelectObject(hdcDst, oldDst); SelectObject(hdcSrc, oldSrc); @@ -2389,6 +2860,9 @@ test_GetDIBits_BI_BITFIELDS(); test_select_object(); test_CreateBitmap(); + test_BitBlt(); + test_StretchBlt(); + test_StretchDIBits(); test_GdiAlphaBlend(); test_bitmapinfoheadersize(); test_get16dibits(); Modified: trunk/rostests/winetests/gdi32/clipping.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/clipping.…
============================================================================== --- trunk/rostests/winetests/gdi32/clipping.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdi32/clipping.c [iso-8859-1] Thu Oct 15 21:50:01 2009 @@ -189,13 +189,13 @@ HRGN hrgn; XFORM xform; -if (0) /* crashes under Win9x */ -{ - SetLastError(0xdeadbeef); - hrgn = ExtCreateRegion(NULL, 0, NULL); - ok(!hrgn, "ExtCreateRegion should fail\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); -} + if (0) /* crashes under Win9x */ + { + SetLastError(0xdeadbeef); + hrgn = ExtCreateRegion(NULL, 0, NULL); + ok(!hrgn, "ExtCreateRegion should fail\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); + } rgn.data.rdh.dwSize = 0; rgn.data.rdh.iType = 0; Modified: trunk/rostests/winetests/gdi32/font.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/font.c?re…
============================================================================== --- trunk/rostests/winetests/gdi32/font.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdi32/font.c [iso-8859-1] Thu Oct 15 21:50:01 2009 @@ -2175,7 +2175,7 @@ seg->id_range_offset = GET_BE_WORD(cmap->end_count[3 * segs + 1 + seg_num]); } -static BOOL get_first_last_from_cmap4(void *ptr, DWORD *first, DWORD *last) +static BOOL get_first_last_from_cmap4(void *ptr, DWORD *first, DWORD *last, DWORD limit) { int i; cmap_format_4 *cmap = (cmap_format_4*)ptr; @@ -2200,7 +2200,15 @@ + code - seg.start_count + i - seg_count; - index = GET_BE_WORD(glyph_ids[index]); + /* some fonts have broken last segment */ + if ((char *)(glyph_ids + index + sizeof(*glyph_ids)) < (char *)ptr + limit) + index = GET_BE_WORD(glyph_ids[index]); + else + { + trace("segment %04x/%04x index %04x points to nowhere\n", + seg.start_count, seg.end_count, index); + index = 0; + } if(index) index += seg.id_delta; } if(*first == 0x10000) @@ -2273,7 +2281,7 @@ r = get_first_last_from_cmap0(cmap, first, last); break; case 4: - r = get_first_last_from_cmap4(cmap, first, last); + r = get_first_last_from_cmap4(cmap, first, last, size); break; default: trace("unhandled cmap format %d\n", format); @@ -2914,10 +2922,67 @@ DeleteDC(hdc); } +/* bug #9995: there is a limit to the character width that can be specified */ +static void test_GetTextMetrics2(const char *fontname, int font_height) +{ + HFONT of, hf; + HDC hdc; + TEXTMETRICA tm; + BOOL ret; + int ave_width, height, width, ratio, scale; + + if (!is_truetype_font_installed( fontname)) { + skip("%s is not installed\n", fontname); + return; + } + hdc = CreateCompatibleDC(0); + ok( hdc != NULL, "CreateCompatibleDC failed\n"); + /* select width = 0 */ + hf = CreateFontA(font_height, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, + DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_LH_ANGLES, + DEFAULT_QUALITY, VARIABLE_PITCH, + fontname); + ok( hf != NULL, "CreateFontA failed\n"); + of = SelectObject( hdc, hf); + ret = GetTextMetricsA( hdc, &tm); + ok(ret, "GetTextMetricsA error %u\n", GetLastError()); + height = tm.tmHeight; + ave_width = tm.tmAveCharWidth; + SelectObject( hdc, of); + DeleteObject( hf); + + trace("height %d, ave width %d\n", height, ave_width); + + for (width = ave_width * 2; /* nothing*/; width += ave_width) + { + hf = CreateFont(height, width, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, + DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_LH_ANGLES, + DEFAULT_QUALITY, VARIABLE_PITCH, fontname); + ok(hf != 0, "CreateFont failed\n"); + of = SelectObject(hdc, hf); + ret = GetTextMetrics(hdc, &tm); + ok(ret, "GetTextMetrics error %u\n", GetLastError()); + SelectObject(hdc, of); + DeleteObject(hf); + + if (tm.tmAveCharWidth == ave_width || width / height > 200) + break; + } + + DeleteDC(hdc); + + ratio = width / height; + scale = width / ave_width; + + trace("max width/height ratio (%d / %d) %d, max width scale (%d / %d) %d\n", + width, height, ratio, width, ave_width, scale); + + ok(ratio >= 90 && ratio <= 110, "expected width/height ratio 90-110, got %d\n", ratio); +} + START_TEST(font) { init(); - test_logfont(); test_bitmap_font(); test_outline_font(); @@ -2952,4 +3017,10 @@ test_GdiRealizationInfo(); test_GetTextFace(); test_GetGlyphOutline(); -} + test_GetTextMetrics2("Tahoma", -11); + test_GetTextMetrics2("Tahoma", -55); + test_GetTextMetrics2("Tahoma", -110); + test_GetTextMetrics2("Arial", -11); + test_GetTextMetrics2("Arial", -55); + test_GetTextMetrics2("Arial", -110); +} Modified: trunk/rostests/winetests/gdi32/gdiobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/gdiobj.c?…
============================================================================== --- trunk/rostests/winetests/gdi32/gdiobj.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdi32/gdiobj.c [iso-8859-1] Thu Oct 15 21:50:01 2009 @@ -266,9 +266,49 @@ DeleteDC(hdc); } +static void test_region(void) +{ + HRGN hrgn = CreateRectRgn(10, 10, 20, 20); + RECT rc = { 5, 5, 15, 15 }; + BOOL ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + /* swap left and right */ + SetRect( &rc, 15, 5, 5, 15 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + /* swap top and bottom */ + SetRect( &rc, 5, 15, 15, 5 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + /* swap both */ + SetRect( &rc, 15, 15, 5, 5 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + DeleteObject(hrgn); + /* swap left and right in the region */ + hrgn = CreateRectRgn(20, 10, 10, 20); + SetRect( &rc, 5, 5, 15, 15 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + /* swap left and right */ + SetRect( &rc, 15, 5, 5, 15 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + /* swap top and bottom */ + SetRect( &rc, 5, 15, 15, 5 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + /* swap both */ + SetRect( &rc, 15, 15, 5, 5 ); + ret = RectInRegion( hrgn, &rc); + ok( ret, "RectInRegion should return TRUE\n"); + DeleteObject(hrgn); +} + START_TEST(gdiobj) { test_gdi_objects(); test_thread_objects(); test_GetCurrentObject(); -} + test_region(); +} Modified: trunk/rostests/winetests/gdi32/mapping.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/mapping.c…
============================================================================== --- trunk/rostests/winetests/gdi32/mapping.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdi32/mapping.c [iso-8859-1] Thu Oct 15 21:50:01 2009 @@ -342,9 +342,227 @@ ReleaseDC(0, hdc); } +static void test_setvirtualresolution(void) +{ + HDC hdc = CreateICA("DISPLAY", NULL, NULL, NULL); + DWORD r; + DWORD (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD); + INT horz_res = GetDeviceCaps(hdc, HORZRES); + INT horz_size = GetDeviceCaps(hdc, HORZSIZE); + INT log_pixels_x = GetDeviceCaps(hdc, LOGPIXELSX); + SIZE orig_lometric_vp, orig_lometric_wnd; + + pSetVirtualResolution = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "SetVirtualResolution"); + + if(!pSetVirtualResolution) + { + win_skip("Don't have SetVirtualResolution\n"); + return; + } + + /* Get the true resolution limits */ + SetMapMode(hdc, MM_LOMETRIC); + GetViewportExtEx(hdc, &orig_lometric_vp); + GetWindowExtEx(hdc, &orig_lometric_wnd); + SetMapMode(hdc, MM_TEXT); + + r = pSetVirtualResolution(hdc, 4000, 1000, 400, 200); /* 10 pix/mm x 5 pix/mm */ + ok(r == TRUE, "got %d\n", r); + expect_LPtoDP(hdc, 1000, 1000); + expect_viewport_ext(hdc, 1, 1); + expect_window_ext(hdc, 1, 1); + + SetMapMode(hdc, MM_LOMETRIC); + expect_LPtoDP(hdc, 1000, -500); + expect_viewport_ext(hdc, 4000, -1000); + expect_window_ext(hdc, 4000, 2000); + + /* Doesn't change the device caps */ + ok(horz_res == GetDeviceCaps(hdc, HORZRES), "horz_res changed\n"); + ok(horz_size == GetDeviceCaps(hdc, HORZSIZE), "horz_size changed\n"); + ok(log_pixels_x == GetDeviceCaps(hdc, LOGPIXELSX), "log_pixels_x changed\n"); + + r = pSetVirtualResolution(hdc, 8000, 1000, 400, 200); /* 20 pix/mm x 5 pix/mm */ + ok(r == TRUE, "got %d\n", r); + expect_LPtoDP(hdc, 1000, -500); /* No change, need to re-set the mapping mode */ + SetMapMode(hdc, MM_TEXT); + SetMapMode(hdc, MM_LOMETRIC); + expect_LPtoDP(hdc, 2000, -500); + expect_viewport_ext(hdc, 8000, -1000); + expect_window_ext(hdc, 4000, 2000); + + r = pSetVirtualResolution(hdc, 8000, 1000, 200, 200); /* 40 pix/mm x 5 pix/mm */ + ok(r == TRUE, "got %d\n", r); + SetMapMode(hdc, MM_TEXT); + SetMapMode(hdc, MM_LOMETRIC); + expect_LPtoDP(hdc, 4000, -500); + expect_viewport_ext(hdc, 8000, -1000); + expect_window_ext(hdc, 2000, 2000); + + r = pSetVirtualResolution(hdc, 8000, 1000, 200, 200); /* 40 pix/mm x 5 pix/mm */ + ok(r == TRUE, "got %d\n", r); + SetMapMode(hdc, MM_TEXT); + SetMapMode(hdc, MM_LOMETRIC); + expect_LPtoDP(hdc, 4000, -500); + expect_viewport_ext(hdc, 8000, -1000); + expect_window_ext(hdc, 2000, 2000); + + r = pSetVirtualResolution(hdc, 8000, 2000, 200, 200); /* 40 pix/mm x 10 pix/mm */ + ok(r == TRUE, "got %d\n", r); + SetMapMode(hdc, MM_TEXT); + SetMapMode(hdc, MM_LOMETRIC); + expect_LPtoDP(hdc, 4000, -1000); + expect_viewport_ext(hdc, 8000, -2000); + expect_window_ext(hdc, 2000, 2000); + + r = pSetVirtualResolution(hdc, 0, 0, 10, 0); /* Error */ + ok(r == FALSE, "got %d\n", r); + SetMapMode(hdc, MM_TEXT); + SetMapMode(hdc, MM_LOMETRIC); + expect_LPtoDP(hdc, 4000, -1000); + expect_viewport_ext(hdc, 8000, -2000); + expect_window_ext(hdc, 2000, 2000); + + r = pSetVirtualResolution(hdc, 0, 0, 0, 0); /* Reset to true resolution */ + ok(r == TRUE, "got %d\n", r); + SetMapMode(hdc, MM_TEXT); + SetMapMode(hdc, MM_LOMETRIC); + expect_viewport_ext(hdc, orig_lometric_vp.cx, orig_lometric_vp.cy); + expect_window_ext(hdc, orig_lometric_wnd.cx, orig_lometric_wnd.cy); + + DeleteDC(hdc); +} + + +static inline void expect_identity(int line, XFORM *xf) +{ + ok(xf->eM11 == 1.0, "%d: got %f\n", line, xf->eM11); + ok(xf->eM12 == 0.0, "%d: got %f\n", line, xf->eM12); + ok(xf->eM21 == 0.0, "%d: got %f\n", line, xf->eM21); + ok(xf->eM22 == 1.0, "%d: got %f\n", line, xf->eM22); + ok(xf->eDx == 0.0, "%d: got %f\n", line, xf->eDx); + ok(xf->eDy == 0.0, "%d: got %f\n", line, xf->eDy); +} + +static inline void xform_near_match(int line, XFORM *got, XFORM *expect) +{ + ok(fabs(got->eM11 - expect->eM11) < 0.001, "%d: got %f expect %f\n", line, got->eM11, expect->eM11); + ok(fabs(got->eM12 - expect->eM12) < 0.001, "%d: got %f expect %f\n", line, got->eM12, expect->eM12); + ok(fabs(got->eM21 - expect->eM21) < 0.001, "%d: got %f expect %f\n", line, got->eM21, expect->eM21); + ok(fabs(got->eM22 - expect->eM22) < 0.001, "%d: got %f expect %f\n", line, got->eM22, expect->eM22); + ok(fabs(got->eDx - expect->eDx) < 0.001, "%d: got %f expect %f\n", line, got->eDx, expect->eDx); + ok(fabs(got->eDy - expect->eDy) < 0.001, "%d: got %f expect %f\n", line, got->eDy, expect->eDy); +} + + +static void test_gettransform(void) +{ + HDC hdc = CreateICA("DISPLAY", NULL, NULL, NULL); + BOOL (WINAPI *pGetTransform)(HDC, DWORD, XFORM *); + XFORM xform, expect; + BOOL r; + SIZE lometric_vp, lometric_wnd; + + pGetTransform = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetTransform"); + + if(!pGetTransform) + { + win_skip("Don't have GetTransform\n"); + return; + } + + r = pGetTransform(hdc, 0x203, &xform); /* World -> Page */ + ok(r == TRUE, "got %d\n", r); + expect_identity(__LINE__, &xform); + r = pGetTransform(hdc, 0x304, &xform); /* Page -> Device */ + ok(r == TRUE, "got %d\n", r); + expect_identity(__LINE__, &xform); + r = pGetTransform(hdc, 0x204, &xform); /* World -> Device */ + ok(r == TRUE, "got %d\n", r); + expect_identity(__LINE__, &xform); + r = pGetTransform(hdc, 0x402, &xform); /* Device -> World */ + ok(r == TRUE, "got %d\n", r); + expect_identity(__LINE__, &xform); + + SetMapMode(hdc, MM_LOMETRIC); + GetViewportExtEx(hdc, &lometric_vp); + GetWindowExtEx(hdc, &lometric_wnd); + + r = pGetTransform(hdc, 0x203, &xform); /* World -> Page */ + ok(r == TRUE, "got %d\n", r); + expect_identity(__LINE__, &xform); + + r = pGetTransform(hdc, 0x304, &xform); /* Page -> Device */ + ok(r == TRUE, "got %d\n", r); + expect.eM11 = (FLOAT) lometric_vp.cx / lometric_wnd.cx; + expect.eM12 = expect.eM21 = 0.0; + expect.eM22 = (FLOAT) lometric_vp.cy / lometric_wnd.cy; + expect.eDx = expect.eDy = 0.0; + xform_near_match(__LINE__, &xform, &expect); + + r = pGetTransform(hdc, 0x204, &xform); /* World -> Device */ + ok(r == TRUE, "got %d\n", r); + xform_near_match(__LINE__, &xform, &expect); + + r = pGetTransform(hdc, 0x402, &xform); /* Device -> World */ + ok(r == TRUE, "got %d\n", r); + expect.eM11 = (FLOAT) lometric_wnd.cx / lometric_vp.cx; + expect.eM22 = (FLOAT) lometric_wnd.cy / lometric_vp.cy; + xform_near_match(__LINE__, &xform, &expect); + + + SetGraphicsMode(hdc, GM_ADVANCED); + + expect.eM11 = 10.0; + expect.eM22 = 20.0; + SetWorldTransform(hdc, &expect); + r = pGetTransform(hdc, 0x203, &xform); /* World -> Page */ + ok(r == TRUE, "got %d\n", r); + xform_near_match(__LINE__, &xform, &expect); + + r = pGetTransform(hdc, 0x304, &xform); /* Page -> Device */ + ok(r == TRUE, "got %d\n", r); + expect.eM11 = (FLOAT) lometric_vp.cx / lometric_wnd.cx; + expect.eM22 = (FLOAT) lometric_vp.cy / lometric_wnd.cy; + xform_near_match(__LINE__, &xform, &expect); + + r = pGetTransform(hdc, 0x204, &xform); /* World -> Device */ + ok(r == TRUE, "got %d\n", r); + expect.eM11 *= 10.0; + expect.eM22 *= 20.0; + xform_near_match(__LINE__, &xform, &expect); + + r = pGetTransform(hdc, 0x402, &xform); /* Device -> World */ + ok(r == TRUE, "got %d\n", r); + expect.eM11 = 1 / expect.eM11; + expect.eM22 = 1 / expect.eM22; + xform_near_match(__LINE__, &xform, &expect); + + r = pGetTransform(hdc, 0x102, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x103, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x104, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x202, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x302, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x303, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x403, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0x404, &xform); + ok(r == FALSE, "got %d\n", r); + r = pGetTransform(hdc, 0xffff, &xform); + ok(r == FALSE, "got %d\n", r); +} + START_TEST(mapping) { test_modify_world_transform(); test_world_transform(); test_isotropic_mapping(); -} + test_setvirtualresolution(); + test_gettransform(); +} Modified: trunk/rostests/winetests/gdi32/metafile.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/metafile.…
============================================================================== --- trunk/rostests/winetests/gdi32/metafile.c [iso-8859-1] (original) +++ trunk/rostests/winetests/gdi32/metafile.c [iso-8859-1] Thu Oct 15 21:50:01 2009 @@ -1277,6 +1277,26 @@ HeapFree(GetProcessHeap(), 0, eto1); HeapFree(GetProcessHeap(), 0, eto2); } + else if (emr1->iType == EMR_EXTSELECTCLIPRGN && !lstrcmpA(desc, "emf_clipping")) + { + /* We have to take care of NT4 differences here */ + diff = memcmp(emr1, emr2, emr1->nSize); + if (diff) + { + ENHMETARECORD *emr_nt4; + + emr_nt4 = HeapAlloc(GetProcessHeap(), 0, emr2->nSize); + memcpy(emr_nt4, emr2, emr2->nSize); + /* Correct the nRgnSize field */ + emr_nt4->dParm[5] = sizeof(RECT); + + diff = memcmp(emr1, emr_nt4, emr1->nSize); + if (!diff) + win_skip("Catered for NT4 differences\n"); + + HeapFree(GetProcessHeap(), 0, emr_nt4); + } + } else diff = memcmp(emr1, emr2, emr1->nSize); @@ -1302,15 +1322,22 @@ BOOL ignore_scaling) { unsigned char buf[MF_BUFSIZE]; - UINT mfsize, offset; + UINT mfsize, offset1, offset2, diff_nt4, diff_9x; const ENHMETAHEADER *emh1, *emh2; mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf); ok (mfsize > 0, "%s: GetEnhMetaFileBits error %d\n", desc, GetLastError()); + /* ENHMETAHEADER size could differ, depending on platform */ + diff_nt4 = sizeof(SIZEL); + diff_9x = sizeof(SIZEL) + 3 * sizeof(DWORD); + if (mfsize < MF_BUFSIZE) { - ok(mfsize == bsize, "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize); + ok(mfsize == bsize || + broken(mfsize == bsize - diff_nt4) || /* NT4 */ + broken(mfsize == bsize - diff_9x), /* Win9x/WinME */ + "%s: mfsize=%d, bsize=%d\n", desc, mfsize, bsize); } else ok(bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d\n", @@ -1325,23 +1352,32 @@ ok(emh1->dSignature == ENHMETA_SIGNATURE, "expected ENHMETA_SIGNATURE, got %u\n", emh1->dSignature); ok(emh1->iType == emh2->iType, "expected EMR_HEADER, got %u\n", emh2->iType); - ok(emh1->nSize == emh2->nSize, "expected nSize %u, got %u\n", emh1->nSize, emh2->nSize); + ok(emh1->nSize == emh2->nSize || + broken(emh1->nSize - diff_nt4 == emh2->nSize) || + broken(emh1->nSize - diff_9x == emh2->nSize), + "expected nSize %u, got %u\n", emh1->nSize, emh2->nSize); ok(emh1->dSignature == emh2->dSignature, "expected dSignature %u, got %u\n", emh1->dSignature, emh2->dSignature); - ok(emh1->nBytes == emh2->nBytes, "expected nBytes %u, got %u\n", emh1->nBytes, emh2->nBytes); - ok(emh1->nRecords == emh2->nRecords, "expected nBytes %u, got %u\n", emh1->nRecords, emh2->nRecords); - - offset = emh1->nSize; - while (offset < emh1->nBytes) - { - const ENHMETARECORD *emr1 = (const ENHMETARECORD *)(bits + offset); - const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset); - - trace("EMF record %u, size %u/record %u, size %u\n", - emr1->iType, emr1->nSize, emr2->iType, emr2->nSize); + ok(emh1->nBytes == emh2->nBytes || + broken(emh1->nBytes - diff_nt4 == emh2->nBytes) || + broken(emh1->nBytes - diff_9x == emh2->nBytes), + "expected nBytes %u, got %u\n", emh1->nBytes, emh2->nBytes); + ok(emh1->nRecords == emh2->nRecords, "expected nRecords %u, got %u\n", emh1->nRecords, emh2->nRecords); + + offset1 = emh1->nSize; + offset2 = emh2->nSize; /* Needed for Win9x/WinME/NT4 */ + while (offset1 < emh1->nBytes) + { + const ENHMETARECORD *emr1 = (const ENHMETARECORD *)(bits + offset1); + const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset2); + + trace("%s: EMF record %u, size %u/record %u, size %u\n", + desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize); if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1; - offset += emr1->nSize; + /* We have already bailed out if iType or nSize don't match */ + offset1 += emr1->nSize; + offset2 += emr2->nSize; } return 0; } @@ -1421,8 +1457,8 @@ if (compare_mf_disk_bits(mf_name, MF_BLANK_BITS, sizeof(MF_BLANK_BITS), "mf_blank") != 0) { - dump_mf_bits(hMetafile, "mf_Blank"); - EnumMetaFile(0, hMetafile, mf_enum_proc, 0); + dump_mf_bits(hmf_copy, "mf_Blank"); + EnumMetaFile(0, hmf_copy, mf_enum_proc, 0); } ret = DeleteMetaFile(hmf_copy); @@ -1440,6 +1476,7 @@ METAHEADER *mh; hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), MF_GRAPHICS_BITS); + trace("hmf %p\n", hmf); ok(hmf != 0, "SetMetaFileBitsEx error %d\n", GetLastError()); type = GetObjectType(hmf); ok(type == OBJ_METAFILE, "SetMetaFileBitsEx created object with type %d\n", type); @@ -1456,21 +1493,23 @@ /* NULL data crashes XP SP1 */ /*hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), NULL);*/ - /* Now with not zero size */ + /* Now with zero size */ SetLastError(0xdeadbeef); hmf = SetMetaFileBitsEx(0, MF_GRAPHICS_BITS); + trace("hmf %p\n", hmf); ok(!hmf, "SetMetaFileBitsEx should fail\n"); ok(GetLastError() == ERROR_INVALID_DATA || broken(GetLastError() == ERROR_INVALID_PARAMETER), /* Win9x */ "wrong error %d\n", GetLastError()); - /* Now with not even size */ + /* Now with odd size */ SetLastError(0xdeadbeef); hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS) - 1, MF_GRAPHICS_BITS); + trace("hmf %p\n", hmf); ok(!hmf, "SetMetaFileBitsEx should fail\n"); ok(GetLastError() == 0xdeadbeef /* XP SP1 */, "wrong error %d\n", GetLastError()); - /* Now with zeroed out or faked some header fields */ + /* Now with zeroed out header fields */ assert(sizeof(buf) >= sizeof(MF_GRAPHICS_BITS)); memcpy(buf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS)); mh = (METAHEADER *)buf; @@ -1480,6 +1519,7 @@ mh->mtHeaderSize = 0; SetLastError(0xdeadbeef); hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf); + trace("hmf %p\n", hmf); ok(!hmf, "SetMetaFileBitsEx should fail\n"); ok(GetLastError() == ERROR_INVALID_DATA || broken(GetLastError() == ERROR_INVALID_PARAMETER), /* Win9x */ @@ -1491,6 +1531,7 @@ /* corruption of mtSize doesn't lead to a failure */ mh->mtSize *= 2; hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf); + trace("hmf %p\n", hmf); ok(hmf != 0, "SetMetaFileBitsEx error %d\n", GetLastError()); if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0) @@ -1508,6 +1549,7 @@ /* zeroing mtSize doesn't lead to a failure */ mh->mtSize = 0; hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf); + trace("hmf %p\n", hmf); ok(hmf != 0, "SetMetaFileBitsEx error %d\n", GetLastError()); if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0) @@ -1793,7 +1835,9 @@ ok(rgn1->data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn1->data.rdh.dwSize); ok(rgn1->data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn1->data.rdh.iType); ok(rgn1->data.rdh.nCount == 1, "expected 1, got %u\n", rgn1->data.rdh.nCount); - ok(rgn1->data.rdh.nRgnSize == sizeof(RECT), "expected sizeof(RECT), got %u\n", rgn1->data.rdh.nRgnSize); + ok(rgn1->data.rdh.nRgnSize == sizeof(RECT) || + broken(rgn1->data.rdh.nRgnSize == 168), /* NT4 */ + "expected sizeof(RECT), got %u\n", rgn1->data.rdh.nRgnSize); hrgn = CreateRectRgn(0, 0, 0, 0); @@ -1812,7 +1856,7 @@ PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs); ret = GetClipRgn(hdc, hrgn); - ok(ret == 1, "GetClipRgn returned %d, expected 0\n", ret); + ok(ret == 1, "GetClipRgn returned %d, expected 1\n", ret); /* Win9x returns empty clipping region */ if (is_win9x) return 1; @@ -1846,7 +1890,9 @@ ok(rgn2.data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn2.data.rdh.dwSize); ok(rgn2.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn2.data.rdh.iType); ok(rgn2.data.rdh.nCount == 1, "expected 1, got %u\n", rgn2.data.rdh.nCount); - ok(rgn2.data.rdh.nRgnSize == sizeof(RECT), "expected sizeof(RECT), got %u\n", rgn2.data.rdh.nRgnSize); + ok(rgn2.data.rdh.nRgnSize == sizeof(RECT) || + broken(rgn2.data.rdh.nRgnSize == 168), /* NT4 */ + "expected sizeof(RECT), got %u\n", rgn2.data.rdh.nRgnSize); DeleteObject(hrgn); } @@ -1862,6 +1908,7 @@ HENHMETAFILE hemf; HRGN hrgn; INT ret; + RECT rc_res, rc_sclip; SetLastError(0xdeadbeef); hdc = CreateEnhMetaFileA(0, NULL, NULL, NULL); @@ -1900,6 +1947,22 @@ DeleteEnhMetaFile(hemf); ReleaseDC(hwnd, hdc); DestroyWindow(hwnd); + + hdc = CreateEnhMetaFileA(0, NULL, NULL, NULL); + + SetRect(&rc_sclip, 100, 100, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + hrgn = CreateRectRgn(rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom); + SelectClipRgn(hdc, hrgn); + GetClipBox(hdc, &rc_res); + todo_wine ok(EqualRect(&rc_res, &rc_sclip), + "expected rc_res (%d, %d) - (%d, %d), got (%d, %d) - (%d, %d)\n", + rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom, + rc_res.left, rc_res.top, rc_res.right, rc_res.bottom); + + hemf = CloseEnhMetaFile(hdc); + DeleteEnhMetaFile(hemf); + DeleteObject(hrgn); + DeleteDC(hdc); } static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData) @@ -2262,6 +2325,198 @@ HeapFree(GetProcessHeap(), 0, buffer); } +static BOOL near_match(int x, int y) +{ + int epsilon = min(abs(x), abs(y)); + + epsilon = max(epsilon/100, 2); + + if(x < y - epsilon || x > y + epsilon) return FALSE; + return TRUE; +} + +static void getwinmetafilebits(UINT mode, int scale, RECT *rc) +{ + HENHMETAFILE emf; + HDC display_dc, emf_dc; + ENHMETAHEADER *enh_header; + UINT size, emf_size, i; + WORD check = 0; + DWORD rec_num = 0; + METAHEADER *mh = NULL; + METARECORD *rec; + INT horz_res, vert_res, horz_size, vert_size; + + display_dc = GetDC(NULL); + ok(display_dc != NULL, "display_dc is NULL\n"); + + horz_res = GetDeviceCaps(display_dc, HORZRES); + vert_res = GetDeviceCaps(display_dc, VERTRES); + horz_size = GetDeviceCaps(display_dc, HORZSIZE); + vert_size = GetDeviceCaps(display_dc, VERTSIZE); + + emf_dc = CreateEnhMetaFileA(display_dc, NULL, rc, NULL); + ok(emf_dc != NULL, "emf_dc is NULL\n"); + for(i = 0; i < 3000; i++) /* This is enough to take emf_size > 0xffff */ + Rectangle(emf_dc, 0, 0, 1000, 20); + emf = CloseEnhMetaFile(emf_dc); + ok(emf != NULL, "emf is NULL\n"); + + emf_size = GetEnhMetaFileBits(emf, 0, NULL); + enh_header = HeapAlloc(GetProcessHeap(), 0, emf_size); + emf_size = GetEnhMetaFileBits(emf, emf_size, (BYTE*)enh_header); + DeleteEnhMetaFile(emf); + /* multiply szlDevice.cx by scale, when scale != 1 the recording and playback dcs + have different resolutions */ + enh_header->szlDevice.cx *= scale; + emf = SetEnhMetaFileBits(emf_size, (BYTE*)enh_header); + ok(emf != NULL, "emf is NULL\n"); + ok(EqualRect((RECT*)&enh_header->rclFrame, rc), "Frame rectangles differ\n"); + + size = GetWinMetaFileBits(emf, 0, NULL, mode, display_dc); + ok(size || + broken(size == 0), /* some versions of winxp fail for some reason */ + "GetWinMetaFileBits returns 0\n"); + if(!size) goto end; + mh = HeapAlloc(GetProcessHeap(), 0, size); + GetWinMetaFileBits(emf, size, (BYTE*)mh, mode, display_dc); + + for(i = 0; i < size / 2; i++) check += ((WORD*)mh)[i]; + ok(check == 0, "check %04x\n", check); + + rec = (METARECORD*)(mh + 1); + + while(rec->rdSize && rec->rdFunction) + { + const DWORD chunk_size = 0x2000; + DWORD mfcomment_chunks = (emf_size + chunk_size - 1) / chunk_size; + + if(rec_num < mfcomment_chunks) + { + DWORD this_chunk_size = chunk_size; + + if(rec_num == mfcomment_chunks - 1) + this_chunk_size = emf_size - rec_num * chunk_size; + + ok(rec->rdSize == (this_chunk_size + 44) / 2, "%04x: got %04x expected %04x\n", rec_num, rec->rdSize, (this_chunk_size + 44) / 2); + ok(rec->rdFunction == META_ESCAPE, "%04x: got %04x\n", rec_num, rec->rdFunction); + if(rec->rdSize < (this_chunk_size + 44) / 2) break; + ok(rec->rdParm[0] == MFCOMMENT, "got %04x\n", rec->rdParm[0]); + ok(rec->rdParm[1] == this_chunk_size + 34, "got %04x %x\n", rec->rdParm[1], emf_size + 34); + ok(rec->rdParm[2] == 0x4d57, "got %04x\n", rec->rdParm[2]); /* WMFC */ + ok(rec->rdParm[3] == 0x4346, "got %04x\n", rec->rdParm[3]); /* " */ + ok(rec->rdParm[4] == 1, "got %04x\n", rec->rdParm[4]); + ok(rec->rdParm[5] == 0, "got %04x\n", rec->rdParm[5]); + ok(rec->rdParm[6] == 0, "got %04x\n", rec->rdParm[6]); + ok(rec->rdParm[7] == 1, "got %04x\n", rec->rdParm[7]); + /* parm[8] is the checksum, tested above */ + if(rec_num > 0) ok(rec->rdParm[8] == 0, "got %04x\n", rec->rdParm[8]); + ok(rec->rdParm[9] == 0, "got %04x\n", rec->rdParm[9]); + ok(rec->rdParm[10] == 0, "got %04x\n", rec->rdParm[10]); + ok(rec->rdParm[11] == mfcomment_chunks, "got %04x\n", rec->rdParm[11]); /* num chunks */ + ok(rec->rdParm[12] == 0, "got %04x\n", rec->rdParm[12]); + ok(rec->rdParm[13] == this_chunk_size, "got %04x expected %04x\n", rec->rdParm[13], this_chunk_size); + ok(rec->rdParm[14] == 0, "got %04x\n", rec->rdParm[14]); + ok(*(DWORD*)(rec->rdParm + 15) == emf_size - this_chunk_size - rec_num * chunk_size, "got %08x\n", *(DWORD*)(rec->rdParm + 15)); /* DWORD size remaining after current chunk */ + ok(*(DWORD*)(rec->rdParm + 17) == emf_size, "got %08x emf_size %08x\n", *(DWORD*)(rec->rdParm + 17), emf_size); + ok(!memcmp(rec->rdParm + 19, (char*)enh_header + rec_num * chunk_size, this_chunk_size), "bits mismatch\n"); + } + + else if(rec_num == mfcomment_chunks) + { + ok(rec->rdFunction == META_SETMAPMODE, "got %04x\n", rec->rdFunction); + ok(rec->rdParm[0] == mode, "got %04x\n", rec->rdParm[0]); + } + else if(rec_num == mfcomment_chunks + 1) + { + POINT pt; + ok(rec->rdFunction == META_SETWINDOWORG, "got %04x\n", rec->rdFunction); + switch(mode) + { + case MM_TEXT: + case MM_ISOTROPIC: + case MM_ANISOTROPIC: + pt.y = MulDiv(rc->top, vert_res, vert_size * 100) + 1; + pt.x = MulDiv(rc->left, horz_res, horz_size * 100); + break; + case MM_LOMETRIC: + pt.y = MulDiv(-rc->top, 1, 10) + 1; + pt.x = MulDiv( rc->left, 1, 10); + break; + case MM_HIMETRIC: + pt.y = -rc->top + 1; + pt.x = (rc->left >= 0) ? rc->left : rc->left + 1; /* strange but true */ + break; + case MM_LOENGLISH: + pt.y = MulDiv(-rc->top, 10, 254) + 1; + pt.x = MulDiv( rc->left, 10, 254); + break; + case MM_HIENGLISH: + pt.y = MulDiv(-rc->top, 100, 254) + 1; + pt.x = MulDiv( rc->left, 100, 254); + break; + case MM_TWIPS: + pt.y = MulDiv(-rc->top, 72 * 20, 2540) + 1; + pt.x = MulDiv( rc->left, 72 * 20, 2540); + break; + default: + pt.x = pt.y = 0; + } + ok(near_match((short)rec->rdParm[0], pt.y), "got %d expect %d\n", (short)rec->rdParm[0], pt.y); + ok(near_match((short)rec->rdParm[1], pt.x), "got %d expect %d\n", (short)rec->rdParm[1], pt.x); + } + if(rec_num == mfcomment_chunks + 2) + { + ok(rec->rdFunction == META_SETWINDOWEXT, "got %04x\n", rec->rdFunction); + ok(near_match((short)rec->rdParm[0], MulDiv(rc->bottom - rc->top, vert_res, vert_size * 100)), + "got %d\n", (short)rec->rdParm[0]); + ok(near_match((short)rec->rdParm[1], MulDiv(rc->right - rc->left, horz_res, horz_size * 100)), + "got %d\n", (short)rec->rdParm[1]); + } + + rec_num++; + rec = (METARECORD*)((WORD*)rec + rec->rdSize); + } + +end: + HeapFree(GetProcessHeap(), 0, mh); + HeapFree(GetProcessHeap(), 0, enh_header); + DeleteEnhMetaFile(emf); + + ReleaseDC(NULL, display_dc); +} + +static void test_GetWinMetaFileBits(void) +{ + UINT mode; + RECT frames[] = + { + { 1000, 2000, 3000, 6000}, + {-1000, 2000, 3000, 6000}, + { 1000, -2000, 3000, 6000}, + { 1005, 2005, 3000, 6000}, + {-1005, -2005, 3000, 6000}, + {-1005, -2010, 3000, 6000}, + {-1005, 2010, 3000, 6000}, + { 0, 0, 1, 1}, + { -1, -1, 1, 1}, + { 0, 0, 0, 0} + }; + + for(mode = MM_MIN; mode <= MM_MAX; mode++) + { + RECT *rc; + trace("mode %d\n", mode); + + for(rc = frames; rc->right - rc->left > 0; rc++) + { + trace("frame %d,%d - %d,%d\n", rc->left, rc->top, rc->right, rc->bottom); + getwinmetafilebits(mode, 1, rc); + getwinmetafilebits(mode, 2, rc); + } + } +} + static BOOL (WINAPI *pGdiIsMetaPrintDC)(HDC); static BOOL (WINAPI *pGdiIsMetaFileDC)(HDC); static BOOL (WINAPI *pGdiIsPlayMetafileDC)(HDC); @@ -2385,6 +2640,7 @@ /* For metafile conversions */ test_mf_conversions(); test_SetWinMetaFileBits(); + test_GetWinMetaFileBits(); test_gdiis(); test_SetEnhMetaFileBits();
15 years, 2 months
1
0
0
0
[fireball] 43495: [PSDK] - Add MM_MIN / MM_MAX definitions.
by fireball@svn.reactos.org
Author: fireball Date: Thu Oct 15 21:49:10 2009 New Revision: 43495 URL:
http://svn.reactos.org/svn/reactos?rev=43495&view=rev
Log: [PSDK] - Add MM_MIN / MM_MAX definitions. Modified: trunk/reactos/include/psdk/wingdi.h Modified: trunk/reactos/include/psdk/wingdi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wingdi.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/wingdi.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/wingdi.h [iso-8859-1] Thu Oct 15 21:49:10 2009 @@ -822,6 +822,8 @@ #define MM_TEXT 1 #define MM_TWIPS 6 #define MM_MAX_FIXEDSCALE MM_TWIPS +#define MM_MIN MM_TEXT +#define MM_MAX MM_ANISOTROPIC #define ABSOLUTE 1 #define RELATIVE 2 #define PC_EXPLICIT 2
15 years, 2 months
1
0
0
0
[gschneider] 43494: Amendment to r43487: check last character as well
by gschneider@svn.reactos.org
Author: gschneider Date: Thu Oct 15 21:28:11 2009 New Revision: 43494 URL:
http://svn.reactos.org/svn/reactos?rev=43494&view=rev
Log: Amendment to r43487: check last character as well Modified: trunk/reactos/dll/win32/kernel32/mem/isbad.c Modified: trunk/reactos/dll/win32/kernel32/mem/isbad.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/mem/isb…
============================================================================== --- trunk/reactos/dll/win32/kernel32/mem/isbad.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/mem/isbad.c [iso-8859-1] Thu Oct 15 21:28:11 2009 @@ -181,7 +181,7 @@ { Char = *Current; Current++; - } while (Char && (Current != Last)); + } while (Char && (Current != Last + 1)); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -224,7 +224,7 @@ { Char = *Current; Current++; - } while (Char && (Current != Last)); + } while (Char && (Current != Last + 1)); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
15 years, 2 months
1
0
0
0
[tkreuzer] 43493: reenable some spinlock code
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Oct 15 21:24:21 2009 New Revision: 43493 URL:
http://svn.reactos.org/svn/reactos?rev=43493&view=rev
Log: reenable some spinlock code Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/spinlock.c Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/spinlock.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/spinlock.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/spinlock.c [iso-8859-1] Thu Oct 15 21:24:21 2009 @@ -140,7 +140,6 @@ /* PUBLIC FUNCTIONS **********************************************************/ -#ifdef _X86_ /* * @implemented */ @@ -183,7 +182,6 @@ /* Clear it */ *SpinLock = 0; } -#endif /* * @implemented
15 years, 2 months
1
0
0
0
[tkreuzer] 43492: - Add CPUID - rename Ke386InitThreadWithContext to KiInitializeContextThread
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Oct 15 21:23:49 2009 New Revision: 43492 URL:
http://svn.reactos.org/svn/reactos?rev=43492&view=rev
Log: - Add CPUID - rename Ke386InitThreadWithContext to KiInitializeContextThread Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/thrdini.c Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] Thu Oct 15 21:23:49 2009 @@ -54,6 +54,28 @@ static const CHAR CmpCentaurID[] = "CentaurHauls"; static const CHAR CmpRiseID[] = "RiseRiseRise"; +/* SUPPORT ROUTINES FOR MSVC COMPATIBILITY ***********************************/ + +VOID +NTAPI +CPUID(IN ULONG InfoType, + OUT PULONG CpuInfoEax, + OUT PULONG CpuInfoEbx, + OUT PULONG CpuInfoEcx, + OUT PULONG CpuInfoEdx) +{ + ULONG CpuInfo[4]; + + /* Perform the CPUID Operation */ + __cpuid((int*)CpuInfo, InfoType); + + /* Return the results */ + *CpuInfoEax = CpuInfo[0]; + *CpuInfoEbx = CpuInfo[1]; + *CpuInfoEcx = CpuInfo[2]; + *CpuInfoEdx = CpuInfo[3]; +} + /* FUNCTIONS *****************************************************************/ VOID Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/thrdini.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/thrdini.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/thrdini.c [iso-8859-1] Thu Oct 15 21:23:49 2009 @@ -46,13 +46,13 @@ VOID NTAPI -Ke386InitThreadWithContext(IN PKTHREAD Thread, +KiInitializeContextThread(IN PKTHREAD Thread, IN PKSYSTEM_ROUTINE SystemRoutine, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext, IN PCONTEXT ContextPointer) { - FrLdrDbgPrint("Ke386InitThreadWithContext stub\n"); + FrLdrDbgPrint("KiInitializeContextThread stub\n"); #if 0 PFX_SAVE_AREA FxSaveArea; PFXSAVE_FORMAT FxSaveFormat;
15 years, 2 months
1
0
0
0
[tkreuzer] 43491: Add some missing macros
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Oct 15 21:22:09 2009 New Revision: 43491 URL:
http://svn.reactos.org/svn/reactos?rev=43491&view=rev
Log: Add some missing macros Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/mm.h Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] Thu Oct 15 21:22:09 2009 @@ -75,6 +75,31 @@ #define KD_BREAKPOINT_TYPE UCHAR #define KD_BREAKPOINT_SIZE sizeof(UCHAR) #define KD_BREAKPOINT_VALUE 0xCC + +// +// Macros for getting and setting special purpose registers in portable code +// +#define KeGetContextPc(Context) \ + ((Context)->Rip) + +#define KeSetContextPc(Context, ProgramCounter) \ + ((Context)->Rip = (ProgramCounter)) + +#define KeGetTrapFramePc(TrapFrame) \ + ((TrapFrame)->Rip) + +#define KeGetContextReturnRegister(Context) \ + ((Context)->Rax) + +#define KeSetContextReturnRegister(Context, ReturnValue) \ + ((Context)->Rax = (ReturnValue)) + +// +// Returns the Interrupt State from a Trap Frame. +// ON = TRUE, OFF = FALSE +// +#define KeGetTrapFrameInterruptState(TrapFrame) \ + BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK) struct _KPCR; Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/mm.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] Thu Oct 15 21:22:09 2009 @@ -47,4 +47,14 @@ /* Easy accessing PFN in PTE */ #define PFN_FROM_PTE(v) ((v)->u.Hard.PageFrameNumber) +// FIXME, only copied from x86 +#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.Global = 0) +#define MI_MAKE_DIRTY_PAGE(x) ((x)->u.Hard.Dirty = 1) +#define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.CacheDisable = 1) +#define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.WriteThrough = 1) +#define MI_PAGE_WRITE_COMBINED(x) ((x)->u.Hard.WriteThrough = 0) +#define MI_IS_PAGE_WRITEABLE(x) ((x)->u.Hard.Write == 1) +#define MI_IS_PAGE_COPY_ON_WRITE(x)((x)->u.Hard.CopyOnWrite == 1) +#define MI_IS_PAGE_DIRTY(x) ((x)->u.Hard.Dirty == 1) + #endif /* __NTOSKRNL_INCLUDE_INTERNAL_AMD64_MM_H */
15 years, 2 months
1
0
0
0
[tkreuzer] 43490: Add some stuff needed for the ARM3 code
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Oct 15 21:20:57 2009 New Revision: 43490 URL:
http://svn.reactos.org/svn/reactos?rev=43490&view=rev
Log: Add some stuff needed for the ARM3 code Added: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/init.c (with props) Added: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/init.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/init.c (added) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] Thu Oct 15 21:20:57 2009 @@ -1,0 +1,62 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnl/mm/amd64/init.c + * PURPOSE: Memory Manager Initialization for amd64 + * + * PROGRAMMERS: Timo kreuzer (timo.kreuzer(a)reactos.org) + */ + +/* INCLUDES ***************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +#include "../ARM3/miarm.h" + + +/* GLOBALS *****************************************************************/ + +ULONG MmMaximumNonPagedPoolPercent; +ULONG MmSizeOfNonPagedPoolInBytes; +ULONG MmMaximumNonPagedPoolInBytes; + +ULONG64 MmUserProbeAddress; +PVOID MmHighestUserAddress; +PVOID MmSystemRangeStart; + +ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage = -1; + +ULONG MmBootImageSize; + +PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock; + +RTL_BITMAP MiPfnBitMap; + +PVOID MmNonPagedSystemStart; +PVOID MmNonPagedPoolStart; +PVOID MmNonPagedPoolExpansionStart; +PVOID MmNonPagedPoolEnd = MI_NONPAGED_POOL_END; + +PVOID MmPagedPoolStart = MI_PAGED_POOL_START; +PVOID MmPagedPoolEnd; + +ULONG MmSizeOfPagedPoolInBytes = MI_MIN_INIT_PAGED_POOLSIZE; + +PVOID MmSessionBase; +ULONG MmSessionSize; + +PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor; +MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor; + + +NTSTATUS +NTAPI +MmArmInitSystem(IN ULONG Phase, + IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + Propchange: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/init.c ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 2 months
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
...
65
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Results per page:
10
25
50
100
200