i think there is a mizundaztanding

ihsir just want to shut down his dos, but the other think that he want to shut down his windows

the problem is, usually dos cannot doing any auto power off, so if you execute that outport condition, it will do the restarting (i have read one, but it use interrupt)
if the problem, is you want the user of your program cannot use the computer after he fail 3 times,
then you can off the ctrl-break condition, then do a not-end-loop

hope it work