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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
#include "CE_Screen_Output.h"
#include <string.h>
// This utility does not use ACE, and shouldn't.
//FUZZ: disable check_for_lack_ACE_OS
HWND CE_Screen_Output::handler_ = 0;
CE_Screen_Output::CE_Screen_Output()
: pFile_(0)
{
}
CE_Screen_Output::~CE_Screen_Output()
{
if (pFile_ != 0) {
fclose(pFile_);
}
}
void CE_Screen_Output::SetOutputWindow(HWND hEdit)
{
handler_ = hEdit;
}
void CE_Screen_Output::clear()
{
SetWindowText(handler_, 0);
}
CE_Screen_Output& CE_Screen_Output::operator << (wchar_t* output)
{
int length = GetWindowTextLength(handler_);
SendMessage(handler_, EM_SETSEL, length, length);
SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output);
if (pFile_ != 0)
{
fwprintf(pFile_, L"%s", output);
}
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (const wchar_t* output)
{
wchar_t* buffer = _wcsdup(output);
if (buffer != 0)
{
*this << buffer;
delete buffer;
}
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (char* output)
{
int len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, 0, 0);
wchar_t* w_output = new wchar_t[len];
MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, w_output, len);
*this << w_output;
delete w_output;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (const char* output)
{
int len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, 0, 0);
wchar_t* w_output = new wchar_t[len];
MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, output, -1, w_output, len);
*this << w_output;
delete [] w_output;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (char output)
{
*this << (int)output;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (unsigned char output)
{
*this << (int)output;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (unsigned short output)
{
wchar_t buffer[20];
wsprintf(buffer, L"%u", output);
*this << buffer;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (int output)
{
wchar_t buffer[20];
wsprintf(buffer, L"%d", output);
*this << buffer;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (unsigned int output)
{
wchar_t buffer[20];
wsprintf(buffer, L"%du", output);
*this << buffer;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (float output)
{
wchar_t buffer[20];
swprintf(buffer, L"%f", output);
*this << buffer;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (long output)
{
wchar_t buffer[20];
wsprintf(buffer, L"%l", output);
*this << buffer;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (unsigned long output)
{
wchar_t buffer[20];
wsprintf(buffer, L"%lu", output);
*this << buffer;
return *this;
}
CE_Screen_Output& CE_Screen_Output::operator << (FILE* pFile)
{
pFile_ = pFile;
return *this;
}
//FUZZ: enable check_for_lack_ACE_OS
|