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
April
March
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
August 2017
----- 2025 -----
April 2025
March 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
351 discussions
Start a n
N
ew thread
Alexandre Julliard : kernel32: Silence buffer overflow gcc warnings.
by Alexandre Julliard
31 Aug '17
31 Aug '17
Module: wine Branch: master Commit: 741fe13d445d73293d54066ad4a9a9d9cbecb96a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=741fe13d445d73293d54066ad…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 31 10:48:39 2017 +0200 kernel32: Silence buffer overflow gcc warnings. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/oldconfig.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/oldconfig.c b/dlls/kernel32/oldconfig.c index 6c80dc6..219ecc5 100644 --- a/dlls/kernel32/oldconfig.c +++ b/dlls/kernel32/oldconfig.c @@ -290,7 +290,8 @@ static void create_hardware_branch(void) { if (strncmp(dent->d_name, "hd", 2) == 0) { - sprintf(cStr, procname_ide_media, dent->d_name); + if (snprintf(cStr, sizeof(cStr), procname_ide_media, dent->d_name) >= sizeof(cStr)) + continue; procfile = fopen(cStr, "r"); if (!procfile) { @@ -306,7 +307,8 @@ static void create_hardware_branch(void) if (nType == DRIVE_UNKNOWN) continue; } - sprintf(cStr, procname_ide_model, dent->d_name); + if (snprintf(cStr, sizeof(cStr), procname_ide_model, dent->d_name) >= sizeof(cStr)) + continue; procfile = fopen(cStr, "r"); if (!procfile) { @@ -322,7 +324,8 @@ static void create_hardware_branch(void) cDevModel[strlen(cDevModel) - 1] = 0; } - sprintf(cUnixDeviceName, "/dev/%s", dent->d_name); + if (snprintf(cUnixDeviceName, sizeof(cUnixDeviceName), "/dev/%s", dent->d_name) >= sizeof(cUnixDeviceName)) + continue; scsi_addr.PortNumber = (dent->d_name[2] - 'a') / 2; scsi_addr.PathId = 0; scsi_addr.TargetId = (dent->d_name[2] - 'a') % 2;
1
0
0
0
Alexandre Julliard : fusion/tests: Simplify directory recursion and avoid redundant buffers.
by Alexandre Julliard
31 Aug '17
31 Aug '17
Module: wine Branch: master Commit: 5c37020a7e170365387973c38446a16c26030861 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5c37020a7e170365387973c38…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 31 10:20:00 2017 +0200 fusion/tests: Simplify directory recursion and avoid redundant buffers. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/fusion/tests/asmenum.c | 115 ++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/dlls/fusion/tests/asmenum.c b/dlls/fusion/tests/asmenum.c index 1dc34a2..5091be4 100644 --- a/dlls/fusion/tests/asmenum.c +++ b/dlls/fusion/tests/asmenum.c @@ -217,79 +217,80 @@ static void test_CreateAssemblyEnum(void) typedef struct _tagASMNAME { struct list entry; - LPSTR data; + char data[1]; } ASMNAME; -static BOOL enum_gac_assemblies(struct list *assemblies, int depth, LPSTR path) +static void enum_gac_assembly_dirs(struct list *assemblies, const char *parent, char path[MAX_PATH]) { + static const char format[] = "%s, Version=%s, Culture=%s, PublicKeyToken=%s"; WIN32_FIND_DATAA ffd; - CHAR buf[MAX_PATH]; - CHAR disp[MAX_PATH]; ASMNAME *name; HANDLE hfind; - LPSTR ptr; - - static CHAR parent[MAX_PATH]; + int len; + char *ptr, *end = path + strlen( path ); - sprintf(buf, "%s\\*", path); - hfind = FindFirstFileA(buf, &ffd); - if (hfind == INVALID_HANDLE_VALUE) - return FALSE; + lstrcpynA( end, "\\*", path + MAX_PATH - end ); + hfind = FindFirstFileA(path, &ffd); + if (hfind == INVALID_HANDLE_VALUE) return; + end++; do { - if (!lstrcmpA(ffd.cFileName, ".") || !lstrcmpA(ffd.cFileName, "..")) - continue; + char culture[MAX_PATH]; + + if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName, "..")) continue; - if (depth == 0) + *end = 0; + /* Directories with no dll or exe will not be enumerated */ + snprintf(end, path + MAX_PATH - end, "%s\\%s.dll", ffd.cFileName, parent); + if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES) { - lstrcpyA(parent, ffd.cFileName); + snprintf(end, path + MAX_PATH - end, "%s\\%s.exe", ffd.cFileName, parent); + if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES) continue; } - else if (depth == 1) + + if (!(ptr = strchr(ffd.cFileName, '_'))) continue; + *ptr++ = 0; + + if (*ptr != '_') { - char culture[MAX_PATH]; - char dll[MAX_PATH], exe[MAX_PATH]; + lstrcpyA(culture, ptr); + *strchr(culture, '_') = 0; + } + else + lstrcpyA(culture, "neutral"); - /* Directories with no dll or exe will not be enumerated */ - sprintf(dll, "%s\\%s\\%s.dll", path, ffd.cFileName, parent); - sprintf(exe, "%s\\%s\\%s.exe", path, ffd.cFileName, parent); - if (GetFileAttributesA(dll) == INVALID_FILE_ATTRIBUTES && - GetFileAttributesA(exe) == INVALID_FILE_ATTRIBUTES) - continue; + ptr = strchr(ptr, '_'); + ptr++; + len = sizeof(format) + strlen(parent) + strlen(ffd.cFileName) + strlen(culture) + strlen(ptr); - ptr = strstr(ffd.cFileName, "_"); - *ptr = '\0'; - ptr++; + name = HeapAlloc(GetProcessHeap(), 0, offsetof( ASMNAME, data[len] )); + sprintf( name->data, format, parent, ffd.cFileName, culture, ptr); + list_add_tail(assemblies, &name->entry); + } while (FindNextFileA(hfind, &ffd) != 0); - if (*ptr != '_') - { - lstrcpyA(culture, ptr); - *strstr(culture, "_") = '\0'; - } - else - lstrcpyA(culture, "neutral"); - - ptr = strchr(ptr, '_'); - ptr++; - sprintf(buf, ", Version=%s, Culture=%s, PublicKeyToken=%s", - ffd.cFileName, culture, ptr); - lstrcpyA(disp, parent); - lstrcatA(disp, buf); - - name = HeapAlloc(GetProcessHeap(), 0, sizeof(ASMNAME)); - name->data = HeapAlloc(GetProcessHeap(), 0, lstrlenA(disp) + 1); - lstrcpyA(name->data, disp); - list_add_tail(assemblies, &name->entry); - - continue; - } + FindClose(hfind); +} - sprintf(buf, "%s\\%s", path, ffd.cFileName); - enum_gac_assemblies(assemblies, depth + 1, buf); +static void enum_gac_assemblies(struct list *assemblies, char path[MAX_PATH]) +{ + WIN32_FIND_DATAA ffd; + HANDLE hfind; + char *end = path + strlen( path ); + + lstrcpynA( end, "\\*", path + MAX_PATH - end ); + hfind = FindFirstFileA(path, &ffd); + if (hfind == INVALID_HANDLE_VALUE) return; + end++; + + do + { + if (!strcmp(ffd.cFileName, ".") || !strcmp(ffd.cFileName, "..")) continue; + lstrcpynA( end, ffd.cFileName, path + MAX_PATH - end ); + enum_gac_assembly_dirs( assemblies, ffd.cFileName, path ); } while (FindNextFileA(hfind, &ffd) != 0); FindClose(hfind); - return TRUE; } static void test_enumerate(void) @@ -311,18 +312,18 @@ static void test_enumerate(void) to_multibyte(path, buf); lstrcatA(path, "_32"); - enum_gac_assemblies(&assemblies, 0, path); + enum_gac_assemblies(&assemblies, path); to_multibyte(path, buf); lstrcatA(path, "_64"); - enum_gac_assemblies(&assemblies, 0, path); + enum_gac_assemblies(&assemblies, path); to_multibyte(path, buf); lstrcatA(path, "_MSIL"); - enum_gac_assemblies(&assemblies, 0, path); + enum_gac_assemblies(&assemblies, path); to_multibyte(path, buf); - enum_gac_assemblies(&assemblies, 0, path); + enum_gac_assemblies(&assemblies, path); asmenum = NULL; hr = pCreateAssemblyEnum(&asmenum, NULL, NULL, ASM_CACHE_GAC, NULL); @@ -345,7 +346,6 @@ static void test_enumerate(void) found = TRUE; list_remove(&asmname->entry); - HeapFree(GetProcessHeap(), 0, asmname->data); HeapFree(GetProcessHeap(), 0, asmname); break; } @@ -369,7 +369,6 @@ static void test_enumerate(void) ok(FALSE, "Assembly not enumerated: %s\n", asmname->data); list_remove(&asmname->entry); - HeapFree(GetProcessHeap(), 0, asmname->data); HeapFree(GetProcessHeap(), 0, asmname); }
1
0
0
0
Alexandre Julliard : fusion/tests: Correctly test non-string properties.
by Alexandre Julliard
31 Aug '17
31 Aug '17
Module: wine Branch: master Commit: 99f08cc76bdd8eb7465673432ca6162c74f799c7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=99f08cc76bdd8eb7465673432…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 31 09:27:13 2017 +0200 fusion/tests: Correctly test non-string properties. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/fusion/tests/asmname.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/fusion/tests/asmname.c b/dlls/fusion/tests/asmname.c index 5fb14a4..01ebd0a 100644 --- a/dlls/fusion/tests/asmname.c +++ b/dlls/fusion/tests/asmname.c @@ -351,16 +351,14 @@ static void test_assembly_name_props_line(IAssemblyName *name, DWORD i, size; WCHAR expect[MAX_PATH]; WCHAR str[MAX_PATH]; - CHAR val[MAX_PATH]; for (i = 0; i < ASM_NAME_MAX_PARAMS; i++) { to_widechar(expect, vals[i].val); size = MAX_PATH; - ZeroMemory(str, MAX_PATH); + memset( str, 0xcc, sizeof(str) ); hr = IAssemblyName_GetProperty(name, i, str, &size); - to_multibyte(val, str); ok(hr == vals[i].hr || broken(i >= ASM_NAME_CONFIG_MASK && hr == E_INVALIDARG) || /* .NET 1.1 */ @@ -368,11 +366,15 @@ static void test_assembly_name_props_line(IAssemblyName *name, "%d: prop %d: Expected %08x, got %08x\n", line, i, vals[i].hr, hr); if (hr != E_INVALIDARG) { - if (i == ASM_NAME_PUBLIC_KEY_TOKEN) - ok(!memcmp(vals[i].val, str, size), "Expected a correct ASM_NAME_PUBLIC_KEY_TOKEN\n"); - else - ok(!lstrcmpA(vals[i].val, val), "%d: prop %d: Expected \"%s\", got \"%s\"\n", line, i, vals[i].val, val); ok(size == vals[i].size, "%d: prop %d: Expected %d, got %d\n", line, i, vals[i].size, size); + if (size && size != MAX_PATH) + { + if (i != ASM_NAME_NAME && i != ASM_NAME_CULTURE) + ok( !memcmp( vals[i].val, str, size ), "%d: prop %d: wrong value\n", line, i ); + else + ok( !lstrcmpW( expect, str ), "%d: prop %d: Expected %s, got %s\n", + line, i, wine_dbgstr_w(expect), wine_dbgstr_w(str) ); + } } } }
1
0
0
0
Alexandre Julliard : ntdll: Store the PEB lock pointer in the PEB.
by Alexandre Julliard
31 Aug '17
31 Aug '17
Module: wine Branch: master Commit: b31583770f074ca343e00f6c2be19b831d6ad90e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b31583770f074ca343e00f6c2…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Aug 31 10:01:04 2017 +0200 ntdll: Store the PEB lock pointer in the PEB. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/rtl.c | 13 ++----------- dlls/ntdll/thread.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index b0ea413..e56eec8 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -49,15 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll); -static RTL_CRITICAL_SECTION peb_lock; -static RTL_CRITICAL_SECTION_DEBUG critsect_debug = -{ - 0, 0, &peb_lock, - { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": peb_lock") } -}; -static RTL_CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 }; - #ifdef __i386__ #define DEFINE_FASTCALL4_ENTRYPOINT( name ) \ __ASM_STDCALL_FUNC( name, 16, \ @@ -380,7 +371,7 @@ NTSTATUS WINAPI vDbgPrintExWithPrefix( LPCSTR prefix, ULONG id, ULONG level, LPC */ VOID WINAPI RtlAcquirePebLock(void) { - RtlEnterCriticalSection( &peb_lock ); + RtlEnterCriticalSection( NtCurrentTeb()->Peb->FastPebLock ); } /****************************************************************************** @@ -388,7 +379,7 @@ VOID WINAPI RtlAcquirePebLock(void) */ VOID WINAPI RtlReleasePebLock(void) { - RtlLeaveCriticalSection( &peb_lock ); + RtlLeaveCriticalSection( NtCurrentTeb()->Peb->FastPebLock ); } /****************************************************************************** diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index ba1be0f..6ded7ea 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -69,6 +69,15 @@ static RTL_BITMAP tls_expansion_bitmap; static RTL_BITMAP fls_bitmap; static int nb_threads = 1; +static RTL_CRITICAL_SECTION peb_lock; +static RTL_CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &peb_lock, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": peb_lock") } +}; +static RTL_CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 }; + /*********************************************************************** * get_unicode_string * @@ -292,6 +301,7 @@ HANDLE thread_init(void) MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE ); peb = addr; + peb->FastPebLock = &peb_lock; peb->ProcessParameters = ¶ms; peb->TlsBitmap = &tls_bitmap; peb->TlsExpansionBitmap = &tls_expansion_bitmap;
1
0
0
0
Marcus Meissner : kernel32/tests: Fixed size to GetTempPathW.
by Alexandre Julliard
30 Aug '17
30 Aug '17
Module: wine Branch: master Commit: 844b57e4d800bfb260c1694ed54a02b9f5ad1f47 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=844b57e4d800bfb260c1694ed…
Author: Marcus Meissner <marcus(a)jet.franken.de> Date: Wed Aug 30 19:59:47 2017 +0200 kernel32/tests: Fixed size to GetTempPathW. Signed-off-by: Marcus Meissner <marcus(a)jet.franken.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index bfe94b9..108d0cb 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -971,7 +971,7 @@ static void test_AddDllDirectory(void) } buf[0] = '\0'; - GetTempPathW( sizeof(path), path ); + GetTempPathW( sizeof(path)/sizeof(path[0]), path ); GetTempFileNameW( path, tmpW, 0, buf ); SetLastError( 0xdeadbeef ); cookie = pAddDllDirectory( buf );
1
0
0
0
Vincent Povirk : gdiplus: Account for gdi transform in SOFTWARE_GdipFillRegion.
by Alexandre Julliard
30 Aug '17
30 Aug '17
Module: wine Branch: master Commit: 399fd55f5c4e7668b286f92cf43253bf17deefdc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=399fd55f5c4e7668b286f92cf…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Aug 30 12:32:17 2017 -0500 gdiplus: Account for gdi transform in SOFTWARE_GdipFillRegion. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/gdiplus_private.h | 4 +++ dlls/gdiplus/graphics.c | 57 +++++++++++++++++++++++++++++++++++++++--- dlls/gdiplus/tests/graphics.c | 2 +- 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 9980afc..6bb7f88 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -81,6 +81,8 @@ extern REAL units_scale(GpUnit from, GpUnit to, REAL dpi) DECLSPEC_HIDDEN; #define WineCoordinateSpaceGdiDevice ((GpCoordinateSpace)4) +extern GpStatus gdi_transform_acquire(GpGraphics *graphics); +extern GpStatus gdi_transform_release(GpGraphics *graphics); extern GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix) DECLSPEC_HIDDEN; extern GpStatus gdip_transform_points(GpGraphics *graphics, GpCoordinateSpace dst_space, @@ -258,6 +260,8 @@ struct GpGraphics{ struct list containers; GraphicsContainer contid; /* last-issued container ID */ INT origin_x, origin_y; + INT gdi_transform_acquire_count, gdi_transform_save; + GpMatrix gdi_transform; /* For giving the caller an HDC when we technically can't: */ HBITMAP temp_hbitmap; int temp_hbitmap_width; diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 3dbb457..7aa1dac 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2039,7 +2039,7 @@ static GpStatus restore_container(GpGraphics* graphics, return Ok; } -static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) +static GpStatus get_graphics_device_bounds(GpGraphics* graphics, GpRectF* rect) { RECT wnd_rect; GpStatus stat=Ok; @@ -2083,7 +2083,14 @@ static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) rect->Height = GetDeviceCaps(graphics->hdc, VERTRES); } - if (graphics->hdc) + return stat; +} + +static GpStatus get_graphics_bounds(GpGraphics* graphics, GpRectF* rect) +{ + GpStatus stat = get_graphics_device_bounds(graphics, rect); + + if (stat == Ok && graphics->hdc) { GpPointF points[4], min_point, max_point; int i; @@ -4457,14 +4464,17 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush, if (!brush_can_fill_pixels(brush)) return NotImplemented; - stat = get_graphics_bounds(graphics, &graphics_bounds); + stat = gdi_transform_acquire(graphics); + + if (stat == Ok) + stat = get_graphics_device_bounds(graphics, &graphics_bounds); if (stat == Ok) stat = GdipCloneRegion(region, &temp_region); if (stat == Ok) { - stat = get_graphics_transform(graphics, CoordinateSpaceDevice, + stat = get_graphics_transform(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceWorld, &world_to_device); if (stat == Ok) @@ -4482,6 +4492,7 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush, if (stat == Ok && GetRgnBox(hregion, &bound_rect) == NULLREGION) { DeleteObject(hregion); + gdi_transform_release(graphics); return Ok; } @@ -4513,6 +4524,8 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush, DeleteObject(hregion); } + gdi_transform_release(graphics); + return stat; } @@ -6586,10 +6599,46 @@ static void get_gdi_transform(GpGraphics *graphics, GpMatrix *matrix) return; } + if (graphics->gdi_transform_acquire_count) + { + *matrix = graphics->gdi_transform; + return; + } + GetTransform(graphics->hdc, 0x204, &xform); GdipSetMatrixElements(matrix, xform.eM11, xform.eM12, xform.eM21, xform.eM22, xform.eDx, xform.eDy); } +GpStatus gdi_transform_acquire(GpGraphics *graphics) +{ + if (graphics->gdi_transform_acquire_count == 0 && graphics->hdc) + { + get_gdi_transform(graphics, &graphics->gdi_transform); + graphics->gdi_transform_save = SaveDC(graphics->hdc); + SetGraphicsMode(graphics->hdc, GM_COMPATIBLE); + SetMapMode(graphics->hdc, MM_TEXT); + SetWindowOrgEx(graphics->hdc, 0, 0, NULL); + SetViewportOrgEx(graphics->hdc, 0, 0, NULL); + } + graphics->gdi_transform_acquire_count++; + return Ok; +} + +GpStatus gdi_transform_release(GpGraphics *graphics) +{ + if (graphics->gdi_transform_acquire_count <= 0) + { + ERR("called without matching gdi_transform_acquire"); + return GenericError; + } + if (graphics->gdi_transform_acquire_count == 1 && graphics->hdc) + { + RestoreDC(graphics->hdc, graphics->gdi_transform_save); + } + graphics->gdi_transform_acquire_count--; + return Ok; +} + GpStatus get_graphics_transform(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpMatrix *matrix) { diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 5f45cc2..5416ebc 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -6361,7 +6361,7 @@ static void test_GdipFillRectanglesOnMemoryDCTextureBrush(void) color[4] = get_bitmap_pixel(width/2-1, height-1); color[5] = get_bitmap_pixel(width-1, height/2-1); } - todo_wine ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && + ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && color[3] == 0 && color[4] == 0 && color[5] == 0, "Expected GdipFillRectangleI take effect!\n" ); ReleaseBitmapPixelBuffer(pixel);
1
0
0
0
Changhui Liu : gdiplus/tests: Add drawing tests for GdipFillRegion with gdi transform.
by Alexandre Julliard
30 Aug '17
30 Aug '17
Module: wine Branch: master Commit: 24f109072c60149a87ceacb8bff97bdc4f69ebcb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=24f109072c60149a87ceacb8b…
Author: Changhui Liu <liuchanghui(a)linuxdeepin.com> Date: Wed Aug 30 12:32:16 2017 -0500 gdiplus/tests: Add drawing tests for GdipFillRegion with gdi transform. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/graphics.c | 245 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 540fdfd..5f45cc2 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -6287,6 +6287,248 @@ static void test_GdipFillRectanglesOnMemoryDCSolidBrush(void) ReleaseDC(hwnd, dc); } +static void test_GdipFillRectanglesOnMemoryDCTextureBrush(void) +{ + ARGB color[6] = {0,0,0,0,0,0}; + POINT pt = {0,0}; + RECT rect = {100, 100, 180, 180}; + UINT width = rect.right - rect.left; + UINT height = rect.bottom - rect.top; + GpStatus status = 0; + union + { + GpBitmap *bitmap; + GpImage *image; + } src_img; + GpTexture *brush = NULL; + GpGraphics *graphics = NULL; + HDC dc = GetDC( hwnd); + HDC hdc = CreateCompatibleDC(dc); + HBITMAP bmp = CreateCompatibleBitmap(dc, width, height); + HGDIOBJ old = SelectObject(hdc, bmp); + + UINT x = 0; + UINT y = 0; + UINT src_img_width = width/2; + UINT src_img_height = height/2; + BYTE *src_img_data = GdipAlloc(src_img_width*src_img_height*4); + DWORD *pixel = (DWORD *)src_img_data; + ok(pixel != NULL, "Expected src_img_data is valid\n"); + + /*Change the window origin is the key test point*/ + SetWindowOrgEx(hdc, rect.left, rect.top, &pt); + + /*build a blue solid image!*/ + for(y = 0; y < src_img_height; ++y) + { + for(x = 0; x < src_img_width; ++x) + { + pixel[x] = BLUE_COLOR; + } + + pixel += src_img_width; + } + + status = GdipCreateBitmapFromScan0(src_img_width, src_img_height, src_img_width*4, + PixelFormat32bppARGB, src_img_data, &src_img.bitmap); + expect(Ok, status); + + status = GdipCreateTexture(src_img.image, 0, &brush); + expect(Ok, status); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + status = GdipSetClipRectI(graphics, rect.left+width/2, rect.top+height/2, + width, height, CombineModeReplace); + expect(Ok, status); + + status = GdipFillRectangleI(graphics, (GpBrush*)brush, 0, 0, rect.right, rect.bottom); + expect(Ok, status); + + GdipDisposeImage(src_img.image); + GdipDeleteBrush((GpBrush*)brush); + GdipDeleteGraphics(graphics); + GdipFree(src_img_data); + + pixel = GetBitmapPixelBuffer(hdc, bmp, width, height); + if (pixel) + { + color[0] = get_bitmap_pixel(width/2, height/2); + color[1] = get_bitmap_pixel(width/2+1, height/2); + color[2] = get_bitmap_pixel(width/2, height/2+1); + color[3] = get_bitmap_pixel(width/2-1, height/2-1); + color[4] = get_bitmap_pixel(width/2-1, height-1); + color[5] = get_bitmap_pixel(width-1, height/2-1); + } + todo_wine ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && + color[3] == 0 && color[4] == 0 && color[5] == 0, + "Expected GdipFillRectangleI take effect!\n" ); + ReleaseBitmapPixelBuffer(pixel); + + SelectObject(hdc, old); + DeleteObject(bmp); + DeleteDC(hdc); + ReleaseDC(hwnd, dc); +} + +static void test_GdipFillRectanglesOnBitmapTextureBrush(void) +{ + ARGB color[6] = {0,0,0,0,0,0}; + UINT x = 0; + UINT y = 0; + RECT rect = {100, 100, 180, 180}; + UINT width = rect.right - rect.left; + UINT height = rect.bottom - rect.top; + UINT src_img_width = width/2; + UINT src_img_height = height/2; + + GpStatus status = 0; + union + { + GpBitmap *bitmap; + GpImage *image; + } src_img; + union + { + GpBitmap *bitmap; + GpImage *image; + } dst_img; + + GpTexture *brush = NULL; + GpGraphics *graphics = NULL; + BYTE *src_img_data = GdipAlloc(src_img_width*src_img_height*4); + DWORD *pixel = (DWORD *)src_img_data; + ok(pixel != NULL, "Expected src_img_data is valid\n"); + + status = GdipCreateBitmapFromScan0(width, height, width*4, + PixelFormat32bppARGB, NULL, &dst_img.bitmap); + expect(Ok, status); + + /*build a blue solid image!*/ + for(y = 0; y < src_img_height; ++y) + { + for(x = 0; x < src_img_width; ++x) + { + pixel[x] = BLUE_COLOR; + } + + pixel += src_img_width; + } + + status = GdipCreateBitmapFromScan0(src_img_width, src_img_height, src_img_width*4, + PixelFormat32bppARGB, src_img_data, &src_img.bitmap); + expect(Ok, status); + + status = GdipCreateTexture(src_img.image, 0, &brush); + expect(Ok, status); + + status = GdipGetImageGraphicsContext(dst_img.image, &graphics); + expect(Ok, status); + + status = GdipSetClipRectI(graphics, 0, 0, width, height, CombineModeReplace); + expect(Ok, status); + + status = GdipFillRectangleI(graphics, (GpBrush*)brush, 0, 0, width/2, height/2); + expect(Ok, status); + + GdipDeleteBrush((GpBrush*)brush); + GdipDeleteGraphics(graphics); + + GdipBitmapGetPixel(dst_img.bitmap, 0, 0, &color[0]); + GdipBitmapGetPixel(dst_img.bitmap, 0, 1, &color[1]); + GdipBitmapGetPixel(dst_img.bitmap, 1, 0, &color[2]); + GdipBitmapGetPixel(dst_img.bitmap, width/2, 0, &color[3]); + GdipBitmapGetPixel(dst_img.bitmap, width/2, height/2, &color[4]); + GdipBitmapGetPixel(dst_img.bitmap, 0, height/2, &color[5]); + + ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && + color[3] == 0 && color[4] == 0 && color[5] == 0, + "Expected GdipFillRectangleI take effect!\n" ); + + GdipDisposeImage(src_img.image); + GdipDisposeImage(dst_img.image); + GdipFree(src_img_data); +} + +static void test_GdipDrawImagePointsRectOnMemoryDC(void) +{ + ARGB color[6] = {0,0,0,0,0,0}; + POINT pt = {0,0}; + RECT rect = {100, 100, 180, 180}; + UINT width = rect.right - rect.left; + UINT height = rect.bottom - rect.top; + GpStatus status = 0; + union + { + GpBitmap *bitmap; + GpImage *image; + } src_img; + GpGraphics *graphics = NULL; + HDC dc = GetDC( hwnd); + HDC hdc = CreateCompatibleDC(dc); + HBITMAP bmp = CreateCompatibleBitmap(dc, width, height); + HGDIOBJ old = SelectObject(hdc, bmp); + + UINT x = 0; + UINT y = 0; + UINT src_img_width = width/2; + UINT src_img_height = height/2; + BYTE *src_img_data = GdipAlloc(src_img_width*src_img_height*4); + DWORD *pixel = (DWORD *)src_img_data; + ok(pixel != NULL, "Expected src_img_data is valid\n"); + + /*Change the window origin is the key test point*/ + SetWindowOrgEx(hdc, rect.left, rect.top, &pt); + + /*build a blue solid image!*/ + for(y = 0; y < src_img_height; ++y) + { + for(x = 0; x < src_img_width; ++x) + { + pixel[x] = BLUE_COLOR; + } + + pixel += src_img_width; + } + + status = GdipCreateBitmapFromScan0(src_img_width, src_img_height, src_img_width*4, + PixelFormat32bppARGB, src_img_data, &src_img.bitmap); + expect(Ok, status); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + status = GdipDrawImageRectRectI(graphics, src_img.image, + rect.left+width/2, rect.top+height/2, width/2, height/2, + 0, 0, src_img_width, src_img_height, UnitPixel, NULL, NULL, NULL); + expect(Ok, status); + + GdipDisposeImage(src_img.image); + GdipDeleteGraphics(graphics); + GdipFree(src_img_data); + + pixel = GetBitmapPixelBuffer(hdc, bmp, width, height); + if (pixel) + { + color[0] = get_bitmap_pixel(width/2, height/2); + color[1] = get_bitmap_pixel(width/2+1, height/2); + color[2] = get_bitmap_pixel(width/2, height/2+1); + color[3] = get_bitmap_pixel(width/2-1, height/2-1); + color[4] = get_bitmap_pixel(width/2-1, height-1); + color[5] = get_bitmap_pixel(width-1, height/2-1); + } + ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && + color[3] == 0 && color[4] == 0 && color[5] == 0, + "Expected GdipDrawImageRectRectI take effect!\n" ); + ReleaseBitmapPixelBuffer(pixel); + + SelectObject(hdc, old); + DeleteObject(bmp); + DeleteDC(hdc); + ReleaseDC(hwnd, dc); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; @@ -6371,6 +6613,9 @@ START_TEST(graphics) test_GdipFillRectangles(); test_GdipGetVisibleClipBounds_memoryDC(); test_GdipFillRectanglesOnMemoryDCSolidBrush(); + test_GdipFillRectanglesOnMemoryDCTextureBrush(); + test_GdipFillRectanglesOnBitmapTextureBrush(); + test_GdipDrawImagePointsRectOnMemoryDC(); test_container_rects(); test_GdipGraphicsSetAbort();
1
0
0
0
Vincent Povirk : gdiplus: Test that GdipGetRegionHRgn includes gdi32 transform.
by Alexandre Julliard
30 Aug '17
30 Aug '17
Module: wine Branch: master Commit: 0241da1c2d893013eff26f6221a499bf58867d32 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0241da1c2d893013eff26f622…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Aug 30 12:32:15 2017 -0500 gdiplus: Test that GdipGetRegionHRgn includes gdi32 transform. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/region.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c index 06c47d9..86a2e40 100644 --- a/dlls/gdiplus/tests/region.c +++ b/dlls/gdiplus/tests/region.c @@ -1118,6 +1118,8 @@ static void test_gethrgn(void) GpGraphics *graphics; HRGN hrgn; HDC hdc=GetDC(0); + INT rgntype; + RECT rgnbox; static const RECT empty_rect = {0,0,0,0}; static const RECT test_rect = {10, 11, 20, 21}; static const GpRectF test_rectF = {10.0, 11.0, 10.0, 10.0}; @@ -1238,6 +1240,35 @@ static void test_gethrgn(void) ok(status == Ok, "status %08x\n", status); status = GdipDeleteGraphics(graphics); ok(status == Ok, "status %08x\n", status); + + /* test with gdi32 transform */ + SetViewportOrgEx(hdc, 10, 10, NULL); + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + status = GdipCreateRegionRect(&test_rectF, ®ion); + expect(Ok, status); + + status = GdipGetRegionHRgn(region, graphics, &hrgn); + expect(Ok, status); + + rgntype = GetRgnBox(hrgn, &rgnbox); + DeleteObject(hrgn); + + expect(SIMPLEREGION, rgntype); + expect(20, rgnbox.left); + expect(21, rgnbox.top); + expect(30, rgnbox.right); + expect(31, rgnbox.bottom); + + status = GdipDeleteRegion(region); + expect(Ok, status); + status = GdipDeleteGraphics(graphics); + expect(Ok, status); + + SetViewportOrgEx(hdc, 0, 0, NULL); + ReleaseDC(0, hdc); }
1
0
0
0
Vincent Povirk : gdiplus: Transform clipping region to gdi device coordinates.
by Alexandre Julliard
30 Aug '17
30 Aug '17
Module: wine Branch: master Commit: 016dc76ab22f14c6f9a1c04fcc1fd494bddebe62 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=016dc76ab22f14c6f9a1c04fc…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Aug 30 12:32:14 2017 -0500 gdiplus: Transform clipping region to gdi device coordinates. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/graphics.c | 22 ++++++++++++++++++++-- dlls/gdiplus/tests/graphics.c | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index a250678..3dbb457 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -348,8 +348,26 @@ static void gdi_alpha_blend(GpGraphics *graphics, INT dst_x, INT dst_y, INT dst_ static GpStatus get_clip_hrgn(GpGraphics *graphics, HRGN *hrgn) { - /* clipping region is in device coords */ - return GdipGetRegionHRgn(graphics->clip, NULL, hrgn); + GpRegion *rgn; + GpMatrix transform; + GpStatus stat; + + stat = get_graphics_transform(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceDevice, &transform); + + if (stat == Ok) + stat = GdipCloneRegion(graphics->clip, &rgn); + + if (stat == Ok) + { + stat = GdipTransformRegion(rgn, &transform); + + if (stat == Ok) + stat = GdipGetRegionHRgn(rgn, NULL, hrgn); + + GdipDeleteRegion(rgn); + } + + return stat; } /* Draw ARGB data to the given graphics object */ diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 04e2f50..540fdfd 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -6276,7 +6276,7 @@ static void test_GdipFillRectanglesOnMemoryDCSolidBrush(void) color[5] = get_bitmap_pixel(width-1, height/2-1); } - todo_wine ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && + ok(is_blue_color(color[0]) && is_blue_color(color[1]) && is_blue_color(color[2]) && color[3] == 0 && color[4] == 0 && color[5] == 0, "Expected GdipFillRectangleI take effect!\n" ); ReleaseBitmapPixelBuffer(pixel);
1
0
0
0
Vincent Povirk : gdiplus: Test that clip region doesn' t account for gdi32 transform changes.
by Alexandre Julliard
30 Aug '17
30 Aug '17
Module: wine Branch: master Commit: c579661006041d0fb28287dd22029339446a34d0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c579661006041d0fb28287dd2…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Aug 30 12:32:13 2017 -0500 gdiplus: Test that clip region doesn't account for gdi32 transform changes. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/graphics.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 74d85d1..04e2f50 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -4959,6 +4959,16 @@ static void test_clipping(void) ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0, "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height); + /* Clip region does not account for changes to gdi32 transform */ + SetViewportOrgEx(hdc, 10, 10, NULL); + + status = GdipGetClipBounds(graphics, &rect); + expect(Ok, status); + ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0, + "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height); + + SetViewportOrgEx(hdc, 0, 0, NULL); + status = GdipSetEmpty(region); expect(Ok, status); status = GdipGetClip(graphics, region);
1
0
0
0
← Newer
1
2
3
4
5
6
...
36
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
Results per page:
10
25
50
100
200