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

commit feff2b1e6c5e3b2ece225e20d32b98c2bd813617
Author:     Thamatip Chitpong <[email protected]>
AuthorDate: Sat Dec 3 22:00:22 2022 +0700
Commit:     GitHub <[email protected]>
CommitDate: Sat Dec 3 16:00:22 2022 +0100

    [EXPLORER] Fix Windows XP compatibility (#4923)
    
    
    CORE-18694
    It regressed by 0.4.15-dev-4596-g 1aa95f389772901970369afa3abfb207df6f57f6
---
 base/shell/explorer/desktop.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/base/shell/explorer/desktop.cpp b/base/shell/explorer/desktop.cpp
index 764c9b0f975..d492be6c8d5 100644
--- a/base/shell/explorer/desktop.cpp
+++ b/base/shell/explorer/desktop.cpp
@@ -26,6 +26,7 @@ private:
     CComPtr<ITrayWindow> m_Tray;
     HANDLE m_hInitEvent;
     HANDLE m_hThread;
+    DWORD m_ThreadId;
 
     DWORD DesktopThreadProc();
     static DWORD WINAPI s_DesktopThreadProc(LPVOID lpParameter);
@@ -43,7 +44,8 @@ public:
 CDesktopThread::CDesktopThread():
     m_Tray(NULL),
     m_hInitEvent(NULL),
-    m_hThread(NULL)
+    m_hThread(NULL),
+    m_ThreadId(0)
 {
 }
 
@@ -68,7 +70,7 @@ HRESULT CDesktopThread::Initialize(ITrayWindow* pTray)
     }
 
     m_Tray = pTray;
-    m_hThread = CreateThread(NULL, 0, s_DesktopThreadProc, (LPVOID)this, 0, 
NULL);
+    m_hThread = CreateThread(NULL, 0, s_DesktopThreadProc, (LPVOID)this, 0, 
&m_ThreadId);
 
     if (!m_hThread)
     {
@@ -99,6 +101,7 @@ HRESULT CDesktopThread::Initialize(ITrayWindow* pTray)
         {
             CloseHandle(m_hThread);
             m_hThread = NULL;
+            m_ThreadId = 0;
 
             CloseHandle(m_hInitEvent);
             m_hInitEvent = NULL;
@@ -119,12 +122,13 @@ void CDesktopThread::Destroy()
         if (WaitResult == WAIT_TIMEOUT)
         {
             /* Send WM_QUIT message to the thread and wait for it to terminate 
*/
-            PostThreadMessageW(GetThreadId(m_hThread), WM_QUIT, 0, 0);
+            PostThreadMessageW(m_ThreadId, WM_QUIT, 0, 0);
             WaitForSingleObject(m_hThread, INFINITE);
         }
 
         CloseHandle(m_hThread);
         m_hThread = NULL;
+        m_ThreadId = 0;
     }
 
     if (m_hInitEvent)

Reply via email to