[RSHELL]
authorDavid Quintana <gigaherz@gmail.com>
Sun, 2 Nov 2014 20:17:23 +0000 (20:17 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Sun, 2 Nov 2014 20:17:23 +0000 (20:17 +0000)
[STOBJECT]
* Some nitpicking.

[SHELL32]
* Fix missing null-termination by using proper string literals.

svn path=/branches/shell-experiments/; revision=65194

base/shell/rshell/CDesktopBrowser.cpp
base/shell/rshell/CStartMenu.cpp
dll/shellext/stobject/csystray.cpp
dll/win32/shell32/desktop.cpp
include/reactos/undocshell.h
lib/atl/atlwin.h

index 928d0ee..01985dc 100644 (file)
@@ -26,10 +26,8 @@ BOOL WINAPI SetShellWindowEx(HWND, HWND);
 
 #define SHDESK_TAG 0x4b534544
 
-static const WCHAR szProgmanClassName [] = { 'P', 'r', 'o', 'g', 'm', 'a', 'n' };
-static const WCHAR szProgmanWindowName [] = {
-    'P', 'r', 'o', 'g', 'r', 'a', 'm', ' ', 'M', 'a', 'n', 'a', 'g', 'e', 'r'
-};
+static const WCHAR szProgmanClassName [] = L"Progman";
+static const WCHAR szProgmanWindowName [] = L"Program Manager";
 
 class CDesktopBrowser :
     public CComObjectRootEx<CComMultiThreadModelNoCS>,
@@ -542,7 +540,7 @@ HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk)
         rcDesk.bottom = GetSystemMetrics(SM_CYSCREEN);
     }
 
-    hWndDesk = CreateWindowExW(0, szProgmanClassName, szProgmanWindowName,
+    hWndDesk = CreateWindowExW(WS_EX_TOOLWINDOW, szProgmanClassName, szProgmanWindowName,
         WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
         rcDesk.left, rcDesk.top, rcDesk.right, rcDesk.bottom,
         NULL, NULL, shell32_hInstance, reinterpret_cast<LPVOID>(ShellDesk));
index 9889a95..0abaacc 100644 (file)
@@ -85,13 +85,20 @@ private:
             return S_OK;
 
         hr = IUnknown_GetSite(m_pDeskBar, IID_PPV_ARG(ITrayPriv, &m_pTrayPriv));
+        if (FAILED_UNEXPECTEDLY(hr))
+            return hr;
+
         hr = IUnknown_GetWindow(m_pTrayPriv, &m_hwndTray);
+        if (FAILED_UNEXPECTEDLY(hr))
+            return hr;
+
         hr = m_pTrayPriv->AppendMenuW(&hmenu);
-#ifndef TEST_TRACKPOPUPMENU_SUBMENUS
+        if (FAILED_UNEXPECTEDLY(hr))
+            return hr;
+
         hr = m_pShellMenu->SetMenu(hmenu, NULL, SMSET_BOTTOM);
-#else
-        hr = m_pShellMenu->SetMenu(hmenu, m_hwndTray, SMSET_BOTTOM);
-#endif
+        if (FAILED_UNEXPECTEDLY(hr))
+            return hr;
 
         return hr;
     }
index ac7ae7e..f7a1868 100644 (file)
@@ -194,6 +194,7 @@ BOOL CSysTray::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
         UpdateIcons();
         return TRUE;
     case WM_DESTROY:
+        KillTimer(1);
         ShutdownIcons();
         return TRUE;
     }
index 51dbfa8..b27168b 100644 (file)
@@ -26,10 +26,8 @@ BOOL WINAPI SetShellWindowEx(HWND, HWND);
 
 #define SHDESK_TAG 0x4b534544
 
-static const WCHAR szProgmanClassName[] = {'P','r','o','g','m','a','n'};
-static const WCHAR szProgmanWindowName[] = {
-    'P','r','o','g','r','a','m',' ','M','a','n','a','g','e','r'
-};
+static const WCHAR szProgmanClassName [] = L"Progman";
+static const WCHAR szProgmanWindowName [] = L"Program Manager";
 
 class CDesktopBrowser :
     public CComObjectRootEx<CComMultiThreadModelNoCS>,
@@ -543,7 +541,7 @@ HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk)
         rcDesk.bottom = GetSystemMetrics(SM_CYSCREEN);
     }
 
-    hWndDesk = CreateWindowExW(0, szProgmanClassName, szProgmanWindowName,
+    hWndDesk = CreateWindowExW(WS_EX_TOOLWINDOW, szProgmanClassName, szProgmanWindowName,
         WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
         rcDesk.left, rcDesk.top, rcDesk.right, rcDesk.bottom,
         NULL, NULL, shell32_hInstance, (LPVOID)ShellDesk);
index 942ca8b..da8b18b 100644 (file)
@@ -823,6 +823,29 @@ HRESULT inline ShellObjectCreatorInit(REFIID riid, void ** ppv)
     return S_OK;
 }
 
+template<class T, class T1>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
+{
+    CComPtr<T>  obj;
+    HRESULT     hResult;
+
+    if (ppv == NULL)
+        return E_POINTER;
+    *ppv = NULL;
+    ATLTRY(obj = new _CComObject<T>);
+    if (obj.p == NULL)
+        return E_OUTOFMEMORY;
+    hResult = obj->QueryInterface(riid, ppv);
+    if (FAILED(hResult))
+        return hResult;
+
+    hResult = obj->Initialize(initArg1);
+    if (FAILED(hResult))
+        return hResult;
+
+    return S_OK;
+}
+
 template<class T, class T1, class R>
 HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, R ** ppv)
 {
@@ -926,6 +949,32 @@ HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4
 
     return S_OK;
 }
+
+template<class T, class T1, class T2, class T3, class T4, class T5, class R>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, T5 initArg5, REFIID riid, R ** ppv)
+{
+    CComPtr<T>  obj;
+    CComPtr<R>  result;
+    HRESULT     hResult;
+
+    if (ppv == NULL)
+        return E_POINTER;
+    *ppv = NULL;
+    ATLTRY(obj = new _CComObject<T>);
+    if (obj.p == NULL)
+        return E_OUTOFMEMORY;
+    hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result));
+    if (FAILED(hResult))
+        return hResult;
+
+    hResult = obj->Initialize(initArg1, initArg2, initArg3, initArg4, initArg5);
+    if (FAILED(hResult))
+        return hResult;
+
+    *ppv = result.Detach();
+
+    return S_OK;
+}
 #endif /* __cplusplus */
 
 #endif /* __WINE_UNDOCSHELL_H */
index 0031c58..7cfc38d 100644 (file)
@@ -696,6 +696,10 @@ public:                                                                                                                                                                                                                                            \
                {                                                                                                                                                                                                                                       \
                case 0:
 
+#define ALT_MSG_MAP(map)                                                                                                                                               \
+            break;                                                                                                                                                             \
+        case map:
+
 #define END_MSG_MAP()                                                                                                                                                  \
                        break;                                                                                                                                                          \
                default:                                                                                                                                                                \