winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1024 discussions
Start a n
N
ew thread
Jacek Caban : user32: Use NtUserMessageCall for SendMessageTimeoutA implementation.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 52eac01237c5e77d7c720731bc1844b196034edd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=52eac01237c5e77d7c720731…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Apr 4 16:58:00 2022 +0200 user32: Use NtUserMessageCall for SendMessageTimeoutA implementation. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/message.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index d54d5b55e50..e42ab74cf3f 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -2197,18 +2197,22 @@ LRESULT WINAPI SendMessageTimeoutW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, UINT flags, UINT timeout, PDWORD_PTR res_ptr ) { - struct send_message_info info; + struct send_message_timeout_params params = { .flags = flags, .timeout = timeout }; + LRESULT res = 0; - info.type = MSG_ASCII; - info.hwnd = hwnd; - info.msg = msg; - info.wparam = wparam; - info.lparam = lparam; - info.flags = flags; - info.timeout = timeout; - info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + if (msg != WM_CHAR || WIN_IsCurrentThread( hwnd )) + { + res = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, + FNID_SENDMESSAGEWTOOPTION, TRUE ); + } + else if (map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_SENDMESSAGE )) + { + res = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, + FNID_SENDMESSAGEWTOOPTION, FALSE ); + } - return send_message( &info, res_ptr, FALSE ); + if (res_ptr) *res_ptr = res; + return params.result; }
1
0
0
0
Jacek Caban : win32u: Move SendMessageW implementation from user32.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 30cc496099705faaf282d5dbe66b27a75ba17b20 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=30cc496099705faaf282d5db…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Apr 4 16:57:52 2022 +0200 win32u: Move SendMessageW implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/message.c | 14 +------------- dlls/user32/user_main.c | 2 -- dlls/win32u/message.c | 19 ++++++++++++++----- dlls/win32u/ntuser_private.h | 2 -- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 138c8d73941..d54d5b55e50 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -2217,19 +2217,7 @@ LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l */ LRESULT WINAPI SendMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - DWORD_PTR res = 0; - struct send_message_info info; - - info.type = MSG_UNICODE; - info.hwnd = hwnd; - info.msg = msg; - info.wparam = wparam; - info.lparam = lparam; - info.flags = SMTO_NORMAL; - info.timeout = 0; - - send_message( &info, &res, TRUE ); - return res; + return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, FNID_SENDMESSAGE, FALSE ); } diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 789533329c3..3fd05ec3f01 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -165,8 +165,6 @@ static const struct user_callbacks user_funcs = EndMenu, HideCaret, PostMessageW, - SendMessageA, - SendMessageW, SendNotifyMessageW, SetSystemMenu, ShowCaret, diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 359a3cadbab..41d97e648a0 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2234,11 +2234,20 @@ BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) static LRESULT send_window_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { - /* FIXME: move implementation from user32 */ - if (!user_callbacks) return FALSE; - return ansi - ? user_callbacks->pSendMessageA( hwnd, msg, wparam, lparam ) - : user_callbacks->pSendMessageW( hwnd, msg, wparam, lparam ); + struct send_message_info info; + DWORD_PTR res = 0; + + info.type = ansi ? MSG_ASCII : MSG_UNICODE; + info.hwnd = hwnd; + info.msg = msg; + info.wparam = wparam; + info.lparam = lparam; + info.flags = SMTO_NORMAL; + info.timeout = 0; + info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + + process_message( &info, &res, ansi ); + return res; } /* see SendMessageTimeoutW */ diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index d69e24a1dab..f9623446f6d 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -38,8 +38,6 @@ struct user_callbacks BOOL (WINAPI *pEndMenu)(void); BOOL (WINAPI *pHideCaret)( HWND hwnd ); BOOL (WINAPI *pPostMessageW)( HWND, UINT, WPARAM, LPARAM ); - LRESULT (WINAPI *pSendMessageA)( HWND, UINT, WPARAM, LPARAM ); - LRESULT (WINAPI *pSendMessageW)( HWND, UINT, WPARAM, LPARAM ); BOOL (WINAPI *pSendNotifyMessageW)( HWND, UINT, WPARAM, LPARAM ); BOOL (WINAPI *pSetSystemMenu)( HWND hwnd, HMENU menu ); BOOL (WINAPI *pShowCaret)( HWND hwnd );
1
0
0
0
Jacek Caban : win32u: Move SendMessageTimeoutW implementation from user32.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 74da33b7914d191afff03637dda1d60ee09710ca URL:
https://source.winehq.org/git/wine.git/?a=commit;h=74da33b7914d191afff03637…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Apr 4 16:57:43 2022 +0200 win32u: Move SendMessageTimeoutW implementation from user32. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/message.c | 15 ++---- dlls/user32/user_main.c | 1 - dlls/win32u/input.c | 6 +-- dlls/win32u/message.c | 125 +++++++++++++++++++++++++++++++++++++++++++ dlls/win32u/ntuser_private.h | 1 - dlls/win32u/palette.c | 5 +- dlls/win32u/sysparams.c | 9 ++-- dlls/win32u/tests/win32u.c | 4 -- dlls/win32u/win32u_private.h | 2 + 9 files changed, 141 insertions(+), 27 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=74da33b7914d191afff0…
1
0
0
0
Jacek Caban : win32u: Use public declaration for NtUserPostMessage.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: dca49630a9caf34c85a576428a16f4091ac33ac8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dca49630a9caf34c85a57642…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Apr 4 16:57:31 2022 +0200 win32u: Use public declaration for NtUserPostMessage. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/win32u/input.c | 2 +- dlls/win32u/message.c | 6 ++++-- dlls/win32u/win32u_private.h | 1 - dlls/win32u/window.c | 4 ++-- include/ntuser.h | 2 ++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 9f309ed37ec..7fd9e7da720 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1394,7 +1394,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, is_iconic(hwnd) ), (LPARAM)previous ); if (NtUserGetAncestor( hwnd, GA_PARENT ) == get_desktop_window()) - post_message( get_desktop_window(), WM_PARENTNOTIFY, WM_NCACTIVATE, (LPARAM)hwnd ); + NtUserPostMessage( get_desktop_window(), WM_PARENTNOTIFY, WM_NCACTIVATE, (LPARAM)hwnd ); } /* now change focus if necessary */ diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 0f84ad055e7..639372cc7c1 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2154,8 +2154,10 @@ static BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar return user_callbacks && user_callbacks->pSendNotifyMessageW( hwnd, msg, wparam, lparam ); } -/* see PostMessageW */ -LRESULT post_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) +/*********************************************************************** + * NtUserPostMessage (win32u.@) + */ +BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { /* FIXME: move implementation from user32 */ if (!user_callbacks) return 0; diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 350372b0ed7..d72ce3b8a0d 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -350,7 +350,6 @@ extern HMENU get_menu( HWND hwnd ) DECLSPEC_HIDDEN; /* message.c */ extern LRESULT dispatch_message( const MSG *msg, BOOL ansi ) DECLSPEC_HIDDEN; extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN; -extern LRESULT post_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN; extern void process_sent_messages(void) DECLSPEC_HIDDEN; extern BOOL reply_message_result( LRESULT result, MSG *msg ) DECLSPEC_HIDDEN; extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 09f3fc01e58..a8be22ab51b 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3902,7 +3902,7 @@ void update_window_state( HWND hwnd ) if (!is_current_thread_window( hwnd )) { - post_message( hwnd, WM_WINE_UPDATEWINDOWSTATE, 0, 0 ); + NtUserPostMessage( hwnd, WM_WINE_UPDATEWINDOWSTATE, 0, 0 ); return; } @@ -4923,7 +4923,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, } if (parent == get_desktop_window()) - post_message( parent, WM_PARENTNOTIFY, WM_CREATE, (LPARAM)hwnd ); + NtUserPostMessage( parent, WM_PARENTNOTIFY, WM_CREATE, (LPARAM)hwnd ); if (cs.style & WS_VISIBLE) { diff --git a/include/ntuser.h b/include/ntuser.h index 4515a9ce0f1..0be02986377 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -608,6 +608,8 @@ BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access ); HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access ); BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ); +BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ); +BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ); BOOL WINAPI NtUserRedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags ); ATOM WINAPI NtUserRegisterClassExWOW( const WNDCLASSEXW *wc, UNICODE_STRING *name, UNICODE_STRING *version, struct client_menu_name *client_menu_name, DWORD fnid, DWORD flags,
1
0
0
0
Jacek Caban : win32u: Return LRESULT from NtUserMessageCall.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 177eb908c9433bd1b45c243d3b13e996711c1cd3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=177eb908c9433bd1b45c243d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Apr 4 16:57:23 2022 +0200 win32u: Return LRESULT from NtUserMessageCall. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/user_main.c | 3 +- dlls/user32/winproc.c | 4 +- dlls/win32u/message.c | 20 ++++----- dlls/win32u/tests/win32u.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ dlls/win32u/win32u_private.h | 4 +- dlls/win32u/window.c | 8 ++-- dlls/win32u/wrappers.c | 4 +- include/ntuser.h | 29 +++++++++---- 8 files changed, 138 insertions(+), 31 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=177eb908c9433bd1b45c…
1
0
0
0
Paul Gofman : ucrtbase: Update ioinfo structure.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: cbbe8ad73a45cff0353935e9ef6d98888b75d345 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cbbe8ad73a45cff0353935e9…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Apr 4 18:52:21 2022 +0300 ucrtbase: Update ioinfo structure. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/file.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 2f9ff31f8f3..43f27629a64 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -88,6 +88,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); static char utf8_bom[3] = { 0xef, 0xbb, 0xbf }; static char utf16_bom[2] = { 0xff, 0xfe }; +#define MSVCRT_INTERNAL_BUFSIZ 4096 + enum textmode { TEXTMODE_ANSI, @@ -95,12 +97,33 @@ enum textmode TEXTMODE_UTF16LE, }; -/* FIXME: this should be allocated dynamically */ +#if _MSVCR_VER >= 140 + +#define MSVCRT_MAX_FILES 8192 +#define MSVCRT_FD_BLOCK_SIZE 64 + +typedef struct { + CRITICAL_SECTION crit; + HANDLE handle; + __int64 startpos; + unsigned char wxflag; + char textmode; + char lookahead[3]; + char unicode : 1; + char utf8translations : 1; + char dbcsBufferUsed : 1; + char dbcsBuffer[MB_LEN_MAX]; +} ioinfo; + +/********************************************************************* + * __badioinfo (MSVCRT.@) + */ +ioinfo MSVCRT___badioinfo = { {0}, INVALID_HANDLE_VALUE, 0, WX_TEXT }; +#else + #define MSVCRT_MAX_FILES 2048 #define MSVCRT_FD_BLOCK_SIZE 32 -#define MSVCRT_INTERNAL_BUFSIZ 4096 - typedef struct { HANDLE handle; unsigned char wxflag; @@ -113,23 +136,35 @@ typedef struct { char pipech2[2]; __int64 startpos; BOOL utf8translations; - char dbcsBuffer; + char dbcsBuffer[1]; BOOL dbcsBufferUsed; #endif } ioinfo; /********************************************************************* - * __pioinfo (MSVCRT.@) - * array of pointers to ioinfo arrays [32] + * __badioinfo (MSVCRT.@) */ -ioinfo * MSVCRT___pioinfo[MSVCRT_MAX_FILES/MSVCRT_FD_BLOCK_SIZE] = { 0 }; +ioinfo MSVCRT___badioinfo = { INVALID_HANDLE_VALUE, WX_TEXT }; +#endif /********************************************************************* - * __badioinfo (MSVCRT.@) + * __pioinfo (MSVCRT.@) + * array of pointers to ioinfo arrays [32] */ -ioinfo MSVCRT___badioinfo = { INVALID_HANDLE_VALUE, WX_TEXT }; +ioinfo * MSVCRT___pioinfo[MSVCRT_MAX_FILES/MSVCRT_FD_BLOCK_SIZE] = { 0 }; #if _MSVCR_VER >= 80 + +#if _MSVCR_VER >= 140 +static inline BOOL ioinfo_is_crit_init(ioinfo *info) +{ + return TRUE; +} + +static inline void ioinfo_set_crit_init(ioinfo *info) +{ +} +#else static inline BOOL ioinfo_is_crit_init(ioinfo *info) { return info->exflag & 1; @@ -139,6 +174,7 @@ static inline void ioinfo_set_crit_init(ioinfo *info) { info->exflag |= 1; } +#endif static inline enum textmode ioinfo_get_textmode(ioinfo *info) { @@ -384,9 +420,24 @@ static inline BOOL alloc_pioinfo_block(int fd) return FALSE; } for(i=0; i<MSVCRT_FD_BLOCK_SIZE; i++) + { block[i].handle = INVALID_HANDLE_VALUE; + if (ioinfo_is_crit_init(&block[i])) + { + /* Initialize crit section on block allocation for _MSVC_VER >= 140, + * ioinfo_is_crit_init() is always TRUE. */ + InitializeCriticalSection(&block[i].crit); + } + } if(InterlockedCompareExchangePointer((void**)&MSVCRT___pioinfo[fd/MSVCRT_FD_BLOCK_SIZE], block, NULL)) + { + if (ioinfo_is_crit_init(&block[0])) + { + for(i = 0; i < MSVCRT_FD_BLOCK_SIZE; ++i) + DeleteCriticalSection(&block[i].crit); + } free(block); + } return TRUE; } @@ -3555,7 +3606,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count) #if _MSVCR_VER >= 80 if (info->dbcsBufferUsed) { - conv[j++] = info->dbcsBuffer; + conv[j++] = info->dbcsBuffer[0]; info->dbcsBufferUsed = FALSE; conv[j++] = s[i++]; len++; @@ -3572,7 +3623,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count) if (i == count) { #if _MSVCR_VER >= 80 - info->dbcsBuffer = conv[j-1]; + info->dbcsBuffer[0] = conv[j-1]; info->dbcsBufferUsed = TRUE; break; #else
1
0
0
0
Paul Gofman : msvcr90/tests: Test ioinfo structure.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 7ebba96a951d891b2dc43007ec54f4d88322fab2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7ebba96a951d891b2dc43007…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Apr 4 18:52:20 2022 +0300 msvcr90/tests: Test ioinfo structure. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr90/tests/msvcr90.c | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c index 63a2254d187..5b6a1d08399 100644 --- a/dlls/msvcr90/tests/msvcr90.c +++ b/dlls/msvcr90/tests/msvcr90.c @@ -33,6 +33,33 @@ #include <errno.h> #include "wine/test.h" +#define WX_OPEN 0x01 +#define WX_ATEOF 0x02 +#define WX_READNL 0x04 +#define WX_PIPE 0x08 +#define WX_DONTINHERIT 0x10 +#define WX_APPEND 0x20 +#define WX_TTY 0x40 +#define WX_TEXT 0x80 + +#define MSVCRT_FD_BLOCK_SIZE 32 + +typedef struct { + HANDLE handle; + unsigned char wxflag; + char lookahead[3]; + int exflag; + CRITICAL_SECTION crit; + char textmode : 7; + char unicode : 1; + char pipech2[2]; + __int64 startpos; + BOOL utf8translations; + char dbcsBuffer; + BOOL dbcsBufferUsed; +} ioinfo; +static ioinfo **__pioinfo; + #define DEFINE_EXPECT(func) \ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE @@ -84,6 +111,9 @@ static int (__cdecl *p_controlfp_s)(unsigned int *, unsigned int, unsigned int); static int (__cdecl *p_tmpfile_s)(FILE**); static int (__cdecl *p_atoflt)(_CRT_FLOAT *, char *); static unsigned int (__cdecl *p_set_abort_behavior)(unsigned int, unsigned int); +static int (__cdecl *p__open)(const char *, int, ...); +static int (__cdecl *p__close)(int); +static intptr_t (__cdecl *p__get_osfhandle)(int); static int (__cdecl *p_sopen_s)(int*, const char*, int, int, int); static int (__cdecl *p_wsopen_s)(int*, const wchar_t*, int, int, int); static void* (__cdecl *p_realloc_crt)(void*, size_t); @@ -362,6 +392,7 @@ static BOOL init(void) ok(p_set_invalid_parameter_handler(test_invalid_parameter_handler) == NULL, "Invalid parameter handler was already set\n"); + SET(__pioinfo, "__pioinfo"); SET(p_initterm_e, "_initterm_e"); SET(p_encode_pointer, "_encode_pointer"); SET(p_decode_pointer, "_decode_pointer"); @@ -382,6 +413,9 @@ static BOOL init(void) SET(p_set_abort_behavior, "_set_abort_behavior"); SET(p_sopen_s, "_sopen_s"); SET(p_wsopen_s, "_wsopen_s"); + SET(p__open,"_open"); + SET(p__close,"_close"); + SET(p__get_osfhandle, "_get_osfhandle"); SET(p_realloc_crt, "_realloc_crt"); SET(p_malloc, "malloc"); SET(p_free, "free"); @@ -2350,6 +2384,63 @@ static void test__get_current_locale(void) p_setlocale(LC_ALL, "C"); } +static void test_ioinfo_flags(void) +{ + HANDLE handle; + ioinfo *info; + char *tempf; + int tempfd; + + tempf = _tempnam(".","wne"); + + tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_WTEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + handle = (HANDLE)p__get_osfhandle(tempfd); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->handle == handle, "Unexpected handle %p, expected %p.\n", info->handle, handle); + ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + ok(info->unicode, "Unicode is not set.\n"); + ok(info->textmode == 2, "Unexpected textmode %d.\n", info->textmode); + p__close(tempfd); + + ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle); + ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->unicode, "Unicode is not set.\n"); + ok(!info->wxflag, "Unexpected wxflag %#x.\n", info->wxflag); + ok(info->textmode == 2, "Unexpected textmode %d.\n", info->textmode); + + info = &__pioinfo[(tempfd + 4) / MSVCRT_FD_BLOCK_SIZE][(tempfd + 4) % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle); + ok(!info->exflag, "Unexpected exflag %#x.\n", info->exflag); + ok(!info->textmode, "Unexpected textmode %d.\n", info->textmode); + + tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_TEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + ok(!info->unicode, "Unicode is not set.\n"); + ok(!info->textmode, "Unexpected textmode %d.\n", info->textmode); + p__close(tempfd); + + tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_U8TEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + ok(!info->unicode, "Unicode is not set.\n"); + ok(info->textmode == 1, "Unexpected textmode %d.\n", info->textmode); + p__close(tempfd); + + unlink(tempf); + free(tempf); +} + START_TEST(msvcr90) { if(!init()) @@ -2391,4 +2482,5 @@ START_TEST(msvcr90) test_swscanf(); test____mb_cur_max_l_func(); test__get_current_locale(); + test_ioinfo_flags(); }
1
0
0
0
Paul Gofman : msvcrt: Use newer ioinfo structure for _MSVC_VER >= 80.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 1c9e9ec360cef5cc8c004a54a9fccc1eb201de12 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1c9e9ec360cef5cc8c004a54…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Apr 4 18:52:19 2022 +0300 msvcrt: Use newer ioinfo structure for _MSVC_VER >= 80. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcr80/tests/msvcr80.c | 18 +++--- dlls/msvcrt/file.c | 140 +++++++++++++++++++++++++++++++++---------- 2 files changed, 118 insertions(+), 40 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=1c9e9ec360cef5cc8c00…
1
0
0
0
Paul Gofman : msvcr80: Fix ioinfo structure definition.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 4c90f58bb5d8e85a973d8c38ae9590c3136b3549 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4c90f58bb5d8e85a973d8c38…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Apr 4 18:52:18 2022 +0300 msvcr80: Fix ioinfo structure definition. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 1 + configure.ac | 1 + dlls/msvcr80/tests/Makefile.in | 7 ++ dlls/msvcr80/tests/msvcr80.c | 148 ++++++++++++++++++++++++++++++++++++ dlls/msvcr80/tests/msvcr80.manifest | 22 ++++++ dlls/msvcr80/tests/msvcr80.rc | 22 ++++++ dlls/msvcrt/file.c | 6 +- 7 files changed, 203 insertions(+), 4 deletions(-) diff --git a/configure b/configure index ce248cc6e1d..53c5eb290c2 100755 --- a/configure +++ b/configure @@ -21550,6 +21550,7 @@ wine_fn_config_makefile dlls/msvcr120_app enable_msvcr120_app wine_fn_config_makefile dlls/msvcr70 enable_msvcr70 wine_fn_config_makefile dlls/msvcr71 enable_msvcr71 wine_fn_config_makefile dlls/msvcr80 enable_msvcr80 +wine_fn_config_makefile dlls/msvcr80/tests enable_tests wine_fn_config_makefile dlls/msvcr90 enable_msvcr90 wine_fn_config_makefile dlls/msvcr90/tests enable_tests wine_fn_config_makefile dlls/msvcrt enable_msvcrt diff --git a/configure.ac b/configure.ac index e509b232d11..6cbc0a61be1 100644 --- a/configure.ac +++ b/configure.ac @@ -2798,6 +2798,7 @@ WINE_CONFIG_MAKEFILE(dlls/msvcr120_app) WINE_CONFIG_MAKEFILE(dlls/msvcr70) WINE_CONFIG_MAKEFILE(dlls/msvcr71) WINE_CONFIG_MAKEFILE(dlls/msvcr80) +WINE_CONFIG_MAKEFILE(dlls/msvcr80/tests) WINE_CONFIG_MAKEFILE(dlls/msvcr90) WINE_CONFIG_MAKEFILE(dlls/msvcr90/tests) WINE_CONFIG_MAKEFILE(dlls/msvcrt) diff --git a/dlls/msvcr80/tests/Makefile.in b/dlls/msvcr80/tests/Makefile.in new file mode 100644 index 00000000000..1a17aea05ce --- /dev/null +++ b/dlls/msvcr80/tests/Makefile.in @@ -0,0 +1,7 @@ +TESTDLL = msvcr80.dll + +C_SRCS = \ + msvcr80.c + +RC_SRCS = \ + msvcr80.rc diff --git a/dlls/msvcr80/tests/msvcr80.c b/dlls/msvcr80/tests/msvcr80.c new file mode 100644 index 00000000000..a9c51654e5e --- /dev/null +++ b/dlls/msvcr80/tests/msvcr80.c @@ -0,0 +1,148 @@ +/* + * Copyright 2022 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#include <fcntl.h> +#include <share.h> +#include <sys/stat.h> + +#include <windef.h> +#include <winbase.h> +#include <errno.h> +#include "wine/test.h" + +#define WX_OPEN 0x01 +#define WX_ATEOF 0x02 +#define WX_READNL 0x04 +#define WX_PIPE 0x08 +#define WX_DONTINHERIT 0x10 +#define WX_APPEND 0x20 +#define WX_TTY 0x40 +#define WX_TEXT 0x80 + +#define MSVCRT_FD_BLOCK_SIZE 32 + +typedef struct +{ + HANDLE handle; + unsigned char wxflag; + char lookahead[3]; + int exflag; + CRITICAL_SECTION crit; + char textmode : 7; + char unicode : 1; + char pipech2[2]; + __int64 startpos; + BOOL utf8translations; + char dbcsBuffer; + BOOL dbcsBufferUsed; +} ioinfo; + +static ioinfo **__pioinfo; + +static int (__cdecl *p__open)(const char *, int, ...); +static int (__cdecl *p__close)(int); +static intptr_t (__cdecl *p__get_osfhandle)(int); + +#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hcrt,y) +#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0) +static BOOL init(void) +{ + HMODULE hcrt; + + SetLastError(0xdeadbeef); + hcrt = LoadLibraryA("msvcr80.dll"); + if (!hcrt) { + win_skip("msvcr80.dll not installed (got %ld)\n", GetLastError()); + return FALSE; + } + + SET(__pioinfo, "__pioinfo"); + SET(p__open,"_open"); + SET(p__close,"_close"); + SET(p__get_osfhandle, "_get_osfhandle"); + + return TRUE; +} + +static void test_ioinfo_flags(void) +{ + HANDLE handle; + ioinfo *info; + char *tempf; + int tempfd; + + tempf = _tempnam(".","wne"); + + tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_WTEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + handle = (HANDLE)p__get_osfhandle(tempfd); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->handle == handle, "Unexpected handle %p, expected %p.\n", info->handle, handle); + todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + todo_wine ok(info->unicode, "Unicode is not set.\n"); + todo_wine ok(info->textmode == 2, "Unexpected textmode %d.\n", info->textmode); + p__close(tempfd); + + ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle); + todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + todo_wine ok(info->unicode, "Unicode is not set.\n"); + ok(!info->wxflag, "Unexpected wxflag %#x.\n", info->wxflag); + todo_wine ok(info->textmode == 2, "Unexpected textmode %d.\n", info->textmode); + + info = &__pioinfo[(tempfd + 4) / MSVCRT_FD_BLOCK_SIZE][(tempfd + 4) % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle); + ok(!info->exflag, "Unexpected exflag %#x.\n", info->exflag); + ok(!info->textmode, "Unexpected textmode %d.\n", info->textmode); + + tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_TEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + ok(!info->unicode, "Unicode is not set.\n"); + ok(!info->textmode, "Unexpected textmode %d.\n", info->textmode); + p__close(tempfd); + + tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_U8TEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + ok(!info->unicode, "Unicode is not set.\n"); + todo_wine ok(info->textmode == 1, "Unexpected textmode %d.\n", info->textmode); + p__close(tempfd); + + unlink(tempf); + free(tempf); +} + +START_TEST(msvcr80) +{ + if(!init()) + return; + + test_ioinfo_flags(); +} diff --git a/dlls/msvcr80/tests/msvcr80.manifest b/dlls/msvcr80/tests/msvcr80.manifest new file mode 100644 index 00000000000..038788d4c4f --- /dev/null +++ b/dlls/msvcr80/tests/msvcr80.manifest @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity + type="win32" + name="Wine.msvcr80.Test" + version="1.0.0.0" + processorArchitecture="*" + /> +<description>Wine msvcr90 test suite</description> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="microsoft.vc80.crt" + version="8.0.50727.762" + processorArchitecture="*" + publicKeyToken="1fc8b3b9a1e18e3b" + language="*" + /> +</dependentAssembly> +</dependency> +</assembly> diff --git a/dlls/msvcr80/tests/msvcr80.rc b/dlls/msvcr80/tests/msvcr80.rc new file mode 100644 index 00000000000..69d3b1239b4 --- /dev/null +++ b/dlls/msvcr80/tests/msvcr80.rc @@ -0,0 +1,22 @@ +/* + * Copyright 2022 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "winuser.h" + +/* @makedep: msvcr80.manifest */ +1 RT_MANIFEST msvcr80.manifest diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 86c67868381..a9e532af3d2 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -113,8 +113,6 @@ typedef struct { char pipech2[2]; __int64 startpos; BOOL utf8translations; -#endif -#if _MSVCR_VER >= 90 char dbcsBuffer; BOOL dbcsBufferUsed; #endif @@ -3476,7 +3474,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count) char conv[sizeof(lfbuf)]; size_t len = 0; -#if _MSVCR_VER >= 90 +#if _MSVCR_VER >= 80 if (info->dbcsBufferUsed) { conv[j++] = info->dbcsBuffer; @@ -3495,7 +3493,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count) if (i == count) { -#if _MSVCR_VER >= 90 +#if _MSVCR_VER >= 80 info->dbcsBuffer = conv[j-1]; info->dbcsBufferUsed = TRUE; break;
1
0
0
0
Paul Gofman : msvcrt/tests: Add test for ioinfo->exflag.
by Alexandre Julliard
05 Apr '22
05 Apr '22
Module: wine Branch: master Commit: 2636c9e80e5987e8109d2d71bb536df7f8d14188 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2636c9e80e5987e8109d2d71…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Apr 4 18:52:17 2022 +0300 msvcrt/tests: Add test for ioinfo->exflag. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/tests/file.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index bc26f90643e..78ed8931d7a 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -37,6 +37,20 @@ #include <locale.h> #include <winternl.h> +#define WX_OPEN 0x01 +#define WX_ATEOF 0x02 +#define WX_READNL 0x04 +#define WX_PIPE 0x08 +#define WX_DONTINHERIT 0x10 +#define WX_APPEND 0x20 +#define WX_TTY 0x40 +#define WX_TEXT 0x80 + +#define EF_UTF8 0x01 +#define EF_UTF16 0x02 +#define EF_CRIT_INIT 0x04 +#define EF_UNK_UNICODE 0x08 + #define MSVCRT_FD_BLOCK_SIZE 32 typedef struct { HANDLE handle; @@ -2851,6 +2865,40 @@ static void test_open_hints(void) unlink(tempfile); } +static void test_ioinfo_flags(void) +{ + HANDLE handle; + ioinfo *info; + char *tempf; + int tempfd; + + tempf = _tempnam(".","wne"); + + tempfd = _open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_WTEXT, _S_IWRITE); + ok(tempfd != -1, "_open failed with error: %d\n", errno); + + handle = (HANDLE)_get_osfhandle(tempfd); + info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->handle == handle, "Unexpected handle %p, expected %p.\n", info->handle, handle); + ok(info->exflag == (EF_UTF16 | EF_CRIT_INIT | EF_UNK_UNICODE), "Unexpected exflag %#x.\n", info->exflag); + ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag); + + close(tempfd); + + ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle); + ok(info->exflag == (EF_UTF16 | EF_CRIT_INIT | EF_UNK_UNICODE), "Unexpected exflag %#x.\n", info->exflag); + ok(!info->wxflag, "Unexpected wxflag %#x.\n", info->wxflag); + + info = &__pioinfo[(tempfd + 4) / MSVCRT_FD_BLOCK_SIZE][(tempfd + 4) % MSVCRT_FD_BLOCK_SIZE]; + ok(!!info, "NULL info.\n"); + ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle); + ok(!info->exflag, "Unexpected exflag %#x.\n", info->exflag); + + unlink(tempf); + free(tempf); +} + START_TEST(file) { int arg_c; @@ -2925,6 +2973,7 @@ START_TEST(file) test_lseek(); test_fopen_hints(); test_open_hints(); + test_ioinfo_flags(); /* Wait for the (_P_NOWAIT) spawned processes to finish to make sure the report * file contains lines in the correct order
1
0
0
0
← Newer
1
...
89
90
91
92
93
94
95
...
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200