Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Injected-Via-Gmane: http://gmane.org/ To: cygwin AT cygwin DOT com From: Mark Ord Subject: shutdown-1.3-1 patch for Win9x Date: Sat, 13 Sep 2003 05:30:55 +0000 (UTC) Lines: 65 Message-ID: Reply-To: ord AT alphalink DOT com DOT au X-Complaints-To: usenet AT sea DOT gmane DOT org User-Agent: tin/1.4.7-20030322 ("Suggestions") (UNIX) (CYGWIN_98-4.10/1.3.22(0.78/3/2) (i686)) Although shutdown.exe works fine on NT (XP at least), it's not possible to shutdown a system to a power off state with shutdown.exe on Win9x (Win98SE tested). It's been my experience (on Win98SE anyway) that it's directly related to the ShutdownEx() API. Despite what the API docs say, EWX_POWEROFF actually performs a log off, while EWX_SHUTDOWN performs a power off shutdown, on Win9x. This behavour seems to hold true even in a non cygwin application. The following patch to shutdown-1.3-1 makes 'shutdown -s' work as expected (power off, instead of log off) on Win9x, tested on Win98SE. Mark. diff -up shutdown-1.3-1/shutdown.c shutdown-1.3-1.patch/shutdown.c --- shutdown-1.3-1/shutdown.c 2003-05-26 05:39:08.000000000 +1000 +++ shutdown-1.3-1.patch/shutdown.c 2003-09-13 15:18:12.000000000 +1000 @@ -141,6 +141,9 @@ main (int argc, char **argv) char buf[4096], *arg, *endptr; DWORD err; + if(!is_winnt) + action = EWX_SHUTDOWN; + if ((myname = strrchr (argv[0], '/')) || (myname = strrchr (argv[0], '\\'))) ++myname; else @@ -162,7 +165,10 @@ main (int argc, char **argv) force = EWX_FORCE; break; case 's': - action = EWX_POWEROFF; + if(is_winnt) + action = EWX_POWEROFF; + else + action = EWX_SHUTDOWN; break; case 'r': action = EWX_REBOOT; @@ -260,7 +266,8 @@ main (int argc, char **argv) while (secs) secs = sleep (secs); - if (action == EWX_POWEROFF || action == EWX_REBOOT) + if ( (is_winnt && action == EWX_POWEROFF) || + (!is_winnt && action == EWX_SHUTDOWN) || action == EWX_REBOOT) { if (ExitWindowsEx (action | force, 0)) return 0; @@ -277,6 +284,7 @@ main (int argc, char **argv) switch (action) { case EWX_POWEROFF: + case EWX_SHUTDOWN: fprintf (stderr, "shutdown"); break; case EWX_REBOOT: -- Mark Ord | I tried my best, tried to forget, Melbourne, Australia | that you're a bad habit, just like a mailto://ord AT alphalink DOT com DOT au | cigarette. http://www.alphalink.com.au/~ord/home/ | "Spark" - Jesse Valenzuela - -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/