mirror of
https://github.com/reactos/reactos.git
synced 2024-06-22 22:11:39 +00:00
[SHELL32] Enable _DEBUG and fix assertion failures (#4307)
Improve debuggability. Fix "WorkerW" window class conflict. - Enable _DEBUG macro if debugging, in order to enable ATLASSERT macro. - Fix assertion failures. - Add SHCreateDefaultWorkerWindow helper function and CWorkerTraits, then use them. - Don't create the broker and server windows by themselves, but subclass. CORE-17505, CORE-13950
This commit is contained in:
parent
a92304fdd4
commit
c199edda45
|
@ -1027,7 +1027,8 @@ HRESULT CDefView::FillList()
|
||||||
|
|
||||||
LRESULT CDefView::OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
LRESULT CDefView::OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
m_ListView.UpdateWindow();
|
if (m_ListView.IsWindow())
|
||||||
|
m_ListView.UpdateWindow();
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,14 +66,9 @@ EXTERN_C void FreeChangeNotifications(void)
|
||||||
// The new delivery method is enabled by SHCNRF_NewDelivery flag.
|
// The new delivery method is enabled by SHCNRF_NewDelivery flag.
|
||||||
// With the new delivery method the server directly sends the delivery message.
|
// With the new delivery method the server directly sends the delivery message.
|
||||||
|
|
||||||
typedef CWinTraits <
|
|
||||||
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
|
||||||
WS_EX_TOOLWINDOW
|
|
||||||
> CBrokerTraits;
|
|
||||||
|
|
||||||
// This class brokers all notifications that don't have the SHCNRF_NewDelivery flag
|
// This class brokers all notifications that don't have the SHCNRF_NewDelivery flag
|
||||||
class CChangeNotifyBroker :
|
class CChangeNotifyBroker :
|
||||||
public CWindowImpl<CChangeNotifyBroker, CWindow, CBrokerTraits>
|
public CWindowImpl<CChangeNotifyBroker, CWindow, CWorkerTraits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CChangeNotifyBroker(HWND hwndClient, UINT uMsg) :
|
CChangeNotifyBroker(HWND hwndClient, UINT uMsg) :
|
||||||
|
@ -139,13 +134,15 @@ CreateNotificationBroker(HWND hwnd, UINT wMsg)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND hwndBroker = pBroker->Create(0);
|
HWND hwndBroker = SHCreateDefaultWorkerWindow();
|
||||||
if (hwndBroker == NULL)
|
if (hwndBroker == NULL)
|
||||||
{
|
{
|
||||||
ERR("hwndBroker == NULL\n");
|
ERR("hwndBroker == NULL\n");
|
||||||
delete pBroker;
|
delete pBroker;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pBroker->SubclassWindow(hwndBroker);
|
||||||
return hwndBroker;
|
return hwndBroker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef _PRECOMP_H__
|
#ifndef _PRECOMP_H__
|
||||||
#define _PRECOMP_H__
|
#define _PRECOMP_H__
|
||||||
|
|
||||||
|
#if DBG && !defined(_DEBUG)
|
||||||
|
#define _DEBUG // CORE-17505
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,6 @@ struct ITEM
|
||||||
CDirectoryWatcher *pDirWatch; // for filesystem notification
|
CDirectoryWatcher *pDirWatch; // for filesystem notification
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef CWinTraits <
|
|
||||||
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
|
||||||
WS_EX_TOOLWINDOW
|
|
||||||
> CChangeNotifyServerTraits;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// CChangeNotifyServer
|
// CChangeNotifyServer
|
||||||
//
|
//
|
||||||
|
@ -37,7 +32,7 @@ typedef CWinTraits <
|
||||||
// to this window where all processing takes place.
|
// to this window where all processing takes place.
|
||||||
|
|
||||||
class CChangeNotifyServer :
|
class CChangeNotifyServer :
|
||||||
public CWindowImpl<CChangeNotifyServer, CWindow, CChangeNotifyServerTraits>,
|
public CWindowImpl<CChangeNotifyServer, CWindow, CWorkerTraits>,
|
||||||
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
||||||
public IOleWindow
|
public IOleWindow
|
||||||
{
|
{
|
||||||
|
@ -470,10 +465,10 @@ HRESULT WINAPI CChangeNotifyServer::ContextSensitiveHelp(BOOL fEnterMode)
|
||||||
HRESULT CChangeNotifyServer::Initialize()
|
HRESULT CChangeNotifyServer::Initialize()
|
||||||
{
|
{
|
||||||
// This is called by CChangeNotifyServer_CreateInstance right after instantiation.
|
// This is called by CChangeNotifyServer_CreateInstance right after instantiation.
|
||||||
// Create the window of the server here.
|
HWND hwnd = SHCreateDefaultWorkerWindow();
|
||||||
Create(0);
|
if (!hwnd)
|
||||||
if (!m_hWnd)
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
SubclassWindow(hwnd);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <shlwapi_undoc.h> // for SHCreateWorkerWindowW
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CChangeNotifyServer is a delivery worker window that is managed by CDesktopBrowser.
|
// CChangeNotifyServer is a delivery worker window that is managed by CDesktopBrowser.
|
||||||
// The process of CChangeNotifyServer is same as the process of CDesktopBrowser.
|
// The process of CChangeNotifyServer is same as the process of CDesktopBrowser.
|
||||||
|
@ -89,3 +91,13 @@ typedef struct HANDBAG
|
||||||
#define HANDBAG_MAGIC 0xFACEB00C
|
#define HANDBAG_MAGIC 0xFACEB00C
|
||||||
|
|
||||||
HRESULT CChangeNotifyServer_CreateInstance(REFIID riid, void **ppv);
|
HRESULT CChangeNotifyServer_CreateInstance(REFIID riid, void **ppv);
|
||||||
|
|
||||||
|
#define WORKER_STYLE (WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
|
||||||
|
#define WORKER_EXSTYLE WS_EX_TOOLWINDOW
|
||||||
|
|
||||||
|
typedef CWinTraits<WORKER_STYLE, WORKER_EXSTYLE> CWorkerTraits;
|
||||||
|
|
||||||
|
inline HWND SHCreateDefaultWorkerWindow(VOID)
|
||||||
|
{
|
||||||
|
return SHCreateWorkerWindowW(NULL, NULL, WORKER_EXSTYLE, WORKER_STYLE, NULL, 0);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue