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
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
May 2012
----- 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
12 participants
227 discussions
Start a n
N
ew thread
[akhaldi] 56601: [USER32_WINETEST] * Sync to Wine 1.5.4.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu May 17 16:22:34 2012 New Revision: 56601 URL:
http://svn.reactos.org/svn/reactos?rev=56601&view=rev
Log: [USER32_WINETEST] * Sync to Wine 1.5.4. Modified: trunk/rostests/winetests/user32/cursoricon.c trunk/rostests/winetests/user32/dialog.c trunk/rostests/winetests/user32/input.c trunk/rostests/winetests/user32/win.c 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 May 17 16:22:34 2012 @@ -1926,8 +1926,8 @@ check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, 0, 0x00102030, 0x00102030, 0x00102030, __LINE__); check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, 0, 0x00102030, 0x00102030, 0x00102030, __LINE__); - check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_MASK, 0x00FFFFFF, 0x00000000, 0x00000000, __LINE__); - check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_MASK, 0x00FFFFFF, 0x00FFFFFF, 0x00FFFFFF, __LINE__); + check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_MASK, 0x00123456, 0x00000000, 0x00000000, __LINE__); + check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_MASK, 0x00123456, 0x00FFFFFF, 0x00FFFFFF, __LINE__); check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, DI_IMAGE, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__); check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, DI_IMAGE, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__); 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 May 17 16:22:34 2012 @@ -1066,20 +1066,38 @@ static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { - static int received_idok = 0; + static int received_idok; + switch (uiMsg) { case WM_INITDIALOG: - { - MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001}; - IsDialogMessage(hDlg, &msg); - } - ok(received_idok, "WM_COMMAND not received\n"); + { + MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001}; + + received_idok = -1; + IsDialogMessage(hDlg, &msg); + ok(received_idok == 0xdead, "WM_COMMAND/0xdead not received\n"); + + received_idok = -2; + IsDialogMessage(hDlg, &msg); + ok(received_idok == IDOK, "WM_COMMAND/IDOK not received\n"); + EndDialog(hDlg, 0); return TRUE; + } + + case DM_GETDEFID: + if (received_idok == -1) + { + HWND hwnd = GetDlgItem(hDlg, 0xdead); + ok(!hwnd, "dialog item with ID 0xdead should not exist\n"); + SetWindowLong(hDlg, DWLP_MSGRESULT, MAKELRESULT(0xdead, DC_HASDEFID)); + return TRUE; + } + return FALSE; + case WM_COMMAND: - ok(wParam==IDOK, "Expected IDOK\n"); - received_idok = 1; + received_idok = wParam; return TRUE; } return FALSE; 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 May 17 16:22:34 2012 @@ -1603,6 +1603,46 @@ ok(!strcmp(klid, "00000409"), "expected 00000409, got %s\n", klid); } +static void test_key_names(void) +{ + char buffer[40]; + WCHAR bufferW[40]; + int ret, prev; + LONG lparam = 0x1d << 16; + + memset( buffer, 0xcc, sizeof(buffer) ); + ret = GetKeyNameTextA( lparam, buffer, sizeof(buffer) ); + ok( ret > 0, "wrong len %u for '%s'\n", ret, buffer ); + ok( ret == strlen(buffer), "wrong len %u for '%s'\n", ret, buffer ); + + memset( buffer, 0xcc, sizeof(buffer) ); + prev = ret; + ret = GetKeyNameTextA( lparam, buffer, prev ); + ok( ret == prev - 1, "wrong len %u for '%s'\n", ret, buffer ); + ok( ret == strlen(buffer), "wrong len %u for '%s'\n", ret, buffer ); + + memset( buffer, 0xcc, sizeof(buffer) ); + ret = GetKeyNameTextA( lparam, buffer, 0 ); + ok( ret == 0, "wrong len %u for '%s'\n", ret, buffer ); + ok( buffer[0] == 0, "wrong string '%s'\n", buffer ); + + memset( bufferW, 0xcc, sizeof(bufferW) ); + ret = GetKeyNameTextW( lparam, bufferW, sizeof(bufferW)/sizeof(WCHAR) ); + ok( ret > 0, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) ); + ok( ret == lstrlenW(bufferW), "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) ); + + memset( bufferW, 0xcc, sizeof(bufferW) ); + prev = ret; + ret = GetKeyNameTextW( lparam, bufferW, prev ); + ok( ret == prev - 1, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) ); + ok( ret == lstrlenW(bufferW), "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) ); + + memset( bufferW, 0xcc, sizeof(bufferW) ); + ret = GetKeyNameTextW( lparam, bufferW, 0 ); + ok( ret == 0, "wrong len %u for %s\n", ret, wine_dbgstr_w(bufferW) ); + ok( bufferW[0] == 0xcccc, "wrong string %s\n", wine_dbgstr_w(bufferW) ); +} + START_TEST(input) { init_function_pointers(); @@ -1621,6 +1661,7 @@ test_ToUnicode(); test_get_async_key_state(); test_keyboard_layout_name(); + test_key_names(); if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx(); 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 May 17 16:22:34 2012 @@ -6710,7 +6710,7 @@ SetLastError(0xdeadbeef); ret = pFlashWindowEx(&finfo); - todo_wine ok(!ret, "FlashWindowEx succeeded\n"); + todo_wine ok(!ret, "previous window state should not be active\n"); finfo.cbSize = sizeof(FLASHWINFO) - 1; SetLastError(0xdeadbeef); @@ -6750,7 +6750,7 @@ SetLastError(0xdeadbeef); ret = pFlashWindowEx(&finfo); - todo_wine ok(!ret, "FlashWindowEx succeeded\n"); + ok(ret, "previous window state should be active\n"); ok(finfo.cbSize == sizeof(FLASHWINFO), "FlashWindowEx modified cdSize to %x\n", finfo.cbSize); ok(finfo.hwnd == hwnd, "FlashWindowEx modified hwnd to %p\n", finfo.hwnd); @@ -6761,7 +6761,8 @@ finfo.dwFlags = FLASHW_STOP; SetLastError(0xdeadbeef); ret = pFlashWindowEx(&finfo); - ok(ret, "FlashWindowEx failed with %d\n", GetLastError()); +todo_wine + ok(!ret, "previous window state should not be active\n"); DestroyWindow( hwnd ); } @@ -6820,6 +6821,238 @@ DestroyWindow( hwndPopup2 ); DestroyWindow( hwndPopup1 ); DestroyWindow( hwndOwner ); +} + +static LRESULT WINAPI my_httrasparent_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + if (msg == WM_NCHITTEST) return HTTRANSPARENT; + return DefWindowProc(hwnd, msg, wp, lp); +} + +static LRESULT WINAPI my_window_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + return DefWindowProc(hwnd, msg, wp, lp); +} + +static void create_window_tree(HWND parent, HWND *window, int size) +{ + static const DWORD style[] = { 0, WS_VISIBLE, WS_DISABLED, WS_VISIBLE | WS_DISABLED }; + int i, pos; + + memset(window, 0, size * sizeof(window[0])); + + pos = 0; + for (i = 0; i < sizeof(style)/sizeof(style[0]); i++) + { + assert(pos < size); + window[pos] = CreateWindowEx(0, "my_window", NULL, style[i] | WS_CHILD, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_window", NULL, style[i] | WS_CHILD, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + + assert(pos < size); + window[pos] = CreateWindowEx(0, "my_httrasparent", NULL, style[i] | WS_CHILD, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_httrasparent", NULL, style[i] | WS_CHILD, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + + assert(pos < size); + window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(0, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + + assert(pos < size); + window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(0, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + + assert(pos < size); + window[pos] = CreateWindowEx(0, "Static", NULL, style[i] | WS_CHILD, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + assert(pos < size); + window[pos] = CreateWindowEx(WS_EX_TRANSPARENT, "Static", NULL, style[i] | WS_CHILD, + 0, 0, 100, 100, parent, 0, 0, NULL); + ok(window[pos] != 0, "CreateWindowEx failed\n"); + pos++; + } +} + +struct window_attributes +{ + char class_name[128]; + int is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent; +}; + +static void get_window_attributes(HWND hwnd, struct window_attributes *attrs) +{ + DWORD style, ex_style, hittest; + + style = GetWindowLong(hwnd, GWL_STYLE); + ex_style = GetWindowLong(hwnd, GWL_EXSTYLE); + attrs->class_name[0] = 0; + GetClassName(hwnd, attrs->class_name, sizeof(attrs->class_name)); + hittest = SendMessage(hwnd, WM_NCHITTEST, 0, 0); + + attrs->is_visible = (style & WS_VISIBLE) != 0; + attrs->is_enabled = (style & WS_DISABLED) == 0; + attrs->is_groupbox = !lstrcmpi(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX; + attrs->is_httransparent = hittest == HTTRANSPARENT; + attrs->is_extransparent = (ex_style & WS_EX_TRANSPARENT) != 0; +} + +static int window_to_index(HWND hwnd, HWND *window, int size) +{ + int i; + + for (i = 0; i < size; i++) + { + if (!window[i]) break; + if (window[i] == hwnd) return i; + } + return -1; +} + +static void test_child_window_from_point(void) +{ + static const int real_child_pos[] = { 14,15,16,17,18,19,20,21,24,25,26,27,42,43, + 44,45,46,47,48,49,52,53,54,55,51,50,23,22,-1 }; + static const int real_child_pos_nt4[] = { 14,15,16,17,20,21,24,25,26,27,42,43,44,45, + 48,49,52,53,54,55,51,50,47,46,23,22,19,18,-1 }; + WNDCLASSA cls; + HWND hwnd, parent, window[100]; + POINT pt; + int found_invisible, found_disabled, found_groupbox, found_httransparent, found_extransparent; + int ret, i; + + ret = GetClassInfo(0, "Button", &cls); + ok(ret, "GetClassInfo(Button) failed\n"); + cls.lpszClassName = "my_button"; + ret = RegisterClass(&cls); + ok(ret, "RegisterClass(my_button) failed\n"); + + cls.lpszClassName = "my_httrasparent"; + cls.lpfnWndProc = my_httrasparent_proc; + ret = RegisterClass(&cls); + ok(ret, "RegisterClass(my_httrasparent) failed\n"); + + cls.lpszClassName = "my_window"; + cls.lpfnWndProc = my_window_proc; + ret = RegisterClass(&cls); + ok(ret, "RegisterClass(my_window) failed\n"); + + parent = CreateWindowEx(0, "MainWindowClass", NULL, + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, + 0, 0, GetModuleHandle(0), NULL); + ok(parent != 0, "CreateWindowEx failed\n"); + trace("parent %p\n", parent); + + create_window_tree(parent, window, sizeof(window)/sizeof(window[0])); + + found_invisible = 0; + found_disabled = 0; + found_groupbox = 0; + found_httransparent = 0; + found_extransparent = 0; + + /* FIXME: also test WindowFromPoint, ChildWindowFromPoint, ChildWindowFromPointEx */ + for (i = 0; i < sizeof(real_child_pos)/sizeof(real_child_pos[0]); i++) + { + struct window_attributes attrs; + + pt.x = pt.y = 50; + hwnd = RealChildWindowFromPoint(parent, pt); + ok(hwnd != 0, "RealChildWindowFromPoint failed\n"); + ret = window_to_index(hwnd, window, sizeof(window)/sizeof(window[0])); + /* FIXME: remove once Wine is fixed */ + if (ret != real_child_pos[i]) + todo_wine ok(ret == real_child_pos[i] || broken(ret == real_child_pos_nt4[i]), "expected %d, got %d\n", real_child_pos[i], ret); + else + ok(ret == real_child_pos[i] || broken(ret == real_child_pos_nt4[i]), "expected %d, got %d\n", real_child_pos[i], ret); + + get_window_attributes(hwnd, &attrs); + if (!attrs.is_visible) found_invisible++; + if (!attrs.is_enabled) found_disabled++; + if (attrs.is_groupbox) found_groupbox++; + if (attrs.is_httransparent) found_httransparent++; + if (attrs.is_extransparent) found_extransparent++; + + if (ret != real_child_pos[i] && ret != -1) + { + trace("found hwnd %p (%s), is_visible %d, is_enabled %d, is_groupbox %d, is_httransparent %d, is_extransparent %d\n", + hwnd, attrs.class_name, attrs.is_visible, attrs.is_enabled, attrs.is_groupbox, attrs.is_httransparent, attrs.is_extransparent); + get_window_attributes(window[real_child_pos[i]], &attrs); + trace("expected hwnd %p (%s), is_visible %d, is_enabled %d, is_groupbox %d, is_httransparent %d, is_extransparent %d\n", + window[real_child_pos[i]], attrs.class_name, attrs.is_visible, attrs.is_enabled, attrs.is_groupbox, attrs.is_httransparent, attrs.is_extransparent); + } + if (ret == -1) + { + ok(hwnd == parent, "expected %p, got %p\n", parent, hwnd); + break; + } + DestroyWindow(hwnd); + } + + DestroyWindow(parent); + + ok(!found_invisible, "found %d invisible windows\n", found_invisible); + ok(found_disabled, "found %d disabled windows\n", found_disabled); +todo_wine + ok(found_groupbox == 4, "found %d groupbox windows\n", found_groupbox); + ok(found_httransparent, "found %d httransparent windows\n", found_httransparent); +todo_wine + ok(found_extransparent, "found %d extransparent windows\n", found_extransparent); + + ret = UnregisterClass("my_button", cls.hInstance); + ok(ret, "UnregisterClass(my_button) failed\n"); + ret = UnregisterClass("my_httrasparent", cls.hInstance); + ok(ret, "UnregisterClass(my_httrasparent) failed\n"); + ret = UnregisterClass("my_window", cls.hInstance); + ok(ret, "UnregisterClass(my_window) failed\n"); } START_TEST(win) @@ -6872,6 +7105,7 @@ our_pid = GetWindowThreadProcessId(hwndMain, NULL); /* Add the tests below this line */ + test_child_window_from_point(); test_thick_child_size(hwndMain); test_fullscreen(); test_hwnd_message();
12 years, 7 months
1
0
0
0
[akhaldi] 56600: [BROWSEUI_WINETEST] * Sync to Wine 1.5.4.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu May 17 16:00:16 2012 New Revision: 56600 URL:
http://svn.reactos.org/svn/reactos?rev=56600&view=rev
Log: [BROWSEUI_WINETEST] * Sync to Wine 1.5.4. Added: trunk/rostests/winetests/browseui/progressdlg.c (with props) Modified: trunk/rostests/winetests/browseui/CMakeLists.txt trunk/rostests/winetests/browseui/autocomplete.c trunk/rostests/winetests/browseui/testlist.c Modified: trunk/rostests/winetests/browseui/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/browseui/CMakeL…
============================================================================== --- trunk/rostests/winetests/browseui/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/browseui/CMakeLists.txt [iso-8859-1] Thu May 17 16:00:16 2012 @@ -3,7 +3,10 @@ -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) -add_executable(browseui_winetest autocomplete.c testlist.c) +add_executable(browseui_winetest + autocomplete.c + progressdlg.c + testlist.c) target_link_libraries(browseui_winetest wine uuid) set_module_type(browseui_winetest win32cui) add_importlibs(browseui_winetest user32 ole32 msvcrt kernel32 ntdll) Modified: trunk/rostests/winetests/browseui/autocomplete.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/browseui/autoco…
============================================================================== --- trunk/rostests/winetests/browseui/autocomplete.c [iso-8859-1] (original) +++ trunk/rostests/winetests/browseui/autocomplete.c [iso-8859-1] Thu May 17 16:00:16 2012 @@ -17,12 +17,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <assert.h> #include <stdarg.h> #include <initguid.h> #include <windows.h> #include <shlobj.h> +#include <shldisp.h> #include <shlwapi.h> #include <shlguid.h> @@ -127,10 +127,8 @@ return S_OK; } -#if 0 /* IID_IEnumACString not defined yet in wine */ if (!IsEqualGUID(iid, &IID_IEnumACString)) trace("unknown interface queried\n"); -#endif return E_NOINTERFACE; } @@ -239,6 +237,8 @@ const char *strings2[] = {"a", "b", "d"}; WCHAR exp[] = {'A','B','C',0}; IEnumString *obj; + IEnumACString *unk; + HRESULT hr; TestACL *acl1, *acl2; IACList *acl; IObjMgr *mgr; @@ -252,11 +252,16 @@ ok(obj->lpVtbl->QueryInterface(obj, &IID_IACList2, &tmp) == E_NOINTERFACE, "Unexpected interface IACList2 in ACLMulti\n"); stop_on_error(obj->lpVtbl->QueryInterface(obj, &IID_IObjMgr, (LPVOID *)&mgr)); -#if 0 /* IID_IEnumACString not defined yet in wine */ - ole_ok(obj->lpVtbl->QueryInterface(obj, &IID_IEnumACString, &unk)); - if (unk != NULL) - unk->lpVtbl->Release(unk); -#endif + + hr = obj->lpVtbl->QueryInterface(obj, &IID_IEnumACString, (LPVOID*)&unk); + if (hr == E_NOINTERFACE) + todo_wine win_skip("IEnumACString is not supported, skipping tests\n"); + else + { + ok(hr == S_OK, "QueryInterface(IID_IEnumACString) failed: %x\n", hr); + if (unk != NULL) + unk->lpVtbl->Release(unk); + } ok(obj->lpVtbl->Next(obj, 1, (LPOLESTR *)&tmp, &i) == S_FALSE, "Unexpected return from Next\n"); ok(i == 0, "Unexpected fetched value %d\n", i); Added: trunk/rostests/winetests/browseui/progressdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/browseui/progre…
============================================================================== --- trunk/rostests/winetests/browseui/progressdlg.c (added) +++ trunk/rostests/winetests/browseui/progressdlg.c [iso-8859-1] Thu May 17 16:00:16 2012 @@ -1,0 +1,72 @@ +/* Unit tests for progressdialog object + * + * Copyright 2012 Detlef Riekenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include <stdarg.h> +#include <shlobj.h> + +#include "wine/test.h" + + +static void test_IProgressDialog_QueryInterface(void) +{ + IProgressDialog *dlg; + IProgressDialog *dlg2; + IOleWindow *olewindow; + IUnknown *unk; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, &IID_IProgressDialog, (void*)&dlg); + if (FAILED(hr)) { + win_skip("CoCreateInstance for IProgressDialog returned 0x%x\n", hr); + return; + } + + hr = IUnknown_QueryInterface(dlg, &IID_IUnknown, NULL); + ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr); + + hr = IUnknown_QueryInterface(dlg, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + IUnknown_Release(unk); + } + + hr = IUnknown_QueryInterface(dlg, &IID_IOleWindow, (void**)&olewindow); + ok(hr == S_OK, "QueryInterface (IOleWindow) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + hr = IUnknown_QueryInterface(olewindow, &IID_IProgressDialog, (void**)&dlg2); + ok(hr == S_OK, "QueryInterface (IProgressDialog) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + IProgressDialog_Release(dlg2); + } + IOleWindow_Release(olewindow); + } + IProgressDialog_Release(dlg); +} + + +START_TEST(progressdlg) +{ + CoInitialize(NULL); + + test_IProgressDialog_QueryInterface(); + + CoUninitialize(); +} Propchange: trunk/rostests/winetests/browseui/progressdlg.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/winetests/browseui/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/browseui/testli…
============================================================================== --- trunk/rostests/winetests/browseui/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/browseui/testlist.c [iso-8859-1] Thu May 17 16:00:16 2012 @@ -7,9 +7,11 @@ #include "wine/test.h" extern void func_autocomplete(void); +extern void func_progressdlg(void); const struct test winetest_testlist[] = { { "autocomplete", func_autocomplete }, + { "progressdlg", func_progressdlg }, { 0, 0 } };
12 years, 7 months
1
0
0
0
[akhaldi] 56599: [OLE32] * Do not set DllGetClassObject as private. Fixes comcat msvc build.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu May 17 15:39:01 2012 New Revision: 56599 URL:
http://svn.reactos.org/svn/reactos?rev=56599&view=rev
Log: [OLE32] * Do not set DllGetClassObject as private. Fixes comcat msvc build. Modified: trunk/reactos/dll/win32/ole32/ole32.spec Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] Thu May 17 15:39:01 2012 @@ -98,7 +98,7 @@ @ stdcall CreatePointerMoniker(ptr ptr) @ stdcall CreateStreamOnHGlobal(ptr long ptr) @ stdcall DllDebugObjectRPCHook(long ptr) -@ stdcall -private DllGetClassObject (ptr ptr ptr) +@ stdcall DllGetClassObject (ptr ptr ptr) @ stub DllGetClassObjectWOW @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer()
12 years, 7 months
1
0
0
0
[akhaldi] 56598: [OLE32_WINETEST] * Sync to Wine 1.5.4. See issue #7070 for more details.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu May 17 15:17:09 2012 New Revision: 56598 URL:
http://svn.reactos.org/svn/reactos?rev=56598&view=rev
Log: [OLE32_WINETEST] * Sync to Wine 1.5.4. See issue #7070 for more details. Modified: trunk/rostests/winetests/ole32/clipboard.c trunk/rostests/winetests/ole32/compobj.c trunk/rostests/winetests/ole32/dragdrop.c trunk/rostests/winetests/ole32/hglobalstream.c trunk/rostests/winetests/ole32/marshal.c trunk/rostests/winetests/ole32/moniker.c trunk/rostests/winetests/ole32/ole2.c trunk/rostests/winetests/ole32/propvariant.c trunk/rostests/winetests/ole32/stg_prop.c trunk/rostests/winetests/ole32/storage32.c trunk/rostests/winetests/ole32/usrmarshal.c Modified: trunk/rostests/winetests/ole32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/clipboard…
============================================================================== --- trunk/rostests/winetests/ole32/clipboard.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/clipboard.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -19,6 +19,7 @@ */ #define COBJMACROS +#define CONST_VTABLE #define NONAMELESSUNION #include <stdarg.h> @@ -49,7 +50,7 @@ } typedef struct DataObjectImpl { - const IDataObjectVtbl *lpVtbl; + IDataObject IDataObject_iface; LONG ref; FORMATETC *fmtetc; @@ -61,7 +62,7 @@ } DataObjectImpl; typedef struct EnumFormatImpl { - const IEnumFORMATETCVtbl *lpVtbl; + IEnumFORMATETC IEnumFORMATETC_iface; LONG ref; FORMATETC *fmtetc; @@ -79,9 +80,19 @@ static HRESULT EnumFormatImpl_Create(FORMATETC *fmtetc, UINT size, LPENUMFORMATETC *lplpformatetc); +static inline DataObjectImpl *impl_from_IDataObject(IDataObject *iface) +{ + return CONTAINING_RECORD(iface, DataObjectImpl, IDataObject_iface); +} + +static inline EnumFormatImpl *impl_from_IEnumFORMATETC(IEnumFORMATETC *iface) +{ + return CONTAINING_RECORD(iface, EnumFormatImpl, IEnumFORMATETC_iface); +} + static HRESULT WINAPI EnumFormatImpl_QueryInterface(IEnumFORMATETC *iface, REFIID riid, LPVOID *ppvObj) { - EnumFormatImpl *This = (EnumFormatImpl*)iface; + EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IEnumFORMATETC)) { IEnumFORMATETC_AddRef(iface); @@ -94,14 +105,14 @@ static ULONG WINAPI EnumFormatImpl_AddRef(IEnumFORMATETC *iface) { - EnumFormatImpl *This = (EnumFormatImpl*)iface; + EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface); LONG ref = InterlockedIncrement(&This->ref); return ref; } static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface) { - EnumFormatImpl *This = (EnumFormatImpl*)iface; + EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface); ULONG ref = InterlockedDecrement(&This->ref); if(!ref) { @@ -115,7 +126,7 @@ static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched) { - EnumFormatImpl *This = (EnumFormatImpl*)iface; + EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface); ULONG count, i; trace("next: count %d cur %d\n", celt, This->cur); @@ -147,7 +158,7 @@ static HRESULT WINAPI EnumFormatImpl_Reset(IEnumFORMATETC *iface) { - EnumFormatImpl *This = (EnumFormatImpl*)iface; + EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface); This->cur = 0; return S_OK; @@ -174,7 +185,7 @@ EnumFormatImpl *ret; ret = HeapAlloc(GetProcessHeap(), 0, sizeof(EnumFormatImpl)); - ret->lpVtbl = &VT_EnumFormatImpl; + ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl; ret->ref = 1; ret->cur = 0; ret->fmtetc_cnt = fmtetc_cnt; @@ -186,7 +197,7 @@ static HRESULT WINAPI DataObjectImpl_QueryInterface(IDataObject *iface, REFIID riid, LPVOID *ppvObj) { - DataObjectImpl *This = (DataObjectImpl*)iface; + DataObjectImpl *This = impl_from_IDataObject(iface); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDataObject)) { IDataObject_AddRef(iface); @@ -199,14 +210,14 @@ static ULONG WINAPI DataObjectImpl_AddRef(IDataObject* iface) { - DataObjectImpl *This = (DataObjectImpl*)iface; + DataObjectImpl *This = impl_from_IDataObject(iface); ULONG ref = InterlockedIncrement(&This->ref); return ref; } static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface) { - DataObjectImpl *This = (DataObjectImpl*)iface; + DataObjectImpl *This = impl_from_IDataObject(iface); ULONG ref = InterlockedDecrement(&This->ref); if(!ref) @@ -226,7 +237,7 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium) { - DataObjectImpl *This = (DataObjectImpl*)iface; + DataObjectImpl *This = impl_from_IDataObject(iface); UINT i; BOOL foundFormat = FALSE; @@ -282,7 +293,7 @@ static HRESULT WINAPI DataObjectImpl_QueryGetData(IDataObject* iface, FORMATETC *pformatetc) { - DataObjectImpl *This = (DataObjectImpl*)iface; + DataObjectImpl *This = impl_from_IDataObject(iface); UINT i; BOOL foundFormat = FALSE; @@ -320,7 +331,7 @@ static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject* iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc) { - DataObjectImpl *This = (DataObjectImpl*)iface; + DataObjectImpl *This = impl_from_IDataObject(iface); DataObjectImpl_EnumFormatEtc_calls++; @@ -371,7 +382,7 @@ DataObjectImpl *obj; obj = HeapAlloc(GetProcessHeap(), 0, sizeof(DataObjectImpl)); - obj->lpVtbl = &VT_DataObjectImpl; + obj->IDataObject_iface.lpVtbl = &VT_DataObjectImpl; obj->ref = 1; obj->text = GlobalAlloc(GMEM_MOVEABLE, strlen(text) + 1); strcpy(GlobalLock(obj->text), text); @@ -387,9 +398,9 @@ return S_OK; } -const char *cmpl_stm_data = "complex stream"; -const char *cmpl_text_data = "complex text"; -const WCHAR device_name[] = {'m','y','d','e','v',0}; +static const char *cmpl_stm_data = "complex stream"; +static const char *cmpl_text_data = "complex text"; +static const WCHAR device_name[] = {'m','y','d','e','v',0}; static HRESULT DataObjectImpl_CreateComplex(LPDATAOBJECT *lplpdataobj) { @@ -398,7 +409,7 @@ DEVMODEW dm; obj = HeapAlloc(GetProcessHeap(), 0, sizeof(DataObjectImpl)); - obj->lpVtbl = &VT_DataObjectImpl; + obj->IDataObject_iface.lpVtbl = &VT_DataObjectImpl; obj->ref = 1; obj->text = GlobalAlloc(GMEM_MOVEABLE, strlen(cmpl_text_data) + 1); strcpy(GlobalLock(obj->text), cmpl_text_data); @@ -417,18 +428,21 @@ InitFormatEtc(obj->fmtetc[1], cf_stream, TYMED_ISTREAM); InitFormatEtc(obj->fmtetc[2], cf_storage, TYMED_ISTORAGE); InitFormatEtc(obj->fmtetc[3], cf_another, TYMED_ISTORAGE|TYMED_ISTREAM|TYMED_HGLOBAL); - memset(&dm, 0, sizeof(dm)); - dm.dmSize = sizeof(dm); - dm.dmDriverExtra = 0; - lstrcpyW(dm.dmDeviceName, device_name); - obj->fmtetc[3].ptd = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); - obj->fmtetc[3].ptd->tdSize = FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra; - obj->fmtetc[3].ptd->tdDriverNameOffset = FIELD_OFFSET(DVTARGETDEVICE, tdData); - obj->fmtetc[3].ptd->tdDeviceNameOffset = 0; - obj->fmtetc[3].ptd->tdPortNameOffset = 0; - obj->fmtetc[3].ptd->tdExtDevmodeOffset = obj->fmtetc[3].ptd->tdDriverNameOffset + sizeof(device_name); - lstrcpyW((WCHAR*)obj->fmtetc[3].ptd->tdData, device_name); - memcpy(obj->fmtetc[3].ptd->tdData + sizeof(device_name), &dm, dm.dmSize + dm.dmDriverExtra); + if (0) /* Causes crashes on both Wine and Windows */ + { + memset(&dm, 0, sizeof(dm)); + dm.dmSize = sizeof(dm); + dm.dmDriverExtra = 0; + lstrcpyW(dm.dmDeviceName, device_name); + obj->fmtetc[3].ptd = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); + obj->fmtetc[3].ptd->tdSize = FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra; + obj->fmtetc[3].ptd->tdDriverNameOffset = FIELD_OFFSET(DVTARGETDEVICE, tdData); + obj->fmtetc[3].ptd->tdDeviceNameOffset = 0; + obj->fmtetc[3].ptd->tdPortNameOffset = 0; + obj->fmtetc[3].ptd->tdExtDevmodeOffset = obj->fmtetc[3].ptd->tdDriverNameOffset + sizeof(device_name); + lstrcpyW((WCHAR*)obj->fmtetc[3].ptd->tdData, device_name); + memcpy(obj->fmtetc[3].ptd->tdData + sizeof(device_name), &dm, dm.dmSize + dm.dmDriverExtra); + } InitFormatEtc(obj->fmtetc[4], cf_global, TYMED_HGLOBAL); InitFormatEtc(obj->fmtetc[5], cf_another, TYMED_HGLOBAL); @@ -812,15 +826,15 @@ cf_onemore = RegisterClipboardFormatA("one more format"); hr = DataObjectImpl_CreateText("data1", &data1); - ok(SUCCEEDED(hr), "Failed to create data1 object: 0x%08x\n", hr); + ok(hr == S_OK, "Failed to create data1 object: 0x%08x\n", hr); if(FAILED(hr)) return; hr = DataObjectImpl_CreateText("data2", &data2); - ok(SUCCEEDED(hr), "Failed to create data2 object: 0x%08x\n", hr); + ok(hr == S_OK, "Failed to create data2 object: 0x%08x\n", hr); if(FAILED(hr)) return; hr = DataObjectImpl_CreateComplex(&data_cmpl); - ok(SUCCEEDED(hr), "Failed to create complex data object: 0x%08x\n", hr); + ok(hr == S_OK, "Failed to create complex data object: 0x%08x\n", hr); if(FAILED(hr)) return; @@ -1181,31 +1195,32 @@ InitFormatEtc(fmt, cf_another, 0xffff); hr = IDataObject_GetData(get, &fmt, &med); - ok(hr == DV_E_FORMATETC || - broken(hr == S_OK), /* win9x, winme & nt4 */ - "got %08x\n", hr); - if(SUCCEEDED(hr)) ReleaseStgMedium(&med); - - InitFormatEtc(fmt, cf_another, 0xffff); - memset(&dm, 0, sizeof(dm)); - dm.dmSize = sizeof(dm); - dm.dmDriverExtra = 0; - lstrcpyW(dm.dmDeviceName, device_name); - fmt.ptd = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); - fmt.ptd->tdSize = FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra; - fmt.ptd->tdDriverNameOffset = FIELD_OFFSET(DVTARGETDEVICE, tdData); - fmt.ptd->tdDeviceNameOffset = 0; - fmt.ptd->tdPortNameOffset = 0; - fmt.ptd->tdExtDevmodeOffset = fmt.ptd->tdDriverNameOffset + sizeof(device_name); - lstrcpyW((WCHAR*)fmt.ptd->tdData, device_name); - memcpy(fmt.ptd->tdData + sizeof(device_name), &dm, dm.dmSize + dm.dmDriverExtra); - - hr = IDataObject_GetData(get, &fmt, &med); - ok(hr == S_OK, "got %08x\n", hr); - ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed); - if(SUCCEEDED(hr)) ReleaseStgMedium(&med); - - HeapFree(GetProcessHeap(), 0, fmt.ptd); + ok(hr == S_OK, "got %08x\n", hr); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); + + if (0) /* Causes crashes on both Wine and Windows */ + { + InitFormatEtc(fmt, cf_another, 0xffff); + memset(&dm, 0, sizeof(dm)); + dm.dmSize = sizeof(dm); + dm.dmDriverExtra = 0; + lstrcpyW(dm.dmDeviceName, device_name); + fmt.ptd = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); + fmt.ptd->tdSize = FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra; + fmt.ptd->tdDriverNameOffset = FIELD_OFFSET(DVTARGETDEVICE, tdData); + fmt.ptd->tdDeviceNameOffset = 0; + fmt.ptd->tdPortNameOffset = 0; + fmt.ptd->tdExtDevmodeOffset = fmt.ptd->tdDriverNameOffset + sizeof(device_name); + lstrcpyW((WCHAR*)fmt.ptd->tdData, device_name); + memcpy(fmt.ptd->tdData + sizeof(device_name), &dm, dm.dmSize + dm.dmDriverExtra); + + hr = IDataObject_GetData(get, &fmt, &med); + ok(hr == S_OK, "got %08x\n", hr); + ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); + + HeapFree(GetProcessHeap(), 0, fmt.ptd); + } IDataObject_Release(get); Modified: trunk/rostests/winetests/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/compobj.c…
============================================================================== --- trunk/rostests/winetests/ole32/compobj.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/compobj.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -38,11 +38,11 @@ extern const IID GUID_NULL; /* functions that are not present on all versions of Windows */ -HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit); -HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv); -HRESULT (WINAPI * pCoSwitchCallContext)(IUnknown *pObject, IUnknown **ppOldObject); -HRESULT (WINAPI * pCoGetTreatAsClass)(REFCLSID clsidOld, LPCLSID pClsidNew); -HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token); +static HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit); +static HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv); +static HRESULT (WINAPI * pCoSwitchCallContext)(IUnknown *pObject, IUnknown **ppOldObject); +static HRESULT (WINAPI * pCoGetTreatAsClass)(REFCLSID clsidOld, LPCLSID pClsidNew); +static HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token); #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) #define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks) @@ -117,7 +117,7 @@ static HRESULT WINAPI Test_IClassFactory_CreateInstance( LPCLASSFACTORY iface, - LPUNKNOWN pUnkOuter, + IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObj) { @@ -192,6 +192,9 @@ static void test_CLSIDFromString(void) { CLSID clsid; + WCHAR wszCLSID_Broken[50]; + UINT i; + HRESULT hr = CLSIDFromString(wszCLSID_StdFont, &clsid); ok_ole_success(hr, "CLSIDFromString"); ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); @@ -199,6 +202,60 @@ hr = CLSIDFromString(NULL, &clsid); ok_ole_success(hr, "CLSIDFromString"); ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n"); + + lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont); + for(i = lstrlenW(wszCLSID_StdFont); i < 49; i++) + wszCLSID_Broken[i] = 'A'; + wszCLSID_Broken[i] = '\0'; + + memset(&clsid, 0, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); + + wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A'; + memset(&clsid, 0, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); + + wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0'; + memset(&clsid, 0, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); + + wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0'; + memset(&clsid, 0, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); + + memset(&clsid, 0xcc, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken+1, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n"); + + wszCLSID_Broken[9] = '*'; + memset(&clsid, 0xcc, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %08x\n", clsid.Data1); + ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2); + + wszCLSID_Broken[3] = '*'; + memset(&clsid, 0xcc, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1); + ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2); + + wszCLSID_Broken[3] = '\0'; + memset(&clsid, 0xcc, sizeof(CLSID)); + hr = CLSIDFromString(wszCLSID_Broken, &clsid); + ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr); + ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1); + ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2); } static void test_StringFromGUID2(void) @@ -515,7 +572,7 @@ } static HRESULT WINAPI Test_IUnknown_QueryInterface( - LPUNKNOWN iface, + IUnknown *iface, REFIID riid, LPVOID *ppvObj) { @@ -533,12 +590,12 @@ return E_NOINTERFACE; } -static ULONG WINAPI Test_IUnknown_AddRef(LPUNKNOWN iface) +static ULONG WINAPI Test_IUnknown_AddRef(IUnknown *iface) { return 2; /* non-heap-based object */ } -static ULONG WINAPI Test_IUnknown_Release(LPUNKNOWN iface) +static ULONG WINAPI Test_IUnknown_Release(IUnknown *iface) { return 1; /* non-heap-based object */ } @@ -872,7 +929,7 @@ /* crashes with at least win9x DCOM! */ if (0) - hr = CoRevokeClassObject(cookie); + CoRevokeClassObject(cookie); CoUninitialize(); } @@ -1216,9 +1273,14 @@ } typedef struct { - const IUnknownVtbl *lpVtbl; + IUnknown IUnknown_iface; LONG refs; } Test_CallContext; + +static inline Test_CallContext *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface); +} static HRESULT WINAPI Test_CallContext_QueryInterface( IUnknown *iface, @@ -1240,13 +1302,13 @@ static ULONG WINAPI Test_CallContext_AddRef(IUnknown *iface) { - Test_CallContext *This = (Test_CallContext*)iface; + Test_CallContext *This = impl_from_IUnknown(iface); return InterlockedIncrement(&This->refs); } static ULONG WINAPI Test_CallContext_Release(IUnknown *iface) { - Test_CallContext *This = (Test_CallContext*)iface; + Test_CallContext *This = impl_from_IUnknown(iface); ULONG refs = InterlockedDecrement(&This->refs); if (!refs) HeapFree(GetProcessHeap(), 0, This); @@ -1265,7 +1327,7 @@ HRESULT hr; ULONG refs; IUnknown *pUnk; - IUnknown *test_object; + Test_CallContext *test_object; if (!pCoSwitchCallContext) { @@ -1276,41 +1338,43 @@ CoInitialize(NULL); test_object = HeapAlloc(GetProcessHeap(), 0, sizeof(Test_CallContext)); - ((Test_CallContext*)test_object)->lpVtbl = &TestCallContext_Vtbl; - ((Test_CallContext*)test_object)->refs = 1; + test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl; + test_object->refs = 1; hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk); ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr); pUnk = (IUnknown*)0xdeadbeef; - hr = pCoSwitchCallContext(test_object, &pUnk); + hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk); ok_ole_success(hr, "CoSwitchCallContext"); ok(pUnk == NULL, "expected NULL, got %p\n", pUnk); - refs = IUnknown_AddRef(test_object); + refs = IUnknown_AddRef(&test_object->IUnknown_iface); ok(refs == 2, "Expected refcount 2, got %d\n", refs); - IUnknown_Release(test_object); + IUnknown_Release(&test_object->IUnknown_iface); pUnk = (IUnknown*)0xdeadbeef; hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk); ok_ole_success(hr, "CoGetCallContext"); - ok(pUnk == test_object, "expected %p, got %p\n", test_object, pUnk); - refs = IUnknown_AddRef(test_object); + ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n", + &test_object->IUnknown_iface, pUnk); + refs = IUnknown_AddRef(&test_object->IUnknown_iface); ok(refs == 3, "Expected refcount 3, got %d\n", refs); - IUnknown_Release(test_object); + IUnknown_Release(&test_object->IUnknown_iface); IUnknown_Release(pUnk); pUnk = (IUnknown*)0xdeadbeef; hr = pCoSwitchCallContext(NULL, &pUnk); ok_ole_success(hr, "CoSwitchCallContext"); - ok(pUnk == test_object, "expected %p, got %p\n", test_object, pUnk); - refs = IUnknown_AddRef(test_object); + ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n", + &test_object->IUnknown_iface, pUnk); + refs = IUnknown_AddRef(&test_object->IUnknown_iface); ok(refs == 2, "Expected refcount 2, got %d\n", refs); - IUnknown_Release(test_object); + IUnknown_Release(&test_object->IUnknown_iface); hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk); ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr); - IUnknown_Release(test_object); + IUnknown_Release(&test_object->IUnknown_iface); CoUninitialize(); } Modified: trunk/rostests/winetests/ole32/dragdrop.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/dragdrop.…
============================================================================== --- trunk/rostests/winetests/ole32/dragdrop.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/dragdrop.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -39,7 +39,7 @@ static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget* iface, REFIID riid, void** ppvObject) { - trace("DropTarget_QueryInterface\n"); + ok(0, "DropTarget_QueryInterface() shouldn't be called\n"); if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDropTarget)) { Modified: trunk/rostests/winetests/ole32/hglobalstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/hglobalst…
============================================================================== --- trunk/rostests/winetests/ole32/hglobalstream.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/hglobalstream.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -175,7 +175,7 @@ ull.u.HighPart = 0xCAFECAFE; ull.u.LowPart = 0xCAFECAFE; ll.u.HighPart = 0; - ll.u.LowPart = -sizeof(data); + ll.u.LowPart = -(DWORD)sizeof(data); hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull); ok_ole_success(hr, "IStream_Seek"); ok(ull.u.LowPart == 0, "LowPart set to %d\n", ull.u.LowPart); @@ -190,7 +190,7 @@ ull.u.HighPart = 0xCAFECAFE; ull.u.LowPart = 0xCAFECAFE; ll.u.HighPart = 0; - ll.u.LowPart = -sizeof(data)-1; + ll.u.LowPart = -(DWORD)sizeof(data)-1; hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull); ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr); ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart); @@ -421,6 +421,8 @@ static const LARGE_INTEGER llZero; char buffer[15]; + ok_ole_success(hr, "CreateStreamOnHGlobal"); + expected_method_list = methods_copyto; hr = IStream_Write(pStream, szHello, sizeof(szHello), &written); Modified: trunk/rostests/winetests/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/marshal.c…
============================================================================== --- trunk/rostests/winetests/ole32/marshal.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/marshal.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -36,9 +36,10 @@ #include "wine/test.h" DEFINE_GUID(CLSID_StdGlobalInterfaceTable,0x00000323,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); +DEFINE_GUID(CLSID_ManualResetEvent, 0x0000032c,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); /* functions that are not present on all versions of Windows */ -HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit); +static HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit); /* helper macros to make tests a bit leaner */ #define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks) @@ -1437,14 +1438,8 @@ /* Win9x returns E_NOINTERFACE, whilst NT returns RPC_E_WRONG_THREAD */ trace("call to proxy's QueryInterface from wrong apartment returned 0x%08x\n", hr); - /* this statement causes Win9x DCOM to crash during CoUninitialize of - * other apartment, so don't test this on Win9x (signified by NT-only - * export of CoRegisterSurrogateEx) */ - if (GetProcAddress(GetModuleHandle("ole32"), "CoRegisterSurrogateEx")) - /* now be really bad and release the proxy from the wrong apartment */ - IUnknown_Release(cf); - else - skip("skipping test for releasing proxy from wrong apartment that will succeed, but cause a crash during CoUninitialize\n"); + /* now be really bad and release the proxy from the wrong apartment */ + IUnknown_Release(cf); CoUninitialize(); @@ -1703,9 +1698,14 @@ typedef struct { - const IUnknownVtbl *lpVtbl; + IUnknown IUnknown_iface; ULONG refs; } HeapUnknown; + +static inline HeapUnknown *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, HeapUnknown, IUnknown_iface); +} static HRESULT WINAPI HeapUnknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) { @@ -1721,13 +1721,13 @@ static ULONG WINAPI HeapUnknown_AddRef(IUnknown *iface) { - HeapUnknown *This = (HeapUnknown *)iface; + HeapUnknown *This = impl_from_IUnknown(iface); return InterlockedIncrement((LONG*)&This->refs); } static ULONG WINAPI HeapUnknown_Release(IUnknown *iface) { - HeapUnknown *This = (HeapUnknown *)iface; + HeapUnknown *This = impl_from_IUnknown(iface); ULONG refs = InterlockedDecrement((LONG*)&This->refs); if (!refs) HeapFree(GetProcessHeap(), 0, This); return refs; @@ -1750,7 +1750,7 @@ CLSID clsid; HeapUnknown *pUnkOuter = HeapAlloc(GetProcessHeap(), 0, sizeof(*pUnkOuter)); - pUnkOuter->lpVtbl = &HeapUnknown_Vtbl; + pUnkOuter->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl; pUnkOuter->refs = 1; hr = CoGetPSClsid(riid, &clsid); @@ -1759,21 +1759,17 @@ hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (LPVOID*)&psfb); ok_ole_success(hr, CoGetClassObject); - hr = IPSFactoryBuffer_CreateProxy(psfb, (IUnknown*)pUnkOuter, riid, &proxy, &lpvtbl); + hr = IPSFactoryBuffer_CreateProxy(psfb, &pUnkOuter->IUnknown_iface, riid, &proxy, &lpvtbl); ok_ole_success(hr, IPSFactoryBuffer_CreateProxy); ok(lpvtbl != NULL, "IPSFactoryBuffer_CreateProxy succeeded, but returned a NULL vtable!\n"); /* release our reference to the outer unknown object - the PS factory * buffer will have AddRef's it in the CreateProxy call */ - refs = IUnknown_Release((IUnknown *)pUnkOuter); + refs = IUnknown_Release(&pUnkOuter->IUnknown_iface); ok(refs == 1, "Ref count of outer unknown should have been 1 instead of %d\n", refs); - refs = IPSFactoryBuffer_Release(psfb); - if (0) - { - /* not reliable on native. maybe it leaks references! */ - ok(refs == 0, "Ref-count leak of %d on IPSFactoryBuffer\n", refs); - } + /* Not checking return, unreliable on native. Maybe it leaks references? */ + IPSFactoryBuffer_Release(psfb); refs = IUnknown_Release((IUnknown *)lpvtbl); ok(refs == 0, "Ref-count leak of %d on IRpcProxyBuffer\n", refs); @@ -1801,12 +1797,8 @@ hr = IPSFactoryBuffer_CreateStub(psfb, riid, (IUnknown*)&Test_ClassFactory, &stub); ok_ole_success(hr, IPSFactoryBuffer_CreateStub); - refs = IPSFactoryBuffer_Release(psfb); - if (0) - { - /* not reliable on native. maybe it leaks references */ - ok(refs == 0, "Ref-count leak of %d on IPSFactoryBuffer\n", refs); - } + /* Not checking return, unreliable on native. Maybe it leaks references? */ + IPSFactoryBuffer_Release(psfb); ok_more_than_one_lock(); @@ -1845,7 +1837,7 @@ Test_IClassFactory_LockServer }; -IClassFactory TestRE_ClassFactory = { &TestREClassFactory_Vtbl }; +static IClassFactory TestRE_ClassFactory = { &TestREClassFactory_Vtbl }; static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -1878,6 +1870,7 @@ /* note the use of the magic IID_IWineTest value to tell remote thread * to try to send a message back to us */ hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IWineTest, (void **)&object); + ok(hr == S_FALSE, "expected S_FALSE, got %d\n", hr); IClassFactory_Release(proxy); @@ -1917,6 +1910,7 @@ * WM_QUIT message doesn't stop the call from succeeding */ PostMessage(hwnd, WM_QUIT, 0, 0); hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IUnknown, (void **)&object); + ok(hr == S_FALSE, "IClassFactory_CreateInstance returned 0x%08x, expected S_FALSE\n", hr); IClassFactory_Release(proxy); @@ -2011,7 +2005,7 @@ Test_IClassFactory_LockServer }; -IClassFactory TestMsg_ClassFactory = { &TestMsgClassFactory_Vtbl }; +static IClassFactory TestMsg_ClassFactory = { &TestMsgClassFactory_Vtbl }; static void test_call_from_message(void) { @@ -2274,7 +2268,7 @@ IMarshal_Release(pFTMarshal); } -static void reg_unreg_wine_test_class(BOOL Register) +static HRESULT reg_unreg_wine_test_class(BOOL Register) { HRESULT hr; char buffer[256]; @@ -2292,9 +2286,16 @@ if (Register) { error = RegCreateKeyEx(HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &dwDisposition); + if (error == ERROR_ACCESS_DENIED) + { + skip("Not authorized to modify the Classes key\n"); + return E_FAIL; + } ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error); + if (error != ERROR_SUCCESS) hr = E_FAIL; error = RegSetValueEx(hkey, NULL, 0, REG_SZ, (const unsigned char *)"\"ole32.dll\"", strlen("\"ole32.dll\"") + 1); ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error); + if (error != ERROR_SUCCESS) hr = E_FAIL; RegCloseKey(hkey); } else @@ -2303,6 +2304,7 @@ *strrchr(buffer, '\\') = '\0'; RegDeleteKey(HKEY_CLASSES_ROOT, buffer); } + return hr; } static void test_inproc_handler(void) @@ -2311,7 +2313,8 @@ IUnknown *pObject; IUnknown *pObject2; - reg_unreg_wine_test_class(TRUE); + if (FAILED(reg_unreg_wine_test_class(TRUE))) + return; hr = CoCreateInstance(&CLSID_WineTest, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pObject); ok_ole_success(hr, "CoCreateInstance"); @@ -2392,7 +2395,8 @@ HANDLE thread; static const LARGE_INTEGER ullZero; - reg_unreg_wine_test_class(TRUE); + if (FAILED(reg_unreg_wine_test_class(TRUE))) + return; cLocks = 0; hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream); @@ -2645,6 +2649,7 @@ { char **argv; char cmdline[MAX_PATH]; + BOOL ret; PROCESS_INFORMATION pi; STARTUPINFO si = { 0 }; si.cb = sizeof(si); @@ -2653,8 +2658,8 @@ pi.hProcess = NULL; winetest_get_mainargs( &argv ); sprintf(cmdline, "%s %s %s", argv[0], argv[1], arg); - ok(CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, - &si, &pi) != 0, "CreateProcess failed with error: %u\n", GetLastError()); + ret = CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + ok(ret, "CreateProcess failed with error: %u\n", GetLastError()); if (pi.hThread) CloseHandle(pi.hThread); return pi.hProcess; } @@ -2841,6 +2846,68 @@ ok_no_locks(); IGlobalInterfaceTable_Release(git); +} + +static void test_manualresetevent(void) +{ + ISynchronize *psync1, *psync2; + IUnknown *punk; + LONG ref; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(!!punk, "Got NULL.\n"); + IUnknown_Release(punk); + + hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_ISynchronize, (void**)&psync1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(!!psync1, "Got NULL.\n"); + + hr = ISynchronize_Wait(psync1, 0, 5); + ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr); + + hr = ISynchronize_Reset(psync1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Signal(psync1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Wait(psync1, 0, 5); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Wait(psync1, 0, 5); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Reset(psync1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Wait(psync1, 0, 5); + ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr); + + hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_ISynchronize, (void**)&psync2); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(!!psync2, "Got NULL.\n"); + ok(psync1 != psync2, "psync1 == psync2.\n"); + hr = ISynchronize_Wait(psync2, 0, 5); + ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr); + + hr = ISynchronize_Reset(psync1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Reset(psync2); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Signal(psync1); + ok(hr == S_OK, "Got 0x%08x\n", hr); + hr = ISynchronize_Wait(psync2, 0, 5); + ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr); + + ref = ISynchronize_AddRef(psync1); + ok(ref == 2, "Got ref: %d\n", ref); + ref = ISynchronize_AddRef(psync1); + ok(ref == 3, "Got ref: %d\n", ref); + ref = ISynchronize_Release(psync1); + ok(ref == 2, "Got nonzero ref: %d\n", ref); + ref = ISynchronize_Release(psync2); + ok(!ref, "Got nonzero ref: %d\n", ref); + ref = ISynchronize_Release(psync1); + ok(ref == 1, "Got nonzero ref: %d\n", ref); + ref = ISynchronize_Release(psync1); + ok(!ref, "Got nonzero ref: %d\n", ref); } static const char *debugstr_iid(REFIID riid) @@ -3060,7 +3127,12 @@ int argc; char **argv; - if (!(pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx"))) goto no_test; + if (!GetProcAddress(hOle32, "CoRegisterSurrogateEx")) { + win_skip("skipping test on win9x\n"); + return; + } + + pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx"); argc = winetest_get_mainargs( &argv ); if (argc > 2 && (!strcmp(argv[2], "-Embedding"))) @@ -3122,14 +3194,10 @@ test_local_server(); test_globalinterfacetable(); + test_manualresetevent(); /* must be last test as channel hooks can't be unregistered */ test_channel_hook(); CoUninitialize(); - return; - -no_test: - trace("You need DCOM95 installed to run this test\n"); - return; -} +} Modified: trunk/rostests/winetests/ole32/moniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/moniker.c…
============================================================================== --- trunk/rostests/winetests/ole32/moniker.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/moniker.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -28,6 +28,7 @@ #include "windef.h" #include "winbase.h" #include "objbase.h" +#include "ocidl.h" #include "initguid.h" #include "comcat.h" #include "olectl.h" @@ -156,9 +157,14 @@ typedef struct { - const IUnknownVtbl *lpVtbl; + IUnknown IUnknown_iface; ULONG refs; } HeapUnknown; + +static inline HeapUnknown *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, HeapUnknown, IUnknown_iface); +} static HRESULT WINAPI HeapUnknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) { @@ -174,13 +180,13 @@ static ULONG WINAPI HeapUnknown_AddRef(IUnknown *iface) { - HeapUnknown *This = (HeapUnknown *)iface; + HeapUnknown *This = impl_from_IUnknown(iface); return InterlockedIncrement((LONG*)&This->refs); } static ULONG WINAPI HeapUnknown_Release(IUnknown *iface) { - HeapUnknown *This = (HeapUnknown *)iface; + HeapUnknown *This = impl_from_IUnknown(iface); ULONG refs = InterlockedDecrement((LONG*)&This->refs); if (!refs) HeapFree(GetProcessHeap(), 0, This); return refs; @@ -1007,7 +1013,6 @@ hr = IEnumMoniker_QueryInterface(spEM1, &IID_IUnknown, (void*) &lpEM1); /* Register a couple of Monikers and check is ok */ ok(hr==0, "IEnumMoniker_QueryInterface hr %08x %p\n", hr, lpEM1); - hr = MK_E_NOOBJECT; matchCnt = count_moniker_matches(pbc, spEM1); trace("Number of matches is %i\n", matchCnt); @@ -1271,6 +1276,7 @@ IROTData_Release(rotdata); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok_ole_success(hr, CreateStreamOnHGlobal); /* Saving */ @@ -1451,6 +1457,7 @@ ok_ole_success(hr, CreateFileMoniker); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok_ole_success(hr, CreateStreamOnHGlobal); /* Marshal */ hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker1, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL); @@ -1774,9 +1781,9 @@ /* Hashing */ hr = IMoniker_Hash(moniker, &hash); ok_ole_success(hr, IMoniker_Hash); - ok(hash == (DWORD)&Test_ClassFactory, + ok(hash == PtrToUlong(&Test_ClassFactory), "Hash value should have been 0x%08x, instead of 0x%08x\n", - (DWORD)&Test_ClassFactory, hash); + PtrToUlong(&Test_ClassFactory), hash); /* IsSystemMoniker test */ hr = IMoniker_IsSystemMoniker(moniker, &moniker_type); @@ -1880,9 +1887,9 @@ ok(hr == E_INVALIDARG, "IBindCtx_RegisterObjectParam should have returned E_INVALIDARG instead of 0x%08x\n", hr); unknown = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown)); - unknown->lpVtbl = &HeapUnknown_Vtbl; + unknown->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl; unknown->refs = 1; - hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, (IUnknown *)&unknown->lpVtbl); + hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, &unknown->IUnknown_iface); ok_ole_success(hr, "IBindCtx_RegisterObjectParam"); hr = IBindCtx_GetObjectParam(pBindCtx, (WCHAR *)wszParamName, ¶m_obj); @@ -1907,23 +1914,23 @@ ok(hr == E_INVALIDARG, "IBindCtx_RevokeObjectBound(NULL) should have return E_INVALIDARG instead of 0x%08x\n", hr); unknown2 = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown)); - unknown2->lpVtbl = &HeapUnknown_Vtbl; + unknown2->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl; unknown2->refs = 1; - hr = IBindCtx_RegisterObjectBound(pBindCtx, (IUnknown *)&unknown2->lpVtbl); + hr = IBindCtx_RegisterObjectBound(pBindCtx, &unknown2->IUnknown_iface); ok_ole_success(hr, "IBindCtx_RegisterObjectBound"); - hr = IBindCtx_RevokeObjectBound(pBindCtx, (IUnknown *)&unknown2->lpVtbl); + hr = IBindCtx_RevokeObjectBound(pBindCtx, &unknown2->IUnknown_iface); ok_ole_success(hr, "IBindCtx_RevokeObjectBound"); - hr = IBindCtx_RevokeObjectBound(pBindCtx, (IUnknown *)&unknown2->lpVtbl); + hr = IBindCtx_RevokeObjectBound(pBindCtx, &unknown2->IUnknown_iface); ok(hr == MK_E_NOTBOUND, "IBindCtx_RevokeObjectBound with not bound object should have returned MK_E_NOTBOUND instead of 0x%08x\n", hr); IBindCtx_Release(pBindCtx); - refs = IUnknown_Release((IUnknown *)&unknown->lpVtbl); + refs = IUnknown_Release(&unknown->IUnknown_iface); ok(!refs, "object param should have been destroyed, instead of having %d refs\n", refs); - refs = IUnknown_Release((IUnknown *)&unknown2->lpVtbl); + refs = IUnknown_Release(&unknown2->IUnknown_iface); ok(!refs, "bound object should have been destroyed, instead of having %d refs\n", refs); } @@ -1998,6 +2005,11 @@ START_TEST(moniker) { + if (!GetProcAddress(GetModuleHandleA("ole32.dll"), "CoRegisterSurrogateEx")) { + win_skip("skipping test on win9x\n"); + return; + } + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); test_ROT(); Modified: trunk/rostests/winetests/ole32/ole2.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/ole2.c?re…
============================================================================== --- trunk/rostests/winetests/ole32/ole2.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/ole2.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -20,9 +20,10 @@ #define COBJMACROS #define CONST_VTABLE +#define WIN32_LEAN_AND_MEAN #include <stdarg.h> -#define NOCRYPT + #include "windef.h" #include "winbase.h" #include "objbase.h" @@ -44,7 +45,16 @@ {0xbc, 0x13, 0x51, 0x6e, 0x92, 0x39, 0xac, 0xe0} }; +static const IID IID_WineTest = +{ /* 9474ba1a-258b-490b-bc13-516e9239ace1 */ + 0x9474ba1a, + 0x258b, + 0x490b, + {0xbc, 0x13, 0x51, 0x6e, 0x92, 0x39, 0xac, 0xe1} +}; + #define TEST_OPTIONAL 0x1 +#define TEST_TODO 0x2 struct expected_method { @@ -53,21 +63,38 @@ }; static const struct expected_method *expected_method_list; - -BOOL g_showRunnable = TRUE; -BOOL g_isRunning = TRUE; +static FORMATETC *g_expected_fetc = NULL; + +static BOOL g_showRunnable = TRUE; +static BOOL g_isRunning = TRUE; +static BOOL g_failGetMiscStatus; +static HRESULT g_QIFailsWith; + +static UINT cf_test_1, cf_test_2, cf_test_3; #define CHECK_EXPECTED_METHOD(method_name) \ do { \ trace("%s\n", method_name); \ ok(expected_method_list->method != NULL, "Extra method %s called\n", method_name); \ + if (!strcmp(expected_method_list->method, "WINE_EXTRA")) \ + { \ + todo_wine ok(0, "Too many method calls.\n"); \ + break; \ + } \ if (expected_method_list->method) \ { \ while (expected_method_list->flags & TEST_OPTIONAL && \ strcmp(expected_method_list->method, method_name) != 0) \ expected_method_list++; \ - ok(!strcmp(expected_method_list->method, method_name), "Expected %s to be called instead of %s\n", \ - expected_method_list->method, method_name); \ + if (expected_method_list->flags & TEST_TODO) \ + todo_wine \ + ok(!strcmp(expected_method_list->method, method_name), \ + "Expected %s to be called instead of %s\n", \ + expected_method_list->method, method_name); \ + else \ + ok(!strcmp(expected_method_list->method, method_name), \ + "Expected %s to be called instead of %s\n", \ + expected_method_list->method, method_name); \ expected_method_list++; \ } \ } while(0) @@ -93,6 +120,8 @@ *ppv = cache; else if (IsEqualIID(riid, &IID_IRunnableObject) && g_showRunnable) *ppv = runnable; + else if (IsEqualIID(riid, &IID_WineTest)) + return g_QIFailsWith; if(*ppv) { IUnknown_AddRef((IUnknown*)*ppv); @@ -327,8 +356,16 @@ ) { CHECK_EXPECTED_METHOD("OleObject_GetMiscStatus"); - *pdwStatus = DVASPECT_CONTENT; - return S_OK; + if(!g_failGetMiscStatus) + { + *pdwStatus = OLEMISC_RECOMPOSEONRESIZE; + return S_OK; + } + else + { + *pdwStatus = 0x1234; + return E_FAIL; + } } static HRESULT WINAPI OleObject_SetColorScheme @@ -496,6 +533,22 @@ ) { CHECK_EXPECTED_METHOD("OleObjectCache_Cache"); + if (g_expected_fetc) { + ok(pformatetc != NULL, "pformatetc should not be NULL\n"); + if (pformatetc) { + ok(pformatetc->cfFormat == g_expected_fetc->cfFormat, + "cfFormat: %x\n", pformatetc->cfFormat); + ok((pformatetc->ptd != NULL) == (g_expected_fetc->ptd != NULL), + "ptd: %p\n", pformatetc->ptd); + ok(pformatetc->dwAspect == g_expected_fetc->dwAspect, + "dwAspect: %x\n", pformatetc->dwAspect); + ok(pformatetc->lindex == g_expected_fetc->lindex, + "lindex: %x\n", pformatetc->lindex); + ok(pformatetc->tymed == g_expected_fetc->tymed, + "tymed: %x\n", pformatetc->tymed); + } + } else + ok(pformatetc == NULL, "pformatetc should be NULL\n"); return S_OK; } @@ -796,6 +849,12 @@ { NULL, 0 } }; + g_expected_fetc = &formatetc; + formatetc.cfFormat = 0; + formatetc.ptd = NULL; + formatetc.dwAspect = DVASPECT_CONTENT; + formatetc.lindex = -1; + formatetc.tymed = TYMED_NULL; runnable = &OleObjectRunnable; cache = &OleObjectCache; expected_method_list = methods_olerender_none; @@ -836,6 +895,8 @@ IOleObject_Release(pObject); CHECK_NO_EXTRA_METHODS(); + formatetc.cfFormat = 0; + formatetc.tymed = TYMED_NULL; runnable = NULL; expected_method_list = methods_olerender_draw_no_runnable; trace("OleCreate with OLERENDER_DRAW (no IRunnableObject):\n"); @@ -853,6 +914,7 @@ IOleObject_Release(pObject); CHECK_NO_EXTRA_METHODS(); trace("end\n"); + g_expected_fetc = NULL; } static void test_OleLoad(IStorage *pStorage) @@ -874,10 +936,32 @@ { "OleObject_SetClientSite", 0 }, { "OleObject_Release", 0 }, { "OleObject_QueryInterface", 0 }, + { "OleObject_GetMiscStatus", 0 }, { "OleObject_Release", 0 }, { NULL, 0 } }; + /* Test once with IOleObject_GetMiscStatus failing */ + expected_method_list = methods_oleload; + g_failGetMiscStatus = TRUE; + trace("OleLoad:\n"); + hr = OleLoad(pStorage, &IID_IOleObject, (IOleClientSite *)0xdeadbeef, (void **)&pObject); + ok(hr == S_OK || + broken(hr == E_INVALIDARG), /* win98 and win2k */ + "OleLoad failed with error 0x%08x\n", hr); + if(pObject) + { + DWORD dwStatus = 0xdeadbeef; + hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus); + ok(hr == E_FAIL, "Got 0x%08x\n", hr); + ok(dwStatus == 0x1234, "Got 0x%08x\n", dwStatus); + + IOleObject_Release(pObject); + CHECK_NO_EXTRA_METHODS(); + } + + /* Test again, let IOleObject_GetMiscStatus succeed. */ + g_failGetMiscStatus = FALSE; expected_method_list = methods_oleload; trace("OleLoad:\n"); hr = OleLoad(pStorage, &IID_IOleObject, (IOleClientSite *)0xdeadbeef, (void **)&pObject); @@ -886,6 +970,11 @@ "OleLoad failed with error 0x%08x\n", hr); if (pObject) { + DWORD dwStatus = 0xdeadbeef; + hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus); + ok(hr == S_OK, "Got 0x%08x\n", hr); + ok(dwStatus == 1, "Got 0x%08x\n", dwStatus); + IOleObject_Release(pObject); CHECK_NO_EXTRA_METHODS(); } @@ -895,6 +984,12 @@ { CHECK_EXPECTED_METHOD("draw_continue"); return TRUE; +} + +static BOOL STDMETHODCALLTYPE draw_continue_false(ULONG_PTR param) +{ + CHECK_EXPECTED_METHOD("draw_continue_false"); + return FALSE; } static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid, void **ppv) @@ -972,6 +1067,8 @@ REFIID riid, void** ppvObject) { + CHECK_EXPECTED_METHOD("DataObject_QueryInterface"); + if (IsEqualIID(riid, &IID_IDataObject) || IsEqualIID(riid, &IID_IUnknown)) { *ppvObject = iface; @@ -984,12 +1081,14 @@ static ULONG WINAPI DataObject_AddRef( IDataObject* iface) { + CHECK_EXPECTED_METHOD("DataObject_AddRef"); return 2; } static ULONG WINAPI DataObject_Release( IDataObject* iface) { + CHECK_EXPECTED_METHOD("DataObject_Release"); return 1; } @@ -1054,8 +1153,20 @@ IAdviseSink* pAdvSink, DWORD* pdwConnection) { + STGMEDIUM stgmedium; + CHECK_EXPECTED_METHOD("DataObject_DAdvise"); *pdwConnection = 1; + + if(advf & ADVF_PRIMEFIRST) + { + ok(pformatetc->cfFormat == cf_test_2, "got %04x\n", pformatetc->cfFormat); + stgmedium.tymed = TYMED_HGLOBAL; + U(stgmedium).hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 4); + stgmedium.pUnkForRelease = NULL; + IAdviseSink_OnDataChange(pAdvSink, pformatetc, &stgmedium); + } + return S_OK; } @@ -1101,6 +1212,7 @@ IPersistStorage *pPS; IViewObject *pViewObject; IOleCacheControl *pOleCacheControl; + IDataObject *pCacheDataObject; FORMATETC fmtetc; STGMEDIUM stgmedium; DWORD dwConnection; @@ -1116,7 +1228,8 @@ { { "AdviseSink_OnViewChange", 0 }, { "AdviseSink_OnViewChange", 0 }, - { "draw_continue", 0 }, + { "draw_continue", 1 }, + { "draw_continue_false", 1 }, { "DataObject_DAdvise", 0 }, { "DataObject_DAdvise", 0 }, { "DataObject_DUnadvise", 0 }, @@ -1126,12 +1239,25 @@ static const struct expected_method methods_cacheload[] = { { "AdviseSink_OnViewChange", 0 }, - { "draw_continue", 0 }, - { "draw_continue", 0 }, - { "draw_continue", 0 }, + { "draw_continue", 1 }, + { "draw_continue", 1 }, + { "draw_continue", 1 }, { "DataObject_GetData", 0 }, { "DataObject_GetData", 0 }, { "DataObject_GetData", 0 }, + { NULL, 0 } + }; + static const struct expected_method methods_cachethenrun[] = + { + { "DataObject_DAdvise", 0 }, + { "DataObject_DAdvise", 0 }, + { "DataObject_DAdvise", 0 }, + { "DataObject_QueryGetData", 1 }, /* called by win9x and nt4 */ + { "DataObject_DAdvise", 0 }, + { "DataObject_DUnadvise", 0 }, + { "DataObject_DUnadvise", 0 }, + { "DataObject_DUnadvise", 0 }, + { "DataObject_DUnadvise", 0 }, { NULL, 0 } }; @@ -1248,6 +1374,7 @@ fmtetc.dwAspect = DVASPECT_ICON; hr = IOleCache_SetData(pOleCache, &fmtetc, &stgmedium, FALSE); ok_ole_success(hr, "IOleCache_SetData"); + ReleaseStgMedium(&stgmedium); hr = IViewObject_Freeze(pViewObject, DVASPECT_ICON, -1, NULL, &dwFreeze); todo_wine { @@ -1268,12 +1395,20 @@ hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef); ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr); + /* a NULL draw_continue fn ptr */ + hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, NULL, 0xdeadbeef); + ok_ole_success(hr, "IViewObject_Draw"); + + /* draw_continue that returns FALSE to abort drawing */ + hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue_false, 0xdeadbeef); + ok(hr == E_ABORT || + broken(hr == S_OK), /* win9x may skip the callbacks */ + "IViewObject_Draw with draw_continue_false returns 0x%08x\n", hr); + DeleteDC(hdcMem); hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject); - todo_wine { ok_ole_success(hr, "IOleCacheControl_OnRun"); - } hr = IPersistStorage_Save(pPS, pStorage, TRUE); ok_ole_success(hr, "IPersistStorage_Save"); @@ -1289,9 +1424,7 @@ IOleCache_Release(pOleCache); IOleCacheControl_Release(pOleCacheControl); - todo_wine { CHECK_NO_EXTRA_METHODS(); - } /* Test with loaded data */ trace("Testing loaded data with CreateDataCache:\n"); @@ -1365,8 +1498,70 @@ CHECK_NO_EXTRA_METHODS(); } + hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache); + ok_ole_success(hr, "CreateDataCache"); + + expected_method_list = methods_cachethenrun; + + hr = IOleCache_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject); + ok_ole_success(hr, "IOleCache_QueryInterface(IID_IDataObject)"); + hr = IOleCache_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl); + ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)"); + + fmtetc.cfFormat = CF_METAFILEPICT; + fmtetc.dwAspect = DVASPECT_CONTENT; + fmtetc.tymed = TYMED_MFPICT; + + hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection); + ok_ole_success(hr, "IOleCache_Cache"); + + hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium); + ok(hr == OLE_E_BLANK, "got %08x\n", hr); + + fmtetc.cfFormat = cf_test_1; + fmtetc.dwAspect = DVASPECT_CONTENT; + fmtetc.tymed = TYMED_HGLOBAL; + + hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection); + ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr); + + hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium); + ok(hr == OLE_E_BLANK, "got %08x\n", hr); + + fmtetc.cfFormat = cf_test_2; + hr = IOleCache_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection); + ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr); + + hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium); + ok(hr == OLE_E_BLANK, "got %08x\n", hr); + + hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject); + ok_ole_success(hr, "IOleCacheControl_OnRun"); + + fmtetc.cfFormat = cf_test_3; + hr = IOleCache_Cache(pOleCache, &fmtetc, 0, &dwConnection); + ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr); + + fmtetc.cfFormat = cf_test_1; + hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium); + ok(hr == OLE_E_BLANK, "got %08x\n", hr); + + fmtetc.cfFormat = cf_test_2; + hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium); + ok(hr == S_OK, "got %08x\n", hr); + ReleaseStgMedium(&stgmedium); + + fmtetc.cfFormat = cf_test_3; + hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium); + ok(hr == OLE_E_BLANK, "got %08x\n", hr); + + IOleCacheControl_Release(pOleCacheControl); + IDataObject_Release(pCacheDataObject); + IOleCache_Release(pOleCache); + + CHECK_NO_EXTRA_METHODS(); + IStorage_Release(pStorage); - ReleaseStgMedium(&stgmedium); } static void test_default_handler(void) @@ -1386,9 +1581,24 @@ FORMATETC fmtetc; IOleInPlaceObject *pInPlaceObj; IEnumOLEVERB *pEnumVerbs; + DWORD dwRegister; static const WCHAR wszUnknown[] = {'U','n','k','n','o','w','n',0}; static const WCHAR wszHostName[] = {'W','i','n','e',' ','T','e','s','t',' ','P','r','o','g','r','a','m',0}; static const WCHAR wszDelim[] = {'!',0}; + + static const struct expected_method methods_embeddinghelper[] = + { + { "OleObject_QueryInterface", 0 }, + { "OleObject_AddRef", 0 }, + { "OleObject_QueryInterface", 0 }, + { "OleObject_QueryInterface", TEST_TODO }, + { "OleObject_QueryInterface", 0 }, + { "OleObject_QueryInterface", 0 }, + { "OleObject_QueryInterface", TEST_OPTIONAL }, /* Win95/98/NT4 */ + { "OleObject_Release", TEST_TODO }, + { "WINE_EXTRA", TEST_OPTIONAL }, + { NULL, 0 } + }; hr = CoCreateInstance(&CLSID_WineTest, NULL, CLSCTX_INPROC_HANDLER, &IID_IOleObject, (void **)&pObject); ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed with REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr); @@ -1449,6 +1659,7 @@ sizel.cx = sizel.cy = 0; hr = IOleObject_SetExtent(pObject, DVASPECT_CONTENT, &sizel); + ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetExtent should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr); hr = IOleObject_SetHostNames(pObject, wszHostName, NULL); ok_ole_success(hr, "IOleObject_SetHostNames"); @@ -1517,6 +1728,45 @@ IRunnableObject_Release(pRunnableObject); IOleObject_Release(pObject); + + /* Test failure propagation from delegate ::QueryInterface */ + hr = CoRegisterClassObject(&CLSID_WineTest, (IUnknown*)&OleObjectCF, + CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegister); + ok_ole_success(hr, "CoRegisterClassObject"); + if(SUCCEEDED(hr)) + { + expected_method_list = methods_embeddinghelper; + hr = OleCreateEmbeddingHelper(&CLSID_WineTest, NULL, EMBDHLP_INPROC_SERVER, + &OleObjectCF, &IID_IOleObject, (void**)&pObject); + ok_ole_success(hr, "OleCreateEmbeddingHelper"); + if(SUCCEEDED(hr)) + { + IUnknown *punk; + + g_QIFailsWith = E_FAIL; + hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk); + ok(hr == E_FAIL, "Got 0x%08x\n", hr); + + g_QIFailsWith = E_NOINTERFACE; + hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk); + ok(hr == E_NOINTERFACE, "Got 0x%08x\n", hr); + + g_QIFailsWith = CO_E_OBJNOTCONNECTED; + hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk); + ok(hr == CO_E_OBJNOTCONNECTED, "Got 0x%08x\n", hr); + + g_QIFailsWith = 0x87654321; + hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk); + ok(hr == 0x87654321, "Got 0x%08x\n", hr); + + IOleObject_Release(pObject); + } + + CHECK_NO_EXTRA_METHODS(); + + hr = CoRevokeClassObject(dwRegister); + ok_ole_success(hr, "CoRevokeClassObject"); + } } static void test_runnable(void) @@ -1536,20 +1786,28 @@ { NULL, 0 } }; + BOOL ret; IOleObject *object = &OleObject; + /* null argument */ + ret = OleIsRunning(NULL); + ok(ret == FALSE, "got %d\n", ret); + expected_method_list = methods_query_runnable; - ok(OleIsRunning(object), "Object should be running\n"); + ret = OleIsRunning(object); + ok(ret == TRUE, "Object should be running\n"); CHECK_NO_EXTRA_METHODS(); g_isRunning = FALSE; expected_method_list = methods_query_runnable; - ok(OleIsRunning(object) == FALSE, "Object should not be running\n"); + ret = OleIsRunning(object); + ok(ret == FALSE, "Object should not be running\n"); CHECK_NO_EXTRA_METHODS(); g_showRunnable = FALSE; /* QueryInterface(IID_IRunnableObject, ...) will fail */ expected_method_list = methods_no_runnable; - ok(OleIsRunning(object), "Object without IRunnableObject should be running\n"); + ret = OleIsRunning(object); + ok(ret == TRUE, "Object without IRunnableObject should be running\n"); CHECK_NO_EXTRA_METHODS(); g_isRunning = TRUE; @@ -1585,13 +1843,13 @@ Unknown_Release }; -static IUnknown Unknown = { &UnknownVtbl }; +static IUnknown unknown = { &UnknownVtbl }; static void test_OleLockRunning(void) { HRESULT hr; - hr = OleLockRunning((LPUNKNOWN)&Unknown, TRUE, FALSE); + hr = OleLockRunning((LPUNKNOWN)&unknown, TRUE, FALSE); ok(hr == S_OK, "OleLockRunning failed 0x%08x\n", hr); } @@ -1602,6 +1860,10 @@ STATSTG statstg; HRESULT hr; + cf_test_1 = RegisterClipboardFormatA("cf_winetest_1"); + cf_test_2 = RegisterClipboardFormatA("cf_winetest_2"); + cf_test_3 = RegisterClipboardFormatA("cf_winetest_3"); + CoInitialize(NULL); hr = CoRegisterClassObject(&CLSID_Equation3, (IUnknown *)&OleObjectCF, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegister); Modified: trunk/rostests/winetests/ole32/propvariant.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/propvaria…
============================================================================== --- trunk/rostests/winetests/ole32/propvariant.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/propvariant.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -32,7 +32,7 @@ #define PROP_V1A 2 #define PROP_TODO 0x80 -struct valid_mapping +static const struct valid_mapping { BYTE simple; BYTE with_array; Modified: trunk/rostests/winetests/ole32/stg_prop.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/stg_prop.…
============================================================================== --- trunk/rostests/winetests/ole32/stg_prop.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/stg_prop.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -186,7 +186,7 @@ spec.ulKind = PRSPEC_PROPID; U(spec).propid = PIDSI_THUMBNAIL; hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var); - ok(SUCCEEDED(hr), "ReadMultiple failed: 0x%08x\n", hr); + ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr); ok(var.vt == VT_CF, "variant type wrong\n"); ok(U(var).pclipdata->ulClipFmt == CF_ENHMETAFILE, "clipboard type wrong\n"); @@ -315,13 +315,18 @@ spec.ulKind = PRSPEC_PROPID; U(spec).propid = PID_FIRST_USABLE; + var.vt = VT_I4; U(var).lVal = 1; hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0); ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr); + + hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT); + ok(hr == S_OK, "Commit failed: 0x%08x\n", hr); IPropertyStorage_Release(propertyStorage); IPropertySetStorage_Release(propSetStorage); IStorage_Release(storage); + propertyStorage = NULL; /* now open it again */ hr = StgOpenStorage(filename, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, @@ -338,7 +343,11 @@ spec.ulKind = PRSPEC_PROPID; U(spec).propid = PID_FIRST_USABLE; hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var); - ok(hr == S_FALSE, "ReadMultiple failed: 0x%08x\n", hr); + ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr); + + ok(var.vt == VT_I4 && U(var).lVal == 1, + "Didn't get expected type or value for property (got type %d, value %d)\n", + var.vt, U(var).lVal); IPropertyStorage_Release(propertyStorage); IPropertySetStorage_Release(propSetStorage); Modified: trunk/rostests/winetests/ole32/storage32.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/storage32…
============================================================================== --- trunk/rostests/winetests/ole32/storage32.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/storage32.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -66,12 +66,18 @@ r = CreateILockBytesOnHGlobal( NULL, TRUE, &ilb ); ok( r == S_OK, "CreateILockBytesOnHGlobal failed\n"); + r = StgIsStorageILockBytes( ilb ); + ok( r == S_FALSE, "StgIsStorageILockBytes should have failed\n"); + mode = STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE;/*0x1012*/ r = StgCreateDocfileOnILockBytes( ilb, mode, 0, &stg ); ok( r == S_OK, "StgCreateDocfileOnILockBytes failed\n"); r = WriteClassStg( stg, &test_stg_cls ); ok( r == S_OK, "WriteClassStg failed\n"); + + r = StgIsStorageILockBytes( ilb ); + ok( r == S_OK, "StgIsStorageILockBytes failed\n"); memset( &stat, 0, sizeof stat ); r = IStorage_Stat( stg, &stat, 0 ); @@ -236,6 +242,59 @@ /* test the way msi uses StgCreateDocfile */ r = StgCreateDocfile( filename, STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stg); ok(r==S_OK, "StgCreateDocFile failed\n"); + r = IStorage_Release(stg); + ok(r == 0, "storage not released\n"); + ok(DeleteFileA(filenameA), "failed to delete file\n"); +} + +static void test_stgcreatestorageex(void) +{ + HRESULT (WINAPI *pStgCreateStorageEx)(const WCHAR* pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS* pStgOptions, void* reserved, REFIID riid, void** ppObjectOpen); + HMODULE hOle32 = GetModuleHandle("ole32"); + IStorage *stg = NULL; + STGOPTIONS stgoptions = {1, 0, 4096}; + HRESULT r; + + pStgCreateStorageEx = (void *) GetProcAddress(hOle32, "StgCreateStorageEx"); + if (!pStgCreateStorageEx) + { + win_skip("skipping test on NT4\n"); + return; + } + + DeleteFileA(filenameA); + + /* Verify that StgCreateStorageEx can accept an options param */ + r = pStgCreateStorageEx( filename, + STGM_SHARE_EXCLUSIVE | STGM_READWRITE, + STGFMT_DOCFILE, + 0, + &stgoptions, + NULL, + &IID_IStorage, + (void **) &stg); + ok(r==S_OK || r==STG_E_UNIMPLEMENTEDFUNCTION, "StgCreateStorageEx with options failed\n"); + if (r==STG_E_UNIMPLEMENTEDFUNCTION) + { + /* We're on win98 which means all bets are off. Let's get out of here. */ + win_skip("skipping test on win9x\n"); + return; + } + + r = IStorage_Release(stg); + ok(r == 0, "storage not released\n"); + ok(DeleteFileA(filenameA), "failed to delete file\n"); + + /* Verify that StgCreateStorageEx can accept a NULL pStgOptions */ + r = pStgCreateStorageEx( filename, + STGM_SHARE_EXCLUSIVE | STGM_READWRITE, + STGFMT_STORAGE, + 0, + NULL, + NULL, + &IID_IStorage, + (void **) &stg); + ok(r==S_OK, "StgCreateStorageEx with NULL options failed\n"); r = IStorage_Release(stg); ok(r == 0, "storage not released\n"); ok(DeleteFileA(filenameA), "failed to delete file\n"); @@ -822,7 +881,7 @@ STATSTG statstg; r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME ); - ok(r == S_OK, "Stat should have succeded instead of returning 0x%08x\n", r); + ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r); ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type); ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %d\n", U(statstg.cbSize).LowPart); ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %d\n", U(statstg.cbSize).HighPart); @@ -837,7 +896,7 @@ ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08x\n", r); r = IStorage_Stat( stg2, &statstg, STATFLAG_DEFAULT ); - ok(r == S_OK, "Stat should have succeded instead of returning 0x%08x\n", r); + ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r); ok(!memcmp(statstg.pwcsName, stgname, sizeof(stgname)), "Statstg pwcsName should have been the name the storage was created with\n"); ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type); @@ -955,6 +1014,7 @@ CoTaskMemFree(stat.pwcsName); r = IEnumSTATSTG_Release(ee); + ok(r==S_OK, "EnumSTATSTG_Release failed with error 0x%08x\n", r); /* second enum... destroy the stream before reading */ r = IStorage_EnumElements(stg, 0, NULL, 0, &ee); @@ -985,6 +1045,7 @@ ok(r==S_OK, "IStorage->CreateStream failed\n"); r = IStream_Release(stm); + ok(r==S_OK, "Stream_Release failed with error 0x%08x\n", r); count = 0xf00; r = IEnumSTATSTG_Next(ee, 1, &stat, &count); @@ -1001,6 +1062,7 @@ ok(r==S_OK, "IStorage->CreateStream failed\n"); r = IStream_Release(stm); + ok(r==S_OK, "Stream_Release failed with error 0x%08x\n", r); count = 0xf00; r = IEnumSTATSTG_Next(ee, 1, &stat, &count); @@ -1018,6 +1080,7 @@ ok(r==S_OK, "IStorage->CreateStream failed\n"); r = IStream_Release(stm); + ok(r==S_OK, "Stream_Release failed with error 0x%08x\n", r); r = IEnumSTATSTG_Reset(ee); ok(r==S_OK, "IEnumSTATSTG->Reset failed\n"); @@ -1363,6 +1426,7 @@ ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r); r = IStorage_Revert(stg); + ok(r==S_OK, "Storage_Revert failed with error 0x%08x\n", r); /* all open objects become invalid */ r = IStream_Write(stm, "this shouldn't work\n", 20, NULL); @@ -1497,7 +1561,7 @@ if (r == S_OK) { r = IStream_Write(stm, "this should fail\n", 17, NULL); - ok(r==STG_E_REVERTED, "IStream->Write sould fail, hr=%x\n", r); + ok(r==STG_E_REVERTED, "IStream->Write should fail, hr=%x\n", r); IStream_Release(stm); @@ -2679,6 +2743,7 @@ ok(r==S_OK, "StgCreateDocfile failed\n"); r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT ); + ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r); ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n", wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName)); CoTaskMemFree(stat.pwcsName); @@ -2689,6 +2754,7 @@ ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r); r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT ); + ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r); ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n", wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName)); CoTaskMemFree(stat.pwcsName); @@ -2712,6 +2778,7 @@ ok(r==S_OK, "StgCreateDocfile failed\n"); r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT ); + ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r); ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n", wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName)); CoTaskMemFree(stat.pwcsName); @@ -2722,6 +2789,7 @@ ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r); r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT ); + ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r); ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n", wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName)); CoTaskMemFree(stat.pwcsName); @@ -2819,7 +2887,7 @@ /* Try to copy the storage while the substorage is open */ r = IStorage_CopyTo(stg2, 0, NULL, NULL, stg3); - todo_wine ok(r==S_OK, "IStorage->CopyTo failed, hr=%08x\n", r); + ok(r==S_OK, "IStorage->CopyTo failed, hr=%08x\n", r); IStorage_Release(stg4); IStorage_Release(stg3); @@ -2879,6 +2947,52 @@ r = DeleteFileA(filenameA); ok( r == TRUE, "deleted file\n"); +} + +static void test_hglobal_storage_creation(void) +{ + ILockBytes *ilb = NULL; + IStorage *stg = NULL; + HRESULT r; + STATSTG stat; + char junk[512]; + ULARGE_INTEGER offset; + + r = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb); + ok(r == S_OK, "CreateILockBytesOnHGlobal failed, hr=%x\n", r); + + offset.QuadPart = 0; + memset(junk, 0xaa, 512); + r = ILockBytes_WriteAt(ilb, offset, junk, 512, NULL); + ok(r == S_OK, "ILockBytes_WriteAt failed, hr=%x\n", r); + + offset.QuadPart = 2000; + r = ILockBytes_WriteAt(ilb, offset, junk, 512, NULL); + ok(r == S_OK, "ILockBytes_WriteAt failed, hr=%x\n", r); + + r = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stg); + ok(r == S_OK, "StgCreateDocfileOnILockBytes failed, hr=%x\n", r); + + IStorage_Release(stg); + + r = StgOpenStorageOnILockBytes(ilb, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE, + NULL, 0, &stg); + ok(r == S_OK, "StgOpenStorageOnILockBytes failed, hr=%x\n", r); + + if (SUCCEEDED(r)) + { + r = IStorage_Stat(stg, &stat, STATFLAG_NONAME); + ok(r == S_OK, "StgOpenStorageOnILockBytes failed, hr=%x\n", r); + ok(IsEqualCLSID(&stat.clsid, &GUID_NULL), "unexpected CLSID value\n"); + + IStorage_Release(stg); + } + + r = ILockBytes_Stat(ilb, &stat, STATFLAG_NONAME); + ok(r == S_OK, "ILockBytes_Stat failed, hr=%x\n", r); + ok(stat.cbSize.u.LowPart < 2512, "expected truncated size, got %d\n", stat.cbSize.u.LowPart); + + ILockBytes_Release(ilb); } START_TEST(storage32) @@ -2896,6 +3010,7 @@ test_hglobal_storage_stat(); test_create_storage_modes(); + test_stgcreatestorageex(); test_storage_stream(); test_open_storage(); test_storage_suminfo(); @@ -2922,4 +3037,5 @@ test_substorage_enum(); test_copyto_locking(); test_copyto_recursive(); -} + test_hglobal_storage_creation(); +} Modified: trunk/rostests/winetests/ole32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/usrmarsha…
============================================================================== --- trunk/rostests/winetests/ole32/usrmarshal.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/usrmarshal.c [iso-8859-1] Thu May 17 15:17:09 2012 @@ -182,6 +182,7 @@ wirehglobal += sizeof(ULONG); ok(*(ULONG *)wirehglobal == 0, "buffer+4 should be HGLOBAL\n"); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); + hglobal2 = NULL; HGLOBAL_UserUnmarshal(&umcb.Flags, buffer, &hglobal2); ok(hglobal2 == hglobal, "Didn't unmarshal properly\n"); HeapFree(GetProcessHeap(), 0, buffer); @@ -227,6 +228,7 @@ ok(wirehglobal[i] == i, "buffer+0x%x should be %d\n", 0x10 + i, i); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); + hglobal2 = NULL; HGLOBAL_UserUnmarshal(&umcb.Flags, buffer, &hglobal2); ok(hglobal2 != NULL, "Didn't unmarshal properly\n"); HeapFree(GetProcessHeap(), 0, buffer); @@ -578,7 +580,6 @@ ok(size == 0, "size should be 0 bytes, not %d\n", size); buffer = HeapAlloc(GetProcessHeap(), 0, size); buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, ctx, buffer, unk, &IID_IUnknown); - wireip = buffer; HeapFree(GetProcessHeap(), 0, buffer); /* Now for a non-NULL pointer. The marshalled data are two size DWORDS and then
12 years, 7 months
1
0
0
0
[akhaldi] 56597: [OLE32] * Sync to Wine 1.5.4.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu May 17 15:16:51 2012 New Revision: 56597 URL:
http://svn.reactos.org/svn/reactos?rev=56597&view=rev
Log: [OLE32] * Sync to Wine 1.5.4. Added: trunk/reactos/dll/win32/ole32/ole32.rgs (with props) Removed: trunk/reactos/dll/win32/ole32/regsvr.c Modified: trunk/reactos/dll/win32/ole32/CMakeLists.txt trunk/reactos/dll/win32/ole32/antimoniker.c trunk/reactos/dll/win32/ole32/bindctx.c trunk/reactos/dll/win32/ole32/classmoniker.c trunk/reactos/dll/win32/ole32/clipboard.c trunk/reactos/dll/win32/ole32/comcat.c trunk/reactos/dll/win32/ole32/compobj.c trunk/reactos/dll/win32/ole32/compobj_private.h trunk/reactos/dll/win32/ole32/compositemoniker.c trunk/reactos/dll/win32/ole32/datacache.c trunk/reactos/dll/win32/ole32/dcom.idl trunk/reactos/dll/win32/ole32/defaulthandler.c trunk/reactos/dll/win32/ole32/dictionary.h trunk/reactos/dll/win32/ole32/enumx.h trunk/reactos/dll/win32/ole32/filelockbytes.c trunk/reactos/dll/win32/ole32/filemoniker.c trunk/reactos/dll/win32/ole32/ftmarshal.c trunk/reactos/dll/win32/ole32/git.c trunk/reactos/dll/win32/ole32/hglobalstream.c trunk/reactos/dll/win32/ole32/ifs.c trunk/reactos/dll/win32/ole32/itemmoniker.c trunk/reactos/dll/win32/ole32/marshal.c trunk/reactos/dll/win32/ole32/memlockbytes.c trunk/reactos/dll/win32/ole32/moniker.c trunk/reactos/dll/win32/ole32/moniker.h trunk/reactos/dll/win32/ole32/ole2.c trunk/reactos/dll/win32/ole32/ole2stubs.c trunk/reactos/dll/win32/ole32/ole32.spec trunk/reactos/dll/win32/ole32/ole32_main.c trunk/reactos/dll/win32/ole32/ole32_objidl.idl trunk/reactos/dll/win32/ole32/ole32_oleidl.idl trunk/reactos/dll/win32/ole32/ole32_unknwn.idl trunk/reactos/dll/win32/ole32/ole32res.rc trunk/reactos/dll/win32/ole32/oleobj.c trunk/reactos/dll/win32/ole32/pointermoniker.c trunk/reactos/dll/win32/ole32/rpc.c trunk/reactos/dll/win32/ole32/stg_prop.c trunk/reactos/dll/win32/ole32/storage32.c trunk/reactos/dll/win32/ole32/storage32.h trunk/reactos/dll/win32/ole32/stubmanager.c trunk/reactos/dll/win32/ole32/usrmarshal.c trunk/reactos/media/doc/README.WINE [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/ole32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/CMakeLists…
Modified: trunk/reactos/dll/win32/ole32/antimoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/antimonike…
Modified: trunk/reactos/dll/win32/ole32/bindctx.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/bindctx.c?…
Modified: trunk/reactos/dll/win32/ole32/classmoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/classmonik…
Modified: trunk/reactos/dll/win32/ole32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/clipboard.…
Modified: trunk/reactos/dll/win32/ole32/comcat.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/comcat.c?r…
Modified: trunk/reactos/dll/win32/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj.c?…
Modified: trunk/reactos/dll/win32/ole32/compobj_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj_pr…
Modified: trunk/reactos/dll/win32/ole32/compositemoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compositem…
Modified: trunk/reactos/dll/win32/ole32/datacache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/datacache.…
Modified: trunk/reactos/dll/win32/ole32/dcom.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/dcom.idl?r…
Modified: trunk/reactos/dll/win32/ole32/defaulthandler.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/defaulthan…
Modified: trunk/reactos/dll/win32/ole32/dictionary.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/dictionary…
Modified: trunk/reactos/dll/win32/ole32/enumx.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/enumx.h?re…
Modified: trunk/reactos/dll/win32/ole32/filelockbytes.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/filelockby…
Modified: trunk/reactos/dll/win32/ole32/filemoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/filemonike…
Modified: trunk/reactos/dll/win32/ole32/ftmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ftmarshal.…
Modified: trunk/reactos/dll/win32/ole32/git.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/git.c?rev=…
Modified: trunk/reactos/dll/win32/ole32/hglobalstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/hglobalstr…
Modified: trunk/reactos/dll/win32/ole32/ifs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ifs.c?rev=…
Modified: trunk/reactos/dll/win32/ole32/itemmoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/itemmonike…
Modified: trunk/reactos/dll/win32/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/marshal.c?…
Modified: trunk/reactos/dll/win32/ole32/memlockbytes.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/memlockbyt…
Modified: trunk/reactos/dll/win32/ole32/moniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/moniker.c?…
Modified: trunk/reactos/dll/win32/ole32/moniker.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/moniker.h?…
Modified: trunk/reactos/dll/win32/ole32/ole2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2.c?rev…
Modified: trunk/reactos/dll/win32/ole32/ole2stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2stubs.…
Added: trunk/reactos/dll/win32/ole32/ole32.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.rgs?…
Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec…
Modified: trunk/reactos/dll/win32/ole32/ole32_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32_main…
Modified: trunk/reactos/dll/win32/ole32/ole32_objidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32_obji…
Modified: trunk/reactos/dll/win32/ole32/ole32_oleidl.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32_olei…
Modified: trunk/reactos/dll/win32/ole32/ole32_unknwn.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32_unkn…
Modified: trunk/reactos/dll/win32/ole32/ole32res.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32res.r…
Modified: trunk/reactos/dll/win32/ole32/oleobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/oleobj.c?r…
Modified: trunk/reactos/dll/win32/ole32/pointermoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/pointermon…
Removed: trunk/reactos/dll/win32/ole32/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/regsvr.c?r…
Modified: trunk/reactos/dll/win32/ole32/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/rpc.c?rev=…
Modified: trunk/reactos/dll/win32/ole32/stg_prop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_prop.c…
Modified: trunk/reactos/dll/win32/ole32/storage32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
Modified: trunk/reactos/dll/win32/ole32/storage32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
Modified: trunk/reactos/dll/win32/ole32/stubmanager.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stubmanage…
Modified: trunk/reactos/dll/win32/ole32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/usrmarshal…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
12 years, 7 months
1
0
0
0
[akhaldi] 56596: [PSDK] * Fix a typo.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu May 17 15:05:17 2012 New Revision: 56596 URL:
http://svn.reactos.org/svn/reactos?rev=56596&view=rev
Log: [PSDK] * Fix a typo. Modified: trunk/reactos/include/psdk/guiddef.h Modified: trunk/reactos/include/psdk/guiddef.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/guiddef.h?rev…
============================================================================== --- trunk/reactos/include/psdk/guiddef.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/guiddef.h [iso-8859-1] Thu May 17 15:05:17 2012 @@ -67,7 +67,7 @@ #define _GUIDDEF_H_ #ifndef __LPGUID_DEFINED__ -#define __LPGUID_DEFINED___ +#define __LPGUID_DEFINED__ typedef GUID *LPGUID; #endif
12 years, 7 months
1
0
0
0
[ekohl] 56595: [INF] Add default security settings file for ReactOS Workstation.
by ekohl@svn.reactos.org
Author: ekohl Date: Thu May 17 13:08:59 2012 New Revision: 56595 URL:
http://svn.reactos.org/svn/reactos?rev=56595&view=rev
Log: [INF] Add default security settings file for ReactOS Workstation. Added: trunk/reactos/media/inf/defltws.inf (with props) Modified: trunk/reactos/media/inf/CMakeLists.txt Modified: trunk/reactos/media/inf/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/CMakeLists.txt?r…
============================================================================== --- trunk/reactos/media/inf/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/media/inf/CMakeLists.txt [iso-8859-1] Thu May 17 13:08:59 2012 @@ -6,6 +6,7 @@ bth.inf cdrom.inf cpu.inf + defltws.inf disk.inf display.inf fdc.inf Added: trunk/reactos/media/inf/defltws.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/defltws.inf?rev=…
============================================================================== --- trunk/reactos/media/inf/defltws.inf (added) +++ trunk/reactos/media/inf/defltws.inf [iso-8859-1] Thu May 17 13:08:59 2012 @@ -1,0 +1,9 @@ +; defltws.inf +; Default security settings for ReactOS Workstation + +[Version] +Signature = "$Windows NT$" + +[Privilege Rights] +SeAssignPrimaryTokenPrivilege = S-1-5-19, S-1-5-20 +SeAuditPrivilege = S-1-5-19, S-1-5-20 Propchange: trunk/reactos/media/inf/defltws.inf ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/media/inf/defltws.inf ------------------------------------------------------------------------------ svn:keywords = author date id revision
12 years, 7 months
1
0
0
0
[ekohl] 56594: [PSDK/LSASRV] - Add new ntlsa.h file to the PSDK. - LsarAddPrivilegesToAccount: Implement the ability to add new privileges to an existing privilege set.
by ekohl@svn.reactos.org
Author: ekohl Date: Thu May 17 12:02:50 2012 New Revision: 56594 URL:
http://svn.reactos.org/svn/reactos?rev=56594&view=rev
Log: [PSDK/LSASRV] - Add new ntlsa.h file to the PSDK. - LsarAddPrivilegesToAccount: Implement the ability to add new privileges to an existing privilege set. Added: trunk/reactos/include/psdk/ntlsa.h (with props) Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c trunk/reactos/dll/win32/lsasrv/lsasrv.h Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Thu May 17 12:02:50 2012 @@ -733,7 +733,7 @@ /* Validate the AccountHandle */ Status = LsapValidateDbObject(AccountHandle, LsaDbAccountObject, - 0, + ACCOUNT_VIEW, &AccountObject); if (!NT_SUCCESS(Status)) { @@ -778,13 +778,18 @@ PLSAPR_PRIVILEGE_SET Privileges) { PLSA_DB_OBJECT AccountObject; + PPRIVILEGE_SET CurrentPrivileges = NULL; + PPRIVILEGE_SET NewPrivileges = NULL; ULONG PrivilegeSetSize = 0; + ULONG PrivilegeCount; + ULONG i, j; + BOOL bFound; NTSTATUS Status; /* Validate the AccountHandle */ Status = LsapValidateDbObject(AccountHandle, LsaDbAccountObject, - 0, + ACCOUNT_ADJUST_PRIVILEGES, &AccountObject); if (!NT_SUCCESS(Status)) { @@ -811,8 +816,107 @@ { /* The Privilgs attribute exists */ - Status = STATUS_NOT_IMPLEMENTED; - } + /* Allocate memory for the stored privilege set */ + CurrentPrivileges = MIDL_user_allocate(PrivilegeSetSize); + if (CurrentPrivileges == NULL) + return STATUS_NO_MEMORY; + + /* Get the current privilege set */ + Status = LsapGetObjectAttribute(AccountObject, + L"Privilgs", + CurrentPrivileges, + &PrivilegeSetSize); + if (!NT_SUCCESS(Status)) + { + TRACE("LsapGetObjectAttribute() failed (Status 0x%08lx)\n", Status); + goto done; + } + + PrivilegeCount = CurrentPrivileges->PrivilegeCount; + TRACE("Current privilege count: %lu\n", PrivilegeCount); + + /* Calculate the number privileges in the combined privilege set */ + for (i = 0; i < Privileges->PrivilegeCount; i++) + { + bFound = FALSE; + for (j = 0; j < CurrentPrivileges->PrivilegeCount; j++) + { + if (RtlEqualLuid(&(Privileges->Privilege[i].Luid), + &(CurrentPrivileges->Privilege[i].Luid))) + { + bFound = TRUE; + break; + } + } + + if (bFound == FALSE) + { + TRACE("Found new privilege\n"); + PrivilegeCount++; + } + } + TRACE("New privilege count: %lu\n", PrivilegeCount); + + /* Calculate the size of the new privilege set and allocate it */ + PrivilegeSetSize = sizeof(PRIVILEGE_SET) + + (PrivilegeCount - 1) * sizeof(LUID_AND_ATTRIBUTES); + NewPrivileges = MIDL_user_allocate(PrivilegeSetSize); + if (NewPrivileges == NULL) + { + Status = STATUS_NO_MEMORY; + goto done; + } + + /* Initialize the new privilege set */ + NewPrivileges->PrivilegeCount = PrivilegeCount; + NewPrivileges->Control = 0; + + /* Copy all privileges from the current privilege set */ + RtlCopyLuidAndAttributesArray(CurrentPrivileges->PrivilegeCount, + &(CurrentPrivileges->Privilege[0]), + &(NewPrivileges->Privilege[0])); + + /* Add new privileges to the new privilege set */ + PrivilegeCount = CurrentPrivileges->PrivilegeCount; + for (i = 0; i < Privileges->PrivilegeCount; i++) + { + bFound = FALSE; + for (j = 0; j < CurrentPrivileges->PrivilegeCount; j++) + { + if (RtlEqualLuid(&(Privileges->Privilege[i].Luid), + &(CurrentPrivileges->Privilege[i].Luid))) + { + /* Overwrite attributes if a matching privilege was found */ + NewPrivileges->Privilege[j].Attributes = Privileges->Privilege[i].Attributes; + + bFound = TRUE; + break; + } + } + + if (bFound == FALSE) + { + /* Copy the new privilege */ + RtlCopyLuidAndAttributesArray(1, + (PLUID_AND_ATTRIBUTES)&(Privileges->Privilege[i]), + &(NewPrivileges->Privilege[PrivilegeCount])); + PrivilegeCount++; + } + } + + /* Set the new priivliege set */ + Status = LsapSetObjectAttribute(AccountObject, + L"Privilgs", + NewPrivileges, + PrivilegeSetSize); + } + +done: + if (CurrentPrivileges != NULL) + MIDL_user_free(CurrentPrivileges); + + if (NewPrivileges != NULL) + MIDL_user_free(NewPrivileges); return Status; } Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Thu May 17 12:02:50 2012 @@ -17,6 +17,7 @@ #include <ndk/rtlfuncs.h> #include <ndk/setypes.h> +#include <ntlsa.h> #include <ntsecapi.h> #include <sddl.h> Added: trunk/reactos/include/psdk/ntlsa.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntlsa.h?rev=5…
============================================================================== --- trunk/reactos/include/psdk/ntlsa.h (added) +++ trunk/reactos/include/psdk/ntlsa.h [iso-8859-1] Thu May 17 12:02:50 2012 @@ -1,0 +1,40 @@ +/* + * ntlsa.h + * + * This file is part of the ReactOS PSDK package. + * + * Contributors: + * Created by Eric Kohl. + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef _NTLSA_ +#define _NTLSA_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ACCOUNT_VIEW 1 +#define ACCOUNT_ADJUST_PRIVILEGES 2 +#define ACCOUNT_ADJUST_QUOTAS 4 +#define ACCOUNT_ADJUST_SYSTEM_ACCESS 8 + + + +#ifdef __cplusplus +} +#endif + + +#endif /* _NTLSA_ */ Propchange: trunk/reactos/include/psdk/ntlsa.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/include/psdk/ntlsa.h ------------------------------------------------------------------------------ svn:keywords = author date id revision
12 years, 7 months
1
0
0
0
[tkreuzer] 56593: [WIN32K] - Mark bitmap as API bitmap in NtGdiCreateDIBSection - Mark palette as DIB section palette in NtGdiCreateDIBSection - Set biXPelsPerMeter to 0 instead of using the bitmap...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed May 16 14:13:26 2012 New Revision: 56593 URL:
http://svn.reactos.org/svn/reactos?rev=56593&view=rev
Log: [WIN32K] - Mark bitmap as API bitmap in NtGdiCreateDIBSection - Mark palette as DIB section palette in NtGdiCreateDIBSection - Set biXPelsPerMeter to 0 instead of using the bitmap dimentions - Check BITMAPINFO parameters in GreGetDIBits - Handle case when requested bit depth doesn't match actual one in GreGetDIBits - Use maximum BITMAPINFO size in NtGdiGetDIBitsInternal - Verify header size in NtGdiGetDIBitsInternal - Misc code improvements Modified: branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c Modified: branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c URL:
http://svn.reactos.org/svn/reactos/branches/dib_rewrite/win32ss/gdi/ntgdi/d…
============================================================================== --- branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c [iso-8859-1] (original) +++ branches/dib_rewrite/win32ss/gdi/ntgdi/dibitmap.c [iso-8859-1] Wed May 16 14:13:26 2012 @@ -530,6 +530,12 @@ /* Return the base address if requested */ if (ppvBits) *ppvBits = psurfDIBSection->SurfObj.pvBits; + /* Mark as API bitmap */ + psurfDIBSection->flags |= API_BITMAP; + + /* Mark the palette as a DIB section palette */ + psurfDIBSection->ppal->flFlags |= PAL_DIBSECTION; + /* Save the handle and unlock the bitmap */ hbmp = psurfDIBSection->BaseObject.hHmgr; SURFACE_UnlockSurface(psurfDIBSection); @@ -697,7 +703,7 @@ HANDLE hSecure; HBITMAP hbmp; -__debugbreak(); +//__debugbreak(); if (fInit & CBM_INIT) { @@ -772,24 +778,16 @@ pbmi->bmiHeader.biPlanes = 1; pbmi->bmiHeader.biCompression = SURFACE_iCompression(psurf); pbmi->bmiHeader.biSizeImage = psurf->SurfObj.cjBits; - pbmi->bmiHeader.biXPelsPerMeter = psurf->sizlDim.cx; - pbmi->bmiHeader.biYPelsPerMeter = psurf->sizlDim.cy; - - /* Check if the caller requests a color table */ - if (pbmi->bmiHeader.biBitCount != 0) - { - /* Synthesize a color table */ - __debugbreak(); - } + pbmi->bmiHeader.biXPelsPerMeter = 0; + pbmi->bmiHeader.biYPelsPerMeter = 0; + pbmi->bmiHeader.biBitCount = gajBitsPerFormat[psurf->SurfObj.iBitmapFormat]; + + /* Set the number of colors */ + if (pbmi->bmiHeader.biBitCount <= 8) + pbmi->bmiHeader.biClrUsed = 1 << pbmi->bmiHeader.biBitCount; else - { - /* Just return the bit depth */ - pbmi->bmiHeader.biBitCount = - gajBitsPerFormat[psurf->SurfObj.iBitmapFormat]; - } - - /* Set the number of colors */ - pbmi->bmiHeader.biClrUsed = 1 << pbmi->bmiHeader.biBitCount; + pbmi->bmiHeader.biClrUsed = 0; + pbmi->bmiHeader.biClrImportant = pbmi->bmiHeader.biClrUsed; if (pbmi->bmiHeader.biSize >= sizeof(BITMAPV4HEADER)) @@ -828,12 +826,31 @@ _In_ UINT cjMaxInfo) { PDC pdc; - PSURFACE psurf; + PSURFACE psurfBmp; ULONG iCompression, cBitsPixel, cjLine; LONG lDeltaDst; PBYTE pjSrc; INT iResult = 0; + /* Check bitmap info */ + if ((pbmi->bmiHeader.biCompression >= BI_JPEG) || + (pbmi->bmiHeader.biWidth <= 0) || + (pbmi->bmiHeader.biHeight == 0)) + { + return 0; + } + + /* Check if we have a proper bit count value */ + if ((pbmi->bmiHeader.biBitCount != 1) && + (pbmi->bmiHeader.biBitCount != 4) && + (pbmi->bmiHeader.biBitCount != 8) && + (pbmi->bmiHeader.biBitCount != 16) && + (pbmi->bmiHeader.biBitCount != 24) && + (pbmi->bmiHeader.biBitCount != 32)) + { + return 0; + } + /* Lock the DC */ pdc = DC_LockDc(hdc); if (!pdc) @@ -842,35 +859,56 @@ } /* Lock the bitmap */ - psurf = SURFACE_ShareLockSurface(hbm); - if (!psurf) - { - + psurfBmp = SURFACE_ShareLockSurface(hbm); + if (!psurfBmp) + { + DC_UnlockDc(pdc); return 0; } + /* Check if the bitmap is compatile with the dc */ + if (!DC_bIsBitmapCompatible(pdc, psurfBmp)) + { + /* Dereference the bitmap, unlock the DC and fail. */ + SURFACE_ShareUnlockSurface(psurfBmp); + DC_UnlockDc(pdc); + return 0; + } + + /* Calculate width of one dest line */ + lDeltaDst = WIDTH_BYTES_ALIGN32(pbmi->bmiHeader.biWidth, + pbmi->bmiHeader.biBitCount); + + /* Calculate the image size */ + pbmi->bmiHeader.biSizeImage = lDeltaDst * abs(pbmi->bmiHeader.biHeight); + + /* Set planes to 1 */ + pbmi->bmiHeader.biPlanes = 1; + /* Check if there is anything to do */ - if (iStartScan < (ULONG)psurf->SurfObj.sizlBitmap.cy) - { + if (pjBits == NULL) + { + /* Nothing to copy, but we had success */ + iResult = 1; + } + else if (iStartScan < (ULONG)psurfBmp->SurfObj.sizlBitmap.cy) + { + /* Calculate the maximum number of scan lines to be copied */ + cScans = min(cScans, psurfBmp->SurfObj.sizlBitmap.cy - iStartScan); + cScans = min(cScans, cjMaxBits / lDeltaDst); + /* Get the bit depth of the bitmap */ - cBitsPixel = gajBitsPerFormat[psurf->SurfObj.iBitmapFormat]; + cBitsPixel = gajBitsPerFormat[psurfBmp->SurfObj.iBitmapFormat]; /* Get the compression of the bitmap */ - iCompression = SURFACE_iCompression(psurf); + iCompression = SURFACE_iCompression(psurfBmp); /* Check if the requested format matches the actual one */ if ((cBitsPixel == pbmi->bmiHeader.biBitCount) && (iCompression == pbmi->bmiHeader.biCompression)) { - /* Calculate width of one dest line */ - lDeltaDst = WIDTH_BYTES_ALIGN32(pbmi->bmiHeader.biWidth, cBitsPixel); - - /* Calculate the maximum number of scan lines to be copied */ - cScans = min(cScans, psurf->SurfObj.sizlBitmap.cy - iStartScan); - cScans = min(cScans, cjMaxBits / lDeltaDst); - /* Calculate the maximum length of a line */ - cjLine = min(lDeltaDst, abs(psurf->SurfObj.lDelta)); + cjLine = min(lDeltaDst, abs(psurfBmp->SurfObj.lDelta)); /* Check for top-down bitmaps */ if (pbmi->bmiHeader.biHeight > 0) @@ -881,8 +919,8 @@ } /* Calculate the start address from where to copy */ - pjSrc = psurf->SurfObj.pvScan0; - pjSrc += iStartScan * psurf->SurfObj.lDelta; + pjSrc = psurfBmp->SurfObj.pvScan0; + pjSrc += iStartScan * psurfBmp->SurfObj.lDelta; /* Save number of copied scans */ iResult = cScans; @@ -894,7 +932,7 @@ RtlCopyMemory(pjBits, pjSrc, cjLine); /* go to the next scan line */ - pjSrc += psurf->SurfObj.lDelta; + pjSrc += psurfBmp->SurfObj.lDelta; pjBits += lDeltaDst; } @@ -904,7 +942,42 @@ } else { - __debugbreak(); + RECTL rclDest = {0, 0, pbmi->bmiHeader.biWidth - 1, cScans -1}; + POINTL ptlSrc = {0, iStartScan}; + EXLATEOBJ exlo; + PSURFACE psurfDIB; + + /* Create a DIB surface */ + psurfDIB = DibCreateDIBSurface(pbmi, + pdc, + iUsage, + 0, + pjBits, + cjMaxBits); + if (psurfDIB) + { + /* Initialize XLATEOBJ */ + EXLATEOBJ_vInitialize(&exlo, + psurfDIB->ppal, + psurfBmp->ppal, + RGB(0xff, 0xff, 0xff), + pdc->pdcattr->crBackgroundClr, + pdc->pdcattr->crForegroundClr); + + EngCopyBits(&psurfDIB->SurfObj, + &psurfBmp->SurfObj, + NULL, + &exlo.xlo, + &rclDest, + &ptlSrc); + + /* Cleanup */ + EXLATEOBJ_vCleanup(&exlo); + GDIOBJ_vDeleteObject(&psurfDIB->BaseObject); + + /* Return the number of copied scan lnes */ + iResult = cScans; + } } } else @@ -913,9 +986,8 @@ iResult = 0; } - /* Unlock the bitmap surface */ - SURFACE_ShareUnlockSurface(psurf); - + /* Unlock the bitmap surface and the DC */ + SURFACE_ShareUnlockSurface(psurfBmp); DC_UnlockDc(pdc); return iResult; @@ -936,7 +1008,10 @@ { PBITMAPINFO pbmi; HANDLE hSecure; - INT iResult; + INT iResult = 0; + + /* Check for bad iUsage */ + if (iUsage > 2) return 0; /* Check if the size of the bitmap info is large enough */ if (cjMaxInfo < sizeof(BITMAPINFOHEADER)) @@ -944,37 +1019,53 @@ return 0; } + /* Use maximum size */ + cjMaxInfo = min(cjMaxInfo, sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD)); + + /* Allocate a buffer the bitmapinfo */ + pbmi = ExAllocatePoolWithTag(PagedPool, cjMaxInfo, GDITAG_BITMAPINFO); + if (!pbmi) + { + /* Fail */ + return 0; + } + + /* Use SEH */ + _SEH2_TRY + { + /* Probe and copy the BITMAPINFO */ + ProbeForWrite(pbmiUser, cjMaxInfo, 1); + RtlCopyMemory(pbmi, pbmiUser, cjMaxInfo); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(goto cleanup;) + } + _SEH2_END; + + /* Check if the header size is large enough */ + if ((pbmi->bmiHeader.biSize < sizeof(BITMAPINFOHEADER)) || + (pbmi->bmiHeader.biSize > cjMaxInfo)) + { + iResult = 0; + goto cleanup; + } + + /* Check if the caller provided bitmap bits */ if (pjBits) { + /* Secure the user mode memory */ hSecure = EngSecureMem(pjBits, cjMaxBits); if (!hSecure) { - return 0; - } - } - - pbmi = ExAllocatePoolWithTag(PagedPool, cjMaxInfo, GDITAG_BITMAPINFO); - if (!pbmi) - { - __debugbreak(); - } - - _SEH2_TRY - { - ProbeForWrite(pbmiUser, cjMaxInfo, 1); - RtlCopyMemory(pbmi, pbmiUser, cjMaxInfo); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - __debugbreak(); - } - _SEH2_END; - - // FIXME: check pbmi size - - if (pjBits) - { - /* Call the internal functiomn */ + goto cleanup; + } + } + + /* Check if the bitcount member is initialized */ + if (pbmi->bmiHeader.biBitCount != 0) + { + /* Call the internal function */ iResult = GreGetDIBits(hdc, hbm, iStartScan, @@ -985,23 +1076,35 @@ cjMaxBits, cjMaxInfo); } + else if (pjBits == NULL) + { + /* Just get the BITMAPINFO */ + iResult = GreGetDIBitmapInfo(hbm, pbmi, iUsage, cjMaxInfo); + } else { - iResult = GreGetDIBitmapInfo(hbm, pbmi, iUsage, cjMaxInfo); - } - - _SEH2_TRY - { - RtlCopyMemory(pbmiUser, pbmi, cjMaxInfo); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - } - _SEH2_END; - - + /* This combination is not valid */ + iResult = 0; + } + + /* Check for success */ + if (iResult) + { + /* Use SEH to copy back to user mode */ + _SEH2_TRY + { + /* Buffer is already probed, copy the data back */ + RtlCopyMemory(pbmiUser, pbmi, cjMaxInfo); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END; + } + +cleanup: + if (hSecure) EngUnsecureMem(hSecure); ExFreePoolWithTag(pbmi, GDITAG_BITMAPINFO); - return iResult; } @@ -1269,7 +1372,7 @@ BITMAPINFO* FASTCALL -DIB_ConvertBitmapInfo(CONST BITMAPINFO* pbmi, DWORD Usage) +_DIB_ConvertBitmapInfo(CONST BITMAPINFO* pbmi, DWORD Usage) { __debugbreak(); return 0; @@ -1277,7 +1380,7 @@ VOID FASTCALL -DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig) +_DIB_FreeConvertedBitmapInfo(BITMAPINFO* converted, BITMAPINFO* orig) { if(converted != orig) ExFreePoolWithTag(converted, TAG_DIB);
12 years, 7 months
1
0
0
0
[akhaldi] 56592: [GDI32_WINETEST] * Complete the sync to Wine 1.5.4 now that bug #7070 is fixed (thanks Timo).
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue May 15 17:21:43 2012 New Revision: 56592 URL:
http://svn.reactos.org/svn/reactos?rev=56592&view=rev
Log: [GDI32_WINETEST] * Complete the sync to Wine 1.5.4 now that bug #7070 is fixed (thanks Timo). Modified: trunk/rostests/winetests/gdi32/bitmap.c trunk/rostests/winetests/gdi32/dib.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/gdi32/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/bitmap.c?…
Modified: trunk/rostests/winetests/gdi32/dib.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdi32/dib.c?rev…
12 years, 7 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
23
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
Results per page:
10
25
50
100
200