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
November 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
20 participants
274 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSPAINT] Add selectionModel.hitTest and use it
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c2bb5aa01d5b66e8d7852…
commit c2bb5aa01d5b66e8d7852c334e776433adac8f33 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Nov 23 10:31:24 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Nov 23 10:31:24 2023 +0900 [MSPAINT] Add selectionModel.hitTest and use it Refactoring. CORE-19094 --- base/applications/mspaint/canvas.cpp | 17 ++--------------- base/applications/mspaint/canvas.h | 1 - base/applications/mspaint/selectionmodel.cpp | 11 +++++++++++ base/applications/mspaint/selectionmodel.h | 1 + 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp index 99f1abf772b..99be275fd02 100644 --- a/base/applications/mspaint/canvas.cpp +++ b/base/applications/mspaint/canvas.cpp @@ -317,7 +317,7 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO return 0; } - HITTEST hitSelection = SelectionHitTest(pt); + HITTEST hitSelection = selectionModel.hitTest(pt); if (hitSelection != HIT_NONE) { selectionModel.m_nSelectionBrush = 0; // Selection Brush is OFF @@ -634,7 +634,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL return 0; } - HITTEST hitSelection = SelectionHitTest(pt); + HITTEST hitSelection = selectionModel.hitTest(pt); if (hitSelection != HIT_NONE) { if (!setCursorOnSizeBox(hitSelection)) @@ -746,19 +746,6 @@ VOID CCanvasWindow::finishDrawing() Invalidate(FALSE); } -HITTEST CCanvasWindow::SelectionHitTest(POINT ptImage) -{ - if (!selectionModel.m_bShow) - return HIT_NONE; - - RECT rcSelection = selectionModel.m_rc; - Zoomed(rcSelection); - ::OffsetRect(&rcSelection, GRIP_SIZE - GetScrollPos(SB_HORZ), GRIP_SIZE - GetScrollPos(SB_VERT)); - ::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE); - - return getSizeBoxHitTest(ptImage, &rcSelection); -} - VOID CCanvasWindow::StartSelectionDrag(HITTEST hit, POINT ptImage) { m_hitSelection = hit; diff --git a/base/applications/mspaint/canvas.h b/base/applications/mspaint/canvas.h index e275e97a4d3..d65be1df606 100644 --- a/base/applications/mspaint/canvas.h +++ b/base/applications/mspaint/canvas.h @@ -68,7 +68,6 @@ protected: VOID DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint); VOID OnHVScroll(WPARAM wParam, INT fnBar); - HITTEST SelectionHitTest(POINT ptImage); VOID StartSelectionDrag(HITTEST hit, POINT ptImage); VOID SelectionDragging(POINT ptImage); VOID EndSelectionDrag(POINT ptImage); diff --git a/base/applications/mspaint/selectionmodel.cpp b/base/applications/mspaint/selectionmodel.cpp index 3cf31aab9e0..1dda60404a4 100644 --- a/base/applications/mspaint/selectionmodel.cpp +++ b/base/applications/mspaint/selectionmodel.cpp @@ -529,6 +529,17 @@ void SelectionModel::SwapWidthAndHeight() m_rc.bottom = m_rc.top + cx; } +HITTEST SelectionModel::hitTest(POINT ptCanvas) +{ + if (!m_bShow) + return HIT_NONE; + + RECT rcSelection = m_rc; + canvasWindow.ImageToCanvas(rcSelection); + ::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE); + return getSizeBoxHitTest(ptCanvas, &rcSelection); +} + void SelectionModel::StretchSelection(BOOL bShrink) { if (!m_bShow) diff --git a/base/applications/mspaint/selectionmodel.h b/base/applications/mspaint/selectionmodel.h index e66b2bff0cc..4fa9e3887dc 100644 --- a/base/applications/mspaint/selectionmodel.h +++ b/base/applications/mspaint/selectionmodel.h @@ -39,6 +39,7 @@ public: BOOL IsLanded() const; void HideSelection(); void DeleteSelection(); + HITTEST hitTest(POINT ptCanvas); HBITMAP GetSelectionContents(); void DrawFramePoly(HDC hDCImage);
1 year, 1 month
1
0
0
0
[reactos] 01/01: [VGAFONTEDIT] Fix exception on New
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=df54fb01fda9e7b24e897…
commit df54fb01fda9e7b24e89786ce1d9abd5f6fc33eb Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Nov 23 08:34:56 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Nov 23 08:34:56 2023 +0900 [VGAFONTEDIT] Fix exception on New Based on KRosUser's vgafont.patch. CORE-19192 --- modules/rosapps/applications/devutils/vgafontedit/fontwnd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/rosapps/applications/devutils/vgafontedit/fontwnd.c b/modules/rosapps/applications/devutils/vgafontedit/fontwnd.c index fc865c25858..1d2bd8a3198 100644 --- a/modules/rosapps/applications/devutils/vgafontedit/fontwnd.c +++ b/modules/rosapps/applications/devutils/vgafontedit/fontwnd.c @@ -374,12 +374,17 @@ CreateFontWindow(IN PMAIN_WND_INFO MainWndInfo, IN PFONT_OPEN_INFO OpenInfo) if( InitFont(Info) ) { - PWSTR pszWindowTitle; + PWSTR pch, pszWindowTitle; if(OpenInfo->pszFileName) - pszWindowTitle = wcsrchr(OpenInfo->pszFileName, '\\') + 1; + { + pch = wcsrchr(OpenInfo->pszFileName, '\\'); + pszWindowTitle = (pch ? (pch + 1) : OpenInfo->pszFileName); + } else + { LoadAndFormatString(IDS_DOCNAME, &pszWindowTitle, ++MainWndInfo->uDocumentCounter); + } hFontWnd = CreateMDIWindowW( szFontWndClass, pszWindowTitle,
1 year, 1 month
1
0
0
0
[reactos] 01/01: [MSPAINT] Introduce partial image history, Part 2 (#6005)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e579220098b132dc25a51…
commit e579220098b132dc25a51451c286e4493949a3d4 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Nov 23 07:14:57 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Nov 23 07:14:57 2023 +0900 [MSPAINT] Introduce partial image history, Part 2 (#6005) Follow-up to #5994. Reduce the lag and the cost of drawing on large image. - Introduce partial image history on SmoothDrawTool and ShapeTool. - We can draw with pen smoothly even when the image is huge (10000x10000). CORE-19237 --- base/applications/mspaint/canvas.cpp | 20 +-- base/applications/mspaint/common.h | 1 + base/applications/mspaint/miniature.cpp | 3 +- base/applications/mspaint/mouse.cpp | 250 +++++++++++++++------------ base/applications/mspaint/selectionmodel.cpp | 15 +- base/applications/mspaint/toolsmodel.h | 20 +-- base/applications/mspaint/winproc.cpp | 5 +- 7 files changed, 162 insertions(+), 152 deletions(-) diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp index 6ebe32a48ec..99f1abf772b 100644 --- a/base/applications/mspaint/canvas.cpp +++ b/base/applications/mspaint/canvas.cpp @@ -40,18 +40,14 @@ RECT CCanvasWindow::GetBaseRect() VOID CCanvasWindow::ImageToCanvas(POINT& pt) { - pt.x = Zoomed(pt.x); - pt.y = Zoomed(pt.y); + Zoomed(pt); pt.x += GRIP_SIZE - GetScrollPos(SB_HORZ); pt.y += GRIP_SIZE - GetScrollPos(SB_VERT); } VOID CCanvasWindow::ImageToCanvas(RECT& rc) { - rc.left = Zoomed(rc.left); - rc.top = Zoomed(rc.top); - rc.right = Zoomed(rc.right); - rc.bottom = Zoomed(rc.bottom); + Zoomed(rc); ::OffsetRect(&rc, GRIP_SIZE - GetScrollPos(SB_HORZ), GRIP_SIZE - GetScrollPos(SB_VERT)); } @@ -61,8 +57,7 @@ VOID CCanvasWindow::CanvasToImage(POINT& pt, BOOL bZoomed) pt.y -= GRIP_SIZE - GetScrollPos(SB_VERT); if (bZoomed) return; - pt.x = UnZoomed(pt.x); - pt.y = UnZoomed(pt.y); + UnZoomed(pt); } VOID CCanvasWindow::CanvasToImage(RECT& rc, BOOL bZoomed) @@ -70,15 +65,12 @@ VOID CCanvasWindow::CanvasToImage(RECT& rc, BOOL bZoomed) ::OffsetRect(&rc, GetScrollPos(SB_HORZ) - GRIP_SIZE, GetScrollPos(SB_VERT) - GRIP_SIZE); if (bZoomed) return; - rc.left = UnZoomed(rc.left); - rc.top = UnZoomed(rc.top); - rc.right = UnZoomed(rc.right); - rc.bottom = UnZoomed(rc.bottom); + UnZoomed(rc); } VOID CCanvasWindow::GetImageRect(RECT& rc) { - ::SetRect(&rc, 0, 0, imageModel.GetWidth(), imageModel.GetHeight()); + rc = { 0, 0, imageModel.GetWidth(), imageModel.GetHeight() }; } HITTEST CCanvasWindow::CanvasHitTest(POINT pt) @@ -689,7 +681,7 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& { if (wParam == VK_ESCAPE && ::GetCapture() == m_hWnd) { - // Cancel dragging + cancelDrawing(); ::ReleaseCapture(); m_nMouseDownMsg = 0; m_hitCanvasSizeBox = HIT_NONE; diff --git a/base/applications/mspaint/common.h b/base/applications/mspaint/common.h index 7f640110806..cc3795c1eca 100644 --- a/base/applications/mspaint/common.h +++ b/base/applications/mspaint/common.h @@ -46,6 +46,7 @@ enum HITTEST // hit void ShowOutOfMemory(void); BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1); BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName); +void getBoundaryOfPtStack(RECT& rcBoundary, INT cPoints, const POINT *pPoints); #define DEG2RAD(degree) (((degree) * M_PI) / 180) #define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI)) diff --git a/base/applications/mspaint/miniature.cpp b/base/applications/mspaint/miniature.cpp index 907dcf5d759..1278dc27385 100644 --- a/base/applications/mspaint/miniature.cpp +++ b/base/applications/mspaint/miniature.cpp @@ -122,7 +122,6 @@ LRESULT CMiniatureWindow::OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lPara { // Avoid too small LPMINMAXINFO pInfo = (LPMINMAXINFO)lParam; - pInfo->ptMinTrackSize.x = 100; - pInfo->ptMinTrackSize.y = 75; + pInfo->ptMinTrackSize = { 100, 75 }; return 0; } diff --git a/base/applications/mspaint/mouse.cpp b/base/applications/mspaint/mouse.cpp index 2aa17872c81..9c268514b15 100644 --- a/base/applications/mspaint/mouse.cpp +++ b/base/applications/mspaint/mouse.cpp @@ -9,9 +9,11 @@ /* INCLUDES *********************************************************/ #include "precomp.h" +#include <atlalloc.h> -INT ToolBase::s_pointSP = 0; -POINT ToolBase::s_pointStack[256] = { { 0 } }; +SIZE_T ToolBase::s_pointSP = 0; +static SIZE_T s_maxPointSP = 0; +static CHeapPtr<POINT, CLocalAllocator> s_pointStack; static POINT g_ptStart, g_ptEnd; /* FUNCTIONS ********************************************************/ @@ -51,11 +53,31 @@ BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1) return (abs(x1 - x0) <= cxThreshold) && (abs(y1 - y0) <= cyThreshold); } +void getBoundaryOfPtStack(RECT& rcBoundary, INT cPoints, const POINT *pPoints) +{ + POINT ptMin = { MAXLONG, MAXLONG }, ptMax = { (LONG)MINLONG, (LONG)MINLONG }; + while (cPoints-- > 0) + { + LONG x = pPoints->x, y = pPoints->y; + ptMin = { min(x, ptMin.x), min(y, ptMin.y) }; + ptMax = { max(x, ptMax.x), max(y, ptMax.y) }; + ++pPoints; + } + + ptMax.x += 1; + ptMax.y += 1; + + CRect rc(ptMin, ptMax); + rcBoundary = rc; +} + void ToolBase::reset() { s_pointSP = 0; - g_ptStart.x = g_ptStart.y = g_ptEnd.x = g_ptEnd.y = -1; + g_ptEnd = g_ptStart = { -1, -1 }; + selectionModel.ResetPtStack(); + if (selectionModel.m_bShow) { selectionModel.Landing(); @@ -93,6 +115,24 @@ void ToolBase::OnDrawSelectionOnCanvas(HDC hdc) drawSizeBoxes(hdc, &rcSelection, TRUE); } +void ToolBase::pushToPtStack(LONG x, LONG y) +{ + if (s_pointSP >= s_maxPointSP) + { + SIZE_T newMax = s_maxPointSP + 512; + SIZE_T cbNew = newMax * sizeof(POINT); + if (!s_pointStack.ReallocateBytes(cbNew)) + { + ATLTRACE("%d, %d, %d\n", (INT)s_pointSP, (INT)s_maxPointSP, (INT)cbNew); + return; + } + + s_maxPointSP = newMax; + } + + s_pointStack[s_pointSP++] = { x, y }; +} + /* TOOLS ********************************************************/ // TOOL_FREESEL @@ -410,43 +450,43 @@ struct SmoothDrawTool : ToolBase { DIRECTION m_direction = NO_DIRECTION; BOOL m_bShiftDown = FALSE; + BOOL m_bLeftButton = FALSE; SmoothDrawTool(TOOLTYPE type) : ToolBase(type) { } - virtual void draw(BOOL bLeftButton, LONG x, LONG y) = 0; + virtual void OnDraw(HDC hdc, BOOL bLeftButton, POINT pt0, POINT pt1) = 0; void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override { m_direction = NO_DIRECTION; - imageModel.PushImageForUndo(); - imageModel.NotifyImageChanged(); m_bShiftDown = (::GetKeyState(VK_SHIFT) & 0x8000); // Is Shift key pressed? + m_bLeftButton = bLeftButton; + s_pointSP = 0; + pushToPtStack(x, y); + pushToPtStack(x, y); // We have to draw the first point + imageModel.NotifyImageChanged(); } BOOL OnMouseMove(BOOL bLeftButton, LONG& x, LONG& y) override { - if (m_bShiftDown) + if (!m_bShiftDown) { - if (m_direction == NO_DIRECTION) - { - m_direction = GetDirection(g_ptStart.x, g_ptStart.y, x, y); - if (m_direction == NO_DIRECTION) - return FALSE; - } - - RestrictDrawDirection(m_direction, g_ptStart.x, g_ptStart.y, x, y); + pushToPtStack(x, y); + imageModel.NotifyImageChanged(); + return TRUE; } - else + + if (m_direction == NO_DIRECTION) { - draw(bLeftButton, x, y); - g_ptStart.x = g_ptEnd.x = x; - g_ptStart.y = g_ptEnd.y = y; - return TRUE; + m_direction = GetDirection(g_ptStart.x, g_ptStart.y, x, y); + if (m_direction == NO_DIRECTION) + return FALSE; } - draw(bLeftButton, x, y); + RestrictDrawDirection(m_direction, g_ptStart.x, g_ptStart.y, x, y); + pushToPtStack(x, y); imageModel.NotifyImageChanged(); return TRUE; } @@ -454,24 +494,30 @@ struct SmoothDrawTool : ToolBase BOOL OnButtonUp(BOOL bLeftButton, LONG& x, LONG& y) override { if (m_bShiftDown && m_direction != NO_DIRECTION) - { RestrictDrawDirection(m_direction, g_ptStart.x, g_ptStart.y, x, y); - } - draw(bLeftButton, x, y); + pushToPtStack(x, y); + + CRect rcPartial; + getBoundaryOfPtStack(rcPartial, s_pointSP, s_pointStack); + + SIZE size = toolsModel.GetToolSize(); + rcPartial.InflateRect((size.cx + 1) / 2, (size.cy + 1) / 2); + + imageModel.PushImageForUndo(rcPartial); + + OnDrawOverlayOnImage(m_hdc); + imageModel.NotifyImageChanged(); OnEndDraw(FALSE); return TRUE; } - void OnEndDraw(BOOL bCancel) override + void OnDrawOverlayOnImage(HDC hdc) override { - if (bCancel) + for (SIZE_T i = 1; i < s_pointSP; ++i) { - LONG x = 0, y = 0; - OnButtonUp(FALSE, x, y); - imageModel.Undo(TRUE); + OnDraw(hdc, m_bLeftButton, s_pointStack[i - 1], s_pointStack[i]); } - ToolBase::OnEndDraw(bCancel); } }; @@ -482,12 +528,12 @@ struct RubberTool : SmoothDrawTool { } - void draw(BOOL bLeftButton, LONG x, LONG y) override + void OnDraw(HDC hdc, BOOL bLeftButton, POINT pt0, POINT pt1) override { if (bLeftButton) - Erase(m_hdc, g_ptEnd.x, g_ptEnd.y, x, y, m_bg, toolsModel.GetRubberRadius()); + Erase(hdc, pt0.x, pt0.y, pt1.x, pt1.y, m_bg, toolsModel.GetRubberRadius()); else - Replace(m_hdc, g_ptEnd.x, g_ptEnd.y, x, y, m_fg, m_bg, toolsModel.GetRubberRadius()); + Replace(hdc, pt0.x, pt0.y, pt1.x, pt1.y, m_fg, m_bg, toolsModel.GetRubberRadius()); } void OnSpecialTweak(BOOL bMinus) override @@ -617,10 +663,10 @@ struct PenTool : SmoothDrawTool { } - void draw(BOOL bLeftButton, LONG x, LONG y) override + void OnDraw(HDC hdc, BOOL bLeftButton, POINT pt0, POINT pt1) override { COLORREF rgb = bLeftButton ? m_fg : m_bg; - Line(m_hdc, g_ptEnd.x, g_ptEnd.y, x, y, rgb, toolsModel.GetPenWidth()); + Line(hdc, pt0.x, pt0.y, pt1.x, pt1.y, rgb, toolsModel.GetPenWidth()); } void OnSpecialTweak(BOOL bMinus) override @@ -636,10 +682,10 @@ struct BrushTool : SmoothDrawTool { } - void draw(BOOL bLeftButton, LONG x, LONG y) override + void OnDraw(HDC hdc, BOOL bLeftButton, POINT pt0, POINT pt1) override { COLORREF rgb = bLeftButton ? m_fg : m_bg; - Brush(m_hdc, g_ptEnd.x, g_ptEnd.y, x, y, rgb, toolsModel.GetBrushStyle(), + Brush(hdc, pt0.x, pt0.y, pt1.x, pt1.y, rgb, toolsModel.GetBrushStyle(), toolsModel.GetBrushWidth()); } @@ -652,14 +698,28 @@ struct BrushTool : SmoothDrawTool // TOOL_AIRBRUSH struct AirBrushTool : SmoothDrawTool { + DWORD m_dwTick = 0; + AirBrushTool() : SmoothDrawTool(TOOL_AIRBRUSH) { } - void draw(BOOL bLeftButton, LONG x, LONG y) override + void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override + { + m_dwTick = GetTickCount(); + SmoothDrawTool::OnButtonDown(bLeftButton, x, y, bDoubleClick); + } + + void OnDrawOverlayOnImage(HDC hdc) override + { + srand(m_dwTick); + SmoothDrawTool::OnDrawOverlayOnImage(hdc); + } + + void OnDraw(HDC hdc, BOOL bLeftButton, POINT pt0, POINT pt1) override { COLORREF rgb = bLeftButton ? m_fg : m_bg; - Airbrush(m_hdc, x, y, rgb, toolsModel.GetAirBrushRadius()); + Airbrush(hdc, pt1.x, pt1.y, rgb, toolsModel.GetAirBrushRadius()); } void OnSpecialTweak(BOOL bMinus) override @@ -823,7 +883,6 @@ struct LineTool : TwoPointDrawTool struct BezierTool : ToolBase { BOOL m_bLeftButton = FALSE; - BOOL m_bDrawing = FALSE; BezierTool() : ToolBase(TOOL_BEZIER) { @@ -831,20 +890,17 @@ struct BezierTool : ToolBase void OnDrawOverlayOnImage(HDC hdc) { - if (!m_bDrawing) - return; - COLORREF rgb = (m_bLeftButton ? m_fg : m_bg); switch (s_pointSP) { - case 1: + case 2: Line(hdc, s_pointStack[0].x, s_pointStack[0].y, s_pointStack[1].x, s_pointStack[1].y, rgb, toolsModel.GetLineWidth()); break; - case 2: + case 3: Bezier(hdc, s_pointStack[0], s_pointStack[2], s_pointStack[2], s_pointStack[1], rgb, toolsModel.GetLineWidth()); break; - case 3: + case 4: Bezier(hdc, s_pointStack[0], s_pointStack[2], s_pointStack[3], s_pointStack[1], rgb, toolsModel.GetLineWidth()); break; } @@ -854,18 +910,14 @@ struct BezierTool : ToolBase { m_bLeftButton = bLeftButton; - if (!m_bDrawing) + if (s_pointSP == 0) { - m_bDrawing = TRUE; - s_pointStack[s_pointSP].x = s_pointStack[s_pointSP + 1].x = x; - s_pointStack[s_pointSP].y = s_pointStack[s_pointSP + 1].y = y; - ++s_pointSP; + pushToPtStack(x, y); + pushToPtStack(x, y); } else { - ++s_pointSP; - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; + s_pointStack[s_pointSP - 1] = { x, y }; } imageModel.NotifyImageChanged(); @@ -873,33 +925,32 @@ struct BezierTool : ToolBase BOOL OnMouseMove(BOOL bLeftButton, LONG& x, LONG& y) override { - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; + if (s_pointSP > 0) + s_pointStack[s_pointSP - 1] = { x, y }; imageModel.NotifyImageChanged(); return TRUE; } BOOL OnButtonUp(BOOL bLeftButton, LONG& x, LONG& y) override { - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; - if (s_pointSP >= 3) + if (s_pointSP >= 4) { OnEndDraw(FALSE); return TRUE; } + pushToPtStack(x, y); imageModel.NotifyImageChanged(); return TRUE; } void OnEndDraw(BOOL bCancel) override { - if (!bCancel) + if (!bCancel && s_pointSP > 1) { + // FIXME: I couldn't calculate boundary rectangle from Bezier curve imageModel.PushImageForUndo(); OnDrawOverlayOnImage(m_hdc); } - m_bDrawing = FALSE; ToolBase::OnEndDraw(bCancel); } @@ -945,9 +996,9 @@ struct ShapeTool : ToolBase return; if (m_bLeftButton) - Poly(hdc, s_pointStack, s_pointSP + 1, m_fg, m_bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE); + Poly(hdc, s_pointStack, s_pointSP, m_fg, m_bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE); else - Poly(hdc, s_pointStack, s_pointSP + 1, m_bg, m_fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE); + Poly(hdc, s_pointStack, s_pointSP, m_bg, m_fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle(), m_bClosed, FALSE); } void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override @@ -958,32 +1009,29 @@ struct ShapeTool : ToolBase if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) roundTo8Directions(s_pointStack[s_pointSP - 1].x, s_pointStack[s_pointSP - 1].y, x, y); - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; + pushToPtStack(x, y); - if (s_pointSP && bDoubleClick) + if (s_pointSP > 1 && bDoubleClick) { OnEndDraw(FALSE); return; } - if (s_pointSP == 0) - { - s_pointSP++; - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; - } + if (s_pointSP == 1) + pushToPtStack(x, y); // We have to draw the first point imageModel.NotifyImageChanged(); } BOOL OnMouseMove(BOOL bLeftButton, LONG& x, LONG& y) override { - if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) - roundTo8Directions(s_pointStack[s_pointSP - 1].x, s_pointStack[s_pointSP - 1].y, x, y); + if (s_pointSP > 1) + { + if (GetAsyncKeyState(VK_SHIFT) < 0) + roundTo8Directions(s_pointStack[s_pointSP - 2].x, s_pointStack[s_pointSP - 2].y, x, y); - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; + s_pointStack[s_pointSP - 1] = { x, y }; + } imageModel.NotifyImageChanged(); return TRUE; @@ -991,8 +1039,8 @@ struct ShapeTool : ToolBase BOOL OnButtonUp(BOOL bLeftButton, LONG& x, LONG& y) override { - if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) - roundTo8Directions(s_pointStack[s_pointSP - 1].x, s_pointStack[s_pointSP - 1].y, x, y); + if ((s_pointSP > 1) && (GetAsyncKeyState(VK_SHIFT) < 0)) + roundTo8Directions(s_pointStack[s_pointSP - 2].x, s_pointStack[s_pointSP - 2].y, x, y); m_bClosed = FALSE; if (nearlyEqualPoints(x, y, s_pointStack[0].x, s_pointStack[0].y)) @@ -1000,35 +1048,28 @@ struct ShapeTool : ToolBase OnEndDraw(FALSE); return TRUE; } - else - { - s_pointSP++; - s_pointStack[s_pointSP].x = x; - s_pointStack[s_pointSP].y = y; - } - - if (s_pointSP == _countof(s_pointStack)) - s_pointSP--; + pushToPtStack(x, y); imageModel.NotifyImageChanged(); return TRUE; } void OnEndDraw(BOOL bCancel) override { - if (!bCancel) + if (!bCancel && s_pointSP > 1) { - if (s_pointSP) - { - --s_pointSP; - m_bClosed = TRUE; + CRect rcPartial; + getBoundaryOfPtStack(rcPartial, s_pointSP, s_pointStack); - imageModel.PushImageForUndo(); - OnDrawOverlayOnImage(m_hdc); - } - m_bClosed = FALSE; - s_pointSP = 0; + SIZE size = toolsModel.GetToolSize(); + rcPartial.InflateRect((size.cx + 1) / 2, (size.cy + 1) / 2); + + imageModel.PushImageForUndo(rcPartial); + + m_bClosed = TRUE; + OnDrawOverlayOnImage(m_hdc); } + m_bClosed = FALSE; ToolBase::OnEndDraw(bCancel); } @@ -1107,8 +1148,7 @@ ToolBase::createToolObject(TOOLTYPE type) void ToolsModel::OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) { m_pToolObject->beginEvent(); - g_ptStart.x = g_ptEnd.x = x; - g_ptStart.y = g_ptEnd.y = y; + g_ptEnd = g_ptStart = { x, y }; m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick); m_pToolObject->endEvent(); } @@ -1117,10 +1157,8 @@ void ToolsModel::OnMouseMove(BOOL bLeftButton, LONG x, LONG y) { m_pToolObject->beginEvent(); if (m_pToolObject->OnMouseMove(bLeftButton, x, y)) - { - g_ptEnd.x = x; - g_ptEnd.y = y; - } + g_ptEnd = { x, y }; + m_pToolObject->endEvent(); } @@ -1128,10 +1166,8 @@ void ToolsModel::OnButtonUp(BOOL bLeftButton, LONG x, LONG y) { m_pToolObject->beginEvent(); if (m_pToolObject->OnButtonUp(bLeftButton, x, y)) - { - g_ptEnd.x = x; - g_ptEnd.y = y; - } + g_ptEnd = { x, y }; + m_pToolObject->endEvent(); } diff --git a/base/applications/mspaint/selectionmodel.cpp b/base/applications/mspaint/selectionmodel.cpp index 76333de6f45..3cf31aab9e0 100644 --- a/base/applications/mspaint/selectionmodel.cpp +++ b/base/applications/mspaint/selectionmodel.cpp @@ -23,7 +23,7 @@ SelectionModel::SelectionModel() { ::SetRectEmpty(&m_rc); ::SetRectEmpty(&m_rcOld); - m_ptHit.x = m_ptHit.y = -1; + m_ptHit = { -1, -1 }; } SelectionModel::~SelectionModel() @@ -71,17 +71,8 @@ void SelectionModel::ShiftPtStack(INT dx, INT dy) void SelectionModel::BuildMaskFromPtStack() { - CRect rc = { MAXLONG, MAXLONG, 0, 0 }; - for (INT i = 0; i < m_iPtSP; ++i) - { - POINT& pt = m_ptStack[i]; - rc.left = min(pt.x, rc.left); - rc.top = min(pt.y, rc.top); - rc.right = max(pt.x, rc.right); - rc.bottom = max(pt.y, rc.bottom); - } - rc.right += 1; - rc.bottom += 1; + CRect rc; + getBoundaryOfPtStack(rc, m_iPtSP, m_ptStack); m_rc = m_rcOld = rc; diff --git a/base/applications/mspaint/toolsmodel.h b/base/applications/mspaint/toolsmodel.h index 1bc5ee256c0..81af5af3d98 100644 --- a/base/applications/mspaint/toolsmodel.h +++ b/base/applications/mspaint/toolsmodel.h @@ -43,8 +43,7 @@ struct ToolBase TOOLTYPE m_tool; HDC m_hdc; COLORREF m_fg, m_bg; - static INT s_pointSP; - static POINT s_pointStack[256]; + static SIZE_T s_pointSP; ToolBase(TOOLTYPE tool) : m_tool(tool), m_hdc(NULL) { } virtual ~ToolBase() { } @@ -63,6 +62,7 @@ struct ToolBase void beginEvent(); void endEvent(); void reset(); + void pushToPtStack(LONG x, LONG y); static ToolBase* createToolObject(TOOLTYPE type); @@ -165,28 +165,20 @@ static inline int UnZoomed(int xy) static inline void Zoomed(POINT& pt) { - pt.x = Zoomed(pt.x); - pt.y = Zoomed(pt.y); + pt = { Zoomed(pt.x), Zoomed(pt.y) }; } static inline void Zoomed(RECT& rc) { - rc.left = Zoomed(rc.left); - rc.top = Zoomed(rc.top); - rc.right = Zoomed(rc.right); - rc.bottom = Zoomed(rc.bottom); + rc = { Zoomed(rc.left), Zoomed(rc.top), Zoomed(rc.right), Zoomed(rc.bottom) }; } static inline void UnZoomed(POINT& pt) { - pt.x = UnZoomed(pt.x); - pt.y = UnZoomed(pt.y); + pt = { UnZoomed(pt.x), UnZoomed(pt.y) }; } static inline void UnZoomed(RECT& rc) { - rc.left = UnZoomed(rc.left); - rc.top = UnZoomed(rc.top); - rc.right = UnZoomed(rc.right); - rc.bottom = UnZoomed(rc.bottom); + rc = { UnZoomed(rc.left), UnZoomed(rc.top), UnZoomed(rc.right), UnZoomed(rc.bottom) }; } diff --git a/base/applications/mspaint/winproc.cpp b/base/applications/mspaint/winproc.cpp index b7d825f1b01..a459dda4b76 100644 --- a/base/applications/mspaint/winproc.cpp +++ b/base/applications/mspaint/winproc.cpp @@ -498,9 +498,8 @@ LRESULT CMainWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHand LRESULT CMainWindow::OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - MINMAXINFO *mm = (LPMINMAXINFO) lParam; - mm->ptMinTrackSize.x = 330; - mm->ptMinTrackSize.y = 360; + MINMAXINFO *mm = (MINMAXINFO*)lParam; + mm->ptMinTrackSize = { 330, 360 }; return 0; }
1 year, 1 month
1
0
0
0
[reactos] 01/01: [SETUPAPI] cfgmgr.c: Do not debugstr_*(pszVetoName) (#6027)
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5b5aaf6687b443aa010ae…
commit 5b5aaf6687b443aa010ae055ec005a23a0e4c337 Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Wed Nov 22 22:35:00 2023 +0100 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Nov 22 22:35:00 2023 +0100 [SETUPAPI] cfgmgr.c: Do not debugstr_*(pszVetoName) (#6027) which is an _Out_ parameter. Fixes "uninitialized" data read. --- dll/win32/setupapi/cfgmgr.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index 3ab1d6969ce..1b25536f9e3 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -6586,8 +6586,8 @@ CM_Query_And_Remove_SubTreeW( _In_ ULONG ulNameLength, _In_ ULONG ulFlags) { - TRACE("CM_Query_And_Remove_SubTreeW(%lx %p %s %lu %lx)\n", - dnAncestor, pVetoType, debugstr_w(pszVetoName), ulNameLength, ulFlags); + TRACE("CM_Query_And_Remove_SubTreeW(%lx %p %p %lu %lx)\n", + dnAncestor, pVetoType, pszVetoName, ulNameLength, ulFlags); return CM_Query_And_Remove_SubTree_ExW(dnAncestor, pVetoType, pszVetoName, ulNameLength, ulFlags, NULL); @@ -6610,8 +6610,8 @@ CM_Query_And_Remove_SubTree_ExA( LPWSTR lpLocalVetoName; CONFIGRET ret; - TRACE("CM_Query_And_Remove_SubTree_ExA(%lx %p %s %lu %lx %p)\n", - dnAncestor, pVetoType, debugstr_a(pszVetoName), ulNameLength, + TRACE("CM_Query_And_Remove_SubTree_ExA(%lx %p %p %lu %lx %p)\n", + dnAncestor, pVetoType, pszVetoName, ulNameLength, ulFlags, hMachine); if (pszVetoName == NULL && ulNameLength == 0) @@ -6660,8 +6660,8 @@ CM_Query_And_Remove_SubTree_ExW( LPWSTR lpDevInst; CONFIGRET ret; - TRACE("CM_Query_And_Remove_SubTree_ExW(%lx %p %s %lu %lx %p)\n", - dnAncestor, pVetoType, debugstr_w(pszVetoName), ulNameLength, + TRACE("CM_Query_And_Remove_SubTree_ExW(%lx %p %p %lu %lx %p)\n", + dnAncestor, pVetoType, pszVetoName, ulNameLength, ulFlags, hMachine); if (dnAncestor == 0) @@ -7442,8 +7442,8 @@ CM_Request_Device_EjectA( _In_ ULONG ulNameLength, _In_ ULONG ulFlags) { - TRACE("CM_Request_Device_EjectA(%lx %p %s %lu %lx)\n", - dnDevInst, pVetoType, debugstr_a(pszVetoName), ulNameLength, ulFlags); + TRACE("CM_Request_Device_EjectA(%lx %p %p %lu %lx)\n", + dnDevInst, pVetoType, pszVetoName, ulNameLength, ulFlags); return CM_Request_Device_Eject_ExA(dnDevInst, pVetoType, pszVetoName, ulNameLength, ulFlags, NULL); @@ -7462,8 +7462,8 @@ CM_Request_Device_EjectW( _In_ ULONG ulNameLength, _In_ ULONG ulFlags) { - TRACE("CM_Request_Device_EjectW(%lx %p %s %lu %lx)\n", - dnDevInst, pVetoType, debugstr_w(pszVetoName), ulNameLength, ulFlags); + TRACE("CM_Request_Device_EjectW(%lx %p %p %lu %lx)\n", + dnDevInst, pVetoType, pszVetoName, ulNameLength, ulFlags); return CM_Request_Device_Eject_ExW(dnDevInst, pVetoType, pszVetoName, ulNameLength, ulFlags, NULL); @@ -7486,8 +7486,8 @@ CM_Request_Device_Eject_ExA( LPWSTR lpLocalVetoName = NULL; CONFIGRET ret; - TRACE("CM_Request_Device_Eject_ExA(%lx %p %s %lu %lx %p)\n", - dnDevInst, pVetoType, debugstr_a(pszVetoName), ulNameLength, ulFlags, hMachine); + TRACE("CM_Request_Device_Eject_ExA(%lx %p %p %lu %lx %p)\n", + dnDevInst, pVetoType, pszVetoName, ulNameLength, ulFlags, hMachine); if (ulNameLength != 0) { @@ -7538,8 +7538,8 @@ CM_Request_Device_Eject_ExW( LPWSTR lpDevInst; CONFIGRET ret; - TRACE("CM_Request_Device_Eject_ExW(%lx %p %s %lu %lx %p)\n", - dnDevInst, pVetoType, debugstr_w(pszVetoName), ulNameLength, ulFlags, hMachine); + TRACE("CM_Request_Device_Eject_ExW(%lx %p %p %lu %lx %p)\n", + dnDevInst, pVetoType, pszVetoName, ulNameLength, ulFlags, hMachine); if (dnDevInst == 0) return CR_INVALID_DEVNODE;
1 year, 1 month
1
0
0
0
[reactos] 01/01: Add missing OEMRESOURCE for using the OBM_, OIC_, OCR_ defines from winuser.h
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6cdaad13bdfd5dca8cce7…
commit 6cdaad13bdfd5dca8cce7b88c146162d818df1fe Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Nov 22 16:52:19 2023 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Nov 22 17:02:45 2023 +0100 Add missing OEMRESOURCE for using the OBM_, OIC_, OCR_ defines from winuser.h Fix build by commit 072965eb0 for modules: EXPLORER, COMCTL32, IERNONCE, URLMON, USER32_(API|WINE)TESTS Note that some of these modules (from Wine) already have the OEMRESOURCE defined; however, only in one of their files. But we have added precompiled headers for them where we have included either windows.h or winuser.h in them, without OEMRESOURCE. The result is, that when compiling these modules with PCH support, the OEMRESOURCE define was _not_ satisfied and thus, compile errors arose. Fix this by adding #define OEMRESOURCE before the windows headers also in the precompiled headers we have added for these modules. --- base/shell/explorer/precomp.h | 1 + dll/win32/comctl32/precomp.h | 1 + dll/win32/iernonce/iernonce.h | 2 ++ dll/win32/urlmon/precomp.h | 1 + modules/rostests/apitests/user32/precomp.h | 2 ++ modules/rostests/winetests/user32/precomp.h | 2 ++ 6 files changed, 9 insertions(+) diff --git a/base/shell/explorer/precomp.h b/base/shell/explorer/precomp.h index c9693ec04f1..ecc36caa9c6 100644 --- a/base/shell/explorer/precomp.h +++ b/base/shell/explorer/precomp.h @@ -17,6 +17,7 @@ #define COM_NO_WINDOWS_H #define COBJMACROS +#define OEMRESOURCE #include <windef.h> #include <winbase.h> diff --git a/dll/win32/comctl32/precomp.h b/dll/win32/comctl32/precomp.h index 05f7b082dc6..374ab19fa02 100644 --- a/dll/win32/comctl32/precomp.h +++ b/dll/win32/comctl32/precomp.h @@ -12,6 +12,7 @@ #define COBJMACROS #define NONAMELESSUNION #define NONAMELESSSTRUCT +#define OEMRESOURCE #include "comctl32.h" diff --git a/dll/win32/iernonce/iernonce.h b/dll/win32/iernonce/iernonce.h index 5c46ed85cc5..2de557e644c 100644 --- a/dll/win32/iernonce/iernonce.h +++ b/dll/win32/iernonce/iernonce.h @@ -11,6 +11,8 @@ #include <cstdlib> #define WIN32_NO_STATUS +#define OEMRESOURCE // For OBM_MNARROW + #include <windef.h> #include <winbase.h> #include <windowsx.h> diff --git a/dll/win32/urlmon/precomp.h b/dll/win32/urlmon/precomp.h index 544651e310d..814f061f619 100644 --- a/dll/win32/urlmon/precomp.h +++ b/dll/win32/urlmon/precomp.h @@ -8,6 +8,7 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT +#define OEMRESOURCE #include "urlmon_main.h" diff --git a/modules/rostests/apitests/user32/precomp.h b/modules/rostests/apitests/user32/precomp.h index 9159e4bd588..29a986cd42f 100644 --- a/modules/rostests/apitests/user32/precomp.h +++ b/modules/rostests/apitests/user32/precomp.h @@ -8,6 +8,8 @@ #define COM_NO_WINDOWS_H #define WIN32_NO_STATUS +#define OEMRESOURCE + #include <apitest.h> #include <wingdi.h> #include <winuser.h> diff --git a/modules/rostests/winetests/user32/precomp.h b/modules/rostests/winetests/user32/precomp.h index a379831662e..a108fd0c49f 100644 --- a/modules/rostests/winetests/user32/precomp.h +++ b/modules/rostests/winetests/user32/precomp.h @@ -8,6 +8,8 @@ #define STRICT #define WINE_NOWINSOCK +#define OEMRESOURCE + #include <windows.h> #define WINE_NO_INLINE_RECT
1 year, 1 month
1
0
0
0
[reactos] 04/04: [PSDK] winuser.h: Enclose the OBM/OCR/OIC defines in OEMRESOURCE guard (see also winuser.rh)
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=072965eb0a6c5dc322b0c…
commit 072965eb0a6c5dc322b0c9f2211a57e2d93291a4 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Nov 22 13:10:48 2023 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Nov 22 15:46:19 2023 +0100 [PSDK] winuser.h: Enclose the OBM/OCR/OIC defines in OEMRESOURCE guard (see also winuser.rh) --- sdk/include/psdk/winuser.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdk/include/psdk/winuser.h b/sdk/include/psdk/winuser.h index 5f956a66239..3cc85d18397 100644 --- a/sdk/include/psdk/winuser.h +++ b/sdk/include/psdk/winuser.h @@ -627,7 +627,7 @@ extern "C" { #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 #define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 -#endif +#endif /* !RC_INVOKED */ #endif /* !NORESOURCE */ @@ -1103,6 +1103,8 @@ extern "C" { #define KEYEVENTF_UNICODE 0x00000004 #define KEYEVENTF_SCANCODE 0x00000008 #endif + +#ifdef OEMRESOURCE #define OBM_TRTYPE 32732 #define OBM_LFARROWI 32734 #define OBM_RGARROWI 32735 @@ -1163,6 +1165,8 @@ extern "C" { #define OIC_WARNING OIC_BANG #define OIC_ERROR OIC_HAND #define OIC_INFORMATION OIC_NOTE +#endif /* OEMRESOURCE */ + #define HELPINFO_MENUITEM 2 #define HELPINFO_WINDOW 1 #define MSGF_DIALOGBOX 0
1 year, 1 month
1
0
0
0
[reactos] 03/04: [PSDK][WIN32SS] Fix WINNT in ddraw.h; remove NT_BUILD_ENVIRONMENT usage
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0e88f0485c0c909f2aa42…
commit 0e88f0485c0c909f2aa42dbc84f00e282ef4008c Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Nov 22 12:33:45 2023 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Nov 22 15:46:06 2023 +0100 [PSDK][WIN32SS] Fix WINNT in ddraw.h; remove NT_BUILD_ENVIRONMENT usage Keep compatibility with MS PSDK ddraw.h file by using WINNT instead of _WINNT_ in the preprocessor conditional test. Incidentally this allows also removing those #define NT_BUILD_ENVIRONMENT in the win32ss modules. See commit 5fcfaf2e1 (r42346). --- sdk/include/psdk/ddraw.h | 2 +- win32ss/pch.h | 1 - win32ss/reactx/dxapi/dxapi_driver.h | 1 - win32ss/reactx/dxg/dxg_int.h | 4 ---- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/sdk/include/psdk/ddraw.h b/sdk/include/psdk/ddraw.h index 0d0889d9da9..637afd9e280 100644 --- a/sdk/include/psdk/ddraw.h +++ b/sdk/include/psdk/ddraw.h @@ -7,7 +7,7 @@ #include <objbase.h> #else #define IUnknown void -#if !defined(NT_BUILD_ENVIRONMENT) && !defined(_WINNT_) +#if !defined(NT_BUILD_ENVIRONMENT) && !defined(WINNT) #define CO_E_NOTINITIALIZED 0x800401F0L #endif #endif diff --git a/win32ss/pch.h b/win32ss/pch.h index cf06876ac54..2cc72405405 100644 --- a/win32ss/pch.h +++ b/win32ss/pch.h @@ -55,7 +55,6 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #include <winerror.h> #include <wingdi.h> -#define NT_BUILD_ENVIRONMENT #define _ENGINE_EXPORT_ #include <winddi.h> #define OEMRESOURCE diff --git a/win32ss/reactx/dxapi/dxapi_driver.h b/win32ss/reactx/dxapi/dxapi_driver.h index 09a2ba7958a..6886c861f01 100644 --- a/win32ss/reactx/dxapi/dxapi_driver.h +++ b/win32ss/reactx/dxapi/dxapi_driver.h @@ -3,7 +3,6 @@ #include <windef.h> #include <winerror.h> #include <wingdi.h> -#define NT_BUILD_ENVIRONMENT #include <winddi.h> #include <ddkmapi.h> diff --git a/win32ss/reactx/dxg/dxg_int.h b/win32ss/reactx/dxg/dxg_int.h index 625a3e92afa..731afdc7ab0 100644 --- a/win32ss/reactx/dxg/dxg_int.h +++ b/win32ss/reactx/dxg/dxg_int.h @@ -5,14 +5,10 @@ /* Win32 Headers */ #define WINBASEAPI -#define STARTF_USESIZE 2 -#define STARTF_USEPOSITION 4 -#define NT_BUILD_ENVIRONMENT #define DDHMG_HANDLE_LIMIT 0x200000 #define DDHMG_HTOI(DdHandle) ((DWORD_PTR)DdHandle & (DDHMG_HANDLE_LIMIT-1)) - #include <windef.h> #include <winerror.h> #include <wingdi.h>
1 year, 1 month
1
0
0
0
[reactos] 02/04: [WIN32SS:REACTX] Remove INTERNAL_CALL, deprecated since commit 24abf1b22 (r53467)
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f5563ad22ce576145a800…
commit f5563ad22ce576145a80076c3f44759fb1189b71 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Nov 22 11:56:07 2023 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Nov 22 15:46:05 2023 +0100 [WIN32SS:REACTX] Remove INTERNAL_CALL, deprecated since commit 24abf1b22 (r53467) --- win32ss/reactx/dxg/dxg_int.h | 1 - 1 file changed, 1 deletion(-) diff --git a/win32ss/reactx/dxg/dxg_int.h b/win32ss/reactx/dxg/dxg_int.h index fa9c3170a86..625a3e92afa 100644 --- a/win32ss/reactx/dxg/dxg_int.h +++ b/win32ss/reactx/dxg/dxg_int.h @@ -7,7 +7,6 @@ #define WINBASEAPI #define STARTF_USESIZE 2 #define STARTF_USEPOSITION 4 -#define INTERNAL_CALL NTAPI #define NT_BUILD_ENVIRONMENT #define DDHMG_HANDLE_LIMIT 0x200000
1 year, 1 month
1
0
0
0
[reactos] 01/04: [WIN32K] Re-order some of the includes in pch.h
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6ddfe7e5dd96473f5a8b3…
commit 6ddfe7e5dd96473f5a8b35dd4eab64dcc3607893 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Nov 22 15:23:37 2023 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Nov 22 15:46:00 2023 +0100 [WIN32K] Re-order some of the includes in pch.h First the C headers, then the DDK followed by the Win32 PSDK ones, only then the NDK headers, and finally the rest. --- win32ss/pch.h | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/win32ss/pch.h b/win32ss/pch.h index d72708658f0..cf06876ac54 100644 --- a/win32ss/pch.h +++ b/win32ss/pch.h @@ -14,25 +14,23 @@ #define _NO_COM #define STRICT -/* DDK/NDK/SDK headers */ +/* C headers */ +#include <stdarg.h> +#define _USE_MATH_DEFINES +#include <math.h> +#include <intrin.h> + +/* DDK headers */ #undef NTDDI_VERSION #define NTDDI_VERSION NTDDI_WS03SP1 #include <ntifs.h> +#include <ntddkbd.h> #include <ntddmou.h> -#include <ndk/exfuncs.h> -#include <ndk/iofuncs.h> -#include <ndk/kdfuncs.h> -#include <ndk/kefuncs.h> -#include <ndk/mmfuncs.h> -#include <ndk/obfuncs.h> -#include <ndk/psfuncs.h> -#include <ndk/sefuncs.h> -#include <ndk/rtlfuncs.h> +#include <ntddvdeo.h> #include <ntstrsafe.h> #include <ntintsafe.h> -#include <ntddkbd.h> -/* Win32 headers */ +/* Win32 PSDK headers */ /* FIXME: Defines in winbase.h that we need... */ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #define MAKEINTATOM(i) (LPWSTR)((ULONG_PTR)((WORD)(i))) @@ -40,11 +38,7 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #define STARTF_USESHOWWINDOW 1 #define STARTF_USESIZE 2 #define STARTF_USEPOSITION 4 -#include <stdarg.h> #include <windef.h> -#define _USE_MATH_DEFINES -#include <math.h> -#include <intrin.h> // Needed because windef.h messes up CDECL for whatever #undef CDECL @@ -64,13 +58,24 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; #define NT_BUILD_ENVIRONMENT #define _ENGINE_EXPORT_ #include <winddi.h> +#define OEMRESOURCE #include <winuser.h> #include <prntfont.h> #define _NOCSECT_TYPE #include <ddrawi.h> #include <imm.h> #include <dbt.h> -#include <ntddvdeo.h> + +/* NDK headers */ +#include <ndk/exfuncs.h> +#include <ndk/iofuncs.h> +#include <ndk/kdfuncs.h> +#include <ndk/kefuncs.h> +#include <ndk/mmfuncs.h> +#include <ndk/obfuncs.h> +#include <ndk/psfuncs.h> +#include <ndk/sefuncs.h> +#include <ndk/rtlfuncs.h> /* SEH support with PSEH */ #include <pseh/pseh2.h>
1 year, 1 month
1
0
0
0
[reactos] 01/01: [SETUPAPI] CM_Request_Device_Eject_ExA/W: Fix pszVetoName buffer size validation (#5943)
by Thamatip Chitpong
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7f346b1aa350942540c7d…
commit 7f346b1aa350942540c7dee9fce3869bea2a72a6 Author: Thamatip Chitpong <thamatip.chitpong(a)reactos.org> AuthorDate: Wed Nov 22 08:58:27 2023 +0700 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Nov 22 08:58:27 2023 +0700 [SETUPAPI] CM_Request_Device_Eject_ExA/W: Fix pszVetoName buffer size validation (#5943) - Return CR_INVALID_POINTER if pszVetoName is NULL and ulNameLength is not zero - CM_Request_Device_Eject_ExA: Allow ulNameLength to be zero when pszVetoName is not NULL Verified with Windows 2003 SP2. --- dll/win32/setupapi/cfgmgr.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index 4a4e18ad621..3ab1d6969ce 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -7483,22 +7483,25 @@ CM_Request_Device_Eject_ExA( _In_ ULONG ulFlags, _In_opt_ HMACHINE hMachine) { - LPWSTR lpLocalVetoName; + LPWSTR lpLocalVetoName = NULL; CONFIGRET ret; TRACE("CM_Request_Device_Eject_ExA(%lx %p %s %lu %lx %p)\n", dnDevInst, pVetoType, debugstr_a(pszVetoName), ulNameLength, ulFlags, hMachine); - if (pszVetoName == NULL && ulNameLength == 0) - return CR_INVALID_POINTER; + if (ulNameLength != 0) + { + if (pszVetoName == NULL) + return CR_INVALID_POINTER; - lpLocalVetoName = HeapAlloc(GetProcessHeap(), 0, ulNameLength * sizeof(WCHAR)); - if (lpLocalVetoName == NULL) - return CR_OUT_OF_MEMORY; + lpLocalVetoName = HeapAlloc(GetProcessHeap(), 0, ulNameLength * sizeof(WCHAR)); + if (lpLocalVetoName == NULL) + return CR_OUT_OF_MEMORY; + } ret = CM_Request_Device_Eject_ExW(dnDevInst, pVetoType, lpLocalVetoName, ulNameLength, ulFlags, hMachine); - if (ret == CR_REMOVE_VETOED) + if (ret == CR_REMOVE_VETOED && ulNameLength != 0) { if (WideCharToMultiByte(CP_ACP, 0, @@ -7544,7 +7547,7 @@ CM_Request_Device_Eject_ExW( if (ulFlags != 0) return CR_INVALID_FLAG; - if (pszVetoName == NULL && ulNameLength == 0) + if (pszVetoName == NULL && ulNameLength != 0) return CR_INVALID_POINTER; if (hMachine != NULL)
1 year, 1 month
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200