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
Gabriel Ivăncescu : mshtml: Do not enumerate internal dynamic props.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 8de5187d1b2391288afd31116dc40386642c9d92 URL:
https://gitlab.winehq.org/wine/wine/-/commit/8de5187d1b2391288afd31116dc403…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Mon Oct 10 19:55:22 2022 +0300 mshtml: Do not enumerate internal dynamic props. Props allocated with dispex_get_dprop_ref or dispex_get_dynid are purely internal to our implementation and must not be enumerated. Note that in case of window, the props themselves become enumerable, but the dynamic props must still be hidden, since it's the custom prop that refers to it that must be enumerated (i.e. the DISPID must match with the custom prop, not the underlying dynamic prop backing it, which would violate the former DISPID obtained for the respective name). Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/mshtml/dispex.c | 7 ++++++- dlls/mshtml/htmlwindow.c | 16 ++++++++++++++- dlls/mshtml/tests/documentmode.js | 42 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index d7b587f21d2..3d3d854936e 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -85,6 +85,7 @@ typedef struct { } dynamic_prop_t; #define DYNPROP_DELETED 0x01 +#define DYNPROP_HIDDEN 0x02 typedef struct { DispatchEx dispex; @@ -702,6 +703,8 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA if(FAILED(hres)) return hres; + if(alloc) + prop->flags |= DYNPROP_HIDDEN; *ret = &prop->var; return S_OK; } @@ -715,6 +718,7 @@ HRESULT dispex_get_dynid(DispatchEx *This, const WCHAR *name, DISPID *id) if(FAILED(hres)) return hres; + prop->flags |= DYNPROP_HIDDEN; *id = DISPID_DYNPROP_0 + (prop - This->dynamic_data->props); return S_OK; } @@ -1860,7 +1864,8 @@ static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BS static HRESULT next_dynamic_id(DispatchEx *dispex, DWORD idx, DISPID *ret_id) { - while(idx < dispex->dynamic_data->prop_cnt && dispex->dynamic_data->props[idx].flags & DYNPROP_DELETED) + while(idx < dispex->dynamic_data->prop_cnt && + (dispex->dynamic_data->props[idx].flags & (DYNPROP_DELETED | DYNPROP_HIDDEN))) idx++; if(idx == dispex->dynamic_data->prop_cnt) { diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 02d6d374255..12f8a304d41 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3874,6 +3874,20 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD return hres; } +static HRESULT HTMLWindow_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid) +{ + DWORD idx = (id == DISPID_STARTENUM) ? 0 : id - MSHTML_DISPID_CUSTOM_MIN + 1; + HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + + while(idx < This->global_prop_cnt && This->global_props[idx].type != GLOBAL_DISPEXVAR) + idx++; + if(idx >= This->global_prop_cnt) + return S_FALSE; + + *pid = idx + MSHTML_DISPID_CUSTOM_MIN; + return S_OK; +} + static compat_mode_t HTMLWindow_get_compat_mode(DispatchEx *dispex) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); @@ -3971,7 +3985,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = { HTMLWindow_get_name, HTMLWindow_invoke, NULL, - NULL, + HTMLWindow_next_dispid, HTMLWindow_get_compat_mode, NULL }, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index cb6d2d01ec2..a3a0e2439cd 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -635,6 +635,8 @@ sync_test("JS objs", function() { }); sync_test("for..in", function() { + var v = document.documentMode, found = 0, r; + function ctor() {} ctor.prototype.test2 = true; @@ -642,7 +644,7 @@ sync_test("for..in", function() { obj.test1 = true; i = 0; - for(var r in obj) { + for(r in obj) { ctor.prototype.test3 = true; arr[r] = true; i++; @@ -652,10 +654,22 @@ sync_test("for..in", function() { ok(arr["test1"] === true, "arr[test1] !== true"); ok(arr["test2"] === true, "arr[test2] !== true"); ok(arr["test3"] === true, "arr[test3] !== true"); + + for(r in document) + if(r === "ondragstart") + found++; + ok(found === 1, "ondragstart enumerated " + found + " times in document"); + document.ondragstart = ""; + found = 0; + for(r in document) + if(r === "ondragstart") + found++; + ok(found === 1, "ondragstart enumerated " + found + " times in document after set to empty string"); }); sync_test("elem_by_id", function() { document.body.innerHTML = '<form id="testid" name="testname"></form>'; + var found; var id_elem = document.getElementById("testid"); ok(id_elem.tagName === "FORM", "id_elem.tagName = " + id_elem.tagName); @@ -665,6 +679,32 @@ sync_test("elem_by_id", function() { ok(id_elem === name_elem, "id_elem != id_elem"); else ok(name_elem === null, "name_elem != null"); + + id_elem = window.testid; + ok(id_elem.tagName === "FORM", "window.testid = " + id_elem); + + name_elem = document.testname; + ok(name_elem.tagName === "FORM", "document.testname = " + name_elem); + + for(id_elem in window) + ok(id_elem !== "testid" && id_elem != "testname", id_elem + " was enumerated in window"); + window.testid = 137; + found = false; + for(id_elem in window) { + ok(id_elem != "testname", id_elem + " was enumerated in window after set to 137"); + if(id_elem === "testid") + found = true; + } + ok(found, "testid was not enumerated in window after set to 137"); + + found = false; + for(id_elem in document) { + ok(id_elem !== "testid", "testid was enumerated in document"); + if(id_elem === "testname") + found = true; + } + todo_wine. + ok(found, "testname was not enumerated in document"); }); sync_test("doc_mode", function() {
1
0
0
0
Gabriel Ivăncescu : mshtml: Fix enumerating first custom prop after builtins.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 03c4a231c0e09c89c4bb5794e2b17ec95aab0d16 URL:
https://gitlab.winehq.org/wine/wine/-/commit/03c4a231c0e09c89c4bb5794e2b17e…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Mon Oct 10 19:55:22 2022 +0300 mshtml: Fix enumerating first custom prop after builtins. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/mshtml/dispex.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 90650e5acc4..d7b587f21d2 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1909,6 +1909,8 @@ static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, } func++; } + + id = DISPID_STARTENUM; } if(This->info->desc->vtbl && This->info->desc->vtbl->next_dispid) {
1
0
0
0
Gabriel Ivăncescu : jscript: Refill the props at end of enumeration in html mode and retry.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 605819dcd94b1b1b4843fa869ed15402bdc8a18b URL:
https://gitlab.winehq.org/wine/wine/-/commit/605819dcd94b1b1b4843fa869ed154…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Mon Oct 10 19:55:22 2022 +0300 jscript: Refill the props at end of enumeration in html mode and retry. If properties were added during enumeration, for example on the prototype, they are actually visited in mshtml scripts in any mode. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/dispex.c | 13 ++++++++----- dlls/jscript/tests/lang.js | 2 ++ dlls/mshtml/tests/documentmode.js | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 746c5246ed1..42f41771ef2 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2492,16 +2492,16 @@ HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_ty DWORD idx = id; HRESULT hres; - if(id == DISPID_STARTENUM) { + if(id == DISPID_STARTENUM || idx >= obj->prop_cnt) { hres = (enum_type == JSDISP_ENUM_ALL) ? fill_protrefs(obj) : fill_props(obj); if(FAILED(hres)) return hres; - idx = 0; + if(id == DISPID_STARTENUM) + idx = 0; + if(idx >= obj->prop_cnt) + return S_FALSE; } - if(idx >= obj->prop_cnt) - return S_FALSE; - for(iter = &obj->props[idx]; iter < obj->props + obj->prop_cnt; iter++) { if(iter->type == PROP_DELETED) continue; @@ -2513,6 +2513,9 @@ HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_ty return S_OK; } + if(obj->ctx->html_mode) + return jsdisp_next_prop(obj, prop_to_id(obj, iter - 1), enum_type, ret); + return S_FALSE; } diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index 67e4576813b..5c201d5bf26 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -1559,6 +1559,7 @@ inobj.test2 = true; tmp = 0; for(iter in inobj) { + forinTestObj.prototype.test4 = true; arr[iter] = true; tmp++; } @@ -1567,6 +1568,7 @@ ok(tmp === 3, "for..in tmp = " + tmp); ok(arr["test1"] === true, "arr[test1] !== true"); ok(arr["test2"] === true, "arr[test2] !== true"); ok(arr["test3"] === true, "arr[test3] !== true"); +ok(arr["test4"] !== true, "arr[test4] === true"); ok((delete inobj.test1) === true, "delete inobj.test1 returned false"); ok(!("test1" in inobj), "test1 is still in inobj after delete"); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 90223d53f83..cb6d2d01ec2 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -634,6 +634,26 @@ sync_test("JS objs", function() { test_parses("if(false) { o.if; }", v >= 9); }); +sync_test("for..in", function() { + function ctor() {} + ctor.prototype.test2 = true; + + var arr = new Array(), obj = new ctor(), i, r; + obj.test1 = true; + + i = 0; + for(var r in obj) { + ctor.prototype.test3 = true; + arr[r] = true; + i++; + } + + ok(i === 3, "enum did " + i + " iterations"); + ok(arr["test1"] === true, "arr[test1] !== true"); + ok(arr["test2"] === true, "arr[test2] !== true"); + ok(arr["test3"] === true, "arr[test3] !== true"); +}); + sync_test("elem_by_id", function() { document.body.innerHTML = '<form id="testid" name="testname"></form>';
1
0
0
0
Gabriel Ivăncescu : jscript: Fill the builtin props for enumeration on prototypes as well.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 2a228918ef88eec4b776927026a96498afb7eb7d URL:
https://gitlab.winehq.org/wine/wine/-/commit/2a228918ef88eec4b776927026a964…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Mon Oct 10 19:55:21 2022 +0300 jscript: Fill the builtin props for enumeration on prototypes as well. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> --- dlls/jscript/dispex.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index e25378e866b..746c5246ed1 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -610,15 +610,41 @@ HRESULT builtin_set_const(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) return S_OK; } +static HRESULT fill_props(jsdisp_t *obj) +{ + dispex_prop_t *prop; + HRESULT hres; + + if(obj->builtin_info->idx_length) { + unsigned i = 0, len = obj->builtin_info->idx_length(obj); + WCHAR name[12]; + + for(i = 0; i < len; i++) { + swprintf(name, ARRAY_SIZE(name), L"%u", i); + hres = find_prop_name(obj, string_hash(name), name, FALSE, &prop); + if(FAILED(hres)) + return hres; + } + } + + return S_OK; +} + static HRESULT fill_protrefs(jsdisp_t *This) { dispex_prop_t *iter, *prop; HRESULT hres; + hres = fill_props(This); + if(FAILED(hres)) + return hres; + if(!This->prototype) return S_OK; - fill_protrefs(This->prototype); + hres = fill_protrefs(This->prototype); + if(FAILED(hres)) + return hres; for(iter = This->prototype->props; iter < This->prototype->props+This->prototype->prop_cnt; iter++) { hres = find_prop_name(This, iter->hash, iter->name, FALSE, &prop); @@ -2467,23 +2493,9 @@ HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_ty HRESULT hres; if(id == DISPID_STARTENUM) { - if(obj->builtin_info->idx_length) { - unsigned i = 0, len = obj->builtin_info->idx_length(obj); - WCHAR name[12]; - - for(i = 0; i < len; i++) { - swprintf(name, ARRAY_SIZE(name), L"%d", i); - hres = find_prop_name(obj, string_hash(name), name, FALSE, &iter); - if(FAILED(hres)) - return hres; - } - } - - if (enum_type == JSDISP_ENUM_ALL) { - hres = fill_protrefs(obj); - if(FAILED(hres)) - return hres; - } + hres = (enum_type == JSDISP_ENUM_ALL) ? fill_protrefs(obj) : fill_props(obj); + if(FAILED(hres)) + return hres; idx = 0; }
1
0
0
0
Erich E. Hoover : ntdll: Implement storing DOS attributes in NtCreateFile.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 3602c676dadf823a4868b0b72f326159cb93766e URL:
https://gitlab.winehq.org/wine/wine/-/commit/3602c676dadf823a4868b0b72f3261…
Author: Erich E. Hoover <erich.e.hoover(a)gmail.com> Date: Sun Sep 18 18:58:24 2022 +0100 ntdll: Implement storing DOS attributes in NtCreateFile. Co-authored-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> Signed-off-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> --- dlls/ntdll/tests/directory.c | 25 ++++++++++++------------- dlls/ntdll/unix/file.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 2a5fedb4659..a5ea7900f8d 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -55,7 +55,6 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG * /* The attribute sets to test */ static struct testfile_s { - BOOL todo; /* set if it doesn't work on wine yet */ BOOL attr_done; /* set if attributes were tested for this file already */ const DWORD attr; /* desired attribute */ WCHAR name[20]; /* filename to use */ @@ -63,16 +62,16 @@ static struct testfile_s { const char *description; /* for error messages */ int nfound; /* How many were found (expect 1) */ } testfiles[] = { - { 0, 0, FILE_ATTRIBUTE_NORMAL, {'l','o','n','g','f','i','l','e','n','a','m','e','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {'n','.','t','m','p',}, "normal" }, - { 1, 0, FILE_ATTRIBUTE_HIDDEN, {'h','.','t','m','p',}, "hidden" }, - { 1, 0, FILE_ATTRIBUTE_SYSTEM, {'s','.','t','m','p',}, "system" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'d','.','t','m','p',}, "directory" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {0xe9,'a','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {0xc9,'b','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p'}, "normal" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" }, - { 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" } + { 0, FILE_ATTRIBUTE_NORMAL, {'l','o','n','g','f','i','l','e','n','a','m','e','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'n','.','t','m','p',}, "normal" }, + { 0, FILE_ATTRIBUTE_HIDDEN, {'h','.','t','m','p',}, "hidden" }, + { 0, FILE_ATTRIBUTE_SYSTEM, {'s','.','t','m','p',}, "system" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, {'d','.','t','m','p',}, "directory" }, + { 0, FILE_ATTRIBUTE_NORMAL, {0xe9,'a','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {0xc9,'b','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p'}, "normal" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" } }; static const int test_dir_count = ARRAY_SIZE(testfiles); static const int max_test_dir_size = ARRAY_SIZE(testfiles) + 5; /* size of above plus some for .. etc */ @@ -162,8 +161,8 @@ static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info) if (namelen != len || memcmp(nameW, testfiles[i].name, len*sizeof(WCHAR))) continue; if (!testfiles[i].attr_done) { - todo_wine_if (testfiles[i].todo) - ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%lx), got %lx (is your linux new enough?)\n", wine_dbgstr_w(testfiles[i].name), testfiles[i].description, testfiles[i].attr, attrib); + ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%lx), got %lx\n", + wine_dbgstr_w(testfiles[i].name), testfiles[i].description, testfiles[i].attr, attrib); testfiles[i].attr_done = TRUE; } testfiles[i].nfound++; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 05c982ffb66..469c714f847 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -4002,6 +4002,20 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU io->Information = FILE_OVERWRITTEN; break; } + + if (io->Information == FILE_CREATED && (attributes & XATTR_ATTRIBS_MASK)) + { + int fd, needs_close; + + /* set any DOS extended attributes */ + if (!server_get_unix_fd( *handle, 0, &fd, &needs_close, NULL, NULL )) + { + if (fd_set_dos_attrib( fd, attributes ) == -1 && errno != ENOTSUP) + WARN( "Failed to set extended attribute " SAMBA_XATTR_DOS_ATTRIB ". errno %d (%s)", + errno, strerror( errno ) ); + if (needs_close) close( fd ); + } + } } else if (status == STATUS_TOO_MANY_OPENED_FILES) {
1
0
0
0
Joel Holdsworth : ntdll: Implement retrieving DOS attributes in NtQueryInformationFile.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 0a223f17e1fb4aafb43906aeffe00eadc81cf8c2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/0a223f17e1fb4aafb43906aeffe00e…
Author: Joel Holdsworth <joel(a)airwebreathe.org.uk> Date: Sun Sep 18 19:08:41 2022 +0100 ntdll: Implement retrieving DOS attributes in NtQueryInformationFile. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=9158
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=15679
Co-authored-by: Erich E. Hoover <erich.e.hoover(a)gmail.com> Signed-off-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> --- dlls/ntdll/tests/file.c | 8 ++++---- dlls/ntdll/unix/file.c | 26 +++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index dd0061b13d8..d49d4d5c26f 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1392,7 +1392,7 @@ static void test_file_basic_information(void) memset(&fbi, 0, sizeof(fbi)); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); ok ( res == STATUS_SUCCESS, "can't get attributes\n"); - todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM\n", fbi.FileAttributes ); + ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM\n", fbi.FileAttributes ); /* Then HIDDEN */ memset(&fbi, 0, sizeof(fbi)); @@ -1405,7 +1405,7 @@ static void test_file_basic_information(void) memset(&fbi, 0, sizeof(fbi)); res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation); ok ( res == STATUS_SUCCESS, "can't get attributes\n"); - todo_wine ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN\n", fbi.FileAttributes ); + ok ( (fbi.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN\n", fbi.FileAttributes ); /* Check NORMAL last of all (to make sure we can clear attributes) */ memset(&fbi, 0, sizeof(fbi)); @@ -1462,7 +1462,7 @@ static void test_file_all_information(void) memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res); - todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM\n", fai_buf.fai.BasicInformation.FileAttributes ); + ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_SYSTEM, "attribute %lx not FILE_ATTRIBUTE_SYSTEM\n", fai_buf.fai.BasicInformation.FileAttributes ); /* Then HIDDEN */ memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); @@ -1475,7 +1475,7 @@ static void test_file_all_information(void) memset(&fai_buf.fai, 0, sizeof(fai_buf.fai)); res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation); ok ( res == STATUS_SUCCESS, "can't get attributes\n"); - todo_wine ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN\n", fai_buf.fai.BasicInformation.FileAttributes ); + ok ( (fai_buf.fai.BasicInformation.FileAttributes & attrib_mask) == FILE_ATTRIBUTE_HIDDEN, "attribute %lx not FILE_ATTRIBUTE_HIDDEN\n", fai_buf.fai.BasicInformation.FileAttributes ); /* Check NORMAL last of all (to make sure we can clear attributes) */ memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation)); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 3b114db4f18..05c982ffb66 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -408,6 +408,21 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si } +static int xattr_fget( int filedes, const char *name, void *value, size_t size ) +{ +#ifdef HAVE_SYS_XATTR_H +# ifdef XATTR_ADDITIONAL_OPTIONS + return fgetxattr( filedes, name, value, size, 0, 0 ); +# else + return fgetxattr( filedes, name, value, size ); +# endif +#else + errno = ENOSYS; + return -1; +#endif +} + + /* get space from the current directory data buffer, allocating a new one if necessary */ static void *get_dir_data_space( struct dir_data *data, unsigned int size ) { @@ -1536,7 +1551,8 @@ static BOOL fd_is_mount_point( int fd, const struct stat *st ) /* get the stat info and file attributes for a file (by file descriptor) */ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr ) { - int ret; + char attr_data[65]; + int attr_len, ret; *attr = 0; ret = fstat( fd, st ); @@ -1545,6 +1561,14 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON /* consider mount points to be reparse points (IO_REPARSE_TAG_MOUNT_POINT) */ if ((options & FILE_OPEN_REPARSE_POINT) && fd_is_mount_point( fd, st )) *attr |= FILE_ATTRIBUTE_REPARSE_POINT; + + attr_len = xattr_fget( fd, SAMBA_XATTR_DOS_ATTRIB, attr_data, sizeof(attr_data)-1 ); + if (attr_len != -1) + *attr |= parse_samba_dos_attrib_data( attr_data, attr_len ); + else if (errno != ENODATA && errno != ENOTSUP) + WARN( "Failed to get extended attribute " SAMBA_XATTR_DOS_ATTRIB ". errno %d (%s)\n", + errno, strerror( errno ) ); + return ret; }
1
0
0
0
Erich E. Hoover : ntdll: Implement storing DOS attributes in NtSetInformationFile.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: ba24a78c5b96beb3f0b48cf8f47b408a58d7c73e URL:
https://gitlab.winehq.org/wine/wine/-/commit/ba24a78c5b96beb3f0b48cf8f47b40…
Author: Erich E. Hoover <erich.e.hoover(a)gmail.com> Date: Thu Sep 15 11:09:30 2022 +0100 ntdll: Implement storing DOS attributes in NtSetInformationFile. Co-authored-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> Signed-off-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> --- dlls/ntdll/unix/file.c | 96 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 20 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 34bba9657b6..3b114db4f18 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -363,6 +363,36 @@ NTSTATUS errno_to_status( int err ) } +static int xattr_fremove( int filedes, const char *name ) +{ +#ifdef HAVE_SYS_XATTR_H +# ifdef XATTR_ADDITIONAL_OPTIONS + return fremovexattr( filedes, name, 0 ); +# else + return fremovexattr( filedes, name ); +# endif +#else + errno = ENOSYS; + return -1; +#endif +} + + +static int xattr_fset( int filedes, const char *name, const void *value, size_t size ) +{ +#ifdef HAVE_SYS_XATTR_H +# ifdef XATTR_ADDITIONAL_OPTIONS + return fsetxattr( filedes, name, value, size, 0, 0 ); +# else + return fsetxattr( filedes, name, value, size, 0 ); +# endif +#else + errno = ENOSYS; + return -1; +#endif +} + + static int xattr_get( const char *path, const char *name, void *value, size_t size ) { #ifdef HAVE_SYS_XATTR_H @@ -1519,6 +1549,51 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON } +static int fd_set_dos_attrib( int fd, ULONG attr ) +{ + /* we only store the HIDDEN and SYSTEM attributes */ + attr &= XATTR_ATTRIBS_MASK; + if (attr != 0) + { + /* encode the attributes in Samba 3 ASCII format. Samba 4 has extended + * this format with more features, but retains compatibility with the + * earlier format. */ + char data[11]; + int len = sprintf( data, "0x%x", attr ); + return xattr_fset( fd, SAMBA_XATTR_DOS_ATTRIB, data, len ); + } + else return xattr_fremove( fd, SAMBA_XATTR_DOS_ATTRIB ); +} + + +/* set the stat info and file attributes for a file (by file descriptor) */ +NTSTATUS fd_set_file_info( int fd, ULONG attr ) +{ + struct stat st; + + if (fstat( fd, &st ) == -1) return errno_to_status( errno ); + if (attr & FILE_ATTRIBUTE_READONLY) + { + if (S_ISDIR( st.st_mode)) + WARN("FILE_ATTRIBUTE_READONLY ignored for directory.\n"); + else + st.st_mode &= ~0222; /* clear write permission bits */ + } + else + { + /* add write permission only where we already have read permission */ + st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask); + } + if (fchmod( fd, st.st_mode ) == -1) return errno_to_status( errno ); + + if (fd_set_dos_attrib( fd, attr ) == -1 && errno != ENOTSUP) + WARN( "Failed to set extended attribute " SAMBA_XATTR_DOS_ATTRIB ". errno %d (%s)\n", + errno, strerror( errno ) ); + + return STATUS_SUCCESS; +} + + /* get the stat info and file attributes for a file (by name) */ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) { @@ -4416,7 +4491,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, case FileBasicInformation: if (len >= sizeof(FILE_BASIC_INFORMATION)) { - struct stat st; const FILE_BASIC_INFORMATION *info = ptr; LARGE_INTEGER mtime, atime; @@ -4430,25 +4504,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io, status = set_file_times( fd, &mtime, &atime ); if (status == STATUS_SUCCESS && info->FileAttributes) - { - if (fstat( fd, &st ) == -1) status = errno_to_status( errno ); - else - { - if (info->FileAttributes & FILE_ATTRIBUTE_READONLY) - { - if (S_ISDIR( st.st_mode)) - WARN("FILE_ATTRIBUTE_READONLY ignored for directory.\n"); - else - st.st_mode &= ~0222; /* clear write permission bits */ - } - else - { - /* add write permission only where we already have read permission */ - st.st_mode |= (0600 | ((st.st_mode & 044) >> 1)) & (~start_umask); - } - if (fchmod( fd, st.st_mode ) == -1) status = errno_to_status( errno ); - } - } + status = fd_set_file_info( fd, info->FileAttributes ); if (needs_close) close( fd ); }
1
0
0
0
Erich E. Hoover : ntdll: Implement retrieving DOS attributes in [fd_]get_file_info().
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 1cd1a286703992aa8cb5a02d22a3f4aeca4efcbe URL:
https://gitlab.winehq.org/wine/wine/-/commit/1cd1a286703992aa8cb5a02d22a3f4…
Author: Erich E. Hoover <erich.e.hoover(a)gmail.com> Date: Tue Aug 19 22:10:49 2014 -0600 ntdll: Implement retrieving DOS attributes in [fd_]get_file_info(). Co-authored-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> Signed-off-by: Joel Holdsworth <joel(a)airwebreathe.org.uk> --- configure | 40 ++++++++++++++++++++++++++++++++++++ configure.ac | 9 +++++++++ dlls/ntdll/unix/file.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++- include/config.h.in | 6 ++++++ 4 files changed, 109 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 3088184aade..2efb2a37011 100755 --- a/configure +++ b/configure @@ -8323,6 +8323,12 @@ if test "x$ac_cv_header_sys_vnode_h" = xyes then : printf "%s\n" "#define HAVE_SYS_VNODE_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "sys/xattr.h" "ac_cv_header_sys_xattr_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_xattr_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_XATTR_H 1" >>confdefs.h + fi ac_fn_c_check_header_compile "$LINENO" "syscall.h" "ac_cv_header_syscall_h" "$ac_includes_default" if test "x$ac_cv_header_syscall_h" = xyes @@ -9105,6 +9111,40 @@ then : fi +if test "x$ac_cv_header_sys_xattr_h" = xyes +then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getxattr takes additional arguments" >&5 +printf %s "checking whether getxattr takes additional arguments... " >&6; } +if test ${wine_cv_xattr_extra_args+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/xattr.h> +int +main (void) +{ +getxattr("", "", "", 0, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + wine_cv_xattr_extra_args=yes +else $as_nop + wine_cv_xattr_extra_args=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_xattr_extra_args" >&5 +printf "%s\n" "$wine_cv_xattr_extra_args" >&6; } + test $wine_cv_xattr_extra_args != yes || +printf "%s\n" "#define XATTR_ADDITIONAL_OPTIONS 1" >>confdefs.h + +fi + DLLFLAGS="" diff --git a/configure.ac b/configure.ac index 1e733962b75..41a29cee398 100644 --- a/configure.ac +++ b/configure.ac @@ -494,6 +494,7 @@ AC_CHECK_HEADERS(\ sys/user.h \ sys/utsname.h \ sys/vnode.h \ + sys/xattr.h \ syscall.h \ utime.h \ valgrind/memcheck.h \ @@ -635,6 +636,14 @@ AC_CHECK_HEADERS([libprocstat.h],,, #include <sys/queue.h> #endif]) +if test "x$ac_cv_header_sys_xattr_h" = xyes +then + AC_CACHE_CHECK([whether getxattr takes additional arguments], wine_cv_xattr_extra_args, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])], + [wine_cv_xattr_extra_args=yes],[wine_cv_xattr_extra_args=no])]) + test $wine_cv_xattr_extra_args != yes || AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (macOS)]) +fi + dnl **** Check for working dll **** AC_SUBST(DLLFLAGS,"") diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 7eb8dbe7ad4..34bba9657b6 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -34,6 +34,7 @@ #include <stdarg.h> #include <string.h> #include <stdlib.h> +#include <stdint.h> #include <stdio.h> #include <limits.h> #include <unistd.h> @@ -98,6 +99,9 @@ #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif +#ifdef HAVE_SYS_XATTR_H +#include <sys/xattr.h> +#endif #include <time.h> #include <unistd.h> @@ -167,6 +171,9 @@ typedef struct #define MAX_IGNORED_FILES 4 +#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +#define XATTR_ATTRIBS_MASK (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM) + struct file_identity { dev_t dev; @@ -355,6 +362,22 @@ NTSTATUS errno_to_status( int err ) } } + +static int xattr_get( const char *path, const char *name, void *value, size_t size ) +{ +#ifdef HAVE_SYS_XATTR_H +# ifdef XATTR_ADDITIONAL_OPTIONS + return getxattr( path, name, value, size, 0, 0 ); +# else + return getxattr( path, name, value, size ); +# endif +#else + errno = ENOSYS; + return -1; +#endif +} + + /* get space from the current directory data buffer, allocating a new one if necessary */ static void *get_dir_data_space( struct dir_data *data, unsigned int size ) { @@ -1451,6 +1474,27 @@ static inline ULONG get_file_attributes( const struct stat *st ) } +/* decode the xattr-stored DOS attributes */ +static int parse_samba_dos_attrib_data( char *data, int len ) +{ + char *end; + int val; + + if (len > 2 && data[0] == '0' && data[1] == 'x') + { + data[len] = 0; + val = strtol( data, &end, 16 ); + if (!*end) return val & XATTR_ATTRIBS_MASK; + } + else + { + static BOOL once; + if (!once++) FIXME( "Unhandled " SAMBA_XATTR_DOS_ATTRIB " extended attribute value.\n" ); + } + return 0; +} + + static BOOL fd_is_mount_point( int fd, const struct stat *st ) { struct stat parent; @@ -1479,7 +1523,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON static int get_file_info( const char *path, struct stat *st, ULONG *attr ) { char *parent_path; - int ret; + char attr_data[65]; + int attr_len, ret; *attr = 0; ret = lstat( path, st ); @@ -1505,6 +1550,14 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) free( parent_path ); } *attr |= get_file_attributes( st ); + + attr_len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, attr_data, sizeof(attr_data)-1 ); + if (attr_len != -1) + *attr |= parse_samba_dos_attrib_data( attr_data, attr_len ); + else if (errno != ENODATA && errno != ENOTSUP) + WARN( "Failed to get extended attribute " SAMBA_XATTR_DOS_ATTRIB " from \"%s\". errno %d (%s)\n", + path, errno, strerror( errno ) ); + return ret; } diff --git a/include/config.h.in b/include/config.h.in index de1bf6c61eb..694b11cf8c2 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -679,6 +679,9 @@ /* Define to 1 if you have the <sys/vnode.h> header file. */ #undef HAVE_SYS_VNODE_H +/* Define to 1 if you have the <sys/xattr.h> header file. */ +#undef HAVE_SYS_XATTR_H + /* Define to 1 if you have the `tcdrain' function. */ #undef HAVE_TCDRAIN @@ -888,6 +891,9 @@ backward compatibility; new code need not use it. */ #undef STDC_HEADERS +/* Define if xattr functions take additional arguments (macOS) */ +#undef XATTR_ADDITIONAL_OPTIONS + /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING
1
0
0
0
Eric Pouech : conhost: Fix tests on ReadConsole with CONSOLE_READCONSOLE_CONTROL.
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: c19f3b620acda9125cc975c02992a544b27e5929 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c19f3b620acda9125cc975c02992a5…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Sat Oct 8 17:44:54 2022 +0200 conhost: Fix tests on ReadConsole with CONSOLE_READCONSOLE_CONTROL. It should fix the errors around line 1370 in conhost/tests/tty.c, but it doesn't fix other errors around line 1530 and 1550 which are completly unrelated to this change. So failures to be expected on the latter. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=52648
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- programs/conhost/tests/tty.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/programs/conhost/tests/tty.c b/programs/conhost/tests/tty.c index 849986a1c29..cab7cd5574f 100644 --- a/programs/conhost/tests/tty.c +++ b/programs/conhost/tests/tty.c @@ -1337,6 +1337,9 @@ static void test_read_console_control(void) /* test simple behavior */ for (ctrl = 0; ctrl < ' '; ctrl++) { + DWORD state; + SHORT cc; + /* don't play with fire */ if (ctrl == 0 || ctrl == 3 || ctrl == '\n' || ctrl == 27) continue; @@ -1359,10 +1362,13 @@ static void test_read_console_control(void) strcpy(buf, "def."); buf[3] = ctrl; write_console_pipe(buf); wcscpy(bufw, L"abcdef."); bufw[6] = (WCHAR)ctrl; - child_expect_read_control_result(child_pipe, bufw, - (ctrl == '\t' || ctrl == '\r') ? 0 - : ((ctrl == 30 || ctrl == 31) ? (LEFT_CTRL_PRESSED | SHIFT_PRESSED) - : LEFT_CTRL_PRESSED)); + /* ^H requires special handling */ + cc = (ctrl == 8) ? 0x0200 : VkKeyScanA(ctrl); + if (cc == -1) cc = 0; + state = 0; + if (cc & 0x0100) state |= SHIFT_PRESSED; + if (cc & 0x0200) state |= LEFT_CTRL_PRESSED; + child_expect_read_control_result(child_pipe, bufw, state); skip_sequence("\x1b[?25l"); /* hide cursor */ expect_output_sequence("def"); skip_sequence("\x1b[?25h"); /* show cursor */
1
0
0
0
Hugh McMaster : kernelbase: Return full title length from GetConsoleTitle().
by Alexandre Julliard
10 Oct '22
10 Oct '22
Module: wine Branch: master Commit: 627f2b3557ccb0038ae957ecf17d1a4f784825dc URL:
https://gitlab.winehq.org/wine/wine/-/commit/627f2b3557ccb0038ae957ecf17d1a…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Fri Sep 30 21:38:11 2022 +1000 kernelbase: Return full title length from GetConsoleTitle(). --- dlls/kernel32/tests/console.c | 6 +++--- dlls/kernelbase/console.c | 28 +++++++++++++++++++--------- include/wine/condrv.h | 7 +++++++ programs/conhost/conhost.c | 12 ++++++++---- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index b10254bc161..c145aa4cb59 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -4272,12 +4272,12 @@ static void test_GetConsoleTitleW(void) ret = GetConsoleTitleW(buf, ARRAY_SIZE(buf)); ok(ret, "GetConsoleTitleW failed: %lu\n", GetLastError()); - todo_wine ok(ret == wcslen(str), "Got string length %lu, expected %Iu\n", ret, wcslen(str)); + ok(ret == wcslen(str), "Got string length %lu, expected %Iu\n", ret, wcslen(str)); ok(!wcscmp(buf, str), "Title = %s\n", wine_dbgstr_w(buf)); ret = GetConsoleTitleW(buf, 2); ok(ret, "GetConsoleTitleW failed: %lu\n", GetLastError()); - todo_wine ok(ret == wcslen(str), "Got string length %lu, expected %Iu\n", ret, wcslen(str)); + ok(ret == wcslen(str), "Got string length %lu, expected %Iu\n", ret, wcslen(str)); if (!skip_nt) ok(!wcscmp(buf, L"t"), "Title = %s\n", wine_dbgstr_w(buf)); ret = GetConsoleTitleW(buf, 4); @@ -4289,7 +4289,7 @@ static void test_GetConsoleTitleW(void) ok(ret, "SetConsoleTitleW failed: %lu\n", GetLastError()); ret = GetConsoleTitleW(buf, ARRAY_SIZE(buf)); - todo_wine ok(!ret, "Unexpected string length; error %lu\n", GetLastError()); + ok(!ret, "Unexpected string length; error %lu\n", GetLastError()); } static void test_file_info(HANDLE input, HANDLE output) diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 590198cf7bf..434399b073a 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -1012,12 +1012,11 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA( LPSTR title, DWORD size ) DWORD ret; if (!ptr) return 0; + ret = GetConsoleTitleW( ptr, size ); if (ret) - { - WideCharToMultiByte( GetConsoleOutputCP(), 0, ptr, ret + 1, title, size, NULL, NULL); - ret = strlen(title); - } + WideCharToMultiByte( GetConsoleOutputCP(), 0, ptr, -1, title, size, NULL, NULL); + HeapFree( GetProcessHeap(), 0, ptr ); return ret; } @@ -1028,15 +1027,26 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA( LPSTR title, DWORD size ) */ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleW( LPWSTR title, DWORD size ) { - if (!size) return 0; + struct condrv_title_params *params; + size_t max_size = sizeof(*params) + (size - 1) * sizeof(WCHAR); + + if (!title || !size) return 0; + + if (!(params = HeapAlloc( GetProcessHeap(), 0, max_size ))) + return 0; if (!console_ioctl( RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle, IOCTL_CONDRV_GET_TITLE, - NULL, 0, title, (size - 1) * sizeof(WCHAR), &size )) + NULL, 0, params, max_size, &size )) return 0; - size /= sizeof(WCHAR); - title[size] = 0; - return size + 1; + if (size < sizeof(*params)) return 0; + + size -= sizeof(*params); + memcpy( title, params->buffer, size ); + title[ size / sizeof(WCHAR) ] = 0; + size = params->title_len; + HeapFree( GetProcessHeap(), 0, params ); + return size; } diff --git a/include/wine/condrv.h b/include/wine/condrv.h index 3355d7177b0..51534720444 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -159,6 +159,13 @@ struct condrv_output_info_params #define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040 #define SET_CONSOLE_OUTPUT_INFO_FONT 0x0080 +/* IOCTL_CONDRV_GET_TITLE params */ +struct condrv_title_params +{ + unsigned int title_len; + WCHAR buffer[1]; +}; + /* IOCTL_CONDRV_FILL_OUTPUT params */ struct condrv_fill_output_params { diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 792daeb520f..c3a106c9321 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -2675,12 +2675,16 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code, case IOCTL_CONDRV_GET_TITLE: { - WCHAR *result; + size_t title_len, str_size; + struct condrv_title_params *params; if (in_size) return STATUS_INVALID_PARAMETER; + title_len = console->title ? wcslen( console->title ) : 0; + str_size = min( *out_size - sizeof(*params), title_len * sizeof(WCHAR) ); + *out_size = sizeof(*params) + str_size; + if (!(params = alloc_ioctl_buffer( *out_size ))) return STATUS_NO_MEMORY; TRACE( "returning title %s\n", debugstr_w(console->title) ); - *out_size = min( *out_size, console->title ? wcslen( console->title ) * sizeof(WCHAR) : 0 ); - if (!(result = alloc_ioctl_buffer( *out_size ))) return STATUS_NO_MEMORY; - if (*out_size) memcpy( result, console->title, *out_size ); + if (str_size) memcpy( params->buffer, console->title, str_size ); + params->title_len = title_len; return STATUS_SUCCESS; }
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
53
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