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
September 2023
----- 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
23 participants
113 discussions
Start a n
N
ew thread
[reactos] 01/01: [SDK][CRT][MSVCRT] Implement _CrtSetReportMode and _CrtSetReportFile (#5662)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=85377ee3dbe2373d40dc4…
commit 85377ee3dbe2373d40dc401b1d6349c391cd9d94 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Sep 11 04:37:27 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Sep 11 04:37:27 2023 +0900 [SDK][CRT][MSVCRT] Implement _CrtSetReportMode and _CrtSetReportFile (#5662) - Implement reporting to file. CORE-11835, CORE-15517, ROSTESTS-386 --- dll/win32/msvcrt/msvcrt.spec | 8 +++--- sdk/include/crt/crtdbg.h | 9 ++++--- sdk/lib/crt/misc/dbgrpt.cpp | 60 +++++++++++++++++++++++++++++++++++++++----- sdk/lib/crt/misc/misc.cmake | 1 + 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/dll/win32/msvcrt/msvcrt.spec b/dll/win32/msvcrt/msvcrt.spec index e80a290e2fd..9f2c5a55eb6 100644 --- a/dll/win32/msvcrt/msvcrt.spec +++ b/dll/win32/msvcrt/msvcrt.spec @@ -199,9 +199,9 @@ @ cdecl -arch=i386 _CItanh() @ stub -version=0x600+ _CrtCheckMemory @ stub -version=0x600+ _CrtDbgBreak -@ stub -version=0x600+ _CrtDbgReport +@ cdecl -version=0x600+ _CrtDbgReport(long str long str str) @ stub -version=0x600+ _CrtDbgReportV -@ stub -version=0x600+ _CrtDbgReportW +@ cdecl -version=0x600+ _CrtDbgReportW(long wstr long wstr wstr) @ stub -version=0x600+ _CrtDbgReportWV @ stub -version=0x600+ _CrtDoForAllClientObjects @ stub -version=0x600+ _CrtDumpMemoryLeaks @@ -218,10 +218,10 @@ @ stub -version=0x600+ _CrtSetDbgBlockType @ stub -version=0x600+ _CrtSetDbgFlag @ stub -version=0x600+ _CrtSetDumpClient -@ stub -version=0x600+ _CrtSetReportFile +@ cdecl -version=0x600+ _CrtSetReportFile(long ptr) @ stub -version=0x600+ _CrtSetReportHook @ stub -version=0x600+ _CrtSetReportHook2 -@ stub -version=0x600+ _CrtSetReportMode +@ cdecl -version=0x600+ _CrtSetReportMode(long long) @ stdcall _CxxThrowException(long long) @ cdecl -arch=i386 -norelay _EH_prolog() @ cdecl _Getdays() diff --git a/sdk/include/crt/crtdbg.h b/sdk/include/crt/crtdbg.h index 3a20d5316fb..f9545698e89 100644 --- a/sdk/include/crt/crtdbg.h +++ b/sdk/include/crt/crtdbg.h @@ -91,8 +91,6 @@ extern "C" { #endif - - // Assertion and error reporting #ifndef _DEBUG @@ -124,6 +122,8 @@ extern "C" { #define _RPTFW0(rptno,msg) #define _RPTFWN(rptno,msg,...) + #define _CrtSetReportMode(t,f) ((int)0) + #define _CrtSetReportFile(t,f) ((_HFILE)0) #else // _DEBUG @@ -161,6 +161,9 @@ extern "C" { #define _RPTFW0(rptno,msg) _RPT_BASEW(rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, L"%s", msg) #define _RPTFWN(rptno,msg,...) _RPT_BASEW(rptno, _CRT_WIDE(__FILE__), __LINE__, NULL, msg, __VA_ARGS__) + int __cdecl _CrtSetReportMode(int reportType, int reportMode); + _HFILE __cdecl _CrtSetReportFile(int reportType, _HFILE reportFile); + #endif @@ -230,8 +233,6 @@ extern "C" { #define _CrtGetReportHook() ((_CRT_REPORT_HOOK)0) #define _CrtSetReportHook2(t,f) ((int)0) #define _CrtSetReportHookW2(t,f) ((int)0) -#define _CrtSetReportMode(t,f) ((int)0) -#define _CrtSetReportFile(t,f) ((_HFILE)0) #define _CrtSetBreakAlloc(a) ((long)0) #define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0) diff --git a/sdk/lib/crt/misc/dbgrpt.cpp b/sdk/lib/crt/misc/dbgrpt.cpp index dbb1ebbc966..131a918a2e2 100644 --- a/sdk/lib/crt/misc/dbgrpt.cpp +++ b/sdk/lib/crt/misc/dbgrpt.cpp @@ -16,6 +16,8 @@ #include <windows.h> #undef OutputDebugString +#undef _CrtSetReportMode +#undef _CrtSetReportFile #define DBGRPT_MAX_BUFFER_SIZE 4096 #define DBGRPT_ASSERT_PREFIX_MESSAGE "Assertion failed: " @@ -38,6 +40,13 @@ static const wchar_t* _CrtModeMessages[_CRT_ERRCNT] = L"Error", L"Assertion Failed" }; +// Report files +static _HFILE _CrtReportFiles[_CRT_ERRCNT] = +{ + _CRTDBG_INVALID_HFILE, + _CRTDBG_INVALID_HFILE, + _CRTDBG_INVALID_HFILE +}; // Manually delay-load as to not have a dependency on user32 typedef int (WINAPI *tMessageBoxW)(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType); @@ -57,6 +66,7 @@ struct dbgrpt_char_traits<char> static const char_t* szUnknownFile; static void OutputDebugString(const char_t* message); + static size_t StringLength(const char_t* str) { return strlen(str); } }; template<> @@ -69,13 +79,13 @@ struct dbgrpt_char_traits<wchar_t> static const char_t* szUnknownFile; static void OutputDebugString(const char_t* message); + static size_t StringLength(const char_t* str) { return wcslen(str); }; }; // Shortcut typedef dbgrpt_char_traits<char> achar_traits; typedef dbgrpt_char_traits<wchar_t> wchar_traits; - const wchar_t* achar_traits::szAssertionMessage = L"Debug %s!\n" L"%s%hs" /* module */ @@ -97,17 +107,16 @@ const wchar_traits::char_t* wchar_traits::szEmptyString = L""; const achar_traits::char_t* achar_traits::szUnknownFile = "<unknown file>"; const wchar_traits::char_t* wchar_traits::szUnknownFile = L"<unknown file>"; -void achar_traits::OutputDebugString(const char* message) +inline void achar_traits::OutputDebugString(const char* message) { OutputDebugStringA(message); } -void wchar_traits::OutputDebugString(const wchar_t* message) +inline void wchar_traits::OutputDebugString(const wchar_t* message) { OutputDebugStringW(message); } - static HMODULE _CrtGetUser32() { @@ -221,6 +230,46 @@ void _CrtLeaveDbgReport(int reportType) _InterlockedDecrement(&_CrtInAssert); } +EXTERN_C +int __cdecl _CrtSetReportMode(int reportType, int reportMode) +{ + if (reportType >= _CRT_ERRCNT || reportType < 0) + return 0; + + int oldReportMode = _CrtModeOutputFormat[reportType]; + if (reportMode != _CRTDBG_REPORT_MODE) + _CrtModeOutputFormat[reportType] = reportMode; + return oldReportMode; +} + +EXTERN_C +_HFILE __cdecl _CrtSetReportFile(int reportType, _HFILE reportFile) +{ + if (reportType >= _CRT_ERRCNT || reportType < 0) + return NULL; + + _HFILE oldReportFile = _CrtReportFiles[reportType]; + if (reportFile != _CRTDBG_REPORT_FILE) + _CrtReportFiles[reportType] = reportFile; + return oldReportFile; +} + +template <typename char_t> +static inline BOOL _CrtDbgReportToFile(HANDLE hFile, const char_t* szMsg) +{ + typedef dbgrpt_char_traits<char_t> traits; + + if (hFile == _CRTDBG_INVALID_HFILE || hFile == NULL) + return FALSE; + + if (hFile == _CRTDBG_FILE_STDOUT) + hFile = ::GetStdHandle(STD_OUTPUT_HANDLE); + else if (hFile == _CRTDBG_FILE_STDERR) + hFile = ::GetStdHandle(STD_ERROR_HANDLE); + + DWORD cbMsg = (DWORD)(traits::StringLength(szMsg) * sizeof(char_t)); + return ::WriteFile(hFile, szMsg, cbMsg, &cbMsg, NULL); +} template <typename char_t> static int _CrtHandleDbgReport(int reportType, const char_t* szCompleteMessage, const char_t* szFormatted, @@ -230,8 +279,7 @@ static int _CrtHandleDbgReport(int reportType, const char_t* szCompleteMessage, if (_CrtModeOutputFormat[reportType] & _CRTDBG_MODE_FILE) { - OutputDebugStringA("ERROR: Please implement _CrtSetReportFile first\n"); - _CrtDbgBreak(); + _CrtDbgReportToFile<char_t>(_CrtReportFiles[reportType], szCompleteMessage); } if (_CrtModeOutputFormat[reportType] & _CRTDBG_MODE_DEBUG) diff --git a/sdk/lib/crt/misc/misc.cmake b/sdk/lib/crt/misc/misc.cmake index d5cea9dd5cc..7b8bb4c9efd 100644 --- a/sdk/lib/crt/misc/misc.cmake +++ b/sdk/lib/crt/misc/misc.cmake @@ -15,6 +15,7 @@ list(APPEND CRT_MISC_SOURCE misc/amsg.c misc/assert.c misc/crt_init.c + misc/dbgrpt.cpp misc/environ.c misc/getargs.c misc/i10output.c
1 year, 3 months
1
0
0
0
[reactos] 01/01: [MSPAINT] Use wait cursor (#5660)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=993a45024e5e9467d5dda…
commit 993a45024e5e9467d5dda67dd4c5532463e883f6 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Sep 10 22:28:28 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Sep 10 22:28:28 2023 +0900 [MSPAINT] Use wait cursor (#5660) - Implement CWaitCursor class in newly-added "waitcursor.h". - Use CWaitCursor to manage the wait cursor. - Improve WM_SETCURSOR handlings. CORE-19094 --- base/applications/mspaint/canvas.cpp | 6 +++ base/applications/mspaint/dib.cpp | 16 ++++++++ base/applications/mspaint/precomp.h | 1 + base/applications/mspaint/textedit.cpp | 6 +++ base/applications/mspaint/waitcursor.h | 54 +++++++++++++++++++++++++++ base/applications/mspaint/winproc.cpp | 67 ++++++++++++++++++---------------- 6 files changed, 119 insertions(+), 31 deletions(-) diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp index 3568657a21f..186b88dc044 100644 --- a/base/applications/mspaint/canvas.cpp +++ b/base/applications/mspaint/canvas.cpp @@ -635,6 +635,12 @@ LRESULT CCanvasWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { + if (CWaitCursor::IsWaiting()) + { + bHandled = FALSE; + return 0; + } + POINT pt; ::GetCursorPos(&pt); ScreenToClient(&pt); diff --git a/base/applications/mspaint/dib.cpp b/base/applications/mspaint/dib.cpp index e770f5494d0..ee899c74e98 100644 --- a/base/applications/mspaint/dib.cpp +++ b/base/applications/mspaint/dib.cpp @@ -151,6 +151,8 @@ GetDIBHeight(HBITMAP hBitmap) BOOL SaveDIBToFile(HBITMAP hBitmap, LPCWSTR FileName, BOOL fIsMainFile, REFGUID guidFileType) { + CWaitCursor waitCursor; + CImageDx img; img.Attach(hBitmap); HRESULT hr = img.SaveDx(FileName, guidFileType, g_xDpi, g_yDpi); @@ -250,6 +252,8 @@ HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFoun HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile) { + CWaitCursor waitCursor; + // find the file WIN32_FIND_DATA find; HANDLE hFind = ::FindFirstFileW(name, &find); @@ -341,6 +345,8 @@ HBITMAP Rotate90DegreeBlt(HDC hDC1, INT cx, INT cy, BOOL bRight, BOOL bMono) HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono) { + CWaitCursor waitCursor; + if (nDegree == 0) return CopyDIBImage(hbm); @@ -402,6 +408,8 @@ struct BITMAPINFODX : BITMAPINFO HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap) { + CWaitCursor waitCursor; + BITMAP bm; if (!GetObject(hBitmap, sizeof(BITMAP), &bm)) return NULL; @@ -463,6 +471,8 @@ HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap) HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal) { + CWaitCursor waitCursor; + LPBYTE pb = (LPBYTE)GlobalLock(hGlobal); if (!pb) return NULL; @@ -508,6 +518,8 @@ HBITMAP BitmapFromClipboardDIB(HGLOBAL hGlobal) HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF) { + CWaitCursor waitCursor; + ENHMETAHEADER header; if (!GetEnhMetaFileHeader(hEMF, sizeof(header), &header)) return NULL; @@ -529,6 +541,8 @@ HBITMAP BitmapFromHEMF(HENHMETAFILE hEMF) BOOL IsBitmapBlackAndWhite(HBITMAP hbm) { + CWaitCursor waitCursor; + BITMAP bm; if (!::GetObjectW(hbm, sizeof(bm), &bm)) return FALSE; @@ -578,6 +592,8 @@ Finish: HBITMAP ConvertToBlackAndWhite(HBITMAP hbm) { + CWaitCursor waitCursor; + BITMAP bm; if (!::GetObject(hbm, sizeof(bm), &bm)) return NULL; diff --git a/base/applications/mspaint/precomp.h b/base/applications/mspaint/precomp.h index 385cc985a4f..0c1d6b33ba8 100644 --- a/base/applications/mspaint/precomp.h +++ b/base/applications/mspaint/precomp.h @@ -50,6 +50,7 @@ #include "toolsmodel.h" #include "winproc.h" #include "dialogs.h" +#include "waitcursor.h" #include "globalvar.h" #endif /* _MSPAINT_H */ diff --git a/base/applications/mspaint/textedit.cpp b/base/applications/mspaint/textedit.cpp index e5b51aa3de3..376b1214045 100644 --- a/base/applications/mspaint/textedit.cpp +++ b/base/applications/mspaint/textedit.cpp @@ -187,6 +187,12 @@ LRESULT CTextEditWindow::OnNCHitTest(UINT nMsg, WPARAM wParam, LPARAM lParam, BO LRESULT CTextEditWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { + if (CWaitCursor::IsWaiting()) + { + bHandled = FALSE; + return 0; + } + UINT nHitTest = LOWORD(lParam); if (nHitTest == HTCAPTION) { diff --git a/base/applications/mspaint/waitcursor.h b/base/applications/mspaint/waitcursor.h new file mode 100644 index 00000000000..20269ed16eb --- /dev/null +++ b/base/applications/mspaint/waitcursor.h @@ -0,0 +1,54 @@ +/* + * PROJECT: PAINT for ReactOS + * LICENSE: LGPL-2.0-or-later (
https://spdx.org/licenses/LGPL-2.0-or-later
) + * PURPOSE: Wait cursor management + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +#pragma once + +class CWaitCursor +{ +public: + CWaitCursor() + { + if (s_nLock++ == 0) + { + if (!s_hWaitCursor) + s_hWaitCursor = ::LoadCursor(NULL, IDC_WAIT); + s_hOldCursor = ::SetCursor(s_hWaitCursor); + } + else + { + ::SetCursor(s_hWaitCursor); + } + } + ~CWaitCursor() + { + if (--s_nLock == 0) + { + ::SetCursor(s_hOldCursor); + s_hOldCursor = NULL; + } + } + CWaitCursor(const CWaitCursor&) = delete; + CWaitCursor& operator=(const CWaitCursor&) = delete; + + static BOOL IsWaiting() + { + return s_nLock > 0; + } + static void KeepWait() + { + ::SetCursor(s_hWaitCursor); + } + +protected: + static LONG s_nLock; + static HCURSOR s_hOldCursor; + static HCURSOR s_hWaitCursor; +}; + +DECLSPEC_SELECTANY LONG CWaitCursor::s_nLock = 0; +DECLSPEC_SELECTANY HCURSOR CWaitCursor::s_hOldCursor = NULL; +DECLSPEC_SELECTANY HCURSOR CWaitCursor::s_hWaitCursor = NULL; diff --git a/base/applications/mspaint/winproc.cpp b/base/applications/mspaint/winproc.cpp index 3db01639a34..c85b61b10c3 100644 --- a/base/applications/mspaint/winproc.cpp +++ b/base/applications/mspaint/winproc.cpp @@ -911,44 +911,48 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH imageModel.NotifyImageChanged(); break; case IDM_IMAGEROTATEMIRROR: - switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd)) { - case 1: /* flip horizontally */ - if (selectionModel.m_bShow) - selectionModel.FlipHorizontally(); - else - imageModel.FlipHorizontally(); - break; - case 2: /* flip vertically */ - if (selectionModel.m_bShow) - selectionModel.FlipVertically(); - else - imageModel.FlipVertically(); - break; - case 3: /* rotate 90 degrees */ - if (selectionModel.m_bShow) - selectionModel.RotateNTimes90Degrees(1); - else - imageModel.RotateNTimes90Degrees(1); - break; - case 4: /* rotate 180 degrees */ - if (selectionModel.m_bShow) - selectionModel.RotateNTimes90Degrees(2); - else - imageModel.RotateNTimes90Degrees(2); - break; - case 5: /* rotate 270 degrees */ - if (selectionModel.m_bShow) - selectionModel.RotateNTimes90Degrees(3); - else - imageModel.RotateNTimes90Degrees(3); - break; + CWaitCursor waitCursor; + switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd)) + { + case 1: /* flip horizontally */ + if (selectionModel.m_bShow) + selectionModel.FlipHorizontally(); + else + imageModel.FlipHorizontally(); + break; + case 2: /* flip vertically */ + if (selectionModel.m_bShow) + selectionModel.FlipVertically(); + else + imageModel.FlipVertically(); + break; + case 3: /* rotate 90 degrees */ + if (selectionModel.m_bShow) + selectionModel.RotateNTimes90Degrees(1); + else + imageModel.RotateNTimes90Degrees(1); + break; + case 4: /* rotate 180 degrees */ + if (selectionModel.m_bShow) + selectionModel.RotateNTimes90Degrees(2); + else + imageModel.RotateNTimes90Degrees(2); + break; + case 5: /* rotate 270 degrees */ + if (selectionModel.m_bShow) + selectionModel.RotateNTimes90Degrees(3); + else + imageModel.RotateNTimes90Degrees(3); + break; + } } break; case IDM_IMAGEATTRIBUTES: { if (attributesDialog.DoModal(mainWindow.m_hWnd)) { + CWaitCursor waitCursor; if (attributesDialog.m_bBlackAndWhite && !imageModel.IsBlackAndWhite()) { CString strText(MAKEINTRESOURCE(IDS_LOSECOLOR)); @@ -972,6 +976,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH { if (stretchSkewDialog.DoModal(mainWindow.m_hWnd)) { + CWaitCursor waitCursor; if (selectionModel.m_bShow) { selectionModel.StretchSkew(stretchSkewDialog.percentage.x, stretchSkewDialog.percentage.y,
1 year, 3 months
1
0
0
0
[reactos] 01/01: [NOTEPAD] Use wait cursor (#5659)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ef9cfb04e819a88bf4d5…
commit 0ef9cfb04e819a88bf4d5721cce0800193824e02 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Sep 10 22:27:16 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Sep 10 22:27:16 2023 +0900 [NOTEPAD] Use wait cursor (#5659) - Add WaitCursor helper function to display the wait cursor while heavy operation. - Manage the wait cursor by using a lock count. CORE-18837 --- base/applications/notepad/dialog.c | 43 ++++++++++++++++++++++++++++++++++++++ base/applications/notepad/dialog.h | 1 + base/applications/notepad/main.c | 6 +++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/base/applications/notepad/dialog.c b/base/applications/notepad/dialog.c index 111d0428a1d..82c6c5c57bc 100644 --- a/base/applications/notepad/dialog.c +++ b/base/applications/notepad/dialog.c @@ -111,6 +111,33 @@ void UpdateWindowCaption(BOOL clearModifyAlert) SetWindowText(Globals.hMainWnd, szCaption); } +VOID WaitCursor(BOOL bBegin) +{ + static HCURSOR s_hWaitCursor = NULL; + static HCURSOR s_hOldCursor = NULL; + static INT s_nLock = 0; + + if (bBegin) + { + if (s_nLock++ == 0) + { + if (s_hWaitCursor == NULL) + s_hWaitCursor = LoadCursor(NULL, IDC_WAIT); + s_hOldCursor = SetCursor(s_hWaitCursor); + } + else + { + SetCursor(s_hWaitCursor); + } + } + else + { + if (--s_nLock == 0) + SetCursor(s_hOldCursor); + } +} + + VOID DIALOG_StatusBarAlignParts(VOID) { static const int defaultWidths[] = {120, 120, 120}; @@ -220,11 +247,14 @@ static BOOL DoSaveFile(VOID) HANDLE hFile; DWORD cchText; + WaitCursor(TRUE); + hFile = CreateFileW(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { ShowLastError(); + WaitCursor(FALSE); return FALSE; } @@ -259,6 +289,7 @@ static BOOL DoSaveFile(VOID) SetFileName(Globals.szFileName); } + WaitCursor(FALSE); return bRet; } @@ -307,6 +338,8 @@ VOID DoOpenFile(LPCTSTR szFileName) if (!DoCloseFile()) return; + WaitCursor(TRUE); + hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -347,6 +380,7 @@ VOID DoOpenFile(LPCTSTR szFileName) done: if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); + WaitCursor(FALSE); } VOID DIALOG_FileNew(VOID) @@ -355,6 +389,8 @@ VOID DIALOG_FileNew(VOID) if (!DoCloseFile()) return; + WaitCursor(TRUE); + SetWindowText(Globals.hEdit, NULL); SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0); Globals.iEoln = EOLN_CRLF; @@ -362,13 +398,20 @@ VOID DIALOG_FileNew(VOID) NOTEPAD_EnableSearchMenu(); DIALOG_StatusBarUpdateAll(); + + WaitCursor(FALSE); } VOID DIALOG_FileNewWindow(VOID) { TCHAR pszNotepadExe[MAX_PATH]; + + WaitCursor(TRUE); + GetModuleFileName(NULL, pszNotepadExe, _countof(pszNotepadExe)); ShellExecute(NULL, NULL, pszNotepadExe, NULL, NULL, SW_SHOWNORMAL); + + WaitCursor(FALSE); } VOID DIALOG_FileOpen(VOID) diff --git a/base/applications/notepad/dialog.h b/base/applications/notepad/dialog.h index c9681df92f0..7b62a58063a 100644 --- a/base/applications/notepad/dialog.h +++ b/base/applications/notepad/dialog.h @@ -57,3 +57,4 @@ VOID DoOpenFile(LPCTSTR szFileName); VOID DoShowHideStatusBar(VOID); VOID DoCreateEditWindow(VOID); void UpdateWindowCaption(BOOL clearModifyAlert); +VOID WaitCursor(BOOL bBegin); diff --git a/base/applications/notepad/main.c b/base/applications/notepad/main.c index 599ad5c60df..77100a2e26a 100644 --- a/base/applications/notepad/main.c +++ b/base/applications/notepad/main.c @@ -433,6 +433,8 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) FINDREPLACE *pFindReplace = (FINDREPLACE *) lParam; Globals.find = *(FINDREPLACE *) lParam; + WaitCursor(TRUE); + if (pFindReplace->Flags & FR_FINDNEXT) NOTEPAD_FindNext(pFindReplace, FALSE, TRUE); else if (pFindReplace->Flags & FR_REPLACE) @@ -441,6 +443,8 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) NOTEPAD_ReplaceAll(pFindReplace); else if (pFindReplace->Flags & FR_DIALOGTERM) NOTEPAD_FindTerm(); + + WaitCursor(FALSE); break; } @@ -587,7 +591,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int sh wndclass.lpfnWndProc = NOTEPAD_WndProc; wndclass.hInstance = Globals.hInstance; wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_NPICON)); - wndclass.hCursor = LoadCursor(0, IDC_ARROW); + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndclass.lpszMenuName = MAKEINTRESOURCE(MAIN_MENU); wndclass.lpszClassName = className;
1 year, 3 months
1
0
0
0
[reactos] 02/02: [KERNEL32_APITEST] Improve InitOnce test
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7497f028f4adaef0eb26a…
commit 7497f028f4adaef0eb26abe6206c07396efe8bde Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Sep 8 11:51:41 2023 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Sep 10 14:58:54 2023 +0300 [KERNEL32_APITEST] Improve InitOnce test --- modules/rostests/apitests/kernel32/InitOnce.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/rostests/apitests/kernel32/InitOnce.c b/modules/rostests/apitests/kernel32/InitOnce.c index 66014197f96..1d20dc445a2 100644 --- a/modules/rostests/apitests/kernel32/InitOnce.c +++ b/modules/rostests/apitests/kernel32/InitOnce.c @@ -154,6 +154,7 @@ _test_sync: /* Re-initialize One-Time initialization structure by using INIT_ONCE_STATIC_INIT */ InitOnce = (INIT_ONCE)INIT_ONCE_STATIC_INIT; + ulContextData = 0xdeadbeef; /* Perform synchronous initialization by using InitOnceBeginInitialize */ fPending = FALSE; @@ -169,6 +170,16 @@ _test_sync: goto _test_async; } + /* Call again to check whether initialization has completed */ + fPending = 0xdeadbeef; + bRet = pfnInitOnceBeginInitialize(&InitOnce, + INIT_ONCE_CHECK_ONLY, + &fPending, + (LPVOID*)&ulContextData); + ok(bRet == FALSE, "InitOnceBeginInitialize should fail\n"); + ok(fPending == 0xdeadbeef, "fPending should be unmodified\n"); + ok(ulContextData == 0xdeadbeef, "ulContextData should be unmodified\n"); + /* Complete the initialization */ InitWorker(&ulInitCount, &ulTempContext); bRet = pfnInitOnceComplete(&InitOnce, 0, (LPVOID)ulTempContext);
1 year, 3 months
1
0
0
0
[reactos] 01/02: [KERNEL32_APITEST] Fix stack corruption in InitOnce test on x64
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6286475d711a4348df057…
commit 6286475d711a4348df05750df8ee6d22b6eeaea0 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Sep 8 11:51:00 2023 +0300 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Sep 10 14:58:54 2023 +0300 [KERNEL32_APITEST] Fix stack corruption in InitOnce test on x64 --- modules/rostests/apitests/kernel32/InitOnce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/rostests/apitests/kernel32/InitOnce.c b/modules/rostests/apitests/kernel32/InitOnce.c index 586e87bac9d..66014197f96 100644 --- a/modules/rostests/apitests/kernel32/InitOnce.c +++ b/modules/rostests/apitests/kernel32/InitOnce.c @@ -72,8 +72,8 @@ InitOnceProc( START_TEST(InitOnce) { BOOL bRet, fPending; - ULONG i, ulInitCount, ulSeed, ulContextData; - ULONG_PTR ulTempContext; + ULONG i, ulInitCount, ulSeed; + ULONG_PTR ulContextData, ulTempContext; DWORD dwError; HMODULE hKernel32;
1 year, 3 months
1
0
0
0
[reactos] 01/01: [GETUNAME] Build only english on DBG builds (#5670)
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4459b4f42be00a869f833…
commit 4459b4f42be00a869f833fd7bc5f1fe165f00eff Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sun Sep 10 14:43:41 2023 +0300 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Sep 10 14:43:41 2023 +0300 [GETUNAME] Build only english on DBG builds (#5670) This massively cuts down build time on MSVC builds. Co-authored-by: Stanislav Motylkov <x86corez(a)gmail.com> --- dll/win32/getuname/getuname.rc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dll/win32/getuname/getuname.rc b/dll/win32/getuname/getuname.rc index ef05599696e..a326803e90e 100644 --- a/dll/win32/getuname/getuname.rc +++ b/dll/win32/getuname/getuname.rc @@ -9,6 +9,10 @@ /* UTF-8 */ #pragma code_page(65001) +/* Only use english on debug builds to reduce compile time */ +#if DBG + #include "lang/en-US.rc" +#else #ifdef LANGUAGE_DE_DE #include "lang/de-DE.rc" #endif @@ -39,3 +43,4 @@ #ifdef LANGUAGE_ZH_TW #include "lang/zh-TW.rc" #endif +#endif /* DBG */
1 year, 3 months
1
0
0
0
[reactos] 01/01: [NDK] mmtypes.h: Fix a copypasta in a comment
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a1ee35bdb225da2463ed1…
commit a1ee35bdb225da2463ed12dea7eca2e111d15840 Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr> AuthorDate: Sun Sep 3 14:33:43 2023 +0200 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sun Sep 10 13:30:11 2023 +0300 [NDK] mmtypes.h: Fix a copypasta in a comment --- sdk/include/ndk/mmtypes.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sdk/include/ndk/mmtypes.h b/sdk/include/ndk/mmtypes.h index f33d5cc8b14..56e918d5c2f 100644 --- a/sdk/include/ndk/mmtypes.h +++ b/sdk/include/ndk/mmtypes.h @@ -79,6 +79,7 @@ extern "C" { #define MEM_EXECUTE_OPTION_VALID_FLAGS 0x3F #ifndef NTOS_MODE_USER + // // Virtual Memory Flags // @@ -100,11 +101,13 @@ extern "C" { #define SEC_NOCACHE 0x10000000 #define SEC_WRITECOMBINE 0x40000000 #define SEC_LARGE_PAGES 0x80000000 -#else + +#else // NTOS_MODE_USER + #define SEC_BASED 0x200000 // -// Section Inherit Flags for NtCreateSection +// Section Inherit Flags for NtMapViewOfSection // typedef enum _SECTION_INHERIT { @@ -139,7 +142,8 @@ typedef enum _POOL_TYPE PagedPoolCacheAlignedSession, NonPagedPoolCacheAlignedMustSSession } POOL_TYPE; -#endif + +#endif // NTOS_MODE_USER // // Memory Manager Page Lists @@ -208,7 +212,6 @@ typedef enum _MI_VAD_TYPE } MI_VAD_TYPE, *PMI_VAD_TYPE; #ifdef NTOS_MODE_USER - // // Virtual Memory Counters //
1 year, 3 months
1
0
0
0
[reactos] 01/01: [WIN32K:NTUSER] Avoid TOCTOU in ProbeAndCaptureUnicodeStringOrAtom.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9212e4a72a45b04ddd13…
commit f9212e4a72a45b04ddd13fca63fb90c78eebf053 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat Sep 9 08:59:57 2023 -0400 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Sat Sep 9 17:50:49 2023 -0400 [WIN32K:NTUSER] Avoid TOCTOU in ProbeAndCaptureUnicodeStringOrAtom. --- win32ss/user/ntuser/class.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/win32ss/user/ntuser/class.c b/win32ss/user/ntuser/class.c index 90746db3da2..548bef255e6 100644 --- a/win32ss/user/ntuser/class.c +++ b/win32ss/user/ntuser/class.c @@ -152,32 +152,35 @@ ProbeAndCaptureUnicodeStringOrAtom( __in_data_source(USER_MODE) _In_ PUNICODE_STRING pustrUnsafe) { NTSTATUS Status = STATUS_SUCCESS; + UNICODE_STRING ustrCopy; /* Default to NULL */ - pustrOut->Buffer = NULL; + RtlInitEmptyUnicodeString(pustrOut, NULL, 0); _SEH2_TRY { ProbeForRead(pustrUnsafe, sizeof(UNICODE_STRING), 1); + ustrCopy = *pustrUnsafe; + /* Validate the string */ - if ((pustrUnsafe->Length & 1) || (pustrUnsafe->Buffer == NULL)) + if ((ustrCopy.Length & 1) || (ustrCopy.Buffer == NULL)) { /* This is not legal */ _SEH2_YIELD(return STATUS_INVALID_PARAMETER); } /* Check if this is an atom */ - if (IS_ATOM(pustrUnsafe->Buffer)) + if (IS_ATOM(ustrCopy.Buffer)) { /* Copy the atom, length is 0 */ pustrOut->MaximumLength = pustrOut->Length = 0; - pustrOut->Buffer = pustrUnsafe->Buffer; + pustrOut->Buffer = ustrCopy.Buffer; } else { /* Get the length, maximum length includes zero termination */ - pustrOut->Length = pustrUnsafe->Length; + pustrOut->Length = ustrCopy.Length; pustrOut->MaximumLength = pustrOut->Length + sizeof(WCHAR); /* Allocate a buffer */ @@ -190,8 +193,8 @@ ProbeAndCaptureUnicodeStringOrAtom( } /* Copy the string and zero terminate it */ - ProbeForRead(pustrUnsafe->Buffer, pustrOut->Length, 1); - RtlCopyMemory(pustrOut->Buffer, pustrUnsafe->Buffer, pustrOut->Length); + ProbeForRead(ustrCopy.Buffer, pustrOut->Length, 1); + RtlCopyMemory(pustrOut->Buffer, ustrCopy.Buffer, pustrOut->Length); pustrOut->Buffer[pustrOut->Length / sizeof(WCHAR)] = L'\0'; } }
1 year, 3 months
1
0
0
0
[reactos] 01/01: [MESA] Change reported OpenGL version to 1.1.0 (#5675)
by Belle Aerni
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce43bf6ba735dfb145d11…
commit ce43bf6ba735dfb145d11ebfca24ecaae6d63fef Author: Belle Aerni <belleaerni(a)gmail.com> AuthorDate: Sat Sep 9 12:30:44 2023 -0700 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Sep 9 22:30:44 2023 +0300 [MESA] Change reported OpenGL version to 1.1.0 (#5675) Fixes failing opengl32:sw_extensions test. The test expects version `1.1.0` which is what Windows reports, and ReactOS Mesa3D was reporting just `1.1`. --- dll/opengl/mesa/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dll/opengl/mesa/misc.c b/dll/opengl/mesa/misc.c index 0762d184a02..ccc60073019 100644 --- a/dll/opengl/mesa/misc.c +++ b/dll/opengl/mesa/misc.c @@ -313,7 +313,7 @@ const GLubyte *gl_GetString( GLcontext *ctx, GLenum name ) { static char renderer[1000]; static char *vendor = "Brian Paul & ReactOS Developers"; - static char *version = "1.1"; + static char *version = "1.1.0"; static char *extensions = "GL_EXT_paletted_texture GL_EXT_bgra GL_WIN_swap_hint"; if (INSIDE_BEGIN_END(ctx)) {
1 year, 3 months
1
0
0
0
[reactos] 01/01: [NTUSER] Reduce debug logging spam (#5661)
by Julio Carchi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4976fba59e32a03113ed0…
commit 4976fba59e32a03113ed01da2aff8e181b1b0013 Author: Julio Carchi <juliocarchi(a)yahoo.com> AuthorDate: Sat Sep 9 14:28:19 2023 -0500 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Sep 9 22:28:19 2023 +0300 [NTUSER] Reduce debug logging spam (#5661) Silence two of the most debug log spammers in co_MsqSendMessage() and in co_IntProcessMouseMessage() by demoting ERR to WARN. --- win32ss/user/ntuser/msgqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index 8c24de79853..7f308530749 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -1263,7 +1263,7 @@ co_MsqSendMessage(PTHREADINFO ptirec, Entry = Entry->Flink; } - ERR("MsqSendMessage timed out 2 Status %lx\n", WaitStatus); + WARN("MsqSendMessage timed out 2 Status %lx\n", WaitStatus); break; } // Receiving thread passed on and left us hanging with issues still pending. @@ -1535,7 +1535,7 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, BOOL* NotForUs, L } else { - ERR("Not the same cursor!\n"); + WARN("Not the same cursor!\n"); } msg->hwnd = UserHMGetHandle(pwndMsg);
1 year, 3 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
12
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
Results per page:
10
25
50
100
200