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
March 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
2 participants
1138 discussions
Start a n
N
ew thread
Nikolay Sivov : mf/session: Trace seek position in Start().
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: 3f84ee1eb6637602e3e95fee20985444639b4602 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3f84ee1eb6637602e3e95fee…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Mar 28 14:57:04 2022 +0300 mf/session: Trace seek position in Start(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mf/mf_private.h | 34 ++++++++++++++++++++++++++++++++++ dlls/mf/session.c | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h index db6f101cd6d..6f28c93aea3 100644 --- a/dlls/mf/mf_private.h +++ b/dlls/mf/mf_private.h @@ -79,6 +79,40 @@ static inline const char *debugstr_time(LONGLONG time) return wine_dbg_sprintf("%s", rev); } +static inline const char *debugstr_propvar(const PROPVARIANT *v) +{ + if (!v) + return "(null)"; + + switch (v->vt) + { + case VT_EMPTY: + return wine_dbg_sprintf("%p {VT_EMPTY}", v); + case VT_NULL: + return wine_dbg_sprintf("%p {VT_NULL}", v); + case VT_UI4: + return wine_dbg_sprintf("%p {VT_UI4: %ld}", v, v->ulVal); + case VT_UI8: + return wine_dbg_sprintf("%p {VT_UI8: %s}", v, wine_dbgstr_longlong(v->uhVal.QuadPart)); + case VT_I8: + return wine_dbg_sprintf("%p {VT_I8: %s}", v, wine_dbgstr_longlong(v->hVal.QuadPart)); + case VT_R4: + return wine_dbg_sprintf("%p {VT_R4: %.8e}", v, v->fltVal); + case VT_R8: + return wine_dbg_sprintf("%p {VT_R8: %lf}", v, v->dblVal); + case VT_CLSID: + return wine_dbg_sprintf("%p {VT_CLSID: %s}", v, wine_dbgstr_guid(v->puuid)); + case VT_LPWSTR: + return wine_dbg_sprintf("%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(v->pwszVal)); + case VT_VECTOR | VT_UI1: + return wine_dbg_sprintf("%p {VT_VECTOR|VT_UI1: %p}", v, v->caub.pElems); + case VT_UNKNOWN: + return wine_dbg_sprintf("%p {VT_UNKNOWN: %p}", v, v->punkVal); + default: + return wine_dbg_sprintf("%p {vt %#x}", v, v->vt); + } +} + extern BOOL mf_is_sample_copier_transform(IMFTransform *transform) DECLSPEC_HIDDEN; extern BOOL mf_is_sar_sink(IMFMediaSink *sink) DECLSPEC_HIDDEN; extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) DECLSPEC_HIDDEN; diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 29dae316ce0..85cbcc29630 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -2009,7 +2009,7 @@ static HRESULT WINAPI mfsession_Start(IMFMediaSession *iface, const GUID *format struct session_op *op; HRESULT hr; - TRACE("%p, %s, %p.\n", iface, debugstr_guid(format), start_position); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(format), debugstr_propvar(start_position)); if (!start_position) return E_POINTER;
1
0
0
0
Nikolay Sivov : dbgeng: Use CRT allocation functions.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: adaa984b7bb78a6d31eba824e6a2dff153fd2cf9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=adaa984b7bb78a6d31eba824…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Mar 28 14:24:59 2022 +0300 dbgeng: Use CRT allocation functions. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbgeng/dbgeng.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/dlls/dbgeng/dbgeng.c b/dlls/dbgeng/dbgeng.c index 880b6f03b43..1439cedfeb3 100644 --- a/dlls/dbgeng/dbgeng.c +++ b/dlls/dbgeng/dbgeng.c @@ -31,7 +31,6 @@ #include "dbgeng.h" #include "wine/debug.h" -#include "wine/heap.h" #include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(dbgeng); @@ -149,12 +148,12 @@ static HRESULT debug_target_init_modules_info(struct target_process *target) count = needed / sizeof(HMODULE); - if (!(modules = heap_alloc(count * sizeof(*modules)))) + if (!(modules = calloc(count, sizeof(*modules)))) return E_OUTOFMEMORY; - if (!(target->modules.info = heap_alloc_zero(count * sizeof(*target->modules.info)))) + if (!(target->modules.info = calloc(count, sizeof(*target->modules.info)))) { - heap_free(modules); + free(modules); return E_OUTOFMEMORY; } @@ -179,7 +178,7 @@ static HRESULT debug_target_init_modules_info(struct target_process *target) target->cpu_type = debug_target_get_module_machine(target, modules[0]); - heap_free(modules); + free(modules); target->modules.loaded = count; target->modules.unloaded = 0; /* FIXME */ @@ -331,8 +330,8 @@ static ULONG STDMETHODCALLTYPE debugclient_AddRef(IDebugClient7 *iface) static void debug_target_free(struct target_process *target) { - heap_free(target->modules.info); - heap_free(target); + free(target->modules.info); + free(target); } static ULONG STDMETHODCALLTYPE debugclient_Release(IDebugClient7 *iface) @@ -353,7 +352,7 @@ static ULONG STDMETHODCALLTYPE debugclient_Release(IDebugClient7 *iface) } if (debug_client->event_callbacks) debug_client->event_callbacks->lpVtbl->Release(debug_client->event_callbacks); - heap_free(debug_client); + free(debug_client); } return refcount; @@ -443,7 +442,7 @@ static HRESULT STDMETHODCALLTYPE debugclient_AttachProcess(IDebugClient7 *iface, return E_NOTIMPL; } - if (!(process = heap_alloc_zero(sizeof(*process)))) + if (!(process = calloc(1, sizeof(*process)))) return E_OUTOFMEMORY; process->pid = pid; @@ -1900,7 +1899,7 @@ static HRESULT STDMETHODCALLTYPE debugsymbols_GetModuleVersionInformation(IDebug if (!(size = GetFileVersionInfoSizeA(info->image_name, &handle))) return E_FAIL; - if (!(version_info = heap_alloc(size))) + if (!(version_info = malloc(size))) return E_OUTOFMEMORY; if (GetFileVersionInfoA(info->image_name, handle, size, version_info)) @@ -1921,7 +1920,7 @@ static HRESULT STDMETHODCALLTYPE debugsymbols_GetModuleVersionInformation(IDebug } } - heap_free(version_info); + free(version_info); return hr; } @@ -4033,8 +4032,7 @@ HRESULT WINAPI DebugCreate(REFIID riid, void **obj) TRACE("%s, %p.\n", debugstr_guid(riid), obj); - debug_client = heap_alloc_zero(sizeof(*debug_client)); - if (!debug_client) + if (!(debug_client = calloc(1, sizeof(*debug_client)))) return E_OUTOFMEMORY; debug_client->IDebugClient_iface.lpVtbl = &debugclientvtbl;
1
0
0
0
Nikolay Sivov : browseui/tests: Remove string conversion helper.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: 7f96b7b1fd9ec12565ebe6c1dbd043869942675e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7f96b7b1fd9ec12565ebe6c1…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Mar 28 14:04:09 2022 +0300 browseui/tests: Remove string conversion helper. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/browseui/tests/autocomplete.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/dlls/browseui/tests/autocomplete.c b/dlls/browseui/tests/autocomplete.c index ff1033fc6ff..0c28a2a8cf8 100644 --- a/dlls/browseui/tests/autocomplete.c +++ b/dlls/browseui/tests/autocomplete.c @@ -37,14 +37,6 @@ ok(FALSE, #exp " failed: %#lx\n", res); \ } -static LPWSTR strdup_AtoW(LPCSTR str) -{ - int size = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - LPWSTR wstr = CoTaskMemAlloc((size + 1)*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, size+1); - return wstr; -} - typedef struct { IEnumString IEnumString_iface; @@ -54,7 +46,7 @@ typedef struct INT expcount; INT pos; INT limit; - const char **data; + const WCHAR **data; } TestACL; extern IEnumStringVtbl TestACLVtbl; @@ -70,7 +62,7 @@ static TestACL *impl_from_IACList(IACList *iface) return CONTAINING_RECORD(iface, TestACL, IACList_iface); } -static TestACL *TestACL_Constructor(int limit, const char **strings) +static TestACL *TestACL_Constructor(int limit, const WCHAR **strings) { TestACL *This = CoTaskMemAlloc(sizeof(TestACL)); ZeroMemory(This, sizeof(*This)); @@ -127,6 +119,7 @@ static HRESULT STDMETHODCALLTYPE TestACL_QueryInterface(IEnumString *iface, REFI static HRESULT STDMETHODCALLTYPE TestACL_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) { TestACL *This = impl_from_IEnumString(iface); + int size; ULONG i; trace("ACL(%p): read %ld item(s)\n", This, celt); @@ -134,7 +127,10 @@ static HRESULT STDMETHODCALLTYPE TestACL_Next(IEnumString *iface, ULONG celt, LP { if (This->pos >= This->limit) break; - rgelt[i] = strdup_AtoW(This->data[This->pos]); + + size = wcslen(This->data[This->pos]); + rgelt[i] = CoTaskMemAlloc((size + 1) * sizeof(WCHAR)); + wcscpy(rgelt[i], This->data[This->pos]); This->pos++; } @@ -222,8 +218,8 @@ IACListVtbl TestACL_ACListVtbl = static void test_ACLMulti(void) { - const char *strings1[] = {"a", "c", "e"}; - const char *strings2[] = {"a", "b", "d"}; + const WCHAR *strings1[] = { L"a", L"c", L"e" }; + const WCHAR *strings2[] = { L"a", L"b", L"d" }; const WCHAR exp[] = L"ABC"; IEnumString *obj; IEnumACString *unk;
1
0
0
0
Nikolay Sivov : browseui: Use CRT memory allocation functions.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: 6b5a5c6402334eacc1f2f315906bacf14f4f00a9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6b5a5c6402334eacc1f2f315…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Mar 28 14:04:08 2022 +0300 browseui: Use CRT memory allocation functions. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/browseui/aclmulti.c | 30 ++++++++++++------------------ dlls/browseui/aclsource.c | 13 ++----------- dlls/browseui/browseui_main.c | 5 ++--- dlls/browseui/compcatcachedaemon.c | 7 ++----- dlls/browseui/progressdlg.c | 38 +++++++++++++------------------------- 5 files changed, 31 insertions(+), 62 deletions(-) diff --git a/dlls/browseui/aclmulti.c b/dlls/browseui/aclmulti.c index a41cb810369..47547cdd1e1 100644 --- a/dlls/browseui/aclmulti.c +++ b/dlls/browseui/aclmulti.c @@ -34,8 +34,6 @@ #include "shlguid.h" #include "shlobj.h" -#include "wine/heap.h" - #include "browseui.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); @@ -80,17 +78,6 @@ static void release_obj(struct ACLMultiSublist *obj) IACList_Release(obj->pACL); } -static void ACLMulti_Destructor(ACLMulti *This) -{ - int i; - TRACE("destroying %p\n", This); - for (i = 0; i < This->nObjs; i++) - release_obj(&This->objs[i]); - heap_free(This->objs); - heap_free(This); - BROWSEUI_refCount--; -} - static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut) { ACLMulti *This = impl_from_IEnumString(iface); @@ -129,10 +116,18 @@ static ULONG WINAPI ACLMulti_Release(IEnumString *iface) { ACLMulti *This = impl_from_IEnumString(iface); ULONG ret; + int i; ret = InterlockedDecrement(&This->refCount); if (ret == 0) - ACLMulti_Destructor(This); + { + for (i = 0; i < This->nObjs; i++) + release_obj(&This->objs[i]); + free(This->objs); + free(This); + BROWSEUI_refCount--; + } + return ret; } @@ -224,7 +219,7 @@ static HRESULT WINAPI ACLMulti_Append(IObjMgr *iface, IUnknown *obj) if (obj == NULL) return E_FAIL; - This->objs = heap_realloc(This->objs, sizeof(This->objs[0]) * (This->nObjs+1)); + This->objs = realloc(This->objs, sizeof(This->objs[0]) * (This->nObjs+1)); This->objs[This->nObjs].punk = obj; IUnknown_AddRef(obj); if (FAILED(IUnknown_QueryInterface(obj, &IID_IEnumString, (LPVOID *)&This->objs[This->nObjs].pEnum))) @@ -247,7 +242,7 @@ static HRESULT WINAPI ACLMulti_Remove(IObjMgr *iface, IUnknown *obj) release_obj(&This->objs[i]); memmove(&This->objs[i], &This->objs[i+1], (This->nObjs-i-1)*sizeof(struct ACLMultiSublist)); This->nObjs--; - This->objs = heap_realloc(This->objs, sizeof(This->objs[0]) * This->nObjs); + This->objs = realloc(This->objs, sizeof(This->objs[0]) * This->nObjs); return S_OK; } @@ -313,8 +308,7 @@ HRESULT ACLMulti_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = heap_alloc_zero(sizeof(ACLMulti)); - if (This == NULL) + if (!(This = calloc(1, sizeof(ACLMulti)))) return E_OUTOFMEMORY; This->IEnumString_iface.lpVtbl = &ACLMultiVtbl; diff --git a/dlls/browseui/aclsource.c b/dlls/browseui/aclsource.c index 4412ca38003..72bf323c62e 100644 --- a/dlls/browseui/aclsource.c +++ b/dlls/browseui/aclsource.c @@ -34,8 +34,6 @@ #include "shlguid.h" #include "shlobj.h" -#include "wine/heap.h" - #include "browseui.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); @@ -57,12 +55,6 @@ static inline ACLShellSource *impl_from_IEnumString(IEnumString *iface) return CONTAINING_RECORD(iface, ACLShellSource, IEnumString_iface); } -static void ACLShellSource_Destructor(ACLShellSource *This) -{ - TRACE("destroying %p\n", This); - heap_free(This); -} - static HRESULT WINAPI ACLShellSource_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut) { ACLShellSource *This = impl_from_IEnumString(iface); @@ -106,7 +98,7 @@ static ULONG WINAPI ACLShellSource_Release(IEnumString *iface) TRACE("(%p)->(%lu)\n", This, ref); if (ref == 0) - ACLShellSource_Destructor(This); + free(This); return ref; } @@ -205,8 +197,7 @@ HRESULT ACLShellSource_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = heap_alloc_zero(sizeof(ACLShellSource)); - if (This == NULL) + if (!(This = calloc(1, sizeof(*This)))) return E_OUTOFMEMORY; This->IEnumString_iface.lpVtbl = &ACLShellSourceVtbl; diff --git a/dlls/browseui/browseui_main.c b/dlls/browseui/browseui_main.c index b6962b30f26..6d089725d3c 100644 --- a/dlls/browseui/browseui_main.c +++ b/dlls/browseui/browseui_main.c @@ -32,7 +32,6 @@ #include "shlguid.h" #include "rpcproxy.h" -#include "wine/heap.h" #include "browseui.h" #include "initguid.h" @@ -72,7 +71,7 @@ static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface) static void ClassFactory_Destructor(ClassFactory *This) { TRACE("Destroying class factory %p\n", This); - heap_free(This); + free(This); InterlockedDecrement(&BROWSEUI_refCount); } @@ -147,7 +146,7 @@ static const IClassFactoryVtbl ClassFactoryVtbl = { static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut) { - ClassFactory *This = heap_alloc(sizeof(ClassFactory)); + ClassFactory *This = malloc(sizeof(*This)); This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl; This->ref = 1; This->ctor = ctor; diff --git a/dlls/browseui/compcatcachedaemon.c b/dlls/browseui/compcatcachedaemon.c index 6de0d87ef38..f7a5e4b449f 100644 --- a/dlls/browseui/compcatcachedaemon.c +++ b/dlls/browseui/compcatcachedaemon.c @@ -34,8 +34,6 @@ #include "shlguid.h" #include "shlobj.h" -#include "wine/heap.h" - #include "browseui.h" #include "resids.h" @@ -57,7 +55,7 @@ static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This) TRACE("destroying %p\n", This); This->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->cs); - heap_free(This); + free(This); InterlockedDecrement(&BROWSEUI_refCount); } @@ -146,8 +144,7 @@ HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = heap_alloc(sizeof(CompCatCacheDaemon)); - if (This == NULL) + if (!(This = calloc(1, sizeof(*This)))) return E_OUTOFMEMORY; This->IRunnableTask_iface.lpVtbl = &CompCatCacheDaemonVtbl; diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c index dc0fe813f68..11a973034fa 100644 --- a/dlls/browseui/progressdlg.c +++ b/dlls/browseui/progressdlg.c @@ -34,8 +34,6 @@ #include "shlguid.h" #include "shlobj.h" -#include "wine/heap.h" - #include "browseui.h" #include "resids.h" @@ -88,17 +86,8 @@ static inline ProgressDialog *impl_from_IOleWindow(IOleWindow *iface) static void set_buffer(LPWSTR *buffer, LPCWSTR string) { - IMalloc *malloc; - ULONG cb; - - if (string == NULL) - string = L""; - CoGetMalloc(MEMCTX_TASK, &malloc); - - cb = (lstrlenW(string) + 1)*sizeof(WCHAR); - if (*buffer == NULL || cb > IMalloc_GetSize(malloc, *buffer)) - *buffer = IMalloc_Realloc(malloc, *buffer, cb); - memcpy(*buffer, string, cb); + free(*buffer); + *buffer = wcsdup(string ? string : L""); } struct create_params @@ -114,7 +103,7 @@ static LPWSTR load_string(HINSTANCE hInstance, UINT uiResourceId) LPWSTR ret; LoadStringW(hInstance, uiResourceId, string, ARRAY_SIZE(string)); - ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(string) + 1) * sizeof(WCHAR)); + ret = malloc((lstrlenW(string) + 1) * sizeof(WCHAR)); lstrcpyW(ret, string); return ret; } @@ -277,17 +266,17 @@ static void ProgressDialog_Destructor(ProgressDialog *This) TRACE("destroying %p\n", This); if (This->hwnd) end_dialog(This); - for (i = 0; i < 3; i++) - heap_free(This->lines[i]); - heap_free(This->cancelMsg); - heap_free(This->title); - for (i = 0; i < 2; i++) - heap_free(This->remainingMsg[i]); - for (i = 0; i < 3; i++) - heap_free(This->timeMsg[i]); + for (i = 0; i < ARRAY_SIZE(This->lines); i++) + free(This->lines[i]); + free(This->cancelMsg); + free(This->title); + for (i = 0; i < ARRAY_SIZE(This->remainingMsg); i++) + free(This->remainingMsg[i]); + for (i = 0; i < ARRAY_SIZE(This->timeMsg); i++) + free(This->timeMsg[i]); This->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->cs); - heap_free(This); + free(This); InterlockedDecrement(&BROWSEUI_refCount); } @@ -635,8 +624,7 @@ HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = heap_alloc_zero(sizeof(ProgressDialog)); - if (This == NULL) + if (!(This = calloc(1, sizeof(*This)))) return E_OUTOFMEMORY; This->IProgressDialog_iface.lpVtbl = &ProgressDialogVtbl;
1
0
0
0
Rémi Bernon : kernel32/tests: Remove GlobalMemoryStatus loop and relax the checks.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: 4d122a26e56a8160f81aba9887eac44919c14ab5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4d122a26e56a8160f81aba98…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Mar 28 12:56:34 2022 +0200 kernel32/tests: Remove GlobalMemoryStatus loop and relax the checks. The test is a bit too strict in some case on Windows, relaxing it like it was initially is probably fine now that the counters are correct. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 6efe4da4634..752cc71ac33 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -1232,21 +1232,17 @@ static void test_GlobalMemoryStatus(void) GlobalMemoryStatus( &mem ); ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() ); - do - { - status = NtQuerySystemInformation( SystemBasicInformation, &basic_info, sizeof(basic_info), NULL ); - ok( !status, "NtQuerySystemInformation returned %#lx\n", status ); - status = NtQuerySystemInformation( SystemPerformanceInformation, perf_info, sizeof(buffer), NULL ); - ok( !status, "NtQuerySystemInformation returned %#lx\n", status ); - status = NtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &vmc, sizeof(vmc), NULL ); - ok( !status, "NtQueryInformationProcess returned %#lx\n", status ); - mem.dwLength = sizeof(MEMORYSTATUS); - GlobalMemoryStatus( &mem ); - memex.dwLength = sizeof(MEMORYSTATUSEX); - ret = GlobalMemoryStatusEx( &memex ); - ok( ret, "GlobalMemoryStatusEx succeeded\n" ); - } while (memex.ullAvailPhys != (ULONGLONG)perf_info->AvailablePages * basic_info.PageSize || - mem.dwAvailPhys != min( ~(SIZE_T)0 >> 1, memex.ullAvailPhys )); + status = NtQuerySystemInformation( SystemBasicInformation, &basic_info, sizeof(basic_info), NULL ); + ok( !status, "NtQuerySystemInformation returned %#lx\n", status ); + status = NtQuerySystemInformation( SystemPerformanceInformation, perf_info, sizeof(buffer), NULL ); + ok( !status, "NtQuerySystemInformation returned %#lx\n", status ); + status = NtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &vmc, sizeof(vmc), NULL ); + ok( !status, "NtQueryInformationProcess returned %#lx\n", status ); + mem.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus( &mem ); + memex.dwLength = sizeof(MEMORYSTATUSEX); + ret = GlobalMemoryStatusEx( &memex ); + ok( ret, "GlobalMemoryStatusEx succeeded\n" ); ok( basic_info.PageSize, "got 0 PageSize\n" ); ok( basic_info.MmNumberOfPhysicalPages, "got 0 MmNumberOfPhysicalPages\n" ); @@ -1265,27 +1261,30 @@ static void test_GlobalMemoryStatus(void) expect.ullAvailVirtual = expect.ullTotalVirtual - (ULONGLONG)vmc.WorkingSetSize /* approximate */; expect.ullAvailExtendedVirtual = 0; +/* allow some variability, info sources are not always in sync */ +#define IS_WITHIN_RANGE(a, b) (((a) - (b) + (256 * basic_info.PageSize)) <= (512 * basic_info.PageSize)) + ok( memex.dwMemoryLoad == expect.dwMemoryLoad, "got dwMemoryLoad %lu\n", memex.dwMemoryLoad ); ok( memex.ullTotalPhys == expect.ullTotalPhys, "got ullTotalPhys %#I64x\n", memex.ullTotalPhys ); - ok( memex.ullAvailPhys == expect.ullAvailPhys, "got ullAvailPhys %#I64x\n", memex.ullAvailPhys ); + ok( IS_WITHIN_RANGE( memex.ullAvailPhys, expect.ullAvailPhys ), "got ullAvailPhys %#I64x\n", memex.ullAvailPhys ); ok( memex.ullTotalPageFile == expect.ullTotalPageFile, "got ullTotalPageFile %#I64x\n", memex.ullTotalPageFile ); - /* allow some variability, page file is not always in sync on Windows */ - ok( memex.ullAvailPageFile - expect.ullAvailPageFile + 32 * basic_info.PageSize <= 64 * basic_info.PageSize, - "got ullAvailPageFile %#I64x\n", memex.ullAvailPageFile ); + ok( IS_WITHIN_RANGE( memex.ullAvailPageFile, expect.ullAvailPageFile ), "got ullAvailPageFile %#I64x\n", memex.ullAvailPageFile ); ok( memex.ullTotalVirtual == expect.ullTotalVirtual, "got ullTotalVirtual %#I64x\n", memex.ullTotalVirtual ); ok( memex.ullAvailVirtual <= expect.ullAvailVirtual, "got ullAvailVirtual %#I64x\n", memex.ullAvailVirtual ); ok( memex.ullAvailExtendedVirtual == 0, "got ullAvailExtendedVirtual %#I64x\n", memex.ullAvailExtendedVirtual ); ok( mem.dwMemoryLoad == memex.dwMemoryLoad, "got dwMemoryLoad %lu\n", mem.dwMemoryLoad ); ok( mem.dwTotalPhys == min( ~(SIZE_T)0 >> 1, memex.ullTotalPhys ), "got dwTotalPhys %#Ix\n", mem.dwTotalPhys ); - ok( mem.dwAvailPhys == min( ~(SIZE_T)0 >> 1, memex.ullAvailPhys ), "got dwAvailPhys %#Ix\n", mem.dwAvailPhys ); + ok( IS_WITHIN_RANGE( mem.dwAvailPhys, min( ~(SIZE_T)0 >> 1, memex.ullAvailPhys ) ), "got dwAvailPhys %#Ix\n", mem.dwAvailPhys ); #ifndef _WIN64 todo_wine_if(memex.ullTotalPageFile > 0xfff7ffff) #endif ok( mem.dwTotalPageFile == min( ~(SIZE_T)0, memex.ullTotalPageFile ), "got dwTotalPageFile %#Ix\n", mem.dwTotalPageFile ); - ok( mem.dwAvailPageFile == min( ~(SIZE_T)0, memex.ullAvailPageFile ), "got dwAvailPageFile %#Ix\n", mem.dwAvailPageFile ); + ok( IS_WITHIN_RANGE( mem.dwAvailPageFile, min( ~(SIZE_T)0, memex.ullAvailPageFile ) ), "got dwAvailPageFile %#Ix\n", mem.dwAvailPageFile ); ok( mem.dwTotalVirtual == memex.ullTotalVirtual, "got dwTotalVirtual %#Ix\n", mem.dwTotalVirtual ); ok( mem.dwAvailVirtual == memex.ullAvailVirtual, "got dwAvailVirtual %#Ix\n", mem.dwAvailVirtual ); + +#undef IS_WITHIN_RANGE } START_TEST(heap)
1
0
0
0
Santino Mazza : ncrypt: Implement NCryptVerifySignature.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: 24914ab84bc4bfc27b0899b8311d590fc76d337a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=24914ab84bc4bfc27b0899b8…
Author: Santino Mazza <mazzasantino1206(a)gmail.com> Date: Mon Mar 28 11:52:03 2022 +0200 ncrypt: Implement NCryptVerifySignature. Signed-off-by: Santino Mazza <mazzasantino1206(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ncrypt/main.c | 25 +++++++++++++++++++++---- dlls/ncrypt/tests/ncrypt.c | 8 +++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c index f8fb3135f56..cc979a539d2 100644 --- a/dlls/ncrypt/main.c +++ b/dlls/ncrypt/main.c @@ -36,8 +36,11 @@ static SECURITY_STATUS map_ntstatus(NTSTATUS status) { switch (status) { - case STATUS_INVALID_HANDLE: return NTE_INVALID_HANDLE; - case NTE_BAD_DATA: return NTE_BAD_DATA; + case STATUS_INVALID_HANDLE: return NTE_INVALID_HANDLE; + case STATUS_INVALID_SIGNATURE: return NTE_BAD_SIGNATURE; + case STATUS_SUCCESS: return ERROR_SUCCESS; + case STATUS_INVALID_PARAMETER: return NTE_INVALID_PARAMETER; + case NTE_BAD_DATA: return NTE_BAD_DATA; default: FIXME("unhandled status %#lx\n", status); return NTE_INTERNAL_ERROR; @@ -458,7 +461,21 @@ SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE handle, const WCHAR *name SECURITY_STATUS WINAPI NCryptVerifySignature(NCRYPT_KEY_HANDLE handle, void *padding, BYTE *hash, DWORD hash_size, BYTE *signature, DWORD signature_size, DWORD flags) { - FIXME("(%#Ix, %p, %p, %lu, %p, %lu, %#lx): stub\n", handle, padding, hash, hash_size, signature, + struct object *key_object = (struct object *)handle; + + TRACE("(%#Ix, %p, %p, %lu, %p, %lu, %#lx)\n", handle, padding, hash, hash_size, signature, signature_size, flags); - return ERROR_SUCCESS; + + if (!hash_size || !signature_size) return NTE_INVALID_PARAMETER; + if (!hash || !signature) return HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER); + if (!handle || key_object->type != KEY) return NTE_INVALID_HANDLE; + + if (key_object->key.algid < RSA) + { + FIXME("Symmetric keys not supported.\n"); + return NTE_NOT_SUPPORTED; + } + + return map_ntstatus(BCryptVerifySignature(key_object->key.bcrypt_key, padding, hash, hash_size, signature, + signature_size, flags)); } diff --git a/dlls/ncrypt/tests/ncrypt.c b/dlls/ncrypt/tests/ncrypt.c index e8de441876b..7fb8b2cb4c5 100644 --- a/dlls/ncrypt/tests/ncrypt.c +++ b/dlls/ncrypt/tests/ncrypt.c @@ -428,7 +428,6 @@ static void test_verify_signature(void) sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); - todo_wine { ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), invalid_signature, sizeof(invalid_signature), NCRYPT_PAD_PKCS1_FLAG); ok(ret == NTE_BAD_SIGNATURE, "got %#lx\n", ret); @@ -447,7 +446,7 @@ static void test_verify_signature(void) ret = NCryptVerifySignature(key, &padinfo, sha256_hash, 4, signature_pkcs1_sha256, sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); - ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); + todo_wine ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), NULL, sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); @@ -455,13 +454,12 @@ static void test_verify_signature(void) ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, 4, NCRYPT_PAD_PKCS1_FLAG); - ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); + todo_wine ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); invalid_padinfo.pszAlgId = BCRYPT_MD5_ALGORITHM; ret = NCryptVerifySignature(key, &invalid_padinfo, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); - ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); - } + todo_wine ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); NCryptFreeObject(key); NCryptFreeObject(prov);
1
0
0
0
Santino Mazza : ncrypt/tests: Test for NCryptVerifySignature.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: c20a3d8e23ba177fc7b4cac7985905cc05eea6b3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c20a3d8e23ba177fc7b4cac7…
Author: Santino Mazza <mazzasantino1206(a)gmail.com> Date: Mon Mar 28 11:52:02 2022 +0200 ncrypt/tests: Test for NCryptVerifySignature. Signed-off-by: Santino Mazza <mazzasantino1206(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ncrypt/tests/ncrypt.c | 138 +++++++++++++++++++++++++++++++++++++++++++++ include/ncrypt.h | 6 ++ 2 files changed, 144 insertions(+) diff --git a/dlls/ncrypt/tests/ncrypt.c b/dlls/ncrypt/tests/ncrypt.c index fc951fef80a..e8de441876b 100644 --- a/dlls/ncrypt/tests/ncrypt.c +++ b/dlls/ncrypt/tests/ncrypt.c @@ -330,6 +330,143 @@ static void test_finalize_key(void) NCryptFreeObject(key); } +static UCHAR signature_pubkey_blob[] = { + 0x52, 0x53, 0x41, 0x31, 0x00, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0xb4, 0xdb, 0x15, 0x24, 0xd0, 0x9a, 0xf4, 0xa3, 0x22, + 0x04, 0xbe, 0xbd, 0xda, 0xb4, 0x3b, 0x1f, 0x9d, 0x5f, 0x2a, 0x3e, 0xe7, + 0x42, 0xd7, 0xfa, 0xbc, 0xeb, 0x4e, 0xba, 0xcf, 0x92, 0x5d, 0x42, 0x0e, + 0xc0, 0xb0, 0x0f, 0xcc, 0xc3, 0x03, 0x69, 0x23, 0xb9, 0xc2, 0x07, 0xf7, + 0xf5, 0x19, 0xef, 0x9f, 0xb6, 0xd4, 0x6d, 0x35, 0x0d, 0x4c, 0x3a, 0x2b, + 0x37, 0x9d, 0x4d, 0x61, 0xce, 0x30, 0x33, 0x27, 0xe4, 0x9a, 0xca, 0x23, + 0xd6, 0x8f, 0x90, 0x33, 0xba, 0x5b, 0x16, 0xab, 0xa6, 0xda, 0x7a, 0x16, + 0x8e, 0xae, 0xf9, 0x6f, 0x29, 0xe2, 0xf1, 0x3d, 0xf0, 0xb6, 0xb4, 0x70, + 0xc0, 0x6d, 0xfc, 0x73, 0xf1, 0x3e, 0xdf, 0x02, 0x2c, 0xab, 0x24, 0x7a, + 0xd8, 0x8b, 0xcf, 0x63, 0xd0, 0x1a, 0x76, 0xb3, 0x11, 0x22, 0x5d, 0xf6, + 0x72, 0xb5, 0xd1, 0x6b, 0x83, 0xcd, 0x63, 0x5d, 0x3d, 0x03, 0xa2, 0xe0, + 0x36, 0xe8, 0x54, 0xe9, 0x6f, 0x04, 0xb3, 0x1a, 0xdf, 0x35, 0xd7, 0x01, + 0x57, 0xc7, 0x8d, 0x81, 0x4b, 0x39, 0x0c, 0x92, 0x71, 0x0b, 0x7d, 0x05, + 0xb4, 0xa4, 0xb4, 0xd4, 0x73, 0x55, 0x85, 0x19, 0xd5, 0x37, 0x7f, 0xcd, + 0x81, 0xd3, 0xf2, 0x62, 0x60, 0xfb, 0x6a, 0x1a, 0xda, 0xb4, 0x83, 0xfa, + 0x87, 0xac, 0x51, 0x3a, 0xb4, 0xc2, 0x03, 0xd3, 0xc6, 0xf0, 0x20, 0xca, + 0x10, 0xfd, 0xeb, 0xd8, 0x85, 0xb9, 0x74, 0x29, 0x83, 0xda, 0xa2, 0xee, + 0xcc, 0xf4, 0xf6, 0x18, 0xbc, 0x84, 0x92, 0xf5, 0xdb, 0x71, 0x14, 0xb9, + 0x62, 0x54, 0x4b, 0x64, 0x58, 0x95, 0xbc, 0x69, 0xc1, 0xcd, 0xac, 0x4b, + 0x7c, 0x1d, 0xc4, 0xe7, 0x6c, 0x44, 0x80, 0x5e, 0x88, 0x3a, 0x9c, 0xbd, + 0xd5, 0xa5, 0x2f, 0xa6, 0x73, 0x65, 0x48, 0x00, 0x5e, 0xfd, 0xe9, 0x4e, + 0xd7, 0x6c, 0x59, 0x47, 0x9b, 0xd1, 0x9d}; + +static UCHAR signature_pkcs1_sha256[] = { + 0xad, 0x3d, 0x2f, 0x31, 0x87, 0xba, 0x5b, 0xdc, 0x84, 0x95, 0x77, 0x68, + 0xf9, 0x9c, 0xd2, 0x38, 0x5b, 0x9f, 0x09, 0xc3, 0x8e, 0x9e, 0x8e, 0x8d, + 0x49, 0x56, 0x31, 0x09, 0x55, 0xc6, 0xd2, 0x1a, 0xb3, 0x00, 0x71, 0x60, + 0x84, 0x38, 0xf7, 0x1b, 0xc0, 0x43, 0x87, 0x31, 0x2d, 0xcc, 0xf2, 0x49, + 0x5f, 0x21, 0x8e, 0x77, 0x16, 0x57, 0xd7, 0xe9, 0x37, 0x3a, 0xe9, 0x91, + 0x5b, 0xc5, 0xea, 0x34, 0xb5, 0xf7, 0x4d, 0xaa, 0x65, 0x06, 0xef, 0xc6, + 0x14, 0xfa, 0xa7, 0x1e, 0xe5, 0xc6, 0x18, 0xfe, 0x06, 0x64, 0xe7, 0x6e, + 0x11, 0x83, 0x03, 0x4c, 0x91, 0x47, 0x60, 0x88, 0x12, 0x0c, 0x5e, 0xcc, + 0x3a, 0x93, 0x2f, 0x5c, 0x57, 0x5b, 0x66, 0x55, 0xa3, 0xe5, 0xf4, 0x3c, + 0x6f, 0xe9, 0xd8, 0xfd, 0xcc, 0x19, 0xc8, 0xf8, 0x13, 0x21, 0x3d, 0x29, + 0xee, 0x3c, 0xb2, 0xb4, 0x3f, 0x36, 0xd8, 0x82, 0xb1, 0xa9, 0x34, 0x89, + 0x2a, 0x7a, 0x42, 0x4a, 0x13, 0x0a, 0x0b, 0x50, 0xbe, 0x43, 0xa8, 0x2c, + 0x5a, 0x86, 0x65, 0x9f, 0xab, 0x86, 0x25, 0x44, 0xbb, 0x6b, 0xca, 0x04, + 0xca, 0xa5, 0xe7, 0x8e, 0xe2, 0x1d, 0xa8, 0x31, 0x90, 0x85, 0x6a, 0xd9, + 0xaf, 0x67, 0x8c, 0x1a, 0x13, 0xea, 0xa8, 0xfd, 0x3d, 0xc0, 0xb0, 0x3f, + 0xde, 0x6a, 0xc9, 0x65, 0xeb, 0x0a, 0xa6, 0x9b, 0xfc, 0x97, 0x0a, 0x72, + 0xaf, 0x04, 0xde, 0x3f, 0xcb, 0xac, 0x97, 0x6e, 0xfa, 0xbb, 0xd8, 0x6e, + 0xad, 0x0d, 0x10, 0xc6, 0x34, 0x18, 0x50, 0xb9, 0x12, 0xd4, 0x6b, 0xd5, + 0x3d, 0x9d, 0xfb, 0x31, 0x8d, 0x96, 0x39, 0x4d, 0x20, 0x91, 0x40, 0x06, + 0xca, 0xe6, 0x33, 0x73, 0x76, 0x2a, 0xe3, 0xab, 0xaf, 0x9d, 0xe9, 0x4e, + 0xb7, 0xe0, 0x4b, 0x45, 0x23, 0x07, 0xe9, 0xe2, 0xab, 0xdc, 0x9f, 0x5a, + 0xed, 0xbe, 0x76, 0x27}; + +static UCHAR invalid_signature[] = { + 0x4f, 0x8f, 0x88, 0x43, 0xed, 0x9e, 0xe8, 0x75, 0x0f, 0xe7, 0x32, 0xab, + 0x07, 0xcc, 0x6c, 0x8d, 0x56, 0xaa, 0x78, 0xf8, 0x43, 0x62, 0x4c, 0x0c, + 0xd5, 0x45, 0x2c, 0x3d, 0x28, 0x6f, 0xbc, 0x8b, 0xc1, 0x9f, 0xfe, 0x33, + 0x50, 0x4e, 0xd0, 0x6a, 0x83, 0xf8, 0x0e, 0xc8, 0x19, 0x59, 0xde, 0x25, + 0xf0, 0x7b, 0x4e, 0x3d, 0x9d, 0xc7, 0xbf, 0x72, 0xc3, 0x26, 0x48, 0xb6, + 0x19, 0x08, 0x3f, 0x05, 0xe8, 0x76, 0x2c, 0x11, 0x49, 0xfb, 0xa1, 0xc0, + 0xae, 0x6e, 0x30, 0xf8, 0x10, 0x61, 0x9f, 0x53, 0xc6, 0xeb, 0x7c, 0x7c, + 0x94, 0x5f, 0xca, 0xe5, 0x41, 0x40, 0xd6, 0x83, 0xa8, 0x4a, 0x45, 0x5c, + 0x77, 0x69, 0xf2, 0x89, 0xe9, 0xf7, 0x81, 0xa1, 0xae, 0x77, 0xf5, 0xec, + 0x41, 0x4b, 0xfc, 0x82, 0x7f, 0xee, 0x4e, 0x5b, 0x43, 0xdd, 0xcc, 0xe8, + 0x90, 0x12, 0xf0, 0x9a, 0xd0, 0xbc, 0x56, 0xd8, 0xeb, 0xd6, 0xfc, 0x80, + 0x48, 0x26, 0x8c, 0x63, 0x5c, 0x55, 0xd9, 0x6c, 0xb5, 0x10, 0xc1, 0xab, + 0x98, 0x3c, 0xe1, 0x25, 0x13, 0x4e, 0xc2, 0xdc, 0xd5, 0x4a, 0x25, 0xe5, + 0xc7, 0x9f, 0xfc, 0xf8, 0x53, 0x53, 0x12, 0x4c, 0xc1, 0x6c, 0x67, 0xa9, + 0x9e, 0x6e, 0x88, 0x2e, 0x93, 0xa3, 0x3f, 0x2d, 0xd3, 0xc5, 0xf4, 0x25, + 0xe2, 0x0f, 0x8f, 0xc0, 0x2b, 0x30, 0x94, 0x9d, 0xc0, 0x09, 0x31, 0x6c, + 0x19, 0xf7, 0x2e, 0x72, 0x6b, 0xb3, 0xf6, 0x78, 0x91, 0xca, 0x95, 0x28, + 0x9f, 0xf6, 0xd0, 0x77, 0x1c, 0x73, 0xff, 0x30, 0xe7, 0x02, 0xc3, 0xc8, + 0x0e, 0x95, 0x4f, 0x02, 0x96, 0xc5, 0xa9, 0x02, 0xb8, 0xaa, 0x97, 0xac, + 0x37, 0x47, 0xa9, 0x6d, 0xcb, 0x25, 0xb3, 0x8d, 0x20, 0xc5, 0xb6, 0x49, + 0xd8, 0xaf, 0x1a, 0xad, 0x62, 0x8c, 0x79, 0x60, 0x73, 0x8d, 0x46, 0x1e, + 0xe5, 0x23, 0x39, 0x44}; + +static UCHAR sha256_hash[] = { + 0x27, 0x51, 0x8b, 0xa9, 0x68, 0x30, 0x11, 0xf6, 0xb3, 0x96, 0x07, 0x2c, + 0x05, 0xf6, 0x65, 0x6d, 0x04, 0xf5, 0xfb, 0xc3, 0x78, 0x7c, 0xf9, 0x24, + 0x90, 0xec, 0x60, 0x6e, 0x50, 0x92, 0xe3, 0x26}; + +static void test_verify_signature(void) +{ + NCRYPT_PROV_HANDLE prov; + NCRYPT_KEY_HANDLE key; + BCRYPT_PKCS1_PADDING_INFO padinfo, invalid_padinfo; + SECURITY_STATUS ret; + + ret = NCryptOpenStorageProvider(&prov, NULL, 0); + ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); + + ret = NCryptImportKey(prov, 0, BCRYPT_PUBLIC_KEY_BLOB, NULL, &key, signature_pubkey_blob, + sizeof(signature_pubkey_blob), 0); + ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); + + padinfo.pszAlgId = BCRYPT_SHA256_ALGORITHM; + ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, + sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == ERROR_SUCCESS, "got %#lx\n", ret); + + todo_wine { + ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), invalid_signature, + sizeof(invalid_signature), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == NTE_BAD_SIGNATURE, "got %#lx\n", ret); + + ret = NCryptVerifySignature(key, NULL, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, + sizeof(signature_pkcs1_sha256), 0); + ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); + + ret = NCryptVerifySignature(0, &padinfo, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, + sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == NTE_INVALID_HANDLE, "got %#lx\n", ret); + + ret = NCryptVerifySignature(key, &padinfo, NULL, sizeof(sha256_hash), signature_pkcs1_sha256, + sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER) || broken(ret == NTE_FAIL) /* win7 */, "got %#lx\n", ret); + + ret = NCryptVerifySignature(key, &padinfo, sha256_hash, 4, signature_pkcs1_sha256, + sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); + + ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), NULL, + sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER) || broken(ret == NTE_FAIL) /* win7 */, "got %#lx\n", ret); + + ret = NCryptVerifySignature(key, &padinfo, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, 4, + NCRYPT_PAD_PKCS1_FLAG); + ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); + + invalid_padinfo.pszAlgId = BCRYPT_MD5_ALGORITHM; + ret = NCryptVerifySignature(key, &invalid_padinfo, sha256_hash, sizeof(sha256_hash), signature_pkcs1_sha256, + sizeof(signature_pkcs1_sha256), NCRYPT_PAD_PKCS1_FLAG); + ok(ret == NTE_INVALID_PARAMETER, "got %#lx\n", ret); + } + + NCryptFreeObject(key); + NCryptFreeObject(prov); +} + START_TEST(ncrypt) { test_key_import_rsa(); @@ -338,4 +475,5 @@ START_TEST(ncrypt) test_set_property(); test_create_persisted_key(); test_finalize_key(); + test_verify_signature(); } diff --git a/include/ncrypt.h b/include/ncrypt.h index f7372b30621..c09a1ec8676 100644 --- a/include/ncrypt.h +++ b/include/ncrypt.h @@ -71,6 +71,11 @@ typedef ULONG_PTR NCRYPT_SECRET_HANDLE; #define NCRYPT_SILENT_FLAG 0x00000040 +#define NCRYPT_NO_PADDING_FLAG 0x00000001 +#define NCRYPT_PAD_PKCS1_FLAG 0x00000002 +#define NCRYPT_PAD_OAEP_FLAG 0x00000004 +#define NCRYPT_PAD_PSS_FLAG 0x00000008 + #define NCRYPT_NAME_PROPERTY L"Name" #define NCRYPT_UNIQUE_NAME_PROPERTY L"Unique Name" #define NCRYPT_ALGORITHM_PROPERTY L"Algorithm Name" @@ -116,6 +121,7 @@ SECURITY_STATUS WINAPI NCryptImportKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE, co SECURITY_STATUS WINAPI NCryptOpenKey(NCRYPT_PROV_HANDLE, NCRYPT_KEY_HANDLE *, const WCHAR *, DWORD, DWORD); SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *, const WCHAR *, DWORD); SECURITY_STATUS WINAPI NCryptSetProperty(NCRYPT_HANDLE, const WCHAR *, BYTE *, DWORD, DWORD); +SECURITY_STATUS WINAPI NCryptVerifySignature(NCRYPT_KEY_HANDLE, void *, BYTE *, DWORD, BYTE *, DWORD, DWORD); #ifdef __cplusplus }
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement LOCALE_*MONTHNAME in GetLocaleInfoW/Ex using the locale.nls data.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: ff323aeb6586ed030fa3523f1fd3d95d2ee397c6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ff323aeb6586ed030fa3523f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 28 13:27:02 2022 +0200 kernelbase: Reimplement LOCALE_*MONTHNAME in GetLocaleInfoW/Ex using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 58 ++++++++++-------------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 6e7a277ba07..4b205aed9af 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -1064,7 +1064,9 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ case LOCALE_SMONTHNAME10: case LOCALE_SMONTHNAME11: case LOCALE_SMONTHNAME12: - return -1; + return locale_return_strarray( ((type & LOCALE_RETURN_GENITIVE_NAMES) && locale->sgenitivemonth) ? + locale->sgenitivemonth : locale->smonthname, + type - LOCALE_SMONTHNAME1, type, buffer, len ); case LOCALE_SABBREVMONTHNAME1: case LOCALE_SABBREVMONTHNAME2: @@ -1078,7 +1080,9 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ case LOCALE_SABBREVMONTHNAME10: case LOCALE_SABBREVMONTHNAME11: case LOCALE_SABBREVMONTHNAME12: - return -1; + return locale_return_strarray( ((type & LOCALE_RETURN_GENITIVE_NAMES) && locale->sabbrevgenitivemonth) ? + locale->sabbrevgenitivemonth : locale->sabbrevmonthname, + type - LOCALE_SABBREVMONTHNAME1, type, buffer, len ); case LOCALE_SPOSITIVESIGN: return -1; @@ -1257,10 +1261,14 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ return -1; case LOCALE_SMONTHNAME13: - return -1; + return locale_return_strarray( ((type & LOCALE_RETURN_GENITIVE_NAMES) && locale->sgenitivemonth) ? + locale->sgenitivemonth : locale->smonthname, + 12, type, buffer, len ); case LOCALE_SABBREVMONTHNAME13: - return -1; + return locale_return_strarray( ((type & LOCALE_RETURN_GENITIVE_NAMES) && locale->sabbrevgenitivemonth) ? + locale->sabbrevgenitivemonth : locale->sabbrevmonthname, + 12, type, buffer, len ); case LOCALE_INEGNUMBER: return -1; @@ -1517,30 +1525,6 @@ static UINT get_lcid_codepage( LCID lcid, ULONG flags ) } -static BOOL is_genitive_name_supported( LCTYPE lctype ) -{ - switch (LOWORD(lctype)) - { - case LOCALE_SMONTHNAME1: - case LOCALE_SMONTHNAME2: - case LOCALE_SMONTHNAME3: - case LOCALE_SMONTHNAME4: - case LOCALE_SMONTHNAME5: - case LOCALE_SMONTHNAME6: - case LOCALE_SMONTHNAME7: - case LOCALE_SMONTHNAME8: - case LOCALE_SMONTHNAME9: - case LOCALE_SMONTHNAME10: - case LOCALE_SMONTHNAME11: - case LOCALE_SMONTHNAME12: - case LOCALE_SMONTHNAME13: - return TRUE; - default: - return FALSE; - } -} - - static int get_value_base_by_lctype( LCTYPE lctype ) { return lctype == LOCALE_ILANGUAGE || lctype == LOCALE_IDEFAULTLANGUAGE ? 16 : 10; @@ -4936,12 +4920,6 @@ INT WINAPI DECLSPEC_HOTPATCH GetLocaleInfoW( LCID lcid, LCTYPE lctype, WCHAR *bu ret = get_locale_info( locale, lcid, lctype, buffer, len ); if (ret != -1) return ret; - if (lctype & LOCALE_RETURN_GENITIVE_NAMES && !is_genitive_name_supported( lctype )) - { - SetLastError( ERROR_INVALID_FLAGS ); - return 0; - } - if (!len) buffer = NULL; lcid = ConvertDefaultLocale( lcid ); @@ -5000,18 +4978,6 @@ INT WINAPI DECLSPEC_HOTPATCH GetLocaleInfoW( LCID lcid, LCTYPE lctype, WCHAR *bu for (i = 0; i < (lctype & 0x0f); i++) p += *p + 1; if (lcflags & LOCALE_RETURN_NUMBER) ret = sizeof(UINT) / sizeof(WCHAR); - else if (is_genitive_name_supported( lctype ) && *p) - { - /* genitive form is stored after a null separator from a nominative */ - for (i = 1; i <= *p; i++) if (!p[i]) break; - - if (i <= *p && (lcflags & LOCALE_RETURN_GENITIVE_NAMES)) - { - ret = *p - i + 1; - p += i; - } - else ret = i; - } else ret = (lctype == LOCALE_FONTSIGNATURE) ? *p : *p + 1;
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement LOCALE_*DAYNAME in GetLocaleInfoW/Ex using the locale.nls data.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: 5bf289ea37cc22309b9bb47b016195d5e12c2de2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5bf289ea37cc22309b9bb47b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 28 13:26:01 2022 +0200 kernelbase: Reimplement LOCALE_*DAYNAME in GetLocaleInfoW/Ex using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 7f8c51a8414..6e7a277ba07 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -887,6 +887,15 @@ static int locale_return_number( UINT val, LCTYPE type, WCHAR *buffer, int len ) } +static int locale_return_strarray( DWORD pos, WORD idx, LCTYPE type, WCHAR *buffer, int len ) +{ + const DWORD *array = (const DWORD *)(locale_strings + pos + 1); + WORD count = locale_strings[pos]; + + return locale_return_string( idx < count ? array[idx] : 0, type, buffer, len ); +} + + /* get locale information from the locale.nls file */ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE type, WCHAR *buffer, int len ) @@ -1030,7 +1039,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ case LOCALE_SDAYNAME5: case LOCALE_SDAYNAME6: case LOCALE_SDAYNAME7: - return -1; + return locale_return_strarray( locale->sdayname, + LOWORD(type - LOCALE_SDAYNAME1 + 1) % 7, type, buffer, len ); case LOCALE_SABBREVDAYNAME1: case LOCALE_SABBREVDAYNAME2: @@ -1039,7 +1049,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ case LOCALE_SABBREVDAYNAME5: case LOCALE_SABBREVDAYNAME6: case LOCALE_SABBREVDAYNAME7: - return -1; + return locale_return_strarray( locale->sabbrevdayname, + LOWORD(type - LOCALE_SABBREVDAYNAME1 + 1) % 7, type, buffer, len ); case LOCALE_SMONTHNAME1: case LOCALE_SMONTHNAME2: @@ -1126,7 +1137,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ case LOCALE_SSHORTESTDAYNAME5: case LOCALE_SSHORTESTDAYNAME6: case LOCALE_SSHORTESTDAYNAME7: - return -1; + return locale_return_strarray( locale->sshortestdayname, + LOWORD(type - LOCALE_SSHORTESTDAYNAME1 + 1) % 7, type, buffer, len ); case LOCALE_SISO639LANGNAME2: return locale_return_string( locale->siso639langname2, type, buffer, len );
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement LOCALE_*DEFAULTCODEPAGE in GetLocaleInfoW/Ex using the locale.nls data.
by Alexandre Julliard
28 Mar '22
28 Mar '22
Module: wine Branch: master Commit: b1e17a053a66d06532aa0b8258569d5efc51a806 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b1e17a053a66d06532aa0b82…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Mar 28 12:42:21 2022 +0200 kernelbase: Reimplement LOCALE_*DEFAULTCODEPAGE in GetLocaleInfoW/Ex using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 2e512240b2b..7f8c51a8414 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -932,7 +932,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ return -1; case LOCALE_IDEFAULTCODEPAGE: - return -1; + val = locale->idefaultcodepage == CP_UTF8 ? CP_OEMCP : locale->idefaultcodepage; + return locale_return_number( val, type, buffer, len ); case LOCALE_SLIST: return -1; @@ -1213,7 +1214,8 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ return -1; case LOCALE_IDEFAULTANSICODEPAGE: - return -1; + val = locale->idefaultansicodepage == CP_UTF8 ? CP_ACP : locale->idefaultansicodepage; + return locale_return_number( val, type, buffer, len ); case LOCALE_ITIMEMARKPOSN: return -1; @@ -1252,10 +1254,11 @@ static int get_locale_info( const NLS_LOCALE_DATA *locale, LCID lcid, LCTYPE typ return -1; case LOCALE_IDEFAULTMACCODEPAGE: - return -1; + val = locale->idefaultmaccodepage == CP_UTF8 ? CP_MACCP : locale->idefaultmaccodepage; + return locale_return_number( val, type, buffer, len ); case LOCALE_IDEFAULTEBCDICCODEPAGE: - return -1; + return locale_return_number( locale->idefaultebcdiccodepage, type, buffer, len ); case LOCALE_SSORTNAME: return -1;
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
114
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Results per page:
10
25
50
100
200