public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* shutdown-1.3-1 patch for Win9x
@ 2003-09-13  5:31 Mark Ord
  2003-09-13  9:13 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Ord @ 2003-09-13  5:31 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: shutdown-1.3-1 patch for Win9x
  2003-09-13  5:31 shutdown-1.3-1 patch for Win9x Mark Ord
@ 2003-09-13  9:13 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2003-09-13  9:13 UTC (permalink / raw)
  To: cygwin

On Sat, Sep 13, 2003 at 05:30:55AM +0000, Mark Ord wrote:
> 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.

Thanks for the patch.  I've included it slightly different formatted.
I've uploaded a new version 1.4-1 with this patch to cygwin.com.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-13  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-13  5:31 shutdown-1.3-1 patch for Win9x Mark Ord
2003-09-13  9:13 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).