ftp.nice.ch/pub/next/system/patches/poweroff-3.1-patches.README

This is the README for poweroff-3.1-patches.tar.gz [Download] [Browse] [Up]

These patches apply only to the NeXTSTEP 3.1 distribution for NeXT hardware.

Patches the loginwindow.app (of NeXTSTEP 3.1) to
  - remove the restart and power buttons from the login window

Patches the Workspace.app (of NeXTSTEP 3.1) to
  - (effectively) ignore the power key
  - remove the "Power Off" button from the Log Out alert panel
      (a panel not usually seen, I think)

Patches the WM.app (of NeXTSTEP 3.1) to
  - remove the "Power Off" button from the Log Out alert panel

The specific patches are described in greater detail below.

The effects listed above are produced regardless of the PowerOffDisabled
default's setting.  This patch only causes the power key to be ignored
while the Workspace.app/WM.app is running; the power key is still "active"
at the login window.  To disable the power key at the login window, set
the loginwindow's PowerOffDisabled default from a shell (as root):
   dwrite loginwindow PowerOffDisabled YES

This program must be run as root to work correctly.  You should have backups
of the affected files before running this program, just in case.  Log out and
log in as user 'exit' at the login window to have these changes "take affect".

THIS PROGRAM IS DISTRIBUTED WITHOUT WARRANTY, EXPRESS OR IMPLIED.

Christopher J. Kane (kane@cs.purdue.edu)
Released into public domain; August 15, 1993.


*** The Patch to loginwindow.app/loginwindow in Detail ***

The buttons on the login window are instances of the LoginButton class.
This patch works by patching the loginwindow.app's LoginButton class's
instance method initWithImage:altImage:andString: to be equivalent to

- initWithImage:image altImage:altImage andString:(char *)aString
{
  return nil;
}

		Old instructions			New instructions
000072b0	linkw	a6,#0xffe0			linkw	a6,#0x0
000072b4	fmovemx	fp2,sp@-			clrl	d0
000072b6						unlk	a6
000072b8	moveml	d2/d3/d4/d5/a2/a3/a4,sp@-	rts


*** The Patch to Workspace.app/Workspace in Detail ***

The patch to Workspace.app involves three routines:

  1) -reboot
        The -reboot method displays an alert panel:
	  Title: Reboot
	  Message: Do you really want to reboot?
	  Buttons: Reboot, Cancel
	This patch prevents the panel from being displayed and makes the
	routine behave as if the user had pressed the Cancel button.  It
	replaces the jump to the "display the alert panel" subroutine with
	an instruction to set the "value-return" register to the value
	returned by the subroutine when the user presses Cancel.
  
		Old instruction		New instruction
0001be64	jsr	a2@		clrl	d0

  2) -powerOff
        The -powerOff method displays an alert panel:
	  Title: Power
	  Message: Do you really want to turn off the computer?
	  Buttons: Turn It Off, Cancel
	This patch prevents the panel from being displayed and makes the
	routine behave as if the user had pressed the Cancel button.  It
	replaces the jump to the "display the alert panel" subroutine with
	an instruction to set the "value-return" register to the value
	returned by the subroutine when the user presses Cancel.
  
		Old instruction		New instruction
0001ce4e	jsr	a2@		clrl	d0

  3) -terminate
        The -terminate method displays an alert panel:
	  Title: Log Out
	  Message: Do you really want to log out?
	  Buttons: Log Out, Power Off, Cancel
        This patch removes the Power Off button from the panel, by passing
	NULL as the third button's title (originally "Cancel") and by
	passing "Cancel" as the second button's title (originally "Power Off").
	It also eliminates the former Power Off button's action, so when
	the new second button (Cancel) is clicked, the previous third button's
	action (Cancel) is performed.

		Old instructions	New instructions
0001c0da	pea	0x1f8aa:l	nop
0001c0dc				nop
0001c0de				clrl	sp@-
0001c0e0	pea	0x21463:l	pea	0x1f8aa:l

0001c11e	tstl	d0		nop
0001c120	beq	0x1c122:b	nop


*** The Patch to WM.app/WM in Detail ***

The patch to WM.app involves only one routine, -terminate:.  This
patch removes the Power Off button from the panel.  It works in the
same way as the patch to -terminate in the Workspace.app patches.

		Old instructions	New instructions
0005729c	pea	0x5d22a:l	clrl	sp@-
0005729e				pea	0x5d22a:l
000572a2	pea	0x5d1f7:l
000572a4				pea	0x5d1f7:l
000572a8	lea	_WMSTR:l,a2
000572aa   				lea	_WMSTR:l,a2
000572ae	jsr	a2@
000572b0	addqw	#0x4,sp		jsr	a2@
000572b2	movel	d0,sp@		addqw	#0x4,sp
000572b4	pea	0x5e947:l	movel	d0,sp@
000572b8				nop
000572ba	pea	0x5d1f7:l	nop
000572bc				nop
000572be				nop
000572c0	jsr	a2@		nop
000572c2	addqw	#0x4,sp		nop
000572c4	movel	d0,sp@		nop

000573b2	tstl	a2		bra	0x573d4:b

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.