FreeSid(AdministratorsGroup);\r
}\r
\r
-/* See if we were launched from a console window. */\r
-static void check_console() {\r
- /* If we're running in a service context there will be no console window. */\r
- HWND console = GetConsoleWindow();\r
- if (! console) return;\r
-\r
- unsigned long pid;\r
- if (! GetWindowThreadProcessId(console, &pid)) return;\r
-\r
- /*\r
- If the process associated with the console window handle is the same as\r
- this process, we were not launched from an existing console. The user\r
- probably double-clicked our executable.\r
- */\r
- if (GetCurrentProcessId() != pid) return;\r
-\r
- /* We close our new console so that subsequent messages appear in a popup. */\r
- FreeConsole();\r
-}\r
-\r
int num_cpus() {\r
DWORD_PTR i, affinity, system_affinity;\r
if (! GetProcessAffinityMask(GetCurrentProcess(), &affinity, &system_affinity)) return 64;\r
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