ReactOS  0.4.15-dev-1384-g878186b
CDesktopThread Class Reference
Collaboration diagram for CDesktopThread:

Public Member Functions

 CDesktopThread ()
 
HRESULT Initialize (IN OUT ITrayWindow *pTray)
 
void Destroy ()
 

Private Member Functions

DWORD DesktopThreadProc ()
 

Static Private Member Functions

static DWORD CALLBACK s_DesktopThreadProc (IN OUT LPVOID lpParameter)
 

Private Attributes

HANDLE m_hEvent
 
CComPtr< ITrayWindow > m_Tray
 

Detailed Description

Definition at line 23 of file desktop.cpp.

Constructor & Destructor Documentation

◆ CDesktopThread()

CDesktopThread::CDesktopThread ( )
inline

Definition at line 65 of file desktop.cpp.

65  :
66  m_hEvent(NULL),
67  m_Tray(NULL)
68  {
69  }
CComPtr< ITrayWindow > m_Tray
Definition: desktop.cpp:26
HANDLE m_hEvent
Definition: desktop.cpp:25
#define NULL
Definition: types.h:112

Member Function Documentation

◆ DesktopThreadProc()

DWORD CDesktopThread::DesktopThreadProc ( )
inlineprivate

Definition at line 28 of file desktop.cpp.

29  {
31  HANDLE hDesktop;
32  HRESULT hRet;
33 
35 
36  hRet = m_Tray->QueryInterface(IID_PPV_ARG(IShellDesktopTray, &pSdt));
37  if (!SUCCEEDED(hRet))
38  return 1;
39 
40  hDesktop = _SHCreateDesktop(pSdt);
41  if (hDesktop == NULL)
42  return 1;
43 
44  if (!SetEvent(m_hEvent))
45  {
46  /* Failed to notify that we initialized successfully, kill ourselves
47  to make the main thread wake up! */
48  return 1;
49  }
50 
51  _SHDesktopMessageLoop(hDesktop);
52 
53  /* FIXME: Properly rundown the main thread! */
54  ExitProcess(0);
55 
56  return 0;
57  }
CComPtr< ITrayWindow > m_Tray
Definition: desktop.cpp:26
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1487
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define IID_PPV_ARG(Itype, ppType)
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop)
Definition: rshell.cpp:81
if SUCCEEDED(hr)
HANDLE m_hEvent
Definition: desktop.cpp:25
LONG HRESULT
Definition: typedefs.h:79
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk)
Definition: rshell.cpp:52
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define NULL
Definition: types.h:112

◆ Destroy()

void CDesktopThread::Destroy ( )
inline

Definition at line 111 of file desktop.cpp.

112  {
113  return;
114  }

Referenced by DesktopDestroyShellWindow().

◆ Initialize()

HRESULT CDesktopThread::Initialize ( IN OUT ITrayWindow *  pTray)
inline

Definition at line 71 of file desktop.cpp.

72  {
74  HANDLE Handles[2];
75 
76  m_Tray = pTray;
77 
79  if (!m_hEvent)
80  return E_FAIL;
81 
83  if (!hThread)
84  {
86  return E_FAIL;
87  }
88 
89  Handles[0] = hThread;
90  Handles[1] = m_hEvent;
91 
92  for (;;)
93  {
94  DWORD WaitResult = MsgWaitForMultipleObjects(_countof(Handles), Handles, FALSE, INFINITE, QS_ALLEVENTS);
95  if (WaitResult == WAIT_OBJECT_0 + _countof(Handles))
96  {
98  }
99  else if (WaitResult != WAIT_FAILED && WaitResult != WAIT_OBJECT_0)
100  {
101  break;
102  }
103  }
104 
107 
108  return S_OK;
109  }
#define CloseHandle
Definition: compat.h:598
CComPtr< ITrayWindow > m_Tray
Definition: desktop.cpp:26
VOID TrayProcessMessages(IN OUT ITrayWindow *Tray)
#define E_FAIL
Definition: ddrawi.h:102
static DWORD CALLBACK s_DesktopThreadProc(IN OUT LPVOID lpParameter)
Definition: desktop.cpp:59
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define FALSE
Definition: types.h:117
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
#define QS_ALLEVENTS
Definition: winuser.h:873
HANDLE m_hEvent
Definition: desktop.cpp:25
#define WAIT_OBJECT_0
Definition: winbase.h:387
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_FAILED
Definition: winbase.h:394
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:27
#define INFINITE
Definition: serial.h:102

Referenced by DesktopCreateWindow().

◆ s_DesktopThreadProc()

static DWORD CALLBACK CDesktopThread::s_DesktopThreadProc ( IN OUT LPVOID  lpParameter)
inlinestaticprivate

Definition at line 59 of file desktop.cpp.

60  {
61  return reinterpret_cast<CDesktopThread*>(lpParameter)->DesktopThreadProc();
62  }
LPVOID lpParameter
Definition: kernel32.h:241

Referenced by Initialize().

Member Data Documentation

◆ m_hEvent

HANDLE CDesktopThread::m_hEvent
private

Definition at line 25 of file desktop.cpp.

Referenced by DesktopThreadProc(), and Initialize().

◆ m_Tray

CComPtr<ITrayWindow> CDesktopThread::m_Tray
private

Definition at line 26 of file desktop.cpp.

Referenced by DesktopThreadProc(), and Initialize().


The documentation for this class was generated from the following file: