[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:
Katayama Hirofumi MZ
2022-01-25 03:42:46 +09:00
committed by GitHub
parent a92304fdd4
commit c199edda45
5 changed files with 26 additions and 17 deletions

View File

@@ -23,11 +23,6 @@ struct ITEM
CDirectoryWatcher *pDirWatch; // for filesystem notification
};
typedef CWinTraits <
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
WS_EX_TOOLWINDOW
> CChangeNotifyServerTraits;
//////////////////////////////////////////////////////////////////////////////
// CChangeNotifyServer
//
@@ -37,7 +32,7 @@ typedef CWinTraits <
// to this window where all processing takes place.
class CChangeNotifyServer :
public CWindowImpl<CChangeNotifyServer, CWindow, CChangeNotifyServerTraits>,
public CWindowImpl<CChangeNotifyServer, CWindow, CWorkerTraits>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IOleWindow
{
@@ -470,10 +465,10 @@ HRESULT WINAPI CChangeNotifyServer::ContextSensitiveHelp(BOOL fEnterMode)
HRESULT CChangeNotifyServer::Initialize()
{
// This is called by CChangeNotifyServer_CreateInstance right after instantiation.
// Create the window of the server here.
Create(0);
if (!m_hWnd)
HWND hwnd = SHCreateDefaultWorkerWindow();
if (!hwnd)
return E_FAIL;
SubclassWindow(hwnd);
return S_OK;
}