From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23813 invoked by alias); 13 Sep 2003 05:31:00 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 23805 invoked from network); 13 Sep 2003 05:30:59 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by sources.redhat.com with SMTP; 13 Sep 2003 05:30:59 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19y2zj-00056S-00 for ; Sat, 13 Sep 2003 07:30:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: cygwin@cygwin.com Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19y2zi-00056K-00 for ; Sat, 13 Sep 2003 07:30:50 +0200 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 19y2zo-0003aR-00 for ; Sat, 13 Sep 2003 07:30:56 +0200 From: Mark Ord Subject: shutdown-1.3-1 patch for Win9x Date: Sat, 13 Sep 2003 05:31:00 -0000 Message-ID: Reply-To: ord@alphalink.com.au X-Complaints-To: usenet@sea.gmane.org User-Agent: tin/1.4.7-20030322 ("Suggestions") (UNIX) (CYGWIN_98-4.10/1.3.22(0.78/3/2) (i686)) X-SW-Source: 2003-09/txt/msg00802.txt.bz2 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@alphalink.com.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/