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
June 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
791 discussions
Start a n
N
ew thread
Rémi Bernon : ntdll: Fix handling of free blocks in RtlWalkHeap.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: e3acf755e125d906bf5166a1a35e349e21e8c77b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e3acf755e125d906bf5166a1…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Jun 1 22:25:56 2022 +0200 ntdll: Fix handling of free blocks in RtlWalkHeap. The entry lpData pointer isn't a block but a pointer to the block data, which has a different offset for free blocks and used blocks. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 00b4cd7e894..f03d0ad4a53 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -1782,11 +1782,15 @@ static NTSTATUS heap_walk_blocks( const HEAP *heap, const SUBHEAP *subheap, stru { const char *base = subheap_base( subheap ), *commit_end = subheap_commit_end( subheap ), *end = base + subheap_size( subheap ); const struct block *block, *blocks = first_block( subheap ); + char *data = entry->lpData; if (entry->lpData == commit_end) return STATUS_NO_MORE_ENTRIES; + if (entry->wFlags & RTL_HEAP_ENTRY_BUSY) block = (struct block *)data - 1; + else block = (struct block *)(data - sizeof(struct list)) - 1; + if (entry->lpData == base) block = blocks; - else if (!(block = next_block( subheap, (struct block *)entry->lpData - 1 ))) + else if (!(block = next_block( subheap, block ))) { entry->lpData = (void *)commit_end; entry->cbData = end - commit_end; @@ -1802,8 +1806,8 @@ static NTSTATUS heap_walk_blocks( const HEAP *heap, const SUBHEAP *subheap, stru entry->cbData = block_get_size( block ) - block_get_overhead( block ); /* FIXME: last free block should not include uncommitted range, which also has its own overhead */ if (!contains( blocks, commit_end - (char *)blocks, block, block_get_size( block ) )) - entry->cbData = commit_end - (char *)entry->lpData - 8 * sizeof(void *); - entry->cbOverhead = 4 * sizeof(void *); + entry->cbData = commit_end - (char *)entry->lpData - 4 * ALIGNMENT; + entry->cbOverhead = 2 * ALIGNMENT; entry->iRegionIndex = 0; entry->wFlags = 0; }
1
0
0
0
Rémi Bernon : kernelbase: Convert RtlWalkHeap structure on input too.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: 9af87e2c644ae49e65e2bac446339dd92a77bc08 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9af87e2c644ae49e65e2bac4…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Jun 1 22:08:34 2022 +0200 kernelbase: Convert RtlWalkHeap structure on input too. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/kernelbase/memory.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index 9490626a40a..cac456d01be 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -640,9 +640,24 @@ struct rtl_heap_entry */ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry ) { - struct rtl_heap_entry rtl_entry = {.lpData = entry->lpData}; + struct rtl_heap_entry rtl_entry = {0}; NTSTATUS status; + if (!entry) return set_ntstatus( STATUS_INVALID_PARAMETER ); + + rtl_entry.lpData = entry->lpData; + rtl_entry.cbData = entry->cbData; + rtl_entry.cbOverhead = entry->cbOverhead; + rtl_entry.iRegionIndex = entry->iRegionIndex; + + if (entry->wFlags & PROCESS_HEAP_ENTRY_BUSY) + rtl_entry.wFlags |= RTL_HEAP_ENTRY_BUSY; + if (entry->wFlags & PROCESS_HEAP_REGION) + rtl_entry.wFlags |= RTL_HEAP_ENTRY_REGION; + if (entry->wFlags & PROCESS_HEAP_UNCOMMITTED_RANGE) + rtl_entry.wFlags |= RTL_HEAP_ENTRY_UNCOMMITTED; + memcpy( &rtl_entry.Region, &entry->u.Region, sizeof(entry->u.Region) ); + if (!(status = RtlWalkHeap( heap, &rtl_entry ))) { entry->lpData = rtl_entry.lpData;
1
0
0
0
Jacek Caban : include: Provide iswspace, wcstol and wcstoul in unixlib.h.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: b49dd456fafae254d79f59d141eb10011ba21005 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b49dd456fafae254d79f59d1…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 2 14:25:38 2022 +0200 include: Provide iswspace, wcstol and wcstoul in unixlib.h. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/win32u/win32u_private.h | 95 ---------------------------------------- dlls/winex11.drv/x11drv.h | 50 --------------------- include/wine/unixlib.h | 101 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 145 deletions(-) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 2d69cbef78e..053fb25fe36 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -525,99 +525,6 @@ static inline WCHAR win32u_towupper( WCHAR ch ) return RtlUpcaseUnicodeChar( ch ); } -static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base ) -{ - BOOL negative = FALSE, empty = TRUE; - LONG ret = 0; - - if (base < 0 || base == 1 || base > 36) return 0; - if (end) *end = (WCHAR *)s; - while (*s == ' ' || *s == '\t') s++; - - if (*s == '-') - { - negative = TRUE; - s++; - } - else if (*s == '+') s++; - - if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) - { - base = 16; - s += 2; - } - if (base == 0) base = s[0] != '0' ? 10 : 8; - - while (*s) - { - int v; - - if ('0' <= *s && *s <= '9') v = *s - '0'; - else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; - else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; - else break; - if (v >= base) break; - if (negative) v = -v; - s++; - empty = FALSE; - - if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v)) - ret = MAXLONG; - else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v))) - ret = MINLONG; - else - ret = ret * base + v; - } - - if (end && !empty) *end = (WCHAR *)s; - return ret; -} - -static inline ULONG win32u_wcstoul( const WCHAR *s, WCHAR **end, int base ) -{ - BOOL negative = FALSE, empty = TRUE; - ULONG ret = 0; - - if (base < 0 || base == 1 || base > 36) return 0; - if (end) *end = (WCHAR *)s; - while (*s == ' ' || *s == '\t') s++; - - if (*s == '-') - { - negative = TRUE; - s++; - } - else if (*s == '+') s++; - - if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) - { - base = 16; - s += 2; - } - if (base == 0) base = s[0] != '0' ? 10 : 8; - - while (*s) - { - int v; - - if ('0' <= *s && *s <= '9') v = *s - '0'; - else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; - else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; - else break; - if (v >= base) break; - s++; - empty = FALSE; - - if (ret > MAXDWORD / base || ret * base > MAXDWORD - v) - ret = MAXDWORD; - else - ret = ret * base + v; - } - - if (end && !empty) *end = (WCHAR *)s; - return negative ? -ret : ret; -} - extern CPTABLEINFO ansi_cp DECLSPEC_HIDDEN; DWORD win32u_mbtowc( CPTABLEINFO *info, WCHAR *dst, DWORD dstlen, const char *src, @@ -643,8 +550,6 @@ static inline WCHAR *towstr( const char *str ) #define towupper(c) win32u_towupper(c) #define wcsdup(s) win32u_wcsdup(s) -#define wcstol(s,e,b) win32u_wcstol(s,e,b) -#define wcstoul(s,e,b) win32u_wcstoul(s,e,b) static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 307932b0bf0..003604cd97d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -928,54 +928,4 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src ) return (p - dst) * sizeof(WCHAR); } -static inline LONG x11drv_wcstol( LPCWSTR s, LPWSTR *end, INT base ) -{ - BOOL negative = FALSE, empty = TRUE; - LONG ret = 0; - - if (base < 0 || base == 1 || base > 36) return 0; - if (end) *end = (WCHAR *)s; - while (*s == ' ' || *s == '\t') s++; - - if (*s == '-') - { - negative = TRUE; - s++; - } - else if (*s == '+') s++; - - if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) - { - base = 16; - s += 2; - } - if (base == 0) base = s[0] != '0' ? 10 : 8; - - while (*s) - { - int v; - - if ('0' <= *s && *s <= '9') v = *s - '0'; - else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; - else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; - else break; - if (v >= base) break; - if (negative) v = -v; - s++; - empty = FALSE; - - if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v)) - ret = MAXLONG; - else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v))) - ret = MINLONG; - else - ret = ret * base + v; - } - - if (end && !empty) *end = (WCHAR *)s; - return ret; -} - -#define wcstol x11drv_wcstol - #endif /* __WINE_X11DRV_H */ diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h index a7cfb8f6cab..ef60b32184c 100644 --- a/include/wine/unixlib.h +++ b/include/wine/unixlib.h @@ -84,6 +84,11 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void /* wide char string functions */ +static inline int ntdll_iswspace( WCHAR wc ) +{ + return ('\t' <= wc && wc <= '\r') || wc == ' ' || wc == 0xa0; +} + static inline size_t ntdll_wcslen( const WCHAR *str ) { const WCHAR *s = str; @@ -150,6 +155,100 @@ static inline SIZE_T ntdll_wcscspn( const WCHAR *str, const WCHAR *reject ) return ptr - str; } +static inline LONG ntdll_wcstol( const WCHAR *s, WCHAR **end, int base ) +{ + BOOL negative = FALSE, empty = TRUE; + LONG ret = 0; + + if (base < 0 || base == 1 || base > 36) return 0; + if (end) *end = (WCHAR *)s; + while (ntdll_iswspace(*s)) s++; + + if (*s == '-') + { + negative = TRUE; + s++; + } + else if (*s == '+') s++; + + if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) + { + base = 16; + s += 2; + } + if (base == 0) base = s[0] != '0' ? 10 : 8; + + while (*s) + { + int v; + + if ('0' <= *s && *s <= '9') v = *s - '0'; + else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; + else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; + else break; + if (v >= base) break; + if (negative) v = -v; + s++; + empty = FALSE; + + if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v)) + ret = MAXLONG; + else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v))) + ret = MINLONG; + else + ret = ret * base + v; + } + + if (end && !empty) *end = (WCHAR *)s; + return ret; +} + +static inline ULONG ntdll_wcstoul( const WCHAR *s, WCHAR **end, int base ) +{ + BOOL negative = FALSE, empty = TRUE; + ULONG ret = 0; + + if (base < 0 || base == 1 || base > 36) return 0; + if (end) *end = (WCHAR *)s; + while (ntdll_iswspace(*s)) s++; + + if (*s == '-') + { + negative = TRUE; + s++; + } + else if (*s == '+') s++; + + if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) + { + base = 16; + s += 2; + } + if (base == 0) base = s[0] != '0' ? 10 : 8; + + while (*s) + { + int v; + + if ('0' <= *s && *s <= '9') v = *s - '0'; + else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; + else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; + else break; + if (v >= base) break; + s++; + empty = FALSE; + + if (ret > MAXDWORD / base || ret * base > MAXDWORD - v) + ret = MAXDWORD; + else + ret = ret * base + v; + } + + if (end && !empty) *end = (WCHAR *)s; + return negative ? -ret : ret; +} + +#define iswspace(ch) ntdll_iswspace(ch) #define wcslen(str) ntdll_wcslen(str) #define wcscpy(dst,src) ntdll_wcscpy(dst,src) #define wcscat(dst,src) ntdll_wcscat(dst,src) @@ -162,6 +261,8 @@ static inline SIZE_T ntdll_wcscspn( const WCHAR *str, const WCHAR *reject ) #define wcscspn(str,rej) ntdll_wcscspn(str,rej) #define wcsicmp(s1, s2) ntdll_wcsicmp(s1,s2) #define wcsnicmp(s1, s2,n) ntdll_wcsnicmp(s1,s2,n) +#define wcstol(str,e,b) ntdll_wcstol(str,e,b) +#define wcstoul(str,e,b) ntdll_wcstoul(str,e,b) #endif /* WINE_UNIX_LIB */
1
0
0
0
Jactry Zeng : win32u/clipboard: Set handle of bitmap and palette as system object.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: f30332fe5eaa6d05ec1491702fd4424cf29bd7dd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f30332fe5eaa6d05ec149170…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Sun May 29 02:25:01 2022 -0500 win32u/clipboard: Set handle of bitmap and palette as system object. Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> --- dlls/user32/tests/clipboard.c | 6 +++--- dlls/win32u/clipboard.c | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 537b714a6ac..e05de29805e 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -2032,7 +2032,7 @@ static void test_data_handles(void) memset( &bmi, 0, sizeof(bmi) ); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); result = GetDIBits( hdc, h, 0, 0, NULL, &bmi, 0 ); - todo_wine ok( !!result, "GetDIBits failed: %#lx.\n", GetLastError() ); + ok( !!result, "GetDIBits failed: %#lx.\n", GetLastError() ); bitmap = CreateBitmap( 10, 10, 1, 1, NULL ); h = SetClipboardData( CF_DSPBITMAP, bitmap ); @@ -2050,8 +2050,8 @@ static void test_data_handles(void) ok( !!DeleteObject( palette ), "DeleteObject failed.\n" ); h = GetClipboardData( CF_PALETTE ); ok( h == palette, "Expected palette %p, got %p.\n", palette, h ); - todo_wine ok( !!GetPaletteEntries( h, 0, 1, &entry ), "GetPaletteEntries %p failed.\n", h ); - todo_wine ok( entry.peRed == 0x12 && entry.peGreen == 0x34 && entry.peBlue == 0x56, + ok( !!GetPaletteEntries( h, 0, 1, &entry ), "GetPaletteEntries %p failed.\n", h ); + ok( entry.peRed == 0x12 && entry.peGreen == 0x34 && entry.peBlue == 0x56, "Got wrong color (%02x, %02x, %02x).\n", entry.peRed, entry.peGreen, entry.peBlue ); emf = create_emf(); diff --git a/dlls/win32u/clipboard.c b/dlls/win32u/clipboard.c index 67bdd0ba391..0ddbc62f444 100644 --- a/dlls/win32u/clipboard.c +++ b/dlls/win32u/clipboard.c @@ -31,6 +31,7 @@ #include "ntstatus.h" #define WIN32_NO_STATUS #include "win32u_private.h" +#include "ntgdi_private.h" #include "ntuser_private.h" #include "wine/server.h" #include "wine/debug.h" @@ -112,8 +113,9 @@ static void free_cached_data( struct cached_format *cache ) switch (cache->format) { case CF_BITMAP: - case CF_DSPBITMAP: case CF_PALETTE: + make_gdi_object_system( cache->handle, FALSE ); + case CF_DSPBITMAP: NtGdiDeleteObjectApp( cache->handle ); break; @@ -595,6 +597,11 @@ NTSTATUS WINAPI NtUserSetClipboardData( UINT format, HANDLE data, struct set_cli cache->format = format; cache->handle = data; } + + if (format == CF_BITMAP || format == CF_PALETTE) + { + make_gdi_object_system( cache->handle, TRUE ); + } } pthread_mutex_lock( &clipboard_mutex );
1
0
0
0
Jactry Zeng : user32/tests: Add more tests of SetClipboardData().
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: e743f02010917bbb666197d76aa272fd0741000c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e743f02010917bbb666197d7…
Author: Jactry Zeng <jzeng(a)codeweavers.com> Date: Sun May 29 02:11:00 2022 -0500 user32/tests: Add more tests of SetClipboardData(). Signed-off-by: Jactry Zeng <jzeng(a)codeweavers.com> --- dlls/user32/tests/clipboard.c | 81 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 3053de398f9..537b714a6ac 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -1897,10 +1897,15 @@ static void test_data_handles(void) { BOOL r; char *ptr; - HANDLE h, text; + HANDLE h, text, metafile; HWND hwnd = CreateWindowA( "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL ); BITMAPINFO bmi; void *bits; + PALETTEENTRY entry; + BYTE buffer[1024]; + HENHMETAFILE emf; + int result; + HDC hdc = GetDC( 0 ); ok( hwnd != 0, "window creation failed\n" ); format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" ); @@ -2013,6 +2018,80 @@ static void test_data_handles(void) r = CloseClipboard(); ok( r, "gle %ld\n", GetLastError() ); + r = open_clipboard( hwnd ); + ok( r, "Open clipboard failed: %#lx.\n", GetLastError() ); + r = EmptyClipboard(); + ok( r, "EmptyClipboard failed: %#lx.\n", GetLastError() ); + + bitmap = CreateBitmap( 10, 10, 1, 1, NULL ); + h = SetClipboardData( CF_BITMAP, bitmap ); + ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h ); + ok( !!DeleteObject( bitmap ), "DeleteObject failed.\n" ); + h = GetClipboardData( CF_BITMAP ); + ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h ); + memset( &bmi, 0, sizeof(bmi) ); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + result = GetDIBits( hdc, h, 0, 0, NULL, &bmi, 0 ); + todo_wine ok( !!result, "GetDIBits failed: %#lx.\n", GetLastError() ); + + bitmap = CreateBitmap( 10, 10, 1, 1, NULL ); + h = SetClipboardData( CF_DSPBITMAP, bitmap ); + ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h ); + ok( !!DeleteObject( bitmap ), "DeleteObject failed.\n" ); + h = GetClipboardData( CF_DSPBITMAP ); + ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h ); + memset( &bmi, 0, sizeof(bmi) ); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + ok( !GetDIBits( hdc, h, 0, 0, 0, &bmi, 0 ), "GetDIBits returned unexpected value.\n" ); + + palette = CreatePalette( &logpalette ); + h = SetClipboardData( CF_PALETTE, palette ); + ok( h == palette, "Expected palette %p, got %p.\n", palette, h ); + ok( !!DeleteObject( palette ), "DeleteObject failed.\n" ); + h = GetClipboardData( CF_PALETTE ); + ok( h == palette, "Expected palette %p, got %p.\n", palette, h ); + todo_wine ok( !!GetPaletteEntries( h, 0, 1, &entry ), "GetPaletteEntries %p failed.\n", h ); + todo_wine ok( entry.peRed == 0x12 && entry.peGreen == 0x34 && entry.peBlue == 0x56, + "Got wrong color (%02x, %02x, %02x).\n", entry.peRed, entry.peGreen, entry.peBlue ); + + emf = create_emf(); + h = SetClipboardData( CF_ENHMETAFILE, emf ); + ok( h == emf, "Expected enhmetafile %p, got %p.\n", palette, h ); + ok( !!DeleteEnhMetaFile( emf ), "DeleteEnhMetaFile failed.\n" ); + h = GetClipboardData( CF_ENHMETAFILE ); + ok( h == emf, "Expected enhmetafile %p, got %p.\n", palette, h ); + ok( !GetEnhMetaFileBits( h, sizeof(buffer), buffer ), "GetEnhMetaFileBits returned unexpected value.\n" ); + + emf = create_emf(); + h = SetClipboardData( CF_DSPENHMETAFILE, emf ); + ok( h == emf, "Expected enhmetafile %p, got %p.\n", emf, h ); + ok( !!DeleteEnhMetaFile( emf ), "DeleteEnhMetaFile failed.\n" ); + h = GetClipboardData( CF_DSPENHMETAFILE ); + ok( h == emf, "Expected enhmetafile %p, got %p.\n", emf, h ); + ok( !GetEnhMetaFileBits( h, sizeof(buffer), buffer ), "GetEnhMetaFileBits returned unexpected value.\n" ); + + metafile = create_metafile(); + h = SetClipboardData( CF_METAFILEPICT, metafile ); + ok( h == metafile, "Expected metafilepict %p, got %p.\n", metafile, h ); + ok( !GlobalFree( metafile ), "GlobalFree failed.\n" ); + h = GetClipboardData( CF_METAFILEPICT ); + ok( h == metafile, "Expected metafile %p, got %p.\n", metafile, h ); + ok( is_freed( h ), "Expected freed mem %p.\n", h ); + + metafile = create_metafile(); + h = SetClipboardData( CF_DSPMETAFILEPICT, metafile ); + ok( h == metafile, "Expected metafilepict %p, got %p.\n", metafile, h ); + ok( !GlobalFree( metafile ), "GlobalFree failed.\n" ); + h = GetClipboardData( CF_DSPMETAFILEPICT ); + ok( h == metafile, "Expected metafile %p, got %p.\n", metafile, h ); + ok( is_freed( h ), "Expected freed mem %p.\n", h ); + + r = EmptyClipboard(); + ok( r, "EmptyClipboard failed: %#lx.\n", GetLastError() ); + r = CloseClipboard(); + ok( r, "CloseClipboard failed: %#lx.\n", GetLastError() ); + + ReleaseDC( 0, hdc ); DestroyWindow( hwnd ); }
1
0
0
0
Jacek Caban : winemac: Don't share debugstr_format between dragdrop.c and clipboard.c.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: 469a2ce5cca42e1519736de3b150cb774673730d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=469a2ce5cca42e1519736de3…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri May 27 00:41:50 2022 +0200 winemac: Don't share debugstr_format between dragdrop.c and clipboard.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/clipboard.c | 2 +- dlls/winemac.drv/dragdrop.c | 40 ++++++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/macdrv.h | 1 - 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index 16eff401a98..16c44ddfde6 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -210,7 +210,7 @@ static unsigned int nb_current_mac_formats; /************************************************************************** * debugstr_format */ -const char *debugstr_format(UINT id) +static const char *debugstr_format(UINT id) { WCHAR buffer[256]; diff --git a/dlls/winemac.drv/dragdrop.c b/dlls/winemac.drv/dragdrop.c index d5de2abb37a..19a5c4794b5 100644 --- a/dlls/winemac.drv/dragdrop.c +++ b/dlls/winemac.drv/dragdrop.c @@ -46,6 +46,46 @@ typedef struct } DragDropDataObject; +/************************************************************************** + * debugstr_format + */ +static const char *debugstr_format(UINT id) +{ + WCHAR buffer[256]; + + if (GetClipboardFormatNameW(id, buffer, 256)) + return wine_dbg_sprintf("0x%04x %s", id, debugstr_w(buffer)); + + switch (id) + { +#define BUILTIN(id) case id: return #id; + BUILTIN(CF_TEXT) + BUILTIN(CF_BITMAP) + BUILTIN(CF_METAFILEPICT) + BUILTIN(CF_SYLK) + BUILTIN(CF_DIF) + BUILTIN(CF_TIFF) + BUILTIN(CF_OEMTEXT) + BUILTIN(CF_DIB) + BUILTIN(CF_PALETTE) + BUILTIN(CF_PENDATA) + BUILTIN(CF_RIFF) + BUILTIN(CF_WAVE) + BUILTIN(CF_UNICODETEXT) + BUILTIN(CF_ENHMETAFILE) + BUILTIN(CF_HDROP) + BUILTIN(CF_LOCALE) + BUILTIN(CF_DIBV5) + BUILTIN(CF_OWNERDISPLAY) + BUILTIN(CF_DSPTEXT) + BUILTIN(CF_DSPBITMAP) + BUILTIN(CF_DSPMETAFILEPICT) + BUILTIN(CF_DSPENHMETAFILE) +#undef BUILTIN + default: return wine_dbg_sprintf("0x%04x", id); + } +} + static inline DragDropDataObject *impl_from_IDataObject(IDataObject *iface) { return CONTAINING_RECORD(iface, DragDropDataObject, IDataObject_iface); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index c0f2811c5f5..401ebab3bcc 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -255,7 +255,6 @@ extern void macdrv_displays_changed(const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_UpdateClipboard(void) DECLSPEC_HIDDEN; extern BOOL query_pasteboard_data(HWND hwnd, CFStringRef type) DECLSPEC_HIDDEN; extern void macdrv_lost_pasteboard_ownership(HWND hwnd) DECLSPEC_HIDDEN; -extern const char *debugstr_format(UINT id) DECLSPEC_HIDDEN; extern HANDLE macdrv_get_pasteboard_data(CFTypeRef pasteboard, UINT desired_format) DECLSPEC_HIDDEN; extern BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_format) DECLSPEC_HIDDEN; extern UINT* macdrv_get_pasteboard_formats(CFTypeRef pasteboard, UINT* num_formats) DECLSPEC_HIDDEN;
1
0
0
0
Jacek Caban : winemac: Use unixlib for query_drag_exited.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: dd3d988e43b2eae421dc2e75fa94dd03217736ec URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dd3d988e43b2eae421dc2e75…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 1 00:30:21 2022 +0200 winemac: Use unixlib for query_drag_exited. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/dllmain.c | 1 + dlls/winemac.drv/dragdrop.c | 9 +++++---- dlls/winemac.drv/event.c | 11 +++++++++++ dlls/winemac.drv/macdrv.h | 3 ++- dlls/winemac.drv/unixlib.h | 9 ++++++++- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index d38e7cf9164..493062521ad 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -29,6 +29,7 @@ HMODULE macdrv_module = 0; typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size); static const kernel_callback kernel_callbacks[] = { + macdrv_dnd_query_exited, macdrv_ime_query_char_rect, macdrv_ime_set_text, }; diff --git a/dlls/winemac.drv/dragdrop.c b/dlls/winemac.drv/dragdrop.c index a07b66ac14a..d5de2abb37a 100644 --- a/dlls/winemac.drv/dragdrop.c +++ b/dlls/winemac.drv/dragdrop.c @@ -482,14 +482,15 @@ BOOL query_drag_drop(macdrv_query* query) /************************************************************************** - * query_drag_exited + * macdrv_dnd_query_exited */ -BOOL query_drag_exited(macdrv_query* query) +NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size) { - HWND hwnd = macdrv_get_window_hwnd(query->window); + struct dnd_query_exited_params *params = arg; + HWND hwnd = params->hwnd; IDropTarget *droptarget; - TRACE("win %p/%p\n", hwnd, query->window); + TRACE("win %p\n", hwnd); droptarget = get_droptarget_pointer(last_droptarget_hwnd); if (droptarget) diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 43cd3f85bcd..361709010c9 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -179,6 +179,17 @@ static void macdrv_sent_text_input(const macdrv_event *event) } +/************************************************************************** + * query_drag_exited + */ +static BOOL query_drag_exited(macdrv_query *query) +{ + struct dnd_query_exited_params params; + params.hwnd = macdrv_get_window_hwnd(query->window); + return macdrv_client_func(client_func_dnd_query_exited, ¶ms, sizeof(params)); +} + + /************************************************************************** * query_ime_char_rect */ diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index e125bb03b4d..c0f2811c5f5 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -261,7 +261,6 @@ extern BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_form extern UINT* macdrv_get_pasteboard_formats(CFTypeRef pasteboard, UINT* num_formats) DECLSPEC_HIDDEN; extern BOOL query_drag_operation(macdrv_query* query) DECLSPEC_HIDDEN; -extern BOOL query_drag_exited(macdrv_query* query) DECLSPEC_HIDDEN; extern BOOL query_drag_drop(macdrv_query* query) DECLSPEC_HIDDEN; extern struct opengl_funcs *macdrv_wine_get_wgl_driver(UINT version) DECLSPEC_HIDDEN; @@ -298,6 +297,8 @@ extern NTSTATUS macdrv_notify_icon(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *params, ULONG size) DECLSPEC_HIDDEN; +extern NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size) DECLSPEC_HIDDEN; + /* user helpers */ static inline LRESULT send_message(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index d0950e63c3c..067f46c8f5d 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -67,11 +67,18 @@ struct notify_icon_params /* driver client callbacks exposed with KernelCallbackTable interface */ enum macdrv_client_funcs { - client_func_ime_query_char_rect = NtUserDriverCallbackFirst, + client_func_dnd_query_exited = NtUserDriverCallbackFirst, + client_func_ime_query_char_rect, client_func_ime_set_text, client_func_last }; +/* macdrv_dnd_query_exited params */ +struct dnd_query_exited_params +{ + HWND hwnd; +}; + /* macdrv_ime_query_char_rect result */ struct ime_query_char_rect_result {
1
0
0
0
Jacek Caban : winemac: Use unixlib interface for macdrv_clear_ime_text.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: 219eb6ece23b3455252dc763634f9ae53547f21c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=219eb6ece23b3455252dc763…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue May 31 22:51:41 2022 +0200 winemac: Use unixlib interface for macdrv_clear_ime_text. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/ime.c | 2 +- dlls/winemac.drv/macdrv.h | 3 +-- dlls/winemac.drv/macdrv_main.c | 8 ++++++++ dlls/winemac.drv/unixlib.h | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 251c22d5005..756e880c5a3 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -853,7 +853,7 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) TRACE("NI_COMPOSITIONSTR: CPS_CANCEL\n"); - macdrv_clear_ime_text(); + MACDRV_CALL(ime_clear, NULL); if (lpIMC->hCompStr) ImmDestroyIMCC(lpIMC->hCompStr); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index de8384d5437..e125bb03b4d 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -287,13 +287,12 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; * Mac IME driver */ -extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN; - extern NTSTATUS WINAPI macdrv_ime_set_text(void *params, ULONG size) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI macdrv_ime_query_char_rect(void *params, ULONG size) DECLSPEC_HIDDEN; /* unixlib interface */ +extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_notify_icon(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *params, diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index bf06d96b407..4ef9060ea4b 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -615,6 +615,13 @@ NTSTATUS macdrv_client_func(enum macdrv_client_funcs id, const void *params, ULO } +static NTSTATUS macdrv_ime_clear(void *arg) +{ + macdrv_clear_ime_text(); + return 0; +} + + static NTSTATUS macdrv_ime_using_input_method(void *arg) { return macdrv_using_input_method(); @@ -623,6 +630,7 @@ static NTSTATUS macdrv_ime_using_input_method(void *arg) const unixlib_entry_t __wine_unix_call_funcs[] = { + macdrv_ime_clear, macdrv_ime_process_text_input, macdrv_ime_using_input_method, macdrv_init, diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index dd03cd4de95..d0950e63c3c 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -21,6 +21,7 @@ enum macdrv_funcs { + unix_ime_clear, unix_ime_process_text_input, unix_ime_using_input_method, unix_init,
1
0
0
0
Jacek Caban : winemac: Use unixlib interface for macdrv_ime_query_char_rect.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: 8bfe37c880aeb58ca0d8cf55222e7ba31813ce92 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8bfe37c880aeb58ca0d8cf55…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue May 31 22:42:27 2022 +0200 winemac: Use unixlib interface for macdrv_ime_query_char_rect. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/dllmain.c | 1 + dlls/winemac.drv/event.c | 32 ++++++++++++++++++++++++++++ dlls/winemac.drv/ime.c | 52 +++++++++++++++++++++------------------------- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/unixlib.h | 21 ++++++++++++++++++- 5 files changed, 78 insertions(+), 30 deletions(-) diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index 27eda4d2ac8..d38e7cf9164 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -29,6 +29,7 @@ HMODULE macdrv_module = 0; typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size); static const kernel_callback kernel_callbacks[] = { + macdrv_ime_query_char_rect, macdrv_ime_set_text, }; diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 68b66d610fe..43cd3f85bcd 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -179,6 +179,38 @@ static void macdrv_sent_text_input(const macdrv_event *event) } +/************************************************************************** + * query_ime_char_rect + */ +BOOL query_ime_char_rect(macdrv_query* query) +{ + HWND hwnd = macdrv_get_window_hwnd(query->window); + void *himc = query->ime_char_rect.data; + CFRange *range = &query->ime_char_rect.range; + CGRect *rect = &query->ime_char_rect.rect; + struct ime_query_char_rect_result result = {0}; + struct ime_query_char_rect_params params; + BOOL ret; + + TRACE_(imm)("win %p/%p himc %p range %ld-%ld\n", hwnd, query->window, himc, range->location, + range->length); + + params.hwnd = hwnd; + params.data = himc; + params.result = &result; + params.location = range->location; + params.length = range->length; + ret = macdrv_client_func(client_func_ime_query_char_rect, ¶ms, sizeof(params)); + *range = CFRangeMake(result.location, result.length); + *rect = cgrect_from_rect(result.rect); + + TRACE_(imm)(" -> %s range %ld-%ld rect %s\n", ret ? "TRUE" : "FALSE", range->location, + range->length, wine_dbgstr_cgrect(*rect)); + + return ret; +} + + /*********************************************************************** * macdrv_query_event * diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 2cf3aefb79d..251c22d5005 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -1438,43 +1438,42 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size) } /************************************************************************** - * query_ime_char_rect + * macdrv_ime_query_char_rect */ -BOOL query_ime_char_rect(macdrv_query* query) +NTSTATUS WINAPI macdrv_ime_query_char_rect(void *arg, ULONG size) { - HWND hwnd = macdrv_get_window_hwnd(query->window); - void *himc = query->ime_char_rect.data; - CFRange* range = &query->ime_char_rect.range; - CGRect* rect = &query->ime_char_rect.rect; + struct ime_query_char_rect_params *params = arg; + struct ime_query_char_rect_result *result = params->result; + void *himc = params->data; IMECHARPOSITION charpos; BOOL ret = FALSE; - TRACE("win %p/%p himc %p range %ld-%ld\n", hwnd, query->window, himc, range->location, - range->length); + result->location = params->location; + result->length = params->length; if (!himc) himc = RealIMC(FROM_MACDRV); charpos.dwSize = sizeof(charpos); - charpos.dwCharPos = range->location; + charpos.dwCharPos = params->location; if (ImmRequestMessageW(himc, IMR_QUERYCHARPOSITION, (ULONG_PTR)&charpos)) { int i; - *rect = CGRectMake(charpos.pt.x, charpos.pt.y, 0, charpos.cLineHeight); + SetRect(&result->rect, charpos.pt.x, charpos.pt.y, 0, charpos.pt.y + charpos.cLineHeight); /* iterate over rest of length to extend rect */ - for (i = 1; i < range->length; i++) + for (i = 1; i < params->length; i++) { charpos.dwSize = sizeof(charpos); - charpos.dwCharPos = range->location + i; + charpos.dwCharPos = params->location + i; if (!ImmRequestMessageW(himc, IMR_QUERYCHARPOSITION, (ULONG_PTR)&charpos) || - charpos.pt.y != rect->origin.y) + charpos.pt.y != result->rect.top) { - range->length = i; + result->length = i; break; } - rect->size.width = charpos.pt.x - rect->origin.x; + result->rect.right = charpos.pt.x; } ret = TRUE; @@ -1501,15 +1500,15 @@ BOOL query_ime_char_rect(macdrv_query* query) if (private->textfont) oldfont = SelectObject(dc, private->textfont); - if (range->location > compstr->dwCompStrLen) - range->location = compstr->dwCompStrLen; - if (range->location + range->length > compstr->dwCompStrLen) - range->length = compstr->dwCompStrLen - range->location; + if (result->location > compstr->dwCompStrLen) + result->location = compstr->dwCompStrLen; + if (result->location + result->length > compstr->dwCompStrLen) + result->length = compstr->dwCompStrLen - result->location; - GetTextExtentPoint32W(dc, str, range->location, &size); + GetTextExtentPoint32W(dc, str, result->location, &size); charpos.rcDocument.left = size.cx; charpos.rcDocument.top = 0; - GetTextExtentPoint32W(dc, str, range->location + range->length, &size); + GetTextExtentPoint32W(dc, str, result->location + result->length, &size); charpos.rcDocument.right = size.cx; charpos.rcDocument.bottom = size.cy; @@ -1518,7 +1517,7 @@ BOOL query_ime_char_rect(macdrv_query* query) LPtoDP(dc, (POINT*)&charpos.rcDocument, 2); MapWindowPoints(private->hwndDefault, 0, (POINT*)&charpos.rcDocument, 2); - *rect = cgrect_from_rect(charpos.rcDocument); + result->rect = charpos.rcDocument; ret = TRUE; if (oldfont) @@ -1540,16 +1539,13 @@ BOOL query_ime_char_rect(macdrv_query* query) if (GetGUIThreadInfo(0, >i)) { MapWindowPoints(gti.hwndCaret, 0, (POINT*)>i.rcCaret, 2); - *rect = cgrect_from_rect(gti.rcCaret); + result->rect = gti.rcCaret; ret = TRUE; } } - if (ret && range->length && !rect->size.width) - rect->size.width = 1; - - TRACE(" -> %s range %ld-%ld rect %s\n", ret ? "TRUE" : "FALSE", range->location, - range->length, wine_dbgstr_cgrect(*rect)); + if (ret && result->length && result->rect.left == result->rect.right) + result->rect.right++; return ret; } diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index c9fcf1dbf4b..de8384d5437 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -290,7 +290,7 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI macdrv_ime_set_text(void *params, ULONG size) DECLSPEC_HIDDEN; -extern BOOL query_ime_char_rect(macdrv_query* query) DECLSPEC_HIDDEN; +extern NTSTATUS WINAPI macdrv_ime_query_char_rect(void *params, ULONG size) DECLSPEC_HIDDEN; /* unixlib interface */ diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index 20447f1f3b9..dd03cd4de95 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -66,10 +66,29 @@ struct notify_icon_params /* driver client callbacks exposed with KernelCallbackTable interface */ enum macdrv_client_funcs { - client_func_ime_set_text = NtUserDriverCallbackFirst, + client_func_ime_query_char_rect = NtUserDriverCallbackFirst, + client_func_ime_set_text, client_func_last }; +/* macdrv_ime_query_char_rect result */ +struct ime_query_char_rect_result +{ + RECT rect; + UINT32 location; + UINT32 length; +}; + +/* macdrv_ime_query_char_rect params */ +struct ime_query_char_rect_params +{ + HWND hwnd; + void *data; + UINT32 location; + UINT32 length; + struct ime_query_char_rect_result *result; /* FIXME: Use NtCallbackReturn instead */ +}; + /* macdrv_ime_set_text params */ struct ime_set_text_params {
1
0
0
0
Jacek Caban : winemac: Use unixlib interface for macdrv_ime_set_text calls.
by Alexandre Julliard
02 Jun '22
02 Jun '22
Module: wine Branch: master Commit: 7fa47e47c995d84d9753d5128a93e4c1ab8a75d7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7fa47e47c995d84d9753d512…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue May 31 21:06:20 2022 +0200 winemac: Use unixlib interface for macdrv_ime_set_text calls. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/dllmain.c | 17 ++++++++++++++++- dlls/winemac.drv/event.c | 28 ++++++++++++++++++++++++++++ dlls/winemac.drv/ime.c | 42 ++++++++++++++---------------------------- dlls/winemac.drv/macdrv.h | 5 ++++- dlls/winemac.drv/macdrv_main.c | 8 ++++++++ dlls/winemac.drv/unixlib.h | 19 +++++++++++++++++++ 6 files changed, 89 insertions(+), 30 deletions(-) diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index 23a1e6e2218..27eda4d2ac8 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -26,9 +26,19 @@ HMODULE macdrv_module = 0; +typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size); +static const kernel_callback kernel_callbacks[] = +{ + macdrv_ime_set_text, +}; + +C_ASSERT(NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == client_func_last); + + static BOOL process_attach(void) { struct init_params params; + void **callback_table; struct localized_string *str; struct localized_string strings[] = { @@ -53,7 +63,12 @@ static BOOL process_attach(void) str->len = LoadStringW(macdrv_module, str->id, (WCHAR *)&str->str, 0); params.strings = strings; - return !MACDRV_CALL(init, ¶ms); + if (MACDRV_CALL(init, ¶ms)) return FALSE; + + callback_table = NtCurrentTeb()->Peb->KernelCallbackTable; + memcpy( callback_table + NtUserDriverCallbackFirst, kernel_callbacks, sizeof(kernel_callbacks) ); + + return TRUE; } BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 9e53bef981a..68b66d610fe 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -141,6 +141,34 @@ static macdrv_event_mask get_event_mask(DWORD mask) } +/*********************************************************************** + * macdrv_im_set_text + */ +static void macdrv_im_set_text(const macdrv_event *event) +{ + HWND hwnd = macdrv_get_window_hwnd(event->window); + struct ime_set_text_params *params; + CFIndex length = 0, size; + + TRACE_(imm)("win %p/%p himc %p text %s complete %u\n", hwnd, event->window, event->im_set_text.data, + debugstr_cf(event->im_set_text.text), event->im_set_text.complete); + + if (event->im_set_text.text) + length = CFStringGetLength(event->im_set_text.text); + + size = offsetof(struct ime_set_text_params, text[length]); + if (!(params = malloc(size))) return; + params->hwnd = hwnd; + params->data = event->im_set_text.data; + params->cursor_pos = event->im_set_text.cursor_pos; + params->complete = event->im_set_text.complete; + + if (length) + CFStringGetCharacters(event->im_set_text.text, CFRangeMake(0, length), params->text); + + macdrv_client_func(client_func_ime_set_text, params, size); +} + /*********************************************************************** * macdrv_sent_text_input */ diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 00d4d9f1852..2cf3aefb79d 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -1395,38 +1395,25 @@ BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass, LPCWSTR lpszOpti /* Interfaces to other parts of the Mac driver */ /*********************************************************************** - * macdrv_im_set_text + * macdrv_ime_set_text */ -void macdrv_im_set_text(const macdrv_event *event) +NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size) { - HWND hwnd = macdrv_get_window_hwnd(event->window); - void *himc = event->im_set_text.data; - - TRACE("win %p/%p himc %p text %s complete %u\n", hwnd, event->window, himc, - debugstr_cf(event->im_set_text.text), event->im_set_text.complete); + struct ime_set_text_params *params = arg; + ULONG length = (size - offsetof(struct ime_set_text_params, text)) / sizeof(WCHAR); + void *himc = params->data; if (!himc) himc = RealIMC(FROM_MACDRV); - if (event->im_set_text.text) + if (length) { - CFIndex length = CFStringGetLength(event->im_set_text.text); - const UniChar *chars = CFStringGetCharactersPtr(event->im_set_text.text); - UniChar *buffer = NULL; - - if (!chars) - { - buffer = HeapAlloc(GetProcessHeap(), 0, length * sizeof(*buffer)); - CFStringGetCharacters(event->im_set_text.text, CFRangeMake(0, length), buffer); - chars = buffer; - } - if (himc) - IME_SetCompositionString(himc, SCS_SETSTR, chars, length * sizeof(*chars), - event->im_set_text.cursor_pos, !event->im_set_text.complete); + IME_SetCompositionString(himc, SCS_SETSTR, params->text, length * sizeof(WCHAR), + params->cursor_pos, !params->complete); else { INPUT input; - CFIndex i; + unsigned int i; input.type = INPUT_KEYBOARD; input.ki.wVk = 0; @@ -1435,20 +1422,19 @@ void macdrv_im_set_text(const macdrv_event *event) for (i = 0; i < length; i++) { - input.ki.wScan = chars[i]; + input.ki.wScan = params->text[i]; input.ki.dwFlags = KEYEVENTF_UNICODE; - __wine_send_input(hwnd, &input, NULL); + __wine_send_input(params->hwnd, &input, NULL); input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; - __wine_send_input(hwnd, &input, NULL); + __wine_send_input(params->hwnd, &input, NULL); } } - - HeapFree(GetProcessHeap(), 0, buffer); } - if (event->im_set_text.complete) + if (params->complete) IME_NotifyComplete(himc); + return 0; } /************************************************************************** diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 95ed36ff7e0..c9fcf1dbf4b 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -289,13 +289,16 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN; -extern void macdrv_im_set_text(const macdrv_event *event) DECLSPEC_HIDDEN; +extern NTSTATUS WINAPI macdrv_ime_set_text(void *params, ULONG size) DECLSPEC_HIDDEN; extern BOOL query_ime_char_rect(macdrv_query* query) DECLSPEC_HIDDEN; /* unixlib interface */ extern NTSTATUS macdrv_notify_icon(void *arg) DECLSPEC_HIDDEN; +extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *params, + ULONG size) DECLSPEC_HIDDEN; + /* user helpers */ static inline LRESULT send_message(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 4a183747796..bf06d96b407 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -607,6 +607,14 @@ BOOL macdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, } +NTSTATUS macdrv_client_func(enum macdrv_client_funcs id, const void *params, ULONG size) +{ + /* FIXME: use KeUserModeCallback instead */ + NTSTATUS (WINAPI *func)(const void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + return func(params, size); +} + + static NTSTATUS macdrv_ime_using_input_method(void *arg) { return macdrv_using_input_method(); diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index dc1b314c8cb..20447f1f3b9 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -62,3 +62,22 @@ struct notify_icon_params DWORD msg; struct _NOTIFYICONDATAW *data; }; + +/* driver client callbacks exposed with KernelCallbackTable interface */ +enum macdrv_client_funcs +{ + client_func_ime_set_text = NtUserDriverCallbackFirst, + client_func_last +}; + +/* macdrv_ime_set_text params */ +struct ime_set_text_params +{ + HWND hwnd; + void *data; + UINT32 cursor_pos; + UINT32 complete; + WCHAR text[1]; +}; + +C_ASSERT(client_func_last <= NtUserDriverCallbackLast + 1);
1
0
0
0
← Newer
1
...
73
74
75
76
77
78
79
80
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
Results per page:
10
25
50
100
200