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 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
602 discussions
Start a n
N
ew thread
Gabriel Ivăncescu : shell32/autocomplete: Use the optional IACList interface and IACList::Expand, if available.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: ef2558992201f31ec37c8b54399377c8e6d6d80f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ef2558992201f31ec37c8b54…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Date: Tue Oct 16 14:30:45 2018 +0300 shell32/autocomplete: Use the optional IACList interface and IACList::Expand, if available. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/shell32/autocomplete.c | 70 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index 11e9317..dfe7638 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -2,6 +2,7 @@ * AutoComplete interfaces implementation. * * Copyright 2004 Maxime Bellengé <maxime.bellenge(a)laposte.net> + * Copyright 2018 Gabriel Ivăncescu <gabrielopcode(a)gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -68,6 +69,7 @@ typedef struct WCHAR *txtbackup; WCHAR *quickComplete; IEnumString *enumstr; + IACList *aclist; AUTOCOMPLETEOPTIONS options; WCHAR no_fwd_char; } IAutoCompleteImpl; @@ -221,6 +223,49 @@ static LRESULT change_selection(IAutoCompleteImpl *ac, HWND hwnd, UINT key) return 0; } +static BOOL do_aclist_expand(IAutoCompleteImpl *ac, WCHAR *txt, WCHAR *last_delim) +{ + WCHAR c = last_delim[1]; + last_delim[1] = '\0'; + IACList_Expand(ac->aclist, txt); + last_delim[1] = c; + return TRUE; +} + +static BOOL aclist_expand(IAutoCompleteImpl *ac, WCHAR *txt) +{ + /* call IACList::Expand only when needed, if the + new txt and old_txt require different expansions */ + WCHAR c, *p, *last_delim, *old_txt = ac->txtbackup; + size_t i = 0; + + /* '/' is allowed as a delim for unix paths */ + static const WCHAR delims[] = { '\\', '/', 0 }; + + /* skip the shared prefix */ + while ((c = tolowerW(txt[i])) == tolowerW(old_txt[i])) + { + if (c == '\0') return FALSE; + i++; + } + + /* they differ at this point, check for a delim further in txt */ + for (last_delim = NULL, p = &txt[i]; (p = strpbrkW(p, delims)) != NULL; p++) + last_delim = p; + if (last_delim) return do_aclist_expand(ac, txt, last_delim); + + /* txt has no delim after i, check for a delim further in old_txt */ + if (strpbrkW(&old_txt[i], delims)) + { + /* scan backwards to find the first delim before txt[i] (if any) */ + while (i--) + if (strchrW(delims, txt[i])) + return do_aclist_expand(ac, txt, &txt[i]); + } + + return FALSE; +} + static void autoappend_str(IAutoCompleteImpl *ac, WCHAR *text, UINT len, WCHAR *str, HWND hwnd) { DWORD sel_start; @@ -268,6 +313,17 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_ if (len + 1 != size) text = heap_realloc(text, (len + 1) * sizeof(WCHAR)); + /* Reset it here to simplify the logic in aclist_expand for + empty strings, since it tracks changes using txtbackup, + and Reset needs to be called before IACList::Expand */ + IEnumString_Reset(ac->enumstr); + if (ac->aclist) + { + aclist_expand(ac, text); + if (text[len - 1] == '\\' || text[len - 1] == '/') + flag = autoappend_flag_no; + } + /* Set txtbackup to point to text itself (which must not be released) */ heap_free(ac->txtbackup); ac->txtbackup = text; @@ -277,7 +333,6 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_ SendMessageW(ac->hwndListBox, WM_SETREDRAW, FALSE, 0); SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0); } - IEnumString_Reset(ac->enumstr); for (cpt = 0;;) { LPOLESTR strs = NULL; @@ -607,6 +662,8 @@ static ULONG WINAPI IAutoComplete2_fnRelease( heap_free(This->txtbackup); if (This->enumstr) IEnumString_Release(This->enumstr); + if (This->aclist) + IACList_Release(This->aclist); heap_free(This); } return refCount; @@ -663,6 +720,17 @@ static HRESULT WINAPI IAutoComplete2_fnInit( return E_NOINTERFACE; } + /* Prevent txtbackup from ever being NULL to simplify aclist_expand */ + if ((This->txtbackup = heap_alloc_zero(sizeof(WCHAR))) == NULL) + { + IEnumString_Release(This->enumstr); + This->enumstr = NULL; + return E_OUTOFMEMORY; + } + + if (FAILED (IUnknown_QueryInterface (punkACL, &IID_IACList, (LPVOID*)&This->aclist))) + This->aclist = NULL; + This->initialized = TRUE; This->hwndEdit = hwndEdit;
1
0
0
0
Zebediah Figura : rpcrt4: Unmarshal into a stack pointer on the server side if possible.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 5fae77e4db87ae9db03dd95c43a8978a374c59b4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5fae77e4db87ae9db03dd95c…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Oct 16 18:49:54 2018 -0500 rpcrt4: Unmarshal into a stack pointer on the server side if possible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/rpcrt4/ndr_marshall.c | 5 ++++- dlls/rpcrt4/tests/ndr_marshall.c | 8 +++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 58f0108..b48b300 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -944,7 +944,10 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, * setting the pointer to the buffer, if possible, or set fMustAlloc to * TRUE. */ if (attr & FC_POINTER_DEREF) { - fMustAlloc = TRUE; + if (pSrcPointer && (attr & FC_ALLOCED_ON_STACK)) + *pPointer = pSrcPointer; + else + fMustAlloc = TRUE; } else { *current_ptr = NULL; } diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index e4231ae..2695d46 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -437,7 +437,6 @@ todo_wine ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) -todo_wine ok(mem == mem_orig, "%s: mem has changed %p %p\n", msgpfx, mem, mem_orig); else ok(mem != mem_orig, "%s: mem has not changed\n", msgpfx); @@ -849,10 +848,9 @@ static void test_nontrivial_pointer_types(void) *(void **)mem = NULL; StubMsg.Buffer = StubMsg.BufferStart; NdrPointerUnmarshall( &StubMsg, &mem, &fmtstr_ref_unique_out[4], 0); - todo_wine { - ok(mem == mem_orig, "mem alloced\n"); - ok(my_alloc_called == 0, "alloc called %d\n", my_alloc_called); - } + ok(mem == mem_orig, "mem alloced\n"); +todo_wine + ok(my_alloc_called == 0, "alloc called %d\n", my_alloc_called); my_alloc_called = 0; mem = mem_orig;
1
0
0
0
Zebediah Figura : rpcrt4/tests: Add more tests for NdrPointerUnmarshall() and NdrPointerFree() on the server side.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 3efe54f66d888dd98b4980d0ebf20077e4d9664b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3efe54f66d888dd98b4980d0…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Oct 16 18:49:53 2018 -0500 rpcrt4/tests: Add more tests for NdrPointerUnmarshall() and NdrPointerFree() on the server side. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/rpcrt4/tests/ndr_marshall.c | 151 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index 2938b87..e4231ae 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -355,6 +355,157 @@ todo_wine { } } } + + /* Server */ + StubMsg.IsClient = 0; + + /* For most basetypes (but not enum16), memory will not be allocated but + * instead point directly to the buffer. */ + my_alloc_called = my_free_called = 0; + StubMsg.Buffer = StubMsg.BufferStart; + mem = NULL; + ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); + ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); + ok(!!mem, "%s: mem was not allocated\n", msgpfx); + ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx); + ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); + ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize); + if (formattypes[2] == FC_ENUM16) + ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + else +todo_wine_if(formattypes[1] & FC_POINTER_DEREF) + ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + ok(!my_free_called, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + NdrPointerFree(&StubMsg, mem, formattypes); + if (formattypes[2] == FC_ENUM16) + ok(my_free_called == 1, "%s: my_free got called %d times\n", msgpfx, my_free_called); + else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) + { + /* In theory this should be freed to correspond with the allocation, but + * FC_ALLOCED_ON_STACK is set, and NdrPointerFree() has no way of + * knowing that the memory allocated by NdrPointerUnmarshall() isn't + * stack memory. In practice it always *is* stack memory if ON_STACK is + * set, so this leak isn't a concern. */ +todo_wine + ok(my_free_called == 0, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, mem); + } + else +todo_wine_if((formattypes[1] & FC_POINTER_DEREF) && !(formattypes[1] & FC_ALLOCED_ON_STACK)) + ok(my_free_called == num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + /* reset the buffer and call with must alloc */ + my_alloc_called = my_free_called = 0; + StubMsg.Buffer = StubMsg.BufferStart; + mem = NULL; + ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 1 ); + ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); + ok(!!mem, "%s: mem was not allocated\n", msgpfx); + ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx); + ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); + ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize); + if (formattypes[2] == FC_ENUM16) + ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + else +todo_wine + ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + ok(!my_free_called, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + NdrPointerFree(&StubMsg, mem, formattypes); + if (formattypes[2] == FC_ENUM16) + ok(my_free_called == 1, "%s: my_free got called %d times\n", msgpfx, my_free_called); + else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) + { +todo_wine + ok(my_free_called == 0, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, mem); + } + else +todo_wine + ok(my_free_called == num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + /* Τest with an existing pointer. Unless it's a stack pointer (and deref'd) + * a new pointer will be allocated anyway (in fact, an invalid pointer works + * in every such case). */ + + my_alloc_called = my_free_called = 0; + StubMsg.Buffer = StubMsg.BufferStart; + mem_orig = mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + if (formattypes[1] & FC_POINTER_DEREF) + *(void**)mem = NULL; + ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); + ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); + if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) +todo_wine + ok(mem == mem_orig, "%s: mem has changed %p %p\n", msgpfx, mem, mem_orig); + else + ok(mem != mem_orig, "%s: mem has not changed\n", msgpfx); + ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx); + ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); + ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize); + if (formattypes[2] == FC_ENUM16) + ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) +todo_wine + ok(my_alloc_called == 0, "%s: my_alloc got called %d times\n", msgpfx, my_free_called); + else +todo_wine_if(formattypes[1] & FC_POINTER_DEREF) + ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + ok(!my_free_called, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + NdrPointerFree(&StubMsg, mem, formattypes); + if (formattypes[2] == FC_ENUM16) + ok(my_free_called == 1, "%s: my_free got called %d times\n", msgpfx, my_free_called); + else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) + { +todo_wine + ok(my_free_called == 0, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, mem); + } + else +todo_wine_if((formattypes[1] & FC_POINTER_DEREF) && !(formattypes[1] & FC_ALLOCED_ON_STACK)) + ok(my_free_called == num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + /* reset the buffer and call with must alloc */ + my_alloc_called = my_free_called = 0; + StubMsg.Buffer = StubMsg.BufferStart; + mem_orig = mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + if (formattypes[1] & FC_POINTER_DEREF) + *(void**)mem = NULL; + ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 1 ); + ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); + if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) +todo_wine + ok(mem == mem_orig, "%s: mem has changed %p %p\n", msgpfx, mem, mem_orig); + else + ok(mem != mem_orig, "%s: mem has not changed\n", msgpfx); + ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx); + ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); + ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize); + if (formattypes[2] == FC_ENUM16) + ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) +todo_wine + ok(my_alloc_called == 0, "%s: my_alloc got called %d times\n", msgpfx, my_free_called); + else +todo_wine + ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + ok(!my_free_called, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + NdrPointerFree(&StubMsg, mem, formattypes); + if (formattypes[2] == FC_ENUM16) + ok(my_free_called == 1, "%s: my_free got called %d times\n", msgpfx, my_free_called); + else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) + { +todo_wine + ok(my_free_called == 0, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, mem); + } + else +todo_wine + ok(my_free_called == num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, StubMsg.BufferStart); }
1
0
0
0
Zebediah Figura : rpcrt4/tests: Test that NdrPointerFree() doesn' t free stack pointers.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: f95777e134ce6a1e4fdc20151add7e94dc41656e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f95777e134ce6a1e4fdc2015…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Oct 16 18:49:52 2018 -0500 rpcrt4/tests: Test that NdrPointerFree() doesn't free stack pointers. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/rpcrt4/tests/ndr_marshall.c | 58 +++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index 586a7ef..2938b87 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -187,7 +187,6 @@ static void test_pointer_marshal(const unsigned char *formattypes, void *ptr; unsigned char *mem, *mem_orig; - my_alloc_called = my_free_called = 0; if(!cmp) cmp = memcmp; @@ -261,8 +260,10 @@ static void test_pointer_marshal(const unsigned char *formattypes, StubMsg.Buffer = StubMsg.BufferStart; StubMsg.MemorySize = 0; - mem_orig = mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - + /* Using my_alloc() here is necessary to prevent a crash in Windows 7+. */ + mem_orig = mem = my_alloc(size); + memset(mem, 0, size); + my_alloc_called = my_free_called = 0; if (formattypes[1] & FC_POINTER_DEREF) *(void**)mem = NULL; ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); @@ -271,11 +272,24 @@ static void test_pointer_marshal(const unsigned char *formattypes, ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx); ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize); - ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); - my_alloc_called = 0; + ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); + /* On Windows 7+ unmarshalling may involve calls to NdrFree, for unclear reasons. */ + my_free_called = 0; + + NdrPointerFree(&StubMsg, mem, formattypes); + if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) + { + /* In this case the top-level pointer is not freed. */ + ok(my_free_called == num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, mem); + } + else + ok(my_free_called == 1 + num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); /* reset the buffer and call with must alloc */ + my_alloc_called = my_free_called = 0; StubMsg.Buffer = StubMsg.BufferStart; + mem_orig = mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); if (formattypes[1] & FC_POINTER_DEREF) *(void**)mem = NULL; ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 1 ); @@ -291,11 +305,23 @@ todo_wine { todo_wine { ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); } - my_alloc_called = 0; + ok(!my_free_called, "%s: my_free got called %d times\n", msgpfx, my_free_called); + + NdrPointerFree(&StubMsg, mem, formattypes); + if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF)) + { + /* In this case the top-level pointer is not freed. */ + ok(my_free_called == num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + HeapFree(GetProcessHeap(), 0, mem); + } + else + ok(my_free_called == 1 + num_additional_allocs, "%s: my_free got called %d times\n", msgpfx, my_free_called); + if (formattypes[0] != FC_RP) { /* now pass the address of a NULL ptr */ mem = NULL; + my_alloc_called = my_free_called = 0; StubMsg.Buffer = StubMsg.BufferStart; ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); @@ -329,7 +355,6 @@ todo_wine { } } } - HeapFree(GetProcessHeap(), 0, mem_orig); HeapFree(GetProcessHeap(), 0, StubMsg.BufferStart); } @@ -381,15 +406,15 @@ static void test_simple_types(void) 0x2, /* FC_CHAR */ 0x5c, /* FC_PAD */ }; - static const unsigned char fmtstr_rpup_char[] = + static const unsigned char fmtstr_rpup_char_onstack_deref[] = { - 0x11, 0x14, /* FC_RP [alloced_on_stack] */ + 0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */ NdrFcShort( 0x2 ), /* Offset= 2 (4) */ 0x12, 0x8, /* FC_UP [simple_pointer] */ 0x2, /* FC_CHAR */ 0x5c, /* FC_PAD */ }; - static const unsigned char fmtstr_rpup_char2[] = + static const unsigned char fmtstr_rpup_char_onstack[] = { 0x11, 0x04, /* FC_RP [alloced_on_stack] */ NdrFcShort( 0x2 ), /* Offset= 2 (4) */ @@ -397,6 +422,14 @@ static void test_simple_types(void) 0x2, /* FC_CHAR */ 0x5c, /* FC_PAD */ }; + static const unsigned char fmtstr_rpup_char_deref[] = + { + 0x11, 0x10, /* FC_RP [pointer_deref] */ + NdrFcShort( 0x2 ), /* Offset= 2 (4) */ + 0x12, 0x8, /* FC_UP [simple_pointer] */ + 0x2, /* FC_CHAR */ + 0x5c, /* FC_PAD */ + }; static const unsigned char fmtstr_up_wchar[] = { @@ -481,8 +514,9 @@ static void test_simple_types(void) test_pointer_marshal(fmtstr_rp_char, ch_ptr, 1, &ch, 1, NULL, 0, "rp_char"); - test_pointer_marshal(fmtstr_rpup_char, &ch_ptr, 1, wiredata, 5, deref_cmp, 1, "rpup_char"); - test_pointer_marshal(fmtstr_rpup_char2, ch_ptr, 1, wiredata, 5, NULL, 0, "rpup_char2"); + test_pointer_marshal(fmtstr_rpup_char_onstack_deref, &ch_ptr, 1, wiredata, 5, deref_cmp, 1, "rpup_char_onstack_deref"); + test_pointer_marshal(fmtstr_rpup_char_onstack, ch_ptr, 1, wiredata, 5, NULL, 0, "rpup_char_onstack"); + test_pointer_marshal(fmtstr_rpup_char_deref, &ch_ptr, 1, wiredata, 5, deref_cmp, 1, "rpup_char_deref"); s = 0xa597; if (use_pointer_ids)
1
0
0
0
Zebediah Figura : rpcrt4/tests: Use publicly defined NDR constants.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 99672dbe9167bea9cf8bc6fa918f6c2583f8066d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=99672dbe9167bea9cf8bc6fa…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Oct 16 18:49:51 2018 -0500 rpcrt4/tests: Use publicly defined NDR constants. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/rpcrt4/tests/ndr_marshall.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index 21baba7..586a7ef 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -35,6 +35,7 @@ #include "rpcdce.h" #include "rpcproxy.h" #include "midles.h" +#include "ndrtypes.h" static int my_alloc_called; static int my_free_called; @@ -154,17 +155,17 @@ static void test_ndr_simple_type(void) StubMsg.BufferLength = 16; StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength); l = 0xcafebabe; - NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, 8 /* FC_LONG */); + NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, FC_LONG); ok(StubMsg.Buffer == StubMsg.BufferStart + 4, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart); ok(*(LONG*)StubMsg.BufferStart == l, "%d\n", *(LONG*)StubMsg.BufferStart); StubMsg.Buffer = StubMsg.BufferStart + 1; - NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, 8 /* FC_LONG */); + NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, FC_LONG); ok(StubMsg.Buffer == StubMsg.BufferStart + 8, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart); ok(*(LONG*)(StubMsg.BufferStart + 4) == l, "%d\n", *(LONG*)StubMsg.BufferStart); StubMsg.Buffer = StubMsg.BufferStart + 1; - NdrSimpleTypeUnmarshall(&StubMsg, (unsigned char*)&l2, 8 /* FC_LONG */); + NdrSimpleTypeUnmarshall(&StubMsg, (unsigned char*)&l2, FC_LONG); ok(StubMsg.Buffer == StubMsg.BufferStart + 8, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart); ok(l2 == l, "%d\n", l2); @@ -230,7 +231,7 @@ static void test_pointer_marshal(const unsigned char *formattypes, size = NdrPointerMemorySize( &StubMsg, formattypes ); ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size); ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); - if(formattypes[1] & 0x10 /* FC_POINTER_DEREF */) + if (formattypes[1] & FC_POINTER_DEREF) ok(size == srcsize + sizeof(void *), "%s: mem size %u\n", msgpfx, size); else ok(size == srcsize, "%s: mem size %u\n", msgpfx, size); @@ -240,7 +241,7 @@ static void test_pointer_marshal(const unsigned char *formattypes, size = NdrPointerMemorySize( &StubMsg, formattypes ); ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size); ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); - if(formattypes[1] & 0x10 /* FC_POINTER_DEREF */) + if (formattypes[1] & FC_POINTER_DEREF) ok(size == srcsize + sizeof(void *) + 16, "%s: mem size %u\n", msgpfx, size); else ok(size == srcsize + 16, "%s: mem size %u\n", msgpfx, size); @@ -250,19 +251,19 @@ static void test_pointer_marshal(const unsigned char *formattypes, size = NdrPointerMemorySize( &StubMsg, formattypes ); ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size); ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); - if(formattypes[1] & 0x10 /* FC_POINTER_DEREF */) + if (formattypes[1] & FC_POINTER_DEREF) ok(size == srcsize + sizeof(void *) + (srcsize == 8 ? 8 : sizeof(void *)), "%s: mem size %u\n", msgpfx, size); else ok(size == srcsize + (srcsize == 8 ? 8 : sizeof(void *)), "%s: mem size %u\n", msgpfx, size); size = srcsize; - if(formattypes[1] & 0x10) size += 4; + if (formattypes[1] & FC_POINTER_DEREF) size += 4; StubMsg.Buffer = StubMsg.BufferStart; StubMsg.MemorySize = 0; mem_orig = mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - if(formattypes[1] & 0x10 /* FC_POINTER_DEREF */) + if (formattypes[1] & FC_POINTER_DEREF) *(void**)mem = NULL; ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); @@ -275,7 +276,7 @@ static void test_pointer_marshal(const unsigned char *formattypes, /* reset the buffer and call with must alloc */ StubMsg.Buffer = StubMsg.BufferStart; - if(formattypes[1] & 0x10 /* FC_POINTER_DEREF */) + if (formattypes[1] & FC_POINTER_DEREF) *(void**)mem = NULL; ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 1 ); ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); @@ -291,7 +292,7 @@ todo_wine { ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); } my_alloc_called = 0; - if(formattypes[0] != 0x11 /* FC_RP */) + if (formattypes[0] != FC_RP) { /* now pass the address of a NULL ptr */ mem = NULL; @@ -314,14 +315,15 @@ todo_wine { StubMsg.IsClient = 0; ptr = NdrPointerUnmarshall( &StubMsg, &mem, formattypes, 0 ); ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr); - if (formattypes[2] == 0xd /* FC_ENUM16 */) + if (formattypes[2] == FC_ENUM16) ok(mem != StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem points to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart); else ok(mem == StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem doesn't point to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart); ok(!cmp(mem, memsrc, size), "%s: incorrectly unmarshaled\n", msgpfx); ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen); ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize); - if (formattypes[2] != 0xd /* FC_ENUM16 */) { + if (formattypes[2] != FC_ENUM16) + { ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); my_alloc_called = 0; }
1
0
0
0
Jacek Caban : server: Support NamedPipeState in FilePipeLocalInformation.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 68a32b8c8ec34dae99dca9091d1700be03979795 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=68a32b8c8ec34dae99dca909…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Oct 15 13:41:08 2018 +0200 server: Support NamedPipeState in FilePipeLocalInformation. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/pipe.c | 2 -- server/named_pipe.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c index dcd7c3c..e04672b 100644 --- a/dlls/ntdll/tests/pipe.c +++ b/dlls/ntdll/tests/pipe.c @@ -1415,7 +1415,6 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state) "NtQueryInformationFile(FilePipeLocalInformation) failed in %s state %u: %x\n", is_server ? "server" : "client", state, status); if (!status) - todo_wine ok(local_info.NamedPipeState == state, "%s NamedPipeState = %u, expected %u\n", is_server ? "server" : "client", local_info.NamedPipeState, state); @@ -1631,7 +1630,6 @@ static void test_pipe_local_info(HANDLE pipe, BOOL is_server, DWORD state) todo_wine ok(local_info.WriteQuotaAvailable == (is_server ? 200 : 100), "WriteQuotaAvailable = %u\n", local_info.WriteQuotaAvailable); - todo_wine ok(local_info.NamedPipeState == state, "%s NamedPipeState = %u, expected %u\n", is_server ? "server" : "client", local_info.NamedPipeState, state); ok(local_info.NamedPipeEnd == is_server, "NamedPipeEnd = %u\n", local_info.NamedPipeEnd); diff --git a/server/named_pipe.c b/server/named_pipe.c index dd2bd8c..3e0da4f 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -614,7 +614,7 @@ static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned pipe_info->ReadDataAvailable = 0; /* FIXME */ pipe_info->OutboundQuota = pipe->outsize; pipe_info->WriteQuotaAvailable = 0; /* FIXME */ - pipe_info->NamedPipeState = 0; /* FIXME */ + pipe_info->NamedPipeState = pipe_end->state; pipe_info->NamedPipeEnd = pipe_end->obj.ops == &pipe_server_ops ? FILE_PIPE_SERVER_END : FILE_PIPE_CLIENT_END; break;
1
0
0
0
Jacek Caban : server: Use pipe_end_get_file_info for FilePipeInformation implementation.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 5f43a1b93eb4aed84b8038e0bb42875fee9aef4a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5f43a1b93eb4aed84b8038e0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Oct 15 13:41:00 2018 +0200 server: Use pipe_end_get_file_info for FilePipeInformation implementation. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 20 +-------------- include/wine/server_protocol.h | 22 +---------------- server/named_pipe.c | 56 +++++++++++++++++------------------------- server/protocol.def | 12 --------- server/request.h | 11 --------- server/trace.c | 18 -------------- 6 files changed, 25 insertions(+), 114 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=5f43a1b93eb4aed84b80…
1
0
0
0
Jacek Caban : server: Use pipe_end_get_file_info for FilePipeLocalInformation implementation.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 36c6a16c6265a8ed1be9f6ca3103aa78c9013700 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=36c6a16c6265a8ed1be9f6ca…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Oct 15 13:40:36 2018 +0200 server: Use pipe_end_get_file_info for FilePipeLocalInformation implementation. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/file.c | 41 +++-------------------------------------- server/fd.c | 4 ++-- server/file.h | 4 ++-- server/named_pipe.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 51 insertions(+), 45 deletions(-) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index b2749a6..41e330d 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -2200,6 +2200,8 @@ static NTSTATUS server_get_file_info( HANDLE handle, IO_STATUS_BLOCK *io, void * io->Information = wine_server_reply_size( reply ); } SERVER_END_REQ; + if (io->u.Status == STATUS_OBJECT_TYPE_MISMATCH) + FIXME( "Unsupported info class %x\n", info_class ); return io->u.Status; } @@ -2310,7 +2312,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, if (len < info_sizes[class]) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH; - if (class != FilePipeInformation && class != FilePipeLocalInformation && class != FileAccessInformation) + if (class != FilePipeInformation && class != FileAccessInformation) { if ((io->u.Status = server_get_unix_fd( hFile, 0, &fd, &needs_close, NULL, NULL ))) { @@ -2458,43 +2460,6 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, SERVER_END_REQ; } break; - case FilePipeLocalInformation: - { - FILE_PIPE_LOCAL_INFORMATION* pli = ptr; - - SERVER_START_REQ( get_named_pipe_info ) - { - req->handle = wine_server_obj_handle( hFile ); - if (!(io->u.Status = wine_server_call( req ))) - { - pli->NamedPipeType = (reply->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) ? - FILE_PIPE_TYPE_MESSAGE : FILE_PIPE_TYPE_BYTE; - switch (reply->sharing) - { - case FILE_SHARE_READ: - pli->NamedPipeConfiguration = FILE_PIPE_OUTBOUND; - break; - case FILE_SHARE_WRITE: - pli->NamedPipeConfiguration = FILE_PIPE_INBOUND; - break; - case FILE_SHARE_READ | FILE_SHARE_WRITE: - pli->NamedPipeConfiguration = FILE_PIPE_FULL_DUPLEX; - break; - } - pli->MaximumInstances = reply->maxinstances; - pli->CurrentInstances = reply->instances; - pli->InboundQuota = reply->insize; - pli->ReadDataAvailable = 0; /* FIXME */ - pli->OutboundQuota = reply->outsize; - pli->WriteQuotaAvailable = 0; /* FIXME */ - pli->NamedPipeState = 0; /* FIXME */ - pli->NamedPipeEnd = (reply->flags & NAMED_PIPE_SERVER_END) ? - FILE_PIPE_SERVER_END : FILE_PIPE_CLIENT_END; - } - } - SERVER_END_REQ; - } - break; case FileNameInformation: { FILE_NAME_INFORMATION *info = ptr; diff --git a/server/fd.c b/server/fd.c index 6118f52..b26b111 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2170,7 +2170,7 @@ int no_fd_flush( struct fd *fd, struct async *async ) } /* default get_file_info() routine */ -void no_fd_get_file_info( struct fd *fd, unsigned int info_class ) +void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); } @@ -2391,7 +2391,7 @@ DECL_HANDLER(get_file_info) if (fd) { - fd->fd_ops->get_file_info( fd, req->info_class ); + fd->fd_ops->get_file_info( fd, req->handle, req->info_class ); release_object( fd ); } } diff --git a/server/file.h b/server/file.h index 8609db0..8a47333 100644 --- a/server/file.h +++ b/server/file.h @@ -63,7 +63,7 @@ struct fd_ops /* flush the object buffers */ int (*flush)(struct fd *, struct async *); /* query file info */ - void (*get_file_info)( struct fd *, unsigned int ); + void (*get_file_info)( struct fd *, obj_handle_t, unsigned int ); /* query volume info */ void (*get_volume_info)( struct fd *, unsigned int ); /* perform an ioctl on the file */ @@ -111,7 +111,7 @@ extern void fd_reselect_async( struct fd *fd, struct async_queue *queue ); extern int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); -extern void no_fd_get_file_info( struct fd *fd, unsigned int info_class ); +extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void no_fd_get_volume_info( struct fd *fd, unsigned int info_class ); extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); diff --git a/server/named_pipe.c b/server/named_pipe.c index ae2f2de..a2cc520 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -145,7 +145,7 @@ static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t p static int pipe_end_flush( struct fd *fd, struct async *async ); static void pipe_end_get_volume_info( struct fd *fd, unsigned int info_class ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); -static void pipe_end_get_file_info( struct fd *fd, unsigned int info_class ); +static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); /* server end functions */ static void pipe_server_dump( struct object *obj, int verbose ); @@ -509,7 +509,7 @@ static int pipe_end_flush( struct fd *fd, struct async *async ) return 1; } -static void pipe_end_get_file_info( struct fd *fd, unsigned int info_class ) +static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ) { struct pipe_end *pipe_end = get_fd_user( fd ); struct named_pipe *pipe = pipe_end->pipe; @@ -555,8 +555,49 @@ static void pipe_end_get_file_info( struct fd *fd, unsigned int info_class ) if (reply_size) memcpy( &name_info->FileName[1], name, reply_size ); break; } + case FilePipeLocalInformation: + { + FILE_PIPE_LOCAL_INFORMATION *pipe_info; + + if (!(get_handle_access( current->process, handle) & FILE_READ_ATTRIBUTES)) + { + set_error( STATUS_ACCESS_DENIED ); + return; + } + + if (get_reply_max_size() < sizeof(*pipe_info)) + { + set_error( STATUS_INFO_LENGTH_MISMATCH ); + return; + } + + if (!(pipe_info = set_reply_data_size( sizeof(*pipe_info) ))) return; + pipe_info->NamedPipeType = (pipe_end->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) != 0; + switch (pipe->sharing) + { + case FILE_SHARE_READ: + pipe_info->NamedPipeConfiguration = FILE_PIPE_OUTBOUND; + break; + case FILE_SHARE_WRITE: + pipe_info->NamedPipeConfiguration = FILE_PIPE_INBOUND; + break; + case FILE_SHARE_READ | FILE_SHARE_WRITE: + pipe_info->NamedPipeConfiguration = FILE_PIPE_FULL_DUPLEX; + break; + } + pipe_info->MaximumInstances = pipe->maxinstances; + pipe_info->CurrentInstances = pipe->instances; + pipe_info->InboundQuota = pipe->insize; + pipe_info->ReadDataAvailable = 0; /* FIXME */ + pipe_info->OutboundQuota = pipe->outsize; + pipe_info->WriteQuotaAvailable = 0; /* FIXME */ + pipe_info->NamedPipeState = 0; /* FIXME */ + pipe_info->NamedPipeEnd = pipe_end->obj.ops == &pipe_server_ops + ? FILE_PIPE_SERVER_END : FILE_PIPE_CLIENT_END; + break; + } default: - no_fd_get_file_info( fd, info_class ); + no_fd_get_file_info( fd, handle, info_class ); } }
1
0
0
0
Piotr Caban : wbemprox: Return NULL signature when there are no input parameters.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: wine Branch: master Commit: 91e4961d01ac250a717d67b2bff54c86734a6024 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=91e4961d01ac250a717d67b2…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Wed Oct 17 08:47:20 2018 +0200 wbemprox: Return NULL signature when there are no input parameters. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wbemprox/class.c | 14 +++++++++++--- dlls/wbemprox/tests/query.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index cc54fd5..983834d 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -839,6 +839,13 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di heap_free( query ); if (hr != S_OK) return hr; + if (!count_instances( iter )) + { + *sig = NULL; + IEnumWbemClassObject_Release( iter ); + return S_OK; + } + if (!(name = build_signature_table_name( class, method, dir ))) { IEnumWbemClassObject_Release( iter ); @@ -873,9 +880,9 @@ static HRESULT WINAPI class_object_GetMethod( if (hr == S_OK) { if (ppInSignature) *ppInSignature = in; - else IWbemClassObject_Release( in ); + else if (in) IWbemClassObject_Release( in ); if (ppOutSignature) *ppOutSignature = out; - else IWbemClassObject_Release( out ); + else if (out) IWbemClassObject_Release( out ); } else IWbemClassObject_Release( in ); return hr; @@ -939,7 +946,8 @@ static HRESULT WINAPI class_object_NextMethod( if (hr != S_OK) { SysFreeString( method ); - IWbemClassObject_Release( *ppInSignature ); + if (*ppInSignature) + IWbemClassObject_Release( *ppInSignature ); } else { diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 168c290..95690cf 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -415,7 +415,7 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) WBEM_FLAVOR_ORIGIN_PROPAGATED; WCHAR full_path[MAX_COMPUTERNAME_LENGTH + ARRAY_SIZE(full_path_fmt)]; BSTR class, method; - IWbemClassObject *process, *out; + IWbemClassObject *process, *sig_in, *out; IWbemQualifierSet *qualifiers; VARIANT user, domain, retval, val; DWORD full_path_len = 0; @@ -442,8 +442,10 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) win_skip( "Win32_Process not available\n" ); return; } - hr = IWbemClassObject_GetMethod( process, getownerW, 0, NULL, NULL ); + sig_in = (void*)0xdeadbeef; + hr = IWbemClassObject_GetMethod( process, getownerW, 0, &sig_in, NULL ); ok( hr == S_OK, "failed to get GetOwner method %08x\n", hr ); + ok( !sig_in, "sig_in != NULL\n"); IWbemClassObject_Release( process ); out = NULL;
1
0
0
0
Józef Kucia : vkd3d-shader: Add support for OpenGL atomic counters.
by Alexandre Julliard
17 Oct '18
17 Oct '18
Module: vkd3d Branch: master Commit: 170bb60baae7cd2e44236e0aebeaf6263d9444db URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=170bb60baae7cd2e44236e0…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Oct 17 17:59:36 2018 +0200 vkd3d-shader: Add support for OpenGL atomic counters. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/private/vkd3d_shader.h | 1 + libs/vkd3d-shader/spirv.c | 46 +++++++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/include/private/vkd3d_shader.h b/include/private/vkd3d_shader.h index 121fa75..f0ff82b 100644 --- a/include/private/vkd3d_shader.h +++ b/include/private/vkd3d_shader.h @@ -96,6 +96,7 @@ struct vkd3d_shader_uav_counter_binding unsigned int register_index; /* u# */ struct vkd3d_shader_descriptor_binding binding; + unsigned int offset; }; struct vkd3d_shader_push_constant_buffer diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index fce6e03..7cf58f8 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1988,6 +1988,11 @@ static enum vkd3d_shader_target vkd3d_dxbc_compiler_get_target(const struct vkd3 return args ? args->target : VKD3D_SHADER_TARGET_SPIRV_VULKAN_1_0; } +static bool vkd3d_dxbc_compiler_is_opengl_target(const struct vkd3d_dxbc_compiler *compiler) +{ + return vkd3d_dxbc_compiler_get_target(compiler) == VKD3D_SHADER_TARGET_SPIRV_OPENGL_4_5; +} + static bool vkd3d_dxbc_compiler_check_shader_visibility(const struct vkd3d_dxbc_compiler *compiler, enum vkd3d_shader_visibility visibility) { @@ -2062,6 +2067,9 @@ static struct vkd3d_shader_descriptor_binding vkd3d_dxbc_compiler_get_descriptor { const struct vkd3d_shader_uav_counter_binding *current = &shader_interface->uav_counters[i]; + if (current->offset) + FIXME("Atomic counter offsets are not supported yet.\n"); + /* FIXME: Implement shader visibility for UAV counters. */ if (current->register_index == reg_idx) return current->binding; @@ -3837,11 +3845,11 @@ static void vkd3d_dxbc_compiler_emit_resource_declaration(struct vkd3d_dxbc_comp const struct vkd3d_shader_register *reg, enum vkd3d_shader_resource_type resource_type, enum vkd3d_data_type resource_data_type, unsigned int structure_stride, bool raw) { - const SpvStorageClass storage_class = SpvStorageClassUniformConstant; + uint32_t counter_type_id, type_id, ptr_type_id, var_id, counter_var_id = 0; const struct vkd3d_shader_scan_info *scan_info = compiler->scan_info; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; + SpvStorageClass storage_class = SpvStorageClassUniformConstant; const struct vkd3d_spirv_resource_type *resource_type_info; - uint32_t type_id, ptr_type_id, var_id, counter_var_id = 0; enum vkd3d_component_type sampled_type; struct vkd3d_symbol resource_symbol; bool is_uav; @@ -3872,6 +3880,15 @@ static void vkd3d_dxbc_compiler_emit_resource_declaration(struct vkd3d_dxbc_comp if (is_uav && (scan_info->uav_counter_mask & (1u << reg->idx[0].offset))) { assert(structure_stride); /* counters are valid only for structured buffers */ + + if (vkd3d_dxbc_compiler_is_opengl_target(compiler)) + { + vkd3d_spirv_enable_capability(builder, SpvCapabilityAtomicStorage); + storage_class = SpvStorageClassAtomicCounter; + counter_type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_UINT, 1); + ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, counter_type_id); + } + counter_var_id = vkd3d_spirv_build_op_variable(builder, &builder->global_stream, ptr_type_id, storage_class, 0); @@ -5901,7 +5918,8 @@ static void vkd3d_dxbc_compiler_emit_uav_counter_instruction(struct vkd3d_dxbc_c struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; const struct vkd3d_shader_src_param *src = instruction->src; - uint32_t ptr_type_id, type_id, image_id, result_id; + unsigned int memory_semantics = SpvMemorySemanticsMaskNone; + uint32_t ptr_type_id, type_id, counter_id, result_id; uint32_t coordinate_id, sample_id, pointer_id; const struct vkd3d_symbol *resource_symbol; uint32_t operands[3]; @@ -5911,18 +5929,26 @@ static void vkd3d_dxbc_compiler_emit_uav_counter_instruction(struct vkd3d_dxbc_c ? SpvOpAtomicIIncrement : SpvOpAtomicIDecrement; resource_symbol = vkd3d_dxbc_compiler_find_resource(compiler, &src->reg); - image_id = resource_symbol->info.resource.uav_counter_id; - assert(image_id); + counter_id = resource_symbol->info.resource.uav_counter_id; + assert(counter_id); type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_UINT, 1); - ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassImage, type_id); - coordinate_id = sample_id = vkd3d_dxbc_compiler_get_constant_uint(compiler, 0); - pointer_id = vkd3d_spirv_build_op_image_texel_pointer(builder, - ptr_type_id, image_id, coordinate_id, sample_id); + if (vkd3d_dxbc_compiler_is_opengl_target(compiler)) + { + pointer_id = counter_id; + memory_semantics |= SpvMemorySemanticsAtomicCounterMemoryMask; + } + else + { + ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassImage, type_id); + coordinate_id = sample_id = vkd3d_dxbc_compiler_get_constant_uint(compiler, 0); + pointer_id = vkd3d_spirv_build_op_image_texel_pointer(builder, + ptr_type_id, counter_id, coordinate_id, sample_id); + } operands[0] = pointer_id; operands[1] = vkd3d_dxbc_compiler_get_constant_uint(compiler, SpvScopeDevice); - operands[2] = vkd3d_dxbc_compiler_get_constant_uint(compiler, SpvMemorySemanticsMaskNone); + operands[2] = vkd3d_dxbc_compiler_get_constant_uint(compiler, memory_semantics); result_id = vkd3d_spirv_build_op_trv(builder, &builder->function_stream, op, type_id, operands, ARRAY_SIZE(operands)); if (op == SpvOpAtomicIDecrement)
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200