00097 {
00098 SECURITY_ATTRIBUTES SecurityAttributes;
00099 HANDLE
Handle;
00100
int i;
00101 CONSOLE_GRAPHICS_BUFFER_INFO GraphicsInfo;
00102 SMALL_RECT
Rect;
00103
BOOL Success;
00104 ULONG NumWritten;
00105
00106
DbgPrint(
"TGRAPH: Entering graphics Test Program\n" );
00107
00108
00109
00110
00111
00112
00113 SecurityAttributes.bInheritHandle =
FALSE;
00114 SecurityAttributes.lpSecurityDescriptor =
NULL;
00115 SecurityAttributes.nLength =
sizeof (SECURITY_ATTRIBUTES);
00116 GraphicsInfo.dwBitMapInfoLength =
sizeof(
bmiPat);
00117 GraphicsInfo.lpBitMapInfo = &
bmiPat;
00118 GraphicsInfo.dwUsage = DIB_RGB_COLORS;
00119
Handle =
CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
00120 FILE_SHARE_READ | FILE_SHARE_WRITE,
00121 &SecurityAttributes,
00122 CONSOLE_GRAPHICS_BUFFER,
00123 &GraphicsInfo
00124 );
00125
if (
Handle == (HANDLE)-1) {
00126
DbgPrint(
"CreateConsoleScreenBuffer failed\n");
00127
return FALSE;
00128 }
00129
00130
00131
00132
00133
00134
if (!
SetConsoleActiveScreenBuffer(Handle)) {
00135
DbgPrint(
"SetConsoleActiveScreenBuffer failed\n");
00136
return FALSE;
00137 }
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 Success = WaitForSingleObject(GraphicsInfo.hMutex,-1);
00156
if (Success) {
00157
DbgPrint(
"WaitForSingleObject failed\n");
00158 }
00159
else {
00160
DbgPrint(
"WaitForSingleObject succeeded\n");
00161 }
00162
00163
00164
00165
00166
00167 RtlCopyMemory(GraphicsInfo.lpBitMap,abBigCat,(32*128/8));
00168
00169
00170
00171
00172
00173 ReleaseMutex(GraphicsInfo.hMutex);
00174
00175
00176
00177
00178
00179
Rect.Left = 0;
00180
Rect.Top = 0;
00181
Rect.Right = 31;
00182
Rect.Bottom = 31;
00183 Success =
InvalidateConsoleDIBits(Handle,&Rect);
00184
if (!Success) {
00185
DbgPrint(
"InvalidateConsoleDIBits failed\n");
00186 }
00187
else {
00188
DbgPrint(
"InvalidateConsoleDIBits succeeded\n");
00189 }
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
while (
TRUE) {
00211 Sleep(10000);
00212 }
00213
00214
if (!
SetConsoleActiveScreenBuffer(GetStdHandle(STD_OUTPUT_HANDLE))) {
00215
DbgPrint(
"SetConsoleActiveScreenBuffer failed\n");
00216
return FALSE;
00217 }
00218
00219
if (!CloseHandle(Handle)) {
00220
DbgPrint(
"CloseHandle failed\n");
00221
return FALSE;
00222 }
00223
00224
DbgPrint(
"TGRAPH: Exiting Test Program\n" );
00225
00226
return TRUE;
00227 }