-
Notifications
You must be signed in to change notification settings - Fork 9
/
windebugmonitor.h
58 lines (44 loc) · 1.19 KB
/
windebugmonitor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef WINDEBUGMONITOR_H
#define WINDEBUGMONITOR_H
#include "Windows.h"
#include <iostream>
#include <QObject>
//http://www.codeproject.com/Articles/23776/Mechanism-of-OutputDebugString
class WinDebugMonitor : public QObject {
Q_OBJECT
private:
enum {
TIMEOUT_WIN_DEBUG = 100
};
struct dbwin_buffer
{
DWORD dwProcessId;
char data[4096-sizeof(DWORD)];
};
private:
HANDLE m_hDBWinMutex;
HANDLE m_hDBMonBuffer;
HANDLE m_hEventBufferReady;
HANDLE m_hEventDataReady;
HANDLE m_hWinDebugMonitorThread;
BOOL m_bWinDebugMonStopped;
struct dbwin_buffer *m_pDBBuffer;
private:
void Unintialize();
DWORD WinDebugMonitorProcess();
static DWORD WINAPI WinDebugMonitorThread(void *pData);
signals:
void outputDebugString(int, QString);
public:
WinDebugMonitor();
~WinDebugMonitor();
DWORD Initialize();
BOOL IsInitialized() {
return !m_bWinDebugMonStopped;
}
public:
virtual void OutputWinDebugString(int processId, const char *str) {
emit outputDebugString(processId, QString(str));
}
};
#endif // WINDEBUGMONITOR_H