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
April 2016
----- 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
750 discussions
Start a n
N
ew thread
Jacek Caban : wininet: Use heap_strndupAtoW in InternetOpenUrlA.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: 82d413d96d49e47485a4f7fad5b7ba6a73814f11 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=82d413d96d49e47485a4f7fad…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Apr 27 14:18:21 2016 +0200 wininet: Use heap_strndupAtoW in InternetOpenUrlA. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 537bf7d..a534a96 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -3706,9 +3706,8 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext) { HINTERNET rc = NULL; - DWORD lenHeaders = 0; LPWSTR szUrl = NULL; - LPWSTR szHeaders = NULL; + WCHAR *headers = NULL; TRACE("\n"); @@ -3719,20 +3718,17 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, } if(lpszHeaders) { - lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 ); - szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR)); - if(!szHeaders) { + headers = heap_strndupAtoW(lpszHeaders, dwHeadersLength, &dwHeadersLength); + if(!headers) { heap_free(szUrl); return NULL; } - MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders); } - rc = InternetOpenUrlW(hInternet, szUrl, szHeaders, - lenHeaders, dwFlags, dwContext); + rc = InternetOpenUrlW(hInternet, szUrl, headers, dwHeadersLength, dwFlags, dwContext); heap_free(szUrl); - heap_free(szHeaders); + heap_free(headers); return rc; }
1
0
0
0
Jacek Caban : wininet: Added new heap_strndupAtoW helper and use it in HttpAddRequestHeadersA.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: d282a64280f3e147f09adae9e3e3152b1d20dbb5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d282a64280f3e147f09adae9e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Apr 27 14:18:12 2016 +0200 wininet: Added new heap_strndupAtoW helper and use it in HttpAddRequestHeadersA. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/http.c | 14 +++++--------- dlls/wininet/internet.h | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index bdc659d..ef0b36e 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1376,21 +1376,17 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, LPCSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier) { - DWORD len; - LPWSTR hdr; + WCHAR *headers = NULL; BOOL r; TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_an(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier); - len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 ); - hdr = heap_alloc(len*sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, hdr, len ); - if( dwHeaderLength != ~0U ) - dwHeaderLength = len; + if(lpszHeader) + headers = heap_strndupAtoW(lpszHeader, dwHeaderLength, &dwHeaderLength); - r = HttpAddRequestHeadersW( hHttpRequest, hdr, dwHeaderLength, dwModifier ); + r = HttpAddRequestHeadersW(hHttpRequest, headers, dwHeaderLength, dwModifier); - heap_free( hdr ); + heap_free(headers); return r; } diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 8c3a1f1..eb3a023 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -166,6 +166,25 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, UINT max_len) return ret; } +static inline WCHAR *heap_strndupAtoW(const char *str, int len_a, DWORD *len_w) +{ + WCHAR *ret = NULL; + + if(str) { + size_t len; + if(len_a < 0) len_a = strlen(str); + len = MultiByteToWideChar(CP_ACP, 0, str, len_a, NULL, 0); + ret = heap_alloc((len+1)*sizeof(WCHAR)); + if(ret) { + MultiByteToWideChar(CP_ACP, 0, str, len_a, ret, len); + ret[len] = 0; + *len_w = len; + } + } + + return ret; +} + static inline WCHAR *heap_strdupAtoW(const char *str) { LPWSTR ret = NULL;
1
0
0
0
Jacek Caban : wininet: Fixed handling too small buffers in InternetCrackUrlW.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: 41f69916c0cb6b62fbdb6d6014fdbb018331db68 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=41f69916c0cb6b62fbdb6d601…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Apr 27 14:17:59 2016 +0200 wininet: Fixed handling too small buffers in InternetCrackUrlW. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.c | 116 ++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 68 deletions(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 6cfc488..537bf7d 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1482,6 +1482,30 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet) return TRUE; } +static BOOL set_url_component(WCHAR **component, DWORD *component_length, const WCHAR *value, DWORD len) +{ + TRACE("%s (%d)\n", debugstr_wn(value, len), len); + + if (!*component_length) + return TRUE; + + if (!*component) { + *(const WCHAR**)component = value; + *component_length = len; + return TRUE; + } + + if (*component_length < len+1) { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + *component_length = len; + if(len) + memcpy(*component, value, len*sizeof(WCHAR)); + (*component)[len] = 0; + return TRUE; +} /*********************************************************************** * ConvertUrlComponentValue (Internal) @@ -1686,49 +1710,6 @@ static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp) } /*********************************************************************** - * SetUrlComponentValueW (Internal) - * - * Helper function for InternetCrackUrlW - * - * PARAMS - * lppszComponent [O] Holds the returned string - * dwComponentLen [I] Holds the size of lppszComponent - * [O] Holds the length of the string in lppszComponent without '\0' - * lpszStart [I] Holds the string to copy from - * len [I] Holds the length of lpszStart without '\0' - * - * RETURNS - * TRUE on success - * FALSE on failure - * - */ -static BOOL SetUrlComponentValueW(LPWSTR* lppszComponent, LPDWORD dwComponentLen, LPCWSTR lpszStart, DWORD len) -{ - TRACE("%s (%d)\n", debugstr_wn(lpszStart,len), len); - - if ( (*dwComponentLen == 0) && (*lppszComponent == NULL) ) - return FALSE; - - if (*dwComponentLen != 0 || *lppszComponent == NULL) - { - if (*lppszComponent == NULL) - { - *lppszComponent = (LPWSTR)lpszStart; - *dwComponentLen = len; - } - else - { - DWORD ncpylen = min((*dwComponentLen)-1, len); - memcpy(*lppszComponent, lpszStart, ncpylen*sizeof(WCHAR)); - (*lppszComponent)[ncpylen] = '\0'; - *dwComponentLen = ncpylen; - } - } - - return TRUE; -} - -/*********************************************************************** * InternetCrackUrlW (WININET.@) * * Break up URL into its components @@ -1813,14 +1794,15 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF if(!lpszParam) lpszParam = memchrW(lpszap, '#', dwUrlLength - (lpszap - lpszUrl)); - SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength, - lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0); + if(!set_url_component(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength, + lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0)) + return FALSE; /* Get scheme first. */ lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl); - SetUrlComponentValueW(&lpUC->lpszScheme, &lpUC->dwSchemeLength, - lpszUrl, lpszcp - lpszUrl); + if(!set_url_component(&lpUC->lpszScheme, &lpUC->dwSchemeLength, lpszUrl, lpszcp - lpszUrl)) + return FALSE; /* Eat ':' in protocol. */ lpszcp++; @@ -1854,8 +1836,8 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF if (lpszHost == NULL || lpszHost > lpszNetLoc) { /* username and password not specified. */ - SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0); - SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0); + set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0); + set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0); } else /* Parse out username and password */ { @@ -1870,14 +1852,14 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF lpszcp++; } - SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, - lpszUser, lpszPasswd - lpszUser); + if(!set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, lpszUser, lpszPasswd - lpszUser)) + return FALSE; if (lpszPasswd != lpszHost) lpszPasswd++; - SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, - lpszPasswd == lpszHost ? NULL : lpszPasswd, - lpszHost - lpszPasswd); + if(!set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength, + lpszPasswd == lpszHost ? NULL : lpszPasswd, lpszHost - lpszPasswd)) + return FALSE; lpszcp++; /* Advance to beginning of host */ } @@ -1891,8 +1873,8 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF entire string up to the first '/' */ if(lpUC->nScheme==INTERNET_SCHEME_RES) { - SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, - lpszHost, lpszPort - lpszHost); + if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost)) + return FALSE; lpszcp=lpszNetLoc; } else @@ -1909,13 +1891,12 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF if(lpUC->nScheme==INTERNET_SCHEME_FILE && lpszPort <= lpszHost+1) { lpszcp=lpszHost; - SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, - NULL, 0); + set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0); } else { - SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, - lpszHost, lpszPort - lpszHost); + if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost)) + return FALSE; if (lpszPort != lpszNetLoc) lpUC->nPort = atoiW(++lpszPort); else switch (lpUC->nScheme) @@ -1941,9 +1922,9 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF } else { - SetUrlComponentValueW(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0); - SetUrlComponentValueW(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0); - SetUrlComponentValueW(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0); + set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, NULL, 0); + set_url_component(&lpUC->lpszPassword, &lpUC->dwPasswordLength, NULL, 0); + set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, NULL, 0); } /* Here lpszcp points to: @@ -2005,12 +1986,11 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF ++len; } } - SetUrlComponentValueW(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, - tmppath, len); + if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, tmppath, len)) + return FALSE; } - else - SetUrlComponentValueW(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, - lpszcp, len); + else if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, len)) + return FALSE; } else {
1
0
0
0
Jacek Caban : wininet: Simplify handling ICU_DECODE in InternetCrackUrlW.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: 40992ee873d27dbd8e731f5f2f3432a8dfbbc3c7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=40992ee873d27dbd8e731f5f2…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Apr 27 14:17:31 2016 +0200 wininet: Simplify handling ICU_DECODE in InternetCrackUrlW. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 9045b03..6cfc488 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1737,8 +1737,7 @@ static BOOL SetUrlComponentValueW(LPWSTR* lppszComponent, LPDWORD dwComponentLen * TRUE on success * FALSE on failure */ -BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWORD dwFlags, - LPURL_COMPONENTSW lpUC) +BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC) { /* * RFC 1808 @@ -1747,18 +1746,16 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR */ LPCWSTR lpszParam = NULL; BOOL found_colon = FALSE; - LPCWSTR lpszap, lpszUrl = lpszUrl_orig; + LPCWSTR lpszap; LPCWSTR lpszcp = NULL, lpszNetLoc; - LPWSTR lpszUrl_decode = NULL; - DWORD dwUrlLength = dwUrlLength_orig; TRACE("(%s %u %x %p)\n", lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : strlenW(lpszUrl)) : "(null)", dwUrlLength, dwFlags, lpUC); - if (!lpszUrl_orig || !*lpszUrl_orig || !lpUC) + if (!lpszUrl || !*lpszUrl || !lpUC) { - INTERNET_SetLastError(ERROR_INVALID_PARAMETER); + SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } if (!dwUrlLength) dwUrlLength = strlenW(lpszUrl); @@ -1767,26 +1764,18 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR { WCHAR *url_tmp; DWORD len = dwUrlLength + 1; + BOOL ret; - if (!(url_tmp = heap_alloc(len * sizeof(WCHAR)))) + if (!(url_tmp = heap_strndupW(lpszUrl, dwUrlLength))) { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); + SetLastError(ERROR_OUTOFMEMORY); return FALSE; } - memcpy(url_tmp, lpszUrl_orig, dwUrlLength * sizeof(WCHAR)); - url_tmp[dwUrlLength] = 0; - if (!(lpszUrl_decode = heap_alloc(len * sizeof(WCHAR)))) - { - heap_free(url_tmp); - INTERNET_SetLastError(ERROR_OUTOFMEMORY); - return FALSE; - } - if (InternetCanonicalizeUrlW(url_tmp, lpszUrl_decode, &len, ICU_DECODE | ICU_NO_ENCODE)) - { - dwUrlLength = len; - lpszUrl = lpszUrl_decode; - } + ret = InternetCanonicalizeUrlW(url_tmp, url_tmp, &len, ICU_DECODE | ICU_NO_ENCODE); + if (ret) + ret = InternetCrackUrlW(url_tmp, len, dwFlags & ~ICU_DECODE, lpUC); heap_free(url_tmp); + return ret; } lpszap = lpszUrl; @@ -1989,7 +1978,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR if (*lpszcp == '/') { len = MAX_PATH; - PathCreateFromUrlW(lpszUrl_orig, tmppath, &len, 0); + PathCreateFromUrlW(lpszUrl, tmppath, &len, 0); } else { @@ -2036,7 +2025,6 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR debugstr_wn(lpUC->lpszUrlPath,lpUC->dwUrlPathLength), debugstr_wn(lpUC->lpszExtraInfo,lpUC->dwExtraInfoLength)); - heap_free( lpszUrl_decode ); return TRUE; }
1
0
0
0
Alex Henrie : qedit: Implement IAMTimelineObj_GetTimelineNoRef and add tests.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: d10c5b4ac223365f397cdf02f0d297686bea2854 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d10c5b4ac223365f397cdf02f…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Apr 26 23:12:50 2016 -0600 qedit: Implement IAMTimelineObj_GetTimelineNoRef and add tests. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/qedit/tests/timeline.c | 8 ++++++++ dlls/qedit/timeline.c | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/qedit/tests/timeline.c b/dlls/qedit/tests/timeline.c index ca00063..2d37010 100644 --- a/dlls/qedit/tests/timeline.c +++ b/dlls/qedit/tests/timeline.c @@ -91,6 +91,14 @@ static void test_timeline(void) else ok(hr == E_INVALIDARG, "Expected E_INVALIDARG got %08x\n", hr); } + + hr = IAMTimelineObj_GetTimelineNoRef(obj, NULL); + ok(hr == E_POINTER, "Expected E_POINTER got %08x\n", hr); + + timeline2 = (IAMTimeline *)0xdeadbeef; + hr = IAMTimelineObj_GetTimelineNoRef(obj, &timeline2); + ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE got %08x\n", hr); + ok(!timeline2, "Expected NULL got %p\n", timeline2); } START_TEST(timeline) diff --git a/dlls/qedit/timeline.c b/dlls/qedit/timeline.c index a2552d2..8c6ac5b 100644 --- a/dlls/qedit/timeline.c +++ b/dlls/qedit/timeline.c @@ -737,9 +737,12 @@ static HRESULT WINAPI TimelineObj_RemoveAll(IAMTimelineObj *iface) static HRESULT WINAPI TimelineObj_GetTimelineNoRef(IAMTimelineObj *iface, IAMTimeline **timeline) { + /* MSDN says that this function is "not supported" */ TimelineObjImpl *This = impl_from_IAMTimelineObj(iface); - FIXME("(%p)->(%p): not implemented!\n", This, timeline); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, timeline); + if (!timeline) return E_POINTER; + *timeline = NULL; + return E_NOINTERFACE; } static HRESULT WINAPI TimelineObj_GetGroupIBelongTo(IAMTimelineObj *iface, IAMTimelineGroup **group)
1
0
0
0
Alex Henrie : qedit: Implement IAMTimelineObj_SetTimelineType and add tests.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: bebc10c625c34b5292857f6f7881b8bcfd81a293 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bebc10c625c34b5292857f6f7…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Apr 26 23:12:49 2016 -0600 qedit: Implement IAMTimelineObj_SetTimelineType and add tests. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/qedit/tests/timeline.c | 9 +++++++++ dlls/qedit/timeline.c | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/qedit/tests/timeline.c b/dlls/qedit/tests/timeline.c index ecb4223..ca00063 100644 --- a/dlls/qedit/tests/timeline.c +++ b/dlls/qedit/tests/timeline.c @@ -82,6 +82,15 @@ static void test_timeline(void) hr = IAMTimelineObj_GetTimelineType(obj, &type); ok(hr == S_OK, "GetTimelineType failed: %08x\n", hr); ok(type == TIMELINE_MAJOR_TYPE_COMPOSITE, "Expected TIMELINE_MAJOR_TYPE_COMPOSITE got %d\n", type); + + for (type = 0; type < 256; type++) + { + hr = IAMTimelineObj_SetTimelineType(obj, type); + if (type == TIMELINE_MAJOR_TYPE_COMPOSITE) + ok(hr == S_OK, "SetTimelineType failed: %08x\n", hr); + else + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG got %08x\n", hr); + } } START_TEST(timeline) diff --git a/dlls/qedit/timeline.c b/dlls/qedit/timeline.c index 0ecb1b5..a2552d2 100644 --- a/dlls/qedit/timeline.c +++ b/dlls/qedit/timeline.c @@ -602,9 +602,11 @@ static HRESULT WINAPI TimelineObj_GetTimelineType(IAMTimelineObj *iface, TIMELIN static HRESULT WINAPI TimelineObj_SetTimelineType(IAMTimelineObj *iface, TIMELINE_MAJOR_TYPE type) { + /* MSDN says that this function is "not supported" */ TimelineObjImpl *This = impl_from_IAMTimelineObj(iface); - FIXME("(%p)->(%d): not implemented!\n", This, type); - return E_NOTIMPL; + TRACE("(%p)->(%d)\n", This, type); + if (type != This->timeline_type) return E_INVALIDARG; + return S_OK; } static HRESULT WINAPI TimelineObj_GetUserID(IAMTimelineObj *iface, LONG *id)
1
0
0
0
Alex Henrie : qedit: Implement IAMTimelineObj_GetTimelineType and add tests.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: 41d0860d4185090365d8041080379176c0b82183 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=41d0860d4185090365d804108…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Apr 26 23:12:48 2016 -0600 qedit: Implement IAMTimelineObj_GetTimelineType and add tests. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/qedit/tests/timeline.c | 7 +++++++ dlls/qedit/timeline.c | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/qedit/tests/timeline.c b/dlls/qedit/tests/timeline.c index d2b299c..ecb4223 100644 --- a/dlls/qedit/tests/timeline.c +++ b/dlls/qedit/tests/timeline.c @@ -75,6 +75,13 @@ static void test_timeline(void) hr = IAMTimelineObj_QueryInterface(obj, &IID_IAMTimeline, (void **)&timeline2); ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE got %08x\n", hr); ok(!timeline2, "Expected NULL got %p\n", timeline2); + + hr = IAMTimelineObj_GetTimelineType(obj, NULL); + ok(hr == E_POINTER, "Expected E_POINTER got %08x\n", hr); + + hr = IAMTimelineObj_GetTimelineType(obj, &type); + ok(hr == S_OK, "GetTimelineType failed: %08x\n", hr); + ok(type == TIMELINE_MAJOR_TYPE_COMPOSITE, "Expected TIMELINE_MAJOR_TYPE_COMPOSITE got %d\n", type); } START_TEST(timeline) diff --git a/dlls/qedit/timeline.c b/dlls/qedit/timeline.c index 3274892..0ecb1b5 100644 --- a/dlls/qedit/timeline.c +++ b/dlls/qedit/timeline.c @@ -52,6 +52,7 @@ static inline TimelineImpl *impl_from_IAMTimeline(IAMTimeline *iface) typedef struct { IAMTimelineObj IAMTimelineObj_iface; LONG ref; + TIMELINE_MAJOR_TYPE timeline_type; } TimelineObjImpl; static inline TimelineObjImpl *impl_from_IAMTimelineObj(IAMTimelineObj *iface) @@ -169,6 +170,7 @@ static HRESULT WINAPI Timeline_IAMTimeline_CreateEmptyNode(IAMTimeline *iface, I obj_impl->ref = 1; obj_impl->IAMTimelineObj_iface.lpVtbl = &IAMTimelineObj_VTable; + obj_impl->timeline_type = type; *obj = &obj_impl->IAMTimelineObj_iface; return S_OK; @@ -592,8 +594,10 @@ static HRESULT WINAPI TimelineObj_GetSubObjectLoaded(IAMTimelineObj *iface, BOOL static HRESULT WINAPI TimelineObj_GetTimelineType(IAMTimelineObj *iface, TIMELINE_MAJOR_TYPE *type) { TimelineObjImpl *This = impl_from_IAMTimelineObj(iface); - FIXME("(%p)->(%p): not implemented!\n", This, type); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, type); + if (!type) return E_POINTER; + *type = This->timeline_type; + return S_OK; } static HRESULT WINAPI TimelineObj_SetTimelineType(IAMTimelineObj *iface, TIMELINE_MAJOR_TYPE type)
1
0
0
0
Alex Henrie : qedit: Stub out AMTimelineObj.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: fca60cb558c00d2a54a019fc9b3a891bdb159c88 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fca60cb558c00d2a54a019fc9…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Apr 26 23:12:47 2016 -0600 qedit: Stub out AMTimelineObj. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/qedit/tests/timeline.c | 5 - dlls/qedit/timeline.c | 403 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 401 insertions(+), 7 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=fca60cb558c00d2a54a01…
1
0
0
0
Alex Henrie : qedit/tests: Add timeline object creation tests.
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: cc2e4cfca8769f15aabc21778125221db92447ce URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cc2e4cfca8769f15aabc21778…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Apr 26 23:12:46 2016 -0600 qedit/tests: Add timeline object creation tests. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/qedit/tests/Makefile.in | 3 +- dlls/qedit/tests/timeline.c | 90 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/dlls/qedit/tests/Makefile.in b/dlls/qedit/tests/Makefile.in index 17d027f..07dd4b0 100644 --- a/dlls/qedit/tests/Makefile.in +++ b/dlls/qedit/tests/Makefile.in @@ -2,6 +2,7 @@ TESTDLL = qedit.dll IMPORTS = oleaut32 ole32 C_SRCS = \ - mediadet.c + mediadet.c \ + timeline.c RC_SRCS = qedit.rc diff --git a/dlls/qedit/tests/timeline.c b/dlls/qedit/tests/timeline.c new file mode 100644 index 0000000..6746b7d --- /dev/null +++ b/dlls/qedit/tests/timeline.c @@ -0,0 +1,90 @@ +/* + * Unit tests for Timeline + * + * Copyright (C) 2016 Alex Henrie + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#define CONST_VTABLE + +#include "wine/test.h" +#include "qedit.h" + +static void test_timeline(void) +{ + HRESULT hr; + IAMTimeline *timeline = NULL; + IAMTimeline *timeline2 = (IAMTimeline *)0xdeadbeef; + IAMTimelineObj *obj; + IAMTimelineObj obj_iface; + TIMELINE_MAJOR_TYPE type; + + hr = CoCreateInstance(&CLSID_AMTimeline, NULL, CLSCTX_INPROC_SERVER, &IID_IAMTimeline, (void **)&timeline); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "CoCreateInstance failed: %08x\n", hr); + if (!timeline) return; + + hr = IAMTimeline_CreateEmptyNode(timeline, NULL, 0); +todo_wine + ok(hr == E_POINTER, "Expected E_POINTER got %08x\n", hr); + + hr = IAMTimeline_CreateEmptyNode(timeline, NULL, TIMELINE_MAJOR_TYPE_COMPOSITE); +todo_wine + ok(hr == E_POINTER, "Expected E_POINTER got %08x\n", hr); + + for (type = 0; type < 256; type++) + { + obj = &obj_iface; + hr = IAMTimeline_CreateEmptyNode(timeline, &obj, type); + switch (type) + { + case TIMELINE_MAJOR_TYPE_COMPOSITE: + case TIMELINE_MAJOR_TYPE_TRACK: + case TIMELINE_MAJOR_TYPE_SOURCE: + case TIMELINE_MAJOR_TYPE_TRANSITION: + case TIMELINE_MAJOR_TYPE_EFFECT: + case TIMELINE_MAJOR_TYPE_GROUP: +todo_wine + ok(hr == S_OK, "CreateEmptyNode failed: %08x\n", hr); + if (obj != &obj_iface) IAMTimelineObj_Release(obj); + break; + default: +todo_wine + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG got %08x\n", hr); + ok(obj == &obj_iface, "Expected %p got %p\n", &obj_iface, obj); + } + } + + obj = NULL; + hr = IAMTimeline_CreateEmptyNode(timeline, &obj, TIMELINE_MAJOR_TYPE_COMPOSITE); +todo_wine + ok(hr == S_OK, "CreateEmptyNode failed: %08x\n", hr); + if (!obj) return; + + hr = IAMTimelineObj_QueryInterface(obj, &IID_IAMTimeline, NULL); + ok(hr == E_POINTER, "Expected E_POINTER got %08x\n", hr); + + hr = IAMTimelineObj_QueryInterface(obj, &IID_IAMTimeline, (void **)&timeline2); + ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE got %08x\n", hr); + ok(!timeline2, "Expected NULL got %p\n", timeline2); +} + +START_TEST(timeline) +{ + CoInitialize(NULL); + test_timeline(); + CoUninitialize(); +}
1
0
0
0
Nikolay Sivov : msvcrt: Handle overflow in calloc().
by Alexandre Julliard
27 Apr '16
27 Apr '16
Module: wine Branch: master Commit: 50dd4b892825c75db35cd1f378291b51fa782f3e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=50dd4b892825c75db35cd1f37…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Apr 27 11:11:49 2016 +0300 msvcrt: Handle overflow in calloc(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/heap.c | 10 +++++++++- dlls/msvcrt/tests/heap.c | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c index 52a5287..3fe0227 100644 --- a/dlls/msvcrt/heap.c +++ b/dlls/msvcrt/heap.c @@ -394,7 +394,15 @@ size_t CDECL _aligned_msize(void *p, MSVCRT_size_t alignment, MSVCRT_size_t offs */ void* CDECL MSVCRT_calloc(MSVCRT_size_t count, MSVCRT_size_t size) { - return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, count*size); + MSVCRT_size_t bytes = count*size; + + if (size && bytes / size != count) + { + *MSVCRT__errno() = MSVCRT_ENOMEM; + return NULL; + } + + return msvcrt_heap_alloc(HEAP_ZERO_MEMORY, bytes); } /********************************************************************* diff --git a/dlls/msvcrt/tests/heap.c b/dlls/msvcrt/tests/heap.c index 2aaf48d..82a5961 100644 --- a/dlls/msvcrt/tests/heap.c +++ b/dlls/msvcrt/tests/heap.c @@ -456,6 +456,28 @@ static void test_sbheap(void) free(mem); } +static void test_calloc(void) +{ + void *ptr; + + ptr = calloc(1, 0); + ok(ptr != NULL, "got %p\n", ptr); + free(ptr); + + ptr = calloc(0, 0); + ok(ptr != NULL, "got %p\n", ptr); + free(ptr); + + ptr = calloc(0, 1); + ok(ptr != NULL, "got %p\n", ptr); + free(ptr); + + errno = 0; + ptr = calloc(~(size_t)0 / 2, ~(size_t)0 / 2); + ok(ptr == NULL, "got %p\n", ptr); + ok(errno == ENOMEM || broken(errno == 0) /* winxp, win2k3 */, "got errno %d\n", errno); +} + START_TEST(heap) { void *mem; @@ -480,4 +502,5 @@ START_TEST(heap) test_aligned(); test_sbheap(); + test_calloc(); }
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
75
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
Results per page:
10
25
50
100
200