Merge branch 'born2c0de-master' into dev-chaos

This commit is contained in:
Alberto Ortega 2015-02-12 10:26:05 +01:00
commit 638a7cd84e
3 changed files with 19 additions and 3 deletions

View File

@ -6,9 +6,20 @@
#include "common.h"
void init_cmd_colors() {
unsigned short init_cmd_colors() {
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE handler = GetStdHandle(STD_OUTPUT_HANDLE);
// Get original console colors
GetConsoleScreenBufferInfo(handler, &csbi);
SetConsoleTextAttribute(handler, FOREGROUND_INTENSITY);
// Return original console colors
return csbi.wAttributes;
}
void restore_cmd_colors(unsigned short original_colors) {
HANDLE handler = GetStdHandle(STD_OUTPUT_HANDLE);
// Restore original console colors
SetConsoleTextAttribute(handler, original_colors);
}
void print_header() {

View File

@ -2,7 +2,9 @@
#ifndef COMM_H
#define COMM_H
void init_cmd_colors();
unsigned short init_cmd_colors();
void restore_cmd_colors(unsigned short);
void print_header();

View File

@ -36,10 +36,11 @@ int main(int argc, char *argv[])
{
char icon[] = "Blue fish icon thanks to http://www.fasticon.com/", winverstr[32], aux[1024];
OSVERSIONINFO winver;
unsigned short original_colors = 0;
write_log("Start");
init_cmd_colors();
original_colors = init_cmd_colors();
print_header();
winver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@ -335,6 +336,8 @@ int main(int argc, char *argv[])
fflush(stdin);
getchar();
/* Restore Original Console Colors */
restore_cmd_colors(original_colors);
return 0;
}