winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
708 discussions
Start a n
N
ew thread
Alexandre Julliard : user32: Make sure the scroll button arrows are really at least 3 pixels.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 4428049a7a77069330d77b6fccb7aab3537d1003 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4428049a7a77069330d77b6fc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 20 19:46:46 2012 +0100 user32: Make sure the scroll button arrows are really at least 3 pixels. --- dlls/user32/uitools.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/dlls/user32/uitools.c b/dlls/user32/uitools.c index f1ce0d6..a21ab7b 100644 --- a/dlls/user32/uitools.c +++ b/dlls/user32/uitools.c @@ -1001,8 +1001,7 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags) * with the updown control. * Making sure that the arrow is as least 3 pixels wide (or high). */ - if (tri == 0) - tri = 1; + tri = max( 2, tri ); switch(uFlags & 0xff) {
1
0
0
0
Alexandre Julliard : comctl32/tests: Add some initial pager tests.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: c3f0abfa405996805707243c3d60f7629ae14090 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c3f0abfa405996805707243c3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 20 17:21:08 2012 +0100 comctl32/tests: Add some initial pager tests. --- dlls/comctl32/tests/Makefile.in | 1 + dlls/comctl32/tests/pager.c | 204 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 205 insertions(+), 0 deletions(-) diff --git a/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in index 145c125..670f52e 100644 --- a/dlls/comctl32/tests/Makefile.in +++ b/dlls/comctl32/tests/Makefile.in @@ -12,6 +12,7 @@ C_SRCS = \ misc.c \ monthcal.c \ mru.c \ + pager.c \ progress.c \ propsheet.c \ rebar.c \ diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c new file mode 100644 index 0000000..8ac062d --- /dev/null +++ b/dlls/comctl32/tests/pager.c @@ -0,0 +1,204 @@ +/* + * Unit tests for the pager control + * + * Copyright 2012 Alexandre Julliard + * + * 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 + */ + +#include <windows.h> +#include <commctrl.h> + +#include "wine/test.h" +#include "msg.h" + +#define NUM_MSG_SEQUENCES 1 +#define PAGER_SEQ_INDEX 0 + +static HWND parent_wnd; + +static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR); + +static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; + +static const struct message set_child_seq[] = { + { PGM_SETCHILD, sent }, + { WM_WINDOWPOSCHANGING, sent }, + { WM_NCCALCSIZE, sent|wparam, TRUE }, + { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE }, + { WM_WINDOWPOSCHANGED, sent }, + { 0 } +}; + +static const struct message set_pos_seq[] = { + { PGM_SETPOS, sent }, + { WM_WINDOWPOSCHANGING, sent }, + { WM_NCCALCSIZE, sent|wparam, TRUE }, + { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE }, + { WM_WINDOWPOSCHANGED, sent }, + { WM_MOVE, sent|optional }, + { WM_SIZE, sent|optional }, + { 0 } +}; + +static const struct message set_pos_empty_seq[] = { + { PGM_SETPOS, sent }, + { 0 } +}; + +static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static LONG defwndproc_counter = 0; + LRESULT ret; + struct message msg; + + /* log system messages, except for painting */ + if (message < WM_USER && + message != WM_PAINT && + message != WM_ERASEBKGND && + message != WM_NCPAINT && + message != WM_NCHITTEST && + message != WM_GETTEXT && + message != WM_GETICON && + message != WM_DEVICECHANGE) + { + trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); + + msg.message = message; + msg.flags = sent|wparam|lparam|parent; + if (defwndproc_counter) msg.flags |= defwinproc; + msg.wParam = wParam; + msg.lParam = lParam; + if (message == WM_NOTIFY && lParam) msg.id = ((NMHDR*)lParam)->code; + add_message(sequences, PAGER_SEQ_INDEX, &msg); + } + + defwndproc_counter++; + ret = DefWindowProcA(hwnd, message, wParam, lParam); + defwndproc_counter--; + + return ret; +} + +static BOOL register_parent_wnd_class(void) +{ + WNDCLASSA cls; + + cls.style = 0; + cls.lpfnWndProc = parent_wnd_proc; + cls.cbClsExtra = 0; + cls.cbWndExtra = 0; + cls.hInstance = GetModuleHandleA(NULL); + cls.hIcon = 0; + cls.hCursor = LoadCursorA(0, IDC_ARROW); + cls.hbrBackground = GetStockObject(WHITE_BRUSH); + cls.lpszMenuName = NULL; + cls.lpszClassName = "Pager test parent class"; + return RegisterClassA(&cls); +} + +static HWND create_parent_window(void) +{ + if (!register_parent_wnd_class()) + return NULL; + + return CreateWindow("Pager test parent class", "Pager test parent window", + WS_OVERLAPPED | WS_VISIBLE, + 0, 0, 200, 200, 0, NULL, GetModuleHandleA(NULL), NULL ); +} + +static LRESULT WINAPI pager_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); + struct message msg; + + trace("pager: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam); + + msg.message = message; + msg.flags = sent|wparam|lparam; + msg.wParam = wParam; + msg.lParam = lParam; + msg.id = 0; + add_message(sequences, PAGER_SEQ_INDEX, &msg); + return CallWindowProcA(oldproc, hwnd, message, wParam, lParam); +} + +static HWND create_pager_control( DWORD style ) +{ + WNDPROC oldproc; + HWND hwnd; + RECT rect; + + GetClientRect( parent_wnd, &rect ); + hwnd = CreateWindowA( WC_PAGESCROLLERA, "pager", WS_CHILD | WS_BORDER | WS_VISIBLE | style, + 0, 0, 100, 100, parent_wnd, 0, GetModuleHandleA(0), 0 ); + oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)pager_subclass_proc); + SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc); + return hwnd; +} + +static void test_pager(void) +{ + HWND pager, child; + RECT rect; + + pager = create_pager_control( PGS_HORZ ); + if (!pager) + { + win_skip( "Pager control not supported\n" ); + return; + } + child = CreateWindowA( "BUTTON", "button", WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 300, 300, + pager, 0, GetModuleHandleA(0), 0 ); + + flush_sequences( sequences, NUM_MSG_SEQUENCES ); + SendMessageA( pager, PGM_SETCHILD, 0, (LPARAM)child ); + ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "set child", TRUE); + GetWindowRect( pager, &rect ); + ok( rect.right - rect.left == 100 && rect.bottom - rect.top == 100, + "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top ); + + flush_sequences( sequences, NUM_MSG_SEQUENCES ); + SendMessageA( pager, PGM_SETPOS, 0, 10 ); + ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE); + GetWindowRect( pager, &rect ); + ok( rect.right - rect.left == 100 && rect.bottom - rect.top == 100, + "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top ); + + flush_sequences( sequences, NUM_MSG_SEQUENCES ); + SendMessageA( pager, PGM_SETPOS, 0, 10 ); + ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_empty_seq, "set pos empty", TRUE); + + flush_sequences( sequences, NUM_MSG_SEQUENCES ); + SendMessageA( pager, PGM_SETPOS, 0, 9 ); + ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE); + + DestroyWindow( pager ); +} + +START_TEST(pager) +{ + HMODULE mod = GetModuleHandleA("comctl32.dll"); + + pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410); + + InitCommonControls(); + init_msg_sequences(sequences, NUM_MSG_SEQUENCES); + + parent_wnd = create_parent_window(); + ok(parent_wnd != NULL, "Failed to create parent window!\n"); + + test_pager(); +}
1
0
0
0
Alexandre Julliard : comctl32/pager: Don' t rely on PGN_CALCSIZE to set the non-scrollable dimension of the control.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 3ad9f29e02208c628d8b00bdd0384bac3d97610d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3ad9f29e02208c628d8b00bdd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 20 17:18:17 2012 +0100 comctl32/pager: Don't rely on PGN_CALCSIZE to set the non-scrollable dimension of the control. --- dlls/comctl32/pager.c | 109 +++++++----------------------------------------- 1 files changed, 16 insertions(+), 93 deletions(-) diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c index d541374..3b2c11c 100644 --- a/dlls/comctl32/pager.c +++ b/dlls/comctl32/pager.c @@ -205,22 +205,24 @@ PAGER_GetBkColor(const PAGER_INFO *infoPtr) } static void -PAGER_CalcSize (const PAGER_INFO *infoPtr, INT* size, BOOL getWidth) +PAGER_CalcSize( PAGER_INFO *infoPtr ) { NMPGCALCSIZE nmpgcs; ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); nmpgcs.hdr.hwndFrom = infoPtr->hwndSelf; nmpgcs.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID); nmpgcs.hdr.code = PGN_CALCSIZE; - nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT; - nmpgcs.iWidth = getWidth ? *size : 0; - nmpgcs.iHeight = getWidth ? 0 : *size; + nmpgcs.dwFlag = (infoPtr->dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT; + nmpgcs.iWidth = infoPtr->nWidth; + nmpgcs.iHeight = infoPtr->nHeight; SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs); - *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight; + if (infoPtr->dwStyle & PGS_HORZ) + infoPtr->nWidth = nmpgcs.iWidth; + else + infoPtr->nHeight = nmpgcs.iHeight; - TRACE("[%p] PGN_CALCSIZE returns %s=%d\n", infoPtr->hwndSelf, - getWidth ? "width" : "height", *size); + TRACE("[%p] PGN_CALCSIZE returns %dx%d\n", infoPtr->hwndSelf, nmpgcs.iWidth, nmpgcs.iHeight ); } static void @@ -281,16 +283,15 @@ PAGER_GetScrollRange(PAGER_INFO* infoPtr) RECT wndRect; GetWindowRect(infoPtr->hwndSelf, &wndRect); + PAGER_CalcSize(infoPtr); if (infoPtr->dwStyle & PGS_HORZ) { wndSize = wndRect.right - wndRect.left; - PAGER_CalcSize(infoPtr, &infoPtr->nWidth, TRUE); childSize = infoPtr->nWidth; } else { wndSize = wndRect.bottom - wndRect.top; - PAGER_CalcSize(infoPtr, &infoPtr->nHeight, FALSE); childSize = infoPtr->nHeight; } @@ -415,68 +416,6 @@ PAGER_WindowPosChanging(PAGER_INFO* infoPtr, WINDOWPOS *winpos) return DefWindowProcW (infoPtr->hwndSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM)winpos); } -static INT -PAGER_SetFixedWidth(PAGER_INFO* infoPtr) -{ - /* Must set the non-scrollable dimension to be less than the full height/width - * so that NCCalcSize is called. The Microsoft docs mention 3/4 factor for button - * size, and experimentation shows that the effect is almost right. */ - - RECT wndRect; - INT delta, h; - GetWindowRect(infoPtr->hwndSelf, &wndRect); - - /* see what the app says for btn width */ - PAGER_CalcSize(infoPtr, &infoPtr->nWidth, TRUE); - - if (infoPtr->dwStyle & CCS_NORESIZE) - { - delta = wndRect.right - wndRect.left - infoPtr->nWidth; - if (delta > infoPtr->nButtonSize) - infoPtr->nWidth += 4 * infoPtr->nButtonSize / 3; - else if (delta > 0) - infoPtr->nWidth += infoPtr->nButtonSize / 3; - } - - h = wndRect.bottom - wndRect.top + infoPtr->nButtonSize; - - TRACE("[%p] infoPtr->nWidth set to %d\n", - infoPtr->hwndSelf, infoPtr->nWidth); - - return h; -} - -static INT -PAGER_SetFixedHeight(PAGER_INFO* infoPtr) -{ - /* Must set the non-scrollable dimension to be less than the full height/width - * so that NCCalcSize is called. The Microsoft docs mention 3/4 factor for button - * size, and experimentation shows that the effect is almost right. */ - - RECT wndRect; - INT delta, w; - GetWindowRect(infoPtr->hwndSelf, &wndRect); - - /* see what the app says for btn height */ - PAGER_CalcSize(infoPtr, &infoPtr->nHeight, FALSE); - - if (infoPtr->dwStyle & CCS_NORESIZE) - { - delta = wndRect.bottom - wndRect.top - infoPtr->nHeight; - if (delta > infoPtr->nButtonSize) - infoPtr->nHeight += infoPtr->nButtonSize; - else if (delta > 0) - infoPtr->nHeight += infoPtr->nButtonSize / 3; - } - - w = wndRect.right - wndRect.left + infoPtr->nButtonSize; - - TRACE("[%p] infoPtr->nHeight set to %d\n", - infoPtr->hwndSelf, infoPtr->nHeight); - - return w; -} - /****************************************************************** * For the PGM_RECALCSIZE message (but not the other uses in * * this module), the native control does only the following: * @@ -561,28 +500,14 @@ PAGER_SetButtonSize (PAGER_INFO* infoPtr, INT iButtonSize) static LRESULT PAGER_SetChild (PAGER_INFO* infoPtr, HWND hwndChild) { - INT hw; - infoPtr->hwndChild = IsWindow (hwndChild) ? hwndChild : 0; if (infoPtr->hwndChild) { TRACE("[%p] hwndChild=%p\n", infoPtr->hwndSelf, infoPtr->hwndChild); - if (infoPtr->dwStyle & PGS_HORZ) { - hw = PAGER_SetFixedHeight(infoPtr); - /* adjust non-scrollable dimension to fit the child */ - SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, hw, infoPtr->nHeight, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | - SWP_NOSIZE | SWP_NOACTIVATE); - } - else { - hw = PAGER_SetFixedWidth(infoPtr); - /* adjust non-scrollable dimension to fit the child */ - SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->nWidth, hw, - SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | - SWP_NOSIZE | SWP_NOACTIVATE); - } + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, + SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); /* position child within the page scroller */ SetWindowPos(infoPtr->hwndChild, HWND_TOP, @@ -721,11 +646,12 @@ PAGER_NCCalcSize(PAGER_INFO* infoPtr, WPARAM wParam, LPRECT lpRect) MapWindowPoints (0, infoPtr->hwndSelf, (LPPOINT)&rcChild, 2); /* FIXME: RECT != 2 POINTS */ GetWindowRect (infoPtr->hwndSelf, &rcWindow); + infoPtr->nWidth = lpRect->right - lpRect->left; + infoPtr->nHeight = lpRect->bottom - lpRect->top; + PAGER_CalcSize( infoPtr ); + if (infoPtr->dwStyle & PGS_HORZ) { - infoPtr->nWidth = lpRect->right - lpRect->left; - PAGER_CalcSize (infoPtr, &infoPtr->nWidth, TRUE); - if (infoPtr->TLbtnState && (lpRect->left + infoPtr->nButtonSize < lpRect->right)) lpRect->left += infoPtr->nButtonSize; if (infoPtr->BRbtnState && (lpRect->right - infoPtr->nButtonSize > lpRect->left)) @@ -733,9 +659,6 @@ PAGER_NCCalcSize(PAGER_INFO* infoPtr, WPARAM wParam, LPRECT lpRect) } else { - infoPtr->nHeight = lpRect->bottom - lpRect->top; - PAGER_CalcSize (infoPtr, &infoPtr->nHeight, FALSE); - if (infoPtr->TLbtnState && (lpRect->top + infoPtr->nButtonSize < lpRect->bottom)) lpRect->top += infoPtr->nButtonSize; if (infoPtr->BRbtnState && (lpRect->bottom - infoPtr->nButtonSize > lpRect->top))
1
0
0
0
Alexandre Julliard : comctl32/pager: Fix tracking of mouse position inside the buttons.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 7a78eed463903639f39458b23b6e8403963f8367 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7a78eed463903639f39458b23…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 20 16:02:09 2012 +0100 comctl32/pager: Fix tracking of mouse position inside the buttons. --- dlls/comctl32/pager.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c index c270723..d541374 100644 --- a/dlls/comctl32/pager.c +++ b/dlls/comctl32/pager.c @@ -314,9 +314,10 @@ PAGER_UpdateBtns(PAGER_INFO *infoPtr, INT scrollRange, BOOL hideGrayBtns) RECT rcTopLeft, rcBottomRight; /* get button rects */ - PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, FALSE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, TRUE); GetCursorPos(&pt); + ScreenToClient( infoPtr->hwndSelf, &pt ); /* update states based on scroll position */ if (infoPtr->nPos > 0) @@ -324,7 +325,7 @@ PAGER_UpdateBtns(PAGER_INFO *infoPtr, INT scrollRange, BOOL hideGrayBtns) if (infoPtr->TLbtnState == PGF_INVISIBLE || infoPtr->TLbtnState == PGF_GRAYED) infoPtr->TLbtnState = PGF_NORMAL; } - else if (PtInRect(&rcTopLeft, pt)) + else if (!hideGrayBtns && PtInRect(&rcTopLeft, pt)) infoPtr->TLbtnState = PGF_GRAYED; else infoPtr->TLbtnState = PGF_INVISIBLE; @@ -339,7 +340,7 @@ PAGER_UpdateBtns(PAGER_INFO *infoPtr, INT scrollRange, BOOL hideGrayBtns) if (infoPtr->BRbtnState == PGF_INVISIBLE || infoPtr->BRbtnState == PGF_GRAYED) infoPtr->BRbtnState = PGF_NORMAL; } - else if (PtInRect(&rcBottomRight, pt)) + else if (!hideGrayBtns && PtInRect(&rcBottomRight, pt)) infoPtr->BRbtnState = PGF_GRAYED; else infoPtr->BRbtnState = PGF_INVISIBLE;
1
0
0
0
Alexandre Julliard : comctl32/pager: Use DrawFrameControl to paint the buttons.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: f3b8e68296767f77da98f944d332fc996a047e68 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f3b8e68296767f77da98f944d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 20 16:01:47 2012 +0100 comctl32/pager: Use DrawFrameControl to paint the buttons. --- dlls/comctl32/pager.c | 173 ++++++------------------------------------------- 1 files changed, 20 insertions(+), 153 deletions(-) diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c index e1420e0..c270723 100644 --- a/dlls/comctl32/pager.c +++ b/dlls/comctl32/pager.c @@ -84,9 +84,6 @@ typedef struct INT direction; /* direction of the scroll, (e.g. PGF_SCROLLUP) */ } PAGER_INFO; -#define MIN_ARROW_WIDTH 8 -#define MIN_ARROW_HEIGHT 5 - #define TIMERID1 1 #define TIMERID2 2 #define INITIAL_DELAY 500 @@ -116,115 +113,13 @@ PAGER_GetButtonRects(const PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBotto } } -/* the horizontal arrows are: - * - * 01234 01234 - * 1 * * - * 2 ** ** - * 3*** *** - * 4*** *** - * 5 ** ** - * 6 * * - * 7 - * - */ -static void -PAGER_DrawHorzArrow (HDC hdc, RECT r, INT colorRef, BOOL left) -{ - INT x, y, w, h; - HPEN hPen, hOldPen; - - w = r.right - r.left + 1; - h = r.bottom - r.top + 1; - if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT)) - return; /* refuse to draw partial arrow */ - - if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return; - hOldPen = SelectObject ( hdc, hPen ); - if (left) - { - x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 3; - y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 1; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x--, y+5); y++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x--, y+3); y++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x, y+1); - } - else - { - x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1; - y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 1; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x++, y+5); y++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x++, y+3); y++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x, y+1); - } - - SelectObject( hdc, hOldPen ); - DeleteObject( hPen ); -} - -/* the vertical arrows are: - * - * 01234567 01234567 - * 1****** ** - * 2 **** **** - * 3 ** ****** - * 4 - * - */ -static void -PAGER_DrawVertArrow (HDC hdc, RECT r, INT colorRef, BOOL up) -{ - INT x, y, w, h; - HPEN hPen, hOldPen; - - w = r.right - r.left + 1; - h = r.bottom - r.top + 1; - if ((h < MIN_ARROW_WIDTH) || (w < MIN_ARROW_HEIGHT)) - return; /* refuse to draw partial arrow */ - - if (!(hPen = CreatePen( PS_SOLID, 1, GetSysColor( colorRef )))) return; - hOldPen = SelectObject ( hdc, hPen ); - if (up) - { - x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1; - y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 3; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+5, y--); x++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+3, y--); x++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+1, y); - } - else - { - x = r.left + ((w - MIN_ARROW_HEIGHT) / 2) + 1; - y = r.top + ((h - MIN_ARROW_WIDTH) / 2) + 1; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+5, y++); x++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+3, y++); x++; - MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+1, y); - } - - SelectObject( hdc, hOldPen ); - DeleteObject( hPen ); -} - static void -PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect, +PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT rc, BOOL horz, BOOL topLeft, INT btnState) { - HBRUSH hBrush, hOldBrush; - RECT rc = arrowRect; + UINT flags; - TRACE("arrowRect = %s, btnState = %d\n", wine_dbgstr_rect(&arrowRect), btnState); + TRACE("rc = %s, btnState = %d\n", wine_dbgstr_rect(&rc), btnState); if (btnState == PGF_INVISIBLE) return; @@ -232,54 +127,26 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect, if ((rc.right - rc.left <= 0) || (rc.bottom - rc.top <= 0)) return; - hBrush = CreateSolidBrush(clrBk); - hOldBrush = SelectObject(hdc, hBrush); - - FillRect(hdc, &rc, hBrush); + if (horz) + flags = topLeft ? DFCS_SCROLLLEFT : DFCS_SCROLLRIGHT; + else + flags = topLeft ? DFCS_SCROLLUP : DFCS_SCROLLDOWN; - if (btnState == PGF_HOT) + switch (btnState) { - DrawEdge( hdc, &rc, BDR_RAISEDINNER, BF_RECT); - if (horz) - PAGER_DrawHorzArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); - else - PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); - } - else if (btnState == PGF_NORMAL) - { - DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); - if (horz) - PAGER_DrawHorzArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); - else - PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); - } - else if (btnState == PGF_DEPRESSED) - { - DrawEdge( hdc, &rc, BDR_SUNKENOUTER, BF_RECT); - if (horz) - PAGER_DrawHorzArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); - else - PAGER_DrawVertArrow(hdc, rc, COLOR_WINDOWFRAME, topLeft); - } - else if (btnState == PGF_GRAYED) - { - DrawEdge (hdc, &rc, BDR_OUTER, BF_FLAT); - if (horz) - { - PAGER_DrawHorzArrow(hdc, rc, COLOR_3DHIGHLIGHT, topLeft); - rc.left++, rc.top++; rc.right++, rc.bottom++; - PAGER_DrawHorzArrow(hdc, rc, COLOR_3DSHADOW, topLeft); - } - else - { - PAGER_DrawVertArrow(hdc, rc, COLOR_3DHIGHLIGHT, topLeft); - rc.left++, rc.top++; rc.right++, rc.bottom++; - PAGER_DrawVertArrow(hdc, rc, COLOR_3DSHADOW, topLeft); - } + case PGF_HOT: + break; + case PGF_NORMAL: + flags |= DFCS_FLAT; + break; + case PGF_DEPRESSED: + flags |= DFCS_PUSHED; + break; + case PGF_GRAYED: + flags |= DFCS_INACTIVE | DFCS_FLAT; + break; } - - SelectObject( hdc, hOldBrush ); - DeleteObject(hBrush); + DrawFrameControl( hdc, &rc, DFC_SCROLL, flags ); } /* << PAGER_GetDropTarget >> */
1
0
0
0
Akihiro Sagawa : winmm/tests: Add EOF and buffer pointer tests for mmio.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 1aa15750edf060b12a50b547ebadb086d9fc9ca2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1aa15750edf060b12a50b547e…
Author: Akihiro Sagawa <sagawa.aki(a)gmail.com> Date: Wed Nov 14 19:20:03 2012 +0900 winmm/tests: Add EOF and buffer pointer tests for mmio. --- dlls/winmm/tests/mmio.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 106 insertions(+), 0 deletions(-) diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c index a4e7a2d..232f84b 100644 --- a/dlls/winmm/tests/mmio.c +++ b/dlls/winmm/tests/mmio.c @@ -787,6 +787,110 @@ static void test_mmioSeek(void) DeleteFileA(test_file); } +static void test_mmio_end_of_file(void) +{ + char test_file[MAX_PATH], buffer[128], data[16]; + MMIOINFO mmio; + HMMIO hmmio; + LONG ret; + MMRESULT res; + + if (!create_test_file(test_file)) return; + + memset(&mmio, 0, sizeof(mmio)); + mmio.fccIOProc = FOURCC_DOS; + mmio.pchBuffer = buffer; + mmio.cchBuffer = sizeof(buffer); + hmmio = mmioOpen(test_file, &mmio, MMIO_READ); + ok(hmmio != NULL, "mmioOpen error %u\n", mmio.wErrorRet); + if (hmmio == NULL) { + DeleteFileA(test_file); + return; + } + + ret = mmioSeek(hmmio, 0, SEEK_END); + ok(sizeof(RIFF_buf) == ret, "got %d\n", ret); + + ret = mmioRead(hmmio, data, sizeof(data)); + todo_wine ok(ret == 0, "expected %d, got %d\n", 0, ret); + + res = mmioGetInfo(hmmio, &mmio, 0); + ok(res == MMSYSERR_NOERROR, "expected 0, got %d\n", res); + + res = mmioAdvance(hmmio, &mmio, MMIO_READ); + ok(res == MMSYSERR_NOERROR, "expected 0, got %d\n", res); + todo_wine ok(mmio.pchNext == mmio.pchEndRead, "expected %p, got %p\n", mmio.pchEndRead, mmio.pchNext); + + mmioClose(hmmio, 0); + DeleteFileA(test_file); +} + +static void test_mmio_buffer_pointer(void) +{ + char test_file[MAX_PATH]; + char buffer[5], data[16]; + MMIOINFO mmio; + HMMIO hmmio; + LONG size, pos; + MMRESULT res; + + if (!create_test_file(test_file)) return; + + memset(&mmio, 0, sizeof(mmio)); + mmio.fccIOProc = FOURCC_DOS; + mmio.pchBuffer = buffer; + mmio.cchBuffer = sizeof(buffer); + hmmio = mmioOpen(test_file, &mmio, MMIO_READ); + ok(hmmio != NULL, "mmioOpen error %u\n", mmio.wErrorRet); + if (hmmio == NULL) { + DeleteFileA(test_file); + return; + } + + /* the buffer is empty */ + size = mmioRead(hmmio, data, 0); + ok(size == 0, "expected 0, got %d\n", size); + res = mmioGetInfo(hmmio, &mmio, 0); + ok(res == MMSYSERR_NOERROR, "expected 0, got %d\n", res); + ok(mmio.pchEndRead == mmio.pchBuffer, "expected %p, got %p\n", mmio.pchBuffer, mmio.pchEndRead); + + /* fill the buffer */ + size = mmioAdvance(hmmio, &mmio, MMIO_READ); + ok(mmio.pchEndRead-mmio.pchBuffer == sizeof(buffer), "got %d\n", (int)(mmio.pchEndRead-mmio.pchBuffer)); + + /* seeking to the same buffer chunk, the buffer is kept */ + size = sizeof(buffer)/2; + pos = mmioSeek(hmmio, size, SEEK_SET); + ok(pos == size, "failed to seek, expected %d, got %d\n", size, pos); + res = mmioGetInfo(hmmio, &mmio, 0); + ok(res == MMSYSERR_NOERROR, "expected 0, got %d\n", res); + ok(mmio.lBufOffset == 0, "expected 0, got %d\n", mmio.lBufOffset); + ok(mmio.pchNext-mmio.pchBuffer == size, "expected %d, got %d\n", size, (int)(mmio.pchNext-mmio.pchBuffer)); + ok(mmio.pchEndRead-mmio.pchBuffer == sizeof(buffer), "got %d\n", (int)(mmio.pchEndRead-mmio.pchBuffer)); + + /* seeking to another buffer chunk, the buffer is empty */ + size = sizeof(buffer) * 3 + sizeof(buffer) / 2; + pos = mmioSeek(hmmio, size, SEEK_SET); + ok(pos == size, "failed to seek, got %d\n", pos); + res = mmioGetInfo(hmmio, &mmio, 0); + ok(res == MMSYSERR_NOERROR, "expected 0, got %d\n", res); + todo_wine ok(mmio.lBufOffset == size, "expected %d, got %d\n", size, mmio.lBufOffset); + todo_wine ok(mmio.pchNext == mmio.pchBuffer, "expected %p, got %p\n", mmio.pchBuffer, mmio.pchNext); + todo_wine ok(mmio.pchEndRead == mmio.pchBuffer, "expected %p, got %p\n", mmio.pchBuffer, mmio.pchEndRead); + + /* reading a lot (as sizeof(data) > mmio.cchBuffer), the buffer is empty */ + size = mmioRead(hmmio, data, sizeof(data)); + ok(size == sizeof(data), "failed to read, got %d\n", size); + res = mmioGetInfo(hmmio, &mmio, 0); + ok(res == MMSYSERR_NOERROR, "expected 0, got %d\n", res); + todo_wine ok(mmio.lBufOffset == pos+size, "expected %d, got %d\n", pos+size, mmio.lBufOffset); + todo_wine ok(mmio.pchNext == mmio.pchBuffer, "expected %p, got %p\n", mmio.pchBuffer, mmio.pchNext); + todo_wine ok(mmio.pchEndRead == mmio.pchBuffer, "expected %p, got %p\n", mmio.pchBuffer, mmio.pchEndRead); + + mmioClose(hmmio, 0); + DeleteFileA(test_file); +} + START_TEST(mmio) { /* Make it possible to run the tests against a specific AVI file in @@ -803,4 +907,6 @@ START_TEST(mmio) test_mmioSetBuffer(fname); test_mmioOpen_fourcc(); test_mmioSeek(); + test_mmio_end_of_file(); + test_mmio_buffer_pointer(); }
1
0
0
0
Dmitry Timoshkov : windowscodecs: Test QueryCapability of the TIFF decoder.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: a98fe810a4af56626bc5c1475eb8032a137d6389 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a98fe810a4af56626bc5c1475…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Nov 20 18:37:08 2012 +0800 windowscodecs: Test QueryCapability of the TIFF decoder. --- dlls/windowscodecs/tests/tiffformat.c | 148 ++++++++++++++++++++++++++++----- 1 files changed, 128 insertions(+), 20 deletions(-) diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c index 0874053..9b5db52 100644 --- a/dlls/windowscodecs/tests/tiffformat.c +++ b/dlls/windowscodecs/tests/tiffformat.c @@ -94,6 +94,8 @@ static const struct tiff_1bpp_data }; #include "poppack.h" +static IWICImagingFactory *factory; + static const char *debugstr_guid(const GUID *guid) { static char buf[50]; @@ -106,23 +108,35 @@ static const char *debugstr_guid(const GUID *guid) return buf; } -static IWICBitmapDecoder *create_decoder(IWICImagingFactory *factory, - const void *image_data, UINT image_size) +static IStream *create_stream(const void *data, int data_size) { - HGLOBAL hmem; - BYTE *data; HRESULT hr; - IWICBitmapDecoder *decoder = NULL; IStream *stream; - GUID guid; + HGLOBAL hdata; + void *locked_data; + + hdata = GlobalAlloc(GMEM_MOVEABLE, data_size); + ok(hdata != 0, "GlobalAlloc failed\n"); + if (!hdata) return NULL; - hmem = GlobalAlloc(0, image_size); - data = GlobalLock(hmem); - memcpy(data, image_data, image_size); - GlobalUnlock(hmem); + locked_data = GlobalLock(hdata); + memcpy(locked_data, data, data_size); + GlobalUnlock(hdata); - hr = CreateStreamOnHGlobal(hmem, TRUE, &stream); - ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr); + hr = CreateStreamOnHGlobal(hdata, TRUE, &stream); + ok(hr == S_OK, "CreateStreamOnHGlobal failed, hr=%x\n", hr); + + return stream; +} + +static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size) +{ + HRESULT hr; + IStream *stream; + IWICBitmapDecoder *decoder = NULL; + GUID guid; + + stream = create_stream(image_data, image_size); hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder); ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr); @@ -139,19 +153,14 @@ static IWICBitmapDecoder *create_decoder(IWICImagingFactory *factory, static void test_tiff_palette(void) { HRESULT hr; - IWICImagingFactory *factory; IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *frame; IWICPalette *palette; GUID format; - hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, - &IID_IWICImagingFactory, (void **)&factory); - ok(hr == S_OK, "CoCreateInstance error %#x\n", hr); - if (FAILED(hr)) return; - - decoder = create_decoder(factory, &tiff_1bpp_data, sizeof(tiff_1bpp_data)); + decoder = create_decoder(&tiff_1bpp_data, sizeof(tiff_1bpp_data)); ok(decoder != 0, "Failed to load TIFF image data\n"); + hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); ok(hr == S_OK, "GetFrame error %#x\n", hr); @@ -169,14 +178,113 @@ static void test_tiff_palette(void) IWICPalette_Release(palette); IWICBitmapFrameDecode_Release(frame); IWICBitmapDecoder_Release(decoder); - IWICImagingFactory_Release(factory); +} + +static void test_QueryCapability(void) +{ + HRESULT hr; + IStream *stream; + IWICBitmapDecoder *decoder; + static const DWORD exp_caps = WICBitmapDecoderCapabilityCanDecodeAllImages | + WICBitmapDecoderCapabilityCanDecodeSomeImages | + WICBitmapDecoderCapabilityCanEnumerateMetadata; + static const DWORD exp_caps_xp = WICBitmapDecoderCapabilityCanDecodeAllImages | + WICBitmapDecoderCapabilityCanDecodeSomeImages; + DWORD capability; + LARGE_INTEGER pos; + ULARGE_INTEGER cur_pos; + UINT frame_count; + + stream = create_stream(&tiff_1bpp_data, sizeof(tiff_1bpp_data)); + if (!stream) return; + + hr = IWICImagingFactory_CreateDecoder(factory, &GUID_ContainerFormatTiff, NULL, &decoder); + ok(hr == S_OK, "CreateDecoder error %#x\n", hr); + + frame_count = 0xdeadbeef; + hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); +todo_wine + ok(hr == S_OK || broken(hr == E_POINTER) /* XP */, "GetFrameCount error %#x\n", hr); +todo_wine + ok(frame_count == 0, "expected 0, got %u\n", frame_count); + + pos.QuadPart = 4; + hr = IStream_Seek(stream, pos, SEEK_SET, NULL); + ok(hr == S_OK, "IStream_Seek error %#x\n", hr); + + capability = 0xdeadbeef; + hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability); +todo_wine + ok(hr == S_OK, "QueryCapability error %#x\n", hr); +todo_wine + ok(capability == exp_caps || capability == exp_caps_xp, + "expected %#x, got %#x\n", exp_caps, capability); + + frame_count = 0xdeadbeef; + hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); +todo_wine + ok(hr == S_OK, "GetFrameCount error %#x\n", hr); +todo_wine + ok(frame_count == 1, "expected 1, got %u\n", frame_count); + + pos.QuadPart = 0; + hr = IStream_Seek(stream, pos, SEEK_CUR, &cur_pos); + ok(hr == S_OK, "IStream_Seek error %#x\n", hr); +todo_wine + ok(cur_pos.QuadPart > 4 && cur_pos.QuadPart < sizeof(tiff_1bpp_data), + "current stream pos is at %x/%x\n", cur_pos.u.LowPart, cur_pos.u.HighPart); + + hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability); +todo_wine + ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr); + + hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand); +todo_wine + ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr); + + IWICBitmapDecoder_Release(decoder); + + hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder); +todo_wine + ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND, "expected WINCODEC_ERR_COMPONENTNOTFOUND, got %#x\n", hr); + + pos.QuadPart = 0; + hr = IStream_Seek(stream, pos, SEEK_SET, NULL); + ok(hr == S_OK, "IStream_Seek error %#x\n", hr); + + hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder); + ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr); + + frame_count = 0xdeadbeef; + hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count); + ok(hr == S_OK, "GetFrameCount error %#x\n", hr); + ok(frame_count == 1, "expected 1, got %u\n", frame_count); + + hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnDemand); + ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr); + + hr = IWICBitmapDecoder_QueryCapability(decoder, stream, &capability); +todo_wine + ok(hr == WINCODEC_ERR_WRONGSTATE, "expected WINCODEC_ERR_WRONGSTATE, got %#x\n", hr); + + IWICBitmapDecoder_Release(decoder); + IStream_Release(stream); } START_TEST(tiffformat) { + HRESULT hr; + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICImagingFactory, (void **)&factory); + ok(hr == S_OK, "CoCreateInstance error %#x\n", hr); + if (FAILED(hr)) return; + test_tiff_palette(); + test_QueryCapability(); + IWICImagingFactory_Release(factory); CoUninitialize(); }
1
0
0
0
Frédéric Delanoy : msi: Fix a couple of leaks ( coverity).
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: fcbc5cc5bb5af7fced9c282dbf250a1941342898 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fcbc5cc5bb5af7fced9c282db…
Author: Frédéric Delanoy <frederic.delanoy(a)gmail.com> Date: Fri Nov 16 18:38:02 2012 +0100 msi: Fix a couple of leaks (coverity). --- dlls/msi/files.c | 6 ++++-- dlls/msi/package.c | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 11913ef..d831313 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -336,7 +336,8 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) { ERR("Unable to load media info for %s (%u)\n", debugstr_w(file->File), rc); - return ERROR_FUNCTION_FAILED; + rc = ERROR_FUNCTION_FAILED; + goto done; } if (!file->Component->Enabled) continue; @@ -513,7 +514,8 @@ UINT ACTION_PatchFiles( MSIPACKAGE *package ) if (rc != ERROR_SUCCESS) { ERR("Unable to load media info for %s (%u)\n", debugstr_w(file->File), rc); - return ERROR_FUNCTION_FAILED; + rc = ERROR_FUNCTION_FAILED; + goto done; } comp->Action = msi_get_component_action( package, comp ); if (!comp->Enabled || comp->Action != INSTALLSTATE_LOCAL) continue; diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 015af00..3055175 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -1567,13 +1567,17 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) { r = msi_create_empty_local_file( localfile, dotmsi ); if (r != ERROR_SUCCESS) + { + msi_free ( base_url ); return r; + } if (!CopyFileW( file, localfile, FALSE )) { r = GetLastError(); WARN("unable to copy package %s to %s (%u)\n", debugstr_w(file), debugstr_w(localfile), r); DeleteFileW( localfile ); + msi_free ( base_url ); return r; } delete_on_close = TRUE; @@ -1581,7 +1585,10 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage) TRACE("opening package %s\n", debugstr_w( localfile )); r = MSI_OpenDatabaseW( localfile, MSIDBOPEN_TRANSACT, &db ); if (r != ERROR_SUCCESS) + { + msi_free ( base_url ); return r; + } } package = MSI_CreatePackage( db, base_url ); msi_free( base_url );
1
0
0
0
Christian Costa : wmvcore: Add stub for DllRegisterServer.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 37419c4af206828a218e49e663ebc544d02d2e86 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=37419c4af206828a218e49e66…
Author: Christian Costa <titan.costa(a)gmail.com> Date: Fri Nov 16 15:13:14 2012 +0100 wmvcore: Add stub for DllRegisterServer. --- dlls/wmvcore/wmvcore.spec | 2 +- dlls/wmvcore/wmvcore_main.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/dlls/wmvcore/wmvcore.spec b/dlls/wmvcore/wmvcore.spec index ee85eb6..5b7e4f1 100644 --- a/dlls/wmvcore/wmvcore.spec +++ b/dlls/wmvcore/wmvcore.spec @@ -4,7 +4,7 @@ @ stub WMCreateSyncReaderPriv @ stub WMIsAvailableOffline @ stub WMValidateData -@ stub DllRegisterServer +@ stdcall -private DllRegisterServer() @ stub WMCreateBackupRestorer @ stub WMCreateEditor @ stub WMCreateIndexer diff --git a/dlls/wmvcore/wmvcore_main.c b/dlls/wmvcore/wmvcore_main.c index 5d07159..846b8d6 100644 --- a/dlls/wmvcore/wmvcore_main.c +++ b/dlls/wmvcore/wmvcore_main.c @@ -45,6 +45,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } +HRESULT WINAPI DllRegisterServer(void) +{ + FIXME("(): stub\n"); + + return S_OK; +} + HRESULT WINAPI WMCreateReader(IUnknown *reserved, DWORD rights, IWMSyncReader **reader) { FIXME("(%p, %x, %p): stub\n", reserved, rights, reader);
1
0
0
0
Daniel Jelinski : xolehlp: Add some stubs.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: da87b102e07a0eafa87d283541ad43f55926a030 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=da87b102e07a0eafa87d28354…
Author: Daniel Jelinski <djelinski1(a)gmail.com> Date: Sat Nov 3 23:43:36 2012 +0100 xolehlp: Add some stubs. --- dlls/xolehlp/xolehlp.c | 24 ++++++++++++++++++++++++ dlls/xolehlp/xolehlp.spec | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/xolehlp/xolehlp.c b/dlls/xolehlp/xolehlp.c index 3b970ef..9573744 100644 --- a/dlls/xolehlp/xolehlp.c +++ b/dlls/xolehlp/xolehlp.c @@ -39,3 +39,27 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) } return TRUE; } + +HRESULT WINAPI DtcGetTransactionManager(char *host, char *tm_name, REFIID riid, + DWORD dwReserved1, WORD wcbReserved2, void *pvReserved2, void **ppv) +{ + FIXME("(%s, %s, %s, %d, %d, %p, %p): stub\n", debugstr_a(host), debugstr_a(tm_name), + debugstr_guid(riid), dwReserved1, wcbReserved2, pvReserved2, ppv); + return E_NOTIMPL; +} + +HRESULT WINAPI DtcGetTransactionManagerExA(CHAR *host, CHAR *tm_name, REFIID riid, + DWORD options, void *config, void **ppv) +{ + FIXME("(%s, %s, %s, %d, %p, %p): stub\n", debugstr_a(host), debugstr_a(tm_name), + debugstr_guid(riid), options, config, ppv); + return E_NOTIMPL; +} + +HRESULT WINAPI DtcGetTransactionManagerExW(WCHAR *host, WCHAR *tm_name, REFIID riid, + DWORD options, void *config, void **ppv) +{ + FIXME("(%s, %s, %s, %d, %p, %p): stub\n", debugstr_w(host), debugstr_w(tm_name), + debugstr_guid(riid), options, config, ppv); + return E_NOTIMPL; +} diff --git a/dlls/xolehlp/xolehlp.spec b/dlls/xolehlp/xolehlp.spec index f774542..0b149de 100644 --- a/dlls/xolehlp/xolehlp.spec +++ b/dlls/xolehlp/xolehlp.spec @@ -1,6 +1,6 @@ @ stub GetDtcLocaleResourceHandle -@ stub DtcGetTransactionManager +@ stdcall DtcGetTransactionManager(str str ptr long long ptr ptr) @ stub DtcGetTransactionManagerEx @ stub DtcGetTransactionManagerC -@ stub DtcGetTransactionManagerExA -@ stub DtcGetTransactionManagerExW +@ stdcall DtcGetTransactionManagerExA(str str ptr long ptr ptr) +@ stdcall DtcGetTransactionManagerExW(wstr wstr ptr long ptr ptr)
1
0
0
0
Alexandre Julliard : odbc32: Fix some data types for 64-bit.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 1ce71ab7d85629f3cc98bc51d7ca0b0d5bc90b7c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1ce71ab7d85629f3cc98bc51d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Nov 20 13:22:05 2012 +0100 odbc32: Fix some data types for 64-bit. --- dlls/odbc32/proxyodbc.c | 44 ++++++++++++++++++++++---------------------- include/sqltypes.h | 23 ++++++++++------------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 10adf16..c7a5038 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -688,7 +688,7 @@ static BOOL ODBC_LoadDMFunctions(void) SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionHandle) { SQLRETURN ret; - TRACE("Env=%lx\n",EnvironmentHandle); + TRACE("Env=%p\n",EnvironmentHandle); if (!pSQLAllocConnect) { @@ -698,7 +698,7 @@ SQLRETURN WINAPI SQLAllocConnect(SQLHENV EnvironmentHandle, SQLHDBC *ConnectionH } ret = pSQLAllocConnect(EnvironmentHandle, ConnectionHandle); - TRACE("Returns ret=%d, Handle %lx\n",ret, *ConnectionHandle); + TRACE("Returns ret=%d, Handle %p\n",ret, *ConnectionHandle); return ret; } @@ -719,7 +719,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) } ret = pSQLAllocEnv(EnvironmentHandle); - TRACE("Returns ret=%d, Env=%lx\n",ret, *EnvironmentHandle); + TRACE("Returns ret=%d, Env=%p\n",ret, *EnvironmentHandle); return ret; } @@ -730,7 +730,7 @@ SQLRETURN WINAPI SQLAllocEnv(SQLHENV *EnvironmentHandle) SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) { SQLRETURN ret; - TRACE("(Type=%d, Handle=%lx)\n",HandleType,InputHandle); + TRACE("(Type=%d, Handle=%p)\n",HandleType,InputHandle); if (!pSQLAllocHandle) { @@ -751,7 +751,7 @@ SQLRETURN WINAPI SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, S } ret = pSQLAllocHandle(HandleType, InputHandle, OutputHandle); - TRACE("Returns ret=%d, Handle=%lx\n",ret, *OutputHandle); + TRACE("Returns ret=%d, Handle=%p\n",ret, *OutputHandle); return ret; } @@ -763,7 +763,7 @@ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandl { SQLRETURN ret; - TRACE("(Connection=%lx)\n",ConnectionHandle); + TRACE("(Connection=%p)\n",ConnectionHandle); if (!pSQLAllocStmt) { @@ -773,7 +773,7 @@ SQLRETURN WINAPI SQLAllocStmt(SQLHDBC ConnectionHandle, SQLHSTMT *StatementHandl } ret = pSQLAllocStmt(ConnectionHandle, StatementHandle); - TRACE ("Returns ret=%d, Handle=%lx\n", ret, *StatementHandle); + TRACE ("Returns ret=%d, Handle=%p\n", ret, *StatementHandle); return ret; } @@ -864,7 +864,7 @@ SQLRETURN WINAPI SQLCancel(SQLHSTMT StatementHandle) SQLRETURN WINAPI SQLCloseCursor(SQLHSTMT StatementHandle) { SQLRETURN ret; - TRACE("(Handle=%lx)\n",StatementHandle); + TRACE("(Handle=%p)\n",StatementHandle); if (!pSQLCloseCursor) return SQL_ERROR; @@ -951,7 +951,7 @@ SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, { SQLRETURN ret; - TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle); + TRACE("EnvironmentHandle = %p\n", EnvironmentHandle); if (!pSQLDataSources) return SQL_ERROR; @@ -979,7 +979,7 @@ SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, { SQLRETURN ret; - TRACE("EnvironmentHandle = %p\n", (void*)EnvironmentHandle); + TRACE("EnvironmentHandle = %p\n", EnvironmentHandle); if (!pSQLDataSourcesA) return SQL_ERROR; @@ -1021,7 +1021,7 @@ SQLRETURN WINAPI SQLDescribeCol(SQLHSTMT StatementHandle, SQLRETURN WINAPI SQLDisconnect(SQLHDBC ConnectionHandle) { SQLRETURN ret; - TRACE("(Handle=%lx)\n", ConnectionHandle); + TRACE("(Handle=%p)\n", ConnectionHandle); if (!pSQLDisconnect) return SQL_ERROR; @@ -1114,7 +1114,7 @@ SQLRETURN WINAPI SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrien SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) { SQLRETURN ret; - TRACE("(Handle=%lx)\n",ConnectionHandle); + TRACE("(Handle=%p)\n",ConnectionHandle); if (!pSQLFreeConnect) return SQL_ERROR; @@ -1130,7 +1130,7 @@ SQLRETURN WINAPI SQLFreeConnect(SQLHDBC ConnectionHandle) SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) { SQLRETURN ret; - TRACE("(Env=%lx)\n",EnvironmentHandle); + TRACE("(Env=%p)\n",EnvironmentHandle); if (!pSQLFreeEnv) return SQL_ERROR; @@ -1146,7 +1146,7 @@ SQLRETURN WINAPI SQLFreeEnv(SQLHENV EnvironmentHandle) SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { SQLRETURN ret; - TRACE("(Type=%d, Handle=%lx)\n",HandleType,Handle); + TRACE("(Type=%d, Handle=%p)\n",HandleType,Handle); if (!pSQLFreeHandle) return SQL_ERROR; @@ -1162,7 +1162,7 @@ SQLRETURN WINAPI SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) SQLRETURN WINAPI SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) { SQLRETURN ret; - TRACE("(Handle %lx, Option=%d)\n",StatementHandle, Option); + TRACE("(Handle %p, Option=%d)\n",StatementHandle, Option); if (!pSQLFreeStmt) return SQL_ERROR; @@ -2039,7 +2039,7 @@ SQLRETURN WINAPI SQLColAttributesW( { SQLRETURN iResult; - TRACE("hstmt=0x%08lx icol=%d fDescType=%d rgbDesc=%p cbDescMax=%d pcbDesc=%p pfDesc=%p\n", + TRACE("hstmt=%p icol=%d fDescType=%d rgbDesc=%p cbDescMax=%d pcbDesc=%p pfDesc=%p\n", hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); if (!pSQLColAttributesW) return SQL_ERROR; @@ -2085,7 +2085,7 @@ SQLRETURN WINAPI SQLConnectW(SQLHDBC ConnectionHandle, SQLRETURN WINAPI SQLDescribeColW(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, WCHAR *ColumnName, SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, - SQLSMALLINT *DataType, SQLUINTEGER *ColumnSize, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) { SQLRETURN iResult; @@ -2182,7 +2182,7 @@ SQLRETURN WINAPI SQLColAttributeW (SQLHSTMT StatementHandle, { SQLRETURN iResult; - TRACE("StatementHandle=0x%08lx ColumnNumber=%d FieldIdentifier=%d CharacterAttribute=%p BufferLength=%d StringLength=%p NumericAttribute=%p\n", + TRACE("StatementHandle=%p ColumnNumber=%d FieldIdentifier=%d CharacterAttribute=%p BufferLength=%d StringLength=%p NumericAttribute=%p\n", StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, StringLength, NumericAttribute); @@ -2240,7 +2240,7 @@ SQLRETURN WINAPI SQLGetDescRecW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, WCHAR *Name, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLSMALLINT *Type, SQLSMALLINT *SubType, - SQLINTEGER *Length, SQLSMALLINT *Precision, + SQLLEN *Length, SQLSMALLINT *Precision, SQLSMALLINT *Scale, SQLSMALLINT *Nullable) { TRACE("\n"); @@ -2289,7 +2289,7 @@ SQLRETURN WINAPI SQLGetStmtAttrW(SQLHSTMT StatementHandle, { SQLRETURN iResult; - TRACE("Attribute = (%02ld) Value = %p BufferLength = (%ld) StringLength = %p\n", + TRACE("Attribute = (%02d) Value = %p BufferLength = (%d) StringLength = %p\n", Attribute, Value, BufferLength, StringLength); if (Value == NULL) { @@ -2507,7 +2507,7 @@ SQLRETURN WINAPI SQLDataSourcesW(SQLHENV EnvironmentHandle, { SQLRETURN ret; - TRACE("EnvironmentHandle = %p\n", (LPVOID)EnvironmentHandle); + TRACE("EnvironmentHandle = %p\n", EnvironmentHandle); if (!pSQLDataSourcesW) return SQL_ERROR; @@ -2689,7 +2689,7 @@ SQLRETURN WINAPI SQLSetStmtAttrW(SQLHSTMT StatementHandle, SQLINTEGER StringLength) { SQLRETURN iResult; - TRACE("Attribute = (%02ld) Value = %p StringLength = (%ld)\n", + TRACE("Attribute = (%02d) Value = %p StringLength = (%d)\n", Attribute, Value, StringLength); if (!pSQLSetStmtAttrW) return SQL_ERROR; diff --git a/include/sqltypes.h b/include/sqltypes.h index 5c8f3ca..4f3f8fe 100644 --- a/include/sqltypes.h +++ b/include/sqltypes.h @@ -46,7 +46,7 @@ typedef double SQLDOUBLE; typedef double SQLFLOAT; #endif -typedef long SQLINTEGER; +typedef int SQLINTEGER; #if (ODBCVER >= 0x0300) typedef unsigned char SQLNUMERIC; @@ -69,27 +69,23 @@ typedef unsigned char SQLVARCHAR; typedef SQLSMALLINT SQLRETURN; -/* typedef void * SQLHANDLE; */ - -typedef SQLINTEGER SQLHANDLE; #if (ODBCVER >= 0x0300) - +typedef void *SQLHANDLE; typedef SQLHANDLE SQLHENV; typedef SQLHANDLE SQLHDBC; typedef SQLHANDLE SQLHSTMT; typedef SQLHANDLE SQLHDESC; - #else -typedef SQLINTEGER SQLHENV; -typedef SQLINTEGER SQLHDBC; -typedef SQLINTEGER SQLHSTMT; +typedef void *SQLHENV; +typedef void *SQLHDBC; +typedef void *SQLHSTMT; #endif typedef signed char SCHAR; typedef SCHAR SQLSCHAR; -typedef long int SDWORD; +typedef int SDWORD; typedef signed short int SWORD; -typedef unsigned long int UDWORD; +typedef unsigned int UDWORD; typedef unsigned short int UWORD; typedef UDWORD SQLUINTEGER; typedef signed long SLONG; @@ -207,7 +203,8 @@ typedef struct tagSQL_INTERVAL_STRUCT #endif #if (ODBCVER >= 0x0300) -#define ODBCINT64 long +#define ODBCINT64 __int64 +#define UODBCINT64 unsigned __int64 #ifdef ODBCINT64 typedef ODBCINT64 SQLBIGINT; typedef unsigned ODBCINT64 SQLUBIGINT; @@ -240,7 +237,7 @@ typedef struct tagSQLGUID #endif -typedef unsigned long int BOOKMARK; +typedef SQLULEN BOOKMARK; #define SQL_WCHAR (-8) #define SQL_C_WCHAR SQL_WCHAR
1
0
0
0
Nikolay Sivov : oledb32: Implement IDataInitialize::GetInitializationString .
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 92013d7bd263ff07db15d38d23cc01f1c4ee06fb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=92013d7bd263ff07db15d38d2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 20 12:40:28 2012 -0500 oledb32: Implement IDataInitialize::GetInitializationString. --- dlls/oledb32/datainit.c | 199 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 194 insertions(+), 5 deletions(-) diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index b990dd8..b53e08a 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -27,13 +27,15 @@ #include "ole2.h" #include "msdasc.h" #include "oledberr.h" - +#include "initguid.h" #include "oledb_private.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(oledb); +DEFINE_GUID(DBPROPSET_DBINIT, 0xc8b522bc, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d); typedef struct datainit { @@ -288,14 +290,201 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *p return E_NOTIMPL; } -static HRESULT WINAPI datainit_GetInitializationString(IDataInitialize *iface, IUnknown *pDataSource, - boolean fIncludePassword, LPWSTR *ppwszInitString) +/* returns character length of string representation */ +static int get_propvalue_length(DBPROP *prop) +{ + VARIANT str; + HRESULT hr; + + if (V_VT(&prop->vValue) == VT_BSTR) return SysStringLen(V_BSTR(&prop->vValue)); + + VariantInit(&str); + hr = VariantChangeType(&str, &prop->vValue, 0, VT_BSTR); + if (hr == S_OK) + { + int len = SysStringLen(V_BSTR(&str)); + VariantClear(&str); + return len; + } + + return 0; +} + +static void write_propvalue_str(WCHAR *str, DBPROP *prop) +{ + VARIANT *v = &prop->vValue; + VARIANT vstr; + HRESULT hr; + + if (V_VT(v) == VT_BSTR) + { + strcatW(str, V_BSTR(v)); + return; + } + + VariantInit(&vstr); + hr = VariantChangeType(&vstr, v, VARIANT_ALPHABOOL, VT_BSTR); + if (hr == S_OK) + { + strcatW(str, V_BSTR(&vstr)); + VariantClear(&vstr); + } +} + +static WCHAR *get_propinfo_descr(DBPROP *prop, DBPROPINFOSET *propinfoset) { + int i; + + for (i = 0; i < propinfoset->cPropertyInfos; i++) + if (propinfoset->rgPropertyInfos[i].dwPropertyID == prop->dwPropertyID) + return propinfoset->rgPropertyInfos[i].pwszDescription; + + return NULL; +} + +static void free_dbpropset(ULONG count, DBPROPSET *propset) +{ + int i; + + for (i = 0; i < count; i++) + { + int p; + + for (p = 0; p < propset[i].cProperties; p++) + { + VariantClear(&propset[i].rgProperties[p].vValue); + CoTaskMemFree(&propset[i].rgProperties[p]); + } + CoTaskMemFree(&propset[i]); + } +} + +static void free_dbpropinfoset(ULONG count, DBPROPINFOSET *propinfoset) +{ + int i; + + for (i = 0; i < count; i++) + { + int p; + + for (p = 0; p < propinfoset[i].cPropertyInfos; p++) + { + VariantClear(&propinfoset[i].rgPropertyInfos[p].vValues); + CoTaskMemFree(&propinfoset[i].rgPropertyInfos[p]); + } + CoTaskMemFree(&propinfoset[i]); + } +} + +static HRESULT WINAPI datainit_GetInitializationString(IDataInitialize *iface, IUnknown *datasource, + boolean include_pass, LPWSTR *init_string) +{ + static const WCHAR provW[] = {'P','r','o','v','i','d','e','r','=',0}; + static const WCHAR colW[] = {';',0}; datainit *This = impl_from_IDataInitialize(iface); + DBPROPINFOSET *propinfoset; + IDBProperties *props; + DBPROPIDSET propidset; + ULONG count, infocount; + WCHAR *progid, *desc; + DBPROPSET *propset; + IPersist *persist; + HRESULT hr; + CLSID clsid; + int i, len; + + TRACE("(%p)->(%p %d %p)\n", This, datasource, include_pass, init_string); + + /* IPersist support is mandatory for data sources */ + hr = IUnknown_QueryInterface(datasource, &IID_IPersist, (void**)&persist); + if (FAILED(hr)) return hr; + + memset(&clsid, 0, sizeof(clsid)); + hr = IPersist_GetClassID(persist, &clsid); + IPersist_Release(persist); + if (FAILED(hr)) return hr; + + progid = NULL; + ProgIDFromCLSID(&clsid, &progid); + TRACE("clsid=%s, progid=%s\n", debugstr_guid(&clsid), debugstr_w(progid)); + + /* now get initialization properties */ + hr = IUnknown_QueryInterface(datasource, &IID_IDBProperties, (void**)&props); + if (FAILED(hr)) + { + WARN("IDBProperties not supported\n"); + CoTaskMemFree(progid); + return hr; + } - FIXME("(%p)->(%p %d %p)\n", This, pDataSource, fIncludePassword, ppwszInitString); + propidset.rgPropertyIDs = NULL; + propidset.cPropertyIDs = 0; + propidset.guidPropertySet = DBPROPSET_DBINIT; + propset = NULL; + count = 0; + hr = IDBProperties_GetProperties(props, 1, &propidset, &count, &propset); + if (FAILED(hr)) + { + WARN("failed to get data source properties, 0x%08x\n", hr); + CoTaskMemFree(progid); + return hr; + } - return E_NOTIMPL; + infocount = 0; + IDBProperties_GetPropertyInfo(props, 1, &propidset, &infocount, &propinfoset, &desc); + IDBProperties_Release(props); + + /* check if we need to skip password */ + len = strlenW(progid) + strlenW(provW) + 1; /* including ';' */ + for (i = 0; i < count; i++) + { + WCHAR *descr = get_propinfo_descr(&propset->rgProperties[i], propinfoset); + if (descr) + { + /* include '=' and ';' */ + len += strlenW(descr) + 2; + len += get_propvalue_length(&propset->rgProperties[i]); + } + + if ((propset->rgProperties[i].dwPropertyID == DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO) && + (V_BOOL(&propset->rgProperties[i].vValue) == VARIANT_FALSE)) + include_pass = FALSE; + } + + len *= sizeof(WCHAR); + *init_string = CoTaskMemAlloc(len); + *init_string[0] = 0; + + /* provider name */ + strcatW(*init_string, provW); + strcatW(*init_string, progid); + strcatW(*init_string, colW); + CoTaskMemFree(progid); + + for (i = 0; i < count; i++) + { + WCHAR *descr; + + if (!include_pass && propset->rgProperties[i].dwPropertyID == DBPROP_AUTH_PASSWORD) continue; + + descr = get_propinfo_descr(&propset->rgProperties[i], propinfoset); + if (descr) + { + static const WCHAR eqW[] = {'=',0}; + strcatW(*init_string, descr); + strcatW(*init_string, eqW); + write_propvalue_str(*init_string, &propset->rgProperties[i]); + strcatW(*init_string, colW); + } + } + + free_dbpropset(count, propset); + free_dbpropinfoset(infocount, propinfoset); + CoTaskMemFree(desc); + + if (!include_pass) + TRACE("%s\n", debugstr_w(*init_string)); + return S_OK; } static HRESULT WINAPI datainit_CreateDBInstance(IDataInitialize *iface, REFCLSID provider,
1
0
0
0
Nikolay Sivov : oledb32: Implement IDataInitialize::CreateDBInstance.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: d587a1f102c1ac2a16839a079834a630376c3fb2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d587a1f102c1ac2a16839a079…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Nov 19 23:27:30 2012 -0500 oledb32: Implement IDataInitialize::CreateDBInstance. --- dlls/oledb32/datainit.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 862c725..b990dd8 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -298,15 +298,16 @@ static HRESULT WINAPI datainit_GetInitializationString(IDataInitialize *iface, I return E_NOTIMPL; } -static HRESULT WINAPI datainit_CreateDBInstance(IDataInitialize *iface, REFCLSID clsidProvider, - IUnknown *pUnkOuter, DWORD dwClsCtx, LPWSTR pwszReserved, REFIID riid, - IUnknown **ppDataSource) +static HRESULT WINAPI datainit_CreateDBInstance(IDataInitialize *iface, REFCLSID provider, + IUnknown *outer, DWORD clsctx, LPWSTR reserved, REFIID riid, + IUnknown **datasource) { datainit *This = impl_from_IDataInitialize(iface); - FIXME("(%p)->()\n", This); + TRACE("(%p)->(%s %p 0x%08x %s %s %p)\n", This, debugstr_guid(provider), outer, clsctx, debugstr_w(reserved), + debugstr_guid(riid), datasource); - return E_NOTIMPL; + return CoCreateInstance(provider, outer, clsctx, riid, (void**)datasource); } static HRESULT WINAPI datainit_RemoteCreateDBInstanceEx(IDataInitialize *iface, REFCLSID clsidProvider,
1
0
0
0
Nikolay Sivov : odbc32: Implement SQLDataSourcesA() forward.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: b5ee2079e22d4e2ff4175471e9780b1d88d3f197 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b5ee2079e22d4e2ff4175471e…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Nov 19 22:56:50 2012 -0500 odbc32: Implement SQLDataSourcesA() forward. --- dlls/odbc32/odbc32.spec | 2 +- dlls/odbc32/proxyodbc.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletions(-) diff --git a/dlls/odbc32/odbc32.spec b/dlls/odbc32/odbc32.spec index 8e54e2b..766eec0 100644 --- a/dlls/odbc32/odbc32.spec +++ b/dlls/odbc32/odbc32.spec @@ -150,7 +150,7 @@ 254 stub SQLTablesA 255 stub SQLBrowseConnectA 256 stub SQLColumnPrivilegesA -257 stub SQLDataSourcesA +257 stdcall SQLDataSourcesA(long long str long ptr str long ptr) 260 stub SQLForeignKeysA 262 stub SQLNativeSqlA 265 stub SQLPrimaryKeysA diff --git a/dlls/odbc32/proxyodbc.c b/dlls/odbc32/proxyodbc.c index 50a2f99..10adf16 100644 --- a/dlls/odbc32/proxyodbc.c +++ b/dlls/odbc32/proxyodbc.c @@ -75,6 +75,7 @@ static SQLRETURN (*pSQLConnect)(SQLHDBC,SQLCHAR*,SQLSMALLINT,SQLCHAR*,SQLSMALLIN static SQLRETURN (*pSQLConnectW)(SQLHDBC,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLWCHAR*,SQLSMALLINT); static SQLRETURN (*pSQLCopyDesc)(SQLHDESC,SQLHDESC); static SQLRETURN (*pSQLDataSources)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); +static SQLRETURN (*pSQLDataSourcesA)(SQLHENV,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*); static SQLRETURN (*pSQLDataSourcesW)(SQLHENV,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*); static SQLRETURN (*pSQLDescribeCol)(SQLHSTMT,SQLUSMALLINT,SQLCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLUINTEGER*,SQLSMALLINT*,SQLSMALLINT*); static SQLRETURN (*pSQLDescribeColW)(SQLHSTMT,SQLUSMALLINT,SQLWCHAR*,SQLSMALLINT,SQLSMALLINT*,SQLSMALLINT*,SQLULEN*,SQLSMALLINT*,SQLSMALLINT*); @@ -584,6 +585,7 @@ static BOOL ODBC_LoadDMFunctions(void) LOAD_FUNC(SQLConnectW); LOAD_FUNC(SQLCopyDesc); LOAD_FUNC(SQLDataSources); + LOAD_FUNC(SQLDataSourcesA); LOAD_FUNC(SQLDataSourcesW); LOAD_FUNC(SQLDescribeCol); LOAD_FUNC(SQLDescribeColW); @@ -969,6 +971,32 @@ SQLRETURN WINAPI SQLDataSources(SQLHENV EnvironmentHandle, return ret; } +SQLRETURN WINAPI SQLDataSourcesA(SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, SQLCHAR *ServerName, + SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1, + SQLCHAR *Description, SQLSMALLINT BufferLength2, + SQLSMALLINT *NameLength2) +{ + SQLRETURN ret; + + TRACE("EnvironmentHandle = %p\n", (void*)EnvironmentHandle); + + if (!pSQLDataSourcesA) return SQL_ERROR; + + ret = pSQLDataSourcesA(EnvironmentHandle, Direction, ServerName, + BufferLength1, NameLength1, Description, BufferLength2, NameLength2); + if (TRACE_ON(odbc)) + { + TRACE("returns: %d \t", ret); + if (NameLength1 && *NameLength1 > 0) + TRACE("DataSource = %s,", ServerName); + if (NameLength2 && *NameLength2 > 0) + TRACE(" Description = %s", Description); + TRACE("\n"); + } + + return ret; +} /************************************************************************* * SQLDescribeCol [ODBC32.008]
1
0
0
0
Nikolay Sivov : xmllite: Store remaining reader input parameters.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: dc2fe2a4bec08235b124950a8501a38ee7f14355 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dc2fe2a4bec08235b124950a8…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Nov 18 23:33:55 2012 -0500 xmllite: Store remaining reader input parameters. --- dlls/xmllite/reader.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 50 insertions(+), 1 deletions(-) diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index 1970ac8..3f22152 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -29,6 +29,7 @@ #include "xmllite_private.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(xmllite); @@ -73,6 +74,9 @@ typedef struct _xmlreaderinput /* reference passed on IXmlReaderInput creation, is kept when input is created */ IUnknown *input; IMalloc *imalloc; + xml_encoding encoding; + BOOL hint; + WCHAR *baseuri; /* stream reference set after SetInput() call from reader, stored as sequential stream, cause currently optimizations possible with IStream aren't implemented */ @@ -161,6 +165,21 @@ static inline void readerinput_free(xmlreaderinput *input, void *mem) return m_free(input->imalloc, mem); } +static inline WCHAR *readerinput_strdupW(xmlreaderinput *input, const WCHAR *str) +{ + LPWSTR ret = NULL; + + if(str) { + DWORD size; + + size = (strlenW(str)+1)*sizeof(WCHAR); + ret = readerinput_alloc(input, size); + if (ret) memcpy(ret, str, size); + } + + return ret; +} + static HRESULT init_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer) { const int initial_len = 0x2000; @@ -195,6 +214,32 @@ static HRESULT get_code_page(xml_encoding encoding, xmlreaderinput *input) return S_OK; } +static xml_encoding parse_encoding_name(const WCHAR *encoding) +{ + int min, max, n, c; + + if (!encoding) return XmlEncoding_Unknown; + + min = 0; + max = sizeof(xml_encoding_map)/sizeof(struct xml_encoding_data) - 1; + + while (min <= max) + { + n = (min+max)/2; + + c = strcmpiW(xml_encoding_map[n].encoding, encoding); + if (!c) + return xml_encoding_map[n].enc; + + if (c > 0) + max = n-1; + else + min = n+1; + } + + return XmlEncoding_Unknown; +} + static HRESULT alloc_input_buffer(xmlreaderinput *input) { input_buffer *buffer; @@ -688,6 +733,7 @@ static ULONG WINAPI xmlreaderinput_Release(IXmlReaderInput *iface) if (This->input) IUnknown_Release(This->input); if (This->stream) ISequentialStream_Release(This->stream); if (This->buffer) free_input_buffer(This->buffer); + readerinput_free(This, This->baseuri); readerinput_free(This, This); if (imalloc) IMalloc_Release(imalloc); } @@ -747,7 +793,7 @@ HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, xmlreaderinput *readerinput; HRESULT hr; - FIXME("%p %p %s %d %s %p: stub\n", stream, imalloc, wine_dbgstr_w(encoding), + TRACE("%p %p %s %d %s %p\n", stream, imalloc, wine_dbgstr_w(encoding), hint, wine_dbgstr_w(base_uri), ppInput); if (!stream || !ppInput) return E_INVALIDARG; @@ -763,6 +809,9 @@ HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, readerinput->imalloc = imalloc; readerinput->stream = NULL; if (imalloc) IMalloc_AddRef(imalloc); + readerinput->encoding = parse_encoding_name(encoding); + readerinput->hint = hint; + readerinput->baseuri = readerinput_strdupW(readerinput, base_uri); hr = alloc_input_buffer(readerinput); if (hr != S_OK)
1
0
0
0
Nikolay Sivov : xmllite: Implement GetNodeType() for reader.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: befbc8f57dea0dc20d7d61ba90a5b183d8da05ba URL:
http://source.winehq.org/git/wine.git/?a=commit;h=befbc8f57dea0dc20d7d61ba9…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Nov 18 19:00:24 2012 -0500 xmllite: Implement GetNodeType() for reader. --- dlls/xmllite/reader.c | 8 ++++++-- dlls/xmllite/tests/reader.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index 188b419..1970ac8 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -87,6 +87,7 @@ typedef struct _xmlreader xmlreaderinput *input; IMalloc *imalloc; XmlReadState state; + XmlNodeType nodetype; DtdProcessing dtdmode; UINT line, pos; /* reader position in XML stream */ } xmlreader; @@ -469,8 +470,10 @@ static HRESULT WINAPI xmlreader_Read(IXmlReader* iface, XmlNodeType *node_type) static HRESULT WINAPI xmlreader_GetNodeType(IXmlReader* iface, XmlNodeType *node_type) { - FIXME("(%p %p): stub\n", iface, node_type); - return E_NOTIMPL; + xmlreader *This = impl_from_IXmlReader(iface); + TRACE("(%p)->(%p)\n", This, node_type); + *node_type = This->nodetype; + return This->state == XmlReadState_Closed ? S_FALSE : S_OK; } static HRESULT WINAPI xmlreader_MoveToFirstAttribute(IXmlReader* iface) @@ -725,6 +728,7 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc) reader->line = reader->pos = 0; reader->imalloc = imalloc; if (imalloc) IMalloc_AddRef(imalloc); + reader->nodetype = XmlNodeType_None; *obj = &reader->IXmlReader_iface; diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index f5b7680..7d77fe9 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -351,6 +351,7 @@ static void test_reader_create(void) IXmlReader *reader; IUnknown *input; DtdProcessing dtd; + XmlNodeType nodetype; /* crashes native */ if (0) @@ -364,6 +365,11 @@ static void test_reader_create(void) test_read_state(reader, XmlReadState_Closed, -1, FALSE); + nodetype = XmlNodeType_Element; + hr = IXmlReader_GetNodeType(reader, &nodetype); + ok(hr == S_FALSE, "got %08x\n", hr); + ok(nodetype == XmlNodeType_None, "got %d\n", nodetype); + dtd = 2; hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, (LONG_PTR*)&dtd); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); @@ -403,6 +409,7 @@ static void test_readerinput(void) IXmlReader *reader, *reader2; IUnknown *obj, *input; IStream *stream, *stream2; + XmlNodeType nodetype; HRESULT hr; LONG ref; @@ -444,6 +451,11 @@ static void test_readerinput(void) test_read_state(reader, XmlReadState_Initial, -1, FALSE); + nodetype = XmlNodeType_Element; + hr = IXmlReader_GetNodeType(reader, &nodetype); + ok(hr == S_OK, "got %08x\n", hr); + ok(nodetype == XmlNodeType_None, "got %d\n", nodetype); + /* IXmlReader grabs a IXmlReaderInput reference */ ref = IUnknown_AddRef(reader_input); ok(ref == 3, "Expected 3, got %d\n", ref);
1
0
0
0
Nikolay Sivov : xmllite: Initial support for reader input encoding detection.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: d693790175ac8c8d1b2ac88ac2026e9a10f3102d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d693790175ac8c8d1b2ac88ac…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Nov 18 18:01:46 2012 -0500 xmllite: Initial support for reader input encoding detection. --- dlls/xmllite/reader.c | 123 ++++++++++++++++++++++++++++++++-------- dlls/xmllite/tests/reader.c | 11 +++- dlls/xmllite/xmllite_private.h | 5 ++ 3 files changed, 115 insertions(+), 24 deletions(-) diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c index ae05057..188b419 100644 --- a/dlls/xmllite/reader.c +++ b/dlls/xmllite/reader.c @@ -117,6 +117,14 @@ static inline void *m_alloc(IMalloc *imalloc, size_t len) return heap_alloc(len); } +static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len) +{ + if (imalloc) + return IMalloc_Realloc(imalloc, mem, len); + else + return heap_realloc(mem, len); +} + static inline void m_free(IMalloc *imalloc, void *mem) { if (imalloc) @@ -142,6 +150,11 @@ static inline void *readerinput_alloc(xmlreaderinput *input, size_t len) return m_alloc(input->imalloc, len); } +static inline void *readerinput_realloc(xmlreaderinput *input, void *mem, size_t len) +{ + return m_realloc(input->imalloc, mem, len); +} + static inline void readerinput_free(xmlreaderinput *input, void *mem) { return m_free(input->imalloc, mem); @@ -165,7 +178,7 @@ static void free_encoded_buffer(xmlreaderinput *input, encoded_buffer *buffer) readerinput_free(input, buffer->data); } -static HRESULT get_code_page(xml_encoding encoding, UINT *cp) +static HRESULT get_code_page(xml_encoding encoding, xmlreaderinput *input) { const struct xml_encoding_data *data; @@ -176,12 +189,12 @@ static HRESULT get_code_page(xml_encoding encoding, UINT *cp) } data = &xml_encoding_map[encoding]; - *cp = data->cp; + input->buffer->code_page = data->cp; return S_OK; } -static HRESULT alloc_input_buffer(xmlreaderinput *input, xml_encoding encoding) +static HRESULT alloc_input_buffer(xmlreaderinput *input) { input_buffer *buffer; HRESULT hr; @@ -192,29 +205,20 @@ static HRESULT alloc_input_buffer(xmlreaderinput *input, xml_encoding encoding) if (!buffer) return E_OUTOFMEMORY; buffer->input = input; - hr = get_code_page(encoding, &buffer->code_page); + buffer->code_page = ~0; /* code page is unknown at this point */ + hr = init_encoded_buffer(input, &buffer->utf16); if (hr != S_OK) { readerinput_free(input, buffer); return hr; } - hr = init_encoded_buffer(input, &buffer->utf16); + hr = init_encoded_buffer(input, &buffer->encoded); if (hr != S_OK) { + free_encoded_buffer(input, &buffer->utf16); readerinput_free(input, buffer); return hr; } - if (encoding != XmlEncoding_UTF16) { - hr = init_encoded_buffer(input, &buffer->encoded); - if (hr != S_OK) { - free_encoded_buffer(input, &buffer->utf16); - readerinput_free(input, buffer); - return hr; - } - } - else - memset(&buffer->encoded, 0, sizeof(buffer->encoded)); - input->buffer = buffer; return S_OK; } @@ -226,7 +230,7 @@ static void free_input_buffer(input_buffer *buffer) readerinput_free(buffer->input, buffer); } -static void xmlreaderinput_release_stream(xmlreaderinput *readerinput) +static void readerinput_release_stream(xmlreaderinput *readerinput) { if (readerinput->stream) { ISequentialStream_Release(readerinput->stream); @@ -236,11 +240,11 @@ static void xmlreaderinput_release_stream(xmlreaderinput *readerinput) /* Queries already stored interface for IStream/ISequentialStream. Interface supplied on creation will be overwritten */ -static HRESULT xmlreaderinput_query_for_stream(xmlreaderinput *readerinput) +static HRESULT readerinput_query_for_stream(xmlreaderinput *readerinput) { HRESULT hr; - xmlreaderinput_release_stream(readerinput); + readerinput_release_stream(readerinput); hr = IUnknown_QueryInterface(readerinput->input, &IID_IStream, (void**)&readerinput->stream); if (hr != S_OK) hr = IUnknown_QueryInterface(readerinput->input, &IID_ISequentialStream, (void**)&readerinput->stream); @@ -248,6 +252,59 @@ static HRESULT xmlreaderinput_query_for_stream(xmlreaderinput *readerinput) return hr; } +/* reads a chunk to raw buffer */ +static HRESULT readerinput_growraw(xmlreaderinput *readerinput) +{ + encoded_buffer *buffer = &readerinput->buffer->encoded; + ULONG len = buffer->allocated - buffer->written, read; + HRESULT hr; + + /* always try to get aligned to 4 bytes, so the only case we can get partialy read characters is + variable width encodings like UTF-8 */ + len = (len + 3) & ~3; + /* try to use allocated space or grow */ + if (buffer->allocated - buffer->written < len) + { + buffer->allocated *= 2; + buffer->data = readerinput_realloc(readerinput, buffer->data, buffer->allocated); + len = buffer->allocated - buffer->written; + } + + hr = ISequentialStream_Read(readerinput->stream, buffer->data + buffer->written, len, &read); + if (FAILED(hr)) return hr; + TRACE("requested %d, read %d, ret 0x%08x\n", len, read, hr); + buffer->written += read; + + return hr; +} + +static xml_encoding readerinput_detectencoding(xmlreaderinput *readerinput) +{ + encoded_buffer *buffer = &readerinput->buffer->encoded; + + /* try start symbols if we have enough data to do that, input buffer should contain + first chunk already */ + if (buffer->written >= 4) + { + static char startA[] = {'<','?','x','m'}; + static WCHAR startW[] = {'<','?'}; + + if (!memcmp(buffer->data, startA, sizeof(startA))) return XmlEncoding_UTF8; + if (!memcmp(buffer->data, startW, sizeof(startW))) return XmlEncoding_UTF16; + } + + /* try with BOM now */ + if (buffer->written >= 3) + { + static char utf8bom[] = {0xef,0xbb,0xbf}; + static char utf16lebom[] = {0xff,0xfe}; + if (!memcmp(buffer->data, utf8bom, sizeof(utf8bom))) return XmlEncoding_UTF8; + if (!memcmp(buffer->data, utf16lebom, sizeof(utf16lebom))) return XmlEncoding_UTF16; + } + + return XmlEncoding_Unknown; +} + static HRESULT WINAPI xmlreader_QueryInterface(IXmlReader *iface, REFIID riid, void** ppvObject) { xmlreader *This = impl_from_IXmlReader(iface); @@ -305,7 +362,7 @@ static HRESULT WINAPI xmlreader_SetInput(IXmlReader* iface, IUnknown *input) if (This->input) { - xmlreaderinput_release_stream(This->input); + readerinput_release_stream(This->input); IUnknown_Release(&This->input->IXmlReaderInput_iface); This->input = NULL; } @@ -333,7 +390,7 @@ static HRESULT WINAPI xmlreader_SetInput(IXmlReader* iface, IUnknown *input) } /* set stream for supplied IXmlReaderInput */ - hr = xmlreaderinput_query_for_stream(This->input); + hr = readerinput_query_for_stream(This->input); if (hr == S_OK) This->state = XmlReadState_Initial; @@ -386,7 +443,27 @@ static HRESULT WINAPI xmlreader_SetProperty(IXmlReader* iface, UINT property, LO static HRESULT WINAPI xmlreader_Read(IXmlReader* iface, XmlNodeType *node_type) { - FIXME("(%p %p): stub\n", iface, node_type); + xmlreader *This = impl_from_IXmlReader(iface); + + FIXME("(%p)->(%p): stub\n", This, node_type); + + if (This->state == XmlReadState_Closed) return S_FALSE; + + /* if it's a first call for a new input we need to detect stream encoding */ + if (This->state == XmlReadState_Initial) + { + xml_encoding enc; + HRESULT hr; + + hr = readerinput_growraw(This->input); + if (FAILED(hr)) return hr; + + /* try to detect encoding by BOM or data and set input code page */ + enc = readerinput_detectencoding(This->input); + TRACE("detected encoding %d\n", enc); + get_code_page(enc, This->input); + } + return E_NOTIMPL; } @@ -683,7 +760,7 @@ HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, readerinput->stream = NULL; if (imalloc) IMalloc_AddRef(imalloc); - hr = alloc_input_buffer(readerinput, XmlEncoding_UTF16); + hr = alloc_input_buffer(readerinput); if (hr != S_OK) { readerinput_free(readerinput, readerinput); diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 582ad48..f5b7680 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -551,15 +551,24 @@ static void test_readerinput(void) static void test_reader_state(void) { IXmlReader *reader; + XmlNodeType nodetype; HRESULT hr; - hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL); + hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); /* invalid arguments */ hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, NULL); ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); + /* attempt to read on closed reader */ + test_read_state(reader, XmlReadState_Closed, -1, 0); +if (0) +{ + /* newer versions crash here, probably cause no input was set */ + hr = IXmlReader_Read(reader, &nodetype); + ok(hr == S_FALSE, "got %08x\n", hr); +} IXmlReader_Release(reader); } diff --git a/dlls/xmllite/xmllite_private.h b/dlls/xmllite/xmllite_private.h index 1677e5c..97993e1 100644 --- a/dlls/xmllite/xmllite_private.h +++ b/dlls/xmllite/xmllite_private.h @@ -27,6 +27,11 @@ static inline void *heap_alloc(size_t len) return HeapAlloc(GetProcessHeap(), 0, len); } +static inline void *heap_realloc(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), 0, mem, len); +} + static inline BOOL heap_free(void *mem) { return HeapFree(GetProcessHeap(), 0, mem);
1
0
0
0
Jason Edmeades : cmd: Add support for NUL in copy.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: d16f4e700bc16e174bfff8c430cfa93b1f9076fe URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d16f4e700bc16e174bfff8c43…
Author: Jason Edmeades <jason(a)edmeades.me.uk> Date: Fri Nov 9 22:36:30 2012 +0000 cmd: Add support for NUL in copy. --- programs/cmd/builtins.c | 52 ++++++++++++++++++++++-------- programs/cmd/tests/test_builtins.cmd | 17 +++++++++- programs/cmd/tests/test_builtins.cmd.exp | 8 ++++- 3 files changed, 61 insertions(+), 16 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 2e7fdd9..8715c51 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -47,6 +47,7 @@ const WCHAR slashW[] = {'\\','\0'}; const WCHAR equalW[] = {'=','\0'}; const WCHAR wildcardsW[] = {'*','?','\0'}; const WCHAR slashstarW[] = {'\\','*','\0'}; +const WCHAR deviceW[] = {'\\','\\','.','\\','\0'}; const WCHAR inbuilt[][10] = { {'C','A','L','L','\0'}, {'C','D','\0'}, @@ -414,7 +415,7 @@ static BOOL WCMD_ManualCopy(WCHAR *srcname, WCHAR *dstname, BOOL ascii, BOOL app BOOL ok; DWORD bytesread, byteswritten; - WINE_TRACE("ASCII Copying %s to %s (append?%d)\n", + WINE_TRACE("Manual Copying %s to %s (append?%d)\n", wine_dbgstr_w(srcname), wine_dbgstr_w(dstname), append); in = CreateFileW(srcname, GENERIC_READ, 0, NULL, @@ -502,7 +503,7 @@ void WCMD_copy(WCHAR * args) { int argno = 0; WCHAR *rawarg; WIN32_FIND_DATAW fd; - HANDLE hff; + HANDLE hff = INVALID_HANDLE_VALUE; int binarymode = -1; /* -1 means use the default, 1 is binary, 0 ascii */ BOOL concatnextfilename = FALSE; /* True if we have just processed a + */ BOOL anyconcats = FALSE; /* Have we found any + options */ @@ -514,6 +515,7 @@ void WCMD_copy(WCHAR * args) { BOOL status; WCHAR copycmd[4]; DWORD len; + BOOL dstisdevice = FALSE; static const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'}; typedef struct _COPY_FILES @@ -785,6 +787,12 @@ void WCMD_copy(WCHAR * args) { WINE_TRACE("Resolved destination is '%s' (calc later %d)\n", wine_dbgstr_w(destname), appendfirstsource); + /* Remember if the destination is a device */ + if (strncmpW(destination->name, deviceW, strlenW(deviceW)) == 0) { + WINE_TRACE("Destination is a device\n"); + dstisdevice = TRUE; + } + /* Now we need to walk the set of sources, and process each name we come to. If anyconcats is true, we are writing to one file, otherwise we are using the source name each time. @@ -800,8 +808,10 @@ void WCMD_copy(WCHAR * args) { while (thiscopy != NULL) { WCHAR srcpath[MAX_PATH]; + const WCHAR *srcname; WCHAR *filenamepart; DWORD attributes; + BOOL srcisdevice = FALSE; /* If it was not explicit, we now know whether we are concatenating or not and hence whether to copy as binary or ascii */ @@ -836,29 +846,41 @@ void WCMD_copy(WCHAR * args) { WINE_TRACE("Copy source (calculated): path: '%s' (Concats: %d)\n", wine_dbgstr_w(srcpath), anyconcats); - /* Loop through all source files */ - WINE_TRACE("Searching for: '%s'\n", wine_dbgstr_w(srcpath)); - hff = FindFirstFileW(srcpath, &fd); - if (hff != INVALID_HANDLE_VALUE) { + /* If the source is a device, just use it, otherwise search */ + if (strncmpW(srcpath, deviceW, strlenW(deviceW)) == 0) { + WINE_TRACE("Source is a device\n"); + srcisdevice = TRUE; + srcname = &srcpath[4]; /* After the \\.\ prefix */ + } else { + + /* Loop through all source files */ + WINE_TRACE("Searching for: '%s'\n", wine_dbgstr_w(srcpath)); + hff = FindFirstFileW(srcpath, &fd); + if (hff != INVALID_HANDLE_VALUE) { + srcname = fd.cFileName; + } + } + + if (srcisdevice || hff != INVALID_HANDLE_VALUE) { do { WCHAR outname[MAX_PATH]; BOOL overwrite; /* Skip . and .., and directories */ - if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + if (!srcisdevice && fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { WINE_TRACE("Skipping directories\n"); } else { /* Build final destination name */ strcpyW(outname, destination->name); - if (destisdirectory || appendfirstsource) strcatW(outname, fd.cFileName); + if (destisdirectory || appendfirstsource) strcatW(outname, srcname); /* Build source name */ - strcpyW(filenamepart, fd.cFileName); + if (!srcisdevice) strcpyW(filenamepart, srcname); - /* Do we just overwrite */ + /* Do we just overwrite (we do if we are writing to a device) */ overwrite = !prompt; - if (anyconcats && writtenoneconcat) { + if (dstisdevice || (anyconcats && writtenoneconcat)) { overwrite = TRUE; } @@ -879,7 +901,7 @@ void WCMD_copy(WCHAR * args) { else overwrite = TRUE; } - /* If we needed tyo save away the first filename, do it */ + /* If we needed to save away the first filename, do it */ if (appendfirstsource && overwrite) { heap_free(destination->name); destination->name = heap_strdupW(outname); @@ -898,6 +920,8 @@ void WCMD_copy(WCHAR * args) { } } else if (!thiscopy->binarycopy) { status = WCMD_ManualCopy(srcpath, outname, TRUE, FALSE); + } else if (srcisdevice) { + status = WCMD_ManualCopy(srcpath, outname, FALSE, FALSE); } else { status = CopyFileW(srcpath, outname, FALSE); } @@ -921,8 +945,8 @@ void WCMD_copy(WCHAR * args) { } } } - } while (FindNextFileW(hff, &fd) != 0); - FindClose (hff); + } while (!srcisdevice && FindNextFileW(hff, &fd) != 0); + if (!srcisdevice) FindClose (hff); } else { /* Error if the first file was not found */ if (!anyconcats || (anyconcats && !writtenoneconcat)) { diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 93ef7e2..eb9b888 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -607,7 +607,22 @@ if exist foo ( ) else ( echo *** ) -cd .. & rd foobar +echo 1234 >a.a +copy a.a+NUL b.b >nul +call :CheckFileSize a.a 7 b.b 8 +copy NUL+a.a b.b >nul +call :CheckFileSize a.a 7 b.b 8 +mkdir subdir +copy a.a+NUL subdir\ >nul +call :CheckFileSize a.a 7 subdir\a.a 8 +del subdir\a.a +cd subdir +copy ..\a.a NUL >nul +if exist a.a echo Failed +cd .. +rd subdir /s /q +del a.a b.b +cd .. & rd foobar /s /q echo ------------ Testing if/else ------------ echo --- if/else should work with blocks diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 218db9c..e7300b4 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -415,7 +415,13 @@ bar bar bar NUL -@todo_wine@foo created +foo created +Passed: file size check on a.a [7]@or_broken@Skipping file size check on NT4 +Passed: file size check on b.b [8]@or_broken@Skipping file size check on NT4 +Passed: file size check on a.a [7]@or_broken@Skipping file size check on NT4 +Passed: file size check on b.b [8]@or_broken@Skipping file size check on NT4 +Passed: file size check on a.a [7]@or_broken@Skipping file size check on NT4 +Passed: file size check on subdir\a.a [8]@or_broken@Skipping file size check on NT4 ------------ Testing if/else ------------ --- if/else should work with blocks if seems to work
1
0
0
0
Jason Edmeades : cmd: Prevent external env vars causing tests to fail.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 2e92853091262fee67f651dfc6a0188e349ba0b2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2e92853091262fee67f651dfc…
Author: Jason Edmeades <jason(a)edmeades.me.uk> Date: Thu Nov 8 22:06:21 2012 +0000 cmd: Prevent external env vars causing tests to fail. --- programs/cmd/tests/test_builtins.cmd | 683 +++++++++++++++--------------- programs/cmd/tests/test_builtins.cmd.exp | 36 +- 2 files changed, 362 insertions(+), 357 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=2e92853091262fee67f65…
1
0
0
0
Jason Edmeades : cmd: Add support for tokens= (for /f).
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 47b35d5545cd9794c299acb0417ab9f2de538fb8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=47b35d5545cd9794c299acb04…
Author: Jason Edmeades <jason(a)edmeades.me.uk> Date: Thu Nov 8 21:53:08 2012 +0000 cmd: Add support for tokens= (for /f). --- programs/cmd/builtins.c | 200 +++++++++++++++++++++++++++--- programs/cmd/tests/test_builtins.cmd | 31 +++++ programs/cmd/tests/test_builtins.cmd.exp | 21 +++ 3 files changed, 237 insertions(+), 15 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=47b35d5545cd9794c299a…
1
0
0
0
Austin English : include: Remove stray linefeeds.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: c540cca987ec56e4212b2a6dda1ea60f9a8c720d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c540cca987ec56e4212b2a6dd…
Author: Austin English <austinenglish(a)gmail.com> Date: Mon Nov 19 17:47:11 2012 -0600 include: Remove stray linefeeds. --- include/endpointvolume.idl | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/endpointvolume.idl b/include/endpointvolume.idl index f58450a..eaf4f8a 100644 --- a/include/endpointvolume.idl +++ b/include/endpointvolume.idl @@ -30,9 +30,9 @@ typedef struct AUDIO_VOLUME_NOTIFICATION_DATA cpp_quote("typedef struct AUDIO_VOLUME_NOTIFICATION_DATA *PAUDIO_VOLUME_NOTIFICATION_DATA;") -cpp_quote("#define ENDPOINT_HARDWARE_SUPPORT_VOLUME 0x1\n") -cpp_quote("#define ENDPOINT_HARDWARE_SUPPORT_MUTE 0x2\n") -cpp_quote("#define ENDPOINT_HARDWARE_SUPPORT_METER 0x4\n") +cpp_quote("#define ENDPOINT_HARDWARE_SUPPORT_VOLUME 0x1") +cpp_quote("#define ENDPOINT_HARDWARE_SUPPORT_MUTE 0x2") +cpp_quote("#define ENDPOINT_HARDWARE_SUPPORT_METER 0x4") interface IAudioEndpointVolumeCallback; interface IAudioEndpointVolume;
1
0
0
0
Andrew Talbot : crypt32: Remove unused variables.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 8300fd5aa8f57e2c93b2c6c74834e2db697d4ddd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8300fd5aa8f57e2c93b2c6c74…
Author: Andrew Talbot <andrew.talbot(a)talbotville.com> Date: Mon Nov 19 22:00:08 2012 +0000 crypt32: Remove unused variables. --- dlls/crypt32/oid.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/oid.c b/dlls/crypt32/oid.c index 4f09e7b..4c3f95f 100644 --- a/dlls/crypt32/oid.c +++ b/dlls/crypt32/oid.c @@ -1053,9 +1053,6 @@ static const WCHAR rc2[] = { 'r','c','2',0 }; static const WCHAR rc4[] = { 'r','c','4',0 }; static const WCHAR sha[] = { 's','h','a',0 }; static const WCHAR sha1[] = { 's','h','a','1',0 }; -static const WCHAR sha256[] = { 's','h','a','2','5','6',0 }; -static const WCHAR sha384[] = { 's','h','a','3','8','4',0 }; -static const WCHAR sha512[] = { 's','h','a','5','1','2',0 }; static const WCHAR RSA[] = { 'R','S','A',0 }; static const WCHAR RSA_KEYX[] = { 'R','S','A','_','K','E','Y','X',0 }; static const WCHAR RSA_SIGN[] = { 'R','S','A','_','S','I','G','N',0 };
1
0
0
0
Andrew Talbot : mscoree: Remove unneeded address-of operator from function name.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: d2de810df38c3c0ef4514fe5e4c07fc2df671aad URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d2de810df38c3c0ef4514fe5e…
Author: Andrew Talbot <andrew.talbot(a)talbotville.com> Date: Mon Nov 19 22:00:19 2012 +0000 mscoree: Remove unneeded address-of operator from function name. --- dlls/mscoree/mscoree_main.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 620fb9b..de37706 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -607,7 +607,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) This = HeapAlloc(GetProcessHeap(), 0, sizeof(mscorecf)); This->IClassFactory_iface.lpVtbl = &mscorecf_vtbl; - This->pfnCreateInstance = &create_monodata; + This->pfnCreateInstance = create_monodata; This->ref = 1; This->clsid = *rclsid;
1
0
0
0
Henri Verbeet : d3d9/tests: Add tests for device resets in d3d9ex.
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 2f307a14f0ccbf965b1022f768f3b617dedc56fc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2f307a14f0ccbf965b1022f76…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Nov 19 22:04:14 2012 +0100 d3d9/tests: Add tests for device resets in d3d9ex. --- dlls/d3d9/tests/d3d9ex.c | 480 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 480 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=2f307a14f0ccbf965b102…
1
0
0
0
Henri Verbeet : d3d9/tests: Create the d3d9ex object in create_device().
by Alexandre Julliard
20 Nov '12
20 Nov '12
Module: wine Branch: master Commit: 84da62d9933c75a4a89828ca34da6c8e8303960c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=84da62d9933c75a4a89828ca3…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Nov 19 22:04:13 2012 +0100 d3d9/tests: Create the d3d9ex object in create_device(). --- dlls/d3d9/tests/d3d9ex.c | 30 ++++++++++++++---------------- 1 files changed, 14 insertions(+), 16 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 8b79b46..6be030c 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -49,11 +49,15 @@ static HWND create_window(void) return ret; } -static IDirect3DDevice9Ex *create_device(IDirect3D9Ex *d3d9, HWND device_window, HWND focus_window, BOOL windowed) +static IDirect3DDevice9Ex *create_device(HWND device_window, HWND focus_window, BOOL windowed) { D3DPRESENT_PARAMETERS present_parameters = {0}; IDirect3DDevice9Ex *device; D3DDISPLAYMODEEX mode, *m; + IDirect3D9Ex *d3d9; + + if (FAILED(pDirect3DCreate9Ex(D3D_SDK_VERSION, &d3d9))) + return NULL; present_parameters.Windowed = windowed; present_parameters.hDeviceWindow = device_window; @@ -73,16 +77,20 @@ static IDirect3DDevice9Ex *create_device(IDirect3D9Ex *d3d9, HWND device_window, m = windowed ? NULL : &mode; if (SUCCEEDED(IDirect3D9Ex_CreateDeviceEx(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, m, &device))) return device; + D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, m, &device))) goto done; present_parameters.AutoDepthStencilFormat = D3DFMT_D16; if (SUCCEEDED(IDirect3D9Ex_CreateDeviceEx(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, m, &device))) return device; + D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, m, &device))) goto done; if (SUCCEEDED(IDirect3D9Ex_CreateDeviceEx(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, m, &device))) return device; + D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, m, &device))) goto done; + + device = NULL; - return NULL; +done: + IDirect3D9Ex_Release(d3d9); + return device; } static ULONG getref(IUnknown *obj) { @@ -387,21 +395,13 @@ static void test_texture_sysmem_create(void) IDirect3DDevice9Ex *device; IDirect3DTexture9 *texture; D3DLOCKED_RECT locked_rect; - IDirect3D9Ex *d3d9; UINT refcount; HWND window; HRESULT hr; void *mem; - if (FAILED(hr = pDirect3DCreate9Ex(D3D_SDK_VERSION, &d3d9))) - { - skip("Failed to create IDirect3D9Ex object (hr %#x), skipping tests.\n", hr); - return; - } - window = create_window(); - device = create_device(d3d9, window, window, TRUE); - if (!device) + if (!(device = create_device(window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); goto done; @@ -428,8 +428,6 @@ static void test_texture_sysmem_create(void) done: DestroyWindow(window); - if (d3d9) - IDirect3D9Ex_Release(d3d9); } START_TEST(d3d9ex)
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200