If you can't even start the computer in safe mode, things get tricky. There are tools, such as those from Winternals, that help you repair the computer. My initial suggest is to use Windows Preinstallation Environment to start the computer and then restore a backup copy of the system hive files, which are located in %SYSTEMROOT%System32config. Then, after the computer is starting properly, use System Restore to restore a previous configuration.
This was first published in June 2003