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
February 2010
----- 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
783 discussions
Start a n
N
ew thread
Andrew Nguyen : user32: Ensure that WM_INITDIALOG passes the first tabstop control handle to the dialog procedure .
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 0b2301286796df64959d910b4afb3609b6da3e41 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0b2301286796df64959d910b4…
Author: Andrew Nguyen <arethusa26(a)gmail.com> Date: Tue Feb 23 01:16:18 2010 -0600 user32: Ensure that WM_INITDIALOG passes the first tabstop control handle to the dialog procedure. --- dlls/user32/dialog.c | 9 ++++++--- dlls/user32/tests/dialog.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index c7c9409..325d6e2 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -690,11 +690,14 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate, if (dlgProc) { - if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ) && + HWND focus = GetNextDlgTabItem( hwnd, 0, FALSE ); + if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) && ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE))) { - /* By returning TRUE, app has requested a default focus assignment */ - dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE); + /* By returning TRUE, app has requested a default focus assignment. + * WM_INITDIALOG may have changed the tab order, so find the first + * tabstop control again. */ + dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE ); if( dlgInfo->hwndFocus ) SetFocus( dlgInfo->hwndFocus ); } diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 204d854..c423f0b 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -926,6 +926,21 @@ static INT_PTR CALLBACK DestroyOnCloseDlgWinProc (HWND hDlg, UINT uiMsg, return FALSE; } +static INT_PTR CALLBACK TestInitDialogHandleProc (HWND hDlg, UINT uiMsg, + WPARAM wParam, LPARAM lParam) +{ + if (uiMsg == WM_INITDIALOG) + { + HWND expected = GetNextDlgTabItem(hDlg, NULL, FALSE); + ok(expected == (HWND)wParam, + "Expected wParam to be the handle to the first tabstop control (%p), got %p\n", + expected, (HWND)wParam); + + EndDialog(hDlg, LOWORD(SendMessage(hDlg, DM_GETDEFID, 0, 0))); + return TRUE; + } + return FALSE; +} static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) @@ -978,6 +993,9 @@ static void test_DialogBoxParamA(void) broken(GetLastError() == 0xdeadbeef), "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError()); + ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0); + ok(ret == IDOK, "Expected IDOK\n"); + ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0); ok(ret == IDOK, "Expected IDOK\n"); }
1
0
0
0
David Hedberg : msvcrt: Implement _ismbclegal.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 30f6dc9510033dec4782ac00a53a0bc00a18b63d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=30f6dc9510033dec4782ac00a…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Tue Feb 23 07:05:44 2010 +0100 msvcrt: Implement _ismbclegal. --- dlls/msvcrt/mbcs.c | 8 +++++ dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/tests/string.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletions(-) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index f4bb248..38891e6 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -1153,6 +1153,14 @@ int CDECL _ismbbtrail(unsigned int c) } /********************************************************************* + * _ismbclegal(MSVCRT.@) + */ +int CDECL _ismbclegal(unsigned int c) +{ + return _ismbblead(HIBYTE(c)) && _ismbbtrail(LOBYTE(c)); +} + +/********************************************************************* * _ismbslead(MSVCRT.@) */ int CDECL _ismbslead(const unsigned char* start, const unsigned char* str) diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 51cb7df..a3bbb88 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -336,7 +336,7 @@ @ stub _ismbcl0 #(long) @ stub _ismbcl1 #(long) @ stub _ismbcl2 #(long) -@ stub _ismbclegal #(long) +@ cdecl _ismbclegal(long) @ cdecl _ismbclower(long) @ cdecl _ismbcprint(long) @ cdecl _ismbcpunct(long) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 182c598..199c0fa 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -730,6 +730,81 @@ static void test_mbcjisjms(void) } while(jisjms[i++][0] != 0); } +static void test_ismbclegal(void) { + unsigned int prev_cp = _getmbcp(); + int ret, exp, err; + unsigned int i; + + _setmbcp(932); /* Japanese */ + err = 0; + for(i = 0; i < 0x10000; i++) { + ret = _ismbclegal(i); + exp = ((HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0x9F) || + (HIBYTE(i) >= 0xE0 && HIBYTE(i) <= 0xFC)) && + ((LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0x7E) || + (LOBYTE(i) >= 0x80 && LOBYTE(i) <= 0xFC)); + if(ret != exp) { + err = 1; + break; + } + } + ok(!err, "_ismbclegal (932) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i); + _setmbcp(936); /* Chinese (GBK) */ + err = 0; + for(i = 0; i < 0x10000; i++) { + ret = _ismbclegal(i); + exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE && + LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0xFE; + if(ret != exp) { + err = 1; + break; + } + } + ok(!err, "_ismbclegal (936) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i); + _setmbcp(949); /* Korean */ + err = 0; + for(i = 0; i < 0x10000; i++) { + ret = _ismbclegal(i); + exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE && + LOBYTE(i) >= 0x41 && LOBYTE(i) <= 0xFE; + if(ret != exp) { + err = 1; + break; + } + } + ok(!err, "_ismbclegal (949) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i); + _setmbcp(950); /* Chinese (Big5) */ + err = 0; + for(i = 0; i < 0x10000; i++) { + ret = _ismbclegal(i); + exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE && + ((LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0x7E) || + (LOBYTE(i) >= 0xA1 && LOBYTE(i) <= 0xFE)); + if(ret != exp) { + err = 1; + break; + } + } + ok(!err, "_ismbclegal (950) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i); + _setmbcp(1361); /* Korean (Johab) */ + err = 0; + for(i = 0; i < 0x10000; i++) { + ret = _ismbclegal(i); + exp = ((HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xD3) || + (HIBYTE(i) >= 0xD8 && HIBYTE(i) <= 0xF9)) && + ((LOBYTE(i) >= 0x31 && LOBYTE(i) <= 0x7E) || + (LOBYTE(i) >= 0x81 && LOBYTE(i) <= 0xFE)) && + HIBYTE(i) != 0xDF; + if(ret != exp) { + err = 1; + break; + } + } + todo_wine ok(!err, "_ismbclegal (1361) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i); + + _setmbcp(prev_cp); +} + static const struct { const char* string; const char* delimiter; @@ -856,6 +931,7 @@ START_TEST(string) test_strcat_s(); test__mbsnbcpy_s(); test_mbcjisjms(); + test_ismbclegal(); test_strtok(); test_wcscpy_s(); test__wcsupr_s();
1
0
0
0
David Hedberg : msvcrt: Add trail bytes info for codepage 1361.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 85cc5dd1b2c78ecb233ce8d73464c384524b765b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=85cc5dd1b2c78ecb233ce8d73…
Author: David Hedberg <david.hedberg(a)gmail.com> Date: Tue Feb 23 06:43:12 2010 +0100 msvcrt: Add trail bytes info for codepage 1361. --- dlls/msvcrt/mbcs.c | 1 + dlls/msvcrt/tests/string.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index f738bcf..f4bb248 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -48,6 +48,7 @@ static struct cp_extra_info_t g_cpextrainfo[] = {936, {0x40, 0xfe, 0, 0}}, {949, {0x41, 0xfe, 0, 0}}, {950, {0x40, 0x7e, 0xa1, 0xfe, 0, 0}}, + {1361, {0x31, 0x7e, 0x81, 0xfe, 0, 0}}, {20932, {1, 255, 0, 0}}, /* seems to give different results on different systems */ {0, {1, 255, 0, 0}} /* match all with FIXME */ }; diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 8544735..182c598 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -345,6 +345,29 @@ static void test_mbcp(void) else skip("Current locale has double-byte charset - could leave to false positives\n"); + _setmbcp(1361); + expect_eq(_ismbblead(0x80), 0, int, "%d"); + todo_wine { + expect_eq(_ismbblead(0x81), 1, int, "%d"); + expect_eq(_ismbblead(0x83), 1, int, "%d"); + } + expect_eq(_ismbblead(0x84), 1, int, "%d"); + expect_eq(_ismbblead(0xd3), 1, int, "%d"); + expect_eq(_ismbblead(0xd7), 0, int, "%d"); + todo_wine { + expect_eq(_ismbblead(0xd8), 1, int, "%d"); + } + expect_eq(_ismbblead(0xd9), 1, int, "%d"); + + expect_eq(_ismbbtrail(0x30), 0, int, "%d"); + expect_eq(_ismbbtrail(0x31), 1, int, "%d"); + expect_eq(_ismbbtrail(0x7e), 1, int, "%d"); + expect_eq(_ismbbtrail(0x7f), 0, int, "%d"); + expect_eq(_ismbbtrail(0x80), 0, int, "%d"); + expect_eq(_ismbbtrail(0x81), 1, int, "%d"); + expect_eq(_ismbbtrail(0xfe), 1, int, "%d"); + expect_eq(_ismbbtrail(0xff), 0, int, "%d"); + _setmbcp(curr_mbcp); }
1
0
0
0
XueFeng Chang : server: Check create_event return value in console creation .
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 4bc7c59f446ac8736e4db59f312b73725e35f903 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4bc7c59f446ac8736e4db59f3…
Author: XueFeng Chang <welfear(a)gmail.com> Date: Tue Feb 23 11:54:28 2010 +0800 server: Check create_event return value in console creation. --- server/console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/server/console.c b/server/console.c index a79dc67..3758a71 100644 --- a/server/console.c +++ b/server/console.c @@ -294,7 +294,7 @@ static struct object *create_console_input( struct thread* renderer ) console_input->win = 0; console_input->event = create_event( NULL, NULL, 0, 1, 0, NULL ); - if (!console_input->history || !console_input->evt) + if (!console_input->history || !console_input->evt || !console_input->event) { release_object( console_input ); return NULL;
1
0
0
0
Piotr Caban : oleaut32/tests: Added more typelib creation tests.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 456de20085545709b87077d90b1b039240e1d9b4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=456de20085545709b87077d90…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Feb 22 23:16:19 2010 +0100 oleaut32/tests: Added more typelib creation tests. --- dlls/oleaut32/tests/typelib.c | 42 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index c821fac..0dfd5bb 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -971,6 +971,7 @@ if(use_midl_tlb) { static void test_CreateTypeLib(void) { static const WCHAR stdoleW[] = {'s','t','d','o','l','e','2','.','t','l','b',0}; static OLECHAR interface1W[] = {'i','n','t','e','r','f','a','c','e','1',0}; + static OLECHAR interface2W[] = {'i','n','t','e','r','f','a','c','e','2',0}; static WCHAR defaultW[] = {'d','e','f','a','u','l','t',0x3213,0}; static OLECHAR func1W[] = {'f','u','n','c','1',0}; static OLECHAR func2W[] = {'f','u','n','c','2',0}; @@ -982,9 +983,9 @@ static void test_CreateTypeLib(void) { char filename[MAX_PATH]; WCHAR filenameW[MAX_PATH]; ICreateTypeLib2 *createtl; - ICreateTypeInfo *createti; + ICreateTypeInfo *createti, *createti2; ITypeLib *tl, *stdole; - ITypeInfo *unknown; + ITypeInfo *interface1, *interface2, *unknown, *ti; FUNCDESC funcdesc; ELEMDESC elemdesc[5]; PARAMDESCEX paramdescex; @@ -1009,6 +1010,15 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti); ok(hres == S_OK, "got %08x\n", hres); + hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&interface1); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ITypeInfo_GetRefTypeInfo(interface1, 0, NULL); + ok(hres == E_INVALIDARG, "got %08x\n", hres); + + hres = ITypeInfo_GetRefTypeInfo(interface1, 16, &ti); + ok(hres == E_FAIL, "got %08x\n", hres); + hres = ICreateTypeInfo_LayOut(createti); ok(hres == S_OK, "got %08x\n", hres); @@ -1021,6 +1031,12 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeInfo_AddRefTypeInfo(createti, unknown, &hreftype); ok(hres == S_OK, "got %08x\n", hres); + hres = ICreateTypeInfo_AddImplType(createti, 1, hreftype); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + + hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype); + ok(hres == S_OK, "got %08x\n", hres); + memset(&funcdesc, 0, sizeof(FUNCDESC)); funcdesc.funckind = FUNC_PUREVIRTUAL; funcdesc.invkind = INVOKE_PROPERTYGET; @@ -1146,6 +1162,26 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti); ok(hres == TYPE_E_NAMECONFLICT, "got %08x\n", hres); + hres = ICreateTypeLib_CreateTypeInfo(createtl, interface2W, TKIND_INTERFACE, &createti2); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_QueryInterface(createti2, &IID_ITypeInfo, (void**)&interface2); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_AddRefTypeInfo(createti2, interface1, &hreftype); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ITypeInfo_GetRefTypeInfo(interface2, 0, &ti); + ok(hres == S_OK, "got %08x\n", hres); + ok(ti == interface1, "Received and added interfaces are different\n"); + + ITypeInfo_Release(ti); + + hres = ICreateTypeInfo_AddImplType(createti2, 0, hreftype); + ok(hres == S_OK, "got %08x\n", hres); + + ICreateTypeInfo_Release(createti2); + hres = ICreateTypeLib2_SaveAllChanges(createtl); ok(hres == S_OK, "got %08x\n", hres); ICreateTypeLib2_Release(createtl); @@ -1153,6 +1189,8 @@ static void test_CreateTypeLib(void) { hres = LoadTypeLib(filenameW, &tl); ok(hres == S_OK, "got %08x\n", hres); + ITypeInfo_Release(interface2); + ITypeInfo_Release(interface1); ITypeInfo_Release(unknown); ITypeLib_Release(tl);
1
0
0
0
Piotr Caban : oleaut32: Improved implementation of ICreateTypeInfo2_fnAddImplType.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 9e02ef54e18aaca29664e4177f9a5cafe2fca1cc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9e02ef54e18aaca29664e4177…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Feb 22 23:15:42 2010 +0100 oleaut32: Improved implementation of ICreateTypeInfo2_fnAddImplType. --- dlls/oleaut32/typelib.h | 1 + dlls/oleaut32/typelib2.c | 102 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 80 insertions(+), 23 deletions(-) diff --git a/dlls/oleaut32/typelib.h b/dlls/oleaut32/typelib.h index b1c85ed..058c6a2 100644 --- a/dlls/oleaut32/typelib.h +++ b/dlls/oleaut32/typelib.h @@ -155,6 +155,7 @@ typedef struct tagMSFT_TypeInfoBase { INT datatype2; /* if 0x8000, entry above is valid */ /* actually dunno */ /* else it is zero? */ + /* if interface: inheritance level | no of inherited funcs */ INT res18; /* always? 0 */ /*060*/ INT res19; /* always? -1 */ } MSFT_TypeInfoBase; diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index a5eebea..71e8e81 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -1326,7 +1326,8 @@ static ULONG WINAPI ICreateTypeInfo2_fnRelease(ICreateTypeInfo2 *iface) if (!ref) { if (This->typelib) { ICreateTypeLib2_fnRelease((ICreateTypeLib2 *)This->typelib); - This->typelib = NULL; + /* Keep This->typelib reference to make stored ICreateTypeInfo structure valid */ + /* This->typelib = NULL; */ } /* ICreateTypeLib2 frees all ICreateTypeInfos when it releases. */ @@ -1791,18 +1792,13 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddImplType( } else if ((This->typeinfo->typekind & 15) == TKIND_DISPATCH) { FIXME("dispatch case unhandled.\n"); } else if ((This->typeinfo->typekind & 15) == TKIND_INTERFACE) { - if (This->typeinfo->cImplTypes) { - return (index == 1)? TYPE_E_BADMODULEKIND: TYPE_E_ELEMENTNOTFOUND; - } - - if (index != 0) return TYPE_E_ELEMENTNOTFOUND; + if (This->typeinfo->cImplTypes && index==1) + return TYPE_E_BADMODULEKIND; - This->typeinfo->cImplTypes++; + if( index != 0) return TYPE_E_ELEMENTNOTFOUND; - /* hacked values for IDispatch only, and maybe only for stdole. */ - This->typeinfo->cbSizeVft += 0x0c; /* hack */ - This->typeinfo->datatype1 = hRefType; - This->typeinfo->datatype2 = (3 << 16) | 1; /* ? */ + This->typeinfo->datatype1 = hRefType; + This->typeinfo->cImplTypes++; } else { FIXME("AddImplType unsupported on typekind %d\n", This->typeinfo->typekind & 15); return E_OUTOFMEMORY; @@ -2251,29 +2247,87 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut( { ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface; CyclicList *iter, *iter2, **typedata; + HREFTYPE hreftype; + HRESULT hres; int i; TRACE("(%p)\n", iface); + /* Validate inheritance */ + This->typeinfo->datatype2 = 0; + hreftype = This->typeinfo->datatype1; + + /* Process internally defined interfaces */ + for(i=0; i<This->typelib->typelib_header.nrtypeinfos; i++) { + MSFT_TypeInfoBase *header; + + if(hreftype&1) + break; + + header = (MSFT_TypeInfoBase*)&(This->typelib->typelib_segment_data[MSFT_SEG_TYPEINFO][hreftype]); + This->typeinfo->datatype2 += (header->cElement<<16) + 1; + hreftype = header->datatype1; + } + if(i == This->typelib->typelib_header.nrtypeinfos) + return TYPE_E_CIRCULARTYPE; + + /* Process externally defined interfaces */ + if(hreftype != -1) { + ITypeInfo *cur, *next; + TYPEATTR *typeattr; + + hres = ICreateTypeInfo_QueryInterface(iface, &IID_ITypeInfo, (void**)&next); + if(FAILED(hres)) + return hres; + + hres = ITypeInfo_GetRefTypeInfo(next, hreftype, &cur); + if(FAILED(hres)) + return hres; + + ITypeInfo_Release(next); + + while(1) { + hres = ITypeInfo_GetTypeAttr(cur, &typeattr); + if(FAILED(hres)) + return hres; + + This->typeinfo->datatype2 += (typeattr->cFuncs<<16) + 1; + ITypeInfo_ReleaseTypeAttr(cur, typeattr); + + hres = ITypeInfo_GetRefTypeOfImplType(cur, 0, &hreftype); + if(hres == TYPE_E_ELEMENTNOTFOUND) + break; + if(FAILED(hres)) + return hres; + + hres = ITypeInfo_GetRefTypeInfo(cur, hreftype, &next); + if(FAILED(hres)) + return hres; + + ITypeInfo_Release(cur); + cur = next; + } + } + + This->typeinfo->cbSizeVft = (This->typeinfo->datatype2>>16) * 4; if(!This->typedata) return S_OK; - typedata = HeapAlloc(GetProcessHeap(), 0, sizeof(CyclicList*)*This->typeinfo->cElement); + typedata = HeapAlloc(GetProcessHeap(), 0, sizeof(CyclicList*)*(This->typeinfo->cElement&0xffff)); if(!typedata) return E_OUTOFMEMORY; /* Assign IDs and VTBL entries */ i = 0; - This->typeinfo->cbSizeVft = 0; for(iter=This->typedata->next->next; iter!=This->typedata->next; iter=iter->next) { /* Assign MEMBERID if MEMBERID_NIL was specified */ if(iter->indice == MEMBERID_NIL) { - iter->indice = 0x60000000 + i; + iter->indice = 0x60000000 + i + (This->typeinfo->datatype2<<16); for(iter2=This->typedata->next->next; iter2!=This->typedata->next; iter2=iter2->next) { if(iter == iter2) continue; if(iter2->indice == iter->indice) { - iter->indice = 0x5fffffff + This->typeinfo->cElement + i; + iter->indice = 0x5fffffff + This->typeinfo->cElement + i + (This->typeinfo->datatype2<<16); for(iter2=This->typedata->next->next; iter2!=This->typedata->next; iter2=iter2->next) { if(iter == iter2) continue; @@ -2313,7 +2367,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut( i++; } - for(i=0; i<This->typeinfo->cElement; i++) { + for(i=0; i<(This->typeinfo->cElement&0xffff); i++) { if(typedata[i]->u.data[4]>>16 > i) { int inv; @@ -3757,14 +3811,16 @@ static HRESULT ctl2_finalize_typeinfos(ICreateTypeLib2Impl *This, int filesize) HRESULT hres; for (typeinfo = This->typeinfos; typeinfo; typeinfo = typeinfo->next_typeinfo) { - typeinfo->typeinfo->memoffset = filesize; - if (typeinfo->typedata) { - hres = ICreateTypeInfo2_fnLayOut((ICreateTypeInfo2 *)typeinfo); - if(FAILED(hres)) - return hres; + typeinfo->typeinfo->memoffset = filesize; - filesize += typeinfo->typedata->next->u.val + ((typeinfo->typeinfo->cElement >> 16) * 12) + ((typeinfo->typeinfo->cElement & 0xffff) * 12) + 4; - } + hres = ICreateTypeInfo2_fnLayOut((ICreateTypeInfo2 *)typeinfo); + if(FAILED(hres)) + return hres; + + if (typeinfo->typedata) + filesize += typeinfo->typedata->next->u.val + + ((typeinfo->typeinfo->cElement >> 16) * 12) + + ((typeinfo->typeinfo->cElement & 0xffff) * 12) + 4; } return S_OK;
1
0
0
0
Piotr Caban : oleaut: Added ITypeInfo2_fnGetRefTypeInfo implementation.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 32803c0489206b22669fa903da6ed6d9fdd9c68e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=32803c0489206b22669fa903d…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Feb 22 23:15:09 2010 +0100 oleaut: Added ITypeInfo2_fnGetRefTypeInfo implementation. --- dlls/oleaut32/typelib2.c | 73 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 71 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 38e15ea..a5eebea 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -431,6 +431,29 @@ static int ctl2_encode_string( } /**************************************************************************** + * ctl2_decode_string + * + * Converts string stored in typelib data to unicode. + */ +static void ctl2_decode_string( + char *data, /* [I] String to be decoded */ + WCHAR **string) /* [O] Decoded string */ +{ + int i, length; + static WCHAR converted_string[0x104]; + + length = data[0] + (data[1]<<8); + if(length & 1) + length >>= 2; + + for(i=0; i<length; i++) + converted_string[i] = data[i+2]; + converted_string[length] = '\0'; + + *string = converted_string; +} + +/**************************************************************************** * ctl2_alloc_segment * * Allocates memory from a segment in a type library. @@ -2813,8 +2836,54 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo( HREFTYPE hRefType, ITypeInfo** ppTInfo) { - FIXME("(%p,%d,%p), stub!\n", iface, hRefType, ppTInfo); - return E_OUTOFMEMORY; + ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface); + + TRACE("(%p,%d,%p)\n", iface, hRefType, ppTInfo); + + if(!ppTInfo) + return E_INVALIDARG; + + if(hRefType&1) { + ITypeLib *tl; + MSFT_ImpInfo *impinfo; + MSFT_ImpFile *impfile; + MSFT_GuidEntry *guid; + WCHAR *filename; + HRESULT hres; + + if(hRefType-1 >= This->typelib->typelib_segdir[MSFT_SEG_IMPORTINFO].length) + return E_FAIL; + + impinfo = (MSFT_ImpInfo*)&This->typelib->typelib_segment_data[MSFT_SEG_IMPORTINFO][hRefType-1]; + impfile = (MSFT_ImpFile*)&This->typelib->typelib_segment_data[MSFT_SEG_IMPORTFILES][impinfo->oImpFile]; + guid = (MSFT_GuidEntry*)&This->typelib->typelib_segment_data[MSFT_SEG_GUID][impinfo->oGuid]; + + ctl2_decode_string(impfile->filename, &filename); + + hres = LoadTypeLib(filename, &tl); + if(FAILED(hres)) + return hres; + + hres = ITypeLib_GetTypeInfoOfGuid(tl, &guid->guid, ppTInfo); + + ITypeLib_Release(tl); + return hres; + } else { + ICreateTypeInfo2Impl *iter; + int i = 0; + + for(iter=This->typelib->typeinfos; iter; iter=iter->next_typeinfo) { + if(This->typelib->typelib_typeinfo_offsets[i] == hRefType) { + *ppTInfo = (ITypeInfo*)&iter->lpVtblTypeInfo2; + + ITypeLib_AddRef(*ppTInfo); + return S_OK; + } + i++; + } + } + + return E_FAIL; } /******************************************************************************
1
0
0
0
Piotr Caban : oleaut32: Improved ICreateTypeInfo2_AddRefTypeInfo implementation.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 3647c337a9483096ef9af5d36658805819b50dd7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3647c337a9483096ef9af5d36…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Feb 22 23:14:40 2010 +0100 oleaut32: Improved ICreateTypeInfo2_AddRefTypeInfo implementation. --- dlls/oleaut32/tests/typelib.c | 23 ++++++++++- dlls/oleaut32/typelib2.c | 94 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 109 insertions(+), 8 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index bcf959c..c821fac 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -969,6 +969,7 @@ if(use_midl_tlb) { } static void test_CreateTypeLib(void) { + static const WCHAR stdoleW[] = {'s','t','d','o','l','e','2','.','t','l','b',0}; static OLECHAR interface1W[] = {'i','n','t','e','r','f','a','c','e','1',0}; static WCHAR defaultW[] = {'d','e','f','a','u','l','t',0x3213,0}; static OLECHAR func1W[] = {'f','u','n','c','1',0}; @@ -982,15 +983,23 @@ static void test_CreateTypeLib(void) { WCHAR filenameW[MAX_PATH]; ICreateTypeLib2 *createtl; ICreateTypeInfo *createti; - ITypeLib *tl; + ITypeLib *tl, *stdole; + ITypeInfo *unknown; FUNCDESC funcdesc; ELEMDESC elemdesc[5]; PARAMDESCEX paramdescex; TYPEDESC typedesc1, typedesc2; + HREFTYPE hreftype; HRESULT hres; trace("CreateTypeLib tests\n"); + hres = LoadTypeLib(stdoleW, &stdole); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ITypeLib_GetTypeInfoOfGuid(stdole, &IID_IUnknown, &unknown); + ok(hres == S_OK, "got %08x\n", hres); + GetTempFileNameA(".", "tlb", 0, filename); MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, MAX_PATH); @@ -1003,6 +1012,15 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeInfo_LayOut(createti); ok(hres == S_OK, "got %08x\n", hres); + hres = ICreateTypeInfo_AddRefTypeInfo(createti, NULL, &hreftype); + ok(hres == E_INVALIDARG, "got %08x\n", hres); + + hres = ICreateTypeInfo_AddRefTypeInfo(createti, unknown, NULL); + ok(hres == E_INVALIDARG, "got %08x\n", hres); + + hres = ICreateTypeInfo_AddRefTypeInfo(createti, unknown, &hreftype); + ok(hres == S_OK, "got %08x\n", hres); + memset(&funcdesc, 0, sizeof(FUNCDESC)); funcdesc.funckind = FUNC_PUREVIRTUAL; funcdesc.invkind = INVOKE_PROPERTYGET; @@ -1135,7 +1153,10 @@ static void test_CreateTypeLib(void) { hres = LoadTypeLib(filenameW, &tl); ok(hres == S_OK, "got %08x\n", hres); + ITypeInfo_Release(unknown); + ITypeLib_Release(tl); + ITypeLib_Release(stdole); DeleteFileA(filename); } diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 907eae1..38e15ea 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -43,6 +43,7 @@ #include "windef.h" #include "winbase.h" #include "winnls.h" +#include "winreg.h" #include "winuser.h" #include "wine/unicode.h" @@ -707,6 +708,7 @@ static int ctl2_alloc_importinfo( static int ctl2_alloc_importfile( ICreateTypeLib2Impl *This, /* [I] The type library to allocate in. */ int guidoffset, /* [I] The offset to the GUID for the imported library. */ + LCID lcid, /* [I] The LCID of imported library. */ int major_version, /* [I] The major version number of the imported library. */ int minor_version, /* [I] The minor version number of the imported library. */ const WCHAR *filename) /* [I] The filename of the imported library. */ @@ -732,7 +734,7 @@ static int ctl2_alloc_importfile( importfile = (MSFT_ImpFile *)&This->typelib_segment_data[MSFT_SEG_IMPORTFILES][offset]; importfile->guid = guidoffset; - importfile->lcid = This->typelib_header.lcid2; + importfile->lcid = lcid; importfile->version = major_version | (minor_version << 16); memcpy(importfile->filename, encoded_string, length); @@ -1370,7 +1372,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, U guidoffset = ctl2_alloc_guid(This->typelib, &foo); if (guidoffset == -1) return E_OUTOFMEMORY; - fileoffset = ctl2_alloc_importfile(This->typelib, guidoffset, 2, 0, stdole2tlb); + fileoffset = ctl2_alloc_importfile(This->typelib, guidoffset, + This->typelib->typelib_header.lcid2, 2, 0, stdole2tlb); if (fileoffset == -1) return E_OUTOFMEMORY; foo.guid = IID_IDispatch; @@ -1471,10 +1474,10 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo( TRACE("(%p,%p,%p)\n", iface, pTInfo, phRefType); + if(!pTInfo || !phRefType) + return E_INVALIDARG; + /* - * If this is one of ours, we set *phRefType to the TYPEINFO offset of - * the referred TypeInfo. Otherwise, we presumably have more magic to do. - * * Unfortunately, we can't rely on the passed-in TypeInfo even having the * same internal structure as one of ours. It could be from another * implementation of ITypeInfo. So we need to do the following... @@ -1486,9 +1489,86 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddRefTypeInfo( } if (container == (ITypeLib *)&This->typelib->lpVtblTypeLib2) { + /* Process locally defined TypeInfo */ *phRefType = This->typelib->typelib_typeinfo_offsets[index]; } else { - FIXME("(%p,%p,%p), pTInfo from different typelib.\n", iface, pTInfo, phRefType); + static const WCHAR regkey[] = {'T','y','p','e','L','i','b','\\','{', + '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%', + '0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x', + '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x', + '}','\\','%','d','.','%','d','\\','0','\\','w','i','n','3','2',0}; + + WCHAR name[MAX_PATH], *p; + TLIBATTR *tlibattr; + TYPEATTR *typeattr; + MSFT_GuidEntry guid; + MSFT_ImpInfo impinfo; + int guid_offset, import_offset; + DWORD len; + HRESULT hres; + + /* Allocate container GUID */ + hres = ITypeLib_GetLibAttr(container, &tlibattr); + if(FAILED(hres)) + return hres; + + guid.guid = tlibattr->guid; + guid.hreftype = 2; + guid.next_hash = -1; + + guid_offset = ctl2_alloc_guid(This->typelib, &guid); + if(guid_offset == -1) { + ITypeLib_ReleaseTLibAttr(container, tlibattr); + return E_OUTOFMEMORY; + } + + /* Get import file name */ + /* Check HKEY_CLASSES_ROOT\TypeLib\{GUID}\{Ver}\0\win32 */ + len = MAX_PATH; + sprintfW(name, regkey, guid.guid.Data1, guid.guid.Data2, + guid.guid.Data3, guid.guid.Data4[0], guid.guid.Data4[1], + guid.guid.Data4[2], guid.guid.Data4[3], guid.guid.Data4[4], + guid.guid.Data4[5], guid.guid.Data4[6], guid.guid.Data4[7], + tlibattr->wMajorVerNum, tlibattr->wMinorVerNum); + + if(RegGetValueW(HKEY_CLASSES_ROOT, name, NULL, RRF_RT_REG_SZ, NULL, name, &len)!=ERROR_SUCCESS + || (p=strrchrW(name, '\\'))==NULL) { + ERR("Error guessing typelib filename\n"); + ITypeLib_ReleaseTLibAttr(container, tlibattr); + return E_NOTIMPL; + } + memmove(name, p+1, strlenW(p)*sizeof(WCHAR)); + + /* Import file */ + import_offset = ctl2_alloc_importfile(This->typelib, guid_offset, + tlibattr->lcid, tlibattr->wMajorVerNum, tlibattr->wMinorVerNum, name); + ITypeLib_ReleaseTLibAttr(container, tlibattr); + + if(import_offset == -1) + return E_OUTOFMEMORY; + + /* Allocate referenced guid */ + hres = ITypeInfo_GetTypeAttr(pTInfo, &typeattr); + if(FAILED(hres)) + return hres; + + guid.guid = typeattr->guid; + guid.hreftype = 1; + guid.next_hash = -1; + ITypeInfo_ReleaseTypeAttr(pTInfo, typeattr); + + guid_offset = ctl2_alloc_guid(This->typelib, &guid); + if(guid_offset == -1) + return E_OUTOFMEMORY; + + /* Allocate importinfo */ + impinfo.flags = ((This->typeinfo->typekind&0xf)<<24) | MSFT_IMPINFO_OFFSET_IS_GUID; + impinfo.oImpFile = import_offset; + impinfo.oGuid = guid_offset; + *phRefType = ctl2_alloc_importinfo(This->typelib, &impinfo)+1; + + if(!memcmp(&guid.guid, &IID_IDispatch, sizeof(GUID))) + This->typelib->typelib_header.dispatchpos = *phRefType; } ITypeLib_Release(container); @@ -1613,7 +1693,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( } /* update the index data */ - insert->indice = (This->typeinfo->cImplTypes << 16) | pFuncDesc->memid; + insert->indice = pFuncDesc->memid; insert->name = -1; /* insert type data to list */
1
0
0
0
Piotr Caban : oleaut32/tests: Added VT_PTR tests in function arguments.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 6ebe1ec4d315f9cf3c49adf6ca5424f4e1a0b1f0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6ebe1ec4d315f9cf3c49adf6c…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Feb 22 23:14:12 2010 +0100 oleaut32/tests: Added VT_PTR tests in function arguments. --- dlls/oleaut32/tests/typelib.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index b391866..bcf959c 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -986,6 +986,7 @@ static void test_CreateTypeLib(void) { FUNCDESC funcdesc; ELEMDESC elemdesc[5]; PARAMDESCEX paramdescex; + TYPEDESC typedesc1, typedesc2; HRESULT hres; trace("CreateTypeLib tests\n"); @@ -1053,13 +1054,25 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc); ok(hres == S_OK, "got %08x\n", hres); + elemdesc[0].tdesc.vt = VT_PTR; + elemdesc[0].tdesc.lptdesc = &typedesc1; + typedesc1.vt = VT_BSTR; + funcdesc.cParams = 1; + funcdesc.lprgelemdescParam = elemdesc; + hres = ICreateTypeInfo_AddFuncDesc(createti, 4, &funcdesc); + ok(hres == S_OK, "got %08x\n", hres); + + elemdesc[0].tdesc.lptdesc = &typedesc2; + typedesc2.vt = VT_PTR; + typedesc2.lptdesc = &typedesc1; + hres = ICreateTypeInfo_AddFuncDesc(createti, 4, &funcdesc); + ok(hres == S_OK, "got %08x\n", hres); + elemdesc[0].tdesc.vt = VT_INT; elemdesc[0].paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT; elemdesc[0].paramdesc.pparamdescex = ¶mdescex; V_VT(¶mdescex.varDefaultValue) = VT_INT; V_INT(¶mdescex.varDefaultValue) = 0x123; - funcdesc.lprgelemdescParam = elemdesc; - funcdesc.cParams = 1; hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc); ok(hres == S_OK, "got %08x\n", hres);
1
0
0
0
Piotr Caban : oleaut32: Improved ICreateTypeInfo2_SetFuncAndParamNames implementation.
by Alexandre Julliard
23 Feb '10
23 Feb '10
Module: wine Branch: master Commit: 3102176cebe5865e621ee87df85abdb85bd18ced URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3102176cebe5865e621ee87df…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Feb 22 23:13:42 2010 +0100 oleaut32: Improved ICreateTypeInfo2_SetFuncAndParamNames implementation. --- dlls/oleaut32/tests/typelib.c | 27 +++++++++++++++++++++++ dlls/oleaut32/typelib2.c | 48 ++++++++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 523f33c..b391866 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -971,6 +971,12 @@ if(use_midl_tlb) { static void test_CreateTypeLib(void) { static OLECHAR interface1W[] = {'i','n','t','e','r','f','a','c','e','1',0}; static WCHAR defaultW[] = {'d','e','f','a','u','l','t',0x3213,0}; + static OLECHAR func1W[] = {'f','u','n','c','1',0}; + static OLECHAR func2W[] = {'f','u','n','c','2',0}; + static OLECHAR param1W[] = {'p','a','r','a','m','1',0}; + static OLECHAR param2W[] = {'p','a','r','a','m','2',0}; + static OLECHAR *names1[] = {func1W, param1W, param2W}; + static OLECHAR *names2[] = {func2W, param1W, param2W}; char filename[MAX_PATH]; WCHAR filenameW[MAX_PATH]; @@ -1083,6 +1089,27 @@ static void test_CreateTypeLib(void) { hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc); ok(hres == S_OK, "got %08x\n", hres); + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1000, NULL, 1); + ok(hres == E_INVALIDARG, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1000, names1, 1); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, names1, 2); + ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, names2, 1); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, names1, 1); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 3, names2, 3); + ok(hres == S_OK, "got %08x\n", hres); + + hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 3, names1, 3); + ok(hres == TYPE_E_AMBIGUOUSNAME, "got %08x\n", hres); + ICreateTypeInfo_Release(createti); hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti); diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index f392c1d..907eae1 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -1914,32 +1914,50 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetFuncAndParamNames( UINT cNames) { ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface; - - CyclicList *iter; - UINT i; - int offset; + CyclicList *iter = NULL, *iter2; + int offset, len, i=0; char *namedata; - FIXME("(%p,%d,%s,%d), stub!\n", iface, index, debugstr_w(*rgszNames), cNames); + TRACE("(%p %d %p %d)\n", iface, index, rgszNames, cNames); - offset = ctl2_alloc_name(This->typelib, rgszNames[0]); + if(!rgszNames) + return E_INVALIDARG; - namedata = This->typelib->typelib_segment_data[MSFT_SEG_NAME] + offset; - namedata[9] &= ~0x10; - if (*((INT *)namedata) == -1) { - *((INT *)namedata) = This->typelib->typelib_typeinfo_offsets[This->typeinfo->typekind >> 16]; + if(index >= This->typeinfo->cElement || !cNames) + return TYPE_E_ELEMENTNOTFOUND; + + len = ctl2_encode_name(This->typelib, rgszNames[0], &namedata); + for(iter2=This->typedata->next->next; iter2!=This->typedata->next; iter2=iter2->next) { + if(i == index) + iter = iter2; + else if(iter2->name!=-1 && !memcmp(namedata, + This->typelib->typelib_segment_data[MSFT_SEG_NAME]+iter2->name+8, len)) + return TYPE_E_AMBIGUOUSNAME; + + i++; } - iter = This->typedata->next->next; - for(i=0; i<index; i++) - iter = iter->next; + /* cNames == cParams for put or putref accessor, cParams+1 otherwise */ + if(cNames != iter->u.data[5] + ((iter->u.data[4]>>3)&(INVOKE_PROPERTYPUT|INVOKE_PROPERTYPUTREF) ? 0 : 1)) + return TYPE_E_ELEMENTNOTFOUND; + + offset = ctl2_alloc_name(This->typelib, rgszNames[0]); + if(offset == -1) + return E_OUTOFMEMORY; iter->name = offset; + namedata = This->typelib->typelib_segment_data[MSFT_SEG_NAME] + offset; + *((INT *)namedata) = This->typelib->typelib_typeinfo_offsets[This->typeinfo->typekind >> 16]; + + if(iter->u.data[4]&0x1000) + len = iter->u.data[5]; + else + len = 0; + for (i = 1; i < cNames; i++) { - /* FIXME: Almost certainly easy to break */ offset = ctl2_alloc_name(This->typelib, rgszNames[i]); - iter->u.data[(i * 3) + 5] = offset; + iter->u.data[(i*3) + 4 + len] = offset; } return S_OK;
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
79
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Results per page:
10
25
50
100
200