https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1952e5b795433039d238952dbdc9dbc34ab0c404

commit 1952e5b795433039d238952dbdc9dbc34ab0c404
Author:     Mark Jansen <[email protected]>
AuthorDate: Wed Mar 10 23:43:06 2021 +0100
Commit:     GitHub <[email protected]>
CommitDate: Thu Mar 11 07:43:06 2021 +0900

    Fix some assertions now that they are enabled (#3524)
    
    Fix some assertions, hack out some others (they need more ATL work).
    CORE-17505
---
 base/shell/explorer/syspager.cpp              | 5 ++++-
 base/shell/explorer/taskswnd.cpp              | 2 ++
 base/shell/explorer/traywnd.cpp               | 8 +++++++-
 dll/shellext/netshell/lanstatusui.cpp         | 1 +
 dll/win32/shell32/shellmenu/CMenuToolbars.cpp | 8 +++++---
 dll/win32/shell32/shellmenu/CMenuToolbars.h   | 2 ++
 sdk/include/reactos/rosctrls.h                | 2 ++
 7 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/base/shell/explorer/syspager.cpp b/base/shell/explorer/syspager.cpp
index 7e61b00a042..d6f729d2d7b 100644
--- a/base/shell/explorer/syspager.cpp
+++ b/base/shell/explorer/syspager.cpp
@@ -1231,7 +1231,10 @@ void CNotifyToolbar::Initialize(HWND hWndParent, 
CBalloonQueue * queue)
         TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | 
TBSTYLE_TRANSPARENT |
         CCS_TOP | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER;
 
-    SubclassWindow(CToolbar::Create(hWndParent, styles));
+    HWND toolbar = CToolbar::Create(hWndParent, styles);
+    //HACK: We have not created this toolbar properly, so we need to subclass 
it now!
+    m_hWnd = NULL;
+    SubclassWindow(toolbar);
 
     // Force the toolbar tooltips window to always show tooltips even if not 
foreground
     HWND tooltipsWnd = (HWND)SendMessageW(TB_GETTOOLTIPS);
diff --git a/base/shell/explorer/taskswnd.cpp b/base/shell/explorer/taskswnd.cpp
index f8f4147c225..03a2b3f02a0 100644
--- a/base/shell/explorer/taskswnd.cpp
+++ b/base/shell/explorer/taskswnd.cpp
@@ -287,6 +287,8 @@ public:
 
         HWND toolbar = CToolbar::Create(hWndParent, styles);
         SetDrawTextFlags(DT_NOPREFIX, DT_NOPREFIX);
+        //HACK: We have not created this toolbar properly, so we need to 
subclass it now!
+        m_hWnd = NULL;
         return SubclassWindow(toolbar);
     }
 };
diff --git a/base/shell/explorer/traywnd.cpp b/base/shell/explorer/traywnd.cpp
index 8dd491b0678..8dad6c4e2a1 100644
--- a/base/shell/explorer/traywnd.cpp
+++ b/base/shell/explorer/traywnd.cpp
@@ -200,7 +200,11 @@ public:
 
     VOID Initialize()
     {
-        SubclassWindow(m_hWnd);
+        //HACK: We have not created this button properly, so we need to 
subclass it now!
+        HWND button = m_hWnd;
+        m_hWnd = NULL;
+        SubclassWindow(button);
+
         SetWindowTheme(m_hWnd, L"Start", NULL);
 
         m_ImageList = ImageList_LoadImageW(hExplorerInstance,
@@ -214,6 +218,8 @@ public:
         UpdateSize();
     }
 
+    // Hack:
+    // Use DECLARE_WND_SUPERCLASS instead!
     HWND Create(HWND hwndParent)
     {
         WCHAR szStartCaption[32];
diff --git a/dll/shellext/netshell/lanstatusui.cpp 
b/dll/shellext/netshell/lanstatusui.cpp
index 9210699b622..19b0e676a2b 100644
--- a/dll/shellext/netshell/lanstatusui.cpp
+++ b/dll/shellext/netshell/lanstatusui.cpp
@@ -915,6 +915,7 @@ CLanStatus::InitializeNetTaskbarNotifications()
     Index = 1;
     while (TRUE)
     {
+        pNetCon.Release();
         hr = pEnumCon->Next(1, &pNetCon, &Count);
         if (hr != S_OK)
             break;
diff --git a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp 
b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
index 86bacd2a6f8..984be9ecfc7 100644
--- a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
+++ b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
@@ -398,7 +398,7 @@ HRESULT CMenuToolbarBase::CreateToolbar(HWND hwndParent, 
DWORD dwFlags)
         rc.bottom = 1;
     }
 
-    SubclassWindow(CToolbar::Create(hwndParent, tbStyles, tbExStyles));
+    CToolbar::Create(hwndParent, tbStyles, tbExStyles);
 
     SetWindowTheme(m_hWnd, L"", L"");
 
@@ -1163,7 +1163,8 @@ HRESULT  CMenuStaticToolbar::SetMenu(
     m_hwndMenu = hwnd;
     m_dwMenuFlags = dwFlags;
 
-    ClearToolbar();
+    if (IsWindow())
+        ClearToolbar();
 
     return S_OK;
 }
@@ -1408,7 +1409,8 @@ HRESULT CMenuSFToolbar::SetShellFolder(IShellFolder *psf, 
LPCITEMIDLIST pidlFold
     m_hKey = hKey;
     m_dwMenuFlags = dwFlags;
 
-    ClearToolbar();
+    if (IsWindow())
+        ClearToolbar();
 
     return S_OK;
 }
diff --git a/dll/win32/shell32/shellmenu/CMenuToolbars.h 
b/dll/win32/shell32/shellmenu/CMenuToolbars.h
index 6463166d258..a7ecb45b0ed 100644
--- a/dll/win32/shell32/shellmenu/CMenuToolbars.h
+++ b/dll/win32/shell32/shellmenu/CMenuToolbars.h
@@ -135,6 +135,8 @@ private:
         MESSAGE_HANDLER(WM_COMMAND, OnWinEventWrap)
         MESSAGE_HANDLER(WM_NOTIFY, OnWinEventWrap)
         MESSAGE_HANDLER(WM_TIMER, OnPopupTimer)
+    ALT_MSG_MAP(1)
+        // No pager specific handlers yet
     END_MSG_MAP()
 };
 
diff --git a/sdk/include/reactos/rosctrls.h b/sdk/include/reactos/rosctrls.h
index 73e7cfab1d2..0f1d7f73e61 100644
--- a/sdk/include/reactos/rosctrls.h
+++ b/sdk/include/reactos/rosctrls.h
@@ -251,6 +251,8 @@ class CToolbar :
 {
 public: // Configuration methods
 
+    // Hack:
+    // Use DECLARE_WND_SUPERCLASS instead!
     HWND Create(HWND hWndParent, DWORD dwStyles = 0, DWORD dwExStyles = 0)
     {
         if (!dwStyles)

Reply via email to