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
October 2022
----- 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
1 participants
537 discussions
Start a n
N
ew thread
Alexandre Julliard : nls: Update locales that have been added in recent Windows versions.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: b591b3167cf98ccc6d70871f282d8b5f98013fff URL:
https://gitlab.winehq.org/wine/wine/-/commit/b591b3167cf98ccc6d70871f282d8b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Oct 17 12:31:38 2022 +0200 nls: Update locales that have been added in recent Windows versions. --- nls/locale.nls | Bin 736194 -> 738990 bytes tools/make_unicode | 27 ++++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/nls/locale.nls b/nls/locale.nls index 06d1982cf5a..8ee39e44222 100644 Binary files a/nls/locale.nls and b/nls/locale.nls differ diff --git a/tools/make_unicode b/tools/make_unicode index 667df5e186f..12076252e3d 100755 --- a/tools/make_unicode +++ b/tools/make_unicode @@ -614,8 +614,10 @@ my @locales = { name => "de-LU", lcid => 0x00001007, sabbrevlangname => "DEL" }, { name => "dje", sopentypelang => "DJR" }, { name => "dje-NE" }, - { name => "doi" }, - { name => "doi-IN" }, + { name => "doi", sopentypelang => "DGR" }, + { name => "doi-IN", alias => "doi-Deva-IN" }, + { name => "doi-Deva", file => "doi" }, + { name => "doi-Deva-IN", file => "doi_IN" }, { name => "dsb", lcid => 0x00007c2e, sparent => "hsb", oemcp => 850, ebcdiccp => 870, sabbrevlangname => "DSB", sopentypelang => "LSB" }, { name => "dsb-DE", lcid => 0x0000082e }, { name => "dua" }, @@ -790,7 +792,7 @@ my @locales = { name => "ff-MR", alias => "ff-Latn-MR" }, { name => "ff-NG", alias => "ff-Latn-NG" }, { name => "ff-SN", alias => "ff-Latn-SN" }, - { name => "ff-Adlm" }, + { name => "ff-Adlm", oemcp => 65001 }, { name => "ff-Adlm-BF" }, { name => "ff-Adlm-CM" }, { name => "ff-Adlm-GH" }, @@ -875,10 +877,11 @@ my @locales = { name => "fr-YT" }, { name => "fur", sopentypelang => "FRL" }, { name => "fur-IT" }, + { name => "fuv-NG", alias => "ff-Latn-NG" }, { name => "fy", lcid => 0x00000062, oemcp => 850, sabbrevlangname => "FYN", sopentypelang => "FRI" }, { name => "fy-NL", lcid => 0x00000462 }, { name => "ga", lcid => 0x0000003c, oemcp => 850, sabbrevlangname => "IRE", sopentypelang => "IRI" }, - { name => "ga-GB" }, + { name => "ga-GB", oemcp => 65001 }, { name => "ga-IE", lcid => 0x0000083c }, { name => "gd", lcid => 0x00000091, oemcp => 850, ebcdiccp => 20285, sopentypelang => "GAE" }, { name => "gd-GB", lcid => 0x00000491 }, @@ -896,6 +899,7 @@ my @locales = { name => "guz" }, { name => "guz-KE" }, { name => "gv", sopentypelang => "MNX" }, + { name => "gv-GB", file => "gv" }, { name => "gv-IM" }, { name => "ha", lcid => 0x00000068, oemcp => 437 }, { name => "ha-GH", alias => "ha-Latn-GH" }, @@ -1026,7 +1030,8 @@ my @locales = { name => "ky-Cyrl-KG", alias => "ky-KG" }, { name => "ky-KG", lcid => 0x00000440 }, { name => "la", lcid => 0x00000076, oemcp => 437, slist => ",", dir => "seed", sabbrevlangname => "ZZZ" }, - { name => "la-001", lcid => 0x00000476, file => "la", dir => "seed" }, + { name => "la-VA", lcid => 0x00000476, dir => "seed" }, + { name => "la-001", alias => "la-VA" }, { name => "lag" }, { name => "lag-TZ" }, { name => "lb", lcid => 0x0000006e, oemcp => 850, ebcdiccp => 20297, sabbrevlangname => "LBX" }, @@ -1087,6 +1092,8 @@ my @locales = { name => "mn-Mong-MN", lcid => 0x00000c50, dir => "seed", sabbrevlangname => "MNM" }, { name => "mni", lcid => 0x00000058, slist => ",", sabbrevlangname => "ZZZ" }, { name => "mni-IN", lcid => 0x00000458, file => "mni_Beng_IN" }, + { name => "mni-Beng" }, + { name => "mni-Beng-IN", alias => "mni-IN" }, { name => "moh", lcid => 0x0000007c, oemcp => 850, ebcdiccp => 37, slist => ",", dir => "seed", sabbrevlangname => "MWK" }, { name => "moh-CA", lcid => 0x0000047c, dir => "seed" }, { name => "moh-Latn", alias => "moh" }, @@ -1170,7 +1177,9 @@ my @locales = ## name => "pap", lcid => 0x00000079 }, ## name => "pap-029", lcid => 0x00000479 }, { name => "pcm" }, - { name => "pcm-NG" }, + { name => "pcm-NG", alias => "pcm-Latn-NG" }, + { name => "pcm-Latn", file => "pcm" }, + { name => "pcm-Latn-NG", file => "pcm_NG" }, { name => "pl", lcid => 0x00000015, oemcp => 852, ebcdiccp => 20880, group => 2, sabbrevlangname => "PLK", sopentypelang => "PLK" }, { name => "pl-PL", lcid => 0x00000415 }, ## name => "prg" }, @@ -1376,6 +1385,7 @@ my @locales = { name => "ti-ET", lcid => 0x00000473, sabbrevlangname => "TIE" }, { name => "tig", dir => "seed", sopentypelang => "TGR" }, { name => "tig-ER", dir => "seed" }, + { name => "tig-Ethi-ER", alias => "tig-ER" }, { name => "tk", lcid => 0x00000042, oemcp => 852, ebcdiccp => 20880, group => 2, sopentypelang => "TKM" }, { name => "tk-Latn", alias => "tk" }, { name => "tk-Latn-TM", alias => "tk-TM" }, @@ -1401,6 +1411,7 @@ my @locales = { name => "tzm-Latn-MA", file => "tzm_MA", oemcp => 65001 }, { name => "tzm-Latn-DZ", lcid => 0x0000085f, file => "tzm" }, { name => "tzm-MA", alias => "tzm-Latn-MA" }, + { name => "tzm-DZ", alias => "tzm-Latn-DZ" }, ## name => "tzm-Arab", group => 13 }, ## name => "tzm-Arab-MA", lcid => 0x0000045f }, ## name => "tzm-Tfng", lcid => 0x0000785f }, @@ -1434,6 +1445,8 @@ my @locales = { name => "vo-001", dir => "seed" }, { name => "vun" }, { name => "vun-TZ" }, + { name => "wa", dir => "seed", oemcp => 850 }, + { name => "wa-BE", dir => "seed" }, { name => "wae" }, { name => "wae-CH" }, { name => "wal", dir => "seed" }, @@ -4480,7 +4493,7 @@ sub build_locale_data() else { my $name = $loc->{file} || $loc->{name}; - $name =~ s/-(Arab|Cyrl|Deva|Guru|Hans|Hant|Latn|Tfng|Vaii)$//; + $name =~ s/-(Arab|Beng|Cyrl|Deva|Guru|Hans|Hant|Latn|Tfng|Vaii)$//; $name =~ s/-/_/g; $id = xml_query( $subtags, "/supplementalData/likelySubtags/likelySubtag[\@from='$name']/\@to" ); $id =~ s/_/-/g if $id;
1
0
0
0
Alex Henrie : shell32: Sanitize Program Manager icon and group names.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 52ffd611de9ec84727118b5caa5138dabeb69a68 URL:
https://gitlab.winehq.org/wine/wine/-/commit/52ffd611de9ec84727118b5caa5138…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Fri Oct 14 09:51:08 2022 -0600 shell32: Sanitize Program Manager icon and group names. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=52506
--- dlls/shell32/dde.c | 40 ++++++++++++++++++++++++++++------------ dlls/shell32/tests/progman_dde.c | 3 +-- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index 51aa8f88927..24482d2c33f 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -91,16 +91,32 @@ static inline BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) return FALSE; } -static WCHAR *combine_path(const WCHAR *directory, const WCHAR *name, const WCHAR *extension) +static WCHAR *combine_path(const WCHAR *directory, const WCHAR *name, const WCHAR *extension, BOOL sanitize) { WCHAR *path; - int len; + int len, i; len = wcslen(directory) + 1 + wcslen(name); if (extension) len += wcslen(extension); path = malloc((len + 1) * sizeof(WCHAR)); - PathCombineW(path, directory, name); + if (sanitize) + { + WCHAR *sanitized_name = wcsdup(name); + + for (i = 0; i < wcslen(name); i++) + { + if (name[i] < ' ' || wcschr(L"*/:<>?\\|", name[i])) + sanitized_name[i] = '_'; + } + + PathCombineW(path, directory, sanitized_name); + free(sanitized_name); + } + else + { + PathCombineW(path, directory, name); + } if (extension) wcscat(path, extension); @@ -109,12 +125,12 @@ static WCHAR *combine_path(const WCHAR *directory, const WCHAR *name, const WCHA } /* Returned string must be freed by caller */ -static WCHAR *get_programs_path(const WCHAR *name) +static WCHAR *get_programs_path(const WCHAR *name, BOOL sanitize) { WCHAR *programs, *path; SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs); - path = combine_path(programs, name, NULL); + path = combine_path(programs, name, NULL, sanitize); CoTaskMemFree(programs); return path; @@ -134,7 +150,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, HDDEDATA ret; groups_data[0] = 0; - programs = get_programs_path(L"*"); + programs = get_programs_path(L"*", FALSE); hfind = FindFirstFileW(programs, &finddata); if (hfind) { @@ -185,7 +201,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (argc < 1) return DDE_FNOTPROCESSED; - path = get_programs_path(argv[0]); + path = get_programs_path(argv[0], TRUE); CreateDirectoryW(path, NULL); ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL); @@ -201,7 +217,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (argc < 1) return DDE_FNOTPROCESSED; - path = get_programs_path(argv[0]); + path = get_programs_path(argv[0], TRUE); path2 = malloc((lstrlenW(path) + 2) * sizeof(*path)); lstrcpyW(path2, path); @@ -226,7 +242,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) * ignore its actual value. */ if (argc < 2) return DDE_FNOTPROCESSED; - path = get_programs_path(argv[0]); + path = get_programs_path(argv[0], TRUE); ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL); @@ -275,14 +291,14 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) } if (argc >= 2) { - name = combine_path(last_group, argv[1], L".lnk"); + name = combine_path(last_group, argv[1], L".lnk", TRUE); } else { WCHAR *filename = wcsdup(PathFindFileNameW(argv[0])); WCHAR *ext = PathFindExtensionW(filename); *ext = '\0'; - name = combine_path(last_group, filename, L".lnk"); + name = combine_path(last_group, filename, L".lnk", TRUE); free(filename); } hres = IPersistFile_Save(file, name, TRUE); @@ -300,7 +316,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (argc < 1) return DDE_FNOTPROCESSED; - name = combine_path(last_group, argv[0], L".lnk"); + name = combine_path(last_group, argv[0], L".lnk", FALSE); ret = DeleteFileW(name); free(name); diff --git a/dlls/shell32/tests/progman_dde.c b/dlls/shell32/tests/progman_dde.c index cb1ff8ddb9f..5a7e8c912e5 100644 --- a/dlls/shell32/tests/progman_dde.c +++ b/dlls/shell32/tests/progman_dde.c @@ -459,8 +459,7 @@ static void test_name_sanitization(DWORD instance, HCONV hConv) error = dde_execute(instance, hConv, buf); ok(error == DMLERR_NO_ERROR, "expected DMLERR_NO_ERROR, got %#x\n", error); sprintf(buf, "Group%s", sanitized_name); - todo_wine ok(check_exists(buf), "directory not created\n"); - if (!check_exists(buf)) return; + ok(check_exists(buf), "directory not created\n"); ok(check_window_exists(buf), "window not created\n"); sprintf(buf, "[ShowGroup(\"Group%s\", 0)]", original_name);
1
0
0
0
Alex Henrie : shell32: Introduce combine_path helper for DDE.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 6004f5b0da788c645535455a9ae6d4d2e3c163b9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6004f5b0da788c645535455a9ae6d4…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Fri Oct 14 09:51:08 2022 -0600 shell32: Introduce combine_path helper for DDE. --- dlls/shell32/dde.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index 39e7de9c2c9..51aa8f88927 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -91,20 +91,30 @@ static inline BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) return FALSE; } +static WCHAR *combine_path(const WCHAR *directory, const WCHAR *name, const WCHAR *extension) +{ + WCHAR *path; + int len; + + len = wcslen(directory) + 1 + wcslen(name); + if (extension) len += wcslen(extension); + path = malloc((len + 1) * sizeof(WCHAR)); + + PathCombineW(path, directory, name); + + if (extension) + wcscat(path, extension); + + return path; +} + /* Returned string must be freed by caller */ static WCHAR *get_programs_path(const WCHAR *name) { WCHAR *programs, *path; - int len; SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs); - - len = lstrlenW(programs) + 1 + lstrlenW(name); - path = malloc((len + 1) * sizeof(*path)); - lstrcpyW(path, programs); - lstrcatW(path, L"/"); - lstrcatW(path, name); - + path = combine_path(programs, name, NULL); CoTaskMemFree(programs); return path; @@ -265,16 +275,15 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) } if (argc >= 2) { - len = lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5; - name = malloc(len * sizeof(*name)); - swprintf( name, len, L"%s/%s.lnk", last_group, argv[1] ); + name = combine_path(last_group, argv[1], L".lnk"); } else { - const WCHAR *filename = PathFindFileNameW(argv[0]); - len = PathFindExtensionW(filename) - filename; - name = malloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name)); - swprintf( name, lstrlenW(last_group) + 1 + len + 5, L"%s/%.*s.lnk", last_group, len, filename ); + WCHAR *filename = wcsdup(PathFindFileNameW(argv[0])); + WCHAR *ext = PathFindExtensionW(filename); + *ext = '\0'; + name = combine_path(last_group, filename, L".lnk"); + free(filename); } hres = IPersistFile_Save(file, name, TRUE); @@ -291,12 +300,8 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (argc < 1) return DDE_FNOTPROCESSED; - len = lstrlenW(last_group) + 1 + lstrlenW(argv[0]) + 5; - name = malloc(len * sizeof(*name)); - swprintf( name, len, L"%s/%s.lnk", last_group, argv[0]); - + name = combine_path(last_group, argv[0], L".lnk"); ret = DeleteFileW(name); - free(name); if (!ret) return DDE_FNOTPROCESSED;
1
0
0
0
Alex Henrie : shell32: Use standard C functions for memory allocation in dde.c.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 0d90fa6348d0523a83bab91fc250ea684bc01239 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0d90fa6348d0523a83bab91fc250ea…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Fri Oct 14 09:51:08 2022 -0600 shell32: Use standard C functions for memory allocation in dde.c. --- dlls/shell32/dde.c | 60 +++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index cd956def797..39e7de9c2c9 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -58,7 +58,7 @@ static WCHAR *strndupW(const WCHAR *src, DWORD len) { WCHAR *dest; if (!src) return NULL; - dest = heap_alloc((len + 1) * sizeof(*dest)); + dest = malloc((len + 1) * sizeof(*dest)); if (dest) { memcpy(dest, src, len * sizeof(WCHAR)); @@ -100,7 +100,7 @@ static WCHAR *get_programs_path(const WCHAR *name) SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs); len = lstrlenW(programs) + 1 + lstrlenW(name); - path = heap_alloc((len + 1) * sizeof(*path)); + path = malloc((len + 1) * sizeof(*path)); lstrcpyW(path, programs); lstrcatW(path, L"/"); lstrcatW(path, name); @@ -119,7 +119,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, WIN32_FIND_DATAW finddata; HANDLE hfind; int len = 1; - WCHAR *groups_data = heap_alloc(sizeof(WCHAR)); + WCHAR *groups_data = malloc(sizeof(WCHAR)); char *groups_dataA; HDDEDATA ret; @@ -134,7 +134,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, wcscmp(finddata.cFileName, L".") && wcscmp(finddata.cFileName, L"..")) { len += lstrlenW(finddata.cFileName) + 2; - groups_data = heap_realloc(groups_data, len * sizeof(WCHAR)); + groups_data = realloc(groups_data, len * sizeof(WCHAR)); lstrcatW(groups_data, finddata.cFileName); lstrcatW(groups_data, L"\r\n"); } @@ -143,13 +143,13 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, } len = WideCharToMultiByte(CP_ACP, 0, groups_data, -1, NULL, 0, NULL, NULL); - groups_dataA = heap_alloc(len * sizeof(WCHAR)); + groups_dataA = malloc(len * sizeof(WCHAR)); WideCharToMultiByte(CP_ACP, 0, groups_data, -1, groups_dataA, len, NULL, NULL); ret = DdeCreateDataHandle(dwDDEInst, (BYTE *)groups_dataA, len, 0, hszGroups, uFmt, 0); - heap_free(groups_dataA); - heap_free(groups_data); - heap_free(programs); + free(groups_dataA); + free(groups_data); + free(programs); return ret; } else if (hszTopic == hszProgmanTopic && hszItem == hszProgmanService && uFmt == CF_TEXT) @@ -180,7 +180,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) CreateDirectoryW(path, NULL); ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL); - heap_free(last_group); + free(last_group); last_group = path; } else if (!wcsicmp(command, L"DeleteGroup")) @@ -193,7 +193,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) path = get_programs_path(argv[0]); - path2 = heap_alloc((lstrlenW(path) + 2) * sizeof(*path)); + path2 = malloc((lstrlenW(path) + 2) * sizeof(*path)); lstrcpyW(path2, path); path2[lstrlenW(path) + 1] = 0; @@ -203,8 +203,8 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) ret = SHFileOperationW(&shfos); - heap_free(path2); - heap_free(path); + free(path2); + free(path); if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED; } @@ -220,7 +220,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL); - heap_free(last_group); + free(last_group); last_group = path; } else if (!wcsicmp(command, L"AddItem")) @@ -242,10 +242,10 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) IShellLinkW_Release(link); return DDE_FNOTPROCESSED; } - path = heap_alloc(len * sizeof(WCHAR)); + path = malloc(len * sizeof(WCHAR)); SearchPathW(NULL, argv[0], L".exe", len, path, NULL); IShellLinkW_SetPath(link, path); - heap_free(path); + free(path); if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]); if (argc >= 4) IShellLinkW_SetIconLocation(link, argv[2], wcstol(argv[3], NULL, 10)); @@ -266,19 +266,19 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (argc >= 2) { len = lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5; - name = heap_alloc(len * sizeof(*name)); + name = malloc(len * sizeof(*name)); swprintf( name, len, L"%s/%s.lnk", last_group, argv[1] ); } else { const WCHAR *filename = PathFindFileNameW(argv[0]); len = PathFindExtensionW(filename) - filename; - name = heap_alloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name)); + name = malloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name)); swprintf( name, lstrlenW(last_group) + 1 + len + 5, L"%s/%.*s.lnk", last_group, len, filename ); } hres = IPersistFile_Save(file, name, TRUE); - heap_free(name); + free(name); IPersistFile_Release(file); IShellLinkW_Release(link); @@ -292,12 +292,12 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (argc < 1) return DDE_FNOTPROCESSED; len = lstrlenW(last_group) + 1 + lstrlenW(argv[0]) + 5; - name = heap_alloc(len * sizeof(*name)); + name = malloc(len * sizeof(*name)); swprintf( name, len, L"%s/%s.lnk", last_group, argv[0]); ret = DeleteFileW(name); - heap_free(name); + free(name); if (!ret) return DDE_FNOTPROCESSED; } @@ -326,7 +326,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) while (*command == '[') { argc = 0; - argv = heap_alloc(sizeof(*argv)); + argv = malloc(sizeof(*argv)); command++; while (*command == ' ') command++; @@ -355,7 +355,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) } argc++; - argv = heap_realloc(argv, argc * sizeof(*argv)); + argv = realloc(argv, argc * sizeof(*argv)); argv[argc-1] = strndupW(command, p - command); command = p; @@ -381,9 +381,9 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) ret = DDE_FNOTPROCESSED; } - heap_free(opcode); - for (i = 0; i < argc; i++) heap_free(argv[i]); - heap_free(argv); + free(opcode); + for (i = 0; i < argc; i++) free(argv[i]); + free(argv); if (ret == DDE_FNOTPROCESSED) break; } @@ -392,9 +392,9 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) error: ERR("failed to parse command %s\n", debugstr_w(original)); - heap_free(opcode); - for (i = 0; i < argc; i++) heap_free(argv[i]); - heap_free(argv); + free(opcode); + for (i = 0; i < argc; i++) free(argv[i]); + free(argv); return DDE_FNOTPROCESSED; } @@ -406,14 +406,14 @@ static DWORD Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata) len = DdeGetData(hdata, NULL, 0, 0); if (!len) return DDE_FNOTPROCESSED; - command = heap_alloc(len); + command = malloc(len); DdeGetData(hdata, (BYTE *)command, len, 0); TRACE("conv=%p topic=%s data=%s\n", hconv, debugstr_hsz(hszTopic), debugstr_w(command)); ret = parse_dde_command(hszTopic, command); - heap_free(command); + free(command); return ret; }
1
0
0
0
Alex Henrie : shell32: Move strndupW to dde.c.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 6664991f2471004b3166397f6e2c3895d58ffa81 URL:
https://gitlab.winehq.org/wine/wine/-/commit/6664991f2471004b3166397f6e2c38…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Fri Oct 14 09:51:08 2022 -0600 shell32: Move strndupW to dde.c. --- dlls/shell32/dde.c | 13 +++++++++++++ dlls/shell32/shell32_main.h | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index 5ab63136092..cd956def797 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -54,6 +54,19 @@ static const char *debugstr_hsz( HSZ hsz ) return debugstr_w( buffer ); } +static WCHAR *strndupW(const WCHAR *src, DWORD len) +{ + WCHAR *dest; + if (!src) return NULL; + dest = heap_alloc((len + 1) * sizeof(*dest)); + if (dest) + { + memcpy(dest, src, len * sizeof(WCHAR)); + dest[len] = '\0'; + } + return dest; +} + static inline BOOL Dde_OnConnect(HSZ hszTopic, HSZ hszService) { if ((hszTopic == hszProgmanTopic) && (hszService == hszProgmanService)) diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 7bb26e46a6e..33b85ee2726 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -241,19 +241,6 @@ static inline WCHAR *strdupW(const WCHAR *src) return dest; } -static inline WCHAR *strndupW(const WCHAR *src, DWORD len) -{ - WCHAR *dest; - if (!src) return NULL; - dest = heap_alloc((len + 1) * sizeof(*dest)); - if (dest) - { - memcpy(dest, src, len * sizeof(WCHAR)); - dest[len] = '\0'; - } - return dest; -} - static inline WCHAR *strdupAtoW(const char *str) { WCHAR *ret;
1
0
0
0
Gabriel Ivăncescu : jscript: Implement `reviver` argument for JSON.parse.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 2dcc5a70269e8bb875c76dcf4c4a906de52975b0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/2dcc5a70269e8bb875c76dcf4c4a90…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Fri Oct 14 22:14:43 2022 +0300 jscript: Implement `reviver` argument for JSON.parse. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/array.c | 2 +- dlls/jscript/jscript.h | 1 + dlls/jscript/json.c | 120 ++++++++++++++++++++++++++++++++++++++++++++-- dlls/jscript/tests/api.js | 57 +++++++++++++++++++++- 4 files changed, 173 insertions(+), 7 deletions(-) diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index 5a8131f092c..d69c9f7edf4 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -93,7 +93,7 @@ static HRESULT set_length(jsdisp_t *obj, DWORD length) return jsdisp_propput_name(obj, L"length", jsval_number(length)); } -static WCHAR *idx_to_str(DWORD idx, WCHAR *ptr) +WCHAR *idx_to_str(DWORD idx, WCHAR *ptr) { if(!idx) { *ptr = '0'; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 0f8baea0188..757abf8aa6d 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -318,6 +318,7 @@ HRESULT variant_date_to_string(script_ctx_t*,double,jsstr_t**) DECLSPEC_HIDDEN; HRESULT decode_source(WCHAR*) DECLSPEC_HIDDEN; HRESULT double_to_string(double,jsstr_t**) DECLSPEC_HIDDEN; +WCHAR *idx_to_str(DWORD,WCHAR*) DECLSPEC_HIDDEN; static inline BOOL is_digit(WCHAR c) { diff --git a/dlls/jscript/json.c b/dlls/jscript/json.c index dfcc39daa2a..d354768b486 100644 --- a/dlls/jscript/json.c +++ b/dlls/jscript/json.c @@ -267,20 +267,104 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r) return E_FAIL; } +struct transform_json_object_ctx +{ + script_ctx_t *ctx; + IDispatch *reviver; + HRESULT hres; +}; + +static jsval_t transform_json_object(struct transform_json_object_ctx *proc_ctx, jsdisp_t *holder, jsstr_t *name) +{ + jsval_t res, args[2]; + const WCHAR *str; + + if(!(str = jsstr_flatten(name))) + proc_ctx->hres = E_OUTOFMEMORY; + else + proc_ctx->hres = jsdisp_propget_name(holder, str, &args[1]); + if(FAILED(proc_ctx->hres)) + return jsval_undefined(); + + if(is_object_instance(args[1])) { + jsdisp_t *obj = to_jsdisp(get_object(args[1])); + jsstr_t *jsstr; + DISPID id; + BOOL b; + + if(!obj) { + FIXME("non-JS obj in JSON object: %p\n", get_object(args[1])); + proc_ctx->hres = E_NOTIMPL; + return jsval_undefined(); + }else if(is_class(obj, JSCLASS_ARRAY)) { + unsigned i, length = array_get_length(obj); + WCHAR buf[14], *buf_end; + + buf_end = buf + ARRAY_SIZE(buf) - 1; + *buf_end-- = 0; + for(i = 0; i < length; i++) { + str = idx_to_str(i, buf_end); + if(!(jsstr = jsstr_alloc(str))) { + proc_ctx->hres = E_OUTOFMEMORY; + return jsval_undefined(); + } + res = transform_json_object(proc_ctx, obj, jsstr); + jsstr_release(jsstr); + if(is_undefined(res)) { + if(FAILED(proc_ctx->hres)) + return jsval_undefined(); + if(FAILED(jsdisp_get_id(obj, str, 0, &id))) + continue; + proc_ctx->hres = disp_delete((IDispatch*)&obj->IDispatchEx_iface, id, &b); + }else { + proc_ctx->hres = jsdisp_define_data_property(obj, str, PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE, res); + jsval_release(res); + } + if(FAILED(proc_ctx->hres)) + return jsval_undefined(); + } + }else { + id = DISPID_STARTENUM; + for(;;) { + proc_ctx->hres = jsdisp_next_prop(obj, id, JSDISP_ENUM_OWN_ENUMERABLE, &id); + if(proc_ctx->hres == S_FALSE) + break; + if(FAILED(proc_ctx->hres) || FAILED(proc_ctx->hres = jsdisp_get_prop_name(obj, id, &jsstr))) + return jsval_undefined(); + res = transform_json_object(proc_ctx, obj, jsstr); + if(is_undefined(res)) { + if(SUCCEEDED(proc_ctx->hres)) + proc_ctx->hres = disp_delete((IDispatch*)&obj->IDispatchEx_iface, id, &b); + }else { + if(!(str = jsstr_flatten(jsstr))) + proc_ctx->hres = E_OUTOFMEMORY; + else + proc_ctx->hres = jsdisp_define_data_property(obj, str, PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE, res); + jsval_release(res); + } + jsstr_release(jsstr); + if(FAILED(proc_ctx->hres)) + return jsval_undefined(); + } + } + } + + args[0] = jsval_string(name); + proc_ctx->hres = disp_call_value(proc_ctx->ctx, proc_ctx->reviver, (IDispatch*)&holder->IDispatchEx_iface, + DISPATCH_METHOD, ARRAY_SIZE(args), args, &res); + return FAILED(proc_ctx->hres) ? jsval_undefined() : res; +} + /* ECMA-262 5.1 Edition 15.12.2 */ static HRESULT JSON_parse(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { json_parse_ctx_t parse_ctx; const WCHAR *buf; + jsdisp_t *root; jsstr_t *str; jsval_t ret; HRESULT hres; - if(argc != 1) { - FIXME("Unsupported args\n"); - return E_INVALIDARG; - } - hres = to_flat_string(ctx, argv[0], &str, &buf); if(FAILED(hres)) return hres; @@ -293,12 +377,38 @@ static HRESULT JSON_parse(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned hres = parse_json_value(&parse_ctx, &ret); if(SUCCEEDED(hres) && skip_spaces(&parse_ctx)) { FIXME("syntax error\n"); + jsval_release(ret); hres = E_FAIL; } jsstr_release(str); if(FAILED(hres)) return hres; + /* FIXME: check IsCallable */ + if(argc > 1 && is_object_instance(argv[1])) { + hres = create_object(ctx, NULL, &root); + if(FAILED(hres)) { + jsval_release(ret); + return hres; + } + hres = jsdisp_define_data_property(root, L"", PROPF_WRITABLE | PROPF_ENUMERABLE | PROPF_CONFIGURABLE, ret); + jsval_release(ret); + + if(SUCCEEDED(hres)) { + struct transform_json_object_ctx proc_ctx = { ctx, get_object(argv[1]), S_OK }; + if(!(str = jsstr_alloc(L""))) + hres = E_OUTOFMEMORY; + else { + ret = transform_json_object(&proc_ctx, root, str); + jsstr_release(str); + hres = proc_ctx.hres; + } + } + jsdisp_release(root); + if(FAILED(hres)) + return hres; + } + if(r) *r = ret; else diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index e47e2759abb..c33791f1fb1 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1960,7 +1960,7 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN"); [[[,2,undefined,3,{prop:0},],undefined," "],"[\n null,\n 2,\n null,\n 3,\n {\n \"prop\": 0\n },\n null\n]"] ]; - var i, s, v; + var i, s, v, t; for(i=0; i < stringify_tests.length; i++) { s = JSON.stringify.apply(null, stringify_tests[i][0]); @@ -2043,6 +2043,61 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN"); v = JSON.parse(parse_tests[i][0]); ok(json_cmp(v, parse_tests[i][1]), "parse[" + i + "] returned " + v + ", expected " + parse_tests[i][1]); } + + v = [ [-1, "b"], {"length": -2, "0": -4, "1": -5}, [{}], [{"x": [null]}] ]; + s = + '{' + + '"foo": true,' + + '"bar": [],' + + '"baz": "remove_me",' + + '"obj": {' + + ' "arr": [ [1, "b"], {"length": 2, "0": 4, "1": 5}, [{}], [{"x": [null]}] ],' + + ' "": "empty"' + + '},' + + '"last": false' + + '}'; + o = JSON.parse(s), t = JSON.parse(s), i = new Object(); + i[""] = t; + delete t.baz; /* baz gets removed */ + t.obj.arr = v; /* has negative values */ + + var walk_expect = [ + [ o, "foo", true ], + [ o, "bar", [] ], + [ o, "baz", "remove_me" ], + [ [1, "b"], "0", 1 ], + [ [-1, "b"], "1", "b" ], + [ [ [-1, "b"], {"length": 2, "0": 4, "1": 5}, [{}], [{"x": [null]}] ], "0", [-1, "b"] ], + [ {"length": 2, "0": 4, "1": 5}, "length", 2 ], + [ {"length": -2, "0": 4, "1": 5}, "0", 4 ], + [ {"length": -2, "0": -4, "1": 5}, "1", 5 ], + [ v, "1", {"length": -2, "0": -4, "1": -5} ], + [ [{}], "0", {} ], + [ v, "2", [{}] ], + [ [null], "0", null ], + [ {"x": [null]}, "x", [null] ], + [ [{"x": [null]}], "0", {"x": [null]} ], + [ v, "3", [{"x": [null]}] ], + [ { "arr": v, "": "empty" }, "arr", v ], + [ { "arr": v, "": "empty" }, "", "empty" ], + [ t, "obj", { "arr": v, "": "empty" } ], + [ t, "last", false ], + [ i, "", t ] + ]; + i = 0; + v = JSON.parse(s, function(prop, value) { + var a = [this, prop, value]; + ok(json_cmp(a, walk_expect[i]), "[walk step " + i + "] got [" + a + "], expected [" + walk_expect[i] + "]"); + i++; + return (typeof value === 'number') ? -value : (value === "remove_me" ? undefined : value); + }); + ok(i === walk_expect.length, "parse with reviver walked " + i + " steps, expected " + walk_expect.length); + ok(json_cmp(v, t), "parse with reviver returned wrong object"); + + v = JSON.parse('true', function(prop, value) { return prop === "" ? undefined : value; }); + ok(v === undefined, "parse with reviver removing last prop returned " + v); + v = JSON.parse('true', function(prop, value) { return prop === "" ? false : value; }); + ok(v === false, "parse with reviver setting last prop to false returned " + v); })(); var func = function (a) {
1
0
0
0
Gabriel Ivăncescu : jscript/tests: Fix copy paste mistake in JSON test.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: a4697901ccef210d8f6690772a42b948bac8912f URL:
https://gitlab.winehq.org/wine/wine/-/commit/a4697901ccef210d8f6690772a42b9…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Fri Oct 14 22:14:43 2022 +0300 jscript/tests: Fix copy paste mistake in JSON test. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/tests/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 123665cfdde..e47e2759abb 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -2025,7 +2025,7 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN"); for(var prop in x) { if(!x.hasOwnProperty(prop)) continue; - if(!x.hasOwnProperty(prop)) + if(!y.hasOwnProperty(prop)) return false; if(!json_cmp(x[prop], y[prop])) return false;
1
0
0
0
Gabriel Ivăncescu : jscript: Implement Function.prototype.bind's `thisArg` properly.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 35a65559293e6ef57f0423ab488d489939074204 URL:
https://gitlab.winehq.org/wine/wine/-/commit/35a65559293e6ef57f0423ab488d48…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Fri Oct 14 22:14:43 2022 +0300 jscript: Implement Function.prototype.bind's `thisArg` properly. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/function.c | 40 +++++++++++++++++++++------------------- dlls/mshtml/tests/es5.js | 17 +++++++++++++++++ 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index bf152e22868..8009f3a5d8b 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -57,7 +57,7 @@ typedef struct { typedef struct { FunctionInstance function; FunctionInstance *target; - IDispatch *this; + jsval_t this; unsigned argc; jsval_t args[1]; } BindFunction; @@ -70,7 +70,7 @@ typedef struct { unsigned argc; } ArgumentsInstance; -static HRESULT create_bind_function(script_ctx_t*,FunctionInstance*,IDispatch*,unsigned,jsval_t*,jsdisp_t**r); +static HRESULT create_bind_function(script_ctx_t*,FunctionInstance*,jsval_t,unsigned,jsval_t*,jsdisp_t**r); static inline FunctionInstance *function_from_jsdisp(jsdisp_t *jsdisp) { @@ -448,7 +448,7 @@ static HRESULT Function_call(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig static HRESULT Function_bind(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - IDispatch *bound_this = NULL; + jsval_t bound_this = jsval_undefined(); FunctionInstance *function; jsdisp_t *new_function; HRESULT hres; @@ -459,18 +459,19 @@ static HRESULT Function_bind(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig return JS_E_FUNCTION_EXPECTED; if(argc < 1) { - FIXME("no this argument\n"); - return E_NOTIMPL; - } - - if(is_object_instance(argv[0])) { - bound_this = get_object(argv[0]); - }else if(!is_null(argv[0])) { - FIXME("%s is not an object instance\n", debugstr_jsval(argv[0])); - return E_NOTIMPL; + argc = 1; + }else if(is_null(argv[0])) { + bound_this = argv[0]; + }else if(!is_undefined(argv[0])) { + IDispatch *obj; + hres = to_object(ctx, argv[0], &obj); + if(FAILED(hres)) + return hres; + bound_this = jsval_disp(obj); } hres = create_bind_function(ctx, function, bound_this, argc - 1, argv + 1, &new_function); + jsval_release(bound_this); if(FAILED(hres)) return hres; @@ -849,8 +850,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva memcpy(call_args + function->argc, argv, argc * sizeof(*call_args)); } - hres = function->target->vtbl->call(ctx, function->target, function->this ? jsval_disp(function->this) : jsval_null(), - flags, call_argc, call_args, r); + hres = function->target->vtbl->call(ctx, function->target, function->this, flags, call_argc, call_args, r); heap_free(call_args); return hres; @@ -877,8 +877,7 @@ static void BindFunction_destructor(FunctionInstance *func) for(i = 0; i < function->argc; i++) jsval_release(function->args[i]); jsdisp_release(&function->target->dispex); - if(function->this) - IDispatch_Release(function->this); + jsval_release(function->this); } static const function_vtbl_t BindFunctionVtbl = { @@ -888,7 +887,7 @@ static const function_vtbl_t BindFunctionVtbl = { BindFunction_destructor }; -static HRESULT create_bind_function(script_ctx_t *ctx, FunctionInstance *target, IDispatch *bound_this, unsigned argc, +static HRESULT create_bind_function(script_ctx_t *ctx, FunctionInstance *target, jsval_t bound_this, unsigned argc, jsval_t *argv, jsdisp_t **ret) { BindFunction *function; @@ -902,8 +901,11 @@ static HRESULT create_bind_function(script_ctx_t *ctx, FunctionInstance *target, jsdisp_addref(&target->dispex); function->target = target; - if(bound_this) - IDispatch_AddRef(function->this = bound_this); + hres = jsval_copy(bound_this, &function->this); + if(FAILED(hres)) { + jsdisp_release(&function->function.dispex); + return hres; + } for(function->argc = 0; function->argc < argc; function->argc++) { hres = jsval_copy(argv[function->argc], function->args + function->argc); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index bfaacd1bd5b..e22f610e197 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -1188,6 +1188,23 @@ sync_test("bind", function() { ok(t != a, "t == a"); ok(Function.prototype.bind.length === 1, "Function.prototype.bind.length = " + Function.prototype.bind.length); + + ((function() { ok(this === window, "bind() this = " + this); }).bind())(); + ((function() { ok(this === window, "bind(undefined) = " + this); }).bind(undefined))(); + ((function() { ok(this === window, "bind(nullDisp) = " + this); }).bind(external.nullDisp))(); + ((function() { + ok(typeof(this) === "object", "bind(42) typeof(this) = " + typeof(this)); + ok(this.valueOf() === 42, "bind(42) this = " + this); + }).bind(42))(); + + r = (Object.prototype.toString.bind())(); + ok(r === "[object Undefined]", "toString.bind() returned " + r); + r = (Object.prototype.toString.bind(undefined))(); + ok(r === "[object Undefined]", "toString.bind(undefined) returned " + r); + r = (Object.prototype.toString.bind(null))(); + ok(r === "[object Null]", "toString.bind(null) returned " + r); + r = (Object.prototype.toString.bind(external.nullDisp))(); + ok(r === "[object Null]", "toString.bind(nullDisp) returned " + r); }); sync_test("keys", function() {
1
0
0
0
Piotr Caban : winedump: Add support for EMRI_METAFILE_EXT records.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 0e49547c7ae1ce33ffd293bb784650572bbd75cc URL:
https://gitlab.winehq.org/wine/wine/-/commit/0e49547c7ae1ce33ffd293bb784650…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat Oct 15 20:52:44 2022 +0200 winedump: Add support for EMRI_METAFILE_EXT records. --- tools/winedump/emfspool.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/winedump/emfspool.c b/tools/winedump/emfspool.c index 9e591f6dd67..7d6344facd1 100644 --- a/tools/winedump/emfspool.c +++ b/tools/winedump/emfspool.c @@ -61,6 +61,14 @@ typedef struct unsigned int cjSize; } record_hdr; +static inline void print_longlong(ULONGLONG value) +{ + if (sizeof(value) > sizeof(unsigned long) && value >> 32) + printf("0x%lx%08lx", (unsigned long)(value >> 32), (unsigned long)value); + else + printf("0x%lx", (unsigned long)value); +} + static const WCHAR* read_wstr(unsigned long off) { const WCHAR *beg, *end; @@ -133,6 +141,20 @@ static unsigned long dump_emfspool_record(unsigned long off) break; } + case EMRI_METAFILE_EXT: + case EMRI_BW_METAFILE_EXT: + { + const ULONGLONG *emf_off = PRD(off + sizeof(*hdr), sizeof(*emf_off)); + if (!emf_off) + fatal("truncated file\n"); + printf(" %-20s ", "offset"); + print_longlong(*emf_off); + printf(" (absolute position "); + print_longlong(off - *emf_off); + printf(")\n"); + break; + } + default: dump_data((const unsigned char *)(hdr + 1), hdr->cjSize, ""); break;
1
0
0
0
Piotr Caban : winedump: Add prefix when dumping EMF files.
by Alexandre Julliard
17 Oct '22
17 Oct '22
Module: wine Branch: master Commit: 893ac008735fe3a7f56771fb3a854e9d1eff2ef1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/893ac008735fe3a7f56771fb3a854e…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Sat Oct 15 21:13:37 2022 +0200 winedump: Add prefix when dumping EMF files. --- tools/winedump/emf.c | 93 ++++++++++++++++++++++++----------------------- tools/winedump/emfspool.c | 2 +- tools/winedump/winedump.h | 2 +- 3 files changed, 49 insertions(+), 48 deletions(-)
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
54
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
Results per page:
10
25
50
100
200