https://git.reactos.org/?p=reactos.git;a=commitdiff;h=02c647802f609a3f4cb9a18a623ea0b35eae1c0a

commit 02c647802f609a3f4cb9a18a623ea0b35eae1c0a
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Fri Mar 10 07:31:31 2023 +0900
Commit:     GitHub <[email protected]>
CommitDate: Fri Mar 10 07:31:31 2023 +0900

    [MSPAINT] Fix use of uninitialized variable on startup (#5140)
    
    There was an exception in starting up of mspaint of Visual Studio 2019 
build. CORE-18594, CORE-18867
---
 base/applications/mspaint/winproc.cpp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/base/applications/mspaint/winproc.cpp 
b/base/applications/mspaint/winproc.cpp
index 640e596215b..779db8ff51d 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -72,17 +72,18 @@ void CMainWindow::alignChildrenToMainWindow()
         h = clientRect.bottom - 3;
     }
 
-    RECT statusBarRect0;
-    int statusBarBorders[3];
-    if (::IsWindow(hStatusBar))
+    INT statusBarHeight = 0;
+    if (::IsWindowVisible(hStatusBar))
     {
-        ::SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&statusBarRect0);
-        ::SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&statusBarBorders);
+        RECT Rect;
+        INT borders[3];
+        ::SendMessage(hStatusBar, SB_GETRECT, 0, (LPARAM)&Rect);
+        ::SendMessage(hStatusBar, SB_GETBORDERS, 0, (LPARAM)&borders);
+        statusBarHeight = Rect.bottom - Rect.top + borders[1];
     }
-    int statusBarHeight = statusBarRect0.bottom - statusBarRect0.top + 
statusBarBorders[1];
 
     if (scrollboxWindow.IsWindow())
-        scrollboxWindow.MoveWindow(x, y, w, ::IsWindowVisible(hStatusBar) ? h 
- statusBarHeight : h, TRUE);
+        scrollboxWindow.MoveWindow(x, y, w, h - statusBarHeight, TRUE);
     if (paletteWindow.IsWindow())
         paletteWindow.MoveWindow(x, 9, 255, 32, TRUE);
 }

Reply via email to