Software Power Off on Windows NT 4.0
Introduction:
Software 'Power Off' was first introduced for compliant hardware with Windows 95. Windows NT 4.0, as released by Microsoft in 1996, did not support the operation 'out of the box', except in some cases of laptop computers (with Vendor installed versions of NT - more details here).
In fact, many computers are ready to use Power Down After Shutdown but do not have the proper registry setting enabled. If this is the case for you, all that needs to be done is a minor registry adjustment. To enable the feature, open your registry with regedit.exe and navigate to the registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
Find the valuename 'PowerdownAfterShutdown' and change it's valuedata to '1'. If the valuename doesn't exist, you will need to add it. Alternately, if you don't feel comfortable editing the registry yourself, I've written a .reg file (ntpd.reg) to automate this process. Download it and save it somewhere convenient on your PC. Double click it to add the necessary changes to your registry.
If Power Down After Shutdown doesn't function correctly after changing the registry setting, then your computer may not be properly set up to use the feature, or may not be capable of performing this operation. Read the following sections for more detailed information:
How it Works:
Operation of the "Power Off" feature requires NT4 to have direct access to the necessary hardware on the motherboard. The problem is that the Hardware Abstraction Layer (HAL) as supplied with NT lacks the necessary code to talk to the APM (Advanced Power Management) hardware on the motherboard, and blocks direct access. A company by the name of Softex came to the rescue with a modified HAL (HAL.DLL) that adds the necessary hardware support.
How to Add 'Power Off after Shutdown' to a Desktop (and some Laptop) PC: (Full Procedure)
- Obtain a copy of the appropriate HAL.DLL from Softex that works with your motherboard hardware. The main variation is single or multiple processor versions. The standard single processor and multiprocessor Softex HALs are included on all NT 4.0 Service Packs from 4 upwards. You can extract them from Service Pack by using the /x switch from the command prompt.
EG: "Drive Letter:\Path\Service Pack 6a /x" where:
- Drive Letter - drive on which Service Pack 6a is located
- Path - path to the Service Pack
- Service Pack 6a - file name that the Service Pack is stored under (Microsoft default name is Q246009i.exe)
- After the integrity of the Service Pack archive is verified, a dialogue box will appear asking for a location to where you want to store the contents of the Service Pack. Pick a convenient temporary folder. After the extraction is complete the Service Pack process will terminate. (ie: the Service Pack does not actually install anything - it just unpacks the files to the nominated folder) Look in the temporary folder and you will find a file entitled HAL.DLL.SOFTEX. The multi-processor version of the file is HALMPS.DLL.SOFTEX.
WARNING: If your system uses a differing HAL (eg: many Dell, Compaq and Gateway PCs use an OEM supplied version) you may need to ask around on the net to find a copy suitable for your hardware - unfortunately the Softex HAL will most likely not function correctly. (see the 'Notes' section below)
- Copy the Softex HAL appropriate for your hardware (HAL.DLL.SOFTEX or HALMPS.DLL.SOFTEX or an OEM HAL) to your \WinNT\System32 folder.
- Rename the file to HAL2.DLL
- Open BOOT.INI on your system partition with notepad. You may need to change the attributes of BOOT.INI and remove the read-only and/or hidden and system tags to allow you to edit it.
- Change the entry that you normally use to boot your NT installation so that the switch /hal=hal2.dll is appended to the end. Example from my system:
- [boot loader]
- timeout=30
- default=multi(0)disk(0)rdisk(1)partition(1)\WINNT
- [operating systems]
- multi(0)disk(0)rdisk(1)partition(1)\WINNT="Windows NT Workstation Version 4.00" /hal=hal2.dll <== ADDED SWITCH HERE !
- multi(0)disk(0)rdisk(1)partition(1)\WINNT="Windows NT Workstation Version 4.00 [VGA mode]" /basevideo /sos
- C:\="MS-DOS"
- Restore the attributes of BOOT.INI to the same state as you originally found them, once you have saved the modified version.
- The registry needs to be updated to tell Windows NT that it can now use Software Power Off option. (Note: If you have previously performed this step, there is no need to do it again !) Open the registry with RegEdit and navigate to the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon.
Find the valuename "PowerdownAfterShutdown" and change it's valuedata to "1". If the valuename doesn't exist, you will need to add it. Alternately, if you don't feel comfortable editing the registry yourself, I've written a .reg file (ntpd.reg) to automate this process. Download it and save it somewhere convenient on your PC. Double click it to add the necessary changes to your registry.
- Delete the folder of files extracted from Service Pack. It is probably a good idea to keep a copy of the hal2.dll file you have added to your System32 folder in case you need to rebuild the machine for any reason. Likewise, keep a copy of ntpd.reg as well.
- Reboot your machine and the new Software Power Off features should be available.
Notes:
Some PC hardware is incompatible with the Softex approach to powering off the machine. Possible scenarios are:
- The machine rebooting instead of powering off when you select 'Shutdown' as the option. (I know from experience that some Gateway and Compaq machines will demonstrate this problem. See Microsoft Knowledgebase Article 155373 - "Compaq Laptops Restart Instead of Powering Down" for the official Microsoft explanation of this problem.)
- The Softex HAL is totally incompatible with your hardware, and may cause a blue screen of death (STOP error) at system boot.
- If for any reason the Softex HAL.DLL is not used, and the Microsoft standard HAL is used instead, the symptoms of point 1 above may be exhibited on any hardware.
Some hardware manufacturers have developed alternative arrangements to achieve software power off. The general approach of these solutions is a hardware specific service or executable file added to the system and configured to run at system startup. Such methods are beyond the scope of this article.
In a "Dual-Boot" situation it is possible that the power management arrangements of the other operating system may conflict with Softex approach. See Knowledgebase Article 283378 - "You Must Hold Down the Power Button to Shut Down Windows NT 4.0 in a Dual-Boot Environment With Windows XP" for an example of this situation.
DANGERS:
- ONLY use the above mentioned procedure if the system has no manufacturer supplied power management system available. For details on dealing with a laptop computer, see the section "Power Management and Laptop PCs Running NT 4.0" below.
- I have seen instructions published previously on the net that suggest that the Softex HAL should REPLACE the existing HAL.DLL on the machine. This is an inherently dangerous method of implementing this software power off scheme for a couple of reasons:
- Firstly, depending upon your machine configuration, attempting to replace the existing HAL.DLL can be difficult because the system will have the file marked as 'in use'. If the Softex HAL is incompatible and causes machine instability, or worse still a STOP error, it can then be very difficult to switch back to the previous HAL.
- Secondly, application of a Service Pack or Hotfix to the machine may regress you back to the standard Microsoft supplied HAL, disabling the software power off functions. (See the notes above for possible symptoms of this situation)
- The approach of nominating a different HAL through the switch in the BOOT.INI file is the safer method of achieving the desired result for a couple of reasons:
- By making the use of the Softex HAL conditional upon which boot menu item is selected, you create a 'back door' into the system. If you select the Windows NT [VGA Mode] option (this also invokes base VGA video and expanded startup reporting - the /SOS switch) from the boot menu, the normal HAL is used. So in the event that the Softex HAL fails, reboot and select the [VGA Mode] entry from your Boot Menu. This will start the machine with the normal HAL.DLL and you can then reverse the changes listed above to put the PC back to it's previous state.
- The application of a Service Pack or Hotfix will not change your HAL2.DLL - so the power off functions will continue to function correctly. The patch will update your standard HAL.DLL to the latest version. You should check if the Softex HAL has been updated as well on an occasional basis, and manually replace it if so, but at this stage no changes have been made since Service Pack 4.
- DO NOT attempt to use BIOS hardware power management features whilst running Windows NT 4.0. The BIOS power management will conflict with the operation of NT 4.0 and may result in STOP errors or other problems. See Knowledgebase article 158942 - Windows NT Hangs With BIOS Power Management Enabled for further details.
Other Power Management Options.
With suitable software additions, the computer monitor can also be power managed under NT 4.0 See here for the details of this procedure.
Power Management and Laptop PCs Running NT 4.0
The 'Software Power Off' we have been discussing above is only a small part of a much larger subject: Power Management. Two standards exist in the marketplace for the control of computer hardware for the purposes of power management:
- ACPI (Advanced Configuration and Power Interface) - the more recent standard and has greater flexibility.
- APM (Advanced Power Management) - now somewhat depreciated but still useful.
Fully implementing power management makes a great deal of sense in a laptop computer environment, since the available power from the internal battery pack of a laptop computer is fixed and limited. Any technique which can reduce power consumption will extend the machine run time. Typically power management will do things like:
- Limit the processor clock speed as CPU loading varies with the tasks being run. This saves a great deal of energy and reduces heat generation.
- Control cooling fan speeds to match heat being generated - this function is usually 'thermatic' and controlled by the processor heatsink temperature. (Cooling fans use quite a bit of energy when running, especially at high speeds) If CPU load is low it may be possible to run without any form of forced air cooling at all.
- Disable peripherals which are not currently in use, cutting their power consumption significantly.
- Turn off or dim the display panel.
- Spin down the hard disk drive and optical media drives.
The Basic Approach:
Introduction.
Microsoft officially state in Knowledgebase article '154642 - Power Management in Windows NT 4.0' that "Power management features such as Suspend are not available in Windows NT Version 4.0". Regardless of Microsoft's statement, many laptop manufacturers have created or licensed power management solutions for their hardware suitable for use with Windows NT 4.0.
The following information has to be general in nature, since the exact implementation of power management under NT4 is controlled by the specific hardware on which it is being run. Each manufacturer will provide their own (non standard) solution to achieve the desired results. In all instances (using either APM or ACPI) the same basic approach will be taken with the changes that need to be made to the NT4 installation.
A Typical Arrangement:
- The NTDETECT.COM will be replaced by a hardware specific version supplied by the manufacturer. At system bootup, during hardware enumeration, this modified NTDETECT will generate additional entries in the HKEY_LOCAL_MACHINE\HARDWARE registry hive detailing the locations and control mechanisms of the APM or ACPI hardware found. Typical examples of key names found will be items like 'APMHardware'. (The exact names will vary)
- The Hardware Abstraction Layer (HAL.DLL) will be replaced with a hardware specific version which allows NT4 to directly access hardware involved with power management on the system. (Examples: Dynamically controlling the processor clock speed and System Power Off at Shutdown)
- Several new drivers will be added to the system:
- Laptop.sys (which is a standard driver name) provides NT4 with recognised entry points to perform tasks involving power management. (eg: Power Off at Shutdown) Although the name is standardised, the content of this driver is hardware specific and supplied by the manufacturer.
- One or more other drivers (names vary depending upon the manufacturer) to implement their power management scheme. These drivers reference the new entries in the HKEY_LOCAL_MACHINE\HARDWARE registry hive to determine what capabilities exist in the hardware and how control of them is achieved. These drivers do things like monitor the amount of time the CPU spends in the 'System Idle' task and alters the CPU clock speed accordingly to minimise CPU power consumption.
- One or more drivers that enable access to the system BIOS from within NT4. Most power management settings (eg: time before powering off the display) are controlled by BIOS settings.
- Certain device drivers for some peripherals (eg: network cards, video cards, hard disk drives etc..) may be replaced with versions that allow the APM/ACPI system to control their power consumption. (eg: By putting them into a low power 'standby or sleep mode' when not being actively used)
- Explorer.exe is replaced with a version containing additional 'Start Menu' commands. (eg: Standby and / or Suspend and / or Hibernate - not all options may be available in any particular implementation) The modified Explorer.exe can invoke these new modes by making calls through Laptop.sys, HAL.DLL and the hardware specific drivers.
- SysTray.exe is replaced with a version containing a Taskbar Applet which usually includes some sort of display showing the current system state. Typically the information presented here includes the state of charge of the battery and whether the laptop computer is running from battery pack or AC supply. There is also usually a control and configuration interface provided for power management. (eg: Settings to specify what happens when the battery reaches a discharge limit) This modified SysTray communicates through Laptop.sys and changes settings in the BIOS through the BIOS access drivers mentioned above.
WARNINGS:
- Installing a power management system alters a number of key NT4 system files which have recognised standardised names. (eg: NTDETECT.COM, HAL.DLL, Explorer.exe etc..) Application of a Service Pack, Security Rollup or Hotfix at a later date may regress one of more of these files. The result will normally be failure of the power management system to function correctly, or even worse, a system STOP error. Always exercise extreme caution on a laptop computer when performing any of these tasks. It may be necessary to temporarily uninstall the power management software, make any required changes to the base OS (Service Packs, hotfixes etc..) and then re-install the power management software.
- Setting up a 'dual boot' laptop system using a later OS (such as Windows 2000 or Windows XP) will result in failure of the NT4 power mamangement. This occurs because NTDETECT.COM is replaced with a version appropriate for the later Operating System, and this replacement version does not contain the manufacturer specific modifications required to allow NT4 power management. It may be possible to reinstate the 'NT4 power managed' version of NTDETECT.COM in some cases without adverse impact on the other installed OS - proceed with care.
Acknowledgments:
Thanks to John for additions and corrections on this page.
All promotional photographs and advertising material, corporate names and logos, product names, trade names, trademarks and registered trademarks are the property of their respective owners, and are acknowledged as such.
This information is maintained by ZCM Services, Australia. Whilst every care is taken in preparation, I accept no responsibility for errors or omissions. Use the information presented on this site AT YOUR OWN RISK.
Last Update April 7, 2010 at 8:40 PMAEST.