From 3ff42008f4b865cf92dce28996ce9aad9f860e32 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 23 Aug 2003 13:44:37 +0000 Subject: [PATCH] improved error reporting for GCC version svn path=/trunk/; revision=5794 --- .../system/explorer/taskbar/startmenu.cpp | 6 ++-- .../system/explorer/utility/shellclasses.h | 36 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.cpp b/reactos/subsys/system/explorer/taskbar/startmenu.cpp index 2538eed0c52..cf2ae3fcedb 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.cpp +++ b/reactos/subsys/system/explorer/taskbar/startmenu.cpp @@ -418,6 +418,8 @@ void StartMenu::ActivateEntry(int id, ShellEntry* entry) new_folders.push_back(entry->create_absolute_pidl(_hwnd)); + //TODO: merge all entries of subdirectories with the same name, like "All Users\...\Accessories" and "\...\Accessories" + CreateSubmenu(id, new_folders); } else { entry->launch_entry(_hwnd); //TODO: launch in the background @@ -529,11 +531,11 @@ StartMenuRoot::StartMenuRoot(HWND hwnd) { // insert directory "All Users\Start Menu" ShellDirectory cmn_startmenu(Desktop(), SpecialFolderPath(CSIDL_COMMON_STARTMENU, _hwnd), _hwnd); - _dirs.push_back(StartMenuDirectory(cmn_startmenu, false)); // dont't add subfolders + _dirs.push_back(StartMenuDirectory(cmn_startmenu, false)); // don't add subfolders // insert directory "\Start Menu" ShellDirectory usr_startmenu(Desktop(), SpecialFolderPath(CSIDL_STARTMENU, _hwnd), _hwnd); - _dirs.push_back(StartMenuDirectory(usr_startmenu, false)); // dont't add subfolders + _dirs.push_back(StartMenuDirectory(usr_startmenu, false)); // don't add subfolders } diff --git a/reactos/subsys/system/explorer/utility/shellclasses.h b/reactos/subsys/system/explorer/utility/shellclasses.h index 07a0b5291e0..5fbace694c6 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.h +++ b/reactos/subsys/system/explorer/utility/shellclasses.h @@ -54,24 +54,35 @@ using namespace _com_util; #else -struct COMException { +struct COMException +{ COMException(HRESULT hr) - : _hr(hr) + : _hr(hr) { - _msg = NULL; } LPCTSTR ErrorMessage() const { - if (!_msg) - _msg = TEXT("COM Exception"); //TODO: use FormatMessage() + if (_msg.empty()) { + LPTSTR pBuf; + + if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + 0, _hr, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPSTR)&pBuf, 0, NULL)) { + _msg = pBuf; + LocalFree(pBuf); + } else { + TCHAR buffer[128]; + _stprintf(buffer, _T("unknown COM Exception: 0x%08X"), _hr); + _msg = buffer; + } + } return _msg; } protected: HRESULT _hr; - mutable LPCTSTR _msg; + mutable String _msg; }; inline void CheckError(HRESULT hr) @@ -213,12 +224,12 @@ template struct SShellPtr protected: SShellPtr() - : _p(0) + : _p(0) { } SShellPtr(T* p) - : _p(p) + : _p(p) { } @@ -243,11 +254,12 @@ private: template struct SIfacePtr { SIfacePtr() - : _p(0) + : _p(0) { } - SIfacePtr(T* p) : _p(p) + SIfacePtr(T* p) + : _p(p) { if (p) p->AddRef(); @@ -322,7 +334,7 @@ template struct SIfacePtr protected: SIfacePtr(const SIfacePtr& o) - : _p(o._p) + : _p(o._p) { if (_p) _p->AddRef(); @@ -458,7 +470,7 @@ struct ShellPath : public SShellPtr } ShellPath(ITEMIDLIST* p) - : SShellPtr(p) + : SShellPtr(p) { }