Fixed service context detection when built with VS2013.
[nssm.git] / nssm.cpp
index 6456c97..35001d3 100644 (file)
--- a/nssm.cpp
+++ b/nssm.cpp
@@ -136,7 +136,7 @@ int _tmain(int argc, TCHAR **argv) {
     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