+ {
+ switch (GetLastError())
+ {
+ case ERROR_INVALID_HANDLE:
+ return CH_CONSOLE;
+
+ case ERROR_INVALID_FUNCTION:
+ /*
+ * In case of NUL device return type CH_FILE.
+ * Is this the correct way to test it?
+ */
+ return CH_FILE;
+
+ default:
+ assert(false);
+ }