Visual Studio 2013 includes a C runtime which assigns stdin, stdout and
stderr the file descriptors 0, 1 and 2 - just like UNIX does - even if
there are no streams available. Thus we can no longer use "_fileno(stdin)
< 0" as a check for running in a service context.
Instead we check for "GetStdHandle(STD_INPUT_HANDLE) == 0" which works
when compiled with older or newer versions of Visual Studio.
Thanks Czenda Czendov.
actually running as a service.\r
This will save time when running with no arguments from a command prompt.\r
*/\r
- if (_fileno(stdin) < 0) {\r
+ if (! GetStdHandle(STD_INPUT_HANDLE)) {\r
/* Set up function pointers. */\r
if (get_imports()) exit(111);\r
\r