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
September 2021
----- 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
1030 discussions
Start a n
N
ew thread
Nikolay Sivov : ole32/composite: Fix IsEqual() comparison logic.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: 068ddc5b1b0b00ccef78817cd716815c916ea359 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=068ddc5b1b0b00ccef78817c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 27 15:31:39 2021 +0300 ole32/composite: Fix IsEqual() comparison logic. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/compositemoniker.c | 65 +++++++++++++++++-------------------------- dlls/ole32/tests/moniker.c | 18 +++++++++--- 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 4eb9b32fe5e..60d11b3ba90 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -558,56 +558,41 @@ static HRESULT WINAPI CompositeMonikerImpl_Enum(IMoniker *iface, BOOL forward, I return hr; } -/****************************************************************************** - * CompositeMoniker_IsEqual - ******************************************************************************/ -static HRESULT WINAPI -CompositeMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker) +static HRESULT WINAPI CompositeMonikerImpl_IsEqual(IMoniker *iface, IMoniker *other) { - IEnumMoniker *enumMoniker1,*enumMoniker2; - IMoniker *tempMk1,*tempMk2; - HRESULT res1,res2,res; - BOOL done; - - TRACE("(%p,%p)\n",iface,pmkOtherMoniker); + CompositeMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker; + IMoniker **components, **other_components; + unsigned int i; + HRESULT hr; - if (pmkOtherMoniker==NULL) - return S_FALSE; + TRACE("%p, %p.\n", iface, other); - /* This method returns S_OK if the components of both monikers are equal when compared in the */ - /* left-to-right order.*/ - IMoniker_Enum(pmkOtherMoniker,TRUE,&enumMoniker1); + if (!other) + return E_INVALIDARG; - if (enumMoniker1==NULL) + if (!(other_moniker = unsafe_impl_from_IMoniker(other))) return S_FALSE; - IMoniker_Enum(iface,TRUE,&enumMoniker2); - - do { - - res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL); - res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL); - - if((res1==S_OK)&&(res2==S_OK)){ - done = (res = IMoniker_IsEqual(tempMk1,tempMk2)) == S_FALSE; - } - else - { - res = (res1==S_FALSE) && (res2==S_FALSE); - done = TRUE; - } + if (moniker->comp_count != other_moniker->comp_count) + return S_FALSE; - if (res1==S_OK) - IMoniker_Release(tempMk1); + if (FAILED(hr = composite_get_components_alloc(moniker, &components))) return hr; + if (FAILED(hr = composite_get_components_alloc(other_moniker, &other_components))) + { + heap_free(components); + return hr; + } - if (res2==S_OK) - IMoniker_Release(tempMk2); - } while (!done); + for (i = 0; i < moniker->comp_count; ++i) + { + if ((hr = IMoniker_IsEqual(components[i], other_components[i]) != S_OK)) + break; + } - IEnumMoniker_Release(enumMoniker1); - IEnumMoniker_Release(enumMoniker2); + heap_free(other_components); + heap_free(components); - return res; + return hr; } static HRESULT WINAPI CompositeMonikerImpl_Hash(IMoniker *iface, DWORD *hash) diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 1e4c2e0211d..962ae6c269f 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3303,20 +3303,16 @@ todo_wine /* With itself */ hr = IMoniker_CommonPrefixWith(moniker, moniker, &moniker2); -todo_wine ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr); hr = IMoniker_IsEqual(moniker, moniker2); -todo_wine ok(hr == S_OK && moniker2 != moniker, "Unexpected hr %#x.\n", hr); IMoniker_Release(moniker2); /* Equal composites */ hr = IMoniker_CommonPrefixWith(moniker, moniker1, &moniker2); -todo_wine ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr); ok(moniker2 != moniker && moniker2 != moniker1, "Unexpected object.\n"); hr = IMoniker_IsEqual(moniker, moniker2); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IMoniker_Release(moniker2); @@ -3349,6 +3345,20 @@ todo_wine IMoniker_Release(moniker); IMoniker_Release(moniker1); + /* IsEqual() */ + hr = create_moniker_from_desc("CI1I2", &moniker1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = create_moniker_from_desc("CI1I2", &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_IsEqual(moniker1, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + hr = IMoniker_IsEqual(moniker1, moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_IsEqual(moniker1, moniker1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMoniker_Release(moniker2); + IMoniker_Release(moniker1); + IBindCtx_Release(bindctx); }
1
0
0
0
Nikolay Sivov : ole32/composite: Implement CommonPrefixWith() without iterators.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: ca7e757fb934657c8de9b4a1bbcf498684621fc4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ca7e757fb934657c8de9b4a1…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 27 15:31:38 2021 +0300 ole32/composite: Implement CommonPrefixWith() without iterators. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/compositemoniker.c | 230 ++++++++++++++++++++++-------------------- dlls/ole32/tests/moniker.c | 15 ++- 2 files changed, 128 insertions(+), 117 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=ca7e757fb934657c8de9…
1
0
0
0
Nikolay Sivov : ole32/tests: Add some tests for CommonPrefixWith().
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: 1f261967ac4ebc222ae83705a11d972c175872c8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1f261967ac4ebc222ae83705…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 27 15:31:37 2021 +0300 ole32/tests: Add some tests for CommonPrefixWith(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/compositemoniker.c | 1 + dlls/ole32/tests/moniker.c | 78 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 0907950cb17..efb0e9de9e8 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -934,6 +934,7 @@ CompositeMonikerImpl_CommonPrefixWith(IMoniker* iface, IMoniker* pmkOther, if (IMoniker_IsEqual(pmkOther,mostLeftMk1)==S_OK){ *ppmkPrefix=pmkOther; + IMoniker_AddRef(*ppmkPrefix); return MK_S_HIM; } diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index db068f1426f..ed55ec3e825 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -3042,7 +3042,7 @@ static void test_generic_composite_moniker(void) { "CI1I2", "A3", MKSYS_ANTIMONIKER, L"\\.." }, { "CI1I3", "CA1I2", MKSYS_GENERICCOMPOSITE, L"!I1!I2" }, }; - IMoniker *moniker, *inverse, *moniker1, *moniker2; + IMoniker *moniker, *inverse, *moniker1, *moniker2, *moniker3; IEnumMoniker *enummoniker; IRunningObjectTable *rot; DWORD hash, cookie; @@ -3284,6 +3284,66 @@ todo_wine IMoniker_Release(moniker); IMoniker_Release(moniker1); + /* CommonPrefixWith() */ + hr = create_moniker_from_desc("CI1I2", &moniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = create_moniker_from_desc("CI1I2", &moniker1); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + moniker2 = (void *)0xdeadbeef; + hr = IMoniker_CommonPrefixWith(moniker, NULL, &moniker2); +todo_wine + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + ok(!moniker2, "Unexpected pointer.\n"); + + /* With itself */ + hr = IMoniker_CommonPrefixWith(moniker, moniker, &moniker2); + ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr); +todo_wine + ok(moniker2 != moniker, "Unexpected object.\n"); + TEST_DISPLAY_NAME(moniker2, L"!I1!I2"); + IMoniker_Release(moniker2); + + /* Equal composites */ + hr = IMoniker_CommonPrefixWith(moniker, moniker1, &moniker2); + ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr); +todo_wine + ok(moniker2 != moniker && moniker2 != moniker1, "Unexpected object.\n"); + hr = IMoniker_IsEqual(moniker, moniker2); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMoniker_Release(moniker2); + + hr = create_moniker_from_desc("I2", &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3); + ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr); + IMoniker_Release(moniker2); + + hr = create_moniker_from_desc("I1", &moniker2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3); + ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr); + hr = IMoniker_IsEqual(moniker2, moniker3); +todo_wine + ok(hr == S_OK && moniker3 != moniker2, "Unexpected object.\n"); + IMoniker_Release(moniker3); + + hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3); +todo_wine + ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + hr = IMoniker_IsEqual(moniker2, moniker3); + ok(hr == S_OK && moniker3 != moniker2, "Unexpected object.\n"); + IMoniker_Release(moniker3); + } + + IMoniker_Release(moniker2); + + IMoniker_Release(moniker); + IMoniker_Release(moniker1); + IBindCtx_Release(bindctx); } @@ -3720,11 +3780,15 @@ todo_wine { hr = CreateItemMoniker(L"!", L"Item", &item); ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr); + moniker = (void *)0xdeadbeef; hr = MonikerCommonPrefixWith(item, NULL, &moniker); ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr); + ok(!moniker, "Unexpected pointer.\n"); + moniker = (void *)0xdeadbeef; hr = MonikerCommonPrefixWith(NULL, item, &moniker); ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr); + ok(!moniker, "Unexpected pointer.\n"); hr = MonikerCommonPrefixWith(item, item, &moniker); ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr); @@ -3796,6 +3860,18 @@ todo_wine { IMoniker_Release(composite2); IMoniker_Release(composite); + + /* (I1,(I2,I3)) x ((I1,I2),I4) */ + hr = create_moniker_from_desc("CI1CI2I3", &composite); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = create_moniker_from_desc("CCI1I2I4", &composite2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = MonikerCommonPrefixWith(composite, composite2, &moniker); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE); + TEST_DISPLAY_NAME(moniker, L"!I1!I2"); + IMoniker_Release(moniker); + IMoniker_Release(file2); IMoniker_Release(file1); IMoniker_Release(item);
1
0
0
0
Nikolay Sivov : ole32/tests: Systematically check for supported moniker interfaces.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: 5aed88a3b3650ac5acc293510bc229067e20bce7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5aed88a3b3650ac5acc29351…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Sep 27 15:31:36 2021 +0300 ole32/tests: Systematically check for supported moniker interfaces. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/tests/moniker.c | 59 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index ae46db110b6..db068f1426f 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -36,6 +36,21 @@ #include "wine/test.h" #include "wine/heap.h" +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + #define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr) #define CHECK_EXPECTED_METHOD(method_name) \ @@ -1896,6 +1911,13 @@ static void test_class_moniker(void) hr = CreateClassMoniker(&GUID_NULL, &moniker); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + check_interface(moniker, &IID_IMoniker, TRUE); + check_interface(moniker, &IID_IPersist, TRUE); + check_interface(moniker, &IID_IPersistStream, TRUE); + check_interface(moniker, &CLSID_ClassMoniker, TRUE); + check_interface(moniker, &IID_IROTData, TRUE); + check_interface(moniker, &IID_IMarshal, TRUE); + hr = IMoniker_GetSizeMax(moniker, &size); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(size.QuadPart == 20, "Unexpected size %u.\n", size.LowPart); @@ -2222,6 +2244,14 @@ static void test_file_monikers(void) hr = CreateFileMoniker(filename, &moniker); ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr); + check_interface(moniker, &IID_IMoniker, TRUE); +todo_wine + check_interface(moniker, &IID_IPersist, FALSE); + check_interface(moniker, &IID_IPersistStream, TRUE); + check_interface(moniker, &CLSID_FileMoniker, TRUE); + check_interface(moniker, &IID_IROTData, TRUE); + check_interface(moniker, &IID_IMarshal, TRUE); + hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IStorage, (void **)&storage); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); @@ -2753,6 +2783,14 @@ static void test_anti_moniker(void) hr = CreateAntiMoniker(&moniker); ok_ole_success(hr, CreateAntiMoniker); + check_interface(moniker, &IID_IMoniker, TRUE); +todo_wine + check_interface(moniker, &IID_IPersist, FALSE); + check_interface(moniker, &IID_IPersistStream, TRUE); + check_interface(moniker, &CLSID_AntiMoniker, TRUE); + check_interface(moniker, &IID_IROTData, TRUE); + check_interface(moniker, &IID_IMarshal, TRUE); + hr = IMoniker_QueryInterface(moniker, &CLSID_AntiMoniker, (void **)&unknown); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n"); @@ -3067,6 +3105,13 @@ static void test_generic_composite_moniker(void) hr = CreateGenericComposite(moniker1, moniker2, &moniker); ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr); + check_interface(moniker, &IID_IMoniker, TRUE); +todo_wine + check_interface(moniker, &IID_IPersist, FALSE); + check_interface(moniker, &IID_IPersistStream, TRUE); + check_interface(moniker, &IID_IROTData, TRUE); + check_interface(moniker, &IID_IMarshal, TRUE); + hr = CreateGenericComposite(moniker1, moniker2, &moniker); ok(hr == S_OK, "Failed to create composite, hr %#x.\n", hr); TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE); @@ -3253,7 +3298,6 @@ static void test_pointer_moniker(void) FILETIME filetime; IUnknown *unknown; IStream *stream; - IROTData *rotdata; LPOLESTR display_name; IMarshal *marshal; LARGE_INTEGER pos; @@ -3267,6 +3311,14 @@ static void test_pointer_moniker(void) hr = CreatePointerMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + check_interface(moniker, &IID_IMoniker, TRUE); +todo_wine + check_interface(moniker, &IID_IPersist, FALSE); + check_interface(moniker, &IID_IPersistStream, TRUE); + check_interface(moniker, &CLSID_PointerMoniker, TRUE); + check_interface(moniker, &IID_IMarshal, TRUE); + check_interface(moniker, &IID_IROTData, FALSE); + hr = IMoniker_QueryInterface(moniker, &IID_IMoniker, NULL); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); @@ -3318,11 +3370,6 @@ static void test_pointer_moniker(void) hr = IMoniker_IsDirty(moniker); ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08x\n", hr); - /* IROTData::GetComparisonData test */ - - hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata); - ok(hr == E_NOINTERFACE, "IMoniker_QueryInterface(IID_IROTData) should have returned E_NOINTERFACE instead of 0x%08x\n", hr); - /* Saving */ hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1
0
0
0
Jacek Caban : gdi32: Move __wine_get_wgl_driver to driver.c.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: 1e8fa197b5b8732967e6aac1691428358c944f50 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1e8fa197b5b8732967e6aac1…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 27 13:05:51 2021 +0200 gdi32: Move __wine_get_wgl_driver to driver.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/driver.c | 17 +++++++++++++++++ dlls/gdi32/opengl.c | 18 ------------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index f9cf592b28e..aad5f08b78e 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -1157,3 +1157,20 @@ NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNE return get_display_driver()->pD3DKMTCheckVidPnExclusiveOwnership( desc ); } + +/*********************************************************************** + * __wine_get_wgl_driver (win32u.@) + */ +struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version ) +{ + struct opengl_funcs *ret = NULL; + DC * dc = get_dc_ptr( hdc ); + + if (dc) + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, wine_get_wgl_driver ); + ret = physdev->funcs->wine_get_wgl_driver( physdev, version ); + release_dc_ptr( dc ); + } + return ret; +} diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c index c50d7bc2b43..0fbd851f67e 100644 --- a/dlls/gdi32/opengl.c +++ b/dlls/gdi32/opengl.c @@ -30,7 +30,6 @@ #include "winerror.h" #include "winternl.h" #include "winnt.h" -#include "ntgdi_private.h" static HMODULE opengl32; @@ -40,23 +39,6 @@ static INT (WINAPI *wglGetPixelFormat)(HDC); static BOOL (WINAPI *wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR*); static BOOL (WINAPI *wglSwapBuffers)(HDC); -/*********************************************************************** - * __wine_get_wgl_driver (GDI32.@) - */ -struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version ) -{ - struct opengl_funcs *ret = NULL; - DC * dc = get_dc_ptr( hdc ); - - if (dc) - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, wine_get_wgl_driver ); - ret = physdev->funcs->wine_get_wgl_driver( physdev, version ); - release_dc_ptr( dc ); - } - return ret; -} - /****************************************************************************** * ChoosePixelFormat (GDI32.@) */
1
0
0
0
Jacek Caban : gdi32: Read screen DPI config in init_font_options.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: 8e40e56b79c39356a981bbc25100daa9635b29f3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8e40e56b79c39356a981bbc2…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 27 13:05:38 2021 +0200 gdi32: Read screen DPI config in init_font_options. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 39 ++++++++++++++++++---------- dlls/gdi32/gdiobj.c | 65 +++++++--------------------------------------- dlls/gdi32/ntgdi_private.h | 3 +-- 3 files changed, 36 insertions(+), 71 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index b85f11b14a6..189405c2ba1 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2682,7 +2682,7 @@ static void update_font_system_link_info(UINT current_ansi_codepage) } } -static void update_codepage(void) +static void update_codepage( UINT screen_dpi ) { char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[40 * sizeof(WCHAR)])]; KEY_VALUE_PARTIAL_INFORMATION *info = (void *)value_buffer; @@ -2691,14 +2691,11 @@ static void update_codepage(void) HKEY hkey; DWORD size; UINT i, ansi_cp, oem_cp; - DWORD screen_dpi, font_dpi = 0; + DWORD font_dpi = 0; BOOL done = FALSE, cp_match = FALSE; static const WCHAR log_pixelsW[] = {'L','o','g','P','i','x','e','l','s',0}; - screen_dpi = get_dpi(); - if (!screen_dpi) screen_dpi = 96; - size = query_reg_value( wine_fonts_key, log_pixelsW, info, sizeof(value_buffer) ); if (size == sizeof(DWORD) && info->Type == REG_DWORD) font_dpi = *(DWORD *)info->Data; @@ -4177,12 +4174,13 @@ static BOOL get_key_value( HKEY key, const char *name, DWORD *value ) return !!count; } -static void init_font_options( HKEY hkcu ) +static UINT init_font_options( HKEY hkcu ) { char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[20 * sizeof(WCHAR)])]; KEY_VALUE_PARTIAL_INFORMATION *info = (void *)value_buffer; HKEY key; DWORD i, val, gamma = 1400; + UINT dpi = 0; static const WCHAR desktop_keyW[] = { 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p' }; @@ -4220,6 +4218,7 @@ static void init_font_options( HKEY hkcu ) { gamma = min( max( val, 1000 ), 2200 ); } + if (get_key_value( key, "LogPixels", &val )) dpi = val; NtClose( key ); } @@ -4235,8 +4234,17 @@ static void init_font_options( HKEY hkcu ) font_gamma_ramp.decode[i] = pow( i / 255., gamma / 1000. ) * 255. + .5; } } + + if (!dpi && (key = reg_open_key( NULL, fonts_config_keyW, sizeof(fonts_config_keyW) ))) + { + if (get_key_value( key, "LogPixels", &val )) dpi = val; + NtClose( key ); + } + if (!dpi) dpi = 96; + font_gamma_ramp.gamma = gamma; - TRACE("gamma %d\n", font_gamma_ramp.gamma); + TRACE( "gamma %d screen dpi %u\n", font_gamma_ramp.gamma, dpi ); + return dpi; } @@ -6123,12 +6131,13 @@ static const struct font_callback_funcs callback_funcs = { add_gdi_face }; /*********************************************************************** * font_init */ -void font_init(void) +UINT font_init(void) { OBJECT_ATTRIBUTES attr = { sizeof(attr) }; UNICODE_STRING name; HANDLE mutex, hkcu; DWORD disposition; + UINT dpi = 0; static WCHAR wine_font_mutexW[] = {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s', @@ -6137,14 +6146,15 @@ void font_init(void) {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','F','o','n','t','s'}; static const WCHAR cacheW[] = {'C','a','c','h','e'}; - if (RtlOpenCurrentUser( MAXIMUM_ALLOWED, &hkcu )) return; + if (RtlOpenCurrentUser( MAXIMUM_ALLOWED, &hkcu )) return 0; wine_fonts_key = reg_create_key( hkcu, wine_fonts_keyW, sizeof(wine_fonts_keyW), 0, NULL ); - if (wine_fonts_key) init_font_options( hkcu ); + if (wine_fonts_key) dpi = init_font_options( hkcu ); NtClose( hkcu ); - if (!wine_fonts_key) return; - update_codepage(); + if (!dpi) return 96; + update_codepage( dpi ); - if (__wine_init_unix_lib( gdi32_module, DLL_PROCESS_ATTACH, &callback_funcs, &font_funcs )) return; + if (__wine_init_unix_lib( gdi32_module, DLL_PROCESS_ATTACH, &callback_funcs, &font_funcs )) + return dpi; load_system_bitmap_fonts(); load_file_system_fonts(); @@ -6155,7 +6165,7 @@ void font_init(void) name.Buffer = wine_font_mutexW; name.Length = name.MaximumLength = sizeof(wine_font_mutexW); - if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return; + if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return dpi; NtWaitForSingleObject( mutex, FALSE, NULL ); wine_fonts_cache_key = reg_create_key( wine_fonts_key, cacheW, sizeof(cacheW), @@ -6181,6 +6191,7 @@ void font_init(void) load_system_links(); dump_gdi_font_list(); dump_gdi_font_subst(); + return dpi; } /*********************************************************************** diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 9c62e9e62d1..14cada9ee88 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -514,46 +514,6 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle ) } -/****************************************************************************** - * get_reg_dword - * - * Read a DWORD value from the registry - */ -static BOOL get_reg_dword(HKEY base, const WCHAR *key_name, const WCHAR *value_name, DWORD *value) -{ - HKEY key; - DWORD type, data, size = sizeof(data); - BOOL ret = FALSE; - - if (RegOpenKeyW(base, key_name, &key) == ERROR_SUCCESS) - { - if (RegQueryValueExW(key, value_name, NULL, &type, (void *)&data, &size) == ERROR_SUCCESS && - type == REG_DWORD) - { - *value = data; - ret = TRUE; - } - RegCloseKey(key); - } - return ret; -} - -/****************************************************************************** - * get_dpi - * - * get the dpi from the registry - */ -DWORD get_dpi(void) -{ - DWORD dpi; - - if (get_reg_dword(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"LogPixels", &dpi)) - return dpi; - if (get_reg_dword(HKEY_CURRENT_CONFIG, L"Software\\Fonts", L"LogPixels", &dpi)) - return dpi; - return 0; -} - /****************************************************************************** * get_system_dpi * @@ -580,16 +540,9 @@ static HFONT create_font( const LOGFONTW *deffont ) return NtGdiHfontCreate( &lf, sizeof(lf), 0, 0, NULL ); } -static HFONT create_scaled_font( const LOGFONTW *deffont ) +static HFONT create_scaled_font( const LOGFONTW *deffont, unsigned int dpi ) { LOGFONTW lf; - static DWORD dpi; - - if (!dpi) - { - dpi = get_dpi(); - if (!dpi) dpi = 96; - } lf = *deffont; lf.lfHeight = muldiv( lf.lfHeight, dpi, 96 ); @@ -634,7 +587,7 @@ HGDIOBJ get_stock_object( INT obj ) return entry_to_handle( handle_entry( ULongToHandle( obj + FIRST_GDI_HANDLE ))); } -static void init_stock_objects(void) +static void init_stock_objects( unsigned int dpi ) { const struct DefaultFontInfo *deffonts; unsigned int i; @@ -655,7 +608,7 @@ static void init_stock_objects(void) create_pen( PS_NULL, 0, RGB(0,0,0) ); /* slot 9 is not used for non-scaled stock objects */ - create_scaled_font( &OEMFixedFont ); + create_scaled_font( &OEMFixedFont, dpi ); /* language-independent stock fonts */ create_font( &OEMFixedFont ); @@ -679,9 +632,9 @@ static void init_stock_objects(void) assert( (HandleToULong( obj ) & 0xffff) == FIRST_GDI_HANDLE + DEFAULT_BITMAP ); - create_scaled_font( &deffonts->SystemFont ); - create_scaled_font( &deffonts->SystemFixedFont ); - create_scaled_font( &deffonts->DefaultGuiFont ); + create_scaled_font( &deffonts->SystemFont, dpi ); + create_scaled_font( &deffonts->SystemFixedFont, dpi ); + create_scaled_font( &deffonts->DefaultGuiFont, dpi ); /* clear the NOSYSTEM bit on all stock objects*/ for (i = 0; i < STOCK_LAST + 5; i++) @@ -699,14 +652,16 @@ static void init_stock_objects(void) */ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { + unsigned int dpi; + if (reason != DLL_PROCESS_ATTACH) return TRUE; gdi32_module = inst; DisableThreadLibraryCalls( inst ); NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL ); set_gdi_shared(); - font_init(); - init_stock_objects(); + dpi = font_init(); + init_stock_objects( dpi ); return TRUE; } diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h index 595387e0aef..9f0f1d44240 100644 --- a/dlls/gdi32/ntgdi_private.h +++ b/dlls/gdi32/ntgdi_private.h @@ -338,7 +338,7 @@ struct font_callback_funcs const struct bitmap_font_size *size ); }; -extern void font_init(void) DECLSPEC_HIDDEN; +extern UINT font_init(void) DECLSPEC_HIDDEN; /* opentype.c */ @@ -380,7 +380,6 @@ extern void GDI_CheckNotLock(void) DECLSPEC_HIDDEN; extern UINT GDI_get_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN; extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN; extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN; -extern DWORD get_dpi(void) DECLSPEC_HIDDEN; extern DWORD get_system_dpi(void) DECLSPEC_HIDDEN; extern HGDIOBJ get_stock_object( INT obj ) DECLSPEC_HIDDEN; extern DWORD get_gdi_object_type( HGDIOBJ obj ) DECLSPEC_HIDDEN;
1
0
0
0
Jacek Caban : gdi32: Directly use ntdll in load_registry_fonts.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: b6e494f568667de7f60f60511b1fd70dddc09851 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b6e494f568667de7f60f6051…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 27 13:05:26 2021 +0200 gdi32: Directly use ntdll in load_registry_fonts. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 9d2cd37e642..b85f11b14a6 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -6068,53 +6068,54 @@ static void update_external_font_keys(void) static void load_registry_fonts(void) { - WCHAR value[LF_FULLFACESIZE + 12], data[MAX_PATH + 4], *tmp, *path; - DWORD i = 0, type, dlen, vlen; + char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[MAX_PATH * sizeof(WCHAR)])]; + KEY_VALUE_PARTIAL_INFORMATION *info = (void *)value_buffer; + KEY_VALUE_FULL_INFORMATION *enum_info = (KEY_VALUE_FULL_INFORMATION *)value_buffer; + WCHAR value[LF_FULLFACESIZE + 12], *tmp, *path; + DWORD i = 0, dlen; HKEY hkey; + static const WCHAR dot_fonW[] = {'.','f','o','n',0}; + /* Look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their full path as the entry. Also look for any .fon fonts, since ReadFontDir will skip these. */ - if (RegOpenKeyW( HKEY_LOCAL_MACHINE, - is_win9x() ? L"Software\\Microsoft\\Windows\\CurrentVersion\\Fonts" : - L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", &hkey )) - return; + if (is_win9x()) + hkey = reg_open_key( NULL, fonts_win9x_config_keyW, sizeof(fonts_win9x_config_keyW) ); + else + hkey = reg_open_key( NULL, fonts_winnt_config_keyW, sizeof(fonts_winnt_config_keyW) ); + if (!hkey) return; - memcpy( data, nt_prefixW, sizeof(nt_prefixW) ); - vlen = ARRAY_SIZE(value); - dlen = sizeof(data) - sizeof(nt_prefixW); - while (!RegEnumValueW( hkey, i++, value, &vlen, NULL, &type, NULL, NULL )) + while (reg_enum_value( hkey, i++, enum_info, sizeof(value_buffer), value, sizeof(value) )) { - if (type != REG_SZ) goto next; - dlen /= sizeof(WCHAR); - if ((tmp = wcsrchr( value, ' ' )) && !facename_compare( tmp, L" (TrueType)", -1 )) *tmp = 0; - if (find_face_from_full_name( value )) goto next; + if (enum_info->Type != REG_SZ) continue; + if ((tmp = wcsrchr( value, ' ' )) && !facename_compare( tmp, true_type_suffixW, -1 )) *tmp = 0; + if (find_face_from_full_name( value )) continue; if (tmp && !*tmp) *tmp = ' '; - path = data + ARRAYSIZE(nt_prefixW); - if (RegQueryValueExW( hkey, value, NULL, NULL, (LPBYTE)data + sizeof(nt_prefixW), &dlen )) + if (!(dlen = query_reg_value( hkey, value, info, sizeof(value_buffer) - sizeof(nt_prefixW) )) || + info->Type != REG_SZ) { WARN( "Unable to get face path %s\n", debugstr_w(value) ); - goto next; + continue; } + path = (WCHAR *)info->Data; if (path[0] && path[1] == ':') { - path = data; + memmove( path + ARRAYSIZE(nt_prefixW), path, dlen ); + memcpy( path, nt_prefixW, sizeof(nt_prefixW) ); dlen += sizeof(nt_prefixW); } dlen /= sizeof(WCHAR); if (*path == '\\') add_font_resource( path, ADDFONT_ALLOW_BITMAP ); - else if (dlen >= 6 && !wcsicmp( path + dlen - 5, L".fon" )) + else if (dlen >= 6 && !wcsicmp( path + dlen - 5, dot_fonW )) add_system_font_resource( path, ADDFONT_ALLOW_BITMAP ); - next: - vlen = ARRAY_SIZE(value); - dlen = sizeof(data) - sizeof(nt_prefixW); } - RegCloseKey( hkey ); + NtClose( hkey ); } static const struct font_callback_funcs callback_funcs = { add_gdi_face }; @@ -6134,9 +6135,9 @@ void font_init(void) '\\','_','_','W','I','N','E','_','F','O','N','T','_','M','U','T','E','X','_','_'}; static const WCHAR wine_fonts_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','F','o','n','t','s'}; + static const WCHAR cacheW[] = {'C','a','c','h','e'}; if (RtlOpenCurrentUser( MAXIMUM_ALLOWED, &hkcu )) return; - wine_fonts_key = reg_create_key( hkcu, wine_fonts_keyW, sizeof(wine_fonts_keyW), 0, NULL ); if (wine_fonts_key) init_font_options( hkcu ); NtClose( hkcu ); @@ -6157,8 +6158,8 @@ void font_init(void) if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return; NtWaitForSingleObject( mutex, FALSE, NULL ); - RegCreateKeyExW( wine_fonts_key, L"Cache", 0, NULL, REG_OPTION_VOLATILE, - KEY_ALL_ACCESS, NULL, &wine_fonts_cache_key, &disposition ); + wine_fonts_cache_key = reg_create_key( wine_fonts_key, cacheW, sizeof(cacheW), + REG_OPTION_VOLATILE, &disposition ); if (disposition == REG_CREATED_NEW_KEY) {
1
0
0
0
Jacek Caban : gdi32: Directly use ntdll in update_external_font_keys.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: b544b748800e936e5dc008e3ef9203304b4b70e5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b544b748800e936e5dc008e3…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 27 13:05:15 2021 +0200 gdi32: Directly use ntdll in update_external_font_keys. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 9132c9b6849..9d2cd37e642 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -91,6 +91,8 @@ static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; static const WCHAR nt_prefixW[] = {'\\','?','?','\\'}; +static const WCHAR true_type_suffixW[] = {' ','(','T','r','u','e','T','y','p','e',')',0}; + static const WCHAR system_link_keyW[] = { '\\','R','e','g','i','s','t','r','y', @@ -5984,40 +5986,45 @@ static void update_external_font_keys(void) struct gdi_font_family *family; struct external_key *key, *next; struct gdi_font_face *face; - DWORD len, i = 0, type, dlen, vlen; - WCHAR value[LF_FULLFACESIZE + 12], path[MAX_PATH + 4], *tmp; + DWORD len, i = 0; + WCHAR value[LF_FULLFACESIZE + 12], *tmp, *path; + char buffer[2048]; + KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; WCHAR *file; HKEY hkey; - RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &winnt_key, NULL ); - RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Fonts", - 0, NULL, 0, KEY_ALL_ACCESS, NULL, &win9x_key, NULL ); + static const WCHAR external_fontsW[] = {'E','x','t','e','r','n','a','l',' ','F','o','n','t','s'}; + + winnt_key = reg_create_key( NULL, fonts_winnt_config_keyW, sizeof(fonts_winnt_config_keyW), 0, NULL ); + win9x_key = reg_create_key( NULL, fonts_win9x_config_keyW, sizeof(fonts_win9x_config_keyW), 0, NULL ); /* enumerate the fonts and add external ones to the two keys */ - if (RegCreateKeyW( wine_fonts_key, L"External Fonts", &hkey )) return; + if (!(hkey = reg_create_key( wine_fonts_key, external_fontsW, sizeof(external_fontsW), 0, NULL ))) + return; - memcpy( path, nt_prefixW, sizeof(nt_prefixW) ); - vlen = ARRAY_SIZE(value); - dlen = sizeof(path) - sizeof(nt_prefixW); - while (!RegEnumValueW( hkey, i++, value, &vlen, NULL, &type, (BYTE *)path + sizeof(nt_prefixW), &dlen )) + while (reg_enum_value( hkey, i++, info, sizeof(buffer) - sizeof(nt_prefixW), + value, LF_FULLFACESIZE * sizeof(WCHAR) )) { - if (type != REG_SZ) goto next; - if ((tmp = wcsrchr( value, ' ' )) && !facename_compare( tmp, L" (TrueType)", -1 )) *tmp = 0; - if ((face = find_face_from_full_name( value )) && - !wcsicmp( face->file, path[5] == ':' ? path : path + ARRAYSIZE(nt_prefixW) )) + if (info->Type != REG_SZ) continue; + + path = (WCHAR *)(buffer + info->DataOffset); + if (path[0] && path[1] == ':') + { + memmove( path, path + ARRAYSIZE(nt_prefixW), sizeof(nt_prefixW) ); + memcpy( path, nt_prefixW, sizeof(nt_prefixW) ); + } + + if ((tmp = wcsrchr( value, ' ' )) && !facename_compare( tmp, true_type_suffixW, -1 )) *tmp = 0; + if ((face = find_face_from_full_name( value )) && !wcsicmp( face->file, path )) { face->flags |= ADDFONT_EXTERNAL_FOUND; - goto next; + continue; } if (tmp && !*tmp) *tmp = ' '; if (!(key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) ))) break; lstrcpyW( key->value, value ); list_add_tail( &external_keys, &key->entry ); - next: - vlen = ARRAY_SIZE(value); - dlen = sizeof(path) - sizeof(nt_prefixW); } WINE_RB_FOR_EACH_ENTRY( family, &family_name_tree, struct gdi_font_family, name_entry ) @@ -6028,7 +6035,7 @@ static void update_external_font_keys(void) if ((face->flags & ADDFONT_EXTERNAL_FOUND)) continue; lstrcpyW( value, face->full_name ); - if (face->scalable) lstrcatW( value, L" (TrueType)" ); + if (face->scalable) lstrcatW( value, true_type_suffixW ); if (face->file[0] == '\\') { @@ -6041,22 +6048,22 @@ static void update_external_font_keys(void) file = face->file; len = (lstrlenW(file) + 1) * sizeof(WCHAR); - RegSetValueExW( winnt_key, value, 0, REG_SZ, (BYTE *)file, len ); - RegSetValueExW( win9x_key, value, 0, REG_SZ, (BYTE *)file, len ); - RegSetValueExW( hkey, value, 0, REG_SZ, (BYTE *)file, len ); + set_reg_value( winnt_key, value, REG_SZ, file, len ); + set_reg_value( win9x_key, value, REG_SZ, file, len ); + set_reg_value( hkey, value, REG_SZ, file, len ); } } LIST_FOR_EACH_ENTRY_SAFE( key, next, &external_keys, struct external_key, entry ) { - RegDeleteValueW( win9x_key, key->value ); - RegDeleteValueW( winnt_key, key->value ); - RegDeleteValueW( hkey, key->value ); + reg_delete_value( win9x_key, key->value ); + reg_delete_value( winnt_key, key->value ); + reg_delete_value( hkey, key->value ); list_remove( &key->entry ); HeapFree( GetProcessHeap(), 0, key ); } - RegCloseKey( win9x_key ); - RegCloseKey( winnt_key ); - RegCloseKey( hkey ); + NtClose( win9x_key ); + NtClose( winnt_key ); + NtClose( hkey ); } static void load_registry_fonts(void)
1
0
0
0
Jacek Caban : gdi32: Directly use ntdll in load_system_bitmap_fonts and load_file_system_fonts.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: e3d7e1f539b9a336e99e91c6d7faa9122fb03976 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e3d7e1f539b9a336e99e91c6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 27 13:05:07 2021 +0200 gdi32: Directly use ntdll in load_system_bitmap_fonts and load_file_system_fonts. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 700a7e1c327..9132c9b6849 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -125,6 +125,18 @@ static const WCHAR software_config_keyW[] = '\\','S','o','f','t','w','a','r','e', }; +static const WCHAR fonts_config_keyW[] = +{ + '\\','R','e','g','i','s','t','r','y', + '\\','M','a','c','h','i','n','e', + '\\','S','y','s','t','e','m', + '\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t', + '\\','H','a','r','d','w','a','r','e',' ','P','r','o','f','i','l','e','s', + '\\','C','u','r','r','e','n','t', + '\\','S','o','f','t','w','a','r','e', + '\\','F','o','n','t','s' +}; + static const WCHAR fonts_win9x_config_keyW[] = { '\\','R','e','g','i','s','t','r','y', @@ -5860,19 +5872,19 @@ static BOOL remove_font_resource( LPCWSTR file, DWORD flags ) static void load_system_bitmap_fonts(void) { - static const WCHAR * const fonts[] = { L"FONTS.FON", L"OEMFONT.FON", L"FIXEDFON.FON" }; + static const char * const fonts[] = { "FONTS.FON", "OEMFONT.FON", "FIXEDFON.FON" }; + char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[MAX_PATH * sizeof(WCHAR)])]; + KEY_VALUE_PARTIAL_INFORMATION *info = (void *)value_buffer; HKEY hkey; - WCHAR data[MAX_PATH]; - DWORD i, dlen, type; + DWORD i; - if (RegOpenKeyW( HKEY_CURRENT_CONFIG, L"Software\\Fonts", &hkey )) return; + if (!(hkey = reg_open_key( NULL, fonts_config_keyW, sizeof(fonts_config_keyW) ))) return; for (i = 0; i < ARRAY_SIZE(fonts); i++) { - dlen = sizeof(data); - if (!RegQueryValueExW( hkey, fonts[i], 0, &type, (BYTE *)data, &dlen ) && type == REG_SZ) - add_system_font_resource( data, ADDFONT_ALLOW_BITMAP ); + if (query_reg_ascii_value( hkey, fonts[i], info, sizeof(value_buffer) ) && info->Type == REG_SZ) + add_system_font_resource( (const WCHAR *)info->Data, ADDFONT_ALLOW_BITMAP ); } - RegCloseKey( hkey ); + NtClose( hkey ); } static void load_directory_fonts( WCHAR *path, UINT flags ) @@ -5927,8 +5939,9 @@ static void load_directory_fonts( WCHAR *path, UINT flags ) static void load_file_system_fonts(void) { - WCHAR *ptr, *next, path[MAX_PATH + ARRAYSIZE(nt_prefixW)], value[1024]; - DWORD len = sizeof(value); + char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[1024 * sizeof(WCHAR)])]; + KEY_VALUE_PARTIAL_INFORMATION *info = (void *)value_buffer; + WCHAR *ptr, *next, path[MAX_PATH]; /* Windows directory */ get_fonts_win_dir_path( NULL, path ); @@ -5940,9 +5953,10 @@ static void load_file_system_fonts(void) /* custom paths */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts */ - if (!RegQueryValueExW( wine_fonts_key, L"Path", NULL, NULL, (BYTE *)value, &len )) + if (query_reg_ascii_value( wine_fonts_key, "Path", info, sizeof(value_buffer) ) && + info->Type == REG_SZ) { - for (ptr = value; ptr; ptr = next) + for (ptr = (WCHAR *)info->Data; ptr; ptr = next) { if ((next = wcschr( ptr, ';' ))) *next++ = 0; if (next && next - ptr < 2) continue;
1
0
0
0
Jacek Caban : gdi32: Directly use ntdll in get_associated_charset_info.
by Alexandre Julliard
27 Sep '21
27 Sep '21
Module: wine Branch: master Commit: 1262b1aeab42e5a1978bca53031b2aa295f0400d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1262b1aeab42e5a1978bca53…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Sep 27 13:04:56 2021 +0200 gdi32: Directly use ntdll in get_associated_charset_info. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 5fefa1ea01e..700a7e1c327 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -103,6 +103,17 @@ static const WCHAR system_link_keyW[] = '\\','S','y','s','t','e','m','L','i','n','k' }; +static const WCHAR associated_charset_keyW[] = +{ + '\\','R','e','g','i','s','t','r','y', + '\\','M','a','c','h','i','n','e', + '\\','S','y','s','t','e','m', + '\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t', + '\\','C','o','n','t','r','o','l', + '\\','F','o','n','t','A','s','s','o','c', + '\\','A','s','s','o','c','i','a','t','e','d',' ','C','h','a','r','s','e','t' +}; + static const WCHAR software_config_keyW[] = { '\\','R','e','g','i','s','t','r','y', @@ -4386,32 +4397,30 @@ static DWORD get_associated_charset_info(void) if (associated_charset == -1) { + char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[32 * sizeof(WCHAR)])]; + KEY_VALUE_PARTIAL_INFORMATION *info = (void *)value_buffer; HKEY hkey; - WCHAR dataW[32]; - DWORD type, data_len; + + static const WCHAR yesW[] = {'y','e','s',0}; associated_charset = 0; - if (RegOpenKeyW(HKEY_LOCAL_MACHINE, - L"System\\CurrentControlSet\\Control\\FontAssoc\\Associated Charset", &hkey)) + if (!(hkey = reg_open_key( NULL, associated_charset_keyW, sizeof(associated_charset_keyW) ))) return 0; - data_len = sizeof(dataW); - if (!RegQueryValueExW(hkey, L"ANSI(00)", NULL, &type, (LPBYTE)dataW, &data_len) && - type == REG_SZ && !wcsicmp(dataW, L"yes")) + if (query_reg_ascii_value( hkey, "ANSI(00)", info, sizeof(value_buffer) ) && + info->Type == REG_SZ && !wcsicmp( (const WCHAR *)info->Data, yesW )) associated_charset |= ASSOC_CHARSET_ANSI; - data_len = sizeof(dataW); - if (!RegQueryValueExW(hkey, L"OEM(FF)", NULL, &type, (LPBYTE)dataW, &data_len) && - type == REG_SZ && !wcsicmp(dataW, L"yes")) + if (query_reg_ascii_value( hkey, "OEM(FF)", info, sizeof(value_buffer) ) && + info->Type == REG_SZ && !wcsicmp( (const WCHAR *)info->Data, yesW )) associated_charset |= ASSOC_CHARSET_OEM; - data_len = sizeof(dataW); - if (!RegQueryValueExW(hkey, L"SYMBOL(02)", NULL, &type, (LPBYTE)dataW, &data_len) && - type == REG_SZ && !wcsicmp(dataW, L"yes")) + if (query_reg_ascii_value( hkey, "SYMBOL(02)", info, sizeof(value_buffer) ) && + info->Type == REG_SZ && !wcsicmp( (const WCHAR *)info->Data, yesW )) associated_charset |= ASSOC_CHARSET_SYMBOL; - RegCloseKey(hkey); + NtClose( hkey ); TRACE("associated_charset = %d\n", associated_charset); }
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
103
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
Results per page:
10
25
50
100
200