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
April 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
817 discussions
Start a n
N
ew thread
Alexandre Julliard : ntdll: Reimplement RtlAreBitsSet() to check 32 bits at a time.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 23ce5b8f10607c441eb7470e6df64f18fa4e18bd URL:
https://gitlab.winehq.org/wine/wine/-/commit/23ce5b8f10607c441eb7470e6df64f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 17:33:04 2023 +0200 ntdll: Reimplement RtlAreBitsSet() to check 32 bits at a time. --- dlls/ntdll/rtlbitmap.c | 73 ++++++++------------------------------------------ 1 file changed, 11 insertions(+), 62 deletions(-) diff --git a/dlls/ntdll/rtlbitmap.c b/dlls/ntdll/rtlbitmap.c index 3c3f2182a72..17a8f8b3134 100644 --- a/dlls/ntdll/rtlbitmap.c +++ b/dlls/ntdll/rtlbitmap.c @@ -164,75 +164,24 @@ void WINAPI RtlClearBits( RTL_BITMAP *bitmap, ULONG start, ULONG count) /************************************************************************* * RtlAreBitsSet [NTDLL.@] - * - * Determine if part of a bitmap is set. - * - * PARAMS - * lpBits [I] Bitmap pointer - * ulStart [I] First bit to check from - * ulCount [I] Number of consecutive bits to check - * - * RETURNS - * TRUE, If ulCount bits from ulStart are set. - * FALSE, Otherwise. */ -BOOLEAN WINAPI RtlAreBitsSet(PCRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount) +BOOLEAN WINAPI RtlAreBitsSet( const RTL_BITMAP *bitmap, ULONG start, ULONG count ) { - LPBYTE lpOut; - ULONG ulRemainder; - - TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount); - - if (!lpBits || !ulCount || - ulStart >= lpBits->SizeOfBitMap || - ulCount > lpBits->SizeOfBitMap - ulStart) - return FALSE; - - /* FIXME: It might be more efficient/cleaner to manipulate four bytes - * at a time. But beware of the pointer arithmetics... - */ - lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u); + ULONG end = start + count; + ULONG pos = start / 32; + ULONG end_pos = end / 32; - /* Check bits in first byte, if ulStart isn't a byte boundary */ - if (ulStart & 7) - { - if (ulCount > 7) - { - /* Check from start bit to the end of the byte */ - if ((*lpOut & - ((0xff << (ulStart & 7))) & 0xff) != ((0xff << (ulStart & 7) & 0xff))) - return FALSE; - lpOut++; - ulCount -= (8 - (ulStart & 7)); - } - else - { - /* Check from the start bit, possibly into the next byte also */ - USHORT initialWord = NTDLL_maskBits[ulCount] << (ulStart & 7); + TRACE( "(%p,%lu,%lu)\n", bitmap, start, count ); - if ((*lpOut & (initialWord & 0xff)) != (initialWord & 0xff)) - return FALSE; - if ((initialWord & 0xff00) && - ((lpOut[1] & (initialWord >> 8)) != (initialWord >> 8))) + if (!count || start >= bitmap->SizeOfBitMap || count > bitmap->SizeOfBitMap - start) return FALSE; - return TRUE; - } - } - /* Check bits in blocks of 8 bytes */ - ulRemainder = ulCount & 7; - ulCount >>= 3; - while (ulCount--) - { - if (*lpOut++ != 0xff) - return FALSE; - } + if (end_pos == pos) return (bitmap->Buffer[pos] | ~maskbits( start ) | maskbits( end )) == ~0u; - /* Check remaining bits, if any */ - if (ulRemainder && - (*lpOut & NTDLL_maskBits[ulRemainder]) != NTDLL_maskBits[ulRemainder]) - return FALSE; - return TRUE; + if ((bitmap->Buffer[pos++] | ~maskbits( start )) != ~0u) return FALSE; + while (pos < end_pos) if (bitmap->Buffer[pos++] != ~0u) return FALSE; + if (!(end & 31)) return TRUE; + return (bitmap->Buffer[pos] | maskbits( end )) == ~0u; } /*************************************************************************
1
0
0
0
Alexandre Julliard : ntdll: Reimplement RtlClearBits() to clear 32 bits at a time.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 500ec80e9fe574044bacc410cd96ea9009c3fe5d URL:
https://gitlab.winehq.org/wine/wine/-/commit/500ec80e9fe574044bacc410cd96ea…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 17:32:25 2023 +0200 ntdll: Reimplement RtlClearBits() to clear 32 bits at a time. --- dlls/ntdll/rtlbitmap.c | 61 +++++++++----------------------------------------- 1 file changed, 11 insertions(+), 50 deletions(-) diff --git a/dlls/ntdll/rtlbitmap.c b/dlls/ntdll/rtlbitmap.c index 4ca3df3351c..3c3f2182a72 100644 --- a/dlls/ntdll/rtlbitmap.c +++ b/dlls/ntdll/rtlbitmap.c @@ -142,63 +142,24 @@ void WINAPI RtlSetBits( RTL_BITMAP *bitmap, ULONG start, ULONG count ) /************************************************************************* * RtlClearBits [NTDLL.@] - * - * Clear bits in a bitmap. - * - * PARAMS - * lpBits [I] Bitmap pointer - * ulStart [I] First bit to set - * ulCount [I] Number of consecutive bits to clear - * - * RETURNS - * Nothing. */ -VOID WINAPI RtlClearBits(PRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount) +void WINAPI RtlClearBits( RTL_BITMAP *bitmap, ULONG start, ULONG count) { - LPBYTE lpOut; - - TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount); + ULONG end = start + count; + ULONG pos = start / 32; + ULONG end_pos = end / 32; - if (!lpBits || !ulCount || - ulStart >= lpBits->SizeOfBitMap || - ulCount > lpBits->SizeOfBitMap - ulStart) - return; + TRACE( "(%p,%lu,%lu)\n", bitmap, start, count ); - /* FIXME: It might be more efficient/cleaner to manipulate four bytes - * at a time. But beware of the pointer arithmetics... - */ - lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u); + if (!count || start >= bitmap->SizeOfBitMap || count > bitmap->SizeOfBitMap - start) return; - /* Clear bits in first byte, if ulStart isn't a byte boundary */ - if (ulStart & 7) - { - if (ulCount > 7) - { - /* Clear from start bit to the end of the byte */ - *lpOut++ &= ~(0xff << (ulStart & 7)); - ulCount -= (8 - (ulStart & 7)); - } - else + if (end_pos > pos) { - /* Clear from the start bit, possibly into the next byte also */ - USHORT initialWord = ~(NTDLL_maskBits[ulCount] << (ulStart & 7)); - - *lpOut &= (initialWord & 0xff); - if ((initialWord >> 8) != 0xff) lpOut[1] &= (initialWord >> 8); - return; + bitmap->Buffer[pos++] &= ~maskbits( start ); + while (pos < end_pos) bitmap->Buffer[pos++] = 0; + if (end & 31) bitmap->Buffer[pos] &= maskbits( end ); } - } - - /* Clear bits (in blocks of 8) on whole byte boundaries */ - if (ulCount >> 3) - { - memset(lpOut, 0, ulCount >> 3); - lpOut = lpOut + (ulCount >> 3); - } - - /* Clear remaining bits, if any */ - if (ulCount & 0x7) - *lpOut &= ~NTDLL_maskBits[ulCount & 0x7]; + else bitmap->Buffer[pos] &= ~maskbits( start ) | maskbits( end ); } /*************************************************************************
1
0
0
0
Alexandre Julliard : ntdll: Reimplement RtlSetBits() to set 32 bits at a time.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: d619a44ba6d51ba8b3befaddd2b165817ca04dfd URL:
https://gitlab.winehq.org/wine/wine/-/commit/d619a44ba6d51ba8b3befaddd2b165…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 17:31:46 2023 +0200 ntdll: Reimplement RtlSetBits() to set 32 bits at a time. --- dlls/ntdll/rtlbitmap.c | 66 ++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 50 deletions(-) diff --git a/dlls/ntdll/rtlbitmap.c b/dlls/ntdll/rtlbitmap.c index a86c234f778..4ca3df3351c 100644 --- a/dlls/ntdll/rtlbitmap.c +++ b/dlls/ntdll/rtlbitmap.c @@ -55,6 +55,11 @@ static const signed char NTDLL_mostSignificant[16] = { -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }; +static inline ULONG maskbits( ULONG idx ) +{ + return ~0u << (idx & 31); +} + /************************************************************************* * RtlInitializeBitMap [NTDLL.@] * @@ -115,63 +120,24 @@ VOID WINAPI RtlClearAllBits(PRTL_BITMAP lpBits) /************************************************************************* * RtlSetBits [NTDLL.@] - * - * Set a range of bits in a bitmap. - * - * PARAMS - * lpBits [I] Bitmap pointer - * ulStart [I] First bit to set - * ulCount [I] Number of consecutive bits to set - * - * RETURNS - * Nothing. */ -VOID WINAPI RtlSetBits(PRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount) +void WINAPI RtlSetBits( RTL_BITMAP *bitmap, ULONG start, ULONG count ) { - LPBYTE lpOut; + ULONG end = start + count; + ULONG pos = start / 32; + ULONG end_pos = end / 32; - TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount); - - if (!lpBits || !ulCount || - ulStart >= lpBits->SizeOfBitMap || - ulCount > lpBits->SizeOfBitMap - ulStart) - return; + TRACE( "(%p,%lu,%lu)\n", bitmap, start, count ); - /* FIXME: It might be more efficient/cleaner to manipulate four bytes - * at a time. But beware of the pointer arithmetics... - */ - lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u); + if (!count || start >= bitmap->SizeOfBitMap || count > bitmap->SizeOfBitMap - start) return; - /* Set bits in first byte, if ulStart isn't a byte boundary */ - if (ulStart & 7) - { - if (ulCount > 7) + if (end_pos > pos) { - /* Set from start bit to the end of the byte */ - *lpOut++ |= 0xff << (ulStart & 7); - ulCount -= (8 - (ulStart & 7)); - } - else - { - /* Set from the start bit, possibly into the next byte also */ - USHORT initialWord = NTDLL_maskBits[ulCount] << (ulStart & 7); - - *lpOut |= (initialWord & 0xff); - if (initialWord >> 8) lpOut[1] |= (initialWord >> 8); - return; + bitmap->Buffer[pos++] |= maskbits( start ); + while (pos < end_pos) bitmap->Buffer[pos++] = ~0u; + if (end & 31) bitmap->Buffer[pos] |= ~maskbits( end ); } - } - - /* Set bits up to complete byte count */ - if (ulCount >> 3) - { - memset(lpOut, 0xff, ulCount >> 3); - lpOut = lpOut + (ulCount >> 3); - } - - /* Set remaining bits, if any */ - if (ulCount & 0x7) - *lpOut |= NTDLL_maskBits[ulCount & 0x7]; + else bitmap->Buffer[pos] |= maskbits( start ) & ~maskbits( end ); } /*************************************************************************
1
0
0
0
Alexandre Julliard : kernel32: Move to a higher address on 64-bit.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: bddfa071901d0c827460a6248c559ae7e7bc8348 URL:
https://gitlab.winehq.org/wine/wine/-/commit/bddfa071901d0c827460a6248c559a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 16:09:33 2023 +0200 kernel32: Move to a higher address on 64-bit. --- dlls/kernel32/Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index cf07832226d..d606b9aba1c 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -3,7 +3,9 @@ MODULE = kernel32.dll IMPORTLIB = kernel32 IMPORTS = kernelbase ntdll winecrt0 -EXTRADLLFLAGS = -nodefaultlibs -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b600000 +EXTRADLLFLAGS = -nodefaultlibs -Wb,-F,KERNEL32.dll +i386_EXTRADLLFLAGS = -Wl,--image-base,0x7b800000 +x86_64_EXTRADLLFLAGS = -Wl,--image-base,0x178000000 C_SRCS = \ atom.c \
1
0
0
0
Alexandre Julliard : kernelbase: Move to a higher address on 64-bit.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: cab914c3aa66e26e6756c6704848265ddfcbf3a4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/cab914c3aa66e26e6756c670484826…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 16:09:19 2023 +0200 kernelbase: Move to a higher address on 64-bit. --- dlls/kernelbase/Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/kernelbase/Makefile.in b/dlls/kernelbase/Makefile.in index 38db49d7034..1f10fe8cc0b 100644 --- a/dlls/kernelbase/Makefile.in +++ b/dlls/kernelbase/Makefile.in @@ -3,7 +3,9 @@ MODULE = kernelbase.dll IMPORTLIB = kernelbase IMPORTS = uuid ntdll winecrt0 -EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--image-base,0x7b000000 +EXTRADLLFLAGS = -nodefaultlibs -nostartfiles +i386_EXTRADLLFLAGS = -Wl,--image-base,0x7b000000 +x86_64_EXTRADLLFLAGS = -Wl,--image-base,0x174000000 C_SRCS = \ console.c \
1
0
0
0
Davide Beatrici : winepulse: Implement functions to lock and unlock sessions.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 5a9adc1f289aee92b2901bd0b1bd50d7130a1c6a URL:
https://gitlab.winehq.org/wine/wine/-/commit/5a9adc1f289aee92b2901bd0b1bd50…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Apr 21 23:12:12 2023 +0200 winepulse: Implement functions to lock and unlock sessions. --- dlls/winepulse.drv/mmdevdrv.c | 64 +++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 7f1dbb765cf..12d67c45c4f 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -83,6 +83,16 @@ static CRITICAL_SECTION_DEBUG session_cs_debug = { }; static CRITICAL_SECTION session_cs = { &session_cs_debug, -1, 0, 0, 0, 0 }; +static void sessions_lock(void) +{ + EnterCriticalSection(&session_cs); +} + +static void sessions_unlock(void) +{ + LeaveCriticalSection(&session_cs); +} + BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { if (reason == DLL_PROCESS_ATTACH) { @@ -601,9 +611,9 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) if (This->stream) { pulse_release_stream(This->stream, This->timer_thread); This->stream = 0; - EnterCriticalSection(&session_cs); + sessions_lock(); list_remove(&This->entry); - LeaveCriticalSection(&session_cs); + sessions_unlock(); } IUnknown_Release(This->marshal); IMMDevice_Release(This->parent); @@ -784,10 +794,10 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, return E_INVALIDARG; } - EnterCriticalSection(&session_cs); + sessions_lock(); if (This->stream) { - LeaveCriticalSection(&session_cs); + sessions_unlock(); return AUDCLNT_E_ALREADY_INITIALIZED; } @@ -797,7 +807,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, if (!(pulse_thread = CreateThread(NULL, 0, pulse_mainloop_thread, event, 0, NULL))) { ERR("Failed to create mainloop thread.\n"); - LeaveCriticalSection(&session_cs); + sessions_unlock(); CloseHandle(event); return E_FAIL; } @@ -820,14 +830,14 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, free(name); if (FAILED(hr = params.result)) { - LeaveCriticalSection(&session_cs); + sessions_unlock(); return hr; } if (!(This->vols = malloc(channel_count * sizeof(*This->vols)))) { pulse_release_stream(stream, NULL); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return E_OUTOFMEMORY; } for (i = 0; i < channel_count; i++) @@ -838,7 +848,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, { free(This->vols); This->vols = NULL; - LeaveCriticalSection(&session_cs); + sessions_unlock(); pulse_release_stream(stream, NULL); return E_OUTOFMEMORY; } @@ -848,7 +858,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, list_add_tail(&This->session->clients, &This->entry); set_stream_volumes(This); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -1771,12 +1781,12 @@ static HRESULT WINAPI AudioStreamVolume_SetAllVolumes( if (count != This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&session_cs); + sessions_lock(); for (i = 0; i < count; ++i) This->vols[i] = levels[i]; set_stream_volumes(This); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -1796,10 +1806,10 @@ static HRESULT WINAPI AudioStreamVolume_GetAllVolumes( if (count != This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&session_cs); + sessions_lock(); for (i = 0; i < count; ++i) levels[i] = This->vols[i]; - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -1818,10 +1828,10 @@ static HRESULT WINAPI AudioStreamVolume_SetChannelVolume( if (index >= This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&session_cs); + sessions_lock(); This->vols[index] = level; set_stream_volumes(This); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -1840,9 +1850,9 @@ static HRESULT WINAPI AudioStreamVolume_GetChannelVolume( if (index >= This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&session_cs); + sessions_lock(); *level = This->vols[index]; - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -1940,7 +1950,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, if (!state) return NULL_PTR_ERR; - EnterCriticalSection(&session_cs); + sessions_lock(); if (list_empty(&This->session->clients)) { *state = AudioSessionStateExpired; goto out; @@ -1961,7 +1971,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, *state = AudioSessionStateInactive; out: - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -2172,11 +2182,11 @@ static HRESULT WINAPI SimpleAudioVolume_SetMasterVolume( TRACE("PulseAudio does not support session volume control\n"); - EnterCriticalSection(&session_cs); + sessions_lock(); session->master_vol = level; LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -2209,11 +2219,11 @@ static HRESULT WINAPI SimpleAudioVolume_SetMute(ISimpleAudioVolume *iface, if (context) FIXME("Notifications not supported yet\n"); - EnterCriticalSection(&session_cs); + sessions_lock(); session->mute = mute; LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -2316,11 +2326,11 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( TRACE("PulseAudio does not support session volume control\n"); - EnterCriticalSection(&session_cs); + sessions_lock(); session->channel_vols[index] = level; LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; } @@ -2367,12 +2377,12 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( TRACE("PulseAudio does not support session volume control\n"); - EnterCriticalSection(&session_cs); + sessions_lock(); for(i = 0; i < count; ++i) session->channel_vols[i] = levels[i]; LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&session_cs); + sessions_unlock(); return S_OK; }
1
0
0
0
Davide Beatrici : wineoss: Implement functions to lock and unlock sessions.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 04914b5cd1343bedda00fb84751ab1409b8155b5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/04914b5cd1343bedda00fb84751ab1…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Apr 21 23:11:52 2023 +0200 wineoss: Implement functions to lock and unlock sessions. --- dlls/wineoss.drv/mmdevdrv.c | 86 +++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 38 deletions(-)
1
0
0
0
Davide Beatrici : winecoreaudio: Implement functions to lock and unlock sessions.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 4aeef7e6132474d418dcddabcc5c21df2ecb71b5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4aeef7e6132474d418dcddabcc5c21…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Apr 21 23:11:32 2023 +0200 winecoreaudio: Implement functions to lock and unlock sessions. --- dlls/winecoreaudio.drv/mmdevdrv.c | 66 ++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 21c2528cab1..0ec1fc63c60 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -75,6 +75,16 @@ static struct list g_sessions = LIST_INIT(g_sessions); static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client); +static void sessions_lock(void) +{ + EnterCriticalSection(&g_sessions_lock); +} + +static void sessions_unlock(void) +{ + LeaveCriticalSection(&g_sessions_lock); +} + static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface) { return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface); @@ -452,9 +462,9 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) UNIX_CALL(release_stream, ¶ms); This->stream = 0; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); list_remove(&This->entry); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); } HeapFree(GetProcessHeap(), 0, This->vols); IMMDevice_Release(This->parent); @@ -641,10 +651,10 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, } } - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(This->stream){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return AUDCLNT_E_ALREADY_INITIALIZED; } @@ -661,7 +671,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, UNIX_CALL(create_stream, ¶ms); if(FAILED(params.result)){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return params.result; } @@ -692,7 +702,7 @@ end: set_stream_volumes(This, -1); } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return params.result; } @@ -934,7 +944,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, if(!This->stream) return AUDCLNT_E_NOT_INITIALIZED; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(IsEqualIID(riid, &IID_IAudioRenderClient)){ if(This->dataflow != eRender){ @@ -998,7 +1008,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, } end: - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return hr; } @@ -1492,7 +1502,7 @@ static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); ULONG ref; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); ref = InterlockedDecrement(&This->ref); TRACE("(%p) Refcount now %lu\n", This, ref); @@ -1504,7 +1514,7 @@ static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) HeapFree(GetProcessHeap(), 0, This); } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return ref; } @@ -1520,11 +1530,11 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, if(!state) return NULL_PTR_ERR; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(list_empty(&This->session->clients)){ *state = AudioSessionStateExpired; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1533,12 +1543,12 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, UNIX_CALL(is_started, ¶ms); if(params.result == S_OK){ *state = AudioSessionStateActive; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); *state = AudioSessionStateInactive; @@ -1750,14 +1760,14 @@ static HRESULT WINAPI SimpleAudioVolume_SetMasterVolume( if(context) FIXME("Notifications not supported yet\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); session->master_vol = level; LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client, -1); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1790,14 +1800,14 @@ static HRESULT WINAPI SimpleAudioVolume_SetMute(ISimpleAudioVolume *iface, if(context) FIXME("Notifications not supported yet\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); session->mute = mute; LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client, -1); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1890,14 +1900,14 @@ static HRESULT WINAPI AudioStreamVolume_SetChannelVolume( if(index >= This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); This->vols[index] = level; WARN("CoreAudio doesn't support per-channel volume control\n"); set_stream_volumes(This, index); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1934,14 +1944,14 @@ static HRESULT WINAPI AudioStreamVolume_SetAllVolumes( if(count != This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); for(i = 0; i < count; ++i) This->vols[i] = levels[i]; set_stream_volumes(This, -1); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1960,12 +1970,12 @@ static HRESULT WINAPI AudioStreamVolume_GetAllVolumes( if(count != This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); for(i = 0; i < count; ++i) levels[i] = This->vols[i]; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -2051,7 +2061,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( if(context) FIXME("Notifications not supported yet\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); session->channel_vols[index] = level; @@ -2059,7 +2069,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client, index); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -2104,7 +2114,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( if(context) FIXME("Notifications not supported yet\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); for(i = 0; i < count; ++i) session->channel_vols[i] = levels[i]; @@ -2112,7 +2122,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client, -1); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; }
1
0
0
0
Davide Beatrici : winealsa: Implement functions to lock and unlock sessions.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: bebe0f7ee0c5b404fc625377e2b033962d893c6c URL:
https://gitlab.winehq.org/wine/wine/-/commit/bebe0f7ee0c5b404fc625377e2b033…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Fri Apr 21 23:11:12 2023 +0200 winealsa: Implement functions to lock and unlock sessions. --- dlls/winealsa.drv/mmdevdrv.c | 86 ++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index c46ae41f48b..049abd53f41 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -81,6 +81,16 @@ static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client); +static void sessions_lock(void) +{ + EnterCriticalSection(&g_sessions_lock); +} + +static void sessions_unlock(void) +{ + LeaveCriticalSection(&g_sessions_lock); +} + static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface) { return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface); @@ -480,9 +490,9 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) IMMDevice_Release(This->parent); IUnknown_Release(This->marshal); if(This->session){ - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); list_remove(&This->entry); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); } HeapFree(GetProcessHeap(), 0, This->vols); if (This->stream) @@ -666,10 +676,10 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, } } - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(This->stream){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return AUDCLNT_E_ALREADY_INITIALIZED; } @@ -688,7 +698,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, ALSA_CALL(create_stream, ¶ms); if(FAILED(params.result)){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return params.result; } @@ -718,7 +728,7 @@ exit: set_stream_volumes(This); } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return params.result; } @@ -876,10 +886,10 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) TRACE("(%p)\n", This); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(!This->stream){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return AUDCLNT_E_NOT_INITIALIZED; } @@ -892,7 +902,7 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return params.result; } @@ -964,23 +974,23 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, return E_POINTER; *ppv = NULL; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(!This->stream){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return AUDCLNT_E_NOT_INITIALIZED; } if(IsEqualIID(riid, &IID_IAudioRenderClient)){ if(This->dataflow != eRender){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return AUDCLNT_E_WRONG_ENDPOINT_TYPE; } IAudioRenderClient_AddRef(&This->IAudioRenderClient_iface); *ppv = &This->IAudioRenderClient_iface; }else if(IsEqualIID(riid, &IID_IAudioCaptureClient)){ if(This->dataflow != eCapture){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return AUDCLNT_E_WRONG_ENDPOINT_TYPE; } IAudioCaptureClient_AddRef(&This->IAudioCaptureClient_iface); @@ -995,7 +1005,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, if(!This->session_wrapper){ This->session_wrapper = AudioSessionWrapper_Create(This); if(!This->session_wrapper){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return E_OUTOFMEMORY; } }else @@ -1006,7 +1016,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, if(!This->session_wrapper){ This->session_wrapper = AudioSessionWrapper_Create(This); if(!This->session_wrapper){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return E_OUTOFMEMORY; } }else @@ -1017,7 +1027,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, if(!This->session_wrapper){ This->session_wrapper = AudioSessionWrapper_Create(This); if(!This->session_wrapper){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return E_OUTOFMEMORY; } }else @@ -1027,11 +1037,11 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, } if(*ppv){ - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); FIXME("stub %s\n", debugstr_guid(riid)); return E_NOINTERFACE; @@ -1545,9 +1555,9 @@ static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) TRACE("(%p) Refcount now %lu\n", This, ref); if(!ref){ if(This->client){ - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); This->client->session_wrapper = NULL; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); AudioClient_Release(&This->client->IAudioClient3_iface); } HeapFree(GetProcessHeap(), 0, This); @@ -1567,11 +1577,11 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, if(!state) return NULL_PTR_ERR; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); if(list_empty(&This->session->clients)){ *state = AudioSessionStateExpired; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1580,12 +1590,12 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, ALSA_CALL(is_started, ¶ms); if(params.result == S_OK){ *state = AudioSessionStateActive; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } } - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); *state = AudioSessionStateInactive; @@ -1799,14 +1809,14 @@ static HRESULT WINAPI SimpleAudioVolume_SetMasterVolume( TRACE("ALSA does not support volume control\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); session->master_vol = level; LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1839,13 +1849,13 @@ static HRESULT WINAPI SimpleAudioVolume_SetMute(ISimpleAudioVolume *iface, if(context) FIXME("Notifications not supported yet\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); session->mute = mute; LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1940,12 +1950,12 @@ static HRESULT WINAPI AudioStreamVolume_SetChannelVolume( TRACE("ALSA does not support volume control\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); This->vols[index] = level; set_stream_volumes(This); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -1984,13 +1994,13 @@ static HRESULT WINAPI AudioStreamVolume_SetAllVolumes( TRACE("ALSA does not support volume control\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); for(i = 0; i < count; ++i) This->vols[i] = levels[i]; set_stream_volumes(This); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -2009,12 +2019,12 @@ static HRESULT WINAPI AudioStreamVolume_GetAllVolumes( if(count != This->channel_count) return E_INVALIDARG; - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); for(i = 0; i < count; ++i) levels[i] = This->vols[i]; - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -2102,14 +2112,14 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( TRACE("ALSA does not support volume control\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); session->channel_vols[index] = level; LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; } @@ -2156,7 +2166,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( TRACE("ALSA does not support volume control\n"); - EnterCriticalSection(&g_sessions_lock); + sessions_lock(); for(i = 0; i < count; ++i) session->channel_vols[i] = levels[i]; @@ -2164,7 +2174,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) set_stream_volumes(client); - LeaveCriticalSection(&g_sessions_lock); + sessions_unlock(); return S_OK; }
1
0
0
0
Piotr Caban : gdi32/tests: Add EMF palette tests.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 28df39908a7091143e38dd5a474ccd6448aba586 URL:
https://gitlab.winehq.org/wine/wine/-/commit/28df39908a7091143e38dd5a474ccd…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Apr 21 22:16:44 2023 +0200 gdi32/tests: Add EMF palette tests. --- dlls/gdi32/tests/metafile.c | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index 2b7e53b2529..0e5da463f7f 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -4802,6 +4802,83 @@ static void test_mf_palette(void) ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError()); } +static void test_emf_palette(void) +{ + char logpalettebuf[sizeof(LOGPALETTE) + sizeof(logpalettedata)]; + LOGPALETTE *logpalette = (PLOGPALETTE)logpalettebuf; + HPALETTE hpal, old_pal, def_pal; + HENHMETAFILE emf; + HDC hdc; + BOOL ret; + + static const unsigned char palette_bits[] = + { + 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe6, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff, + 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00, + 0xf0, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x80, 0x07, 0x00, 0x00, 0xcd, 0x03, 0x00, 0x00, + 0xfc, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00, + 0x9f, 0xed, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x03, 0x08, 0x00, 0x10, 0x20, 0x30, 0x00, + 0x20, 0x30, 0x40, 0x00, 0x30, 0x40, 0x50, 0x00, + 0x40, 0x50, 0x60, 0x00, 0x50, 0x60, 0x70, 0x00, + 0x60, 0x70, 0x80, 0x00, 0x70, 0x80, 0x90, 0x00, + 0x80, 0x90, 0xa0, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x10, 0x20, 0x30, 0x00, + 0x20, 0x30, 0x40, 0x00, 0x30, 0x40, 0x50, 0x00, + 0x40, 0x50, 0x60, 0x00, 0x50, 0x60, 0x70, 0x00, + 0x60, 0x70, 0x80, 0x00, 0x70, 0x80, 0x90, 0x00, + 0x80, 0x90, 0xa0, 0x00, 0x34, 0x00, 0x00, 0x00 + }; + + hdc = CreateEnhMetaFileA(NULL, NULL, NULL, NULL); + ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError()); + + /* Initialize the logical palette with a few colours */ + logpalette->palVersion = 0x300; + logpalette->palNumEntries = ARRAY_SIZE(logpalettedata); + memcpy(logpalette->palPalEntry, logpalettedata, sizeof(logpalettedata)); + hpal = CreatePalette(logpalette); + old_pal = SelectPalette(hdc, hpal, FALSE); + def_pal = GetStockObject(DEFAULT_PALETTE); + ok(old_pal == def_pal, "old_pal=%p, expected %p\n", old_pal, def_pal); + + ret = RealizePalette(hdc); + ok(!ret, "RealizePalette returned %d\n", ret); + + old_pal = SelectPalette(hdc, GetStockObject(DEFAULT_PALETTE), FALSE); + ok(old_pal == hpal, "old_pal=%p, expected %p\n", old_pal, hpal); + + ret = RealizePalette(hdc); + ok(!ret, "RealizePalette returned %d\n", ret); + + emf = CloseEnhMetaFile(hdc); + ok(emf != 0, "CloseEnhMetaFile error %ld\n", GetLastError()); + + if (compare_emf_bits(emf, palette_bits, sizeof(palette_bits), "emf_palette", FALSE)) + { + dump_emf_bits(emf, "emf_palette"); + dump_emf_records(emf, "emf_palette"); + } + + ret = DeleteEnhMetaFile(emf); + ok(ret, "DeleteMetaFile error %ld\n", GetLastError()); +} + static void test_mf_blit(void) { BITMAPINFO bmi = {{ sizeof(bmi) }}; @@ -10670,6 +10747,7 @@ START_TEST(metafile) test_emf_mask_blit(); test_emf_StretchDIBits(); test_emf_SetDIBitsToDevice(); + test_emf_palette(); /* For win-format metafiles (mfdrv) */ test_mf_SaveDC();
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
82
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
Results per page:
10
25
50
100
200