I discovered a problem on a Gateway laptop running Windows XP. As soon as I would log in, the laptop would automatically log me off. It did it in Safe Mode and normal mode.
I ended up discovering the Userinit.exe file was completely missing from the c:\windows\system32 directory. I eventually found out the machine had a virus which probably infected the userinit.exe file and antivirus removed it.
All I ended up doing was I popped in the Windows XP CD. Started recovery mode and copied the file back to the c:\windows\system32 directory by doing:
cd d:\i386 (cd rom drive)
expand userinit.ex_ c:\windows\system32\userinit.exe
If the userinit.exe file already exists
There could be a situation where the userinit.exe file is already in c:\windows\system32. If that is the case then there is probably a messed up registry key. The key can be found in:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon. The key is named Userinit and should contain this value:
Yes the comma at the end should be there. The easiest way to access the registry without being able to access the system is to use BartPE. Once you boot off a BartPE CD, you can load the SOFTWARE hive right into the registry and edit it.