winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 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
1024 discussions
Start a n
N
ew thread
Eric Pouech : server: Use negative values for console pseudo handles.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: 95202ea4da95f724a6d98320cacd04b41b4f234e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=95202ea4da95f724a6d98320…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Mon Apr 11 15:05:03 2022 +0200 server: Use negative values for console pseudo handles. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/condrv.h | 6 +++--- server/process.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/wine/condrv.h b/include/wine/condrv.h index 452ce552da1..2d763d0b821 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -188,8 +188,8 @@ struct condrv_ctrl_event }; /* Wine specific values for console inheritance (params->ConsoleHandle) */ -#define CONSOLE_HANDLE_ALLOC UlongToHandle(1) -#define CONSOLE_HANDLE_ALLOC_NO_WINDOW UlongToHandle(2) -#define CONSOLE_HANDLE_SHELL UlongToHandle(3) +#define CONSOLE_HANDLE_ALLOC LongToHandle(-1) +#define CONSOLE_HANDLE_ALLOC_NO_WINDOW LongToHandle(-2) +#define CONSOLE_HANDLE_SHELL LongToHandle(-3) #endif /* _INC_CONDRV */ diff --git a/server/process.c b/server/process.c index 65e2aa70de2..d1407204718 100644 --- a/server/process.c +++ b/server/process.c @@ -1333,8 +1333,8 @@ DECL_HANDLER(new_process) /* connect to the window station */ connect_process_winstation( process, parent_thread, parent ); - /* set the process console */ - if (info->data->console > 3) + /* inherit the process console, but keep pseudo handles (< 0), and 0 (= not attached to a console) as is */ + if ((int)info->data->console > 0) info->data->console = duplicate_handle( parent, info->data->console, process, 0, 0, DUPLICATE_SAME_ACCESS );
1
0
0
0
Jacek Caban : kernelbase: Add support for CREATE_NO_WINDOW flag in CreateProcess.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: b4d91adb16565c9d12a70cb29c2d25cdb3665488 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b4d91adb16565c9d12a70cb2…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Apr 11 15:04:56 2022 +0200 kernelbase: Add support for CREATE_NO_WINDOW flag in CreateProcess. Based on patches by Eric Pouech and Torge Matthies. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 3 --- dlls/kernelbase/console.c | 21 +++++++++++++++------ dlls/kernelbase/process.c | 11 +++++++---- dlls/ntdll/unix/process.c | 2 ++ include/wine/condrv.h | 5 +++-- programs/conhost/conhost.c | 11 ++++++++--- programs/conhost/conhost.h | 1 + 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index da19e3c6a3f..5d65b0b75e7 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -4754,7 +4754,6 @@ static void test_CreateProcessCUI(void) res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE); ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); res = check_child_console_bits(cuiexec, CREATE_NO_WINDOW); - todo_wine ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_ALONE), "Unexpected result %x\n", res); res = check_child_console_bits(cuiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); ok(res == 0, "Unexpected result %x\n", res); @@ -4771,7 +4770,6 @@ static void test_CreateProcessCUI(void) res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE); ok(res == 0, "Unexpected result %x\n", res); res = check_child_console_bits(guiexec, CREATE_NO_WINDOW); - todo_wine ok(res == 0, "Unexpected result %x\n", res); res = check_child_console_bits(guiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); ok(res == 0, "Unexpected result %x\n", res); @@ -4785,7 +4783,6 @@ static void test_CreateProcessCUI(void) res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE); ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); res = check_child_console_bits(cuiexec, CREATE_NO_WINDOW); - todo_wine ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_ALONE), "Unexpected result %x\n", res); res = check_child_console_bits(cuiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); ok(res == 0, "Unexpected result %x\n", res); diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index b2bb6c53fd9..046eee6147c 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -361,10 +361,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH AttachConsole( DWORD pid ) } -/****************************************************************** - * AllocConsole (kernelbase.@) - */ -BOOL WINAPI AllocConsole(void) +static BOOL alloc_console( BOOL headless ) { SECURITY_ATTRIBUTES inheritable_attr = { sizeof(inheritable_attr), NULL, TRUE }; STARTUPINFOW app_si, console_si; @@ -419,6 +416,7 @@ BOOL WINAPI AllocConsole(void) swprintf( conhost_path, ARRAY_SIZE(conhost_path), L"%s\\conhost.exe", system_dir ); swprintf( cmd, ARRAY_SIZE(cmd), L"\"%s\" --server 0x%x", conhost_path, condrv_handle( server )); + if (headless) wcscat( cmd, L" --headless" ); Wow64DisableWow64FsRedirection( &redir ); ret = CreateProcessW( conhost_path, cmd, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &console_si, &pi ); Wow64RevertWow64FsRedirection( redir ); @@ -444,6 +442,15 @@ error: } +/****************************************************************** + * AllocConsole (kernelbase.@) + */ +BOOL WINAPI AllocConsole(void) +{ + return alloc_console( FALSE ); +} + + /****************************************************************************** * CreateConsoleScreenBuffer (kernelbase.@) */ @@ -2287,12 +2294,14 @@ void init_console( void ) init_console_std_handles( FALSE ); } } - else if (params->ConsoleHandle == CONSOLE_HANDLE_ALLOC) + else if (params->ConsoleHandle == CONSOLE_HANDLE_ALLOC || + params->ConsoleHandle == CONSOLE_HANDLE_ALLOC_NO_WINDOW) { + BOOL no_window = params->ConsoleHandle == CONSOLE_HANDLE_ALLOC_NO_WINDOW; HMODULE mod = GetModuleHandleW( NULL ); params->ConsoleHandle = NULL; if (RtlImageNtHeader( mod )->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) - AllocConsole(); + alloc_console( no_window ); } else if (params->ConsoleHandle) create_console_connection( params->ConsoleHandle ); } diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 1cecbce9321..32f622bdf3e 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -193,8 +193,12 @@ static RTL_USER_PROCESS_PARAMETERS *create_process_params( const WCHAR *filename if (flags & CREATE_NEW_CONSOLE) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC; else if (!(flags & DETACHED_PROCESS)) { - params->ConsoleHandle = NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle; - if (!params->ConsoleHandle) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC; + if (flags & CREATE_NO_WINDOW) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC_NO_WINDOW; + else + { + params->ConsoleHandle = NtCurrentTeb()->Peb->ProcessParameters->ConsoleHandle; + if (!params->ConsoleHandle) params->ConsoleHandle = CONSOLE_HANDLE_ALLOC; + } } if (startup->dwFlags & STARTF_USESTDHANDLES) @@ -532,8 +536,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR /* Warn if unsupported features are used */ if (flags & (IDLE_PRIORITY_CLASS | HIGH_PRIORITY_CLASS | REALTIME_PRIORITY_CLASS | - CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW | - PROFILE_USER | PROFILE_KERNEL | PROFILE_SERVER)) + CREATE_DEFAULT_ERROR_MODE | PROFILE_USER | PROFILE_KERNEL | PROFILE_SERVER)) WARN( "(%s,...): ignoring some flags in %lx\n", debugstr_w(app_name), flags ); if (cur_dir) diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 99c8e37053c..078ad75099d 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -445,6 +445,7 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so { if (params->ConsoleFlags || params->ConsoleHandle == CONSOLE_HANDLE_ALLOC || + params->ConsoleHandle == CONSOLE_HANDLE_ALLOC_NO_WINDOW || (params->hStdInput == INVALID_HANDLE_VALUE && params->hStdOutput == INVALID_HANDLE_VALUE)) { setsid(); @@ -585,6 +586,7 @@ static NTSTATUS fork_and_exec( OBJECT_ATTRIBUTES *attr, int unixdir, if (params->ConsoleFlags || params->ConsoleHandle == CONSOLE_HANDLE_ALLOC || + params->ConsoleHandle == CONSOLE_HANDLE_ALLOC_NO_WINDOW || (params->hStdInput == INVALID_HANDLE_VALUE && params->hStdOutput == INVALID_HANDLE_VALUE)) { setsid(); diff --git a/include/wine/condrv.h b/include/wine/condrv.h index 1000e62e765..452ce552da1 100644 --- a/include/wine/condrv.h +++ b/include/wine/condrv.h @@ -188,7 +188,8 @@ struct condrv_ctrl_event }; /* Wine specific values for console inheritance (params->ConsoleHandle) */ -#define CONSOLE_HANDLE_ALLOC ((HANDLE)1) -#define CONSOLE_HANDLE_SHELL ((HANDLE)2) +#define CONSOLE_HANDLE_ALLOC UlongToHandle(1) +#define CONSOLE_HANDLE_ALLOC_NO_WINDOW UlongToHandle(2) +#define CONSOLE_HANDLE_SHELL UlongToHandle(3) #endif /* _INC_CONDRV */ diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index d494e3f53a5..6ea64395e1a 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -2650,7 +2650,7 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code, TRACE( "get window\n" ); if (in_size || *out_size != sizeof(*result)) return STATUS_INVALID_PARAMETER; if (!(result = alloc_ioctl_buffer( sizeof(*result )))) return STATUS_NO_MEMORY; - if (!console->win) init_message_window( console ); + if (!console->win && !console->no_window) init_message_window( console ); *result = condrv_handle( console->win ); return STATUS_SUCCESS; } @@ -2929,8 +2929,13 @@ int __cdecl wmain(int argc, WCHAR *argv[]) { console.tty_input = GetStdHandle( STD_INPUT_HANDLE ); console.tty_output = GetStdHandle( STD_OUTPUT_HANDLE ); - init_tty_output( &console ); - if (!console.is_unix && !ensure_tty_input_thread( &console )) return 1; + + if (console.tty_input || console.tty_output) + { + init_tty_output( &console ); + if (!console.is_unix && !ensure_tty_input_thread( &console )) return 1; + } + else console.no_window = TRUE; } else { diff --git a/programs/conhost/conhost.h b/programs/conhost/conhost.h index 8ca09bb80d0..65cf5d39ebd 100644 --- a/programs/conhost/conhost.h +++ b/programs/conhost/conhost.h @@ -79,6 +79,7 @@ struct console struct screen_buffer *active; /* active screen buffer */ int is_unix; /* UNIX terminal mode */ int use_relative_cursor; /* use relative cursor positionning */ + int no_window; /* don't create console window */ INPUT_RECORD *records; /* input records */ unsigned int record_count; /* number of input records */ unsigned int record_size; /* size of input records buffer */
1
0
0
0
Eric Pouech : kernel32/tests: Add more CreateProcess console management tests.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: 313b10991b63c6d1204f8dda97b8b2a83719d2d4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=313b10991b63c6d1204f8dda…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Mon Apr 11 15:04:50 2022 +0200 kernel32/tests: Add more CreateProcess console management tests. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 89 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 13 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 98692760acf..da19e3c6a3f 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -4689,7 +4689,7 @@ static void copy_change_subsystem(const char* in, const char* out, DWORD subsyst CloseHandle(hFile); } -static BOOL check_whether_child_attached(const char* exec, DWORD flags) +static DWORD check_child_console_bits(const char* exec, DWORD flags) { STARTUPINFOA si = { sizeof(si) }; PROCESS_INFORMATION info; @@ -4705,12 +4705,18 @@ static BOOL check_whether_child_attached(const char* exec, DWORD flags) ret = WaitForSingleObject(info.hProcess, 30000); ok(ret == WAIT_OBJECT_0, "Could not wait for the child process: %ld le=%lu\n", ret, GetLastError()); - ret = GetExitCodeProcess(info.hProcess, &exit_code); - ok(ret && exit_code <= 255, "Couldn't get exit_code\n"); + res = GetExitCodeProcess(info.hProcess, &exit_code); + ok(res && exit_code <= 255, "Couldn't get exit_code\n"); CloseHandle(info.hProcess); - return exit_code != 0; + return exit_code; } +#define CP_WITH_CONSOLE 0x01 /* attached to a console */ +#define CP_WITH_HANDLE 0x02 /* child has a console handle */ +#define CP_WITH_WINDOW 0x04 /* child has a console window */ +#define CP_ALONE 0x08 /* whether child is the single process attached to console */ +#define CP_GROUP_LEADER 0x10 /* whether the child is the process group leader */ + static void test_CreateProcessCUI(void) { char guiexec[MAX_PATH]; @@ -4728,14 +4734,63 @@ static void test_CreateProcessCUI(void) FreeConsole(); - res = check_whether_child_attached(guiexec, DETACHED_PROCESS); - ok(!res, "Don't expecting child to be attached to a console\n"); - res = check_whether_child_attached(guiexec, 0); - ok(!res, "Don't expecting child to be attached to a console\n"); - res = check_whether_child_attached(cuiexec, DETACHED_PROCESS); - ok(!res, "Don't expecting child to be attached to a console\n"); - res = check_whether_child_attached(cuiexec, 0); - ok(res, "Expecting child to be attached to a console\n"); + res = check_child_console_bits(guiexec, 0); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, DETACHED_PROCESS); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + + res = check_child_console_bits(cuiexec, 0); + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, DETACHED_PROCESS); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE); + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, CREATE_NO_WINDOW); + todo_wine + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_ALONE), "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW); + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); + + AllocConsole(); + + res = check_child_console_bits(guiexec, 0); + todo_wine + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, DETACHED_PROCESS); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, CREATE_NO_WINDOW); + todo_wine + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(guiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + + res = check_child_console_bits(cuiexec, 0); + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW), "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, DETACHED_PROCESS); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE); + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, CREATE_NO_WINDOW); + todo_wine + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_ALONE), "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, DETACHED_PROCESS | CREATE_NO_WINDOW); + ok(res == 0, "Unexpected result %x\n", res); + res = check_child_console_bits(cuiexec, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW); + ok(res == (CP_WITH_CONSOLE | CP_WITH_HANDLE | CP_WITH_WINDOW | CP_ALONE), "Unexpected result %x\n", res); DeleteFileA(guiexec); DeleteFileA(cuiexec); @@ -4771,7 +4826,15 @@ START_TEST(console) if (argc == 3 && !strcmp(argv[2], "check_console")) { - ExitProcess(GetConsoleCP() != 0); + DWORD exit_code = 0, pcslist; + if (GetConsoleCP() != 0) exit_code |= CP_WITH_CONSOLE; + if (RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle) exit_code |= CP_WITH_HANDLE; + if (IsWindow(GetConsoleWindow())) exit_code |= CP_WITH_WINDOW; + if (pGetConsoleProcessList && GetConsoleProcessList(&pcslist, 1) == 1) + exit_code |= CP_ALONE; + if (RtlGetCurrentPeb()->ProcessParameters->ProcessGroupId == GetCurrentProcessId()) + exit_code |= CP_GROUP_LEADER; + ExitProcess(exit_code); } test_current = argc >= 3 && !strcmp(argv[2], "--current");
1
0
0
0
Ziqing Hui : d2d1: Implement GetImageLocalBounds() for bitmap.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: c037144db7be4ea2ebc6cbe9e14cdf207954a514 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c037144db7be4ea2ebc6cbe9…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Mon Apr 11 10:59:54 2022 +0800 d2d1: Implement GetImageLocalBounds() for bitmap. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/device.c | 36 +++++++++++++++++++++++++++++++++++- dlls/d2d1/tests/d2d1.c | 7 ++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/dlls/d2d1/device.c b/dlls/d2d1/device.c index ea38ca41c8c..43c65ebddc1 100644 --- a/dlls/d2d1/device.c +++ b/dlls/d2d1/device.c @@ -1978,7 +1978,41 @@ static BOOL STDMETHODCALLTYPE d2d_device_context_IsBufferPrecisionSupported(ID2D static void STDMETHODCALLTYPE d2d_device_context_GetImageLocalBounds(ID2D1DeviceContext *iface, ID2D1Image *image, D2D1_RECT_F *local_bounds) { - FIXME("iface %p, image %p, local_bounds %p stub!\n", iface, image, local_bounds); + struct d2d_device_context *context = impl_from_ID2D1DeviceContext(iface); + D2D_SIZE_U pixel_size; + ID2D1Bitmap *bitmap; + D2D_SIZE_F size; + + TRACE("iface %p, image %p, local_bounds %p.\n", iface, image, local_bounds); + + if (SUCCEEDED(ID2D1Image_QueryInterface(image, &IID_ID2D1Bitmap, (void **)&bitmap))) + { + local_bounds->left = 0.0f; + local_bounds->top = 0.0f; + switch (context->drawing_state.unitMode) + { + case D2D1_UNIT_MODE_DIPS: + size = ID2D1Bitmap_GetSize(bitmap); + local_bounds->right = size.width; + local_bounds->bottom = size.height; + break; + + case D2D1_UNIT_MODE_PIXELS: + pixel_size = ID2D1Bitmap_GetPixelSize(bitmap); + local_bounds->right = pixel_size.width; + local_bounds->bottom = pixel_size.height; + break; + + default: + WARN("Unknown unit mode %#x.\n", context->drawing_state.unitMode); + break; + } + ID2D1Bitmap_Release(bitmap); + } + else + { + FIXME("Unable to get local bounds of image %p.\n", image); + } } static HRESULT STDMETHODCALLTYPE d2d_device_context_GetImageWorldBounds(ID2D1DeviceContext *iface, diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index cd068f78bfa..e412459ebf2 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -10824,7 +10824,7 @@ static void test_image_bounds(BOOL d3d11) set_rect(&bounds, 0.0f, 0.0f, 0.0f, 0.0f); size = ID2D1Bitmap_GetSize(bitmap); ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); - todo_wine ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), + ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height); @@ -10832,7 +10832,7 @@ static void test_image_bounds(BOOL d3d11) ID2D1DeviceContext_GetDpi(context, &dpi_x, &dpi_y); ID2D1DeviceContext_SetDpi(context, dpi_x * 2.0f, dpi_y * 2.0f); ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); - todo_wine ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), + ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height); ID2D1DeviceContext_SetDpi(context, dpi_x, dpi_y); @@ -10842,7 +10842,8 @@ static void test_image_bounds(BOOL d3d11) ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode); ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS); ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); - todo_wine ok(compare_rect(&bounds, 0.0f, 0.0f, test->pixel_size.width, test->pixel_size.height, 0), + todo_wine_if(!compare_float(test->dpi_x, 96.0f, 0) || !compare_float(test->dpi_y, 96.0f, 0)) + ok(compare_rect(&bounds, 0.0f, 0.0f, test->pixel_size.width, test->pixel_size.height, 0), "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, (float)test->pixel_size.width, (float)test->pixel_size.height);
1
0
0
0
Ziqing Hui : d2d1/tests: Add tests for GetImageLocalBounds().
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: 1f0b080f1529215678d8471a0d639d17dc4e5bd1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1f0b080f1529215678d8471a…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Mon Apr 11 10:59:53 2022 +0800 d2d1/tests: Add tests for GetImageLocalBounds(). Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/tests/d2d1.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 826526d9d38..cd068f78bfa 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -10764,6 +10764,99 @@ static void test_stroke_contains_point(BOOL d3d11) ID2D1Factory_Release(factory); } +static void test_image_bounds(BOOL d3d11) +{ + D2D1_BITMAP_PROPERTIES bitmap_desc; + struct d2d1_test_context ctx; + ID2D1DeviceContext *context; + D2D1_UNIT_MODE unit_mode; + ID2D1Factory1 *factory; + ID2D1Bitmap *bitmap; + float dpi_x, dpi_y; + D2D_RECT_F bounds; + D2D1_SIZE_F size; + unsigned int i; + HRESULT hr; + + const struct bitmap_bounds_test + { + float dpi_x; + float dpi_y; + D2D_SIZE_U pixel_size; + } + bitmap_bounds_tests[] = + { + {96.0f, 96.0f, {100, 100}}, + {48.0f, 48.0f, {100, 100}}, + {192.0f, 192.0f, {100, 100}}, + {96.0f, 10.0f, {100, 100}}, + {50.0f, 100.0f, {100, 100}}, + {150.0f, 150.0f, {100, 100}}, + {48.0f, 48.0f, {1, 1}}, + {192.0f, 192.0f, {1, 1}}, + }; + + if (!init_test_context(&ctx, d3d11)) + return; + + if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &IID_ID2D1Factory1, NULL, (void **)&factory))) + { + win_skip("ID2D1Factory1 is not supported.\n"); + release_test_context(&ctx); + return; + } + + hr = ID2D1RenderTarget_QueryInterface(ctx.rt, &IID_ID2D1DeviceContext, (void **)&context); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + for (i = 0; i < ARRAY_SIZE(bitmap_bounds_tests); ++i) + { + const struct bitmap_bounds_test *test = &bitmap_bounds_tests[i]; + winetest_push_context("Test %u", i); + + bitmap_desc.dpiX = test->dpi_x; + bitmap_desc.dpiY = test->dpi_y; + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, test->pixel_size, NULL, 0, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + set_rect(&bounds, 0.0f, 0.0f, 0.0f, 0.0f); + size = ID2D1Bitmap_GetSize(bitmap); + ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + todo_wine ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), + "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height); + + /* Test bitmap local bounds after changing context dpi */ + ID2D1DeviceContext_GetDpi(context, &dpi_x, &dpi_y); + ID2D1DeviceContext_SetDpi(context, dpi_x * 2.0f, dpi_y * 2.0f); + ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + todo_wine ok(compare_rect(&bounds, 0.0f, 0.0f, size.width, size.height, 0), + "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, size.width, size.height); + ID2D1DeviceContext_SetDpi(context, dpi_x, dpi_y); + + /* Test bitmap local bounds after changing context unit mode */ + unit_mode = ID2D1DeviceContext_GetUnitMode(context); + ok(unit_mode == D2D1_UNIT_MODE_DIPS, "Got unexpected unit mode %#x.\n", unit_mode); + ID2D1DeviceContext_SetUnitMode(context, D2D1_UNIT_MODE_PIXELS); + ID2D1DeviceContext_GetImageLocalBounds(context, (ID2D1Image *)bitmap, &bounds); + todo_wine ok(compare_rect(&bounds, 0.0f, 0.0f, test->pixel_size.width, test->pixel_size.height, 0), + "Got unexpected bounds {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + bounds.left, bounds.top, bounds.right, bounds.bottom, 0.0f, 0.0f, + (float)test->pixel_size.width, (float)test->pixel_size.height); + ID2D1DeviceContext_SetUnitMode(context, unit_mode); + + ID2D1Bitmap_Release(bitmap); + winetest_pop_context(); + } + + ID2D1DeviceContext_Release(context); + ID2D1Factory1_Release(factory); + release_test_context(&ctx); +} + START_TEST(d2d1) { HMODULE d2d1_dll = GetModuleHandleA("d2d1.dll"); @@ -10835,6 +10928,7 @@ START_TEST(d2d1) queue_test(test_effect_crop); queue_test(test_effect_grayscale); queue_d3d10_test(test_stroke_contains_point); + queue_test(test_image_bounds); run_queued_tests(); }
1
0
0
0
Jacek Caban : winex11: Directly use win32u for GDI functions in more places.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: 3a11be1d48251ecbc0b99d7f4b3325bddbcd486b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3a11be1d48251ecbc0b99d7f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Apr 12 13:10:35 2022 +0200 winex11: Directly use win32u for GDI functions in more places. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/brush.c | 6 +++--- dlls/winex11.drv/event.c | 4 ++-- dlls/winex11.drv/init.c | 15 +++++++++------ dlls/winex11.drv/mouse.c | 40 +++++++++++++++++++++------------------- dlls/winex11.drv/opengl.c | 17 ++++++++++------- dlls/winex11.drv/pen.c | 10 +++++----- 6 files changed, 50 insertions(+), 42 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=3a11be1d48251ecbc0b9…
1
0
0
0
Jacek Caban : winex11: Directly use win32u for GDI functions in xrender.c.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: b01bf347ad2a7799ccd94dfc8a22d7898204691c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b01bf347ad2a7799ccd94dfc…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Apr 12 13:10:16 2022 +0200 winex11: Directly use win32u for GDI functions in xrender.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/xrender.c | 60 ++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 5ede97fb026..fd92bd63389 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -388,11 +388,11 @@ static void get_xrender_color( struct xrender_physdev *physdev, COLORREF src_col { if (src_color & (1 << 24)) /* PALETTEINDEX */ { - HPALETTE pal = GetCurrentObject( physdev->dev.hdc, OBJ_PAL ); + HPALETTE pal = NtGdiGetDCObject( physdev->dev.hdc, NTGDI_OBJ_PAL ); PALETTEENTRY pal_ent; - if (!GetPaletteEntries( pal, LOWORD(src_color), 1, &pal_ent )) - GetPaletteEntries( pal, 0, 1, &pal_ent ); + if (!get_palette_entries( pal, LOWORD(src_color), 1, &pal_ent )) + get_palette_entries( pal, 0, 1, &pal_ent ); dst_color->red = pal_ent.peRed * 257; dst_color->green = pal_ent.peGreen * 257; dst_color->blue = pal_ent.peBlue * 257; @@ -499,20 +499,20 @@ static Picture get_xrender_picture( struct xrender_physdev *dev, HRGN clip_rgn, if (clip_rect) { - HRGN rgn = CreateRectRgnIndirect( clip_rect ); - if (clip_rgn) CombineRgn( rgn, rgn, clip_rgn, RGN_AND ); - if (dev->region) CombineRgn( rgn, rgn, dev->region, RGN_AND ); + HRGN rgn = NtGdiCreateRectRgn( clip_rect->left, clip_rect->top, clip_rect->right, clip_rect->bottom ); + if (clip_rgn) NtGdiCombineRgn( rgn, rgn, clip_rgn, RGN_AND ); + if (dev->region) NtGdiCombineRgn( rgn, rgn, dev->region, RGN_AND ); update_xrender_clipping( dev, rgn ); - DeleteObject( rgn ); + NtGdiDeleteObjectApp( rgn ); } else if (clip_rgn) { if (dev->region) { - HRGN rgn = CreateRectRgn( 0, 0, 0, 0 ); - CombineRgn( rgn, clip_rgn, dev->region, RGN_AND ); + HRGN rgn = NtGdiCreateRectRgn( 0, 0, 0, 0 ); + NtGdiCombineRgn( rgn, clip_rgn, dev->region, RGN_AND ); update_xrender_clipping( dev, rgn ); - DeleteObject( rgn ); + NtGdiDeleteObjectApp( rgn ); } else update_xrender_clipping( dev, clip_rgn ); } @@ -829,9 +829,10 @@ static HFONT CDECL xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_fla LFANDSIZE lfsz; struct xrender_physdev *physdev = get_xrender_dev( dev ); PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectFont ); + DWORD mode; HFONT ret; - GetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf ); + NtGdiExtGetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf ); if (!*aa_flags) *aa_flags = get_xft_aa_flags( &lfsz.lf ); ret = next->funcs->pSelectFont( next, hfont, aa_flags ); @@ -859,11 +860,12 @@ static HFONT CDECL xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont, UINT *aa_fla lfsz.devsize.cx = X11DRV_XWStoDS( dev->hdc, lfsz.lf.lfWidth ); lfsz.devsize.cy = X11DRV_YWStoDS( dev->hdc, lfsz.lf.lfHeight ); - GetTransform( dev->hdc, 0x204, &lfsz.xform ); + NtGdiGetTransform( dev->hdc, 0x204, &lfsz.xform ); TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12, lfsz.xform.eM21, lfsz.xform.eM22); - if (GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) + NtGdiGetDCDword( dev->hdc, NtGdiGetGraphicsMode, &mode ); + if (mode == GM_COMPATIBLE) { lfsz.lf.lfOrientation = lfsz.lf.lfEscapement; if (lfsz.xform.eM11 * lfsz.xform.eM22 < 0) @@ -1038,20 +1040,23 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_ static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; if (type == GLYPH_INDEX) ggo_format |= GGO_GLYPH_INDEX; - buflen = GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity); + buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity, FALSE ); if(buflen == GDI_ERROR) { if(format != AA_None) { format = AA_None; physDev->aa_flags = GGO_BITMAP; ggo_format = (ggo_format & GGO_GLYPH_INDEX) | GGO_BITMAP; - buflen = GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, &identity); + buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, 0, NULL, + &identity, FALSE); } if(buflen == GDI_ERROR) { WARN("GetGlyphOutlineW failed using default glyph\n"); - buflen = GetGlyphOutlineW(physDev->dev.hdc, 0, ggo_format, &gm, 0, NULL, &identity); + buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, 0, ggo_format, &gm, 0, NULL, + &identity, FALSE ); if(buflen == GDI_ERROR) { WARN("GetGlyphOutlineW failed for default glyph trying for space\n"); - buflen = GetGlyphOutlineW(physDev->dev.hdc, 0x20, ggo_format, &gm, 0, NULL, &identity); + buflen = NtGdiGetGlyphOutline( physDev->dev.hdc, 0x20, ggo_format, &gm, 0, NULL, + &identity, FALSE ); if(buflen == GDI_ERROR) { ERR("GetGlyphOutlineW for all attempts unable to upload a glyph\n"); return; @@ -1122,7 +1127,7 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen); if (buflen) - GetGlyphOutlineW(physDev->dev.hdc, glyph, ggo_format, &gm, buflen, buf, &identity); + NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, buflen, buf, &identity, FALSE ); else gm.gmBlackBoxX = gm.gmBlackBoxY = 0; /* empty glyph */ formatEntry->realized[glyph] = TRUE; @@ -1309,6 +1314,7 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, gsCacheEntry *entry; gsCacheEntryFormat *formatEntry; unsigned int idx; + DWORD text_color; Picture pict, tile_pict = 0; XGlyphElt16 *elts; POINT offset, desired, current; @@ -1317,7 +1323,8 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, RECT rect, bounds; enum glyph_type type = (flags & ETO_GLYPH_INDEX) ? GLYPH_INDEX : GLYPH_WCHAR; - get_xrender_color( physdev, GetTextColor( physdev->dev.hdc ), &col ); + NtGdiGetDCDword( physdev->dev.hdc, NtGdiGetTextColor, &text_color ); + get_xrender_color( physdev, text_color, &col ); pict = get_xrender_picture( physdev, 0, (flags & ETO_CLIPPED) ? lprect : NULL ); if(flags & ETO_OPAQUE) @@ -1328,7 +1335,11 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, /* use the inverse of the text color */ bg.red = bg.green = bg.blue = bg.alpha = ~col.alpha; else - get_xrender_color( physdev, GetBkColor( physdev->dev.hdc ), &bg ); + { + DWORD bg_color; + NtGdiGetDCDword( physdev->dev.hdc, NtGdiGetBkColor, &bg_color ); + get_xrender_color( physdev, bg_color, &bg ); + } set_xrender_transformation( pict, 1, 1, 0, 0 ); pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &bg, @@ -1648,10 +1659,13 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr /* mono -> color */ if (physdev_src->format == WXR_FORMAT_MONO && physdev_dst->format != WXR_FORMAT_MONO) { + DWORD text_color, bg_color; XRenderColor fg, bg; - get_xrender_color( physdev_dst, GetTextColor( physdev_dst->dev.hdc ), &fg ); - get_xrender_color( physdev_dst, GetBkColor( physdev_dst->dev.hdc ), &bg ); + NtGdiGetDCDword( physdev_dst->dev.hdc, NtGdiGetTextColor, &text_color ); + NtGdiGetDCDword( physdev_dst->dev.hdc, NtGdiGetBkColor, &bg_color ); + get_xrender_color( physdev_dst, text_color, &fg ); + get_xrender_color( physdev_dst, bg_color, &bg ); fg.alpha = bg.alpha = 0; xrender_mono_blit( src_pict, dst_pict, physdev_dst->format, &fg, &bg, @@ -2057,7 +2071,7 @@ static BOOL CDECL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, U pt[0].y = v1->y; pt[1].x = v2->x; pt[1].y = v2->y; - LPtoDP( dev->hdc, pt, 2 ); + lp_to_dp( dev->hdc, pt, 2 ); if (mode == GRADIENT_FILL_RECT_H) { gradient.p1.y = gradient.p2.y = 0;
1
0
0
0
Jacek Caban : winex11: Directly use win32u for GDI functions in palette.c.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: 37f31840b90f9de83052c7fe377b4f8c1d5daed2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=37f31840b90f9de83052c7fe…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Apr 12 13:10:03 2022 +0200 winex11: Directly use win32u for GDI functions in palette.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/palette.c | 39 ++++++++++++++++++++------------------- dlls/winex11.drv/x11drv.h | 5 +++++ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index 8fbd7820c95..ffed08d1f35 100644 --- a/dlls/winex11.drv/palette.c +++ b/dlls/winex11.drv/palette.c @@ -337,7 +337,7 @@ int X11DRV_PALETTE_Init(void) } else { - GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, sys_pal_template ); + get_palette_entries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, sys_pal_template ); if ((mapping = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(int) * NB_RESERVED_COLORS ))) palette_set_mapping( GetStockObject(DEFAULT_PALETTE), mapping ); @@ -881,20 +881,20 @@ static int X11DRV_SysPaletteLookupPixel( COLORREF col, BOOL skipReserved ) */ COLORREF X11DRV_PALETTE_GetColor( X11DRV_PDEVICE *physDev, COLORREF color ) { - HPALETTE hPal = GetCurrentObject(physDev->dev.hdc, OBJ_PAL ); - PALETTEENTRY entry; + HPALETTE hPal = NtGdiGetDCObject( physDev->dev.hdc, NTGDI_OBJ_PAL ); + PALETTEENTRY entry; if (color & (1 << 24)) /* PALETTEINDEX */ { unsigned int idx = LOWORD(color); - if (!GetPaletteEntries( hPal, idx, 1, &entry )) return 0; + if (!get_palette_entries( hPal, idx, 1, &entry )) return 0; return RGB( entry.peRed, entry.peGreen, entry.peBlue ); } if (color >> 24 == 2) /* PALETTERGB */ { - unsigned int idx = GetNearestPaletteIndex( hPal, color & 0xffffff ); - if (!GetPaletteEntries( hPal, idx, 1, &entry )) return 0; + unsigned int idx = NtGdiGetNearestPaletteIndex( hPal, color & 0xffffff ); + if (!get_palette_entries( hPal, idx, 1, &entry )) return 0; return RGB( entry.peRed, entry.peGreen, entry.peBlue ); } @@ -911,8 +911,8 @@ COLORREF X11DRV_PALETTE_GetColor( X11DRV_PDEVICE *physDev, COLORREF color ) */ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color ) { - WORD index = 0; - HPALETTE hPal = GetCurrentObject(physDev->dev.hdc, OBJ_PAL ); + WORD index = 0; + HPALETTE hPal = NtGdiGetDCObject( physDev->dev.hdc, NTGDI_OBJ_PAL ); int *mapping = palette_get_mapping( hPal ); PALETTEENTRY entry; ColorShifts *shifts = &X11DRV_PALETTE_default_shifts; @@ -931,7 +931,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color ) { unsigned int idx = LOWORD( color ); - if (!GetPaletteEntries( hPal, idx, 1, &entry )) + if (!get_palette_entries( hPal, idx, 1, &entry )) { WARN("PALETTEINDEX(%x) : idx %d is out of bounds, assuming black\n", color, idx); return 0; @@ -990,13 +990,13 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color ) if (color & (1 << 24)) /* PALETTEINDEX */ { index = LOWORD( color ); - if (!GetPaletteEntries( hPal, index, 1, &entry )) + if (!get_palette_entries( hPal, index, 1, &entry )) WARN("PALETTEINDEX(%x) : index %i is out of bounds\n", color, index); else if (mapping) index = mapping[index]; } else if (color >> 24 == 2) /* PALETTERGB */ { - index = GetNearestPaletteIndex( hPal, color ); + index = NtGdiGetNearestPaletteIndex( hPal, color ); if (mapping) index = mapping[index]; } else if (color >> 16 == 0x10ff) /* DIBINDEX */ @@ -1197,7 +1197,7 @@ UINT CDECL X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary ) if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) return 0; - if (!GetObjectW( hpal, sizeof(num_entries), &num_entries )) return 0; + if (!NtGdiExtGetObjectW( hpal, sizeof(num_entries), &num_entries )) return 0; /* initialize palette mapping table */ prev_mapping = palette_get_mapping( hpal ); @@ -1217,7 +1217,7 @@ UINT CDECL X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary ) FIXME( "more than 256 entries not supported\n" ); num_entries = 256; } - if (!(num_entries = GetPaletteEntries( hpal, 0, num_entries, entries ))) return 0; + if (!(num_entries = get_palette_entries( hpal, 0, num_entries, entries ))) return 0; /* reset dynamic system palette entries */ @@ -1361,19 +1361,19 @@ COLORREF CDECL X11DRV_GetNearestColor( PHYSDEV dev, COLORREF color ) UINT index; PALETTEENTRY entry; - HPALETTE hpal = GetCurrentObject( dev->hdc, OBJ_PAL ); + HPALETTE hpal = NtGdiGetDCObject( dev->hdc, NTGDI_OBJ_PAL ); if (!hpal) hpal = GetStockObject( DEFAULT_PALETTE ); if (spec_type == 2) /* PALETTERGB */ - index = GetNearestPaletteIndex( hpal, color ); + index = NtGdiGetNearestPaletteIndex( hpal, color ); else /* PALETTEINDEX */ index = LOWORD(color); - if (!GetPaletteEntries( hpal, index, 1, &entry )) + if (!get_palette_entries( hpal, index, 1, &entry )) { WARN("RGB(%x) : idx %d is out of bounds, assuming NULL\n", color, index ); - if (!GetPaletteEntries( hpal, 0, 1, &entry )) return CLR_INVALID; + if (!get_palette_entries( hpal, 0, 1, &entry )) return CLR_INVALID; } color = RGB( entry.peRed, entry.peGreen, entry.peBlue ); } @@ -1392,15 +1392,16 @@ COLORREF CDECL X11DRV_GetNearestColor( PHYSDEV dev, COLORREF color ) */ UINT CDECL X11DRV_RealizeDefaultPalette( PHYSDEV dev ) { + DWORD is_memdc; UINT ret = 0; - if (palette_size && GetObjectType(dev->hdc) != OBJ_MEMDC) + if (palette_size && NtGdiGetDCDword( dev->hdc, NtGdiIsMemDC, &is_memdc ) && is_memdc) { /* lookup is needed to account for SetSystemPaletteUse() stuff */ int i, index, *mapping = palette_get_mapping( GetStockObject(DEFAULT_PALETTE) ); PALETTEENTRY entries[NB_RESERVED_COLORS]; - GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, entries ); + get_palette_entries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, entries ); EnterCriticalSection( &palette_cs ); for( i = 0; i < NB_RESERVED_COLORS; i++ ) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 18afc0e133d..2112980aab5 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -847,6 +847,11 @@ static inline BOOL lp_to_dp( HDC hdc, POINT *points, INT count ) return NtGdiTransformPoints( hdc, points, points, count, NtGdiLPtoDP ); } +static inline UINT get_palette_entries( HPALETTE palette, UINT start, UINT count, PALETTEENTRY *entries ) +{ + return NtGdiDoPalette( palette, start, count, entries, NtGdiGetPaletteEntries, TRUE ); +} + /* registry helpers */ extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;
1
0
0
0
Jacek Caban : winex11: Directly use win32u for GDI functions in graphics.c.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: 4631b007c1149f7738d9ac39e5b4922cb7f9a742 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4631b007c1149f7738d9ac39…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Apr 12 13:09:50 2022 +0200 winex11: Directly use win32u for GDI functions in graphics.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/graphics.c | 122 ++++++++++++++++++++++++++------------------ dlls/winex11.drv/x11drv.h | 7 +++ 2 files changed, 80 insertions(+), 49 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=4631b007c1149f7738d9…
1
0
0
0
Jacek Caban : winex11: Directly use win32u for GDI functions in window.c.
by Alexandre Julliard
12 Apr '22
12 Apr '22
Module: wine Branch: master Commit: df4ddc30b35fe96b0f571a715679c4baf98e43dd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=df4ddc30b35fe96b0f571a71…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Apr 12 13:09:33 2022 +0200 winex11: Directly use win32u for GDI functions in window.c. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/window.c | 111 ++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 52 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=df4ddc30b35fe96b0f57…
1
0
0
0
← Newer
1
...
60
61
62
63
64
65
66
...
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200