ReactOS  0.4.14-dev-115-g4576127
CHardErrorThread Class Reference
Collaboration diagram for CHardErrorThread:

Public Member Functions

 CHardErrorThread ()
 
 ~CHardErrorThread ()
 
HRESULT ThreadProc ()
 
void StartThread (PBALLOON_HARD_ERROR_DATA pData)
 

Static Public Member Functions

static DWORD CALLBACK s_HardErrorThreadProc (IN OUT LPVOID lpParameter)
 

Private Attributes

DWORD m_ThreadId
 
HANDLE m_hThread
 
LONG m_bThreadRunning
 
DWORD m_Status
 
DWORD m_dwType
 
CStringW m_Title
 
CStringW m_Text
 

Detailed Description

Definition at line 103 of file taskswnd.cpp.

Constructor & Destructor Documentation

◆ CHardErrorThread()

CHardErrorThread::CHardErrorThread ( )
inline

Definition at line 114 of file taskswnd.cpp.

114  :
115  m_ThreadId(0),
116  m_hThread(NULL),
118  m_Status(NULL),
119  m_dwType(NULL)
120  {
121  }
smooth NULL
Definition: ftsmooth.c:416

◆ ~CHardErrorThread()

CHardErrorThread::~CHardErrorThread ( )
inline

Definition at line 123 of file taskswnd.cpp.

124  {
125  if (m_bThreadRunning)
126  {
127  /* Try to unstuck Show */
130  if (ret == WAIT_TIMEOUT)
133  }
134  }
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
Definition: thread.c:586
#define WM_QUIT
Definition: winuser.h:1605
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define PostThreadMessage
Definition: winuser.h:5734
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret

Member Function Documentation

◆ s_HardErrorThreadProc()

static DWORD CALLBACK CHardErrorThread::s_HardErrorThreadProc ( IN OUT LPVOID  lpParameter)
inlinestatic

Definition at line 168 of file taskswnd.cpp.

169  {
170  CHardErrorThread* pThis = reinterpret_cast<CHardErrorThread*>(lpParameter);
171  pThis->ThreadProc();
172  CloseHandle(pThis->m_hThread);
173  OleUninitialize();
175  return 0;
176  }
#define CloseHandle
Definition: compat.h:398
LPVOID lpParameter
Definition: kernel32.h:241
#define InterlockedExchange
Definition: armddk.h:54
HRESULT ThreadProc()
Definition: taskswnd.cpp:136
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233

Referenced by StartThread().

◆ StartThread()

void CHardErrorThread::StartThread ( PBALLOON_HARD_ERROR_DATA  pData)
inline

Definition at line 178 of file taskswnd.cpp.

179  {
181 
182  /* Ignore the new message if we are already showing one */
183  if (bIsRunning)
184  return;
185 
186  m_Status = pData->Status;
187  m_dwType = pData->dwType;
188  m_Title = (PWCHAR)((ULONG_PTR)pData + pData->TitleOffset);
189  m_Text = (PWCHAR)((ULONG_PTR)pData + pData->MessageOffset);
191  if (!m_hThread)
192  {
195  }
196  }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
CStringW m_Title
Definition: taskswnd.cpp:110
uint16_t * PWCHAR
Definition: typedefs.h:54
uint32_t ULONG_PTR
Definition: typedefs.h:63
unsigned int BOOL
Definition: ntddk_ex.h:94
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
smooth NULL
Definition: ftsmooth.c:416
static DWORD CALLBACK s_HardErrorThreadProc(IN OUT LPVOID lpParameter)
Definition: taskswnd.cpp:168
#define InterlockedExchange
Definition: armddk.h:54
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
CStringW m_Text
Definition: taskswnd.cpp:111

Referenced by CTaskSwitchWnd::OnCopyData().

◆ ThreadProc()

HRESULT CHardErrorThread::ThreadProc ( )
inline

Definition at line 136 of file taskswnd.cpp.

137  {
138  HRESULT hr;
139  CComPtr<IUserNotification> pnotification;
140 
141  hr = OleInitialize(NULL);
142  if (FAILED_UNEXPECTEDLY(hr))
143  return hr;
144 
145  hr = CoCreateInstance(CLSID_UserNotification,
146  NULL,
147  CLSCTX_INPROC_SERVER,
148  IID_PPV_ARG(IUserNotification, &pnotification));
149  if (FAILED_UNEXPECTEDLY(hr))
150  return hr;
151 
152  hr = pnotification->SetBalloonInfo(m_Title, m_Text, NIIF_WARNING);
153  if (FAILED_UNEXPECTEDLY(hr))
154  return hr;
155 
156  hr = pnotification->SetIconInfo(NULL, NULL);
157  if (FAILED_UNEXPECTEDLY(hr))
158  return hr;
159 
160  /* Show will block until the balloon closes */
161  hr = pnotification->Show(NULL, 0);
162  if (FAILED_UNEXPECTEDLY(hr))
163  return hr;
164 
165  return S_OK;
166  }
HRESULT hr
Definition: shlfolder.c:183
CStringW m_Title
Definition: taskswnd.cpp:110
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
#define S_OK
Definition: intsafe.h:59
CStringW m_Text
Definition: taskswnd.cpp:111

Referenced by s_HardErrorThreadProc().

Member Data Documentation

◆ m_bThreadRunning

LONG CHardErrorThread::m_bThreadRunning
private

Definition at line 107 of file taskswnd.cpp.

Referenced by s_HardErrorThreadProc(), StartThread(), and ~CHardErrorThread().

◆ m_dwType

DWORD CHardErrorThread::m_dwType
private

Definition at line 109 of file taskswnd.cpp.

Referenced by StartThread().

◆ m_hThread

HANDLE CHardErrorThread::m_hThread
private

Definition at line 106 of file taskswnd.cpp.

Referenced by s_HardErrorThreadProc(), StartThread(), and ~CHardErrorThread().

◆ m_Status

DWORD CHardErrorThread::m_Status
private

Definition at line 108 of file taskswnd.cpp.

Referenced by StartThread().

◆ m_Text

CStringW CHardErrorThread::m_Text
private

Definition at line 111 of file taskswnd.cpp.

Referenced by StartThread(), and ThreadProc().

◆ m_ThreadId

DWORD CHardErrorThread::m_ThreadId
private

Definition at line 105 of file taskswnd.cpp.

Referenced by StartThread(), and ~CHardErrorThread().

◆ m_Title

CStringW CHardErrorThread::m_Title
private

Definition at line 110 of file taskswnd.cpp.

Referenced by StartThread(), and ThreadProc().


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