April 17, 2007 Ian Luke Kane

Windows XP Login Logout Loop (Virus)

I’m writing this post with the hope that it will be helpful to people who face the same computer predicament that I did a few days ago. Here’s a little bit of background information: Last Tuesday I met John Chol Daau, who is from Sudan. He grew up as one of the Lost Boys of Sudan, forced to leave his home and wander hundreds of miles through Africa to survive. If you don’t know much about this particular humanitarian issue, I suggest spending a small amount of time reading up on it. Anyway, John told me that his PC was experiencing a debilitating virus, and asked if I would look at it. I said that I would. After spending quite a bit of time reading through various website forums, here’s a short description of the problem and its solution:

Problem: The PC (which runs Windows XP with SP2) starts normally. The Windows splash screen appears correctly and then the login prompt correctly loads. You can then enter your user name and password like normal, but as soon as you try to login you are IMMEDIATELY logged back out again. The desktop doesn’t even load. It moves immediately back to the login window where you can then enter your user name and password again. No matter how many times you try to login you always experience this immediate logout. Even if you try to login to the computer in safe mode you still experience the same problem. This problem is documented on Microsoft’s website here.

Solution: I’m sure this behavior can be caused by many different problems, but the most common cause is a virus. If you’re familiar with the Windows registry, this virus changes a few registry key values that makes it impossible to login to your computer. If you’re not familiar with the registry, don’t panic. I’ll post links to a few articles that very clearly explain how to fix this problem. Basically, the virus makes two very simple changes to your computer that render it useless. In order to fix the problem, you have to change these two things back to the way they were while your computer was working.

Easy Fix: The “easy” solution to this problem can be found here. In order to use this fix you have to have your Windows XP install CD. This is the CD that contains the files necessary to install the operating system on your computer. You probably have this disk stashed in a drawer somewhere. You should note that there’s a difference between the Windows XP install CD and the recovery CD that may have shipped with your computer. It’s actually possible that when you bought your computer that it didn’t actually come with a Windows XP install CD. Sometimes computer manufacturers will only ship you a recovery disk, which is altogether different. You need your Windows XP install CD so that you can run an application called the Recovery Console. The link above should provide documentation on how to use the Recovery Console. Unfortunately, this fix didn’t work for John’s computer, but it may work for yours.

Slightly Harder Fix: This fix is the one that ended up working to fix John’s computer. A detailed explanation of this fix can be found here. It requires you to have access to another Windows PC with a CD burner (even if it’s a friend’s computer). You have to download a program called BartPE, which is one of the greatest recovery tools that exists. For this particular problem, BartPE will enable you to quickly change the two settings that the virus messed up. You may need a Windows XP install CD for this method as well. But it may be possible for the program to find what it needs from your friend’s computer without having to have access to this disk.

If you have any questions, please feel free to contact me. The above links should give you the tutorials you need to fix the problem. And if you use a PC you should use a virus protection program! If you don’t, you’re asking for trouble! Good luck!

If you found this article helpful and would like to do something small to support Logic Nest and also benefit yourself, sign up for a Dropbox account here. Dropbox is software that syncs your files online and across your computers, and by signing up you get a 2GB free account. I also get a little bit of extra space for referring you. This is one of the best pieces of software that I use today. It’s a huge productivity booster, and helps me to back items up across computers.


