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 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
947 discussions
Start a n
N
ew thread
Jacek Caban : kernel32: Reimplement OpenConsoleW on top of CreateFileW.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: be2443e0c5f021bb98f92d72191c6c55a031873f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=be2443e0c5f021bb98f92d72…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:27:51 2020 +0200 kernel32: Reimplement OpenConsoleW on top of CreateFileW. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/console.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index 02aa0d6f6f..04b89f8f55 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -227,39 +227,21 @@ BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur ) */ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creation) { - HANDLE output = INVALID_HANDLE_VALUE; - HANDLE ret; + SECURITY_ATTRIBUTES sa; TRACE("(%s, 0x%08x, %d, %u)\n", debugstr_w(name), access, inherit, creation); - if (name) - { - if (strcmpiW(coninW, name) == 0) - output = (HANDLE) FALSE; - else if (strcmpiW(conoutW, name) == 0) - output = (HANDLE) TRUE; - } - - if (output == INVALID_HANDLE_VALUE || creation != OPEN_EXISTING) + if (!name || (strcmpiW( coninW, name ) && strcmpiW( conoutW, name )) || creation != OPEN_EXISTING) { - SetLastError(ERROR_INVALID_PARAMETER); + SetLastError( ERROR_INVALID_PARAMETER ); return INVALID_HANDLE_VALUE; } - SERVER_START_REQ( open_console ) - { - req->from = wine_server_obj_handle( output ); - req->access = access; - req->attributes = inherit ? OBJ_INHERIT : 0; - req->share = FILE_SHARE_READ | FILE_SHARE_WRITE; - wine_server_call_err( req ); - ret = wine_server_ptr_handle( reply->handle ); - } - SERVER_END_REQ; - if (ret) - ret = console_handle_map(ret); + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = inherit; - return ret; + return CreateFileW( name, access, FILE_SHARE_READ | FILE_SHARE_WRITE, &sa, creation, 0, NULL ); } /******************************************************************
1
0
0
0
Jacek Caban : kernelbase: Use NtCreateFile for console handles in CreateFileW.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: 0556d9e6f1c0951e6e4026efe3b176407b82fc7b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0556d9e6f1c0951e6e4026ef…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:27:40 2020 +0200 kernelbase: Use NtCreateFile for console handles in CreateFileW. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 5 ----- dlls/kernelbase/console.c | 26 -------------------------- dlls/kernelbase/file.c | 31 ++++++------------------------- dlls/kernelbase/kernelbase.h | 2 -- 4 files changed, 6 insertions(+), 58 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 76cc71c7a3..50f80314f0 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -1308,7 +1308,6 @@ static void test_CreateFileW(void) cf_table[index].creation, FILE_ATTRIBUTE_NORMAL, NULL); if (!index && ret == INVALID_HANDLE_VALUE) { - todo_wine win_skip("Skipping NT path tests, not supported on this Windows version\n"); skip_nt = TRUE; continue; @@ -3208,25 +3207,21 @@ static void test_FreeConsole(void) ok(ret, "FreeConsole failed: %u\n", GetLastError()); handle = CreateFileA("CONOUT$", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - todo_wine ok(handle == INVALID_HANDLE_VALUE && (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_ACCESS_DENIED /* winxp */)), "CreateFileA failed: %u\n", GetLastError()); handle = CreateFileA("CONIN$", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); - todo_wine ok(handle == INVALID_HANDLE_VALUE && (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_ACCESS_DENIED /* winxp */)), "CreateFileA failed: %u\n", GetLastError()); handle = CreateFileA("CON", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); - todo_wine ok(handle == INVALID_HANDLE_VALUE && (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_ACCESS_DENIED /* winxp */)), "CreateFileA failed: %u\n", GetLastError()); handle = CreateFileA("CON", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); - todo_wine ok(handle == INVALID_HANDLE_VALUE && (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_FILE_NOT_FOUND /* winxp */)), "CreateFileA failed: %u\n", GetLastError()); diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c index 3171933b12..5fb84c0bd9 100644 --- a/dlls/kernelbase/console.c +++ b/dlls/kernelbase/console.c @@ -172,32 +172,6 @@ static COORD get_largest_console_window_size( HANDLE handle ) return c; } -/* helper function to replace OpenConsoleW */ -HANDLE open_console( BOOL output, DWORD access, SECURITY_ATTRIBUTES *sa, DWORD creation ) -{ - HANDLE ret; - - if (creation != OPEN_EXISTING) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return INVALID_HANDLE_VALUE; - } - - SERVER_START_REQ( open_console ) - { - req->from = wine_server_obj_handle( ULongToHandle( output )); - req->access = access; - req->attributes = sa && sa->bInheritHandle ? OBJ_INHERIT : 0; - req->share = FILE_SHARE_READ | FILE_SHARE_WRITE; - wine_server_call_err( req ); - ret = wine_server_ptr_handle( reply->handle ); - } - SERVER_END_REQ; - if (ret) ret = console_handle_map( ret ); - return ret; -} - - /****************************************************************** * AttachConsole (kernelbase.@) */ diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index cc79284520..bd87f75665 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -744,13 +744,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO (sharing & FILE_SHARE_DELETE) ? "FILE_SHARE_DELETE " : "", creation, attributes); - /* Open a console for CONIN$ or CONOUT$ */ - - if (!wcsicmp( filename, L"CONIN$" )) - return open_console( FALSE, access, sa, creation ? OPEN_EXISTING : 0 ); - if (!wcsicmp( filename, L"CONOUT$" )) - return open_console( TRUE, access, sa, creation ? OPEN_EXISTING : 0 ); - if (!wcsncmp( filename, L"\\\\.\\", 4 )) { if ((filename[4] && filename[5] == ':' && !filename[6]) || @@ -771,24 +764,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO } else dosdev = RtlIsDosDeviceName_U( filename ); - if (dosdev) - { - if (LOWORD(dosdev) == 3 * sizeof(WCHAR) && - !wcsnicmp( filename + HIWORD(dosdev)/sizeof(WCHAR), L"CON", 3 )) - { - switch (access & (GENERIC_READ|GENERIC_WRITE)) - { - case GENERIC_READ: - return open_console( FALSE, access, sa, OPEN_EXISTING ); - case GENERIC_WRITE: - return open_console( TRUE, access, sa, OPEN_EXISTING ); - default: - SetLastError( ERROR_FILE_NOT_FOUND ); - return INVALID_HANDLE_VALUE; - } - } - } - if (creation < CREATE_NEW || creation > TRUNCATE_EXISTING) { SetLastError( ERROR_INVALID_PARAMETER ); @@ -853,6 +828,12 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO } else { + if (dosdev && + ((LOWORD(dosdev) == 3 * sizeof(WCHAR) && !wcsnicmp( filename + HIWORD(dosdev)/sizeof(WCHAR), L"CON", 3 )) || + (LOWORD(dosdev) == 6 * sizeof(WCHAR) && !wcsnicmp( filename + HIWORD(dosdev)/sizeof(WCHAR), L"CONIN$", 6 )) || + (LOWORD(dosdev) == 7 * sizeof(WCHAR) && !wcsnicmp( filename + HIWORD(dosdev)/sizeof(WCHAR), L"CONOUT$", 7 )))) + ret = console_handle_map( ret ); + if ((creation == CREATE_ALWAYS && io.Information == FILE_OVERWRITTEN) || (creation == OPEN_ALWAYS && io.Information == FILE_OPENED)) SetLastError( ERROR_ALREADY_EXISTS ); diff --git a/dlls/kernelbase/kernelbase.h b/dlls/kernelbase/kernelbase.h index 459ae88c71..88765df3d1 100644 --- a/dlls/kernelbase/kernelbase.h +++ b/dlls/kernelbase/kernelbase.h @@ -35,8 +35,6 @@ extern const WCHAR system_dir[] DECLSPEC_HIDDEN; static const BOOL is_win64 = (sizeof(void *) > sizeof(int)); extern BOOL is_wow64 DECLSPEC_HIDDEN; -extern HANDLE open_console( BOOL output, DWORD access, SECURITY_ATTRIBUTES *sa, DWORD creation ) DECLSPEC_HIDDEN; - static inline BOOL is_console_handle(HANDLE h) { return h != INVALID_HANDLE_VALUE && ((UINT_PTR)h & 3) == 3;
1
0
0
0
Jacek Caban : ntdll: Support CONIN$ and CONOUT$ in RtlIsDosDeviceName_U.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: d2a3104f5ffc289faf6a6e32f2b4e88e8ee3190c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d2a3104f5ffc289faf6a6e32…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:27:26 2020 +0200 ntdll: Support CONIN$ and CONOUT$ in RtlIsDosDeviceName_U. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/path.c | 8 ++++++++ dlls/ntdll/tests/path.c | 44 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 2a807d5eef..acb4bf1249 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -80,6 +80,8 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name ) static const WCHAR lptW[] = {'L','P','T'}; static const WCHAR nulW[] = {'N','U','L'}; static const WCHAR prnW[] = {'P','R','N'}; + static const WCHAR coninW[] = {'C','O','N','I','N','$'}; + static const WCHAR conoutW[] = {'C','O','N','O','U','T','$'}; const WCHAR *start, *end, *p; @@ -124,6 +126,12 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name ) if (wcsnicmp( start, comW, 3 ) && wcsnicmp( start, lptW, 3 )) break; if (*end <= '0' || *end > '9') break; return MAKELONG( 4 * sizeof(WCHAR), (start - dos_name) * sizeof(WCHAR) ); + case 6: + if (wcsnicmp( start, coninW, ARRAY_SIZE(coninW) )) break; + return MAKELONG( sizeof(coninW), (start - dos_name) * sizeof(WCHAR) ); + case 7: + if (wcsnicmp( start, conoutW, ARRAY_SIZE(conoutW) )) break; + return MAKELONG( sizeof(conoutW), (start - dos_name) * sizeof(WCHAR) ); default: /* can't match anything */ break; } diff --git a/dlls/ntdll/tests/path.c b/dlls/ntdll/tests/path.c index 0541f560ac..e4adc992a2 100644 --- a/dlls/ntdll/tests/path.c +++ b/dlls/ntdll/tests/path.c @@ -77,6 +77,11 @@ static void test_RtlDetermineDosPathNameType_U(void) { "//?foo", 1 }, { "\\\\?", 7 }, { "//?", 7 }, + { "CONIN$", 5 }, + { "CONOUT$", 5 }, + { "CONERR$", 5 }, + { "\\\\.\\CONIN$", 6 }, + { "\\\\.\\CONOUT$", 6 }, { NULL, 0 } }; @@ -143,6 +148,15 @@ static void test_RtlIsDosDeviceName_U(void) { "CoM4:", 0, 8 }, { "lpt9:", 0, 8 }, { "c:\\lpt0.txt", 0, 0 }, + { "CONIN$", 0, 12, TRUE }, /* fails on winxp */ + { "CONOUT$", 0, 14, TRUE }, /* fails on winxp */ + { "CONERR$", 0, 0 }, + { "CON", 0, 6 }, + { "PIPE", 0, 0 }, + { "\\??\\CONIN$", 8, 12, TRUE }, /* fails on winxp */ + { "\\??\\CONOUT$", 8, 14, TRUE }, /* fails on winxp */ + { "\\??\\CONERR$", 0, 0 }, + { "\\??\\CON", 8, 6 }, { "c:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -329,6 +343,11 @@ static void test_RtlGetFullPathName_U(void) { "//?/foo/.", "\\\\?\\foo", "foo"}, { "//?/foo/..", "\\\\?\\", NULL}, + { "CONIN$", "\\\\.\\CONIN$", NULL, + "C:\\windows\\CONIN$", "CONIN$"}, + { "CONOUT$", "\\\\.\\CONOUT$", NULL, + "C:\\windows\\CONOUT$", "CONOUT$"}, + /* RtlGetFullPathName_U() can't understand the global namespace prefix */ { "\\??\\foo", "C:\\??\\foo", "foo"}, { 0 } @@ -409,6 +428,7 @@ static void test_RtlDosPathNameToNtPathName_U(void) const WCHAR *dos; const WCHAR *nt; int file_offset; /* offset to file part */ + const WCHAR *alt_nt; } tests[] = { @@ -507,6 +527,11 @@ static void test_RtlDosPathNameToNtPathName_U(void) {L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8}, {L"\\??\\foo\\.", L"\\??\\foo\\.", 8}, {L"\\??\\foo\\..", L"\\??\\foo\\..", 8}, + + {L"CONIN$", L"\\??\\CONIN$", -1, L"\\??\\C:\\windows\\CONIN$" /* winxp */ }, + {L"CONOUT$", L"\\??\\CONOUT$", -1, L"\\??\\C:\\windows\\CONOUT$" /* winxp */ }, + {L"cOnOuT$", L"\\??\\cOnOuT$", -1, L"\\??\\C:\\windows\\cOnOuT$" /* winxp */ }, + {L"CONERR$", L"\\??\\C:\\windows\\CONERR$", 15}, }; GetCurrentDirectoryA(sizeof(curdir), curdir); @@ -555,16 +580,19 @@ static void test_RtlDosPathNameToNtPathName_U(void) continue; } - ok(!wcscmp(nameW.Buffer, tests[i].nt), "%s: Expected %s, got %s.\n", + ok(!wcscmp(nameW.Buffer, tests[i].nt) || broken(!wcscmp(nameW.Buffer, tests[i].alt_nt)), "%s: Expected %s, got %s.\n", debugstr_w(tests[i].dos), debugstr_w(tests[i].nt), debugstr_w(nameW.Buffer)); - if (tests[i].file_offset > 0) - ok(file_part == nameW.Buffer + tests[i].file_offset, - "%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos), - debugstr_w(nameW.Buffer + tests[i].file_offset), debugstr_w(file_part)); - else - ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n", - debugstr_w(tests[i].dos), debugstr_w(file_part)); + if (!wcscmp(nameW.Buffer, tests[i].nt)) + { + if (tests[i].file_offset > 0) + ok(file_part == nameW.Buffer + tests[i].file_offset, + "%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos), + debugstr_w(nameW.Buffer + tests[i].file_offset), debugstr_w(file_part)); + else + ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n", + debugstr_w(tests[i].dos), debugstr_w(file_part)); + } RtlFreeUnicodeString(&nameW); }
1
0
0
0
Jacek Caban : server: Support console global symlinks.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: 18f83c12a04f934eda74fed77055073075bc4275 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=18f83c12a04f934eda74fed7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:27:19 2020 +0200 server: Support console global symlinks. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/directory.c | 22 ++++++++++++++++++++++ server/object.h | 3 +++ server/symlink.c | 26 ++++++++++---------------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/server/directory.c b/server/directory.c index 9932a63353..4d38393a6c 100644 --- a/server/directory.c +++ b/server/directory.c @@ -347,11 +347,26 @@ void init_directories(void) static const WCHAR link_nulW[] = {'N','U','L'}; static const WCHAR link_pipeW[] = {'P','I','P','E'}; static const WCHAR link_mailslotW[] = {'M','A','I','L','S','L','O','T'}; + static const WCHAR link_coninW[] = {'C','O','N','I','N','$'}; + static const WCHAR link_conoutW[] = {'C','O','N','O','U','T','$'}; + static const WCHAR link_conW[] = {'C','O','N'}; + static const WCHAR link_currentinW[] = {'\\','D','e','v','i','c','e','\\','C','o','n','D','r','v', + '\\','C','u','r','r','e','n','t','I','n'}; + static const WCHAR link_currentoutW[] = {'\\','D','e','v','i','c','e','\\','C','o','n','D','r','v', + '\\','C','u','r','r','e','n','t','O','u','t'}; + static const WCHAR link_consoleW[] = {'\\','D','e','v','i','c','e','\\','C','o','n','D','r','v', + '\\','C','o','n','s','o','l','e'}; static const struct unicode_str link_dosdev_str = {link_dosdevW, sizeof(link_dosdevW)}; static const struct unicode_str link_global_str = {link_globalW, sizeof(link_globalW)}; static const struct unicode_str link_nul_str = {link_nulW, sizeof(link_nulW)}; static const struct unicode_str link_pipe_str = {link_pipeW, sizeof(link_pipeW)}; static const struct unicode_str link_mailslot_str = {link_mailslotW, sizeof(link_mailslotW)}; + static const struct unicode_str link_con_str = {link_conW, sizeof(link_conW)}; + static const struct unicode_str link_conin_str = {link_coninW, sizeof(link_coninW)}; + static const struct unicode_str link_conout_str = {link_conoutW, sizeof(link_conoutW)}; + static const struct unicode_str link_currentin_str = {link_currentinW, sizeof(link_currentinW)}; + static const struct unicode_str link_currentout_str = {link_currentoutW, sizeof(link_currentoutW)}; + static const struct unicode_str link_console_str = {link_consoleW, sizeof(link_consoleW)}; /* devices */ static const WCHAR named_pipeW[] = {'N','a','m','e','d','P','i','p','e'}; @@ -388,6 +403,7 @@ void init_directories(void) struct directory *dir_driver, *dir_device, *dir_global, *dir_kernel; struct object *link_dosdev, *link_global, *link_nul, *link_pipe, *link_mailslot; + struct object *link_conin, *link_conout, *link_con; struct object *named_pipe_device, *mailslot_device, *null_device, *user_data_mapping, *console_device; struct keyed_event *keyed_event; unsigned int i; @@ -422,11 +438,17 @@ void init_directories(void) link_nul = create_obj_symlink( &dir_global->obj, &link_nul_str, 0, null_device, NULL ); link_pipe = create_obj_symlink( &dir_global->obj, &link_pipe_str, 0, named_pipe_device, NULL ); link_mailslot = create_obj_symlink( &dir_global->obj, &link_mailslot_str, 0, mailslot_device, NULL ); + link_conin = create_symlink( &dir_global->obj, &link_conin_str, 0, &link_currentin_str, NULL ); + link_conout = create_symlink( &dir_global->obj, &link_conout_str, 0, &link_currentout_str, NULL ); + link_con = create_symlink( &dir_global->obj, &link_con_str, 0, &link_console_str, NULL ); make_object_static( link_dosdev ); make_object_static( link_global ); make_object_static( link_nul ); make_object_static( link_pipe ); make_object_static( link_mailslot ); + make_object_static( link_conin ); + make_object_static( link_conout ); + make_object_static( link_con ); /* events */ for (i = 0; i < ARRAY_SIZE( kernel_events ); i++) diff --git a/server/object.h b/server/object.h index 3144eb5667..f0b889d589 100644 --- a/server/object.h +++ b/server/object.h @@ -244,6 +244,9 @@ extern void init_directories(void); extern struct object *create_obj_symlink( struct object *root, const struct unicode_str *name, unsigned int attr, struct object *target, const struct security_descriptor *sd ); +extern struct object *create_symlink( struct object *root, const struct unicode_str *name, + unsigned int attr, const struct unicode_str *target, + const struct security_descriptor *sd ); /* global variables */ diff --git a/server/symlink.c b/server/symlink.c index e5ee09f015..7a2f8642d5 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -134,9 +134,9 @@ static void symlink_destroy( struct object *obj ) free( symlink->target ); } -static struct symlink *create_symlink( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct unicode_str *target, - const struct security_descriptor *sd ) +struct object *create_symlink( struct object *root, const struct unicode_str *name, + unsigned int attr, const struct unicode_str *target, + const struct security_descriptor *sd ) { struct symlink *symlink; @@ -145,20 +145,14 @@ static struct symlink *create_symlink( struct object *root, const struct unicode set_error( STATUS_INVALID_PARAMETER ); return NULL; } - if ((symlink = create_named_object( root, &symlink_ops, name, attr, sd )) && - (get_error() != STATUS_OBJECT_NAME_EXISTS)) + if (!(symlink = create_named_object( root, &symlink_ops, name, attr, sd ))) return NULL; + if (get_error() != STATUS_OBJECT_NAME_EXISTS && !(symlink->target = memdup( target->str, target->len ))) { - if ((symlink->target = memdup( target->str, target->len ))) - { - symlink->len = target->len; - } - else - { - release_object( symlink ); - symlink = NULL; - } + release_object( symlink ); + return NULL; } - return symlink; + symlink->len = target->len; + return &symlink->obj; } /* create a symlink pointing to an existing object */ @@ -190,7 +184,7 @@ struct object *create_obj_symlink( struct object *root, const struct unicode_str /* create a symbolic link object */ DECL_HANDLER(create_symlink) { - struct symlink *symlink; + struct object *symlink; struct unicode_str name, target; struct object *root; const struct security_descriptor *sd;
1
0
0
0
Jacek Caban : server: Support ConDrv/CurrentOut device.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: 52c04e1e390e0008580eca7343f5c04aed3d1323 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=52c04e1e390e0008580eca73…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:26:54 2020 +0200 server: Support ConDrv/CurrentOut device. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/server/console.c b/server/console.c index a42bc4751e..57592e6ab0 100644 --- a/server/console.c +++ b/server/console.c @@ -173,6 +173,8 @@ struct screen_buffer static void screen_buffer_dump( struct object *obj, int verbose ); static void screen_buffer_destroy( struct object *obj ); static struct fd *screen_buffer_get_fd( struct object *obj ); +static struct object *screen_buffer_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); static const struct object_ops screen_buffer_ops = { @@ -191,7 +193,7 @@ static const struct object_ops screen_buffer_ops = no_lookup_name, /* lookup_name */ no_link_name, /* link_name */ NULL, /* unlink_name */ - no_open_file, /* open_file */ + screen_buffer_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ screen_buffer_destroy /* destroy */ @@ -1247,6 +1249,12 @@ static void screen_buffer_destroy( struct object *obj ) free( screen_buffer->font.face_name ); } +static struct object *screen_buffer_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ) +{ + return grab_object( obj ); +} + static struct fd *screen_buffer_get_fd( struct object *obj ) { struct screen_buffer *screen_buffer = (struct screen_buffer*)obj; @@ -1493,6 +1501,7 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni { static const WCHAR consoleW[] = {'C','o','n','s','o','l','e'}; static const WCHAR current_inW[] = {'C','u','r','r','e','n','t','I','n'}; + static const WCHAR current_outW[] = {'C','u','r','r','e','n','t','O','u','t'}; if (name->len == sizeof(current_inW) && !memcmp( name->str, current_inW, name->len )) { @@ -1505,6 +1514,17 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni return grab_object( current->process->console ); } + if (name->len == sizeof(current_outW) && !memcmp( name->str, current_outW, name->len )) + { + if (!current->process->console || !current->process->console->active) + { + set_error( STATUS_INVALID_HANDLE ); + return NULL; + } + name->len = 0; + return grab_object( current->process->console->active ); + } + if (name->len == sizeof(consoleW) && !memcmp( name->str, consoleW, name->len )) { name->len = 0;
1
0
0
0
Jacek Caban : server: Support ConDrv/CurrentIn device.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: bededeccc51cc766ed48ce861a2a411ad8d22a87 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bededeccc51cc766ed48ce86…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:26:45 2020 +0200 server: Support ConDrv/CurrentIn device. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/server/console.c b/server/console.c index 2e7845adbe..a42bc4751e 100644 --- a/server/console.c +++ b/server/console.c @@ -75,6 +75,8 @@ struct console_input static void console_input_dump( struct object *obj, int verbose ); static void console_input_destroy( struct object *obj ); static struct fd *console_input_get_fd( struct object *obj ); +static struct object *console_input_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); static const struct object_ops console_input_ops = { @@ -93,7 +95,7 @@ static const struct object_ops console_input_ops = no_lookup_name, /* lookup_name */ no_link_name, /* link_name */ NULL, /* unlink_name */ - no_open_file, /* open_file */ + console_input_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ console_input_destroy /* destroy */ @@ -1204,6 +1206,12 @@ static void console_input_destroy( struct object *obj ) free( console_in->history ); } +static struct object *console_input_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ) +{ + return grab_object( obj ); +} + static void screen_buffer_dump( struct object *obj, int verbose ) { struct screen_buffer *screen_buffer = (struct screen_buffer *)obj; @@ -1484,6 +1492,18 @@ static void console_device_dump( struct object *obj, int verbose ) static struct object *console_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr ) { static const WCHAR consoleW[] = {'C','o','n','s','o','l','e'}; + static const WCHAR current_inW[] = {'C','u','r','r','e','n','t','I','n'}; + + if (name->len == sizeof(current_inW) && !memcmp( name->str, current_inW, name->len )) + { + if (!current->process->console) + { + set_error( STATUS_INVALID_HANDLE ); + return NULL; + } + name->len = 0; + return grab_object( current->process->console ); + } if (name->len == sizeof(consoleW) && !memcmp( name->str, consoleW, name->len )) {
1
0
0
0
Jacek Caban : server: Introduce ConDrv device.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: 6898bdca94cde73bd8d8b88d99153a731f6a7a6b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6898bdca94cde73bd8d8b88d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:26:35 2020 +0200 server: Introduce ConDrv device. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ server/directory.c | 6 ++++- server/file.h | 1 + 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/server/console.c b/server/console.c index 302be6a1c1..2e7845adbe 100644 --- a/server/console.c +++ b/server/console.c @@ -212,6 +212,35 @@ static const struct fd_ops console_fd_ops = default_fd_reselect_async /* reselect_async */ }; +static struct object_type *console_device_get_type( struct object *obj ); +static void console_device_dump( struct object *obj, int verbose ); +static struct object *console_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr ); +static struct object *console_device_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); + +static const struct object_ops console_device_ops = +{ + sizeof(struct object), /* size */ + console_device_dump, /* dump */ + console_device_get_type, /* get_type */ + no_add_queue, /* add_queue */ + NULL, /* remove_queue */ + NULL, /* signaled */ + no_satisfied, /* satisfied */ + no_signal, /* signal */ + no_get_fd, /* get_fd */ + default_fd_map_access, /* map_access */ + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + console_device_lookup_name, /* lookup_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ + console_device_open_file, /* open_file */ + no_kernel_obj_list, /* get_kernel_obj_list */ + no_close_handle, /* close_handle */ + no_destroy /* destroy */ +}; + static struct list screen_buffer_list = LIST_INIT(screen_buffer_list); static const char_info_t empty_char_info = { ' ', 0x000f }; /* white on black space */ @@ -1440,6 +1469,55 @@ static void scroll_console_output( struct screen_buffer *screen_buffer, int xsrc console_input_events_append( screen_buffer->input, &evt ); } +static struct object_type *console_device_get_type( struct object *obj ) +{ + static const WCHAR name[] = {'D','e','v','i','c','e'}; + static const struct unicode_str str = { name, sizeof(name) }; + return get_object_type( &str ); +} + +static void console_device_dump( struct object *obj, int verbose ) +{ + fputs( "Console device\n", stderr ); +} + +static struct object *console_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr ) +{ + static const WCHAR consoleW[] = {'C','o','n','s','o','l','e'}; + + if (name->len == sizeof(consoleW) && !memcmp( name->str, consoleW, name->len )) + { + name->len = 0; + return grab_object( obj ); + } + + return NULL; +} + +static struct object *console_device_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ) +{ + int is_output; + access = default_fd_map_access( obj, access ); + is_output = access & FILE_WRITE_DATA; + if (!current->process->console || (is_output && !current->process->console)) + { + set_error( STATUS_INVALID_HANDLE ); + return NULL; + } + if (is_output && (access & FILE_READ_DATA)) + { + set_error( STATUS_INVALID_PARAMETER ); + return NULL; + } + return is_output ? grab_object( current->process->console->active ) : grab_object( current->process->console ); +} + +struct object *create_console_device( struct object *root, const struct unicode_str *name ) +{ + return create_named_object( root, &console_device_ops, name, 0, NULL ); +} + /* allocate a console for the renderer */ DECL_HANDLER(alloc_console) { diff --git a/server/directory.c b/server/directory.c index 74cbb3ca97..9932a63353 100644 --- a/server/directory.c +++ b/server/directory.c @@ -356,9 +356,11 @@ void init_directories(void) /* devices */ static const WCHAR named_pipeW[] = {'N','a','m','e','d','P','i','p','e'}; static const WCHAR mailslotW[] = {'M','a','i','l','S','l','o','t'}; + static const WCHAR condrvW[] = {'C','o','n','D','r','v'}; static const WCHAR nullW[] = {'N','u','l','l'}; static const struct unicode_str named_pipe_str = {named_pipeW, sizeof(named_pipeW)}; static const struct unicode_str mailslot_str = {mailslotW, sizeof(mailslotW)}; + static const struct unicode_str condrv_str = {condrvW, sizeof(condrvW)}; static const struct unicode_str null_str = {nullW, sizeof(nullW)}; /* events */ @@ -386,7 +388,7 @@ void init_directories(void) struct directory *dir_driver, *dir_device, *dir_global, *dir_kernel; struct object *link_dosdev, *link_global, *link_nul, *link_pipe, *link_mailslot; - struct object *named_pipe_device, *mailslot_device, *null_device, *user_data_mapping; + struct object *named_pipe_device, *mailslot_device, *null_device, *user_data_mapping, *console_device; struct keyed_event *keyed_event; unsigned int i; @@ -403,10 +405,12 @@ void init_directories(void) /* devices */ named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str ); mailslot_device = create_mailslot_device( &dir_device->obj, &mailslot_str ); + console_device = create_console_device( &dir_device->obj, &condrv_str ); null_device = create_unix_device( &dir_device->obj, &null_str, "/dev/null" ); make_object_static( named_pipe_device ); make_object_static( mailslot_device ); make_object_static( null_device ); + make_object_static( console_device ); /* sessions */ create_session( 0 ); diff --git a/server/file.h b/server/file.h index 8bdc5a9010..e8ace7f49e 100644 --- a/server/file.h +++ b/server/file.h @@ -179,6 +179,7 @@ extern struct object *create_user_data_mapping( struct object *root, const struc extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name ); extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name ); +extern struct object *create_console_device( struct object *root, const struct unicode_str *name ); extern struct object *create_unix_device( struct object *root, const struct unicode_str *name, const char *unix_path );
1
0
0
0
Jacek Caban : kernel32/tests: Add more tests for opening console.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: 9bdfb1a29a5b4efb2b7bc5cd2ca1d920e1d5ac14 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9bdfb1a29a5b4efb2b7bc5cd…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Jun 25 22:26:30 2020 +0200 kernel32/tests: Add more tests for opening console. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 125 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 108 insertions(+), 17 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 5e35f101d5..76cc71c7a3 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -21,6 +21,7 @@ #include "wine/test.h" #include <windows.h> +#include <winternl.h> #include <stdio.h> static BOOL (WINAPI *pGetConsoleInputExeNameA)(DWORD, LPSTR); @@ -1226,36 +1227,47 @@ static void test_OpenConsoleW(void) static void test_CreateFileW(void) { - static const WCHAR coninW[] = {'C','O','N','I','N','$',0}; - static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0}; - static const struct { - LPCWSTR name; + BOOL input; DWORD access; BOOL inherit; DWORD creation; DWORD gle; BOOL is_broken; } cf_table[] = { - {coninW, 0, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, - {coninW, 0, FALSE, OPEN_ALWAYS, 0, FALSE}, - {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, - {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, 0, FALSE}, - {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, 0, FALSE}, - {coninW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, 0, FALSE}, - {conoutW, 0, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, - {conoutW, 0, FALSE, OPEN_ALWAYS, 0, FALSE}, - {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, - {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, 0, FALSE}, - {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, 0, FALSE}, - {conoutW, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, 0, FALSE}, + {TRUE, 0, FALSE, OPEN_ALWAYS, 0, FALSE}, + {TRUE, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, + {TRUE, 0, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, + {TRUE, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, 0, FALSE}, + {TRUE, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, 0, FALSE}, + {TRUE, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, 0, FALSE}, + {FALSE, 0, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, + {FALSE, 0, FALSE, OPEN_ALWAYS, 0, FALSE}, + {FALSE, GENERIC_READ | GENERIC_WRITE, FALSE, 0, ERROR_INVALID_PARAMETER, TRUE}, + {FALSE, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_NEW, 0, FALSE}, + {FALSE, GENERIC_READ | GENERIC_WRITE, FALSE, CREATE_ALWAYS, 0, FALSE}, + {FALSE, GENERIC_READ | GENERIC_WRITE, FALSE, OPEN_ALWAYS, 0, FALSE}, /* TRUNCATE_EXISTING is forbidden starting with Windows 8 */ }; + static const UINT nt_disposition[5] = + { + FILE_CREATE, /* CREATE_NEW */ + FILE_OVERWRITE_IF, /* CREATE_ALWAYS */ + FILE_OPEN, /* OPEN_EXISTING */ + FILE_OPEN_IF, /* OPEN_ALWAYS */ + FILE_OVERWRITE /* TRUNCATE_EXISTING */ + }; + int index; HANDLE ret; SECURITY_ATTRIBUTES sa; + OBJECT_ATTRIBUTES attr = {sizeof(attr)}; + UNICODE_STRING string; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + BOOL skip_nt = FALSE; for (index = 0; index < ARRAY_SIZE(cf_table); index++) { @@ -1265,7 +1277,7 @@ static void test_CreateFileW(void) sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = cf_table[index].inherit; - ret = CreateFileW(cf_table[index].name, cf_table[index].access, + ret = CreateFileW(cf_table[index].input ? L"CONIN$" : L"CONOUT$", cf_table[index].access, FILE_SHARE_READ|FILE_SHARE_WRITE, &sa, cf_table[index].creation, FILE_ATTRIBUTE_NORMAL, NULL); if (ret == INVALID_HANDLE_VALUE) @@ -1282,6 +1294,51 @@ static void test_CreateFileW(void) "Expected CreateFileW to succeed for index %d\n", index); CloseHandle(ret); } + + if (skip_nt) continue; + + SetLastError(0xdeadbeef); + + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = cf_table[index].inherit; + + ret = CreateFileW(cf_table[index].input ? L"\\??\\CONIN$" : L"\\??\\CONOUT$", cf_table[index].access, + FILE_SHARE_READ|FILE_SHARE_WRITE, &sa, + cf_table[index].creation, FILE_ATTRIBUTE_NORMAL, NULL); + if (!index && ret == INVALID_HANDLE_VALUE) + { + todo_wine + win_skip("Skipping NT path tests, not supported on this Windows version\n"); + skip_nt = TRUE; + continue; + } + if (cf_table[index].gle) + ok(ret == INVALID_HANDLE_VALUE && GetLastError() == cf_table[index].gle, + "CreateFileW to returned %p %u for index %d\n", ret, GetLastError(), index); + else + ok(ret != INVALID_HANDLE_VALUE && (!cf_table[index].gle || broken(cf_table[index].is_broken) /* Win7 */), + "CreateFileW to returned %p %u for index %d\n", ret, GetLastError(), index); + if (ret != INVALID_HANDLE_VALUE) CloseHandle(ret); + + if (cf_table[index].gle) continue; + + RtlInitUnicodeString(&string, cf_table[index].input + ? L"\\Device\\ConDrv\\CurrentIn" : L"\\Device\\ConDrv\\CurrentOut"); + attr.ObjectName = &string; + status = NtCreateFile(&ret, cf_table[index].access | SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attr, &iosb, NULL, + FILE_ATTRIBUTE_NORMAL, 0, nt_disposition[cf_table[index].creation - CREATE_NEW], + FILE_NON_DIRECTORY_FILE, NULL, 0); + ok(!status, "NtCreateFile failed %x for %u\n", status, index); + CloseHandle(ret); + + RtlInitUnicodeString(&string, cf_table[index].input ? L"\\??\\CONIN$" : L"\\??\\CONOUT$"); + attr.ObjectName = &string; + status = NtCreateFile(&ret, cf_table[index].access | SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attr, &iosb, NULL, + FILE_ATTRIBUTE_NORMAL, 0, nt_disposition[cf_table[index].creation - CREATE_NEW], + FILE_NON_DIRECTORY_FILE, NULL, 0); + ok(!status, "NtCreateFile failed %x for %u\n", status, index); + CloseHandle(ret); } } @@ -3142,6 +3199,39 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output) ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); } +static void test_FreeConsole(void) +{ + HANDLE handle; + BOOL ret; + + ret = FreeConsole(); + ok(ret, "FreeConsole failed: %u\n", GetLastError()); + + handle = CreateFileA("CONOUT$", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); + todo_wine + ok(handle == INVALID_HANDLE_VALUE && + (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_ACCESS_DENIED /* winxp */)), + "CreateFileA failed: %u\n", GetLastError()); + + handle = CreateFileA("CONIN$", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); + todo_wine + ok(handle == INVALID_HANDLE_VALUE && + (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_ACCESS_DENIED /* winxp */)), + "CreateFileA failed: %u\n", GetLastError()); + + handle = CreateFileA("CON", GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); + todo_wine + ok(handle == INVALID_HANDLE_VALUE && + (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_ACCESS_DENIED /* winxp */)), + "CreateFileA failed: %u\n", GetLastError()); + + handle = CreateFileA("CON", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); + todo_wine + ok(handle == INVALID_HANDLE_VALUE && + (GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_FILE_NOT_FOUND /* winxp */)), + "CreateFileA failed: %u\n", GetLastError()); +} + static void test_SetConsoleScreenBufferInfoEx(HANDLE std_output) { BOOL ret; @@ -3447,4 +3537,5 @@ START_TEST(console) test_GetConsoleScreenBufferInfoEx(hConOut); test_SetConsoleScreenBufferInfoEx(hConOut); test_AttachConsole(hConOut); + test_FreeConsole(); }
1
0
0
0
Zebediah Figura : quartz: Try to create the VMR7 in video_renderer_default_create().
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: f7265d97ee12b67adc82cff63b70ee9d70e01b32 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f7265d97ee12b67adc82cff6…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Jun 25 17:57:40 2020 -0500 quartz: Try to create the VMR7 in video_renderer_default_create(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/videorenderer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index f6eebc9ef9..f635d9eaac 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -542,6 +542,10 @@ HRESULT video_renderer_create(IUnknown *outer, IUnknown **out) HRESULT video_renderer_default_create(IUnknown *outer, IUnknown **out) { - /* TODO: Attempt to use the VMR-7 renderer instead when possible */ + HRESULT hr; + + if (SUCCEEDED(hr = vmr7_create(outer, out))) + return hr; + return video_renderer_create(outer, out); }
1
0
0
0
Zebediah Figura : quartz/vmr9: Set the destination rect to the whole client area when connecting.
by Alexandre Julliard
26 Jun '20
26 Jun '20
Module: wine Branch: master Commit: 90f8a1b876cf0d1dbd820b295239faaef1c6cda0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=90f8a1b876cf0d1dbd820b29…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Jun 25 17:57:39 2020 -0500 quartz/vmr9: Set the destination rect to the whole client area when connecting. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/vmr7.c | 30 ++++++++++++++++++++++++++++++ dlls/quartz/tests/vmr9.c | 34 ++++++++++++++++++++++++++++++++-- dlls/quartz/vmr9.c | 3 ++- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 4422a1f914..adf677535b 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -2593,6 +2593,7 @@ static void test_basic_video(void) UINT count; ULONG ref; IPin *pin; + RECT rect; IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video); IBaseFilter_FindPin(filter, L"VMR Input0", &pin); @@ -2727,6 +2728,35 @@ static void test_basic_video(void) test_basic_video_source(video); test_basic_video_destination(video); + hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_Disconnect(graph, pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + vih.bmiHeader.biWidth = 16; + vih.bmiHeader.biHeight = 16; + hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMemInputPin_GetAllocator(input, &allocator); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n"); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IMemAllocator_Release(allocator); + } + + check_source_position(video, 0, 0, 16, 16); + + SetRect(&rect, 0, 0, 0, 0); + AdjustWindowRectEx(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW, FALSE, 0); + check_destination_position(video, 0, 0, max(16, GetSystemMetrics(SM_CXMIN) - (rect.right - rect.left)), + max(16, GetSystemMetrics(SM_CYMIN) - (rect.bottom - rect.top))); + out: ref = IFilterGraph2_Release(graph); ok(!ref, "Got outstanding refcount %d.\n", ref); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 69065d3576..005b10974f 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -3591,6 +3591,7 @@ static void test_basic_video(void) UINT count; ULONG ref; IPin *pin; + RECT rect; IBaseFilter_QueryInterface(filter, &IID_IBasicVideo, (void **)&video); IBaseFilter_FindPin(filter, L"VMR Input0", &pin); @@ -3725,6 +3726,35 @@ static void test_basic_video(void) test_basic_video_source(video); test_basic_video_destination(video); + hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_Disconnect(graph, pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + vih.bmiHeader.biWidth = 16; + vih.bmiHeader.biHeight = 16; + hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMemInputPin_GetAllocator(input, &allocator); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (hr == S_OK) + { + hr = IMemAllocator_SetProperties(allocator, &req_props, &ret_props); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!memcmp(&ret_props, &req_props, sizeof(req_props)), "Properties did not match.\n"); + hr = IMemAllocator_Commit(allocator); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IMemAllocator_Release(allocator); + } + + check_source_position(video, 0, 0, 16, 16); + + SetRect(&rect, 0, 0, 0, 0); + AdjustWindowRectEx(&rect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW, FALSE, 0); + check_destination_position(video, 0, 0, max(16, GetSystemMetrics(SM_CXMIN) - (rect.right - rect.left)), + max(16, GetSystemMetrics(SM_CYMIN) - (rect.bottom - rect.top))); + out: ref = IFilterGraph2_Release(graph); ok(!ref, "Got outstanding refcount %d.\n", ref); @@ -3831,7 +3861,7 @@ static void test_windowless_size(void) hr = IVMRWindowlessControl9_GetVideoPosition(windowless_control, NULL, &dst); ok(hr == S_OK, "Got hr %#x.\n", hr); SetRect(&expect, 0, 0, 0, 0); - todo_wine ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst)); + ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst)); SetRect(&src, 4, 6, 16, 12); hr = IVMRWindowlessControl9_SetVideoPosition(windowless_control, &src, NULL); @@ -3844,7 +3874,7 @@ static void test_windowless_size(void) SetRect(&expect, 4, 6, 16, 12); ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src)); SetRect(&expect, 0, 0, 0, 0); - todo_wine ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst)); + ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst)); SetRect(&dst, 40, 60, 120, 160); hr = IVMRWindowlessControl9_SetVideoPosition(windowless_control, NULL, &dst); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index e4db42223e..b6b55c70c5 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -519,12 +519,13 @@ static HRESULT vmr_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE filter->VideoWidth = bitmap_header->biWidth; filter->VideoHeight = bitmap_header->biHeight; SetRect(&rect, 0, 0, filter->VideoWidth, filter->VideoHeight); - filter->window.src = filter->window.dst = rect; + filter->window.src = rect; AdjustWindowRectEx(&rect, GetWindowLongW(window, GWL_STYLE), FALSE, GetWindowLongW(window, GWL_EXSTYLE)); SetWindowPos(window, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + GetClientRect(window, &filter->window.dst); if (filter->mode || SUCCEEDED(hr = IVMRFilterConfig9_SetRenderingMode(&filter->IVMRFilterConfig9_iface, VMR9Mode_Windowed)))
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
95
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
Results per page:
10
25
50
100
200