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
July
June
May
April
March
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
May 2015
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 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
428 discussions
Start a n
N
ew thread
Martin Storsjo : kernel32: Implement GetSystemTimePreciseAsFileTime.
by Alexandre Julliard
20 May '15
20 May '15
Module: wine Branch: master Commit: c9c5ceccb4f50a81a0f99d683a46dc1f5d4ede62 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c9c5ceccb4f50a81a0f99d683…
Author: Martin Storsjo <martin(a)martin.st> Date: Tue May 19 22:20:46 2015 +0300 kernel32: Implement GetSystemTimePreciseAsFileTime. This just falls back to doing the same as GetSystemTimeAsFileTime. --- .../api-ms-win-core-sysinfo-l1-2-0.spec | 2 +- .../api-ms-win-core-sysinfo-l1-2-1.spec | 2 +- dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/tests/time.c | 42 ++++++++++++++++++++++ dlls/kernel32/time.c | 15 ++++++++ include/winbase.h | 1 + 6 files changed, 61 insertions(+), 2 deletions(-) diff --git a/dlls/api-ms-win-core-sysinfo-l1-2-0/api-ms-win-core-sysinfo-l1-2-0.spec b/dlls/api-ms-win-core-sysinfo-l1-2-0/api-ms-win-core-sysinfo-l1-2-0.spec index d3df6bd..9b05674 100644 --- a/dlls/api-ms-win-core-sysinfo-l1-2-0/api-ms-win-core-sysinfo-l1-2-0.spec +++ b/dlls/api-ms-win-core-sysinfo-l1-2-0/api-ms-win-core-sysinfo-l1-2-0.spec @@ -14,7 +14,7 @@ @ stdcall GetSystemTime(ptr) kernel32.GetSystemTime @ stdcall GetSystemTimeAdjustment(ptr ptr ptr) kernel32.GetSystemTimeAdjustment @ stdcall GetSystemTimeAsFileTime(ptr) kernel32.GetSystemTimeAsFileTime -@ stub GetSystemTimePreciseAsFileTime +@ stdcall GetSystemTimePreciseAsFileTime(ptr) kernel32.GetSystemTimePreciseAsFileTime @ stdcall GetSystemWindowsDirectoryA(ptr long) kernel32.GetSystemWindowsDirectoryA @ stdcall GetSystemWindowsDirectoryW(ptr long) kernel32.GetSystemWindowsDirectoryW @ stdcall GetTickCount() kernel32.GetTickCount diff --git a/dlls/api-ms-win-core-sysinfo-l1-2-1/api-ms-win-core-sysinfo-l1-2-1.spec b/dlls/api-ms-win-core-sysinfo-l1-2-1/api-ms-win-core-sysinfo-l1-2-1.spec index 29262c5..018ab05 100644 --- a/dlls/api-ms-win-core-sysinfo-l1-2-1/api-ms-win-core-sysinfo-l1-2-1.spec +++ b/dlls/api-ms-win-core-sysinfo-l1-2-1/api-ms-win-core-sysinfo-l1-2-1.spec @@ -16,7 +16,7 @@ @ stdcall GetSystemTime(ptr) kernel32.GetSystemTime @ stdcall GetSystemTimeAdjustment(ptr ptr ptr) kernel32.GetSystemTimeAdjustment @ stdcall GetSystemTimeAsFileTime(ptr) kernel32.GetSystemTimeAsFileTime -@ stub GetSystemTimePreciseAsFileTime +@ stdcall GetSystemTimePreciseAsFileTime(ptr) kernel32.GetSystemTimePreciseAsFileTime @ stdcall GetSystemWindowsDirectoryA(ptr long) kernel32.GetSystemWindowsDirectoryA @ stdcall GetSystemWindowsDirectoryW(ptr long) kernel32.GetSystemWindowsDirectoryW @ stdcall -ret64 GetTickCount64() kernel32.GetTickCount64 diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 1261738..8f6a13e 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -829,6 +829,7 @@ @ stdcall GetSystemTime(ptr) @ stdcall GetSystemTimeAdjustment(ptr ptr ptr) @ stdcall GetSystemTimeAsFileTime(ptr) +@ stdcall GetSystemTimePreciseAsFileTime(ptr) @ stdcall GetSystemTimes(ptr ptr ptr) @ stdcall GetSystemWindowsDirectoryA(ptr long) @ stdcall GetSystemWindowsDirectoryW(ptr long) diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c index 378941d..d205174 100644 --- a/dlls/kernel32/tests/time.c +++ b/dlls/kernel32/tests/time.c @@ -28,6 +28,7 @@ static BOOL (WINAPI *pSystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION, static int (WINAPI *pGetCalendarInfoA)(LCID,CALID,CALTYPE,LPSTR,int,LPDWORD); static int (WINAPI *pGetCalendarInfoW)(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD); static DWORD (WINAPI *pGetDynamicTimeZoneInformation)(DYNAMIC_TIME_ZONE_INFORMATION*); +static void (WINAPI *pGetSystemTimePreciseAsFileTime)(LPFILETIME); #define SECSPERMIN 60 #define SECSPERDAY 86400 @@ -761,6 +762,45 @@ static void test_GetDynamicTimeZoneInformation(void) trace("Dyn TimeZoneKeyName %s\n", wine_dbgstr_w(dyninfo.TimeZoneKeyName)); } +static ULONGLONG get_longlong_time(FILETIME *time) +{ + ULARGE_INTEGER uli; + uli.LowPart = time->dwLowDateTime; + uli.HighPart = time->dwHighDateTime; + return uli.QuadPart; +} + +static void test_GetSystemTimePreciseAsFileTime(void) +{ + FILETIME ft; + ULONGLONG time1, time2; + LONGLONG diff; + + if (!pGetSystemTimePreciseAsFileTime) + { + win_skip("GetSystemTimePreciseAsFileTime() is not supported.\n"); + return; + } + + GetSystemTimeAsFileTime(&ft); + time1 = get_longlong_time(&ft); + pGetSystemTimePreciseAsFileTime(&ft); + time2 = get_longlong_time(&ft); + diff = time2 - time1; + if (diff < 0) + diff = -diff; + ok(diff < 1000000, "Difference between GetSystemTimeAsFileTime and GetSystemTimePreciseAsFileTime more than 100 ms\n"); + + pGetSystemTimePreciseAsFileTime(&ft); + time1 = get_longlong_time(&ft); + do { + pGetSystemTimePreciseAsFileTime(&ft); + time2 = get_longlong_time(&ft); + } while (time2 == time1); + diff = time2 - time1; + ok(diff < 10000 && diff > 0, "GetSystemTimePreciseAsFileTime incremented by more than 1 ms\n"); +} + START_TEST(time) { HMODULE hKernel = GetModuleHandleA("kernel32"); @@ -769,6 +809,7 @@ START_TEST(time) pGetCalendarInfoA = (void *)GetProcAddress(hKernel, "GetCalendarInfoA"); pGetCalendarInfoW = (void *)GetProcAddress(hKernel, "GetCalendarInfoW"); pGetDynamicTimeZoneInformation = (void *)GetProcAddress(hKernel, "GetDynamicTimeZoneInformation"); + pGetSystemTimePreciseAsFileTime = (void *)GetProcAddress(hKernel, "GetSystemTimePreciseAsFileTime"); test_conversions(); test_invalid_arg(); @@ -779,4 +820,5 @@ START_TEST(time) test_FileTimeToDosDateTime(); test_GetCalendarInfo(); test_GetDynamicTimeZoneInformation(); + test_GetSystemTimePreciseAsFileTime(); } diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c index 2b8e1d9..daafc7f 100644 --- a/dlls/kernel32/time.c +++ b/dlls/kernel32/time.c @@ -548,6 +548,21 @@ VOID WINAPI GetSystemTimeAsFileTime( } +/*********************************************************************** + * GetSystemTimePreciseAsFileTime (KERNEL32.@) + * + * Get the current time in utc format, with <1 us precision. + * + * RETURNS + * Nothing. + */ +VOID WINAPI GetSystemTimePreciseAsFileTime( + LPFILETIME time) /* [out] Destination for the current utc time */ +{ + GetSystemTimeAsFileTime(time); +} + + /********************************************************************* * TIME_ClockTimeToFileTime (olorin(a)fandra.org, 20-Sep-1998) * diff --git a/include/winbase.h b/include/winbase.h index a8f3fb6..7540e6d 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -2040,6 +2040,7 @@ WINBASEAPI BOOL WINAPI GetSystemRegistryQuota(PDWORD,PDWORD); WINBASEAPI VOID WINAPI GetSystemTime(LPSYSTEMTIME); WINBASEAPI BOOL WINAPI GetSystemTimeAdjustment(PDWORD,PDWORD,PBOOL); WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME); +WINBASEAPI VOID WINAPI GetSystemTimePreciseAsFileTime(LPFILETIME); WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryA(LPSTR,UINT); WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryW(LPWSTR,UINT); #define GetSystemWindowsDirectory WINELIB_NAME_AW(GetSystemWindowsDirectory)
1
0
0
0
Huw Davies : user32/tests: Fix tests on Windows 8.
by Alexandre Julliard
20 May '15
20 May '15
Module: wine Branch: master Commit: b3fe7f7c1bb8a11e2b4b157c1af9a9a7c536ecfe URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b3fe7f7c1bb8a11e2b4b157c1…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue May 19 16:15:13 2015 +0100 user32/tests: Fix tests on Windows 8. --- dlls/user32/tests/edit.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index e5c05db..e8b41c2 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -841,12 +841,14 @@ static void zero_notify(void) } #define test_notify(enchange, enmaxtext, enupdate) \ +do { \ ok(notifications.en_change == enchange, "expected %d EN_CHANGE notifications, " \ "got %d\n", enchange, notifications.en_change); \ ok(notifications.en_maxtext == enmaxtext, "expected %d EN_MAXTEXT notifications, " \ "got %d\n", enmaxtext, notifications.en_maxtext); \ ok(notifications.en_update == enupdate, "expected %d EN_UPDATE notifications, " \ - "got %d\n", enupdate, notifications.en_update) + "got %d\n", enupdate, notifications.en_update); \ +} while(0) static LRESULT CALLBACK edit3_wnd_procA(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -907,8 +909,10 @@ static void test_edit_control_3(void) zero_notify(); SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str); len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0); - ok(lstrlenA(str) > len, "text should have been truncated\n"); - test_notify(1, 1, 1); + if (len == lstrlenA(str)) /* Win 8 */ + test_notify(1, 0, 1); + else + test_notify(1, 1, 1); SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)""); zero_notify(); @@ -998,8 +1002,13 @@ static void test_edit_control_3(void) zero_notify(); SendMessageA(hWnd, EM_REPLACESEL, 0, (LPARAM)str); len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0); - ok(0 == len, "text should have been truncated, expected 0, got %d\n", len); - test_notify(1, 1, 1); + if (len == lstrlenA(str)) /* Win 8 */ + test_notify(1, 0, 1); + else + { + ok(0 == len, "text should have been truncated, expected 0, got %d\n", len); + test_notify(1, 1, 1); + } SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)""); zero_notify();
1
0
0
0
Jacek Caban : urlmon: Correctly handle hash part in file protocol handler.
by Alexandre Julliard
20 May '15
20 May '15
Module: wine Branch: master Commit: 16274e78b658816531df4d670ac89b62329130f7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=16274e78b658816531df4d670…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue May 19 16:36:48 2015 +0200 urlmon: Correctly handle hash part in file protocol handler. --- dlls/urlmon/file.c | 51 +++++++++++++++++++++----------------------- dlls/urlmon/tests/protocol.c | 32 ++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 30 deletions(-) diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c index 80d9dd6..bba7be1 100644 --- a/dlls/urlmon/file.c +++ b/dlls/urlmon/file.c @@ -217,35 +217,14 @@ static inline HRESULT report_result(IInternetProtocolSink *protocol_sink, HRESUL return hres; } -static HRESULT open_file(FileProtocol *This, const WCHAR *path, IInternetProtocolSink *protocol_sink) -{ - LARGE_INTEGER size; - HANDLE file; - - file = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if(file == INVALID_HANDLE_VALUE) - return report_result(protocol_sink, INET_E_RESOURCE_NOT_FOUND, GetLastError()); - - if(!GetFileSizeEx(file, &size)) { - CloseHandle(file); - return report_result(protocol_sink, INET_E_RESOURCE_NOT_FOUND, GetLastError()); - } - - This->file = file; - This->size = size.u.LowPart; - - IInternetProtocolSink_ReportProgress(protocol_sink, - BINDSTATUS_CACHEFILENAMEAVAILABLE, path); - return S_OK; -} - static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved) { FileProtocol *This = impl_from_IInternetProtocolEx(iface); - WCHAR path[MAX_PATH]; + WCHAR path[MAX_PATH], *ptr; + LARGE_INTEGER file_size; + HANDLE file_handle; BINDINFO bindinfo; DWORD grfBINDF = 0; DWORD scheme, size; @@ -296,13 +275,31 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr return report_result(pOIProtSink, hres, 0); } - hres = open_file(This, path, pOIProtSink); - if(FAILED(hres)) - return hres; + file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if(file_handle == INVALID_HANDLE_VALUE && (ptr = strrchrW(path, '#'))) { + /* If path contains fragment part, try without it. */ + *ptr = 0; + file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + } + if(file_handle == INVALID_HANDLE_VALUE) + return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, GetLastError()); + + if(!GetFileSizeEx(file_handle, &file_size)) { + CloseHandle(file_handle); + return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, GetLastError()); + } + + This->file = file_handle; + This->size = file_size.u.LowPart; + IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_CACHEFILENAMEAVAILABLE, path); hres = IUri_GetExtension(pUri, &ext); if(SUCCEEDED(hres)) { if(hres == S_OK && *ext) { + if((ptr = strchrW(ext, '#'))) + *ptr = 0; hres = find_mime_from_ext(ext, &mime); if(SUCCEEDED(hres)) { IInternetProtocolSink_ReportProgress(pOIProtSink, diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index bfe4439..c50d356 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -153,7 +153,7 @@ static PROTOCOLDATA protocoldata, *pdata, continue_protdata; static DWORD prot_read, filter_state, http_post_test, thread_id; static BOOL security_problem, test_async_req, impl_protex; static BOOL async_read_pending, mimefilter_test, direct_read, wait_for_switch, emulate_prot, short_read, test_abort; -static BOOL empty_file, no_mime, bind_from_cache; +static BOOL empty_file, no_mime, bind_from_cache, file_with_hash; enum { STATE_CONNECTING, @@ -907,7 +907,8 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR ok(ulProgress == ulProgressMax, "ulProgress (%d) != ulProgressMax (%d)\n", ulProgress, ulProgressMax); - ok(ulProgressMax == 13, "ulProgressMax=%d, expected 13\n", ulProgressMax); + if(!file_with_hash) + ok(ulProgressMax == 13, "ulProgressMax=%d, expected 13\n", ulProgressMax); /* BSCF_SKIPDRAINDATAFORFILEURLS added in IE8 */ if(tested_protocol == FILE_TEST) ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) || @@ -2396,6 +2397,7 @@ static void init_test(int prot, DWORD flags) impl_protex = (flags & TEST_IMPLPROTEX) != 0; empty_file = (flags & TEST_EMPTY) != 0; bind_from_cache = (flags & TEST_FROMCACHE) != 0; + file_with_hash = FALSE; register_filter(mimefilter_test); } @@ -2530,6 +2532,8 @@ static void test_file_protocol_url(LPCWSTR url) hres = IInternetProtocol_Read(protocol, buf, 2, &cb); ok(hres == S_OK, "Read failed: %08x\n", hres); ok(cb == 2, "cb=%u expected 2\n", cb); + buf[2] = 0; + ok(!memcmp(buf, file_with_hash ? "XX" : "<H", 2), "Unexpected data %s\n", buf); hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); ok(hres == S_FALSE, "Read failed: %08x\n", hres); hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb); @@ -2564,7 +2568,10 @@ static void test_file_protocol_url(LPCWSTR url) hres = IInternetProtocol_UnlockRequest(protocol); ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); hres = IInternetProtocol_Read(protocol, buf, 2, &cb); - ok(hres == S_OK, "Read failed: %08x\n", hres); + if(file_with_hash) /* FIXME: An effect of UnlockRequest call? */ + todo_wine ok(hres == S_OK, "Read failed: %08x\n", hres); + else + ok(hres == S_OK, "Read failed: %08x\n", hres); hres = IInternetProtocol_Terminate(protocol, 0); ok(hres == S_OK, "Terminate failed: %08x\n", hres); } @@ -2717,6 +2724,7 @@ static void test_file_protocol(void) { static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0}; static const WCHAR wszFile4[] = {'f','i','l','e',':','\\','\\',0}; static const char html_doc[] = "<HTML></HTML>"; + static const WCHAR fragmentW[] = {'#','f','r','a','g',0}; trace("Testing file protocol...\n"); init_test(FILE_TEST, 0); @@ -2790,7 +2798,25 @@ static void test_file_protocol(void) { buf[sizeof(wszFile4)/sizeof(WCHAR)] = '|'; test_file_protocol_url(buf); + /* Fragment part of URL is skipped if the file doesn't exist. */ + lstrcatW(buf, fragmentW); + test_file_protocol_url(buf); + + /* Fragment part is considered a part of the file name, if the file exsists. */ + len = lstrlenW(file_name_buf); + lstrcpyW(file_name_buf+len, fragmentW); + file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); + WriteFile(file, "XXX", 3, &size, NULL); + CloseHandle(file); + file_name_buf[len] = 0; + + file_with_hash = TRUE; + test_file_protocol_url(buf); + DeleteFileW(wszIndexHtml); + DeleteFileW(file_name_buf); bindf = 0; test_file_protocol_fail();
1
0
0
0
Thomas Faber : advapi32: Write back partial results in RegQueryInfoKeyA.
by Alexandre Julliard
20 May '15
20 May '15
Module: wine Branch: master Commit: 817d903cb97a1c088eecd0574745d8274726e912 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=817d903cb97a1c088eecd0574…
Author: Thomas Faber <thomas.faber(a)reactos.org> Date: Tue May 19 10:05:01 2015 -0400 advapi32: Write back partial results in RegQueryInfoKeyA. --- dlls/advapi32/registry.c | 22 +++++++++++----------- dlls/advapi32/tests/registry.c | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 0697c9c..30130b1 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -1049,18 +1049,18 @@ LSTATUS WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDW if (status) goto done; - RtlUnicodeToMultiByteSize( &len, (WCHAR *)(buf_ptr + info->ClassOffset), info->ClassLength); - if (class_len) + len = 0; + if (class && class_len) len = *class_len; + RtlUnicodeToMultiByteN( class, len, class_len, + (WCHAR *)(buf_ptr + info->ClassOffset), info->ClassLength ); + if (len) { - if (*class_len == 0) class = NULL; - if (class && len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW; - *class_len = len; - } - if (class && !status) - { - RtlUnicodeToMultiByteN( class, len, NULL, (WCHAR *)(buf_ptr + info->ClassOffset), - info->ClassLength ); - class[len] = 0; + class[len - 1] = 0; + if (*class_len + 1 > len) + { + status = STATUS_BUFFER_OVERFLOW; + *class_len -= 1; + } } } else status = STATUS_SUCCESS; diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 2aca837..c801384 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1815,10 +1815,10 @@ static void test_reg_query_info(void) classlen = 1; ret = RegQueryInfoKeyA(subkey, classbuffer, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); ok(ret == ERROR_MORE_DATA, "ret = %d\n", ret); - todo_wine ok(classlen == 0, "classlen = %u\n", classlen); + ok(classlen == 0, "classlen = %u\n", classlen); memset(expectbuffer, 0x55, sizeof(expectbuffer)); expectbuffer[0] = 0; - todo_wine ok(!memcmp(classbuffer, expectbuffer, sizeof(classbuffer)), "classbuffer was modified\n"); + ok(!memcmp(classbuffer, expectbuffer, sizeof(classbuffer)), "classbuffer was modified\n"); memset(classbufferW, 0x55, sizeof(classbufferW)); classlen = 1; @@ -1834,12 +1834,12 @@ static void test_reg_query_info(void) classlen = sizeof(subkey_class) - 1; ret = RegQueryInfoKeyA(subkey, classbuffer, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); ok(ret == ERROR_MORE_DATA, "ret = %d\n", ret); - todo_wine ok(classlen == sizeof(subkey_class) - 2, "classlen = %u\n", classlen); + ok(classlen == sizeof(subkey_class) - 2, "classlen = %u\n", classlen); memset(expectbuffer, 0x55, sizeof(expectbuffer)); strcpy(expectbuffer, subkey_class); expectbuffer[sizeof(subkey_class) - 2] = 0; expectbuffer[sizeof(subkey_class) - 1] = 0x55; - todo_wine ok(!memcmp(classbuffer, expectbuffer, sizeof(classbuffer)), + ok(!memcmp(classbuffer, expectbuffer, sizeof(classbuffer)), "classbuffer = %.*s, expected %s\n", (int)sizeof(classbuffer), classbuffer, expectbuffer);
1
0
0
0
Thomas Faber : advapi32: Do not fail in RegQueryInfoKey if *class_len is 0.
by Alexandre Julliard
20 May '15
20 May '15
Module: wine Branch: master Commit: 87b6d42c127f8c8b7b1dc2900c2bd18c969aa2c4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=87b6d42c127f8c8b7b1dc2900…
Author: Thomas Faber <thomas.faber(a)reactos.org> Date: Tue May 19 10:03:41 2015 -0400 advapi32: Do not fail in RegQueryInfoKey if *class_len is 0. --- dlls/advapi32/registry.c | 5 +++-- dlls/advapi32/tests/registry.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 633c0c4..0697c9c 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -849,7 +849,7 @@ LSTATUS WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPD status = NtQueryKey( hkey, KeyFullInformation, buffer, sizeof(buffer), &total_size ); if (status && status != STATUS_BUFFER_OVERFLOW) goto done; - if (class) + if (class && class_len && *class_len) { /* retry with a dynamically allocated buffer */ while (status == STATUS_BUFFER_OVERFLOW) @@ -1052,7 +1052,8 @@ LSTATUS WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDW RtlUnicodeToMultiByteSize( &len, (WCHAR *)(buf_ptr + info->ClassOffset), info->ClassLength); if (class_len) { - if (len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW; + if (*class_len == 0) class = NULL; + if (class && len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW; *class_len = len; } if (class && !status) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index c862b46..2aca837 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1747,7 +1747,7 @@ static void test_reg_query_info(void) /* with subkey & default value */ ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); - todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); + ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class), "classlen = %u\n", classlen); ok(subkeys == 1, "subkeys = %u\n", subkeys); ok(maxsubkeylen == strlen("subsubkey"), "maxsubkeylen = %u\n", maxsubkeylen); @@ -1780,7 +1780,7 @@ static void test_reg_query_info(void) /* with named value */ ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); - todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); + ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(values == 3, "values = %u\n", values); ok(maxvaluenamelen == strlen("value one"), "maxvaluenamelen = %u\n", maxvaluenamelen); ok(maxvaluelen == sizeof("second value data") * sizeof(WCHAR), "maxvaluelen = %u\n", maxvaluelen); @@ -1795,7 +1795,7 @@ static void test_reg_query_info(void) memset(classbuffer, 0x55, sizeof(classbuffer)); classlen = 0; ret = RegQueryInfoKeyA(subkey, classbuffer, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); + ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class) /* win2k */ || classlen == 0, "classlen = %u\n", classlen); memset(expectbuffer, 0x55, sizeof(expectbuffer)); @@ -1804,7 +1804,7 @@ static void test_reg_query_info(void) memset(classbufferW, 0x55, sizeof(classbufferW)); classlen = 0; ret = RegQueryInfoKeyW(subkey, classbufferW, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); + ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class) /* win2k */ || classlen == 0, "classlen = %u\n", classlen); memset(expectbufferW, 0x55, sizeof(expectbufferW));
1
0
0
0
Thomas Faber : advapi32: Use STATUS_BUFFER_TOO_SMALL for buffer overflows in RegQueryInfoKeyW.
by Alexandre Julliard
20 May '15
20 May '15
Module: wine Branch: master Commit: b6c31bea3df9a6b0da381e48a85a74580619399a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b6c31bea3df9a6b0da381e48a…
Author: Thomas Faber <thomas.faber(a)reactos.org> Date: Tue May 19 09:59:09 2015 -0400 advapi32: Use STATUS_BUFFER_TOO_SMALL for buffer overflows in RegQueryInfoKeyW. --- dlls/advapi32/registry.c | 2 +- dlls/advapi32/tests/registry.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 06833d6..633c0c4 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -865,7 +865,7 @@ LSTATUS WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPD if (class_len && (info->ClassLength/sizeof(WCHAR) + 1 > *class_len)) { - status = STATUS_BUFFER_OVERFLOW; + status = STATUS_BUFFER_TOO_SMALL; } else { diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 20b9bd8..c862b46 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1823,7 +1823,7 @@ static void test_reg_query_info(void) memset(classbufferW, 0x55, sizeof(classbufferW)); classlen = 1; ret = RegQueryInfoKeyW(subkey, classbufferW, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - todo_wine ok(ret == ERROR_INSUFFICIENT_BUFFER, "ret = %d\n", ret); + ok(ret == ERROR_INSUFFICIENT_BUFFER, "ret = %d\n", ret); ok(classlen == 0 /* win8 */ || classlen == strlen(subkey_class), "classlen = %u\n", classlen); memset(expectbufferW, 0x55, sizeof(expectbufferW)); @@ -1846,7 +1846,7 @@ static void test_reg_query_info(void) memset(classbufferW, 0x55, sizeof(classbufferW)); classlen = sizeof(subkey_class) - 1; ret = RegQueryInfoKeyW(subkey, classbufferW, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - todo_wine ok(ret == ERROR_INSUFFICIENT_BUFFER, "ret = %d\n", ret); + ok(ret == ERROR_INSUFFICIENT_BUFFER, "ret = %d\n", ret); ok(classlen == sizeof(subkey_class) - 2 /* win8 */ || classlen == strlen(subkey_class), "classlen = %u\n", classlen); memset(expectbufferW, 0x55, sizeof(expectbufferW));
1
0
0
0
Nikolay Sivov : dwrite: Added IDWriteGlyphRunAnalysis stub.
by Alexandre Julliard
19 May '15
19 May '15
Module: wine Branch: master Commit: f4790714fe69df7701cff666d6b5ab4be049cbf6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f4790714fe69df7701cff666d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue May 19 15:23:57 2015 +0300 dwrite: Added IDWriteGlyphRunAnalysis stub. --- dlls/dwrite/dwrite_private.h | 1 + dlls/dwrite/font.c | 104 +++++++++++++++++++++++++++++++++++++++++++ dlls/dwrite/main.c | 6 ++- dlls/dwrite/tests/font.c | 81 +++++++++++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index aa73b4b..cd6d08c 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -117,6 +117,7 @@ extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *refer extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN; extern HRESULT create_fontface(DWRITE_FONT_FACE_TYPE,UINT32,IDWriteFontFile* const*,UINT32,DWRITE_FONT_SIMULATIONS,IDWriteFontFace2**) DECLSPEC_HIDDEN; extern HRESULT create_font_collection(IDWriteFactory2*,IDWriteFontFileEnumerator*,BOOL,IDWriteFontCollection**) DECLSPEC_HIDDEN; +extern HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE,IDWriteGlyphRunAnalysis**) DECLSPEC_HIDDEN; extern BOOL is_system_collection(IDWriteFontCollection*) DECLSPEC_HIDDEN; extern HRESULT get_local_refkey(const WCHAR*,const FILETIME*,void**,UINT32*) DECLSPEC_HIDDEN; extern HRESULT get_filestream_from_file(IDWriteFontFile*,IDWriteFontFileStream**) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index c591f4e..85b03f6 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -97,6 +97,11 @@ struct dwrite_fonttable { UINT32 size; }; +struct dwrite_glyphrunanalysis { + IDWriteGlyphRunAnalysis IDWriteGlyphRunAnalysis_iface; + LONG ref; +}; + #define GLYPH_BLOCK_SHIFT 8 #define GLYPH_BLOCK_SIZE (1UL << GLYPH_BLOCK_SHIFT) #define GLYPH_BLOCK_MASK (GLYPH_BLOCK_SIZE - 1) @@ -155,6 +160,11 @@ static inline struct dwrite_fontcollection *impl_from_IDWriteFontCollection(IDWr return CONTAINING_RECORD(iface, struct dwrite_fontcollection, IDWriteFontCollection_iface); } +static inline struct dwrite_glyphrunanalysis *impl_from_IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysis *iface) +{ + return CONTAINING_RECORD(iface, struct dwrite_glyphrunanalysis, IDWriteGlyphRunAnalysis_iface); +} + static HRESULT get_cached_glyph_metrics(struct dwrite_fontface *fontface, UINT16 glyph, DWRITE_GLYPH_METRICS *metrics) { static const DWRITE_GLYPH_METRICS nil; @@ -2569,3 +2579,97 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke return S_OK; } + +/* IDWriteGlyphRunAnalysis */ +static HRESULT WINAPI glyphrunanalysis_QueryInterface(IDWriteGlyphRunAnalysis *iface, REFIID riid, void **ppv) +{ + struct dwrite_glyphrunanalysis *This = impl_from_IDWriteGlyphRunAnalysis(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + + if (IsEqualIID(riid, &IID_IDWriteGlyphRunAnalysis) || + IsEqualIID(riid, &IID_IUnknown)) + { + *ppv = iface; + IDWriteGlyphRunAnalysis_AddRef(iface); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI glyphrunanalysis_AddRef(IDWriteGlyphRunAnalysis *iface) +{ + struct dwrite_glyphrunanalysis *This = impl_from_IDWriteGlyphRunAnalysis(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%u)\n", This, ref); + return ref; +} + +static ULONG WINAPI glyphrunanalysis_Release(IDWriteGlyphRunAnalysis *iface) +{ + struct dwrite_glyphrunanalysis *This = impl_from_IDWriteGlyphRunAnalysis(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%u)\n", This, ref); + + if (!ref) { + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI glyphrunanalysis_GetAlphaTextureBounds(IDWriteGlyphRunAnalysis *iface, DWRITE_TEXTURE_TYPE type, RECT* bounds) +{ + struct dwrite_glyphrunanalysis *This = impl_from_IDWriteGlyphRunAnalysis(iface); + FIXME("(%p)->(%d %p): stub\n", This, type, bounds); + return E_NOTIMPL; +} + +static HRESULT WINAPI glyphrunanalysis_CreateAlphaTexture(IDWriteGlyphRunAnalysis *iface, DWRITE_TEXTURE_TYPE type, + RECT const* bounds, BYTE* alphaValues, UINT32 bufferSize) +{ + struct dwrite_glyphrunanalysis *This = impl_from_IDWriteGlyphRunAnalysis(iface); + FIXME("(%p)->(%d %p %p %u): stub\n", This, type, bounds, alphaValues, bufferSize); + return E_NOTIMPL; +} + +static HRESULT WINAPI glyphrunanalysis_GetAlphaBlendParams(IDWriteGlyphRunAnalysis *iface, IDWriteRenderingParams *params, + FLOAT *blendGamma, FLOAT *blendEnhancedContrast, FLOAT *blendClearTypeLevel) +{ + struct dwrite_glyphrunanalysis *This = impl_from_IDWriteGlyphRunAnalysis(iface); + FIXME("(%p)->(%p %p %p %p): stub\n", This, params, blendGamma, blendEnhancedContrast, blendClearTypeLevel); + return E_NOTIMPL; +} + +static const struct IDWriteGlyphRunAnalysisVtbl glyphrunanalysisvtbl = { + glyphrunanalysis_QueryInterface, + glyphrunanalysis_AddRef, + glyphrunanalysis_Release, + glyphrunanalysis_GetAlphaTextureBounds, + glyphrunanalysis_CreateAlphaTexture, + glyphrunanalysis_GetAlphaBlendParams +}; + +HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE rendering_mode, IDWriteGlyphRunAnalysis **ret) +{ + struct dwrite_glyphrunanalysis *analysis; + + *ret = NULL; + + /* check for valid rendering mode */ + if ((UINT32)rendering_mode >= DWRITE_RENDERING_MODE_OUTLINE || rendering_mode == DWRITE_RENDERING_MODE_DEFAULT) + return E_INVALIDARG; + + analysis = heap_alloc(sizeof(*analysis)); + if (!analysis) + return E_OUTOFMEMORY; + + analysis->IDWriteGlyphRunAnalysis_iface.lpVtbl = &glyphrunanalysisvtbl; + analysis->ref = 1; + + *ret = &analysis->IDWriteGlyphRunAnalysis_iface; + return S_OK; +} diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 3285f2d..20f9d36 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -1075,9 +1075,11 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *ifac DWRITE_MEASURING_MODE measuring_mode, FLOAT baseline_x, FLOAT baseline_y, IDWriteGlyphRunAnalysis **analysis) { struct dwritefactory *This = impl_from_IDWriteFactory2(iface); - FIXME("(%p)->(%p %f %p %d %d %f %f %p): stub\n", This, glyph_run, pixels_per_dip, transform, rendering_mode, + + TRACE("(%p)->(%p %f %p %d %d %f %f %p)\n", This, glyph_run, pixels_per_dip, transform, rendering_mode, measuring_mode, baseline_x, baseline_y, analysis); - return E_NOTIMPL; + + return create_glyphrunanalysis(rendering_mode, analysis); } static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory2 *iface, IDWriteFontCollection **collection, diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 126fba9..1815105 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -70,6 +70,37 @@ static IDWriteFactory *create_factory(void) return factory; } +static IDWriteFontFace *create_fontface(IDWriteFactory *factory) +{ + static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; + IDWriteGdiInterop *interop; + IDWriteFontFace *fontface; + IDWriteFont *font; + LOGFONTW logfont; + HRESULT hr; + + hr = IDWriteFactory_GetGdiInterop(factory, &interop); + ok(hr == S_OK, "got 0x%08x\n", hr); + + memset(&logfont, 0, sizeof(logfont)); + logfont.lfHeight = 12; + logfont.lfWidth = 12; + logfont.lfWeight = FW_NORMAL; + logfont.lfItalic = 1; + lstrcpyW(logfont.lfFaceName, tahomaW); + + hr = IDWriteGdiInterop_CreateFontFromLOGFONT(interop, &logfont, &font); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteFont_CreateFontFace(font, &fontface); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IDWriteFont_Release(font); + IDWriteGdiInterop_Release(interop); + + return fontface; +} + static WCHAR *create_testfontfile(const WCHAR *filename) { static WCHAR pathW[MAX_PATH]; @@ -3238,6 +3269,55 @@ static void test_CreateRenderingParams(void) IDWriteFactory_Release(factory); } +static void test_CreateGlyphRunAnalysis(void) +{ + IDWriteGlyphRunAnalysis *analysis; + IDWriteFactory *factory; + DWRITE_GLYPH_RUN run; + IDWriteFontFace *face; + UINT16 index; + FLOAT advance; + HRESULT hr; + UINT32 ch; + + factory = create_factory(); + face = create_fontface(factory); + + ch = 'A'; + hr = IDWriteFontFace_GetGlyphIndices(face, &ch, 1, &index); + ok(hr == S_OK, "got 0x%08x\n", hr); + + run.fontFace = face; + run.fontEmSize = 24.0; + run.glyphCount = 1; + run.glyphIndices = &index; + run.glyphAdvances = &advance; + run.glyphOffsets = NULL; + run.isSideways = FALSE; + run.bidiLevel = 0; + + /* default mode is not allowed */ + hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, + DWRITE_RENDERING_MODE_DEFAULT, DWRITE_MEASURING_MODE_NATURAL, + 0.0, 0.0, &analysis); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + /* outline too */ + hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, + DWRITE_RENDERING_MODE_OUTLINE, DWRITE_MEASURING_MODE_NATURAL, + 0.0, 0.0, &analysis); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IDWriteFactory_CreateGlyphRunAnalysis(factory, &run, 1.0, NULL, + DWRITE_RENDERING_MODE_GDI_CLASSIC, DWRITE_MEASURING_MODE_NATURAL, + 0.0, 0.0, &analysis); + ok(hr == S_OK, "got 0x%08x\n", hr); + IDWriteGlyphRunAnalysis_Release(analysis); + + IDWriteFontFace_Release(face); + IDWriteFactory_Release(factory); +} + START_TEST(font) { IDWriteFactory *factory; @@ -3280,6 +3360,7 @@ START_TEST(font) test_GetGlyphCount(); test_GetKerningPairAdjustments(); test_CreateRenderingParams(); + test_CreateGlyphRunAnalysis(); IDWriteFactory_Release(factory); }
1
0
0
0
Huw Davies : comctl32: If necessary add the width of a dropdown arrow while wrapping.
by Alexandre Julliard
19 May '15
19 May '15
Module: wine Branch: master Commit: 0634f3b4091b0d0aac3493f8f2eb7397f45ebaac URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0634f3b4091b0d0aac3493f8f…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue May 19 12:51:57 2015 +0100 comctl32: If necessary add the width of a dropdown arrow while wrapping. This also fixes the layout code for the BTNS_WHOLEDROPDOWN case. --- dlls/comctl32/toolbar.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 9f70063..ff52dc7 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -259,6 +259,12 @@ static inline BOOL TOOLBAR_HasDropDownArrows(DWORD exStyle) return (exStyle & TBSTYLE_EX_DRAWDDARROWS) != 0; } +static inline BOOL button_has_ddarrow(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr) +{ + return (TOOLBAR_HasDropDownArrows( infoPtr->dwExStyle ) && (btnPtr->fsStyle & BTNS_DROPDOWN)) || + (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN); +} + static LPWSTR TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr) { @@ -823,9 +829,7 @@ static void TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDraw) { DWORD dwStyle = infoPtr->dwStyle; - BOOL hasDropDownArrow = (TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && - (btnPtr->fsStyle & BTNS_DROPDOWN)) || - (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN); + BOOL hasDropDownArrow = button_has_ddarrow( infoPtr, btnPtr ); BOOL drawSepDropDownArrow = hasDropDownArrow && (~btnPtr->fsStyle & BTNS_WHOLEDROPDOWN); RECT rc, rcArrow, rcBitmap, rcText; @@ -1316,6 +1320,9 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr) else cx = infoPtr->nButtonWidth; + if (!btnPtr[i].cx && button_has_ddarrow( infoPtr, btnPtr + i )) + cx += DDARROW_WIDTH; + /* Two or more adjacent separators form a separator group. */ /* The first separator in a group should be wrapped to the */ /* next row if the previous wrapping is on a button. */ @@ -1628,7 +1635,6 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr) INT x, y, cx, cy; BOOL bWrap; BOOL validImageList = TOOLBAR_IsValidImageList(infoPtr, 0); - BOOL hasDropDownArrows = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle); TOOLBAR_WrapToolbar(infoPtr); @@ -1696,11 +1702,10 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr) /* if size has been set manually then don't add on extra space * for the drop down arrow */ - if (!btnPtr->cx && hasDropDownArrows && - ((btnPtr->fsStyle & BTNS_DROPDOWN) || (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN))) - cx += DDARROW_WIDTH; + if (!btnPtr->cx && button_has_ddarrow( infoPtr, btnPtr )) + cx += DDARROW_WIDTH; } - if (btnPtr->fsState & TBSTATE_WRAP ) + if (btnPtr->fsState & TBSTATE_WRAP) bWrap = TRUE; SetRect (&btnPtr->rect, x, y, x + cx, y + cy);
1
0
0
0
Huw Davies : comctl32: Wrap the buttons inside the toolbar's client rect.
by Alexandre Julliard
19 May '15
19 May '15
Module: wine Branch: master Commit: 797f42699e86a0e4e3468b55f88e7b8e6d06f323 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=797f42699e86a0e4e3468b55f…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue May 19 12:51:56 2015 +0100 comctl32: Wrap the buttons inside the toolbar's client rect. The toolbar need not be the same width as the parent. --- dlls/comctl32/tests/toolbar.c | 56 +++++++++++++++++++++++++++++++++++++++++++ dlls/comctl32/toolbar.c | 17 +------------ 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 4bbffd3..2041216 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -2024,6 +2024,61 @@ static void test_TB_GET_SET_EXTENDEDSTYLE(void) DestroyWindow(hwnd); } +static void test_noresize(void) +{ + HWND wnd; + int i; + TBBUTTON button = {0, 10, TBSTATE_ENABLED, 0, {0, }, 0, -1}; + + wnd = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL, WS_CHILD | WS_VISIBLE | CCS_NORESIZE | TBSTYLE_WRAPABLE, 0, 0, 100, 20, + hMainWnd, (HMENU)5, GetModuleHandleA(NULL), NULL); + SendMessageA(wnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + + for (i=0; i<30; i++) + { + button.idCommand = 10 + i; + SendMessageA(wnd, TB_ADDBUTTONSA, 1, (LPARAM)&button); + } + + SendMessageA(wnd, TB_SETSTATE, 10, TBSTATE_WRAP|TBSTATE_ENABLED); + + /* autosize clears the wrap on button 0 */ + SendMessageA(wnd, TB_AUTOSIZE, 0, 0); + for (i=0; i<30; i++) + { + SendMessageA(wnd, TB_GETBUTTON, i, (LPARAM)&button); + if (i % 4 == 3) + ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "%d: got %08x\n", i, button.fsState); + else + ok(button.fsState == TBSTATE_ENABLED, "%d: got %08x\n", i, button.fsState); + } + + /* changing the parent doesn't do anything */ + MoveWindow(hMainWnd, 0,0, 400, 200, FALSE); + for (i=0; i<30; i++) + { + SendMessageA(wnd, TB_GETBUTTON, i, (LPARAM)&button); + if (i % 4 == 3) + ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "%d: got %08x\n", i, button.fsState); + else + ok(button.fsState == TBSTATE_ENABLED, "%d: got %08x\n", i, button.fsState); + } + + /* again nothing here */ + SendMessageA(wnd, TB_AUTOSIZE, 0, 0); + for (i=0; i<30; i++) + { + SendMessageA(wnd, TB_GETBUTTON, i, (LPARAM)&button); + if (i % 4 == 3) + ok(button.fsState == (TBSTATE_WRAP|TBSTATE_ENABLED), "%d: got %08x\n", i, button.fsState); + else + ok(button.fsState == TBSTATE_ENABLED, "%d: got %08x\n", i, button.fsState); + } + + DestroyWindow(wnd); + +} + START_TEST(toolbar) { WNDCLASSA wc; @@ -2066,6 +2121,7 @@ START_TEST(toolbar) test_get_set_style(); test_create(); test_TB_GET_SET_EXTENDEDSTYLE(); + test_noresize(); PostQuitMessage(0); while(GetMessageA(&msg,0,0,0)) { diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 97d509e..9f70063 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -1282,7 +1282,6 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr) { TBUTTON_INFO *btnPtr; INT x, cx, i, j, width; - RECT rc; BOOL bButtonWrap; /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ @@ -1293,21 +1292,7 @@ TOOLBAR_WrapToolbar(TOOLBAR_INFO *infoPtr) btnPtr = infoPtr->buttons; x = infoPtr->nIndent; - - if (GetParent(infoPtr->hwndSelf)) - { - /* this can get the parents width, to know how far we can extend - * this toolbar. We cannot use its height, as there may be multiple - * toolbars in a rebar control - */ - GetClientRect( GetParent(infoPtr->hwndSelf), &rc ); - width = rc.right - rc.left; - } - else - { - GetWindowRect( infoPtr->hwndSelf, &rc ); - width = rc.right - rc.left; - } + width = infoPtr->client_rect.right - infoPtr->client_rect.left; bButtonWrap = FALSE;
1
0
0
0
Huw Davies : comctl32: Layout the toolbar after a potential resize.
by Alexandre Julliard
19 May '15
19 May '15
Module: wine Branch: master Commit: 0bcadfa88f7da527150d5d1040e2e6c65b3aba31 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0bcadfa88f7da527150d5d104…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue May 19 12:51:55 2015 +0100 comctl32: Layout the toolbar after a potential resize. --- dlls/comctl32/toolbar.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 54a31ac..97d509e 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -3015,38 +3015,28 @@ TOOLBAR_AddStringA (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam) static LRESULT TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr) { - RECT parent_rect; - HWND parent; - INT x, y; - INT cx, cy; - TRACE("auto sizing, style=%x!\n", infoPtr->dwStyle); + TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight); - parent = GetParent (infoPtr->hwndSelf); - - if (!parent || !infoPtr->bDoRedraw) - return 0; - - GetClientRect(parent, &parent_rect); + if (!(infoPtr->dwStyle & CCS_NORESIZE)) + { + RECT window_rect, parent_rect; + UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE; + HWND parent; + INT x, y, cx, cy; - x = parent_rect.left; - y = parent_rect.top; + parent = GetParent (infoPtr->hwndSelf); - TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight); + if (!parent || !infoPtr->bDoRedraw) + return 0; - cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER; - cx = parent_rect.right - parent_rect.left; + GetClientRect(parent, &parent_rect); - if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL)) - { - TOOLBAR_LayoutToolbar(infoPtr); - InvalidateRect( infoPtr->hwndSelf, NULL, TRUE ); - } + x = parent_rect.left; + y = parent_rect.top; - if (!(infoPtr->dwStyle & CCS_NORESIZE)) - { - RECT window_rect; - UINT uPosFlags = SWP_NOZORDER | SWP_NOACTIVATE; + cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER; + cx = parent_rect.right - parent_rect.left; if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY) { @@ -3075,6 +3065,12 @@ TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr) SetWindowPos(infoPtr->hwndSelf, NULL, x, y, cx, cy, uPosFlags); } + if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL)) + { + TOOLBAR_LayoutToolbar(infoPtr); + InvalidateRect( infoPtr->hwndSelf, NULL, TRUE ); + } + return 0; }
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
...
43
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
Results per page:
10
25
50
100
200