Comments (130)

  1. Foundtheansw

    Ok I got the answer to all those whose BARTPE’s cant find the c drive,

    go into recovery console and go to windows\system32\config
    ren software to software.old and then type “copy C:\windows\repair\software”

    now it should load into windows where you can do the hive fix. Dont even need bart pe.

    then go back to the recovery console and rename software to software.temp and rename software.old(the one where you did the hive fix) to software, reboot and viola!

  2. Andrew

    i have followed the steps for the harder fix but userinit reg does not exist in the winlogon folder ,c:\windows\system32\userinit .exe exists any ideas how to fix this

  3. Jason Saunders

    I would like to thank Mr. Kane for posting this to the web. I am an artist and frankly don’t have a lot of money to hire someone to fix my computer. So, I have to do it myself. After Googling the description, and following several false paths this page finely set me on the right one. In my case usernit.exe has gone missing. Once I found instructions on how to restore that program my computer immediately started functioning. I was down for about a day. I have no idea if a virus erased it or if my computer hiccuped and deleted it. I’m just super happy to have my computer working again. Thanks :*)

    This is the page with the instructions:

    P.S. PC’s may be more susceptible to viruses then Macs but they’re more affordable and they have a right mouse button.

    • Evert

      Great man!!! I regretfully tried everything I could think of and googled on until I came across this instruction on the above link. Thanx again … this search was rewarding.

  4. Mike m

    I had to create my own string value for userinit, but other than that I had no problems. BartPE is a great find. Thanks for taking the time to help with this most annoying of pc problems; I am in your debt.

  5. Christophe

    Ok guys you are all god cause it works after a combination of your explanations

    Thanks !!

  6. Crazy GUy

    Can anyone PLEASE tell me how to edit the registry key if I am unable to boot from ANY CD at all?? I made the BartPE CD from a friend’s computer and changed the bios to boot from CD-ROM first; the BartPE booted when I tried it on my friend’s CD but it won’t boot at all on my computer. Instead the PC just boots up normally and goes to the log-in screen. I think my CD-ROM is jacked.

    Is there a way to make this fix on the registry from a different computer? Email me, theworldiscrazy2@yahoo.com if you have the right solution, thanks so much.

  7. Mike

    This has helped many people and I have used something similar for quite a while. One thing to note, is if you upgraded your XP install from 2000 your Windows directory may be WinNT instead so the above paths would need to be adjusted.

    Also, I have seen some viruses change the permissions for the registry and those have to be changed (even in Bart) to allow the reg file to be imported or edited.

    It is a good habit to check the values of these settings and files after cleaning a PC but before restarting. A good utility to do that is the free Autoruns program from Microsoft’s Systernals Utilities.

  8. ali

    hi i read all your comments but, must tell you that in my case i actually deleted this file called userinit.exe when trying to remove a virus.
    my cd rom drive had a problem in picking up cd so was unable to do the bartpe option….after a few huches i foud a way to fix the problem without the need for a cd…

    ok what i did is that i restarted the computer and started windows normally. as it came to the welcome screen i punched in my password for the admin account as it was login in i pressed ctrl+shift+esc this opend my task manager i then clicked on file new task and typed regedit….i was loged off again…i again restarted my computer and again came to the welcome screen i typed my password for the admin account and it logged me in i again opend my task manager new task and the word regedit was already typed for me…i opend registry and went to HKLM/SOFTWARE/MICROSOFT……Iwas logged off again….i had to reapeat the same procedure and this time when i opened regedit from my task manager i had the HKLM/SOFTWARE/MICROSOFT opend i clicked on Windows NT/Current Version/ i was logged off again….restarted my comp again dis time i managed to reach the Current Version before being logged off i opend the userinit entry and typed C:\Windows\system32\userinit.exe,…..given that i am not a fast typer i was logged off again so had to restart and went back to the userinit edit entry where as much as i typed was still there i then completed the whole path and pressed ok restarted the pc and bingo it was working again……….
    i actually managed to do all this without xp cd which was great the key is you have to restart as this gives you time when you login to your admin account…further you need to be very quick in opening task manager and then regedit then the reqired folder but do not worry if your loged off just restart and start again you will notice that the computer saves your opend folder so you don’t have to start everything from scratch..i hope this makes sense if not you can e-mail me for help

    • Troublesome_person

      Sorry, but when I log in, the desktop background pops up for about half a second, before logging up. If you you open task manager, does it extend that time?

  9. Suresh

    I install Avast antivirus and run fist scan from the booting. after clean the viruses this error appear.
    i have try with your CD and the error still the same,
    Please help if you can,
    Thank you!

  10. GRM

    Nephew brought me his laptop with this problem after installing and running Norton. Read through a lot of helpful information here. Because of this Iwas able to find that his laptop was missing the userinit.exe file in system32.

    I copied the file from my desktop computer onto a usb stick, then using the windows cd in recovery mode I simply copied the userinit.exe into system32 from the usb stick.

    This stopped the login loop and just reports a log on error, but giving me full access to a normal windows start up.

    I just have to stop the error window by following advice given above by using regedit to completey remove the problem if this is part of the same problem.

    Having the logon errorr is not a problem for running windows especially as Norton does not report any problems and one click and the message is gone. I presume this is a cause of the logon loop being interupted.

  11. Matt

    Good job guys! I had to go the regedit route though =)

    Linux > PC > Mac

    Linux/Unix/etc. a lot of those open source OSs are for “power users”. In a perfect world everything is “open source”.

    Not trying to heat up arguments Re: That is not why this help form was created..

    THANK YOU GUYS SOOO MUCH, from Florida =)

  12. Orage

    I only have one problem: how can i get my computers name while i cant log in?

  13. Sombre

    My pal had the same issue as everyone else here (login, logout). I used the “slightly harder fix” an it worked perfectly, incase someone runs into the same 2 tiny glitches as me & don’t know much about pc’s, here is how to over come them :

    1 I run out of cap & was unable to download bartpe & we didn’t have time to do the whole process either so I used hierens instead & booted into mini xp, you just download & burn to cd one can also use it for removing passwords etc.

    2 I checked for the userinit.exe file & it was missing, so I just copied it from another pc with xp (c:\windows\system32\userinit.exe) though if another xp pc is not available then this is easy to find on the web.

    Hope this is of help to someone.

  14. Sina

    well from 2 days ago my laptop is gone weird, i have a the same problem as u said but mine doesnt log in and back out it just says windows is loading ….. nd it doesnt even load up. i have windows xp sp3 nd i dont have the CD because i bought it frm my school for school works . so can u please help me ?? i want to know which option i have to use cos im not sure,, PLASE HEP ME

  15. johnylog

    Hello guys,

    Do you encounter errors while deleting files in Windows? I’m here to provide a solution. I’ve been reading several threads on this topic on different forums where computer users were asking about this popular error “The filename you specified is not valid or too long”.

    My research helped me to find a tool for you guys.

    Its LONG PATH TOOL, a very easy to run but highly powerful software.

    Follow the link to read more about this error.


  16. Troublesome_person

    Sounds great!!!
    Just one problem – What is I don’t have my Windows XP install CD? All the methods seem to involve one.
    Please help?

Comments are closed.