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
June 2011
----- 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
809 discussions
Start a n
N
ew thread
Andrew Nguyen : ws2_32: Avoid a crash with an optional pointer in WSAAsyncGetServByPort.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: 9edafeb742d8ce0436e7e055998a94957cfacdd9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9edafeb742d8ce0436e7e0559…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:14:18 2011 -0500 ws2_32: Avoid a crash with an optional pointer in WSAAsyncGetServByPort. --- dlls/ws2_32/async.c | 16 ++++++++--- dlls/ws2_32/tests/sock.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/dlls/ws2_32/async.c b/dlls/ws2_32/async.c index ce28142..01d5d48 100644 --- a/dlls/ws2_32/async.c +++ b/dlls/ws2_32/async.c @@ -407,7 +407,7 @@ HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, LPCSTR proto, LPSTR sbuf, INT buflen) { struct async_query_getservbyport *aq; - unsigned int len = strlen(proto) + 1; + unsigned int len = proto ? strlen(proto) + 1 : 0; TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto)); @@ -416,9 +416,17 @@ HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, SetLastError( WSAEWOULDBLOCK ); return 0; } - aq->serv_proto = (char *)(aq + 1); - aq->serv_port = port; - strcpy( aq->serv_proto, proto ); + + if (proto) + { + aq->serv_proto = (char *)(aq + 1); + strcpy( aq->serv_proto, proto ); + } + else + aq->serv_proto = NULL; + + aq->serv_port = port; + return run_query( hWnd, uMsg, async_getservbyport, &aq->query, sbuf, buflen ); } diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 5db9013..f6a3e57 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -4810,6 +4810,67 @@ static void test_synchronous_WSAIoctl(void) CloseHandle( previous_port ); } +#define WM_ASYNCCOMPLETE (WM_USER + 100) +static HWND create_async_message_window(void) +{ + static const char class_name[] = "ws2_32 async message window class"; + + WNDCLASSEXA wndclass; + HWND hWnd; + + wndclass.cbSize = sizeof(wndclass); + wndclass.style = CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = DefWindowProcA; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = GetModuleHandleA(NULL); + wndclass.hIcon = LoadIconA(NULL, IDI_APPLICATION); + wndclass.hIconSm = LoadIconA(NULL, IDI_APPLICATION); + wndclass.hCursor = LoadCursorA(NULL, IDC_ARROW); + wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wndclass.lpszClassName = class_name; + wndclass.lpszMenuName = NULL; + + RegisterClassExA(&wndclass); + + hWnd = CreateWindow(class_name, "ws2_32 async message window", WS_OVERLAPPEDWINDOW, + 0, 0, 500, 500, NULL, NULL, GetModuleHandleA(NULL), NULL); + if (!hWnd) + { + ok(0, "failed to create window: %u\n", GetLastError()); + return NULL; + } + + return hWnd; +} + +static void test_WSAAsyncGetServByPort(void) +{ + HWND hwnd = create_async_message_window(); + HANDLE ret; + char buffer[MAXGETHOSTSTRUCT]; + + if (!hwnd) + return; + + /* FIXME: The asynchronous window messages should be tested. */ + + /* Parameters are not checked when initiating the asynchronous operation. */ + ret = WSAAsyncGetServByPort(NULL, 0, 0, NULL, NULL, 0); + ok(ret != NULL, "WSAAsyncGetServByPort returned NULL\n"); + + ret = WSAAsyncGetServByPort(hwnd, WM_ASYNCCOMPLETE, 0, NULL, NULL, 0); + ok(ret != NULL, "WSAAsyncGetServByPort returned NULL\n"); + + ret = WSAAsyncGetServByPort(hwnd, WM_ASYNCCOMPLETE, htons(80), NULL, NULL, 0); + ok(ret != NULL, "WSAAsyncGetServByPort returned NULL\n"); + + ret = WSAAsyncGetServByPort(hwnd, WM_ASYNCCOMPLETE, htons(80), NULL, buffer, MAXGETHOSTSTRUCT); + ok(ret != NULL, "WSAAsyncGetServByPort returned NULL\n"); + + DestroyWindow(hwnd); +} + /**************** Main program ***************/ START_TEST( sock ) @@ -4870,6 +4931,8 @@ START_TEST( sock ) test_sioRoutingInterfaceQuery(); + test_WSAAsyncGetServByPort(); + /* this is a io heavy test, do it at the end so the kernel doesn't start dropping packets */ test_send(); test_synchronous_WSAIoctl();
1
0
0
0
Andrew Nguyen : ws2_32/tests: Properly destroy the async test window.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: 2c74796456a74d00ddb1ce172fa8904620fea9c6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2c74796456a74d00ddb1ce172…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:14:13 2011 -0500 ws2_32/tests: Properly destroy the async test window. --- dlls/ws2_32/tests/sock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 07803ff..5db9013 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -3796,7 +3796,7 @@ end: if (hThread != NULL) CloseHandle(hThread); if (hWnd != NULL) - CloseHandle(hWnd); + DestroyWindow(hWnd); if (hEvent != NULL) CloseHandle(hEvent); if (hEvent2 != NULL)
1
0
0
0
Andrew Nguyen : ws2_32: Free the asynchronous query structure if thread creation fails.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: a5e0f09b52e045c70965947f8f98fa8b84de6edd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a5e0f09b52e045c70965947f8…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:14:08 2011 -0500 ws2_32: Free the asynchronous query structure if thread creation fails. --- dlls/ws2_32/async.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/dlls/ws2_32/async.c b/dlls/ws2_32/async.c index 2f79968..ce28142 100644 --- a/dlls/ws2_32/async.c +++ b/dlls/ws2_32/async.c @@ -284,6 +284,7 @@ static HANDLE run_query( HWND hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func, if (!thread) { SetLastError( WSAEWOULDBLOCK ); + HeapFree( GetProcessHeap(), 0, query ); return 0; } CloseHandle( thread );
1
0
0
0
Hans Leidekker : msi: GetUserName sets last error to ERROR_INSUFFICIENT_BUFFER if the buffer is too small .
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: 926fe277185778e275b3ad17bd2b86e5413ba959 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=926fe277185778e275b3ad17b…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Jun 1 14:48:01 2011 +0200 msi: GetUserName sets last error to ERROR_INSUFFICIENT_BUFFER if the buffer is too small. --- dlls/msi/package.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/msi/package.c b/dlls/msi/package.c index c421805..1cbb221 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -1005,7 +1005,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) msi_set_property( package->db, szProductState, bufstr ); len = 0; - if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_MORE_DATA) + if (!GetUserNameW( NULL, &len ) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { WCHAR *username; if ((username = msi_alloc( len * sizeof(WCHAR) )))
1
0
0
0
Hans Leidekker : crypt32: GetUserName sets last error to ERROR_INSUFFICIENT_BUFFER if the buffer is too small .
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: 0875abcce03d1b7d8f0b4a07473b29d847a123f3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0875abcce03d1b7d8f0b4a074…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Jun 1 14:47:43 2011 +0200 crypt32: GetUserName sets last error to ERROR_INSUFFICIENT_BUFFER if the buffer is too small. --- dlls/crypt32/protectdata.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/protectdata.c b/dlls/crypt32/protectdata.c index a7351bb..20e11f4 100644 --- a/dlls/crypt32/protectdata.c +++ b/dlls/crypt32/protectdata.c @@ -722,8 +722,8 @@ BOOL load_encryption_key(HCRYPTPROV hProv, DWORD key_len, const DATA_BLOB *salt, /* This should be the "logon credentials" instead of username */ dwError=GetLastError(); dwUsernameLen = 0; - if (!GetUserNameA(NULL,&dwUsernameLen) && - GetLastError()==ERROR_MORE_DATA && dwUsernameLen && + if (!GetUserNameA(NULL, &dwUsernameLen) && + GetLastError() == ERROR_INSUFFICIENT_BUFFER && dwUsernameLen && (szUsername = CryptMemAlloc(dwUsernameLen))) { szUsername[0]='\0';
1
0
0
0
Andrew Nguyen : advapi32: Fix last error value of GetUserNameA/ W and output buffer handling in GetUserNameA.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: c0b7345e386ac1ccc1e99577cc85093f05c55631 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c0b7345e386ac1ccc1e99577c…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:13:57 2011 -0500 advapi32: Fix last error value of GetUserNameA/W and output buffer handling in GetUserNameA. --- dlls/advapi32/advapi.c | 18 +++++++----------- dlls/advapi32/tests/security.c | 10 ---------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c index 47286a1..e135fa5 100644 --- a/dlls/advapi32/advapi.c +++ b/dlls/advapi32/advapi.c @@ -55,24 +55,20 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize ) { WCHAR *buffer; BOOL ret; - DWORD sizeW = *lpSize * 2; + DWORD sizeW = *lpSize; if (!(buffer = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) ))) { SetLastError( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; } + ret = GetUserNameW( buffer, &sizeW ); if (ret) - { - if (!(*lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL ))) - { - *lpSize = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL ); - SetLastError( ERROR_MORE_DATA ); - ret = FALSE; - } - } - else *lpSize = sizeW * 2; + WideCharToMultiByte( CP_ACP, 0, buffer, -1, lpszName, *lpSize, NULL, NULL ); + else + *lpSize = sizeW; + HeapFree( GetProcessHeap(), 0, buffer ); return ret; } @@ -91,7 +87,7 @@ GetUserNameW( LPWSTR lpszName, LPDWORD lpSize ) if (len > *lpSize) { - SetLastError(ERROR_MORE_DATA); + SetLastError( ERROR_INSUFFICIENT_BUFFER ); *lpSize = len; return FALSE; } diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 1d677ac..6a9a1d2 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3741,7 +3741,6 @@ static void test_GetUserNameA(void) ret = GetUserNameA(NULL, &required_len); ok(ret == FALSE, "GetUserNameA returned %d\n", ret); ok(required_len != 0, "Outputted buffer length was %u\n", required_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -3749,7 +3748,6 @@ static void test_GetUserNameA(void) ret = GetUserNameA(NULL, &required_len); ok(ret == FALSE, "GetUserNameA returned %d\n", ret); ok(required_len != 0 && required_len != 1, "Outputted buffer length was %u\n", required_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); /* Tests crashes on Windows. */ @@ -3774,7 +3772,6 @@ static void test_GetUserNameA(void) ok(ret == FALSE, "GetUserNameA returned %d\n", ret); ok(!memcmp(buffer, filler, sizeof(filler)), "Output buffer was altered\n"); ok(required_len != 0, "Outputted buffer length was %u\n", required_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -3783,7 +3780,6 @@ static void test_GetUserNameA(void) ret = GetUserNameA(buffer, &buffer_len); ok(ret == TRUE, "GetUserNameA returned %d, last error %u\n", ret, GetLastError()); ok(memcmp(buffer, filler, sizeof(filler)) != 0, "Output buffer was untouched\n"); - todo_wine ok(buffer_len == required_len || broken(buffer_len == required_len / sizeof(WCHAR)), /* XP+ */ "Outputted buffer length was %u\n", buffer_len); @@ -3795,11 +3791,9 @@ static void test_GetUserNameA(void) buffer_len--; ret = GetUserNameA(buffer, &buffer_len); ok(ret == FALSE, "GetUserNameA returned %d\n", ret); - todo_wine { ok(!memcmp(buffer, filler, sizeof(filler)), "Output buffer was untouched\n"); ok(buffer_len == required_len, "Outputted buffer length was %u\n", buffer_len); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); - } } static void test_GetUserNameW(void) @@ -3820,7 +3814,6 @@ static void test_GetUserNameW(void) ret = GetUserNameW(NULL, &required_len); ok(ret == FALSE, "GetUserNameW returned %d\n", ret); ok(required_len != 0, "Outputted buffer length was %u\n", required_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -3828,7 +3821,6 @@ static void test_GetUserNameW(void) ret = GetUserNameW(NULL, &required_len); ok(ret == FALSE, "GetUserNameW returned %d\n", ret); ok(required_len != 0 && required_len != 1, "Outputted buffer length was %u\n", required_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); /* Tests crash on Windows. */ @@ -3851,7 +3843,6 @@ static void test_GetUserNameW(void) ok(ret == FALSE, "GetUserNameW returned %d\n", ret); ok(!memcmp(buffer, filler, sizeof(filler)), "Output buffer was altered\n"); ok(required_len != 0, "Outputted buffer length was %u\n", required_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -3872,7 +3863,6 @@ static void test_GetUserNameW(void) broken(memcmp(buffer, filler, sizeof(filler)) != 0), /* XP+ */ "Output buffer was altered\n"); ok(buffer_len == required_len, "Outputted buffer length was %u\n", buffer_len); - todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Last error was %u\n", GetLastError()); }
1
0
0
0
Andrew Nguyen : hostname: Output a CRLF newline with the hostname string.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: c8ea11c0d8d6e0e22463715abb5a2c5843a5cb2b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c8ea11c0d8d6e0e22463715ab…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:13:21 2011 -0500 hostname: Output a CRLF newline with the hostname string. --- programs/hostname/hostname.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/programs/hostname/hostname.c b/programs/hostname/hostname.c index 003bbba..77ff23b 100644 --- a/programs/hostname/hostname.c +++ b/programs/hostname/hostname.c @@ -109,7 +109,7 @@ static int hostname_message(int msg) static void display_computer_name(void) { - static const WCHAR fmtW[] = {'%','s','\n',0}; + static const WCHAR fmtW[] = {'%','s','\r','\n',0}; char nameA[256]; WCHAR nameW[256];
1
0
0
0
Andrew Nguyen : ddraw: Handle a callback cancellation attempt in d3d7_EnumDevices.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: a90b698e0cbcdf4f2b0d67e2a35788b66e1baf58 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a90b698e0cbcdf4f2b0d67e2a…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:13:03 2011 -0500 ddraw: Handle a callback cancellation attempt in d3d7_EnumDevices. --- dlls/ddraw/ddraw.c | 10 +++++++++- dlls/ddraw/tests/d3d.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 65e70dd..8fb2ce0 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4271,8 +4271,16 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA for (i = 0; i < sizeof(device_list7)/sizeof(device_list7[0]); i++) { + HRESULT ret; + device_desc7.deviceGUID = *device_list7[i].device_guid; - callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context); + ret = callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context); + if (ret != DDENUMRET_OK) + { + TRACE("Application cancelled the enumeration.\n"); + LeaveCriticalSection(&ddraw_cs); + return D3D_OK; + } } TRACE("End of enumeration.\n"); diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index d6b8fb8..f975612 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -54,6 +54,11 @@ typedef struct { int unk; } D3D7ETest; +typedef struct { + HRESULT desired_ret; + int total; +} D3D7ECancelTest; + #define MAX_ENUMERATION_COUNT 10 typedef struct { @@ -870,6 +875,15 @@ static HRESULT WINAPI enumDevicesCallbackTest7(LPSTR DeviceDescription, LPSTR De return DDENUMRET_OK; } +static HRESULT WINAPI enumDevicesCancelTest7(LPSTR DeviceDescription, LPSTR DeviceName, LPD3DDEVICEDESC7 lpdd7, LPVOID Context) +{ + D3D7ECancelTest *d3d7et = Context; + + d3d7et->total++; + + return d3d7et->desired_ret; +} + static HRESULT WINAPI enumDevicesLifetimeTest7(LPSTR DeviceDescription, LPSTR DeviceName, LPD3DDEVICEDESC7 lpdd7, LPVOID Context) { D3D7ELifetimeTest *ctx = Context; @@ -895,12 +909,14 @@ static void D3D7EnumTest(void) { HRESULT hr; D3D7ETest d3d7et; + D3D7ECancelTest d3d7_cancel_test; hr = IDirect3D7_EnumDevices(lpD3D, NULL, NULL); ok(hr == DDERR_INVALIDPARAMS, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); memset(&d3d7et, 0, sizeof(d3d7et)); - IDirect3D7_EnumDevices(lpD3D, enumDevicesCallbackTest7, &d3d7et); + hr = IDirect3D7_EnumDevices(lpD3D, enumDevicesCallbackTest7, &d3d7et); + ok(hr == D3D_OK, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); /* A couple of games (Delta Force LW and TFD) rely on this behaviour */ ok(d3d7et.tnlhal < d3d7et.total, "TnLHal device enumerated as only device.\n"); @@ -910,6 +926,23 @@ static void D3D7EnumTest(void) if(d3d7et.tnlhal) ok(d3d7et.hal, "TnLHal device enumerated, but no Hal device found.\n"); + + d3d7_cancel_test.desired_ret = DDENUMRET_CANCEL; + d3d7_cancel_test.total = 0; + hr = IDirect3D7_EnumDevices(lpD3D, enumDevicesCancelTest7, &d3d7_cancel_test); + ok(hr == D3D_OK, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); + + ok(d3d7_cancel_test.total == 1, "Enumerated a total of %u devices\n", + d3d7_cancel_test.total); + + /* An enumeration callback can return any value besides DDENUMRET_OK to stop enumeration. */ + d3d7_cancel_test.desired_ret = E_INVALIDARG; + d3d7_cancel_test.total = 0; + hr = IDirect3D7_EnumDevices(lpD3D, enumDevicesCancelTest7, &d3d7_cancel_test); + ok(hr == D3D_OK, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); + + ok(d3d7_cancel_test.total == 1, "Enumerated a total of %u devices\n", + d3d7_cancel_test.total); } static void D3D7EnumLifetimeTest(void)
1
0
0
0
Andrew Nguyen : ddraw: Extend the lifetime of the EnumDevices strings beyond function scope.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: f2f529ae38b378b12935d2f7489a1a8f6a7a7a7b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f2f529ae38b378b12935d2f74…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Jun 1 07:12:45 2011 -0500 ddraw: Extend the lifetime of the EnumDevices strings beyond function scope. --- dlls/ddraw/ddraw.c | 48 +++++++++++++++++------ dlls/ddraw/tests/d3d.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 13 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 3365c35..65e70dd 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -39,6 +39,35 @@ static const DDDEVICEIDENTIFIER2 deviceidentifier = 0 }; +static struct enum_device_entry +{ + char interface_name[100]; + char device_name[100]; + const GUID *device_guid; +} device_list7[] = +{ + /* T&L HAL device */ + { + "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D", + "Wine D3D7 T&L HAL", + &IID_IDirect3DTnLHalDevice, + }, + + /* HAL device */ + { + "WINE Direct3D7 Hardware acceleration using WineD3D", + "Wine D3D7 HAL", + &IID_IDirect3DHALDevice, + }, + + /* RGB device */ + { + "WINE Direct3D7 RGB Software Emulation using WineD3D", + "Wine D3D7 RGB", + &IID_IDirect3DRGBDevice, + }, +}; + static void STDMETHODCALLTYPE ddraw_null_wined3d_object_destroyed(void *parent) {} const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops = @@ -4220,17 +4249,11 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur *****************************************************************************/ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBACK7 callback, void *context) { - char interface_name_tnl[] = "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D"; - char device_name_tnl[] = "Wine D3D7 T&L HAL"; - char interface_name_hal[] = "WINE Direct3D7 Hardware acceleration using WineD3D"; - char device_name_hal[] = "Wine D3D7 HAL"; - char interface_name_rgb[] = "WINE Direct3D7 RGB Software Emulation using WineD3D"; - char device_name_rgb[] = "Wine D3D7 RGB"; - IDirectDrawImpl *This = impl_from_IDirect3D7(iface); D3DDEVICEDESC7 device_desc7; D3DDEVICEDESC device_desc1; HRESULT hr; + size_t i; TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); @@ -4245,13 +4268,12 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA LeaveCriticalSection(&ddraw_cs); return hr; } - callback(interface_name_tnl, device_name_tnl, &device_desc7, context); - device_desc7.deviceGUID = IID_IDirect3DHALDevice; - callback(interface_name_hal, device_name_hal, &device_desc7, context); - - device_desc7.deviceGUID = IID_IDirect3DRGBDevice; - callback(interface_name_rgb, device_name_rgb, &device_desc7, context); + for (i = 0; i < sizeof(device_list7)/sizeof(device_list7[0]); i++) + { + device_desc7.deviceGUID = *device_list7[i].device_guid; + callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context); + } TRACE("End of enumeration.\n"); diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 4dc2a20..d6b8fb8 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -54,6 +54,16 @@ typedef struct { int unk; } D3D7ETest; +#define MAX_ENUMERATION_COUNT 10 +typedef struct +{ + unsigned int count; + char *callback_description_ptrs[MAX_ENUMERATION_COUNT]; + char callback_description_strings[MAX_ENUMERATION_COUNT][100]; + char *callback_name_ptrs[MAX_ENUMERATION_COUNT]; + char callback_name_strings[MAX_ENUMERATION_COUNT][100]; +} D3D7ELifetimeTest; + /* To compare bad floating point numbers. Not the ideal way to do it, * but it should be enough for here */ #define comparefloat(a, b) ( (((a) - (b)) < 0.0001) && (((a) - (b)) > -0.0001) ) @@ -860,6 +870,24 @@ static HRESULT WINAPI enumDevicesCallbackTest7(LPSTR DeviceDescription, LPSTR De return DDENUMRET_OK; } +static HRESULT WINAPI enumDevicesLifetimeTest7(LPSTR DeviceDescription, LPSTR DeviceName, LPD3DDEVICEDESC7 lpdd7, LPVOID Context) +{ + D3D7ELifetimeTest *ctx = Context; + + if (ctx->count == MAX_ENUMERATION_COUNT) + { + ok(0, "Enumerated too many devices for context in callback\n"); + return DDENUMRET_CANCEL; + } + + ctx->callback_description_ptrs[ctx->count] = DeviceDescription; + strcpy(ctx->callback_description_strings[ctx->count], DeviceDescription); + ctx->callback_name_ptrs[ctx->count] = DeviceName; + strcpy(ctx->callback_name_strings[ctx->count], DeviceName); + + ctx->count++; + return DDENUMRET_OK; +} /* Check the deviceGUID of devices enumerated by IDirect3D7_EnumDevices. */ @@ -884,6 +912,75 @@ static void D3D7EnumTest(void) ok(d3d7et.hal, "TnLHal device enumerated, but no Hal device found.\n"); } +static void D3D7EnumLifetimeTest(void) +{ + D3D7ELifetimeTest ctx, ctx2; + HRESULT hr; + unsigned int i; + + ctx.count = 0; + hr = IDirect3D7_EnumDevices(lpD3D, enumDevicesLifetimeTest7, &ctx); + ok(hr == D3D_OK, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); + + /* The enumeration strings remain valid even after IDirect3D7_EnumDevices finishes. */ + for (i = 0; i < ctx.count; i++) + { + ok(!strcmp(ctx.callback_description_ptrs[i], ctx.callback_description_strings[i]), + "Got '%s' and '%s'\n", ctx.callback_description_ptrs[i], ctx.callback_description_strings[i]); + ok(!strcmp(ctx.callback_name_ptrs[i], ctx.callback_name_strings[i]), + "Got '%s' and '%s'\n", ctx.callback_name_ptrs[i], ctx.callback_name_strings[i]); + } + + ctx2.count = 0; + hr = IDirect3D7_EnumDevices(lpD3D, enumDevicesLifetimeTest7, &ctx2); + ok(hr == D3D_OK, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); + + /* The enumeration strings and their order are identical across enumerations. */ + ok(ctx.count == ctx2.count, "Enumerated %u and %u devices\n", ctx.count, ctx2.count); + if (ctx.count == ctx2.count) + { + for (i = 0; i < ctx.count; i++) + { + ok(ctx.callback_description_ptrs[i] == ctx2.callback_description_ptrs[i], + "Unequal description pointers %p and %p\n", ctx.callback_description_ptrs[i], ctx2.callback_description_ptrs[i]); + ok(!strcmp(ctx.callback_description_strings[i], ctx2.callback_description_strings[i]), + "Got '%s' and '%s'\n", ctx.callback_description_strings[i], ctx2.callback_description_strings[i]); + ok(ctx.callback_name_ptrs[i] == ctx2.callback_name_ptrs[i], + "Unequal name pointers %p and %p\n", ctx.callback_name_ptrs[i], ctx2.callback_name_ptrs[i]); + ok(!strcmp(ctx.callback_name_strings[i], ctx2.callback_name_strings[i]), + "Got '%s' and '%s'\n", ctx.callback_name_strings[i], ctx2.callback_name_strings[i]); + } + } + + /* Try altering the contents of the enumeration strings. */ + for (i = 0; i < ctx2.count; i++) + { + strcpy(ctx2.callback_description_ptrs[i], "Fake Description"); + strcpy(ctx2.callback_name_ptrs[i], "Fake Device"); + } + + ctx2.count = 0; + hr = IDirect3D7_EnumDevices(lpD3D, enumDevicesLifetimeTest7, &ctx2); + ok(hr == D3D_OK, "IDirect3D7_EnumDevices returned 0x%08x\n", hr); + + /* The original contents of the enumeration strings are not restored. */ + ok(ctx.count == ctx2.count, "Enumerated %u and %u devices\n", ctx.count, ctx2.count); + if (ctx.count == ctx2.count) + { + for (i = 0; i < ctx.count; i++) + { + ok(ctx.callback_description_ptrs[i] == ctx2.callback_description_ptrs[i], + "Unequal description pointers %p and %p\n", ctx.callback_description_ptrs[i], ctx2.callback_description_ptrs[i]); + ok(strcmp(ctx.callback_description_strings[i], ctx2.callback_description_strings[i]) != 0, + "Got '%s' and '%s'\n", ctx.callback_description_strings[i], ctx2.callback_description_strings[i]); + ok(ctx.callback_name_ptrs[i] == ctx2.callback_name_ptrs[i], + "Unequal name pointers %p and %p\n", ctx.callback_name_ptrs[i], ctx2.callback_name_ptrs[i]); + ok(strcmp(ctx.callback_name_strings[i], ctx2.callback_name_strings[i]) != 0, + "Got '%s' and '%s'\n", ctx.callback_name_strings[i], ctx2.callback_name_strings[i]); + } + } +} + static void CapsTest(void) { IDirect3D3 *d3d3; @@ -4093,6 +4190,7 @@ START_TEST(d3d) SceneTest(); LimitTest(); D3D7EnumTest(); + D3D7EnumLifetimeTest(); SetMaterialTest(); ComputeSphereVisibility(); CapsTest();
1
0
0
0
Marko Nikolic : comctl32/tests: Removed sign comparison warning in tooltip tests.
by Alexandre Julliard
01 Jun '11
01 Jun '11
Module: wine Branch: master Commit: 2dd0d8ab2a200e74fca6a32ecec93a1811770e7b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2dd0d8ab2a200e74fca6a32ec…
Author: Marko Nikolic <grkoma(a)gmail.com> Date: Tue May 31 23:38:47 2011 +0200 comctl32/tests: Removed sign comparison warning in tooltip tests. --- dlls/comctl32/tests/tooltips.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index 8ca3f7b..596598f 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -148,7 +148,7 @@ static void test_customdraw(void) { {CDRF_NEWFONT, TEST_CDDS_PREPAINT} }; - int iterationNumber; + DWORD iterationNumber; WNDCLASSA wc; LRESULT lResult; @@ -435,7 +435,7 @@ static void test_ttm_gettoolinfo(void) ti.uFlags = 0; ti.uId = 0x1234ABCD; ti.lpszText = NULL; - ti.lParam = 0xdeadbeef; + ti.lParam = 0x1abe11ed; GetClientRect(hwnd, &ti.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&ti); ok(r, "Adding the tool to the tooltip failed\n"); @@ -444,9 +444,9 @@ static void test_ttm_gettoolinfo(void) ti.lParam = 0xaaaaaaaa; r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&ti); ok(r, "Getting tooltip info failed\n"); - ok(0xdeadbeef == ti.lParam || - broken(0xdeadbeef != ti.lParam), /* comctl32 < 5.81 */ - "Expected 0xdeadbeef, got %lx\n", ti.lParam); + ok(0x1abe11ed == ti.lParam || + broken(0x1abe11ed != ti.lParam), /* comctl32 < 5.81 */ + "Expected 0x1abe11ed, got %lx\n", ti.lParam); tiW.cbSize = TTTOOLINFOW_V2_SIZE; tiW.hwnd = NULL; @@ -454,22 +454,22 @@ static void test_ttm_gettoolinfo(void) tiW.lParam = 0xaaaaaaaa; r = SendMessageA(hwnd, TTM_GETTOOLINFOW, 0, (LPARAM)&tiW); ok(r, "Getting tooltip info failed\n"); - ok(0xdeadbeef == tiW.lParam || - broken(0xdeadbeef != tiW.lParam), /* comctl32 < 5.81 */ - "Expected 0xdeadbeef, got %lx\n", tiW.lParam); + ok(0x1abe11ed == tiW.lParam || + broken(0x1abe11ed != tiW.lParam), /* comctl32 < 5.81 */ + "Expected 0x1abe11ed, got %lx\n", tiW.lParam); ti.cbSize = TTTOOLINFOA_V2_SIZE; ti.uId = 0x1234ABCD; - ti.lParam = 0xaaaaaaaa; + ti.lParam = 0x55555555; SendMessageA(hwnd, TTM_SETTOOLINFOA, 0, (LPARAM)&ti); ti.cbSize = TTTOOLINFOA_V2_SIZE; ti.lParam = 0xdeadbeef; r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&ti); ok(r, "Getting tooltip info failed\n"); - ok(0xaaaaaaaa == ti.lParam || - broken(0xaaaaaaaa != ti.lParam), /* comctl32 < 5.81 */ - "Expected 0xaaaaaaaa, got %lx\n", ti.lParam); + ok(0x55555555 == ti.lParam || + broken(0x55555555 != ti.lParam), /* comctl32 < 5.81 */ + "Expected 0x55555555, got %lx\n", ti.lParam); DestroyWindow(hwnd);
1
0
0
0
← Newer
1
...
76
77
78
79
80
81
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
80
81
Results per page:
10
25
50
100
200