ReactOS.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
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
List overview
Download
Ros-diffs
January 2024
----- 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
ros-diffs@reactos.org
17 participants
181 discussions
Start a n
N
ew thread
[reactos] 01/03: [TCPIP] Get max link speed, MTU and max packet size when adapter is connected
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3e3d34d97b7b687bac71d…
commit 3e3d34d97b7b687bac71d48269e7279d5ea0a6de Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Wed Dec 13 19:54:50 2023 +0100 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sat Jan 13 15:23:46 2024 +0100 [TCPIP] Get max link speed, MTU and max packet size when adapter is connected --- drivers/network/tcpip/datalink/lan.c | 71 ++++++++++++++++-------------------- drivers/network/tcpip/include/lan.h | 2 +- 2 files changed, 33 insertions(+), 40 deletions(-) diff --git a/drivers/network/tcpip/datalink/lan.c b/drivers/network/tcpip/datalink/lan.c index 0440c098f49..ccd0f555ef5 100644 --- a/drivers/network/tcpip/datalink/lan.c +++ b/drivers/network/tcpip/datalink/lan.c @@ -718,7 +718,7 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context) { PLAN_ADAPTER Adapter = Context->Adapter; PIP_INTERFACE Interface = Adapter->Context; - //NDIS_STATUS NdisStatus; + NDIS_STATUS NdisStatus; IP_ADDRESS DefaultMask; /* Initialize the default unspecified address (0.0.0.0) */ @@ -754,47 +754,40 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context) TCPUpdateInterfaceIPInformation(Interface); TCPUpdateInterfaceLinkStatus(Interface); - /* We're done here if the adapter isn't connected */ - if (Context->State != LAN_STATE_STARTED) + if (Context->State == LAN_STATE_STARTED) { - Adapter->State = Context->State; - return TRUE; - } - - /* NDIS Bug! */ -#if 0 - /* Get maximum link speed */ - NdisStatus = NDISCall(Adapter, - NdisRequestQueryInformation, - OID_GEN_LINK_SPEED, - &Interface->Speed, - sizeof(UINT)); - - if (!NT_SUCCESS(NdisStatus)) - Interface->Speed = IP_DEFAULT_LINK_SPEED; - - Adapter->Speed = Interface->Speed * 100L; - - /* Get maximum frame size */ - NdisStatus = NDISCall(Adapter, - NdisRequestQueryInformation, - OID_GEN_MAXIMUM_FRAME_SIZE, - &Adapter->MTU, - sizeof(UINT)); - if (NdisStatus != NDIS_STATUS_SUCCESS) - return FALSE; + /* Get maximum link speed */ + NdisStatus = NDISCall(Adapter, + NdisRequestQueryInformation, + OID_GEN_LINK_SPEED, + &Interface->Speed, + sizeof(Interface->Speed)); + + if (!NT_SUCCESS(NdisStatus)) + Interface->Speed = IP_DEFAULT_LINK_SPEED; + + Adapter->Speed = Interface->Speed * 100L; + + /* Get maximum frame size */ + NdisStatus = NDISCall(Adapter, + NdisRequestQueryInformation, + OID_GEN_MAXIMUM_FRAME_SIZE, + &Adapter->MTU, + sizeof(Adapter->MTU)); + if (NdisStatus != NDIS_STATUS_SUCCESS) + return FALSE; - Interface->MTU = Adapter->MTU; + Interface->MTU = Adapter->MTU; - /* Get maximum packet size */ - NdisStatus = NDISCall(Adapter, - NdisRequestQueryInformation, - OID_GEN_MAXIMUM_TOTAL_SIZE, - &Adapter->MaxPacketSize, - sizeof(UINT)); - if (NdisStatus != NDIS_STATUS_SUCCESS) - return FALSE; -#endif + /* Get maximum packet size */ + NdisStatus = NDISCall(Adapter, + NdisRequestQueryInformation, + OID_GEN_MAXIMUM_TOTAL_SIZE, + &Adapter->MaxPacketSize, + sizeof(Adapter->MaxPacketSize)); + if (NdisStatus != NDIS_STATUS_SUCCESS) + return FALSE; + } Adapter->State = Context->State; diff --git a/drivers/network/tcpip/include/lan.h b/drivers/network/tcpip/include/lan.h index ab8f4bc5ba6..f99f588188e 100644 --- a/drivers/network/tcpip/include/lan.h +++ b/drivers/network/tcpip/include/lan.h @@ -52,7 +52,7 @@ typedef struct LAN_ADAPTER { UCHAR BCastCheck; /* Value to check against */ UCHAR BCastOffset; /* Offset in frame to check against */ UCHAR HeaderSize; /* Size of link-level header */ - USHORT MTU; /* Maximum Transfer Unit */ + UINT MTU; /* Maximum Transfer Unit */ UINT MinFrameSize; /* Minimum frame size in bytes */ UINT MaxPacketSize; /* Maximum packet size when sending */ UINT MaxSendPackets; /* Maximum number of packets per send */
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [CRT_APITEST] Fix some Vista+ tests
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4c9037fff1d9ced4e5996…
commit 4c9037fff1d9ced4e59962aef5860bd1ddfe9f62 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Thu Oct 5 09:43:25 2023 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sat Jan 13 15:15:47 2024 +0200 [CRT_APITEST] Fix some Vista+ tests --- modules/rostests/apitests/crt/crtdata.c | 157 ++++++++++++++++++++++---------- 1 file changed, 111 insertions(+), 46 deletions(-) diff --git a/modules/rostests/apitests/crt/crtdata.c b/modules/rostests/apitests/crt/crtdata.c index baf73a2f278..c5606ce56fb 100644 --- a/modules/rostests/apitests/crt/crtdata.c +++ b/modules/rostests/apitests/crt/crtdata.c @@ -24,6 +24,20 @@ int IsLocalSymbol(void* Address) return ((Address >= (void*)&__ImageBase) && (Address <= s_ImageEnd)); } +// Dynamically imported functions (Vista+) +int* (__cdecl *p__daylight)(void); +long* (__cdecl *p__dstbias)(void); +errno_t (__cdecl *p_get_fmode)(int* _PMode); +errno_t (__cdecl *p_get_osplatform)(unsigned int *pValue); +int (__cdecl *p_get_pgmptr)(char** p); +errno_t (__cdecl *p_get_wpgmptr)(_Outptr_result_z_ wchar_t **_Value); +errno_t (__cdecl *p_get_winver)(_Out_ unsigned int *_Value); +errno_t (__cdecl *p_get_winmajor)(_Out_ unsigned int *_Value); +errno_t (__cdecl *p_get_winminor)(_Out_ unsigned int *_Value); +errno_t (__cdecl *p_get_environ)(_Out_ char***); +errno_t (__cdecl *p_get_wenviron)(_Out_ wchar_t***); + + #ifndef TEST_STATIC #define test_is_local_symbol(addr, is) ok_int(IsLocalSymbol(addr), (is)) #else @@ -293,10 +307,10 @@ void Test__daylight(void) _CRTIMP void* __p__daylight(void); ok_ptr(__p__daylight(), &_daylight); #endif -#if (WINVER >= 0x600) - _CRTIMP int* __cdecl __daylight(void); - ok_ptr(&__daylight, &_daylight); -#endif + if (p__daylight != NULL) + { + ok_ptr(p__daylight(), &_daylight); + } } #ifndef _M_ARM @@ -312,10 +326,10 @@ void Test__dstbias(void) _CRTIMP long* __cdecl __p__dstbias(void); ok_ptr(__p__dstbias(), &_dstbias); #endif -#if (WINVER >= 0x600) - _CRTIMP long* __cdecl __dstbias(void); - ok_ptr(&__dstbias, &_dstbias); -#endif + if (p__dstbias != NULL) + { + ok_ptr(p__dstbias(), &_dstbias); + } } void Test__environ(void) @@ -329,6 +343,12 @@ void Test__environ(void) #ifdef _M_IX86 ok_ptr(__p__environ(), &_environ); #endif + if (p_get_environ != NULL) + { + char** result_environ; + ok_int(p_get_environ(&result_environ), 0); + ok_ptr(result_environ, _environ); + } } void Test__fileinfo(void) @@ -358,14 +378,15 @@ void Test__fmode(void) ok_ptr(__p__fmode(), p); #endif -#if (_WIN32_WINNT >= 0x600) - _fmode = 1234; - _CRTIMP errno_t __cdecl _get_fmode(_Out_ int* _PMode); - int mode; - ok_int(_get_fmode(&mode), 0); - ok_int(mode, _fmode); - _fmode = 0; -#endif + if (p_get_fmode != NULL) + { + _fmode = 1234; + + int mode; + ok_int(p_get_fmode(&mode), 0); + ok_int(mode, _fmode); + _fmode = 0; + } } void Test__iob(void) @@ -420,10 +441,12 @@ void Test__mbctype(void) void Test__osplatform(void) { ok_int(_osplatform, s_osvi.dwPlatformId); -#if (WINVER >= 0x600) - _CRTIMP unsigned int __cdecl _get_osplatform(void); - ok_ptr(_get_osplatform(), _osplatform); -#endif + if (p_get_osplatform != NULL) + { + unsigned int result_osplatform; + ok_int(p_get_osplatform(&result_osplatform), 0); + ok_int(result_osplatform, _osplatform); + } } #endif @@ -448,10 +471,12 @@ void Test__pgmptr(void) #ifdef _M_IX86 ok_ptr(__p__pgmptr(), &_pgmptr); #endif -#if (WINVER >= 0x600) - _CRTIMP char* __cdecl _get_pgmptr(void); - ok_ptr(_get_pgmptr(), _pgmptr); -#endif + if (p_get_pgmptr != NULL) + { + char *result_pgmptr; + ok_int(p_get_pgmptr(&result_pgmptr), 0); + ok_ptr(result_pgmptr, _pgmptr); + } } void Test__sys_errlist(void) @@ -505,10 +530,6 @@ void Test__tzname(void) _CRTIMP char** __p__tzname(); ok_ptr(__p__tzname(), &_tzname); #endif -#if (WINVER >= 0x600) - _CRTIMP char* __cdecl __tzname(void); - ok_ptr(__tzname(), _wenviron); -#endif } void Test__wcmdln(void) @@ -532,9 +553,14 @@ void Test__wenviron(void) #ifdef _M_IX86 ok_ptr(__p__wenviron(), &_wenviron); #endif -#if (WINVER >= 0x600) - _CRTIMP unsigned int __cdecl _get_wenviron(void); - ok_int(_get_wenviron(), _wenviron); + +#if 0 // FIXME: This returns an error / NULL on Windows 10 + if (p_get_wenviron != NULL) + { + wchar_t** result_wenviron; + ok_int(p_get_wenviron(&result_wenviron), 0); + ok_ptr(result_wenviron, _wenviron); + } #endif } #endif @@ -546,10 +572,12 @@ void Test__winmajor(void) _CRTIMP unsigned int* __cdecl __p__winmajor(); ok_ptr(__p__winmajor(), &_winmajor); #endif -#if (WINVER >= 0x600) - _CRTIMP unsigned int __cdecl _get_winmajor(void); - ok_int(_get_winmajor(), _winmajor); -#endif + if (p_get_winmajor != NULL) + { + unsigned int result_winmajor; + ok_int(p_get_winmajor(&result_winmajor), 0); + ok_int(result_winmajor, _winmajor); + } } void Test__winminor(void) @@ -559,10 +587,12 @@ void Test__winminor(void) _CRTIMP unsigned int* __cdecl __p__winminor(); ok_ptr(__p__winminor(), &_winminor); #endif -#if (WINVER >= 0x600) - _CRTIMP unsigned int __cdecl _get_winminor(void); - ok_int(_get_winminor(), _winminor); -#endif + if (p_get_winminor != NULL) + { + unsigned int result_winminor; + ok_int(p_get_winminor(&result_winminor), 0); + ok_int(result_winminor, _winminor); + } } #ifndef _M_ARM @@ -573,10 +603,12 @@ void Test__winver(void) _CRTIMP unsigned int* __cdecl __p__winver(); ok_ptr(__p__winver(), &_winver); #endif -#if (WINVER >= 0x600) - _CRTIMP unsigned int __cdecl _get_winver(void); - ok_int(_get_winver(), _winver); -#endif + if (p_get_winver != NULL) + { + unsigned int result_winver; + ok_int(p_get_winver(&result_winver), 0); + ok_int(result_winver, _winver); + } } #endif @@ -592,9 +624,14 @@ void Test__wpgmptr(void) _CRTIMP wchar_t ** __cdecl __p__wpgmptr(); ok_ptr(__p__wpgmptr(), &_wpgmptr); #endif -#if (WINVER >= 0x600) - _CRTIMP unsigned int __cdecl _get_wpgmptr(void); - ok_int(_get_wpgmptr(), _wpgmptr); + +#if 0 // FIXME: This returns an error on Windows 10 + if (p_get_wpgmptr != NULL) + { + wchar_t* result_wpgmptr; + ok_int(p_get_wpgmptr(&result_wpgmptr), 0); + ok_ptr(result_wpgmptr, _wpgmptr); + } #endif } @@ -609,6 +646,34 @@ START_TEST(crtdata) s_osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&s_osvi); + HMODULE hmsvcrt = GetModuleHandleA("msvcrt.dll"); + p__daylight = (void*)GetProcAddress(hmsvcrt, "__daylight"); + p__dstbias = (void*)GetProcAddress(hmsvcrt, "__dstbias"); + p_get_fmode = (void*)GetProcAddress(hmsvcrt, "_get_fmode"); + p_get_osplatform = (void*)GetProcAddress(hmsvcrt, "_get_osplatform"); + p_get_pgmptr = (void*)GetProcAddress(hmsvcrt, "_get_pgmptr"); + p_get_wpgmptr = (void*)GetProcAddress(hmsvcrt, "_get_wpgmptr"); + p_get_winver = (void*)GetProcAddress(hmsvcrt, "_get_winver"); + p_get_winmajor = (void*)GetProcAddress(hmsvcrt, "_get_winmajor"); + p_get_winminor = (void*)GetProcAddress(hmsvcrt, "_get_winminor"); + p_get_environ = (void*)GetProcAddress(hmsvcrt, "_get_environ"); + p_get_wenviron = (void*)GetProcAddress(hmsvcrt, "_get_wenviron"); + + if (s_osvi.dwMajorVersion >= 6) + { + ok(p__daylight != NULL, "__daylight is NULL\n"); + ok(p__dstbias != NULL, "__dstbias is NULL\n"); + ok(p_get_fmode != NULL, "_get_fmode is NULL\n"); + ok(p_get_osplatform != NULL, "_get_osplatform is NULL\n"); + ok(p_get_pgmptr != NULL, "_get_pgmptr is NULL\n"); + ok(p_get_wpgmptr != NULL, "_get_wpgmptr is NULL\n"); + ok(p_get_winver != NULL, "_get_winver is NULL\n"); + ok(p_get_winmajor != NULL, "_get_winmajor is NULL\n"); + ok(p_get_winminor != NULL, "_get_winminor is NULL\n"); + ok(p_get_environ != NULL, "_get_environ is NULL\n"); + ok(p_get_wenviron != NULL, "_get_wenviron is NULL\n"); + } + Test___argc(); Test___argv(); Test___badioinfo();
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [SDK] cicuif.h: Add CUIFToolbarButton (#6338)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6b5c19233510533f5d40…
commit d6b5c19233510533f5d40fe9ade33094fa37f0ad Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Jan 13 18:21:03 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Jan 13 18:21:03 2024 +0900 [SDK] cicuif.h: Add CUIFToolbarButton (#6338) Supporting TIPs... JIRA issue: CORE-19360 - Add CUIFToolbarButton class. --- sdk/include/reactos/cicero/cicuif.h | 187 +++++++++++++++++++++++++++++++++++- 1 file changed, 183 insertions(+), 4 deletions(-) diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 27111958d69..c3f5df67245 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -714,6 +714,7 @@ protected: BOOL m_bPressed; SIZE m_IconSize; SIZE m_TextSize; + friend class CUIFToolbarButton; void DrawBitmapProc(HDC hDC, LPCRECT prc, BOOL bPressed); void DrawEdgeProc(HDC hDC, LPCRECT prc, BOOL bPressed); @@ -785,15 +786,36 @@ public: ///////////////////////////////////////////////////////////////////////////// -// FIXME class CUIFToolbarButton : public CUIFObject { public: CUIFToolbarButtonElement *m_pToolbarButtonElement; CUIFToolbarMenuButton *m_pToolbarMenuButton; - DWORD m_dwButtonFlags; + DWORD m_dwToolbarButtonFlags; LPCWSTR m_pszUnknownText; + CUIFToolbarButton( + CUIFObject *pParent, + DWORD dwUnknown3, + LPCRECT prc, + DWORD style, + DWORD dwToolbarButtonFlags, + LPCWSTR pszUnknownText); + ~CUIFToolbarButton() override { } + + BOOL Init(); + HICON GetIcon(); + void SetIcon(HICON hIcon); + + STDMETHOD_(void, ClearWndObj)() override; + STDMETHOD_(void, DetachWndObj)() override; + STDMETHOD_(void, Enable)(BOOL bEnable) override; + STDMETHOD_(LPCWSTR, GetToolTip)() override; + STDMETHOD_(void, SetActiveTheme)(LPCWSTR pszClassList, INT iPartId, INT iStateId) override; + STDMETHOD_(void, SetFont)(HFONT hFont) override; + STDMETHOD_(void, SetRect)(LPCRECT prc) override; + STDMETHOD_(void, SetToolTip)(LPCWSTR pszToolTip) override; + STDMETHOD_(void, OnUnknownMouse0)() { } STDMETHOD_(void, OnUnknownMouse1)(LONG x, LONG y) { } STDMETHOD_(void, OnUnknownMouse2)(LONG x, LONG y) { } @@ -4337,7 +4359,7 @@ inline STDMETHODIMP_(void) CUIFToolbarButtonElement::OnLButtonUp(LONG x, LONG y) { CUIFButton::OnLButtonUp(x, y); - if ((m_pToolbarButton->m_dwButtonFlags & 0x30000) == 0x20000) + if ((m_pToolbarButton->m_dwToolbarButtonFlags & 0x30000) == 0x20000) m_pToolbarButton->OnUnknownMouse2(x, y); else m_pToolbarButton->OnUnknownMouse1(x, y); @@ -4346,6 +4368,163 @@ CUIFToolbarButtonElement::OnLButtonUp(LONG x, LONG y) inline STDMETHODIMP_(void) CUIFToolbarButtonElement::OnRButtonUp(LONG x, LONG y) { - if ((m_pToolbarButton->m_dwButtonFlags & 0x30000) != 0x20000) + if ((m_pToolbarButton->m_dwToolbarButtonFlags & 0x30000) != 0x20000) m_pToolbarButton->OnUnknownMouse0(); } + +///////////////////////////////////////////////////////////////////////////// + +inline CUIFToolbarButton::CUIFToolbarButton( + CUIFObject *pParent, + DWORD dwUnknown3, + LPCRECT prc, + DWORD style, + DWORD dwToolbarButtonFlags, + LPCWSTR pszUnknownText) : CUIFObject(pParent, dwUnknown3, prc, style) +{ + m_dwToolbarButtonFlags = dwToolbarButtonFlags; + m_pszUnknownText = pszUnknownText; +} + +inline BOOL CUIFToolbarButton::Init() +{ + RECT rc1, rc2; + rc1 = rc2 = m_rc; + + if ((m_dwToolbarButtonFlags & 0x30000) == 0x30000) + { + rc1.right -= 12; + rc2.left = rc1.right + 1; + } + + DWORD style = UIF_BUTTON_LARGE_ICON | UIF_BUTTON_V_ALIGN_MIDDLE | UIF_BUTTON_H_ALIGN_CENTER; + if (m_dwToolbarButtonFlags & 0x2000) + style |= 0x10; + if (m_dwToolbarButtonFlags & 0x80000) + style |= UIF_BUTTON_VERTICAL; + m_pToolbarButtonElement = new(cicNoThrow) CUIFToolbarButtonElement(this, m_dwUnknown3, &rc1, style); + if (!m_pToolbarButtonElement) + return FALSE; + + m_pToolbarButtonElement->Initialize(); + AddUIObj(m_pToolbarButtonElement); + + if (!m_bEnable) + m_pToolbarButtonElement->Enable(FALSE); + + if ((m_dwToolbarButtonFlags & 0x30000) == 0x30000) + { + style = UIF_BUTTON_LARGE_ICON | UIF_BUTTON_H_ALIGN_CENTER; + if (m_dwToolbarButtonFlags & 0x80000) + style |= UIF_BUTTON_VERTICAL; + + m_pToolbarMenuButton = new(cicNoThrow) CUIFToolbarMenuButton(this, 0, &rc2, style); + if (!m_pToolbarMenuButton) + return FALSE; + + m_pToolbarMenuButton->Initialize(); + AddUIObj(m_pToolbarMenuButton); + + if (!m_bEnable) + m_pToolbarMenuButton->Enable(FALSE); + } + + return TRUE; +} + +inline HICON CUIFToolbarButton::GetIcon() +{ + return m_pToolbarButtonElement->m_ButtonIcon.m_hIcon; +} + +inline void CUIFToolbarButton::SetIcon(HICON hIcon) +{ + m_pToolbarButtonElement->SetIcon(hIcon); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::ClearWndObj() +{ + if (m_pToolbarButtonElement) + m_pToolbarButtonElement->ClearWndObj(); + if (m_pToolbarMenuButton) + m_pToolbarMenuButton->ClearWndObj(); + + CUIFObject::ClearWndObj(); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::DetachWndObj() +{ + if (m_pToolbarButtonElement) + m_pToolbarButtonElement->DetachWndObj(); + if (m_pToolbarMenuButton) + m_pToolbarMenuButton->DetachWndObj(); + + CUIFObject::DetachWndObj(); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::Enable(BOOL bEnable) +{ + CUIFObject::Enable(bEnable); + if (m_pToolbarButtonElement) + m_pToolbarButtonElement->Enable(bEnable); + if (m_pToolbarMenuButton) + m_pToolbarMenuButton->Enable(bEnable); +} + +inline STDMETHODIMP_(LPCWSTR) +CUIFToolbarButton::GetToolTip() +{ + return CUIFObject::GetToolTip(); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::SetActiveTheme(LPCWSTR pszClassList, INT iPartId, INT iStateId) +{ + if (m_pToolbarButtonElement) + m_pToolbarButtonElement->SetActiveTheme(pszClassList, iPartId, iStateId); + if (m_pToolbarMenuButton) + m_pToolbarMenuButton->SetActiveTheme(pszClassList, iPartId, iStateId); + + m_pszClassList = pszClassList; + m_iPartId = iPartId; + m_iStateId = iStateId; +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::SetFont(HFONT hFont) +{ + m_pToolbarButtonElement->SetFont(hFont); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::SetRect(LPCRECT prc) +{ + CUIFObject::SetRect(prc); + + RECT rc1, rc2; + rc1 = rc2 = m_rc; + + if ((m_dwToolbarButtonFlags & 0x30000) == 0x30000) + { + rc1.right -= 12; + rc2.left = rc1.right + 1; + } + + if (m_pToolbarButtonElement) + m_pToolbarButtonElement->SetRect(&rc1); + if (m_pToolbarMenuButton) + m_pToolbarMenuButton->SetRect(&rc2); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButton::SetToolTip(LPCWSTR pszToolTip) +{ + CUIFObject::SetToolTip(pszToolTip); + if (m_pToolbarButtonElement) + m_pToolbarButtonElement->SetToolTip(pszToolTip); + if (m_pToolbarMenuButton) + m_pToolbarMenuButton->SetToolTip(pszToolTip); +}
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [SDK] cicuif.h: Add CUIFToolbarMenuButton (#6336)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fa2715fb6bc99a90821a6…
commit fa2715fb6bc99a90821a609d95031d9cb2455954 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Jan 13 16:02:36 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Jan 13 16:02:36 2024 +0900 [SDK] cicuif.h: Add CUIFToolbarMenuButton (#6336) Supporting TIPs... JIRA issue: CORE-19360 - Add CUIFToolbarMenuButton class. - Add CUIFToolbarButtonElement class. --- sdk/include/reactos/cicero/cicuif.h | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 23f0bac68e8..27111958d69 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -23,8 +23,11 @@ class CUIFTheme; class CUIFWindow; class CUIFToolTip; class CUIFShadow; + class CUIFToolbarButton; class CUIFButton; class CUIFButton2; + class CUIFToolbarMenuButton; + class CUIFToolbarButtonElement; class CUIFGripper; class CUIFObjectArray; class CUIFColorTable; @@ -754,6 +757,50 @@ public: ///////////////////////////////////////////////////////////////////////////// +class CUIFToolbarMenuButton : public CUIFButton2 +{ +public: + CUIFToolbarButton *m_pToolbarButton; + + CUIFToolbarMenuButton(CUIFToolbarButton *pParent, DWORD dwUnknown3, LPCRECT prc, DWORD style); + ~CUIFToolbarMenuButton() override; + + STDMETHOD_(void, OnLButtonUp)(LONG x, LONG y) override; + STDMETHOD_(BOOL, OnSetCursor)(UINT uMsg, LONG x, LONG y) override; +}; + +///////////////////////////////////////////////////////////////////////////// + +class CUIFToolbarButtonElement : public CUIFButton2 +{ +public: + CUIFToolbarButton *m_pToolbarButton; + + CUIFToolbarButtonElement(CUIFToolbarButton *pParent, DWORD dwUnknown3, LPCRECT prc, DWORD style); + + STDMETHOD_(LPCWSTR, GetToolTip)() override; + STDMETHOD_(void, OnLButtonUp)(LONG x, LONG y) override; + STDMETHOD_(void, OnRButtonUp)(LONG x, LONG y) override; +}; + +///////////////////////////////////////////////////////////////////////////// + +// FIXME +class CUIFToolbarButton : public CUIFObject +{ +public: + CUIFToolbarButtonElement *m_pToolbarButtonElement; + CUIFToolbarMenuButton *m_pToolbarMenuButton; + DWORD m_dwButtonFlags; + LPCWSTR m_pszUnknownText; + + STDMETHOD_(void, OnUnknownMouse0)() { } + STDMETHOD_(void, OnUnknownMouse1)(LONG x, LONG y) { } + STDMETHOD_(void, OnUnknownMouse2)(LONG x, LONG y) { } +}; + +///////////////////////////////////////////////////////////////////////////// + // m_style flags for CUIFGripper enum { @@ -4226,3 +4273,79 @@ CUIFGripper::SetStyle(DWORD style) else SetActiveTheme(L"REBAR", RP_GRIPPER, 0); } + +///////////////////////////////////////////////////////////////////////////// + +inline +CUIFToolbarMenuButton::CUIFToolbarMenuButton( + CUIFToolbarButton *pParent, + DWORD dwUnknown3, + LPCRECT prc, + DWORD style) : CUIFButton2(pParent, dwUnknown3, prc, style) +{ + m_pToolbarButton = pParent; + + HFONT hFont = ::CreateFont(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SYMBOL_CHARSET, + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, + DEFAULT_PITCH | FF_DONTCARE, TEXT("Marlett")); + SetFont(hFont); + SetText(L"u"); +} + +inline +CUIFToolbarMenuButton::~CUIFToolbarMenuButton() +{ + ::DeleteObject(m_hFont); + SetFont(NULL); +} + +inline STDMETHODIMP_(void) +CUIFToolbarMenuButton::OnLButtonUp(LONG x, LONG y) +{ + CUIFButton::OnLButtonUp(x, y); + m_pToolbarButton->OnUnknownMouse2(x, y); +} + +inline STDMETHODIMP_(BOOL) +CUIFToolbarMenuButton::OnSetCursor(UINT uMsg, LONG x, LONG y) +{ + m_pToolbarButton->OnSetCursor(uMsg, x, y); + return FALSE; +} + +///////////////////////////////////////////////////////////////////////////// + +inline +CUIFToolbarButtonElement::CUIFToolbarButtonElement( + CUIFToolbarButton *pParent, + DWORD dwUnknown3, + LPCRECT prc, + DWORD style) : CUIFButton2(pParent, dwUnknown3, prc, style) +{ + m_pToolbarButton = pParent; +} + +inline STDMETHODIMP_(LPCWSTR) +CUIFToolbarButtonElement::GetToolTip() +{ + if (m_pToolbarButton) + return m_pToolbarButton->GetToolTip(); + return NULL; +} + +inline STDMETHODIMP_(void) +CUIFToolbarButtonElement::OnLButtonUp(LONG x, LONG y) +{ + CUIFButton::OnLButtonUp(x, y); + if ((m_pToolbarButton->m_dwButtonFlags & 0x30000) == 0x20000) + m_pToolbarButton->OnUnknownMouse2(x, y); + else + m_pToolbarButton->OnUnknownMouse1(x, y); +} + +inline STDMETHODIMP_(void) +CUIFToolbarButtonElement::OnRButtonUp(LONG x, LONG y) +{ + if ((m_pToolbarButton->m_dwButtonFlags & 0x30000) != 0x20000) + m_pToolbarButton->OnUnknownMouse0(); +}
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [CRTDLL_APITEST] Oops. Fix that other compiler. CORE-16933
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=286d460b45b7d9fcacc41…
commit 286d460b45b7d9fcacc4125d1ba3a4daf411b543 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Fri Jan 12 12:58:27 2024 -0500 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Fri Jan 12 12:58:27 2024 -0500 [CRTDLL_APITEST] Oops. Fix that other compiler. CORE-16933 --- modules/rostests/apitests/crt/_mbsncmp.c | 20 ++++++------- modules/rostests/apitests/crt/_mbsstr.c | 48 ++++++++++++++++---------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/rostests/apitests/crt/_mbsncmp.c b/modules/rostests/apitests/crt/_mbsncmp.c index 7aa099cde3c..836f19afd85 100644 --- a/modules/rostests/apitests/crt/_mbsncmp.c +++ b/modules/rostests/apitests/crt/_mbsncmp.c @@ -33,38 +33,38 @@ START_TEST(_mbsncmp) ret = _mbsncmp(NULL, NULL, 0); ok(ret == 0, "ret = %d\n", ret); - ret = _mbsncmp("a", "c", 0); + ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"c", 0); ok(ret == 0, "ret = %d\n", ret); /* No null checks - length 1 crashes */ StartSeh() - (void)_mbsncmp("a", NULL, 1); + (void)_mbsncmp((const unsigned char *)"a", NULL, 1); EndSeh(STATUS_ACCESS_VIOLATION); StartSeh() - (void)_mbsncmp(NULL, "c", 1); + (void)_mbsncmp(NULL, (const unsigned char *)"c", 1); EndSeh(STATUS_ACCESS_VIOLATION); /* Strings longer than or equal to length */ - ret = _mbsncmp("a", "c", 1); + ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"c", 1); ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret); - ret = _mbsncmp("a", "a", 1); + ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"a", 1); ok(ret == 0, "ret = %d\n", ret); - ret = _mbsncmp("ab", "aB", 1); + ret = _mbsncmp((const unsigned char *)"ab", (const unsigned char *)"aB", 1); ok(ret == 0, "ret = %d\n", ret); - ret = _mbsncmp("aa", "ac", 2); + ret = _mbsncmp((const unsigned char *)"aa", (const unsigned char *)"ac", 2); ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret); /* Length longer than one of the strings */ - ret = _mbsncmp("a", "ac", 2); + ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"ac", 2); ok(ret == DIFF_RETURN(-, 'c'), "ret = %d\n", ret); - ret = _mbsncmp("aa", "a", 2); + ret = _mbsncmp((const unsigned char *)"aa", (const unsigned char *)"a", 2); ok(ret == DIFF_RETURN(+, 'a'), "ret = %d\n", ret); - ret = _mbsncmp("ab", "ab", 100); + ret = _mbsncmp((const unsigned char *)"ab", (const unsigned char *)"ab", 100); ok(ret == 0, "ret = %d\n", ret); } diff --git a/modules/rostests/apitests/crt/_mbsstr.c b/modules/rostests/apitests/crt/_mbsstr.c index fc926c1cee8..d06d6184ec4 100644 --- a/modules/rostests/apitests/crt/_mbsstr.c +++ b/modules/rostests/apitests/crt/_mbsstr.c @@ -22,27 +22,27 @@ START_TEST(_mbsstr) EndSeh(STATUS_ACCESS_VIOLATION); StartSeh() - haystack = "hello"; + haystack = (unsigned char *)"hello"; (void)_mbsstr(haystack, NULL); EndSeh(STATUS_ACCESS_VIOLATION); StartSeh() - haystack = ""; + haystack = (unsigned char *)""; (void)_mbsstr(haystack, NULL); EndSeh(STATUS_ACCESS_VIOLATION); /* Empty needle returns haystack, empty haystack returns NULL... */ - haystack = "hello"; - ret = _mbsstr(haystack, ""); + haystack = (unsigned char *)"hello"; + ret = _mbsstr(haystack, (const unsigned char *)""); ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); - haystack = ""; - ret = _mbsstr(haystack, "a"); + haystack = (unsigned char *)""; + ret = _mbsstr(haystack, (const unsigned char *)"a"); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); /* ... but if both are empty, behavior differs */ - haystack = ""; - ret = _mbsstr(haystack, ""); + haystack = (unsigned char *)""; + ret = _mbsstr(haystack, (const unsigned char *)""); #ifdef TEST_CRTDLL ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); #else @@ -50,38 +50,38 @@ START_TEST(_mbsstr) #endif /* Simple "found" cases */ - haystack = "abcdefg"; - ret = _mbsstr(haystack, "abc"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"abc"); ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); - haystack = "abcdefg"; - ret = _mbsstr(haystack, "g"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"g"); ok(ret == haystack + 6, "ret = %p, haystack = %p\n", ret, haystack); - haystack = "abcdefg"; - ret = _mbsstr(haystack, "abcdefg"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"abcdefg"); ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); /* Simple "not found" cases */ - haystack = "abcdefg"; - ret = _mbsstr(haystack, "h"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"h"); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); - haystack = "abcdefg"; - ret = _mbsstr(haystack, "gh"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"gh"); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); - haystack = "abcdefg"; - ret = _mbsstr(haystack, "abcD"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"abcD"); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); /* Needle longer than haystack */ - haystack = "abcdefg"; - ret = _mbsstr(haystack, "abcdefgh"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"abcdefgh"); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); - haystack = "abcdefg"; - ret = _mbsstr(haystack, "xxxxxxxx"); + haystack = (unsigned char *)"abcdefg"; + ret = _mbsstr(haystack, (const unsigned char *)"xxxxxxxx"); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); }
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [CRT_APITEST] Add tests for _mbsncmp and _mbsstr. CORE-16933
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c8aba5a172da641b47ded…
commit c8aba5a172da641b47dedb2ed708c574027b873f Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Fri Jan 12 12:31:12 2024 -0500 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Fri Jan 12 12:36:43 2024 -0500 [CRT_APITEST] Add tests for _mbsncmp and _mbsstr. CORE-16933 --- modules/rostests/apitests/crt/_mbsncmp.c | 70 +++++++++++++++++ modules/rostests/apitests/crt/_mbsstr.c | 87 ++++++++++++++++++++++ .../rostests/apitests/crt/crtdll_crt_apitest.cmake | 4 +- .../rostests/apitests/crt/msvcrt_crt_apitest.cmake | 4 +- modules/rostests/apitests/crt/testlist.c | 4 + 5 files changed, 165 insertions(+), 4 deletions(-) diff --git a/modules/rostests/apitests/crt/_mbsncmp.c b/modules/rostests/apitests/crt/_mbsncmp.c new file mode 100644 index 00000000000..7aa099cde3c --- /dev/null +++ b/modules/rostests/apitests/crt/_mbsncmp.c @@ -0,0 +1,70 @@ +/* + * PROJECT: ReactOS API tests + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Tests for _mbsncmp + * COPYRIGHT: Copyright 2024 Thomas Faber (thomas.faber(a)reactos.org) + */ + +#include <apitest.h> +#include <mbstring.h> +#define WIN32_NO_STATUS +#include <pseh/pseh2.h> +#include <ndk/mmfuncs.h> + +/* + * cmp functions can either return 1/-1 or the actual difference between the + * first two differing characters. + * On Win2003, both crtdll and msvcrt always return 1/-1. + * On Win10, msvcrt returns the diff, crtdll returns 1/-1. + */ +#ifdef TEST_CRTDLL +#define RETURN_DIFF 0 +#else +#define RETURN_DIFF (GetVersion() >= 0x0600) +#endif + +#define DIFF_RETURN(sign, absolute) (sign (RETURN_DIFF ? absolute : 1)) + +START_TEST(_mbsncmp) +{ + int ret; + + /* Zero length always returns true */ + ret = _mbsncmp(NULL, NULL, 0); + ok(ret == 0, "ret = %d\n", ret); + + ret = _mbsncmp("a", "c", 0); + ok(ret == 0, "ret = %d\n", ret); + + /* No null checks - length 1 crashes */ + StartSeh() + (void)_mbsncmp("a", NULL, 1); + EndSeh(STATUS_ACCESS_VIOLATION); + + StartSeh() + (void)_mbsncmp(NULL, "c", 1); + EndSeh(STATUS_ACCESS_VIOLATION); + + /* Strings longer than or equal to length */ + ret = _mbsncmp("a", "c", 1); + ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret); + + ret = _mbsncmp("a", "a", 1); + ok(ret == 0, "ret = %d\n", ret); + + ret = _mbsncmp("ab", "aB", 1); + ok(ret == 0, "ret = %d\n", ret); + + ret = _mbsncmp("aa", "ac", 2); + ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret); + + /* Length longer than one of the strings */ + ret = _mbsncmp("a", "ac", 2); + ok(ret == DIFF_RETURN(-, 'c'), "ret = %d\n", ret); + + ret = _mbsncmp("aa", "a", 2); + ok(ret == DIFF_RETURN(+, 'a'), "ret = %d\n", ret); + + ret = _mbsncmp("ab", "ab", 100); + ok(ret == 0, "ret = %d\n", ret); +} diff --git a/modules/rostests/apitests/crt/_mbsstr.c b/modules/rostests/apitests/crt/_mbsstr.c new file mode 100644 index 00000000000..fc926c1cee8 --- /dev/null +++ b/modules/rostests/apitests/crt/_mbsstr.c @@ -0,0 +1,87 @@ +/* + * PROJECT: ReactOS API tests + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Tests for _mbsstr + * COPYRIGHT: Copyright 2024 Thomas Faber (thomas.faber(a)reactos.org) + */ + +#include <apitest.h> +#include <mbstring.h> +#define WIN32_NO_STATUS +#include <pseh/pseh2.h> +#include <ndk/mmfuncs.h> + +START_TEST(_mbsstr) +{ + unsigned char *haystack; + unsigned char *ret; + + /* NULL pointers are not handled */ + StartSeh() + (void)_mbsstr(NULL, NULL); + EndSeh(STATUS_ACCESS_VIOLATION); + + StartSeh() + haystack = "hello"; + (void)_mbsstr(haystack, NULL); + EndSeh(STATUS_ACCESS_VIOLATION); + + StartSeh() + haystack = ""; + (void)_mbsstr(haystack, NULL); + EndSeh(STATUS_ACCESS_VIOLATION); + + /* Empty needle returns haystack, empty haystack returns NULL... */ + haystack = "hello"; + ret = _mbsstr(haystack, ""); + ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); + + haystack = ""; + ret = _mbsstr(haystack, "a"); + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); + + /* ... but if both are empty, behavior differs */ + haystack = ""; + ret = _mbsstr(haystack, ""); +#ifdef TEST_CRTDLL + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); +#else + ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); +#endif + + /* Simple "found" cases */ + haystack = "abcdefg"; + ret = _mbsstr(haystack, "abc"); + ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); + + haystack = "abcdefg"; + ret = _mbsstr(haystack, "g"); + ok(ret == haystack + 6, "ret = %p, haystack = %p\n", ret, haystack); + + haystack = "abcdefg"; + ret = _mbsstr(haystack, "abcdefg"); + ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); + + /* Simple "not found" cases */ + haystack = "abcdefg"; + ret = _mbsstr(haystack, "h"); + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); + + haystack = "abcdefg"; + ret = _mbsstr(haystack, "gh"); + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); + + haystack = "abcdefg"; + ret = _mbsstr(haystack, "abcD"); + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); + + /* Needle longer than haystack */ + haystack = "abcdefg"; + ret = _mbsstr(haystack, "abcdefgh"); + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); + + haystack = "abcdefg"; + ret = _mbsstr(haystack, "xxxxxxxx"); + ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); +} + diff --git a/modules/rostests/apitests/crt/crtdll_crt_apitest.cmake b/modules/rostests/apitests/crt/crtdll_crt_apitest.cmake index c6f60ea1d56..cc9a32d004b 100644 --- a/modules/rostests/apitests/crt/crtdll_crt_apitest.cmake +++ b/modules/rostests/apitests/crt/crtdll_crt_apitest.cmake @@ -212,7 +212,7 @@ list(APPEND SOURCE_CRTDLL # _mbsnbset.c # _mbsncat.c # _mbsnccnt.c -# _mbsncmp.c + _mbsncmp.c # _mbsncpy.c # _mbsnextc.c # _mbsnicmp.c @@ -224,7 +224,7 @@ list(APPEND SOURCE_CRTDLL # _mbsset.c # _mbsspn.c # _mbsspnp.c -# _mbsstr.c + _mbsstr.c # _mbstok.c # _mbstrlen.c # _mbsupr.c diff --git a/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake b/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake index 919a7b01b64..0d1984b5d17 100644 --- a/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake +++ b/modules/rostests/apitests/crt/msvcrt_crt_apitest.cmake @@ -549,7 +549,7 @@ list(APPEND SOURCE_MSVCRT # _mbsncat_s_l # _mbsnccnt.c # _mbsnccnt_l -# _mbsncmp.c + _mbsncmp.c # _mbsncmp_l # _mbsncoll.c # _mbsncoll_l @@ -585,7 +585,7 @@ list(APPEND SOURCE_MSVCRT # _mbsspn_l # _mbsspnp.c # _mbsspnp_l -# _mbsstr.c + _mbsstr.c # _mbsstr_l # _mbstok.c # _mbstok_l diff --git a/modules/rostests/apitests/crt/testlist.c b/modules/rostests/apitests/crt/testlist.c index 14f0bb97ad3..e1592928611 100644 --- a/modules/rostests/apitests/crt/testlist.c +++ b/modules/rostests/apitests/crt/testlist.c @@ -3,6 +3,8 @@ #define STANDALONE #include <apitest.h> +extern void func__mbsncmp(void); +extern void func__mbsstr(void); #if defined(TEST_MSVCRT) extern void func__vscprintf(void); extern void func__vscwprintf(void); @@ -60,6 +62,8 @@ const struct test winetest_testlist[] = { "strlen", func_strlen }, { "strtoul", func_strtoul }, #if defined(TEST_CRTDLL) || defined(TEST_MSVCRT) + { "_mbsncmp", func__mbsncmp }, + { "_mbsstr", func__mbsstr }, { "system", func_system }, #endif #if defined(TEST_MSVCRT)
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [SHELL32] Improve error message on copying files (#6290)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4490a053d01b54f957627…
commit 4490a053d01b54f957627bc0e1c59a471638ae49 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Jan 12 16:01:21 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Jan 12 16:01:21 2024 +0900 [SHELL32] Improve error message on copying files (#6290) Based on KRosUser's copyerrorfix.patch. JIRA issue: CORE-19414 - If feFrom->szFilename was empty, then use feFrom->szFullPath instead. --- dll/win32/shell32/shlfileop.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dll/win32/shell32/shlfileop.cpp b/dll/win32/shell32/shlfileop.cpp index 3480cfd2af0..f1ecc455428 100644 --- a/dll/win32/shell32/shlfileop.cpp +++ b/dll/win32/shell32/shlfileop.cpp @@ -1883,6 +1883,8 @@ static void check_flags(FILEOP_FLAGS fFlags) FIXME("Unsupported flags: %04x\n", fFlags); } +#define GET_FILENAME(fe) ((fe)->szFilename[0] ? (fe)->szFilename : (fe)->szFullPath) + static DWORD validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo) { @@ -1922,14 +1924,14 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flT { strTitle.LoadStringW(IDS_MOVEERRORTITLE); if (IsAttribDir(feFrom->attributes)) - strText.Format(IDS_MOVEERRORSAMEFOLDER, feFrom->szFilename); + strText.Format(IDS_MOVEERRORSAMEFOLDER, GET_FILENAME(feFrom)); else - strText.Format(IDS_MOVEERRORSAME, feFrom->szFilename); + strText.Format(IDS_MOVEERRORSAME, GET_FILENAME(feFrom)); } else { strTitle.LoadStringW(IDS_COPYERRORTITLE); - strText.Format(IDS_COPYERRORSAME, feFrom->szFilename); + strText.Format(IDS_COPYERRORSAME, GET_FILENAME(feFrom)); return ERROR_SUCCESS; } MessageBoxW(hwnd, strText, strTitle, MB_ICONERROR); @@ -1957,12 +1959,12 @@ validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flT if (wFunc == FO_MOVE) { strTitle.LoadStringW(IDS_MOVEERRORTITLE); - strText.Format(IDS_MOVEERRORSUBFOLDER, feFrom->szFilename); + strText.Format(IDS_MOVEERRORSUBFOLDER, GET_FILENAME(feFrom)); } else { strTitle.LoadStringW(IDS_COPYERRORTITLE); - strText.Format(IDS_COPYERRORSUBFOLDER, feFrom->szFilename); + strText.Format(IDS_COPYERRORSUBFOLDER, GET_FILENAME(feFrom)); } MessageBoxW(hwnd, strText, strTitle, MB_ICONERROR); return DE_DESTSUBTREE;
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [SDK] cicuif.h: Reduce magic numbers (#6334)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f51258ae5173e7b5629ad…
commit f51258ae5173e7b5629add52b38405dba9360420 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Jan 12 13:40:28 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Jan 12 13:40:28 2024 +0900 [SDK] cicuif.h: Reduce magic numbers (#6334) Improve human readability. JIRA issue: CORE-19360 - Define some flags of m_style. - Define some flags of dwDrawFlags. - Reduce some magic numbers. --- sdk/include/reactos/cicero/cicuif.h | 185 ++++++++++++++++++++---------------- 1 file changed, 103 insertions(+), 82 deletions(-) diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 457fe782536..23f0bac68e8 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -193,19 +193,6 @@ public: ///////////////////////////////////////////////////////////////////////////// -// Flags for CUIFObject::m_style -enum -{ - UIF_STYLE_CHILD = 0x1, - UIF_STYLE_TOPMOST = 0x2, - UIF_STYLE_TOOLWINDOW = 0x4, - UIF_STYLE_TOOLTIP = 0x20, - UIF_STYLE_SHADOW = 0x40, - UIF_STYLE_RTL = 0x200, - UIF_STYLE_VERTICAL = 0x400, - UIF_STYLE_THEMED = 0x80000000, -}; - class CUIFObject : public CUIFTheme { protected: @@ -432,6 +419,13 @@ BOOL cicGetIconBitmaps(HICON hIcon, HBITMAP *hbm1, HBITMAP *hbm2, const SIZE *pS ///////////////////////////////////////////////////////////////////////////// +// Flags for dwDrawFlags +enum +{ + UIF_DRAW_PRESSED = 0x10, + UIF_DRAW_DISABLED = 0x20, +}; + class CUIFScheme { public: @@ -514,6 +508,22 @@ CUIFScheme *cicCreateUIFScheme(DWORD type); ///////////////////////////////////////////////////////////////////////////// +// m_style flags for CUIFWindow +enum +{ + UIF_WINDOW_CHILD = 0x1, + UIF_WINDOW_TOPMOST = 0x2, + UIF_WINDOW_TOOLWINDOW = 0x4, + UIF_WINDOW_DLGFRAME = 0x8, + UIF_WINDOW_TOOLTIP = 0x20, + UIF_WINDOW_SHADOW = 0x40, + UIF_WINDOW_WORKAREA = 0x80, + UIF_WINDOW_MONITOR = 0x100, + UIF_WINDOW_LAYOUTRTL = 0x200, + UIF_WINDOW_NOMOUSEMSG = 0x400, + UIF_WINDOW_ENABLETHEMED = 0x80000000, +}; + class CUIFWindow : public CUIFObject { protected: @@ -674,6 +684,21 @@ public: ///////////////////////////////////////////////////////////////////////////// +// m_style flags for CUIFButton +enum +{ + UIF_BUTTON_H_ALIGN_LEFT = 0, + UIF_BUTTON_H_ALIGN_CENTER = 0x1, + UIF_BUTTON_H_ALIGN_RIGHT = 0x2, + UIF_BUTTON_H_ALIGN_MASK = UIF_BUTTON_H_ALIGN_CENTER | UIF_BUTTON_H_ALIGN_RIGHT, + UIF_BUTTON_V_ALIGN_TOP = 0, + UIF_BUTTON_V_ALIGN_MIDDLE = 0x4, + UIF_BUTTON_V_ALIGN_BOTTOM = 0x8, + UIF_BUTTON_V_ALIGN_MASK = UIF_BUTTON_V_ALIGN_MIDDLE | UIF_BUTTON_V_ALIGN_BOTTOM, + UIF_BUTTON_LARGE_ICON = 0x100, + UIF_BUTTON_VERTICAL = 0x400, +}; + class CUIFButton : public CUIFObject { protected: @@ -729,6 +754,12 @@ public: ///////////////////////////////////////////////////////////////////////////// +// m_style flags for CUIFGripper +enum +{ + UIF_GRIPPER_VERTICAL = 0x1, +}; + class CUIFGripper : public CUIFObject { protected: @@ -1051,7 +1082,7 @@ inline STDMETHODIMP_(void) CUIFObject::Initialize() inline STDMETHODIMP_(void) CUIFObject::OnPaint(HDC hDC) { - if (!(m_pWindow->m_style & UIF_STYLE_THEMED) || !OnPaintTheme(hDC)) + if (!(m_pWindow->m_style & UIF_WINDOW_ENABLETHEMED) || !OnPaintTheme(hDC)) OnPaintNoTheme(hDC); } @@ -1261,7 +1292,7 @@ inline BOOL CUIFObject::IsRTL() { if (!m_pWindow) return FALSE; - return !!(m_pWindow->m_style & UIF_STYLE_RTL); + return !!(m_pWindow->m_style & UIF_WINDOW_LAYOUTRTL); } inline CUIFObject* CUIFObject::ObjectFromPoint(POINT pt) @@ -1510,7 +1541,7 @@ CUIFSchemeDef::DrawCtrlBkgd(HDC hDC, LPCRECT prc, DWORD unused, DWORD dwDrawFlag { ::FillRect(hDC, prc, GetBrush(9)); - if (!(dwDrawFlags & 0x10) && (dwDrawFlags & 0x2)) + if (!(dwDrawFlags & UIF_DRAW_PRESSED) && (dwDrawFlags & 0x2)) return; HBRUSH hbrDither = cicCreateDitherBrush(); @@ -1552,7 +1583,7 @@ CUIFSchemeDef::DrawCtrlText( cchText = lstrlenW(pszText); RECT rc = *prc; - if (dwDrawFlags & 0x20) + if (dwDrawFlags & UIF_DRAW_DISABLED) { ::OffsetRect(&rc, 1, 1); ::SetTextColor(hDC, ::GetSysColor(COLOR_BTNHIGHLIGHT)); @@ -1585,7 +1616,7 @@ CUIFSchemeDef::DrawCtrlIcon(HDC hDC, LPCRECT prc, HICON hIcon, DWORD dwDrawFlags else { UINT uFlags = DST_PREFIXTEXT | DST_TEXT; - if (dwDrawFlags & 0x20) + if (dwDrawFlags & UIF_DRAW_DISABLED) uFlags |= (DSS_MONO | DSS_DISABLED); ::DrawState(hDC, 0, 0, (LPARAM)hIcon, 0, prc->left, prc->top, 0, 0, uFlags); } @@ -2182,17 +2213,17 @@ CUIFWindow::Initialize() cicUpdateUIFSys(); cicUpdateUIFScheme(); - if (m_style & UIF_STYLE_TOOLTIP) + if (m_style & UIF_WINDOW_TOOLTIP) { - DWORD style = (m_style & UIF_STYLE_RTL) | UIF_STYLE_TOPMOST | 0x10; + DWORD style = (m_style & UIF_WINDOW_LAYOUTRTL) | UIF_WINDOW_TOPMOST | 0x10; m_pToolTip = new(cicNoThrow) CUIFToolTip(m_hInst, style, this); if (m_pToolTip) m_pToolTip->Initialize(); } - if (m_style & UIF_STYLE_SHADOW) + if (m_style & UIF_WINDOW_SHADOW) { - m_pShadow = new(cicNoThrow) CUIFShadow(m_hInst, UIF_STYLE_TOPMOST, this); + m_pShadow = new(cicNoThrow) CUIFShadow(m_hInst, UIF_WINDOW_TOPMOST, this); if (m_pShadow) m_pShadow->Initialize(); } @@ -2288,14 +2319,14 @@ CUIFWindow::GetWndStyle() { DWORD ret; - if (m_style & UIF_STYLE_CHILD) + if (m_style & UIF_WINDOW_CHILD) ret = WS_CHILD | WS_CLIPSIBLINGS; else ret = WS_POPUP | WS_DISABLED; if (m_style & 0x10000000) ret |= WS_BORDER; - else if (m_style & 0x8) + else if (m_style & UIF_WINDOW_DLGFRAME) ret |= WS_DLGFRAME; else if ((m_style & 0x20000000) || (m_style & 0x10)) ret |= WS_BORDER; @@ -2307,11 +2338,11 @@ inline STDMETHODIMP_(DWORD) CUIFWindow::GetWndStyleEx() { DWORD ret = 0; - if (m_style & UIF_STYLE_TOPMOST) - ret = WS_EX_TOPMOST; - if (m_style & UIF_STYLE_TOOLWINDOW) + if (m_style & UIF_WINDOW_TOPMOST) + ret |= WS_EX_TOPMOST; + if (m_style & UIF_WINDOW_TOOLWINDOW) ret |= WS_EX_TOOLWINDOW; - if (m_style & UIF_STYLE_RTL) + if (m_style & UIF_WINDOW_LAYOUTRTL) ret |= WS_EX_LAYOUTRTL; return ret; } @@ -2334,7 +2365,7 @@ inline void CUIFWindow::Show(BOOL bVisible) if (!IsWindow(m_hWnd)) return; - if (bVisible && (m_style & UIF_STYLE_TOPMOST)) + if (bVisible && (m_style & UIF_WINDOW_TOPMOST)) ::SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); m_bVisible = bVisible; @@ -2522,7 +2553,7 @@ CUIFWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) m_pToolTip->RelayEvent(&msg); } - if (!(m_style & UIF_STYLE_VERTICAL)) + if (!(m_style & UIF_WINDOW_NOMOUSEMSG)) HandleMouseMsg(HIWORD(lParam), Point.x, Point.y); return TRUE; @@ -2731,42 +2762,31 @@ CUIFWindow::WindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) inline BOOL CUIFWindow::GetWorkArea(LPCRECT prcWnd, LPRECT prcWorkArea) { - if (!(m_style & 0x180)) - return 0; + if (!(m_style & (UIF_WINDOW_WORKAREA | UIF_WINDOW_MONITOR))) + return FALSE; HMONITOR hMon = ::MonitorFromRect(prcWnd, MONITOR_DEFAULTTONEAREST); MONITORINFO mi; mi.cbSize = sizeof(MONITORINFO); if (!hMon || !::GetMonitorInfo(hMon, &mi)) { - if (m_style & 0x80) + if (m_style & UIF_WINDOW_WORKAREA) return ::SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0); - if (m_style & 0x100) - { - prcWorkArea->top = 0; - prcWorkArea->left = 0; - prcWorkArea->right = ::GetSystemMetrics(SM_CXSCREEN); - prcWorkArea->bottom = ::GetSystemMetrics(SM_CYSCREEN); - return TRUE; - } - - return FALSE; - } - - if (m_style & 0x80) - { - *prcWorkArea = mi.rcWork; + prcWorkArea->left = prcWorkArea->top = 0; + prcWorkArea->right = ::GetSystemMetrics(SM_CXSCREEN); + prcWorkArea->bottom = ::GetSystemMetrics(SM_CYSCREEN); return TRUE; } - if (m_style & 0x100) + if (m_style & UIF_WINDOW_WORKAREA) { - *prcWorkArea = mi.rcMonitor; + *prcWorkArea = mi.rcWork; return TRUE; } - return FALSE; + *prcWorkArea = mi.rcMonitor; + return TRUE; } inline void @@ -2820,7 +2840,7 @@ CUIFWindow::PaintObject(HDC hDC, LPCRECT prc) ::SetViewportOrgEx(hMemDC, -pRect->left, -pRect->top, NULL); if ((FAILED(CUIFTheme::EnsureThemeData(m_hWnd)) || - !(m_style & UIF_STYLE_CHILD) || + !(m_style & UIF_WINDOW_CHILD) || FAILED(DrawThemeParentBackground(m_hWnd, hMemDC, &m_rc))) && FAILED(DrawThemeBackground(hMemDC, m_iStateId, &m_rc, 0))) { @@ -3025,7 +3045,7 @@ CUIFWindow::OnAnimationStart() /// @unimplemented inline CUIFShadow::CUIFShadow(HINSTANCE hInst, DWORD style, CUIFWindow *pShadowOwner) - : CUIFWindow(hInst, (style | UIF_STYLE_TOOLWINDOW)) + : CUIFWindow(hInst, (style | UIF_WINDOW_TOOLWINDOW)) { m_pShadowOrToolTipOwner = pShadowOwner; m_rgbShadowColor = RGB(0, 0, 0); @@ -3610,7 +3630,7 @@ inline void CUIFButton::DrawIconProc(HDC hDC, LPRECT prc, BOOL bPressed) ::FillRect(hMemDC, &rc, hbrWhite); } - if (m_style & 0x100) + if (m_style & UIF_BUTTON_LARGE_ICON) { ::DrawIconEx(hMemDC, 2 + bPressed, 2 + bPressed, @@ -3636,6 +3656,7 @@ inline void CUIFButton::DrawIconProc(HDC hDC, LPRECT prc, BOOL bPressed) ::DeleteDC(hMemDC); } +/// @unimplemented inline void CUIFButton::DrawTextProc(HDC hDC, LPCRECT prc, BOOL bPressed) { @@ -3648,16 +3669,16 @@ CUIFButton::DrawTextProc(HDC hDC, LPCRECT prc, BOOL bPressed) ::GetTextExtentPoint32W(hDC, m_pszButtonText, cchText, &textSize); INT xText, yText; - if ((m_style & (UIF_STYLE_CHILD | UIF_STYLE_TOPMOST)) == UIF_STYLE_CHILD) + if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_CENTER) xText = (m_rc.right - m_rc.left - textSize.cx) / 2; - else if ((m_style & (UIF_STYLE_CHILD | UIF_STYLE_TOPMOST)) == UIF_STYLE_TOPMOST) + else if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_RIGHT) xText = m_rc.right - m_rc.left - textSize.cx; else xText = 0; - if ((m_style & 0xC) == UIF_STYLE_TOOLWINDOW) + if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_MIDDLE) yText = (m_rc.bottom - m_rc.top - textSize.cy) / 2; - else if ((m_style & 0xC) == 0x8) + else if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_BOTTOM) yText = m_rc.bottom - m_rc.top - textSize.cy; else yText = 0; @@ -3741,7 +3762,7 @@ CUIFButton::GetTextSize(LPCWSTR pszText, LPSIZE pSize) ::GetTextExtentPoint32W(hDC, pszText, cchText, pSize); } - if (m_style & UIF_STYLE_VERTICAL) + if (m_style & UIF_BUTTON_VERTICAL) { INT tmp = pSize->cx; pSize->cx = pSize->cy; @@ -3757,7 +3778,7 @@ CUIFButton::OnLButtonDown(LONG x, LONG y) { SetStatus(1); StartCapture(); - if ((m_style & 0x30) == UIF_STYLE_TOOLTIP) + if ((m_style & 0x30) == 0x20) NotifyCommand(1, 0); } @@ -3770,7 +3791,7 @@ CUIFButton::OnLButtonUp(LONG x, LONG y) if (bCapture) EndCapture(); - BOOL bNotInObject = (m_style & 0x30) == UIF_STYLE_TOOLTIP; + BOOL bNotInObject = (m_style & 0x30) == 0x20; if ((m_style & 0x30) != 0x10) { bNotInObject = !PtInObject(pt); @@ -3807,7 +3828,7 @@ CUIFButton::OnLButtonUp(LONG x, LONG y) inline void CUIFButton::OnMouseIn(LONG x, LONG y) { - if ((m_style & 0x30) == UIF_STYLE_TOOLTIP) + if ((m_style & 0x30) == 0x20) { if (IsCapture()) SetStatus(0); @@ -3825,7 +3846,7 @@ inline void CUIFButton::OnMouseIn(LONG x, LONG y) inline void CUIFButton::OnMouseOut(LONG x, LONG y) { - if ((m_style & 0x30) == UIF_STYLE_TOOLTIP) + if ((m_style & 0x30) == 0x20) SetStatus(0); else if (IsCapture()) SetStatus(3); @@ -3935,13 +3956,13 @@ inline DWORD CUIFButton2::MakeDrawFlag() { DWORD dwDrawFlags = 0; if (m_bPressed) - dwDrawFlags |= 0x10; + dwDrawFlags |= UIF_DRAW_PRESSED; if (m_uButtonStatus == 1) dwDrawFlags |= 0x2; else if (2 <= m_uButtonStatus && m_uButtonStatus <= 3) dwDrawFlags |= 0x1; if (!m_bEnable) - dwDrawFlags |= 0x20; + dwDrawFlags |= UIF_DRAW_DISABLED; return dwDrawFlags; } @@ -3999,7 +4020,7 @@ CUIFButton2::OnPaintNoTheme(HDC hDC) cyContent = m_BitmapSize.cy; } - if (m_style & 0x400) + if (m_style & UIF_BUTTON_VERTICAL) { cxyBorders = ((cyText && cyContent) ? 2 : 0); @@ -4019,31 +4040,31 @@ CUIFButton2::OnPaintNoTheme(HDC hDC) } INT xOffset, yOffset; - if ((m_style & 3) == 1) // center + if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_CENTER) xOffset = (rcBack.left + rcBack.right - cxButton) / 2; - else if ((m_style & 3) == 2) // right + else if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_RIGHT) xOffset = rcBack.right - cxText - 2; - else // left + else xOffset = rcBack.left + 2; - if ((m_style & 0xC) == 4) // middle + if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_MIDDLE) yOffset = (rcBack.top + rcBack.bottom - cyButton) / 2; - else if ((m_style & 0xC) == 8) // bottom + else if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_BOTTOM) yOffset = rcBack.bottom - cyButton - 2; - else // top + else yOffset = rcBack.top + 2; RECT rc = { xOffset, yOffset, xOffset + cxButton, cyButton + yOffset }; SIZE offsetSize = { 0, 0 }; DWORD dwDrawFlags = MakeDrawFlag(); - m_pScheme->GetCtrlFaceOffset(((m_style & UIF_STYLE_RTL) ? 165 : 84), + m_pScheme->GetCtrlFaceOffset(((m_style & 0x200) ? 165 : 84), dwDrawFlags, &offsetSize); ::OffsetRect(&rc, offsetSize.cx, offsetSize.cy); RECT rcImage, rcText; - if (m_style & UIF_STYLE_VERTICAL) // vertical + if (m_style & UIF_BUTTON_VERTICAL) { rcImage.left = (rc.left + rc.right - cxContent) / 2; rcImage.top = rc.top; @@ -4071,12 +4092,12 @@ CUIFButton2::OnPaintNoTheme(HDC hDC) m_pScheme->DrawCtrlBkgd(hdcMem, &rcBack, - ((m_style & UIF_STYLE_RTL) ? 165 : 84), + ((m_style & 0x200) ? 165 : 84), dwDrawFlags); if (m_pszButtonText) { m_pScheme->DrawCtrlText(hdcMem, &rcText, m_pszButtonText, -1, dwDrawFlags, - !!(m_style & UIF_STYLE_VERTICAL)); + !!(m_style & UIF_BUTTON_VERTICAL)); } if (m_ButtonIcon.m_hIcon) @@ -4089,7 +4110,7 @@ CUIFButton2::OnPaintNoTheme(HDC hDC) m_pScheme->DrawCtrlEdge(hdcMem, &rcBack, - ((m_style & UIF_STYLE_RTL) ? 165 : 84), + ((m_style & 0x200) ? 165 : 84), dwDrawFlags); ::BitBlt(hDC, m_rc.left, m_rc.top, width, height, hdcMem, 0, 0, SRCCOPY); @@ -4106,7 +4127,7 @@ CUIFGripper::CUIFGripper(CUIFObject *pParent, LPCRECT prc, DWORD style) { m_iStateId = 0; m_pszClassList = L"REBAR"; - if (m_style & 1) + if (m_style & UIF_GRIPPER_VERTICAL) m_iPartId = RP_GRIPPERVERT; else m_iPartId = RP_GRIPPER; @@ -4153,7 +4174,7 @@ CUIFGripper::OnPaintTheme(HDC hDC) if (FAILED(EnsureThemeData(*m_pWindow))) return FALSE; - if (m_style & 1) + if (m_style & UIF_GRIPPER_VERTICAL) { m_rc.top += 2; m_rc.bottom -= 2; @@ -4175,12 +4196,12 @@ CUIFGripper::OnPaintNoTheme(HDC hDC) { if (m_pScheme) { - m_pScheme->DrawDragHandle(hDC, &m_rc, !!(m_style & 1)); + m_pScheme->DrawDragHandle(hDC, &m_rc, !!(m_style & UIF_GRIPPER_VERTICAL)); return; } RECT rc; - if (m_style & 1) + if (m_style & UIF_GRIPPER_VERTICAL) rc = { m_rc.left, m_rc.top + 1, m_rc.right, m_rc.top + 4 }; else rc = { m_rc.left + 1, m_rc.top, m_rc.left + 4, m_rc.bottom }; @@ -4200,7 +4221,7 @@ inline STDMETHODIMP_(void) CUIFGripper::SetStyle(DWORD style) { m_style = style; - if (m_style & 1) + if (m_style & UIF_GRIPPER_VERTICAL) SetActiveTheme(L"REBAR", RP_GRIPPERVERT, 0); else SetActiveTheme(L"REBAR", RP_GRIPPER, 0);
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [SDK] cicuif.h: Add CUIFGripper (#6332)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4287f07c757136b86a684…
commit 4287f07c757136b86a6847ff4b118b0f693e5b1f Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Jan 11 22:09:19 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Jan 11 22:09:19 2024 +0900 [SDK] cicuif.h: Add CUIFGripper (#6332) Supporting TIPs... JIRA issue: CORE-19360 - Add CUIFGripper class. --- sdk/include/reactos/cicero/cicuif.h | 174 +++++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 23 deletions(-) diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 0beab5656d7..457fe782536 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -23,8 +23,9 @@ class CUIFTheme; class CUIFWindow; class CUIFToolTip; class CUIFShadow; - class CUIFButton; - class CUIFButton2; + class CUIFButton; + class CUIFButton2; + class CUIFGripper; class CUIFObjectArray; class CUIFColorTable; class CUIFColorTableSys; @@ -465,8 +466,8 @@ public: STDMETHOD_(void, DrawFrameCtrlIcon)(HDC hDC, LPCRECT prc, HICON hIcon, DWORD dwDrawFlags, LPSIZE pSize) = 0; STDMETHOD_(void, DrawFrameCtrlBitmap)(HDC hDC, LPCRECT prc, HBITMAP hbm1, HBITMAP hbm2, DWORD dwDrawFlags) = 0; STDMETHOD_(void, DrawWndFrame)(HDC hDC, LPCRECT prc, DWORD type, DWORD unused1, DWORD unused2) = 0; - STDMETHOD_(void, DrawDragHandle)(HDC hDC, LPCRECT prc, BOOL bFlag) = 0; - STDMETHOD_(void, DrawSeparator)(HDC hDC, LPCRECT prc, BOOL bFlag) = 0; + STDMETHOD_(void, DrawDragHandle)(HDC hDC, LPCRECT prc, BOOL bVertical) = 0; + STDMETHOD_(void, DrawSeparator)(HDC hDC, LPCRECT prc, BOOL bVertical) = 0; }; class CUIFSchemeDef : public CUIFScheme @@ -499,8 +500,8 @@ public: STDMETHOD_(void, DrawFrameCtrlIcon)(HDC hDC, LPCRECT prc, HICON hIcon, DWORD dwDrawFlags, LPSIZE pSize) override; STDMETHOD_(void, DrawFrameCtrlBitmap)(HDC hDC, LPCRECT prc, HBITMAP hbm1, HBITMAP hbm2, DWORD dwDrawFlags) override; STDMETHOD_(void, DrawWndFrame)(HDC hDC, LPCRECT prc, DWORD type, DWORD unused1, DWORD unused2) override; - STDMETHOD_(void, DrawDragHandle)(HDC hDC, LPCRECT prc, BOOL bFlag) override; - STDMETHOD_(void, DrawSeparator)(HDC hDC, LPCRECT prc, BOOL bFlag) override; + STDMETHOD_(void, DrawDragHandle)(HDC hDC, LPCRECT prc, BOOL bVertical) override; + STDMETHOD_(void, DrawSeparator)(HDC hDC, LPCRECT prc, BOOL bVertical) override; }; DECLSPEC_SELECTANY CUIFColorTableSys *CUIFScheme::s_pColorTableSys = NULL; @@ -538,6 +539,7 @@ protected: public: enum { POINTING_TIMER_ID = 0x7982 }; + operator HWND() const { return m_hWnd; } CUIFWindow(HINSTANCE hInst, DWORD style); ~CUIFWindow() override; @@ -727,6 +729,26 @@ public: ///////////////////////////////////////////////////////////////////////////// +class CUIFGripper : public CUIFObject +{ +protected: + POINT m_ptGripper; + +public: + CUIFGripper(CUIFObject *pParent, LPCRECT prc, DWORD style); + ~CUIFGripper() override; + + STDMETHOD_(void, OnMouseMove)(LONG x, LONG y) override; + STDMETHOD_(void, OnLButtonDown)(LONG x, LONG y) override; + STDMETHOD_(void, OnLButtonUp)(LONG x, LONG y) override; + STDMETHOD_(BOOL, OnPaintTheme)(HDC hDC) override; + STDMETHOD_(void, OnPaintNoTheme)(HDC hDC) override; + STDMETHOD_(BOOL, OnSetCursor)(UINT uMsg, LONG x, LONG y) override; + STDMETHOD_(void, SetStyle)(DWORD style) override; +}; + +///////////////////////////////////////////////////////////////////////////// + inline void cicInitUIFLib(void) { cicInitUIFSys(); @@ -1629,10 +1651,10 @@ CUIFSchemeDef::DrawWndFrame(HDC hDC, LPCRECT prc, DWORD type, DWORD unused1, DWO } inline STDMETHODIMP_(void) -CUIFSchemeDef::DrawDragHandle(HDC hDC, LPCRECT prc, BOOL bFlag) +CUIFSchemeDef::DrawDragHandle(HDC hDC, LPCRECT prc, BOOL bVertical) { RECT rc; - if (bFlag) + if (bVertical) rc = { prc->left, prc->top + 1, prc->right, prc->top + 4 }; else rc = { prc->left + 1, prc->top, prc->left + 4, prc->bottom }; @@ -1640,7 +1662,7 @@ CUIFSchemeDef::DrawDragHandle(HDC hDC, LPCRECT prc, BOOL bFlag) } inline STDMETHODIMP_(void) -CUIFSchemeDef::DrawSeparator(HDC hDC, LPCRECT prc, BOOL bFlag) +CUIFSchemeDef::DrawSeparator(HDC hDC, LPCRECT prc, BOOL bVertical) { HPEN hLightPen = ::CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNHIGHLIGHT)); if (!hLightPen) @@ -1654,7 +1676,7 @@ CUIFSchemeDef::DrawSeparator(HDC hDC, LPCRECT prc, BOOL bFlag) } HGDIOBJ hPenOld = ::SelectObject(hDC, hShadowPen); - if (bFlag) + if (bVertical) { ::MoveToEx(hDC, prc->left, prc->top + 1, NULL); ::LineTo(hDC, prc->right, prc->top + 1); @@ -2514,12 +2536,10 @@ CUIFWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) OnCreate(hWnd); return 0; case WM_DESTROY: - if (m_pToolTip && ::IsWindow(m_pToolTip->m_hWnd)) - ::DestroyWindow(m_pToolTip->m_hWnd); - if (m_pShadow && ::IsWindow(m_pShadow->m_hWnd)) - { - ::DestroyWindow(m_pShadow->m_hWnd); - } + if (m_pToolTip && ::IsWindow(*m_pToolTip)) + ::DestroyWindow(*m_pToolTip); + if (m_pShadow && ::IsWindow(*m_pShadow)) + ::DestroyWindow(*m_pShadow); OnDestroy(hWnd); return 0; case WM_SIZE: @@ -3040,7 +3060,7 @@ inline void CUIFShadow::InitShadow() inline void CUIFShadow::AdjustWindowPos() { - HWND hwndOwner = m_pShadowOrToolTipOwner->m_hWnd; + HWND hwndOwner = *m_pShadowOrToolTipOwner; if (!::IsWindow(m_hWnd)) return; @@ -3093,7 +3113,7 @@ inline STDMETHODIMP_(LRESULT) CUIFShadow::OnWindowPosChanging(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { WINDOWPOS *wp = (WINDOWPOS *)lParam; - wp->hwndInsertAfter = m_pShadowOrToolTipOwner->m_hWnd; + wp->hwndInsertAfter = *m_pShadowOrToolTipOwner; return ::DefWindowProc(hWnd, Msg, wParam, lParam); } @@ -3224,7 +3244,7 @@ CUIFToolTip::GetTipTextColor() inline CUIFObject* CUIFToolTip::FindObject(HWND hWnd, POINT pt) { - if (hWnd == m_pShadowOrToolTipOwner->m_hWnd) + if (hWnd == *m_pShadowOrToolTipOwner) return m_pShadowOrToolTipOwner->ObjectFromPoint(pt); return NULL; } @@ -3246,7 +3266,7 @@ CUIFToolTip::ShowTip() POINT Point; ::GetCursorPos(&Point); - ::ScreenToClient(m_pToolTipTarget->m_pWindow->m_hWnd, &Point); + ::ScreenToClient(*m_pToolTipTarget->m_pWindow, &Point); RECT rc; m_pToolTipTarget->GetRect(&rc); @@ -3264,8 +3284,8 @@ CUIFToolTip::ShowTip() GetTipWindowSize(&size); RECT rc2 = rc; - ::ClientToScreen(m_pToolTipTarget->m_pWindow->m_hWnd, (LPPOINT)&rc); - ::ClientToScreen(m_pToolTipTarget->m_pWindow->m_hWnd, (LPPOINT)&rc.right); + ::ClientToScreen(*m_pToolTipTarget->m_pWindow, (LPPOINT)&rc); + ::ClientToScreen(*m_pToolTipTarget->m_pWindow, (LPPOINT)&rc.right); GetTipWindowRect(&rc2, size, &rc); m_bShowToolTip = TRUE; @@ -3709,7 +3729,7 @@ CUIFButton::GetTextSize(LPCWSTR pszText, LPSIZE pSize) INT cchText = lstrlenW(pszText); HGDIOBJ hFontOld = ::SelectObject(hDC, m_hFont); - if (!m_bHasCustomFont && SUCCEEDED(EnsureThemeData(m_pWindow->m_hWnd))) + if (!m_bHasCustomFont && SUCCEEDED(EnsureThemeData(*m_pWindow))) { RECT rc; GetThemeTextExtent(hDC, 0, pszText, cchText, 0, NULL, &rc); @@ -4077,3 +4097,111 @@ CUIFButton2::OnPaintNoTheme(HDC hDC) ::SelectObject(hdcMem, hbmOld); ::DeleteObject(hbmMem); } + +///////////////////////////////////////////////////////////////////////////// + +inline +CUIFGripper::CUIFGripper(CUIFObject *pParent, LPCRECT prc, DWORD style) + : CUIFObject(pParent, 0, prc, style) +{ + m_iStateId = 0; + m_pszClassList = L"REBAR"; + if (m_style & 1) + m_iPartId = RP_GRIPPERVERT; + else + m_iPartId = RP_GRIPPER; +} + +inline CUIFGripper::~CUIFGripper() +{ +} + +inline STDMETHODIMP_(void) +CUIFGripper::OnMouseMove(LONG x, LONG y) +{ + if (IsCapture()) + { + POINT pt; + ::GetCursorPos(&pt); + m_pWindow->Move(pt.x - m_ptGripper.x, pt.y - m_ptGripper.y, -1, -1); + } +} + +inline STDMETHODIMP_(void) +CUIFGripper::OnLButtonDown(LONG x, LONG y) +{ + StartCapture(); + m_ptGripper.x = x; + m_ptGripper.y = y; + ::ScreenToClient(*m_pWindow, &m_ptGripper); + RECT rc; + ::GetWindowRect(*m_pWindow, &rc); + m_ptGripper.x -= rc.left; + m_ptGripper.y -= rc.top; +} + +inline STDMETHODIMP_(void) +CUIFGripper::OnLButtonUp(LONG x, LONG y) +{ + if (IsCapture()) + EndCapture(); +} + +inline STDMETHODIMP_(BOOL) +CUIFGripper::OnPaintTheme(HDC hDC) +{ + if (FAILED(EnsureThemeData(*m_pWindow))) + return FALSE; + + if (m_style & 1) + { + m_rc.top += 2; + m_rc.bottom -= 2; + } + else + { + m_rc.left += 2; + m_rc.right -= 2; + } + + if (FAILED(DrawThemeBackground(hDC, 1, &m_rc, 0))) + return FALSE; + + return TRUE; +} + +inline STDMETHODIMP_(void) +CUIFGripper::OnPaintNoTheme(HDC hDC) +{ + if (m_pScheme) + { + m_pScheme->DrawDragHandle(hDC, &m_rc, !!(m_style & 1)); + return; + } + + RECT rc; + if (m_style & 1) + rc = { m_rc.left, m_rc.top + 1, m_rc.right, m_rc.top + 4 }; + else + rc = { m_rc.left + 1, m_rc.top, m_rc.left + 4, m_rc.bottom }; + + ::DrawEdge(hDC, &rc, BDR_RAISEDINNER, BF_RECT); +} + +inline STDMETHODIMP_(BOOL) +CUIFGripper::OnSetCursor(UINT uMsg, LONG x, LONG y) +{ + HCURSOR hCursor = ::LoadCursor(NULL, IDC_SIZEALL); + ::SetCursor(hCursor); + return TRUE; +} + +inline STDMETHODIMP_(void) +CUIFGripper::SetStyle(DWORD style) +{ + m_style = style; + if (m_style & 1) + SetActiveTheme(L"REBAR", RP_GRIPPERVERT, 0); + else + SetActiveTheme(L"REBAR", RP_GRIPPER, 0); +}
11 months, 2 weeks
1
0
0
0
[reactos] 01/01: [KERNEL32] OpenFile(): Use InitializeObjectAttributes (#6323)
by Muhammad Faathin Abdurrahman
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5391eaadff005718cb2b4…
commit 5391eaadff005718cb2b434207678c4a9d23ca74 Author: Muhammad Faathin Abdurrahman <kaw411gh0st(a)gmail.com> AuthorDate: Thu Jan 11 18:31:12 2024 +0700 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Jan 11 12:31:12 2024 +0100 [KERNEL32] OpenFile(): Use InitializeObjectAttributes (#6323) Use InitializeObjectAttributes macro instead of initializing the members manually. --- dll/win32/kernel32/client/file/create.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dll/win32/kernel32/client/file/create.c b/dll/win32/kernel32/client/file/create.c index ec6411e4ec2..9a9c97d6839 100644 --- a/dll/win32/kernel32/client/file/create.c +++ b/dll/win32/kernel32/client/file/create.c @@ -513,12 +513,11 @@ OpenFile(LPCSTR lpFileName, // FILE_SHARE_READ // FILE_NO_INTERMEDIATE_BUFFERING - ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES); - ObjectAttributes.RootDirectory = NULL; - ObjectAttributes.ObjectName = &FileNameString; - ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE| OBJ_INHERIT; - ObjectAttributes.SecurityDescriptor = NULL; - ObjectAttributes.SecurityQualityOfService = NULL; + InitializeObjectAttributes(&ObjectAttributes, + &FileNameString, + OBJ_CASE_INSENSITIVE | OBJ_INHERIT, + NULL, + NULL); errCode = NtOpenFile (&FileHandle, GENERIC_READ | SYNCHRONIZE,
11 months, 2 weeks
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
19
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Results per page:
10
25
50
100
200