winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2018
----- 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
951 discussions
Start a n
N
ew thread
Zhiyi Zhang : kernelbase: Implement PathCchRemoveExtension.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 43b5e4ba4a882add1f8cdf0f33554876c1ae41ca URL:
https://source.winehq.org/git/wine.git/?a=commit;h=43b5e4ba4a882add1f8cdf0f…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Tue Nov 20 19:06:27 2018 +0800 kernelbase: Implement PathCchRemoveExtension. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-core-path-l1-1-0.spec | 2 +- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/path.c | 19 +++++ dlls/kernelbase/tests/path.c | 85 ++++++++++++++++++++++ include/pathcch.h | 1 + 5 files changed, 107 insertions(+), 2 deletions(-) diff --git a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec index fed23cb..57e0a67 100644 --- a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec +++ b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec @@ -13,7 +13,7 @@ @ stub PathCchIsRoot @ stub PathCchRemoveBackslash @ stub PathCchRemoveBackslashEx -@ stub PathCchRemoveExtension +@ stdcall PathCchRemoveExtension(wstr long) kernelbase.PathCchRemoveExtension @ stub PathCchRemoveFileSpec @ stub PathCchRenameExtension @ stub PathCchSkipRoot diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 27d10ce..ffe7be2 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1042,7 +1042,7 @@ # @ stub PathCchIsRoot # @ stub PathCchRemoveBackslash # @ stub PathCchRemoveBackslashEx -# @ stub PathCchRemoveExtension +@ stdcall PathCchRemoveExtension(wstr long) # @ stub PathCchRemoveFileSpec # @ stub PathCchRenameExtension # @ stub PathCchSkipRoot diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c index 85f3b6c..9dc2118 100644 --- a/dlls/kernelbase/path.c +++ b/dlls/kernelbase/path.c @@ -151,3 +151,22 @@ HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR *extension = lastpoint ? lastpoint : path; return S_OK; } + +HRESULT WINAPI PathCchRemoveExtension(WCHAR *path, SIZE_T size) +{ + const WCHAR *extension; + WCHAR *next; + HRESULT hr; + + TRACE("%s %lu\n", wine_dbgstr_w(path), size); + + if (!path || !size || size > PATHCCH_MAX_CCH) return E_INVALIDARG; + + hr = PathCchFindExtension(path, size, &extension); + if (FAILED(hr)) return hr; + + next = path + (extension - path); + while (next - path < size && *next) *next++ = 0; + + return next == extension ? S_FALSE : S_OK; +} diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c index 4414f4e..9f1f292 100644 --- a/dlls/kernelbase/tests/path.c +++ b/dlls/kernelbase/tests/path.c @@ -35,6 +35,7 @@ HRESULT (WINAPI *pPathCchAddBackslashEx)(WCHAR *out, SIZE_T size, WCHAR **endptr HRESULT (WINAPI *pPathCchAddExtension)(WCHAR *path, SIZE_T size, const WCHAR *extension); HRESULT (WINAPI *pPathCchCombineEx)(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); HRESULT (WINAPI *pPathCchFindExtension)(const WCHAR *path, SIZE_T size, const WCHAR **extension); +HRESULT (WINAPI *pPathCchRemoveExtension)(WCHAR *path, SIZE_T size); static const struct { @@ -471,6 +472,88 @@ static void test_PathCchFindExtension(void) } } +struct removeextension_test +{ + const CHAR *path; + const CHAR *expected; + HRESULT hr; +}; + +static const struct removeextension_test removeextension_tests[] = +{ + {"1.exe", "1", S_OK}, + {"C:1.exe", "C:1", S_OK}, + {"C:\\1.exe", "C:\\1", S_OK}, + {"\\1.exe", "\\1", S_OK}, + {"\\\\1.exe", "\\\\1", S_OK}, + {"\\\\?\\C:1.exe", "\\\\?\\C:1", S_OK}, + {"\\\\?\\C:\\1.exe", "\\\\?\\C:\\1", S_OK}, + {"\\\\?\\UNC\\1.exe", "\\\\?\\UNC\\1", S_OK}, + {"\\\\?\\UNC\\192.168.1.1\\1.exe", "\\\\?\\UNC\\192.168.1.1\\1", S_OK}, + {"\\\\?\\Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}\\1.exe", + "\\\\?\\Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}\\1", S_OK}, + + /* Malformed */ + {"", "", S_FALSE}, + {" ", " ", S_FALSE}, + {".", "", S_OK}, + {"..", ".", S_OK}, + {"a", "a", S_FALSE}, + {"a.", "a", S_OK}, + {".a.b.", ".a.b", S_OK}, + {"a. ", "a. ", S_FALSE}, + {"a.\\", "a.\\", S_FALSE}, + {"\\\\?\\UNC\\192.168.1.1", "\\\\?\\UNC\\192.168.1", S_OK}, + {"\\\\?\\UNC\\192.168.1.1\\", "\\\\?\\UNC\\192.168.1.1\\", S_FALSE}, + {"\\\\?\\UNC\\192.168.1.1\\a", "\\\\?\\UNC\\192.168.1.1\\a", S_FALSE} +}; + +static void test_PathCchRemoveExtension(void) +{ + WCHAR pathW[PATHCCH_MAX_CCH] = {0}; + CHAR pathA[PATHCCH_MAX_CCH]; + HRESULT hr; + INT i; + + if (!pPathCchRemoveExtension) + { + win_skip("PathCchRemoveExtension() is not available.\n"); + return; + } + + /* Arguments check */ + hr = pPathCchRemoveExtension(NULL, PATHCCH_MAX_CCH); + ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr); + + hr = pPathCchRemoveExtension(pathW, 0); + ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr); + + hr = pPathCchRemoveExtension(pathW, PATHCCH_MAX_CCH + 1); + ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr); + + hr = pPathCchRemoveExtension(pathW, PATHCCH_MAX_CCH); + ok(hr == S_FALSE, "expect %#x, got %#x\n", S_FALSE, hr); + + /* Size < original path length + 1 */ + MultiByteToWideChar(CP_ACP, 0, "C:\\1.exe", -1, pathW, ARRAY_SIZE(pathW)); + hr = pPathCchRemoveExtension(pathW, ARRAY_SIZE("C:\\1.exe") - 1); + ok(hr == E_INVALIDARG, "expect %#x, got %#x\n", E_INVALIDARG, hr); + + for (i = 0; i < ARRAY_SIZE(removeextension_tests); i++) + { + const struct removeextension_test *t = removeextension_tests + i; + + MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW)); + hr = pPathCchRemoveExtension(pathW, ARRAY_SIZE(pathW)); + ok(hr == t->hr, "path %s expect result %#x, got %#x\n", t->path, t->hr, hr); + if (SUCCEEDED(hr)) + { + WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL); + ok(!lstrcmpA(pathA, t->expected), "path %s expect stripped path %s, got %s\n", t->path, t->expected, pathA); + } + } +} + START_TEST(path) { HMODULE hmod = LoadLibraryA("kernelbase.dll"); @@ -480,10 +563,12 @@ START_TEST(path) pPathCchAddBackslashEx = (void *)GetProcAddress(hmod, "PathCchAddBackslashEx"); pPathCchAddExtension = (void *)GetProcAddress(hmod, "PathCchAddExtension"); pPathCchFindExtension = (void *)GetProcAddress(hmod, "PathCchFindExtension"); + pPathCchRemoveExtension = (void *)GetProcAddress(hmod, "PathCchRemoveExtension"); test_PathCchCombineEx(); test_PathCchAddBackslash(); test_PathCchAddBackslashEx(); test_PathCchAddExtension(); test_PathCchFindExtension(); + test_PathCchRemoveExtension(); } diff --git a/include/pathcch.h b/include/pathcch.h index 5a189bc..2f125bb 100644 --- a/include/pathcch.h +++ b/include/pathcch.h @@ -30,3 +30,4 @@ HRESULT WINAPI PathCchAddBackslashEx(WCHAR *path, SIZE_T size, WCHAR **end, SIZE HRESULT WINAPI PathCchAddExtension(WCHAR *path, SIZE_T size, const WCHAR *extension); HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR **extension); +HRESULT WINAPI PathCchRemoveExtension(WCHAR *path, SIZE_T size);
1
0
0
0
Zhiyi Zhang : kernelbase: Implement PathCchAddExtension.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 2d4e7e7df7904459413f52eed059d1ec012e8561 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2d4e7e7df7904459413f52ee…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Tue Nov 20 19:06:11 2018 +0800 kernelbase: Implement PathCchAddExtension. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-core-path-l1-1-0.spec | 2 +- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/path.c | 52 ++++++++++ dlls/kernelbase/tests/path.c | 108 +++++++++++++++++++++ include/pathcch.h | 1 + 5 files changed, 163 insertions(+), 2 deletions(-) diff --git a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec index 7b812eb..fed23cb 100644 --- a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec +++ b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec @@ -2,7 +2,7 @@ @ stub PathAllocCombine @ stdcall PathCchAddBackslash(wstr long) kernelbase.PathCchAddBackslash @ stdcall PathCchAddBackslashEx(wstr long ptr ptr) kernelbase.PathCchAddBackslashEx -@ stub PathCchAddExtension +@ stdcall PathCchAddExtension(wstr long wstr) kernelbase.PathCchAddExtension @ stub PathCchAppend @ stub PathCchAppendEx @ stub PathCchCanonicalize diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 2372db8..27d10ce 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1031,7 +1031,7 @@ @ stdcall PathCanonicalizeW(ptr wstr) shlwapi.PathCanonicalizeW @ stdcall PathCchAddBackslash(wstr long) @ stdcall PathCchAddBackslashEx(wstr long ptr ptr) -# @ stub PathCchAddExtension +@ stdcall PathCchAddExtension(wstr long wstr) # @ stub PathCchAppend # @ stub PathCchAppendEx # @ stub PathCchCanonicalize diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c index b051986..85f3b6c 100644 --- a/dlls/kernelbase/path.c +++ b/dlls/kernelbase/path.c @@ -29,6 +29,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(path); +static SIZE_T strnlenW(const WCHAR *string, SIZE_T maxlen) +{ + SIZE_T i; + + for (i = 0; i < maxlen; i++) + if (!string[i]) break; + return i; +} + HRESULT WINAPI PathCchAddBackslash(WCHAR *path, SIZE_T size) { return PathCchAddBackslashEx(path, size, NULL, NULL); @@ -67,6 +76,49 @@ HRESULT WINAPI PathCchAddBackslashEx(WCHAR *path, SIZE_T size, WCHAR **endptr, S return S_OK; } +HRESULT WINAPI PathCchAddExtension(WCHAR *path, SIZE_T size, const WCHAR *extension) +{ + const WCHAR *existing_extension, *next; + SIZE_T path_length, extension_length, dot_length; + BOOL has_dot; + HRESULT hr; + + TRACE("%s %lu %s\n", wine_dbgstr_w(path), size, wine_dbgstr_w(extension)); + + if (!path || !size || size > PATHCCH_MAX_CCH || !extension) return E_INVALIDARG; + + next = extension; + while (*next) + { + if ((*next == '.' && next > extension) || *next == ' ' || *next == '\\') return E_INVALIDARG; + next++; + } + + has_dot = extension[0] == '.' ? TRUE : FALSE; + + hr = PathCchFindExtension(path, size, &existing_extension); + if (FAILED(hr)) return hr; + if (*existing_extension) return S_FALSE; + + path_length = strnlenW(path, size); + dot_length = has_dot ? 0 : 1; + extension_length = strlenW(extension); + + if (path_length + dot_length + extension_length + 1 > size) return STRSAFE_E_INSUFFICIENT_BUFFER; + + /* If extension is empty or only dot, return S_OK with path unchanged */ + if (!extension[0] || (extension[0] == '.' && !extension[1])) return S_OK; + + if (!has_dot) + { + path[path_length] = '.'; + path_length++; + } + + strcpyW(path + path_length, extension); + return S_OK; +} + HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR **extension) { const WCHAR *lastpoint = NULL; diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c index 4bef964..4414f4e 100644 --- a/dlls/kernelbase/tests/path.c +++ b/dlls/kernelbase/tests/path.c @@ -32,6 +32,7 @@ HRESULT (WINAPI *pPathCchAddBackslash)(WCHAR *out, SIZE_T size); HRESULT (WINAPI *pPathCchAddBackslashEx)(WCHAR *out, SIZE_T size, WCHAR **endptr, SIZE_T *remaining); +HRESULT (WINAPI *pPathCchAddExtension)(WCHAR *path, SIZE_T size, const WCHAR *extension); HRESULT (WINAPI *pPathCchCombineEx)(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); HRESULT (WINAPI *pPathCchFindExtension)(const WCHAR *path, SIZE_T size, const WCHAR **extension); @@ -247,6 +248,111 @@ static void test_PathCchAddBackslashEx(void) } } +struct addextension_test +{ + const CHAR *path; + const CHAR *extension; + const CHAR *expected; + HRESULT hr; +}; + +static const struct addextension_test addextension_tests[] = +{ + /* Normal */ + {"", ".exe", ".exe", S_OK}, + {"C:\\", "", "C:\\", S_OK}, + {"C:", ".exe", "C:.exe", S_OK}, + {"C:\\", ".exe", "C:\\.exe", S_OK}, + {"\\", ".exe", "\\.exe", S_OK}, + {"\\\\", ".exe", "\\\\.exe", S_OK}, + {"\\\\?\\C:", ".exe", "\\\\?\\C:.exe", S_OK}, + {"\\\\?\\C:\\", ".exe", "\\\\?\\C:\\.exe", S_OK}, + {"\\\\?\\UNC\\", ".exe", "\\\\?\\UNC\\.exe", S_OK}, + {"\\\\?\\UNC\\192.168.1.1\\", ".exe", "\\\\?\\UNC\\192.168.1.1\\.exe", S_OK}, + {"\\\\?\\Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}\\", ".exe", + "\\\\?\\Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}\\.exe", S_OK}, + {"C:\\", "exe", "C:\\.exe", S_OK}, + {"C:\\", ".", "C:\\", S_OK}, + {"C:\\1.exe", ".txt", "C:\\1.exe", S_FALSE}, + + /* Extension contains invalid characters but valid for PathCchAddExtension */ + {"C:\\", "./", "C:\\./", S_OK}, + {"C:\\", ".?", "C:\\.?", S_OK}, + {"C:\\", ".%", "C:\\.%", S_OK}, + {"C:\\", ".*", "C:\\.*", S_OK}, + {"C:\\", ".:", "C:\\.:", S_OK}, + {"C:\\", ".|", "C:\\.|", S_OK}, + {"C:\\", ".\"", "C:\\.\"", S_OK}, + {"C:\\", ".<", "C:\\.<", S_OK}, + {"C:\\", ".>", "C:\\.>", S_OK}, + + /* Invalid argument for extension */ + {"C:\\", " exe", NULL, E_INVALIDARG}, + {"C:\\", ". exe", NULL, E_INVALIDARG}, + {"C:\\", " ", NULL, E_INVALIDARG}, + {"C:\\", "\\", NULL, E_INVALIDARG}, + {"C:\\", "..", NULL, E_INVALIDARG}, + {"C:\\", ". ", NULL, E_INVALIDARG}, + {"C:\\", ".\\", NULL, E_INVALIDARG}, + {"C:\\", ".a.", NULL, E_INVALIDARG}, + {"C:\\", ".a ", NULL, E_INVALIDARG}, + {"C:\\", ".a\\", NULL, E_INVALIDARG}, + {"C:\\1.exe", " ", NULL, E_INVALIDARG} +}; + +static void test_PathCchAddExtension(void) +{ + WCHAR pathW[PATHCCH_MAX_CCH + 1]; + CHAR pathA[PATHCCH_MAX_CCH + 1]; + WCHAR extensionW[MAX_PATH]; + HRESULT hr; + INT i; + + if (!pPathCchAddExtension) + { + win_skip("PathCchAddExtension() is not available.\n"); + return; + } + + /* Arguments check */ + MultiByteToWideChar(CP_ACP, 0, "C:\\", -1, pathW, ARRAY_SIZE(pathW)); + MultiByteToWideChar(CP_ACP, 0, ".exe", -1, extensionW, ARRAY_SIZE(extensionW)); + + hr = pPathCchAddExtension(NULL, PATHCCH_MAX_CCH, extensionW); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + + hr = pPathCchAddExtension(pathW, 0, extensionW); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + + hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH, NULL); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + + /* Path length check */ + hr = pPathCchAddExtension(pathW, ARRAY_SIZE("C:\\.exe") - 1, extensionW); + ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "expect result %#x, got %#x\n", STRSAFE_E_INSUFFICIENT_BUFFER, hr); + + hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH + 1, extensionW); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + + hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH, extensionW); + ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr); + + for (i = 0; i < ARRAY_SIZE(addextension_tests); i++) + { + const struct addextension_test *t = addextension_tests + i; + MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW)); + MultiByteToWideChar(CP_ACP, 0, t->extension, -1, extensionW, ARRAY_SIZE(extensionW)); + hr = pPathCchAddExtension(pathW, PATHCCH_MAX_CCH, extensionW); + ok(hr == t->hr, "path %s extension %s expect result %#x, got %#x\n", t->path, t->extension, t->hr, hr); + if (SUCCEEDED(hr)) + { + WideCharToMultiByte(CP_ACP, 0, pathW, -1, pathA, ARRAY_SIZE(pathA), NULL, NULL); + ok(!lstrcmpA(pathA, t->expected), "path %s extension %s expect output path %s, got %s\n", t->path, + t->extension, t->expected, pathA); + } + } +} + struct findextension_test { const CHAR *path; @@ -372,10 +478,12 @@ START_TEST(path) pPathCchCombineEx = (void *)GetProcAddress(hmod, "PathCchCombineEx"); pPathCchAddBackslash = (void *)GetProcAddress(hmod, "PathCchAddBackslash"); pPathCchAddBackslashEx = (void *)GetProcAddress(hmod, "PathCchAddBackslashEx"); + pPathCchAddExtension = (void *)GetProcAddress(hmod, "PathCchAddExtension"); pPathCchFindExtension = (void *)GetProcAddress(hmod, "PathCchFindExtension"); test_PathCchCombineEx(); test_PathCchAddBackslash(); test_PathCchAddBackslashEx(); + test_PathCchAddExtension(); test_PathCchFindExtension(); } diff --git a/include/pathcch.h b/include/pathcch.h index 6bb760c..5a189bc 100644 --- a/include/pathcch.h +++ b/include/pathcch.h @@ -27,5 +27,6 @@ HRESULT WINAPI PathCchAddBackslash(WCHAR *path, SIZE_T size); HRESULT WINAPI PathCchAddBackslashEx(WCHAR *path, SIZE_T size, WCHAR **end, SIZE_T *remaining); +HRESULT WINAPI PathCchAddExtension(WCHAR *path, SIZE_T size, const WCHAR *extension); HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR **extension);
1
0
0
0
Zhiyi Zhang : kernelbase: Implement PathCchFindExtension.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 787633cf9d7e36d35a156a551bbea7544aa50eaf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=787633cf9d7e36d35a156a55…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Tue Nov 20 19:05:46 2018 +0800 kernelbase: Implement PathCchFindExtension. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-core-path-l1-1-0.spec | 2 +- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/path.c | 34 ++++++ dlls/kernelbase/tests/path.c | 122 +++++++++++++++++++++ include/pathcch.h | 3 + 5 files changed, 161 insertions(+), 2 deletions(-) diff --git a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec index 287c5d6..7b812eb 100644 --- a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec +++ b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec @@ -9,7 +9,7 @@ @ stub PathCchCanonicalizeEx @ stub PathCchCombine @ stub PathCchCombineEx -@ stub PathCchFindExtension +@ stdcall PathCchFindExtension(wstr long ptr) kernelbase.PathCchFindExtension @ stub PathCchIsRoot @ stub PathCchRemoveBackslash @ stub PathCchRemoveBackslashEx diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index f3b4fd1..2372db8 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1038,7 +1038,7 @@ # @ stub PathCchCanonicalizeEx # @ stub PathCchCombine # @ stub PathCchCombineEx -# @ stub PathCchFindExtension +@ stdcall PathCchFindExtension(wstr long ptr) # @ stub PathCchIsRoot # @ stub PathCchRemoveBackslash # @ stub PathCchRemoveBackslashEx diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c index 373c34e..b051986 100644 --- a/dlls/kernelbase/path.c +++ b/dlls/kernelbase/path.c @@ -1,5 +1,6 @@ /* * Copyright 2018 Nikolay Sivov + * Copyright 2018 Zhiyi Zhang * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -65,3 +66,36 @@ HRESULT WINAPI PathCchAddBackslashEx(WCHAR *path, SIZE_T size, WCHAR **endptr, S return S_OK; } + +HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR **extension) +{ + const WCHAR *lastpoint = NULL; + SIZE_T counter = 0; + + TRACE("%s %lu %p\n", wine_dbgstr_w(path), size, extension); + + if (!path || !size || size > PATHCCH_MAX_CCH) + { + *extension = NULL; + return E_INVALIDARG; + } + + while (*path) + { + if (*path == '\\' || *path == ' ') + lastpoint = NULL; + else if (*path == '.') + lastpoint = path; + + path++; + counter++; + if (counter == size || counter == PATHCCH_MAX_CCH) + { + *extension = NULL; + return E_INVALIDARG; + } + } + + *extension = lastpoint ? lastpoint : path; + return S_OK; +} diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c index cdba51b..4bef964 100644 --- a/dlls/kernelbase/tests/path.c +++ b/dlls/kernelbase/tests/path.c @@ -2,6 +2,7 @@ * Path tests for kernelbase.dll * * Copyright 2017 Michael Müller + * Copyright 2018 Zhiyi Zhang * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,6 +33,7 @@ HRESULT (WINAPI *pPathCchAddBackslash)(WCHAR *out, SIZE_T size); HRESULT (WINAPI *pPathCchAddBackslashEx)(WCHAR *out, SIZE_T size, WCHAR **endptr, SIZE_T *remaining); HRESULT (WINAPI *pPathCchCombineEx)(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); +HRESULT (WINAPI *pPathCchFindExtension)(const WCHAR *path, SIZE_T size, const WCHAR **extension); static const struct { @@ -245,6 +247,124 @@ static void test_PathCchAddBackslashEx(void) } } +struct findextension_test +{ + const CHAR *path; + INT extension_offset; +}; + +static const struct findextension_test findextension_tests[] = +{ + /* Normal */ + {"1.exe", 1}, + {"C:1.exe", 3}, + {"C:\\1.exe", 4}, + {"\\1.exe", 2}, + {"\\\\1.exe", 3}, + {"\\\\?\\C:1.exe", 7}, + {"\\\\?\\C:\\1.exe", 8}, + {"\\\\?\\UNC\\1.exe", 9}, + {"\\\\?\\UNC\\192.168.1.1\\1.exe", 21}, + {"\\\\?\\Volume{e51a1864-6f2d-4019-b73d-f4e60e600c26}\\1.exe", 50}, + + /* Contains forward slash */ + {"C:\\a/1.exe", 6}, + {"/1.exe", 2}, + {"//1.exe", 3}, + {"C:\\a/b/1.exe", 8}, + {"/a/1.exe", 4}, + {"/a/1.exe", 4}, + + /* Malformed */ + {"", 0}, + {" ", 1}, + {".", 0}, + {"..", 1}, + {"a", 1}, + {"a.", 1}, + {".a.b.", 4}, + {"a. ", 3}, + {"a.\\", 3}, + {"\\\\?\\UNC\\192.168.1.1", 17}, + {"\\\\?\\UNC\\192.168.1.1\\", 20}, + {"\\\\?\\UNC\\192.168.1.1\\a", 21} +}; + +static void test_PathCchFindExtension(void) +{ + WCHAR pathW[PATHCCH_MAX_CCH + 1] = {0}; + const WCHAR *extension; + HRESULT hr; + INT i; + + if (!pPathCchFindExtension) + { + win_skip("PathCchFindExtension() is not available.\n"); + return; + } + + /* Arguments check */ + extension = (const WCHAR *)0xdeadbeef; + hr = pPathCchFindExtension(NULL, PATHCCH_MAX_CCH, &extension); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + ok(extension == NULL, "Expect extension null, got %p\n", extension); + + extension = (const WCHAR *)0xdeadbeef; + hr = pPathCchFindExtension(pathW, 0, &extension); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + ok(extension == NULL, "Expect extension null, got %p\n", extension); + + /* Crashed on Windows */ + if (0) + { + hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, NULL); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + } + + /* Path length check */ + /* size == PATHCCH_MAX_CCH + 1 */ + MultiByteToWideChar(CP_ACP, 0, "C:\\1.exe", -1, pathW, ARRAY_SIZE(pathW)); + hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH + 1, &extension); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + + /* Size == path length + 1*/ + hr = pPathCchFindExtension(pathW, ARRAY_SIZE("C:\\1.exe"), &extension); + ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr); + ok(*extension == '.', "wrong extension value\n"); + + /* Size < path length + 1 */ + extension = (const WCHAR *)0xdeadbeef; + hr = pPathCchFindExtension(pathW, ARRAY_SIZE("C:\\1.exe") - 1, &extension); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + ok(extension == NULL, "Expect extension null, got %p\n", extension); + + /* Size == PATHCCH_MAX_CCH */ + hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension); + ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr); + + /* Path length + 1 > PATHCCH_MAX_CCH */ + for (i = 0; i < ARRAY_SIZE(pathW) - 1; i++) pathW[i] = 'a'; + pathW[PATHCCH_MAX_CCH] = 0; + hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension); + ok(hr == E_INVALIDARG, "expect result %#x, got %#x\n", E_INVALIDARG, hr); + + /* Path length + 1 == PATHCCH_MAX_CCH */ + pathW[PATHCCH_MAX_CCH - 1] = 0; + hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension); + ok(hr == S_OK, "expect result %#x, got %#x\n", S_OK, hr); + + for (i = 0; i < ARRAY_SIZE(findextension_tests); i++) + { + const struct findextension_test *t = findextension_tests + i; + MultiByteToWideChar(CP_ACP, 0, t->path, -1, pathW, ARRAY_SIZE(pathW)); + hr = pPathCchFindExtension(pathW, PATHCCH_MAX_CCH, &extension); + ok(hr == S_OK, "path %s expect result %#x, got %#x\n", t->path, S_OK, hr); + if (SUCCEEDED(hr)) + ok(extension - pathW == t->extension_offset, "path %s expect extension offset %d, got %ld\n", t->path, + t->extension_offset, (UINT_PTR)(extension - pathW)); + } +} + START_TEST(path) { HMODULE hmod = LoadLibraryA("kernelbase.dll"); @@ -252,8 +372,10 @@ START_TEST(path) pPathCchCombineEx = (void *)GetProcAddress(hmod, "PathCchCombineEx"); pPathCchAddBackslash = (void *)GetProcAddress(hmod, "PathCchAddBackslash"); pPathCchAddBackslashEx = (void *)GetProcAddress(hmod, "PathCchAddBackslashEx"); + pPathCchFindExtension = (void *)GetProcAddress(hmod, "PathCchFindExtension"); test_PathCchCombineEx(); test_PathCchAddBackslash(); test_PathCchAddBackslashEx(); + test_PathCchFindExtension(); } diff --git a/include/pathcch.h b/include/pathcch.h index 2b2aed4..6bb760c 100644 --- a/include/pathcch.h +++ b/include/pathcch.h @@ -23,6 +23,9 @@ #define PATHCCH_DO_NOT_NORMALIZE_SEGMENTS 0x08 #define PATHCCH_ENSURE_IS_EXTENDED_LENGTH_PATH 0x10 +#define PATHCCH_MAX_CCH 0x8000 + HRESULT WINAPI PathCchAddBackslash(WCHAR *path, SIZE_T size); HRESULT WINAPI PathCchAddBackslashEx(WCHAR *path, SIZE_T size, WCHAR **end, SIZE_T *remaining); HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); +HRESULT WINAPI PathCchFindExtension(const WCHAR *path, SIZE_T size, const WCHAR **extension);
1
0
0
0
Alistair Leslie-Hughes : api-ms-win-core-libraryloader-l1-2-1: Sync spec file.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: d36063d6a4222a10247522ac805fc119f08edd3e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d36063d6a4222a10247522ac…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Wed Nov 21 01:57:08 2018 +0000 api-ms-win-core-libraryloader-l1-2-1: Sync spec file. File version 6.3.9600.16384 Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=46101
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-core-libraryloader-l1-2-1.spec | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/api-ms-win-core-libraryloader-l1-2-1/api-ms-win-core-libraryloader-l1-2-1.spec b/dlls/api-ms-win-core-libraryloader-l1-2-1/api-ms-win-core-libraryloader-l1-2-1.spec index 95a765f..4cc3358 100644 --- a/dlls/api-ms-win-core-libraryloader-l1-2-1/api-ms-win-core-libraryloader-l1-2-1.spec +++ b/dlls/api-ms-win-core-libraryloader-l1-2-1/api-ms-win-core-libraryloader-l1-2-1.spec @@ -1,3 +1,29 @@ -@ stdcall FindResourceW(long wstr wstr) kernel32.FindResourceW +@ stdcall AddDllDirectory(wstr) kernel32.AddDllDirectory +@ stdcall DisableThreadLibraryCalls(long) kernel32.DisableThreadLibraryCalls +@ stdcall EnumResourceLanguagesExA(long str str ptr long long long) kernel32.EnumResourceLanguagesExA +@ stdcall EnumResourceLanguagesExW(long wstr wstr ptr long long long) kernel32.EnumResourceLanguagesExW +@ stub EnumResourceNamesExA +@ stub EnumResourceNamesExW +@ stub EnumResourceTypesExA +@ stub EnumResourceTypesExW +@ stdcall FindResourceExW(long wstr wstr long) kernel32.FindResourceExW +@ stdcall FindStringOrdinal(long wstr long wstr long long) kernel32.FindStringOrdinal +@ stdcall FreeLibrary(long) kernel32.FreeLibrary +@ stdcall FreeLibraryAndExitThread(long long) kernel32.FreeLibraryAndExitThread +@ stdcall FreeResource(long) kernel32.FreeResource +@ stdcall GetModuleFileNameA(long ptr long) kernel32.GetModuleFileNameA +@ stdcall GetModuleFileNameW(long ptr long) kernel32.GetModuleFileNameW +@ stdcall GetModuleHandleA(str) kernel32.GetModuleHandleA +@ stdcall GetModuleHandleExA(long ptr ptr) kernel32.GetModuleHandleExA +@ stdcall GetModuleHandleExW(long ptr ptr) kernel32.GetModuleHandleExW +@ stdcall GetModuleHandleW(wstr) kernel32.GetModuleHandleW +@ stdcall GetProcAddress(long str) kernel32.GetProcAddress +@ stdcall LoadLibraryExA( str long long) kernel32.LoadLibraryExA +@ stdcall LoadLibraryExW(wstr long long) kernel32.LoadLibraryExW +@ stdcall LoadResource(long long) kernel32.LoadResource @ stdcall LoadLibraryA(str) kernel32.LoadLibraryA @ stdcall LoadLibraryW(wstr) kernel32.LoadLibraryW +@ stdcall LockResource(long) kernel32.LockResource +@ stdcall RemoveDllDirectory(ptr) kernel32.RemoveDllDirectory +@ stdcall SetDefaultDllDirectories(long) kernel32.SetDefaultDllDirectories +@ stdcall SizeofResource(long long) kernel32.SizeofResource
1
0
0
0
Alistair Leslie-Hughes : include: Add IMFSequencerSource interface.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: f3f08d32d417e7871b7d07a41687d3fb2d7ec6c1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f3f08d32d417e7871b7d07a4…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Tue Nov 20 23:42:06 2018 +0000 include: Add IMFSequencerSource interface. Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/mfidl.idl | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/include/mfidl.idl b/include/mfidl.idl index 84be055..170588b 100644 --- a/include/mfidl.idl +++ b/include/mfidl.idl @@ -21,6 +21,7 @@ import "mftransform.idl"; typedef unsigned __int64 TOPOID; typedef LONGLONG MFTIME; +typedef DWORD MFSequencerElementId; typedef enum MF_TOPOLOGY_TYPE { @@ -250,6 +251,60 @@ interface IMFGetService : IUnknown ); } +[ + object, + uuid(03cb2711-24d7-4db6-a17f-f3a7a479a536), +] +interface IMFPresentationDescriptor : IMFAttributes +{ + HRESULT GetStreamDescriptorCount( + [out] DWORD *count ); + + HRESULT GetStreamDescriptorByIndex( + [in] DWORD index, + [out] BOOL *selected, + [out] IMFStreamDescriptor **descriptor ); + + HRESULT SelectStream( + [in] DWORD index ); + + HRESULT DeselectStream( + [in] DWORD index ); + + HRESULT Clone( + [out] IMFPresentationDescriptor **descriptor ); +} + +[ + object, + uuid(197cd219-19cb-4de1-a64c-acf2edcbe59e), + local +] +interface IMFSequencerSource : IUnknown +{ + HRESULT AppendTopology( + [in] IMFTopology *topology, + [in] DWORD flags, + [out] MFSequencerElementId *element ); + + HRESULT DeleteTopology( + [in] MFSequencerElementId element); + + HRESULT GetPresentationContext( + [in] IMFPresentationDescriptor *pd, + [out, optional] MFSequencerElementId *id, + [out, optional] IMFTopology **topology ); + + HRESULT UpdateTopology( + [in] MFSequencerElementId od, + [in] IMFTopology *topology); + + HRESULT UpdateTopologyFlags( + [in] MFSequencerElementId id, + [in] DWORD flags ); + +}; + cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);") cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream);" ) cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);")
1
0
0
0
Gijs Vermeulen : include: Add qos2.h.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 9e84dfcfa2d8cd79466a7f543e51749b88074e38 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9e84dfcfa2d8cd79466a7f54…
Author: Gijs Vermeulen <gijsvrm(a)gmail.com> Date: Wed Nov 21 11:49:43 2018 +0100 include: Add qos2.h. Signed-off-by: Gijs Vermeulen <gijsvrm(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/Makefile.in | 1 + include/qos2.h | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/include/Makefile.in b/include/Makefile.in index cc78b1c..2953748 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -527,6 +527,7 @@ SOURCES = \ pshpack8.h \ pstore.idl \ qedit.idl \ + qos2.h \ ras.h \ rasdlg.h \ raserror.h \ diff --git a/include/qos2.h b/include/qos2.h new file mode 100644 index 0000000..ac486f7 --- /dev/null +++ b/include/qos2.h @@ -0,0 +1,100 @@ +/* + * Copyright 2018 Gijs Vermeulen + * + * 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 + */ + +#ifndef __WINE_QOS2_H__ +#define __WINE_QOS2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef UINT32 QOS_FLOWID; + +typedef enum _QOS_SHAPING { + QOSShapeOnly, + QOSShapeAndMark, + QOSUseNonConformantMarkings +} QOS_SHAPING, *PQOS_SHAPING; + +typedef enum _QOS_FLOWRATE_REASON { + QOSFlowRateNotApplicable, + QOSFlowRateContentChange, + QOSFlowRateCongestion, + QOSFlowRateHigherContentEncoding, + QOSFlowRateUserCaused +} QOS_FLOWRATE_REASON, PQOS_FLOWRATE_REASON; + +typedef enum _QOS_NOTIFY_FLOW { + QOSNotifyCongested, + QOSNotifyUncongested, + QOSNotifyAvailable +} QOS_NOTIFY_FLOW, *PQOS_NOTIFY_FLOW; + +typedef enum _QOS_QUERY_FLOW { + QOSQueryFlowFundamentals, + QOSQueryPacketPriority, + QOSQueryOutgoingRate +} QOS_QUERY_FLOW; + +typedef enum _QOS_SET_FLOW { + QOSSetTrafficType, + QOSSetOutgoingRate, + QOSSetOutgoingDSCPValue +} QOS_SET_FLOW, *PQOS_SET_FLOW; + +typedef enum _QOS_TRAFFIC_TYPE { + QOSTrafficTypeBestEffort, + QOSTrafficTypeBackground, + QOSTrafficTypeExcellentEffort, + QOSTrafficTypeAudioVideo, + QOSTrafficTypeVoice, + QOSTrafficTypeControl +} QOS_TRAFFIC_TYPE, *PQOS_TRAFFIC_TYPE; + +typedef struct _QOS_FLOW_FUNDAMENTALS { + BOOL BottleneckBandwidthSet; + UINT64 BottleneckBandwidth; + BOOL AvailableBandwidthSet; + UINT64 AvailableBandwidth; + BOOL RTTSet; + UINT32 RTT; +} QOS_FLOW_FUNDAMENTALS, *PQOS_FLOW_FUNDAMENTALS; + +typedef struct _QOS_FLOWRATE_OUTGOING { + UINT64 Bandwidth; + QOS_SHAPING ShapingBehavior; + QOS_FLOWRATE_REASON Reason; +} QOS_FLOWRATE_OUTGOING, *PQOS_FLOWRATE_OUTGOING; + +typedef struct _QOS_PACKET_PRIORITY { + ULONG ConformantDSCPValue; + ULONG NonConformantDSCPValue; + ULONG ConformantL2Value; + ULONG NonConformantL2Value; +} QOS_PACKET_PRIORITY, *PQOS_PACKET_PRIORITY; + +typedef struct _QOS_VERSION { + USHORT MajorVersion; + USHORT MinorVersion; +} QOS_VERSION, *PQOS_VERSION; + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_QOS2_H__ */
1
0
0
0
Nikolay Sivov : gdi32: Implement GetFontFileData().
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 2d6a23bef69f6a29b997f81c8d3c7c31498f300e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2d6a23bef69f6a29b997f81c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Nov 21 15:54:03 2018 +0300 gdi32: Implement GetFontFileData(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 38 ++++++++++++++++++++++++++++++++++++++ dlls/gdi32/gdi32.spec | 1 + dlls/gdi32/tests/font.c | 9 +++------ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 96e8e30..5a47272 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -8575,6 +8575,36 @@ static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr ) } /************************************************************************* + * GetFontFileData (GDI32.@) + */ +BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size ) +{ + struct font_handle_entry *entry = handle_entry( instance_id ); + DWORD tag = 0, size; + GdiFont *font; + + if (!entry) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + font = entry->obj; + if (font->ttc_item_offset) + tag = MS_TTCF_TAG; + + size = get_font_data( font, tag, 0, NULL, 0 ); + if (size < buff_size || offset > size - buff_size) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + /* For now this only works for SFNT case. */ + return get_font_data( font, tag, offset, buff, buff_size ) != 0; +} + +/************************************************************************* * GetFontFileInfo (GDI32.@) */ BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info, SIZE_T size, SIZE_T *needed ) @@ -9041,6 +9071,14 @@ BOOL WINAPI GetRasterizerCaps( LPRASTERIZER_STATUS lprs, UINT cbNumBytes) } /************************************************************************* + * GetFontFileData (GDI32.@) + */ +BOOL WINAPI GetFontFileData( DWORD instance_id, DWORD unknown, UINT64 offset, void *buff, DWORD buff_size ) +{ + return FALSE; +} + +/************************************************************************* * GetFontFileInfo (GDI32.@) */ BOOL WINAPI GetFontFileInfo( DWORD instance_id, DWORD unknown, struct font_fileinfo *info, DWORD size, DWORD *needed) diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 2400a51..2dc8f0e 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -281,6 +281,7 @@ @ stdcall GetEnhMetaFileW(wstr) # @ stub GetFontAssocStatus @ stdcall GetFontData(long long long ptr long) +@ stdcall GetFontFileData(long long int64 ptr long) @ stdcall GetFontFileInfo(long long ptr long ptr) @ stdcall GetFontLanguageInfo(long) @ stdcall GetFontRealizationInfo(long ptr) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 468e7d9..7569694 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -61,7 +61,7 @@ static INT (WINAPI *pAddFontResourceExA)(LPCSTR, DWORD, PVOID); static BOOL (WINAPI *pRemoveFontResourceExA)(LPCSTR, DWORD, PVOID); static BOOL (WINAPI *pGetFontRealizationInfo)(HDC hdc, DWORD *); static BOOL (WINAPI *pGetFontFileInfo)(DWORD, DWORD, void *, SIZE_T, SIZE_T *); -static BOOL (WINAPI *pGetFontFileData)(DWORD, DWORD, ULONGLONG, void *, DWORD); +static BOOL (WINAPI *pGetFontFileData)(DWORD, DWORD, UINT64, void *, DWORD); static HMODULE hgdi32 = 0; static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} }; @@ -4402,14 +4402,12 @@ static void test_RealizationInfo(void) ok(r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "ret %d gle %d\n", r, GetLastError()); } - if (pGetFontFileData) { /* Get bytes 2 - 16 using GetFontFileData */ r = pGetFontFileData(fri->instance_id, 0, 2, data, sizeof(data)); ok(r != 0, "ret 0 gle %d\n", GetLastError()); ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n"); } - } DeleteObject(SelectObject(hdc, hfont_old)); @@ -5144,8 +5142,6 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r wine_dbgstr_w(file_info.path)); } -if (pGetFontFileData) -{ size = file_info.size.LowPart; data = HeapAlloc(GetProcessHeap(), 0, size + 16); @@ -5177,11 +5173,12 @@ if (pGetFontFileData) /* Zero buffer size. */ memset(data, 0xcc, size); ret = pGetFontFileData(info.instance_id, 0, 16, data, 0); +todo_wine ok(ret == 0 && GetLastError() == ERROR_NOACCESS, "Unexpected return value %d, error %d\n", ret, GetLastError()); ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data); HeapFree(GetProcessHeap(), 0, data); -} + SelectObject(hdc, hfont_prev); DeleteObject(hfont); ReleaseDC(NULL, hdc);
1
0
0
0
Nikolay Sivov : gdi32: Set data size for fonts created from memory.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 93eca9e919f3298f818e8bb7c6617dd92246189e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93eca9e919f3298f818e8bb7…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Nov 21 15:54:02 2018 +0300 gdi32: Set data size for fonts created from memory. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 1 + dlls/gdi32/tests/font.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 1f46fc8..96e8e30 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -5335,6 +5335,7 @@ static void fill_fileinfo_from_face( GdiFont *font, Face *face ) if (!face->file) { font->fileinfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*font->fileinfo)); + font->fileinfo->size.QuadPart = face->font_data_size; return; } diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index f492f7b..468e7d9 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -5139,7 +5139,6 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r ok(ret != 0, "Failed to get font file info, ret %d gle %d.\n", ret, GetLastError()); if (ret) { - todo_wine_if(is_memory_resource) ok(is_memory_resource ? file_info.size.QuadPart == size : file_info.size.QuadPart > 0, "Unexpected file size.\n"); ok(is_memory_resource ? !file_info.path[0] : file_info.path[0], "Unexpected file path %s.\n", wine_dbgstr_w(file_info.path));
1
0
0
0
Nikolay Sivov : gdi32: Improve GetFontFileInfo() compatibility.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 03ccce70b540379bf4de86232d375f3e64cf465c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=03ccce70b540379bf4de8623…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Nov 21 15:54:01 2018 +0300 gdi32: Improve GetFontFileInfo() compatibility. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/gdiinterop.c | 4 +- dlls/gdi32/freetype.c | 6 +- dlls/gdi32/tests/font.c | 219 +++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 189 insertions(+), 40 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=03ccce70b540379bf4de…
1
0
0
0
Nikolay Sivov : gdi32/tests: Run memory resource font test in a child process.
by Alexandre Julliard
21 Nov '18
21 Nov '18
Module: wine Branch: master Commit: 65ef40bff78fca9c8fcee462284753415e5dadb3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=65ef40bff78fca9c8fcee462…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Nov 21 15:54:00 2018 +0300 gdi32/tests: Run memory resource font test in a child process. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/tests/font.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 4f10e2f..dfb2f8e 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -20,6 +20,7 @@ */ #include <stdarg.h> +#include <stdio.h> #include <assert.h> #include "windef.h" @@ -6859,8 +6860,25 @@ static void test_long_names(void) START_TEST(font) { + static const char *test_names[] = + { + "AddFontMemResource", + }; + char path_name[MAX_PATH]; + STARTUPINFOA startup; + char **argv; + int argc, i; + init(); + argc = winetest_get_mainargs(&argv); + if (argc >= 3) + { + if (!strcmp(argv[2], "AddFontMemResource")) + test_AddFontMemResource(); + return; + } + test_stock_fonts(); test_logfont(); test_bitmap_font(); @@ -6879,7 +6897,6 @@ START_TEST(font) test_nonexistent_font(); test_orientation(); test_height_selection(); - test_AddFontMemResource(); test_EnumFonts(); test_EnumFonts_subst(); @@ -6928,4 +6945,19 @@ START_TEST(font) */ test_vertical_font(); test_CreateScalableFontResource(); + + winetest_get_mainargs( &argv ); + for (i = 0; i < ARRAY_SIZE(test_names); ++i) + { + PROCESS_INFORMATION info; + + memset(&startup, 0, sizeof(startup)); + startup.cb = sizeof(startup); + sprintf(path_name, "%s font %s", argv[0], test_names[i]); + ok(CreateProcessA(NULL, path_name, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info), + "CreateProcess failed.\n"); + winetest_wait_child_process(info.hProcess); + CloseHandle(info.hProcess); + CloseHandle(info.hThread); + } }
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
...
96
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200