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
November 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
851 discussions
Start a n
N
ew thread
Alexandre Julliard : libport: Move the case mapping table back to libwine and stop updating it.
by Alexandre Julliard
30 Nov '20
30 Nov '20
Module: wine Branch: master Commit: c7196dc945879e24e0f255c9e108fe116b3b11f2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c7196dc945879e24e0f255c9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun Nov 29 21:35:16 2020 +0100 libport: Move the case mapping table back to libwine and stop updating it. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/window.c | 2 ++ include/wine/unicode.h | 7 +++---- libs/port/Makefile.in | 1 - libs/wine/Makefile.in | 1 + libs/{port => wine}/casemap.c | 6 ++++++ libs/wine/wine.map | 4 ++-- tools/make_unicode | 47 ------------------------------------------- 7 files changed, 14 insertions(+), 54 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 457173964eb..ba722721ad2 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -37,6 +37,8 @@ #include <X11/extensions/shape.h> #endif /* HAVE_LIBXSHAPE */ +/* avoid conflict with field names in included win32 headers */ +#undef Status #include "windef.h" #include "winbase.h" #include "wingdi.h" diff --git a/include/wine/unicode.h b/include/wine/unicode.h index a346f4cbecd..011aacf7386 100644 --- a/include/wine/unicode.h +++ b/include/wine/unicode.h @@ -26,6 +26,7 @@ #include <windef.h> #include <winbase.h> #include <winnls.h> +#include <winternl.h> #ifdef __WINE_WINE_TEST_H #error This file should not be used in Wine tests @@ -45,14 +46,12 @@ extern "C" { WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch ) { - extern const WCHAR wine_casemap_lower[]; - return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)]; + return RtlDowncaseUnicodeChar( ch ); } WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch ) { - extern const WCHAR wine_casemap_upper[]; - return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)]; + return RtlUpcaseUnicodeChar( ch ); } /* the character type contains the C1_* flags in the low 12 bits */ diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in index aabcc833ec6..5d1019aa801 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in @@ -1,7 +1,6 @@ STATICLIB = libwine_port.a C_SRCS = \ - casemap.c \ ffs.c \ fstatvfs.c \ getopt.c \ diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in index 74ffc0d5f83..f4086b1a763 100644 --- a/libs/wine/Makefile.in +++ b/libs/wine/Makefile.in @@ -66,6 +66,7 @@ C_SRCS = \ c_936.c \ c_949.c \ c_950.c \ + casemap.c \ collation.c \ compose.c \ config.c \ diff --git a/libs/port/casemap.c b/libs/wine/casemap.c similarity index 99% rename from libs/port/casemap.c rename to libs/wine/casemap.c index 540f5ad653c..518575faad5 100644 --- a/libs/port/casemap.c +++ b/libs/wine/casemap.c @@ -2,6 +2,10 @@ /* generated from
https://www.unicode.org/Public/13.0.0/ucd/UCD.zip:UnicodeData.txt
*/ /* DO NOT EDIT!! */ +#include "wine/asm.h" + +#ifdef __ASM_OBSOLETE + #include "windef.h" const WCHAR wine_casemap_lower[4122] = @@ -1101,3 +1105,5 @@ const WCHAR wine_casemap_upper[4557] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; + +#endif /* __ASM_OBSOLETE */ diff --git a/libs/wine/wine.map b/libs/wine/wine.map index 192bf4bd46f..6147dccc77e 100644 --- a/libs/wine/wine.map +++ b/libs/wine/wine.map @@ -7,8 +7,6 @@ WINE_1.0 __wine_main_environ; __wine_main_wargv; wine_anon_mmap; - wine_casemap_lower; - wine_casemap_upper; wine_dll_set_callback; wine_init; wine_init_argv0_path; @@ -64,6 +62,8 @@ WINE_1.0 vsnprintfW; vsprintfW; wine_call_on_stack; + wine_casemap_lower; + wine_casemap_upper; wine_compare_string; wine_cp_enum_table; wine_cp_get_table; diff --git a/tools/make_unicode b/tools/make_unicode index 8d5747ce253..c454c74440f 100755 --- a/tools/make_unicode +++ b/tools/make_unicode @@ -1716,52 +1716,6 @@ sub dump_digit_folding($) } -################################################################ -# dump the case mapping tables -sub dump_case_mappings($) -{ - my $filename = shift; - open OUTPUT,">$filename.new" or die "Cannot create $filename"; - print "Building $filename\n"; - print OUTPUT "/* Unicode case mappings */\n"; - print OUTPUT "/* generated from $UNIDATA:UnicodeData.txt */\n"; - print OUTPUT "/* DO NOT EDIT!! */\n\n"; - print OUTPUT "#include \"windef.h\"\n\n"; - - my @upper = @toupper_table; - my @lower = @tolower_table; - remove_linguistic_mappings( \@upper, \@lower ); - - dump_case_table( "wine_casemap_lower", @lower ); - print OUTPUT "\n"; - dump_case_table( "wine_casemap_upper", @upper ); - close OUTPUT; - save_file($filename); -} - - -################################################################ -# dump a case mapping table -sub dump_case_table($@) -{ - my ($name,@table) = @_; - - for (my $i = 0; $i < 65536; $i++) - { - next unless defined $table[$i]; - $table[$i] = ($table[$i] - $i) & 0xffff; - } - - my @array = compress_array( 256, 0, @table[0..65535] ); - - printf OUTPUT "const WCHAR %s[%d] =\n", $name, scalar @array; - printf OUTPUT "{\n /* index */\n"; - printf OUTPUT "%s,\n", dump_array( 16, 0, @array[0..255] ); - printf OUTPUT " /* data */\n"; - printf OUTPUT "%s", dump_array( 16, 0, @array[256..$#array] ); - printf OUTPUT "\n};\n"; -} - ################################################################ # compress a mapping table by removing identical rows sub compress_array($$@) @@ -2784,7 +2738,6 @@ sub save_file($) chdir ".." if -f "./make_unicode"; load_data(); -dump_case_mappings( "libs/port/casemap.c" ); dump_sortkeys( "dlls/kernelbase/collation.c" ); dump_ctype_tables( "libs/port/wctype.c" ); dump_bidi_dir_table( "dlls/gdi32/uniscribe/direction.c" );
1
0
0
0
Alexandre Julliard : libwine: Move libwine private definitions out of the global wine/unicode.h
by Alexandre Julliard
30 Nov '20
30 Nov '20
Module: wine Branch: master Commit: 00d067769ebaa8e8e52d14f3989dae8adf5eb30c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=00d067769ebaa8e8e52d14f3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun Nov 29 21:30:08 2020 +0100 libwine: Move libwine private definitions out of the global wine/unicode.h Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/unicode.h | 36 --------------------- libs/wine/c_037.c | 2 +- libs/wine/c_10000.c | 2 +- libs/wine/c_10001.c | 2 +- libs/wine/c_10002.c | 2 +- libs/wine/c_10003.c | 2 +- libs/wine/c_10004.c | 2 +- libs/wine/c_10005.c | 2 +- libs/wine/c_10006.c | 2 +- libs/wine/c_10007.c | 2 +- libs/wine/c_10008.c | 2 +- libs/wine/c_10010.c | 2 +- libs/wine/c_10017.c | 2 +- libs/wine/c_10021.c | 2 +- libs/wine/c_10029.c | 2 +- libs/wine/c_10079.c | 2 +- libs/wine/c_10081.c | 2 +- libs/wine/c_10082.c | 2 +- libs/wine/c_1026.c | 2 +- libs/wine/c_1250.c | 2 +- libs/wine/c_1251.c | 2 +- libs/wine/c_1252.c | 2 +- libs/wine/c_1253.c | 2 +- libs/wine/c_1254.c | 2 +- libs/wine/c_1255.c | 2 +- libs/wine/c_1256.c | 2 +- libs/wine/c_1257.c | 2 +- libs/wine/c_1258.c | 2 +- libs/wine/c_1361.c | 2 +- libs/wine/c_20127.c | 2 +- libs/wine/c_20866.c | 2 +- libs/wine/c_20932.c | 2 +- libs/wine/c_21866.c | 2 +- libs/wine/c_28591.c | 2 +- libs/wine/c_28592.c | 2 +- libs/wine/c_28593.c | 2 +- libs/wine/c_28594.c | 2 +- libs/wine/c_28595.c | 2 +- libs/wine/c_28596.c | 2 +- libs/wine/c_28597.c | 2 +- libs/wine/c_28598.c | 2 +- libs/wine/c_28599.c | 2 +- libs/wine/c_28603.c | 2 +- libs/wine/c_28605.c | 2 +- libs/wine/c_437.c | 2 +- libs/wine/c_500.c | 2 +- libs/wine/c_737.c | 2 +- libs/wine/c_775.c | 2 +- libs/wine/c_850.c | 2 +- libs/wine/c_852.c | 2 +- libs/wine/c_855.c | 2 +- libs/wine/c_857.c | 2 +- libs/wine/c_860.c | 2 +- libs/wine/c_861.c | 2 +- libs/wine/c_862.c | 2 +- libs/wine/c_863.c | 2 +- libs/wine/c_864.c | 2 +- libs/wine/c_865.c | 2 +- libs/wine/c_866.c | 2 +- libs/wine/c_869.c | 2 +- libs/wine/c_874.c | 2 +- libs/wine/c_875.c | 2 +- libs/wine/c_932.c | 2 +- libs/wine/c_936.c | 2 +- libs/wine/c_949.c | 2 +- libs/wine/c_950.c | 2 +- libs/wine/cpsymbol.c | 2 +- libs/wine/cptable.c | 2 +- libs/wine/fold.c | 2 +- libs/wine/mbtowc.c | 2 +- libs/wine/sortkey.c | 2 +- libs/wine/unicode.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ libs/wine/utf8.c | 2 +- libs/wine/wctomb.c | 2 +- 74 files changed, 157 insertions(+), 108 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=00d067769ebaa8e8e52d…
1
0
0
0
Alexandre Julliard : libport: Move the non-inline version of the string functions to libwine.
by Alexandre Julliard
30 Nov '20
30 Nov '20
Module: wine Branch: master Commit: 1fdbf850eeef751bbde914f177bf659e402344d6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1fdbf850eeef751bbde914f1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun Nov 29 21:21:49 2020 +0100 libport: Move the non-inline version of the string functions to libwine. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/unicode.h | 29 +++++++++++++++++++++++------ libs/port/Makefile.in | 1 - libs/wine/Makefile.in | 1 + libs/wine/port.c | 12 ++---------- libs/{port => wine}/string.c | 6 ++++++ 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/include/wine/unicode.h b/include/wine/unicode.h index f42a94c7e0d..069b5ce2624 100644 --- a/include/wine/unicode.h +++ b/include/wine/unicode.h @@ -40,7 +40,7 @@ extern "C" { #endif #ifndef WINE_UNICODE_INLINE -#define WINE_UNICODE_INLINE static inline +#define WINE_UNICODE_INLINE static FORCEINLINE #endif /* code page info common to SBCS and DBCS */ @@ -79,11 +79,6 @@ union cptable struct dbcs_table dbcs; }; -extern int sprintfW( WCHAR *str, const WCHAR *format, ... ); -extern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... ); -extern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist ); -extern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list valist ); - WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch ) { extern const WCHAR wine_casemap_lower[]; @@ -401,6 +396,28 @@ WINE_UNICODE_INLINE int atoiW( const WCHAR *str ) return (int)atolW( str ); } +NTSYSAPI int __cdecl _vsnwprintf(WCHAR*,size_t,const WCHAR*,__ms_va_list); + +static inline int WINAPIV snprintfW( WCHAR *str, size_t len, const WCHAR *format, ...) +{ + int retval; + __ms_va_list valist; + __ms_va_start(valist, format); + retval = _vsnwprintf(str, len, format, valist); + __ms_va_end(valist); + return retval; +} + +static inline int WINAPIV sprintfW( WCHAR *str, const WCHAR *format, ...) +{ + int retval; + __ms_va_list valist; + __ms_va_start(valist, format); + retval = _vsnwprintf(str, MAXLONG, format, valist); + __ms_va_end(valist); + return retval; +} + #undef WINE_UNICODE_INLINE #ifdef __cplusplus diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in index 7bc67fa3fee..aabcc833ec6 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in @@ -17,7 +17,6 @@ C_SRCS = \ rint.c \ spawn.c \ statvfs.c \ - string.c \ strnlen.c \ symlink.c \ usleep.c \ diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in index 65a07895027..74ffc0d5f83 100644 --- a/libs/wine/Makefile.in +++ b/libs/wine/Makefile.in @@ -81,6 +81,7 @@ C_SRCS = \ mmap.c \ port.c \ sortkey.c \ + string.c \ utf8.c \ wctomb.c diff --git a/libs/wine/port.c b/libs/wine/port.c index 62d5c2abcdb..8e56ada52aa 100644 --- a/libs/wine/port.c +++ b/libs/wine/port.c @@ -27,16 +27,8 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> - -#include "wine/unicode.h" - -/* functions from libwine_port that are also exported from libwine for backwards compatibility, - * on platforms that require it */ -const void *libwine_port_functions[] = -{ - strtolW, - vsnprintfW, -}; +#include <stdarg.h> +#include <windef.h> /* no longer used, for backwards compatibility only */ struct wine_pthread_functions; diff --git a/libs/port/string.c b/libs/wine/string.c similarity index 99% rename from libs/port/string.c rename to libs/wine/string.c index 62b972399bf..d6fb88f8eca 100644 --- a/libs/port/string.c +++ b/libs/wine/string.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "wine/asm.h" + +#ifdef __ASM_OBSOLETE + #include <assert.h> #include <errno.h> #include <limits.h> @@ -711,3 +715,5 @@ int sprintfW( WCHAR *str, const WCHAR *format, ...) va_end(valist); return retval; } + +#endif /* __ASM_OBSOLETE */
1
0
0
0
Alexandre Julliard : libport: Add both inline and non-inline versions for every Unicode function.
by Alexandre Julliard
30 Nov '20
30 Nov '20
Module: wine Branch: master Commit: 0e03ad249c2ae7d53671bc75b0c57e2fb1665113 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0e03ad249c2ae7d53671bc75…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Nov 28 21:49:20 2020 +0100 libport: Add both inline and non-inline versions for every Unicode function. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/unicode.h | 138 ++++++++++++++++++++++++++++++++++-- libs/port/string.c | 185 ++++++++++++++++++++++++++++++++++++++++++++++++- libs/wine/port.c | 1 - 3 files changed, 316 insertions(+), 8 deletions(-) diff --git a/include/wine/unicode.h b/include/wine/unicode.h index 8d30e9f4477..f42a94c7e0d 100644 --- a/include/wine/unicode.h +++ b/include/wine/unicode.h @@ -79,12 +79,6 @@ union cptable struct dbcs_table dbcs; }; -extern int strcmpiW( const WCHAR *str1, const WCHAR *str2 ); -extern int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n ); -extern int memicmpW( const WCHAR *str1, const WCHAR *str2, int n ); -extern WCHAR *strstrW( const WCHAR *str, const WCHAR *sub ); -extern long int strtolW( const WCHAR *nptr, WCHAR **endptr, int base ); -extern unsigned long int strtoulW( const WCHAR *nptr, WCHAR **endptr, int base ); extern int sprintfW( WCHAR *str, const WCHAR *format, ... ); extern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... ); extern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist ); @@ -265,6 +259,138 @@ WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n ) return ret; } +WINE_UNICODE_INLINE int strcmpiW( const WCHAR *str1, const WCHAR *str2 ) +{ + for (;;) + { + int ret = tolowerW(*str1) - tolowerW(*str2); + if (ret || !*str1) return ret; + str1++; + str2++; + } +} + +WINE_UNICODE_INLINE int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n ) +{ + int ret = 0; + for ( ; n > 0; n--, str1++, str2++) + if ((ret = tolowerW(*str1) - tolowerW(*str2)) || !*str1) break; + return ret; +} + +WINE_UNICODE_INLINE int memicmpW( const WCHAR *str1, const WCHAR *str2, int n ) +{ + int ret = 0; + for ( ; n > 0; n--, str1++, str2++) + if ((ret = tolowerW(*str1) - tolowerW(*str2))) break; + return ret; +} + +WINE_UNICODE_INLINE WCHAR *strstrW( const WCHAR *str, const WCHAR *sub ) +{ + while (*str) + { + const WCHAR *p1 = str, *p2 = sub; + while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; } + if (!*p2) return (WCHAR *)str; + str++; + } + return NULL; +} + +WINE_UNICODE_INLINE LONG strtolW( LPCWSTR s, LPWSTR *end, INT base ) +{ + BOOL negative = FALSE, empty = TRUE; + LONG ret = 0; + + if (base < 0 || base == 1 || base > 36) return 0; + if (end) *end = (WCHAR *)s; + while (isspaceW(*s)) s++; + + if (*s == '-') + { + negative = TRUE; + s++; + } + else if (*s == '+') s++; + + if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) + { + base = 16; + s += 2; + } + if (base == 0) base = s[0] != '0' ? 10 : 8; + + while (*s) + { + int v; + + if ('0' <= *s && *s <= '9') v = *s - '0'; + else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; + else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; + else break; + if (v >= base) break; + if (negative) v = -v; + s++; + empty = FALSE; + + if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v)) + ret = MAXLONG; + else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v))) + ret = MINLONG; + else + ret = ret * base + v; + } + + if (end && !empty) *end = (WCHAR *)s; + return ret; +} + +WINE_UNICODE_INLINE ULONG strtoulW( LPCWSTR s, LPWSTR *end, INT base ) +{ + BOOL negative = FALSE, empty = TRUE; + ULONG ret = 0; + + if (base < 0 || base == 1 || base > 36) return 0; + if (end) *end = (WCHAR *)s; + while (isspaceW(*s)) s++; + + if (*s == '-') + { + negative = TRUE; + s++; + } + else if (*s == '+') s++; + + if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) + { + base = 16; + s += 2; + } + if (base == 0) base = s[0] != '0' ? 10 : 8; + + while (*s) + { + int v; + + if ('0' <= *s && *s <= '9') v = *s - '0'; + else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10; + else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10; + else break; + if (v >= base) break; + s++; + empty = FALSE; + + if (ret > MAXDWORD / base || ret * base > MAXDWORD - v) + ret = MAXDWORD; + else + ret = ret * base + v; + } + + if (end && !empty) *end = (WCHAR *)s; + return negative ? -ret : ret; +} + WINE_UNICODE_INLINE long int atolW( const WCHAR *str ) { return strtolW( str, (WCHAR **)0, 10 ); diff --git a/libs/port/string.c b/libs/port/string.c index c3388bcc7da..62b972399bf 100644 --- a/libs/port/string.c +++ b/libs/port/string.c @@ -22,8 +22,181 @@ #include <errno.h> #include <limits.h> #include <stdio.h> +#include <stdarg.h> -#include "wine/unicode.h" +#include <windef.h> +#include <winbase.h> +#include <winnls.h> + +WCHAR tolowerW( WCHAR ch ) +{ + extern const WCHAR wine_casemap_lower[]; + return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)]; +} + +WCHAR toupperW( WCHAR ch ) +{ + extern const WCHAR wine_casemap_upper[]; + return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)]; +} + +/* the character type contains the C1_* flags in the low 12 bits */ +/* and the C2_* type in the high 4 bits */ +unsigned short get_char_typeW( WCHAR ch ) +{ + extern const unsigned short wine_wctype_table[]; + return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)]; +} + +int iscntrlW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_CNTRL; +} + +int ispunctW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_PUNCT; +} + +int isspaceW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_SPACE; +} + +int isdigitW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_DIGIT; +} + +int isxdigitW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_XDIGIT; +} + +int islowerW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_LOWER; +} + +int isupperW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_UPPER; +} + +int isalnumW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER); +} + +int isalphaW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER); +} + +int isgraphW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER); +} + +int isprintW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER); +} + +unsigned int strlenW( const WCHAR *str ) +{ + const WCHAR *s = str; + while (*s) s++; + return s - str; +} + +WCHAR *strcpyW( WCHAR *dst, const WCHAR *src ) +{ + WCHAR *p = dst; + while ((*p++ = *src++)); + return dst; +} + +int strcmpW( const WCHAR *str1, const WCHAR *str2 ) +{ + while (*str1 && (*str1 == *str2)) { str1++; str2++; } + return *str1 - *str2; +} + +int strncmpW( const WCHAR *str1, const WCHAR *str2, int n ) +{ + if (n <= 0) return 0; + while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; } + return *str1 - *str2; +} + +WCHAR *strcatW( WCHAR *dst, const WCHAR *src ) +{ + strcpyW( dst + strlenW(dst), src ); + return dst; +} + +WCHAR *strchrW( const WCHAR *str, WCHAR ch ) +{ + do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++); + return NULL; +} + +WCHAR *strrchrW( const WCHAR *str, WCHAR ch ) +{ + WCHAR *ret = NULL; + do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++); + return ret; +} + +WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept ) +{ + for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(ULONG_PTR)str; + return NULL; +} + +size_t strspnW( const WCHAR *str, const WCHAR *accept ) +{ + const WCHAR *ptr; + for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break; + return ptr - str; +} + +size_t strcspnW( const WCHAR *str, const WCHAR *reject ) +{ + const WCHAR *ptr; + for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break; + return ptr - str; +} + +WCHAR *strlwrW( WCHAR *str ) +{ + WCHAR *ret; + for (ret = str; *str; str++) *str = tolowerW(*str); + return ret; +} + +WCHAR *struprW( WCHAR *str ) +{ + WCHAR *ret; + for (ret = str; *str; str++) *str = toupperW(*str); + return ret; +} + +WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n ) +{ + const WCHAR *end; + for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(ULONG_PTR)ptr; + return NULL; +} + +WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n ) +{ + const WCHAR *end; + WCHAR *ret = NULL; + for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr; + return ret; +} int strcmpiW( const WCHAR *str1, const WCHAR *str2 ) { @@ -300,6 +473,16 @@ noconv: return 0L; } +long int atolW( const WCHAR *str ) +{ + return strtolW( str, (WCHAR **)0, 10 ); +} + +int atoiW( const WCHAR *str ) +{ + return (int)atolW( str ); +} + /* format a WCHAR string according to a printf format; helper for vsnprintfW */ static size_t format_string( WCHAR *buffer, size_t len, const char *format, const WCHAR *str, int str_len ) diff --git a/libs/wine/port.c b/libs/wine/port.c index 259ff084e88..62d5c2abcdb 100644 --- a/libs/wine/port.c +++ b/libs/wine/port.c @@ -28,7 +28,6 @@ #include <string.h> #include <sys/types.h> -#define WINE_UNICODE_INLINE /* nothing */ #include "wine/unicode.h" /* functions from libwine_port that are also exported from libwine for backwards compatibility,
1
0
0
0
Alexandre Julliard : server: Release the l_intl fd once the mapping is created.
by Alexandre Julliard
30 Nov '20
30 Nov '20
Module: wine Branch: master Commit: 9494fa6986e40fdd563436df3e705feb44f747ad URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9494fa6986e40fdd563436df…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Nov 28 14:59:19 2020 +0100 server: Release the l_intl fd once the mapping is created. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50204
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/directory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/server/directory.c b/server/directory.c index 81d02d6f64e..ca9f978ff7f 100644 --- a/server/directory.c +++ b/server/directory.c @@ -444,6 +444,7 @@ void init_directories( struct fd *intl_fd ) /* mappings */ release_object( create_fd_mapping( &dir_nls->obj, &intl_str, intl_fd, OBJ_PERMANENT, NULL )); release_object( create_user_data_mapping( &dir_kernel->obj, &user_data_str, OBJ_PERMANENT, NULL )); + release_object( intl_fd ); release_object( named_pipe_device ); release_object( mailslot_device );
1
0
0
0
Jacek Caban : kernelbase: Use FileFsDeviceInformation for console handles in GetFileType.
by Alexandre Julliard
27 Nov '20
27 Nov '20
Module: wine Branch: master Commit: cbca9f847f60773b4e7e5408f6a079f4896c5c1e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cbca9f847f60773b4e7e5408…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Nov 27 18:14:22 2020 +0100 kernelbase: Use FileFsDeviceInformation for console handles in GetFileType. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 7 ++++++- dlls/kernelbase/file.c | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index ea6af85c15a..cab036243dc 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3777,7 +3777,7 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output) static void test_FreeConsole(void) { HANDLE handle, unbound_output = NULL, unbound_input = NULL; - DWORD size, mode; + DWORD size, mode, type; WCHAR title[16]; char buf[32]; HWND hwnd; @@ -3889,6 +3889,11 @@ static void test_FreeConsole(void) ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "GetConsoleMode returned %x %u\n", ret, GetLastError()); + type = GetFileType(unbound_input); + ok(type == FILE_TYPE_CHAR, "GetFileType returned %u\n", type); + type = GetFileType(unbound_output); + ok(type == FILE_TYPE_CHAR, "GetFileType returned %u\n", type); + CloseHandle(unbound_input); CloseHandle(unbound_output); } diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index bfa44b4da50..7d0c4d63aa8 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -3099,8 +3099,6 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetFileType( HANDLE file ) file == (HANDLE)STD_ERROR_HANDLE) file = GetStdHandle( (DWORD_PTR)file ); - if (is_console_handle( file )) return FILE_TYPE_CHAR; - if (!set_ntstatus( NtQueryVolumeInformationFile( file, &io, &info, sizeof(info), FileFsDeviceInformation ))) return FILE_TYPE_UNKNOWN; @@ -3108,6 +3106,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetFileType( HANDLE file ) switch (info.DeviceType) { case FILE_DEVICE_NULL: + case FILE_DEVICE_CONSOLE: case FILE_DEVICE_SERIAL_PORT: case FILE_DEVICE_PARALLEL_PORT: case FILE_DEVICE_TAPE:
1
0
0
0
Jacek Caban : server: Use separated fd ops for unbound console output.
by Alexandre Julliard
27 Nov '20
27 Nov '20
Module: wine Branch: master Commit: 2a132a18390e848b90c0273e891cbeb6d140bc70 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2a132a18390e848b90c0273e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Nov 27 18:14:12 2020 +0100 server: Use separated fd ops for unbound console output. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 7 ++++ server/console.c | 82 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 79 insertions(+), 10 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 5e604e949f6..ea6af85c15a 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3878,6 +3878,13 @@ static void test_FreeConsole(void) ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "ReadFile returned %x %u\n", ret, GetLastError()); + ret = WriteFile(unbound_input, "test", 4, &size, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, + "ReadFile returned %x %u\n", ret, GetLastError()); + + ret = GetConsoleMode(unbound_input, &mode); + ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, + "GetConsoleMode returned %x %u\n", ret, GetLastError()); ret = GetConsoleMode(unbound_output, &mode); ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "GetConsoleMode returned %x %u\n", ret, GetLastError()); diff --git a/server/console.c b/server/console.c index 7cffa512f0e..295db7767b2 100644 --- a/server/console.c +++ b/server/console.c @@ -346,15 +346,22 @@ static const struct fd_ops console_input_fd_ops = default_fd_reselect_async /* reselect_async */ }; +struct console_output +{ + struct object obj; /* object header */ + struct fd *fd; /* pseudo-fd */ +}; + static void console_output_dump( struct object *obj, int verbose ); static int console_output_add_queue( struct object *obj, struct wait_queue_entry *entry ); static struct fd *console_output_get_fd( struct object *obj ); static struct object *console_output_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); +static void console_output_destroy( struct object *obj ); static const struct object_ops console_output_ops = { - sizeof(struct object), /* size */ + sizeof(struct console_output), /* size */ console_output_dump, /* dump */ console_device_get_type, /* get_type */ console_output_add_queue, /* add_queue */ @@ -373,7 +380,25 @@ static const struct object_ops console_output_ops = console_output_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ - no_destroy /* destroy */ + console_output_destroy /* destroy */ +}; + +static int console_output_write( struct fd *fd, struct async *async, file_pos_t pos ); +static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); + +static const struct fd_ops console_output_fd_ops = +{ + default_fd_get_poll_events, /* get_poll_events */ + default_poll_event, /* poll_event */ + console_get_fd_type, /* get_fd_type */ + no_fd_read, /* read */ + console_output_write, /* write */ + no_fd_flush, /* flush */ + console_get_file_info, /* get_file_info */ + console_get_volume_info, /* get_volume_info */ + console_output_ioctl, /* ioctl */ + default_fd_queue_async, /* queue_async */ + default_fd_reselect_async /* reselect_async */ }; struct console_connection @@ -1254,8 +1279,17 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni if (name->len == sizeof(outputW) && !memcmp( name->str, outputW, name->len )) { + struct console_output *console_output; name->len = 0; - return alloc_object( &console_output_ops ); + if (!(console_output = alloc_object( &console_output_ops ))) return NULL; + console_output->fd = alloc_pseudo_fd( &console_output_fd_ops, &console_output->obj, + FILE_SYNCHRONOUS_IO_NONALERT ); + if (!console_output->fd) + { + release_object( console_output ); + return NULL; + } + return &console_output->obj; } if (name->len == sizeof(screen_bufferW) && !memcmp( name->str, screen_bufferW, name->len )) @@ -1392,13 +1426,9 @@ static int console_output_add_queue( struct object *obj, struct wait_queue_entry static struct fd *console_output_get_fd( struct object *obj ) { - if (!current->process->console || !current->process->console->active) - { - set_error( STATUS_ACCESS_DENIED ); - return NULL; - } - - return get_obj_fd( ¤t->process->console->active->obj ); + struct console_output *console_output = (struct console_output *)obj; + assert( obj->ops == &console_output_ops ); + return (struct fd *)grab_object( console_output->fd ); } static struct object *console_output_open_file( struct object *obj, unsigned int access, @@ -1407,6 +1437,38 @@ static struct object *console_output_open_file( struct object *obj, unsigned int return grab_object( obj ); } +static void console_output_destroy( struct object *obj ) +{ + struct console_output *console_output = (struct console_output *)obj; + + assert( obj->ops == &console_output_ops ); + if (console_output->fd) release_object( console_output->fd ); +} + +static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +{ + struct console *console = current->process->console; + + if (!console || !console->active) + { + set_error( STATUS_INVALID_HANDLE ); + return 0; + } + return screen_buffer_ioctl( console->active->fd, code, async ); +} + +static int console_output_write( struct fd *fd, struct async *async, file_pos_t pos ) +{ + struct console *console = current->process->console; + + if (!console || !console->active) + { + set_error( STATUS_INVALID_HANDLE ); + return 0; + } + return screen_buffer_write( console->active->fd, async, pos ); +} + struct object *create_console_device( struct object *root, const struct unicode_str *name, unsigned int attr, const struct security_descriptor *sd ) {
1
0
0
0
Jacek Caban : server: Use separated fd ops for unbound console input.
by Alexandre Julliard
27 Nov '20
27 Nov '20
Module: wine Branch: master Commit: a61188bfa5bf20443b11f397d8ef6e7e5fd4bdf1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a61188bfa5bf20443b11f397…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Nov 27 18:13:59 2020 +0100 server: Use separated fd ops for unbound console input. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 18 ++++++++- server/console.c | 94 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 101 insertions(+), 11 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 0376d00892e..5e604e949f6 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -3776,15 +3776,20 @@ static void test_GetConsoleScreenBufferInfoEx(HANDLE std_output) static void test_FreeConsole(void) { - HANDLE handle, unbound_output = NULL; + HANDLE handle, unbound_output = NULL, unbound_input = NULL; DWORD size, mode; WCHAR title[16]; + char buf[32]; HWND hwnd; UINT cp; BOOL ret; ok(RtlGetCurrentPeb()->ProcessParameters->ConsoleHandle != NULL, "ConsoleHandle is NULL\n"); - if (!skip_nt) unbound_output = create_unbound_handle(TRUE, TRUE); + if (!skip_nt) + { + unbound_input = create_unbound_handle(FALSE, TRUE); + unbound_output = create_unbound_handle(TRUE, TRUE); + } ret = FreeConsole(); ok(ret, "FreeConsole failed: %u\n", GetLastError()); @@ -3865,10 +3870,19 @@ static void test_FreeConsole(void) handle = GetConsoleInputWaitHandle(); ok(!handle, "GetConsoleInputWaitHandle returned %p\n", handle); + ret = ReadFile(unbound_input, buf, sizeof(buf), &size, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, + "ReadFile returned %x %u\n", ret, GetLastError()); + + ret = FlushFileBuffers(unbound_input); + ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, + "ReadFile returned %x %u\n", ret, GetLastError()); + ret = GetConsoleMode(unbound_output, &mode); ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "GetConsoleMode returned %x %u\n", ret, GetLastError()); + CloseHandle(unbound_input); CloseHandle(unbound_output); } diff --git a/server/console.c b/server/console.c index 91a00df0998..7cffa512f0e 100644 --- a/server/console.c +++ b/server/console.c @@ -290,15 +290,22 @@ static const struct object_ops console_device_ops = no_destroy /* destroy */ }; +struct console_input +{ + struct object obj; /* object header */ + struct fd *fd; /* pseudo-fd */ +}; + static void console_input_dump( struct object *obj, int verbose ); static struct object *console_input_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); static int console_input_add_queue( struct object *obj, struct wait_queue_entry *entry ); static struct fd *console_input_get_fd( struct object *obj ); +static void console_input_destroy( struct object *obj ); static const struct object_ops console_input_ops = { - sizeof(struct object), /* size */ + sizeof(struct console_input), /* size */ console_input_dump, /* dump */ console_device_get_type, /* get_type */ console_input_add_queue, /* add_queue */ @@ -317,7 +324,26 @@ static const struct object_ops console_input_ops = console_input_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ - no_destroy /* destroy */ + console_input_destroy /* destroy */ +}; + +static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); +static int console_input_flush( struct fd *fd, struct async *async ); +static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); + +static const struct fd_ops console_input_fd_ops = +{ + default_fd_get_poll_events, /* get_poll_events */ + default_poll_event, /* poll_event */ + console_get_fd_type, /* get_fd_type */ + console_input_read, /* read */ + no_fd_write, /* write */ + console_input_flush, /* flush */ + console_get_file_info, /* get_file_info */ + console_get_volume_info, /* get_volume_info */ + console_input_ioctl, /* ioctl */ + default_fd_queue_async, /* queue_async */ + default_fd_reselect_async /* reselect_async */ }; static void console_output_dump( struct object *obj, int verbose ); @@ -1213,8 +1239,17 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni if (name->len == sizeof(inputW) && !memcmp( name->str, inputW, name->len )) { + struct console_input *console_input; name->len = 0; - return alloc_object( &console_input_ops ); + if (!(console_input = alloc_object( &console_input_ops ))) return NULL; + console_input->fd = alloc_pseudo_fd( &console_input_fd_ops, &console_input->obj, + FILE_SYNCHRONOUS_IO_NONALERT ); + if (!console_input->fd) + { + release_object( console_input ); + return NULL; + } + return &console_input->obj; } if (name->len == sizeof(outputW) && !memcmp( name->str, outputW, name->len )) @@ -1285,12 +1320,9 @@ static int console_input_add_queue( struct object *obj, struct wait_queue_entry static struct fd *console_input_get_fd( struct object *obj ) { - if (!current->process->console) - { - set_error( STATUS_ACCESS_DENIED ); - return 0; - } - return get_obj_fd( ¤t->process->console->obj ); + struct console_input *console_input = (struct console_input *)obj; + assert( obj->ops == &console_input_ops ); + return (struct fd *)grab_object( console_input->fd ); } static struct object *console_input_open_file( struct object *obj, unsigned int access, @@ -1299,6 +1331,50 @@ static struct object *console_input_open_file( struct object *obj, unsigned int return grab_object( obj ); } +static void console_input_destroy( struct object *obj ) +{ + struct console_input *console_input = (struct console_input *)obj; + + assert( obj->ops == &console_input_ops ); + if (console_input->fd) release_object( console_input->fd ); +} + +static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +{ + struct console *console = current->process->console; + + if (!console) + { + set_error( STATUS_INVALID_HANDLE ); + return 0; + } + return console_ioctl( console->fd, code, async ); +} + +static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos ) +{ + struct console *console = current->process->console; + + if (!console) + { + set_error( STATUS_INVALID_HANDLE ); + return 0; + } + return console_read( console->fd, async, pos ); +} + +static int console_input_flush( struct fd *fd, struct async *async ) +{ + struct console *console = current->process->console; + + if (!console) + { + set_error( STATUS_INVALID_HANDLE ); + return 0; + } + return console_flush( console->fd, async ); +} + static void console_output_dump( struct object *obj, int verbose ) { fputs( "console Output device\n", stderr );
1
0
0
0
Jacek Caban : server: Rename unbound devices to console_input and console_output.
by Alexandre Julliard
27 Nov '20
27 Nov '20
Module: wine Branch: master Commit: 946da4f3d86202ca2cfc6b59cb37d5602802c9ac URL:
https://source.winehq.org/git/wine.git/?a=commit;h=946da4f3d86202ca2cfc6b59…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Nov 27 18:13:51 2020 +0100 server: Rename unbound devices to console_input and console_output. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 64 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/server/console.c b/server/console.c index f1ce9b27dbd..91a00df0998 100644 --- a/server/console.c +++ b/server/console.c @@ -290,23 +290,23 @@ static const struct object_ops console_device_ops = no_destroy /* destroy */ }; -static void input_device_dump( struct object *obj, int verbose ); -static struct object *input_device_open_file( struct object *obj, unsigned int access, - unsigned int sharing, unsigned int options ); -static int input_device_add_queue( struct object *obj, struct wait_queue_entry *entry ); -static struct fd *input_device_get_fd( struct object *obj ); +static void console_input_dump( struct object *obj, int verbose ); +static struct object *console_input_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); +static int console_input_add_queue( struct object *obj, struct wait_queue_entry *entry ); +static struct fd *console_input_get_fd( struct object *obj ); -static const struct object_ops input_device_ops = +static const struct object_ops console_input_ops = { sizeof(struct object), /* size */ - input_device_dump, /* dump */ + console_input_dump, /* dump */ console_device_get_type, /* get_type */ - input_device_add_queue, /* add_queue */ + console_input_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ no_satisfied, /* satisfied */ no_signal, /* signal */ - input_device_get_fd, /* get_fd */ + console_input_get_fd, /* get_fd */ no_map_access, /* map_access */ default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ @@ -314,29 +314,29 @@ static const struct object_ops input_device_ops = no_lookup_name, /* lookup_name */ directory_link_name, /* link_name */ default_unlink_name, /* unlink_name */ - input_device_open_file, /* open_file */ + console_input_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; -static void output_device_dump( struct object *obj, int verbose ); -static int output_device_add_queue( struct object *obj, struct wait_queue_entry *entry ); -static struct fd *output_device_get_fd( struct object *obj ); -static struct object *output_device_open_file( struct object *obj, unsigned int access, - unsigned int sharing, unsigned int options ); +static void console_output_dump( struct object *obj, int verbose ); +static int console_output_add_queue( struct object *obj, struct wait_queue_entry *entry ); +static struct fd *console_output_get_fd( struct object *obj ); +static struct object *console_output_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ); -static const struct object_ops output_device_ops = +static const struct object_ops console_output_ops = { sizeof(struct object), /* size */ - output_device_dump, /* dump */ + console_output_dump, /* dump */ console_device_get_type, /* get_type */ - output_device_add_queue, /* add_queue */ + console_output_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ no_satisfied, /* satisfied */ no_signal, /* signal */ - output_device_get_fd, /* get_fd */ + console_output_get_fd, /* get_fd */ no_map_access, /* map_access */ default_get_sd, /* get_sd */ default_set_sd, /* set_sd */ @@ -344,7 +344,7 @@ static const struct object_ops output_device_ops = no_lookup_name, /* lookup_name */ directory_link_name, /* link_name */ default_unlink_name, /* unlink_name */ - output_device_open_file, /* open_file */ + console_output_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ no_destroy /* destroy */ @@ -1214,13 +1214,13 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni if (name->len == sizeof(inputW) && !memcmp( name->str, inputW, name->len )) { name->len = 0; - return alloc_object( &input_device_ops ); + return alloc_object( &console_input_ops ); } if (name->len == sizeof(outputW) && !memcmp( name->str, outputW, name->len )) { name->len = 0; - return alloc_object( &output_device_ops ); + return alloc_object( &console_output_ops ); } if (name->len == sizeof(screen_bufferW) && !memcmp( name->str, screen_bufferW, name->len )) @@ -1268,12 +1268,12 @@ static struct object *console_device_open_file( struct object *obj, unsigned int return is_output ? grab_object( current->process->console->active ) : grab_object( current->process->console ); } -static void input_device_dump( struct object *obj, int verbose ) +static void console_input_dump( struct object *obj, int verbose ) { fputs( "console Input device\n", stderr ); } -static int input_device_add_queue( struct object *obj, struct wait_queue_entry *entry ) +static int console_input_add_queue( struct object *obj, struct wait_queue_entry *entry ) { if (!current->process->console) { @@ -1283,7 +1283,7 @@ static int input_device_add_queue( struct object *obj, struct wait_queue_entry * return add_queue( ¤t->process->console->obj, entry ); } -static struct fd *input_device_get_fd( struct object *obj ) +static struct fd *console_input_get_fd( struct object *obj ) { if (!current->process->console) { @@ -1293,18 +1293,18 @@ static struct fd *input_device_get_fd( struct object *obj ) return get_obj_fd( ¤t->process->console->obj ); } -static struct object *input_device_open_file( struct object *obj, unsigned int access, - unsigned int sharing, unsigned int options ) +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 output_device_dump( struct object *obj, int verbose ) +static void console_output_dump( struct object *obj, int verbose ) { fputs( "console Output device\n", stderr ); } -static int output_device_add_queue( struct object *obj, struct wait_queue_entry *entry ) +static int console_output_add_queue( struct object *obj, struct wait_queue_entry *entry ) { if (!current->process->console || !current->process->console->active) { @@ -1314,7 +1314,7 @@ static int output_device_add_queue( struct object *obj, struct wait_queue_entry return add_queue( ¤t->process->console->obj, entry ); } -static struct fd *output_device_get_fd( struct object *obj ) +static struct fd *console_output_get_fd( struct object *obj ) { if (!current->process->console || !current->process->console->active) { @@ -1325,8 +1325,8 @@ static struct fd *output_device_get_fd( struct object *obj ) return get_obj_fd( ¤t->process->console->active->obj ); } -static struct object *output_device_open_file( struct object *obj, unsigned int access, - unsigned int sharing, unsigned int options ) +static struct object *console_output_open_file( struct object *obj, unsigned int access, + unsigned int sharing, unsigned int options ) { return grab_object( obj ); }
1
0
0
0
Jacek Caban : server: Rename create_console_output to create_screen_buffer.
by Alexandre Julliard
27 Nov '20
27 Nov '20
Module: wine Branch: master Commit: b2e1c37381f04964d43c68a99b49cffbe0e1968c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b2e1c37381f04964d43c68a9…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Nov 27 18:13:37 2020 +0100 server: Rename create_console_output to create_screen_buffer. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/console.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/console.c b/server/console.c index 0d2c768f8e5..f1ce9b27dbd 100644 --- a/server/console.c +++ b/server/console.c @@ -551,7 +551,7 @@ static void set_active_screen_buffer( struct console *console, struct screen_buf screen_buffer->id, NULL, NULL ); } -static struct object *create_console_output( struct console *console ) +static struct object *create_screen_buffer( struct console *console ) { struct screen_buffer *screen_buffer; @@ -814,7 +814,7 @@ static struct object *console_server_lookup_name( struct object *obj, struct uni return 0; } if (!(server->console = (struct console *)create_console())) return NULL; - if (!(screen_buffer = (struct screen_buffer *)create_console_output( server->console ))) + if (!(screen_buffer = (struct screen_buffer *)create_screen_buffer( server->console ))) { release_object( server->console ); server->console = NULL; @@ -1231,7 +1231,7 @@ static struct object *console_device_lookup_name( struct object *obj, struct uni return NULL; } name->len = 0; - return create_console_output( current->process->console ); + return create_screen_buffer( current->process->console ); } if (name->len == sizeof(serverW) && !memcmp( name->str, serverW, name->len ))
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
86
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
Results per page:
10
25
50
100
200