summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/inspircd_win32wrapper.cpp13
-rw-r--r--win/inspircd_win32wrapper.h8
2 files changed, 21 insertions, 0 deletions
diff --git a/win/inspircd_win32wrapper.cpp b/win/inspircd_win32wrapper.cpp
index c6f5d8232..169741ba5 100644
--- a/win/inspircd_win32wrapper.cpp
+++ b/win/inspircd_win32wrapper.cpp
@@ -55,3 +55,16 @@ DWORD CWin32Exception::GetErrorCode()
{
return dwErrorCode;
}
+
+WindowsStream::WindowsStream(DWORD handle)
+ : BackgroundColor(0)
+ , ForegroundColor(FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN)
+{
+ this->Handle = GetStdHandle(handle);
+ CONSOLE_SCREEN_BUFFER_INFO bufinf;
+ if (GetConsoleScreenBufferInfo(this->Handle, &bufinf))
+ {
+ this->BackgroundColor = bufinf.wAttributes & 0x00F0;
+ this->ForegroundColor = bufinf.wAttributes & 0x00FF;
+ }
+}
diff --git a/win/inspircd_win32wrapper.h b/win/inspircd_win32wrapper.h
index 49fc1c665..0f492c924 100644
--- a/win/inspircd_win32wrapper.h
+++ b/win/inspircd_win32wrapper.h
@@ -196,3 +196,11 @@ struct sockaddr_un
ADDRESS_FAMILY sun_family;
char sun_path[6];
};
+
+struct WindowsStream
+{
+ WORD BackgroundColor;
+ WORD ForegroundColor;
+ HANDLE Handle;
+ WindowsStream(DWORD handle);
+}; \ No newline at end of file