#define BLACK '*'
#define WHITE ' '
#define FRAME_SIZE (80*25)
unsigned frame_count = 0;
unsigned frame_point = 0;
unsigned char frame[FRAME_SIZE * 2];
int getframe()
{
if (data_point == data_size) {
return 0;
}
if (frame_point >= FRAME_SIZE) {
memcpy(frame, frame + FRAME_SIZE, FRAME_SIZE);
frame_point = frame_point - FRAME_SIZE;
}
do {
auto ch = data[data_point++];
for (auto i = 0; i < (ch & 0x7F); i++) {
frame[frame_point++] = (ch & 0x80) ? BLACK : WHITE;
}
} while (frame_point < FRAME_SIZE);
frame_count++;
return 1;
}
void printframe() {
char process[64] = {};
RtlStringCchPrintfA(process,ARRAYSIZE(process), "%04d/5260 ", frame_count);
memcpy(frame, process, strlen(process));
ULONG x1 = 0, y1 = 0, x2 = 639, y2 = 399;
InbvSolidColorFill(x1, y1, x2, y2, 4);//刷新
InbvSetScrollRegion(x1, y1, x2, y2);//设置光标
InbvDisplayString(frame);
}
void testBadApple()
{
ULONG x1 = 0, y1 = 0, x2 = 639, y2 = 399;
UCHAR SpareColor = 4; // blue,1 red 颜色很多,需要猜测!
UCHAR BackColor = 3; // green
UCHAR TextColor = 15; // white
//接管系统显示
InbvAcquireDisplayOwnership();
//恢复屏幕
//重设屏幕会让屏幕运行在黑色的世界里
InbvResetDisplay();
//画个屏幕区域
InbvSolidColorFill(0, 0, 639, 479, 4); // blue, 640x480
//InbvSolidColorFill(x1, y1, x2, y2, SpareColor); // green, (x1,y1)x(x2,y1)
InbvSetTextColor(TextColor); // white
//设置文字显示模式
InbvInstallDisplayStringFilter((INBV_DISPLAY_STRING_FILTER)NULL);
InbvEnableDisplayString(TRUE);
//设置文字光标位置
InbvSetScrollRegion(x1, y1, x2, y2);
//下面动画开始
while (getframe())
{
printframe();
ddk::util::sleep(ddk::util::milli_seconds(24));
}
//表演结束直接KeBugCheck重启
//KeBugCheck(POWER_FAILURE_SIMULATE);
//TODO:恢复屏幕
//这个需要调用Win32k!NtUserChangeDisplaySettings(NULL, NULL, 0x40000000, NULL);
return;
}
BadApple的字符数据——很久很久之前从某个喜闻乐见的工程里复制的数组我的badapple都用这个——不记得是谁的了,谁记起来是自己的可以联系,我给你加上版权,具体见附件代码:cpp那个
至于声音啊,用exe用ioctrl等等方式通信去配合,反正最后还要调用ChangeDisplaySettingsEx重设喽,exe怎么放音乐?mciSendCommand啊,当然是mciSendCommand啦