If it happens in both regular and safe modes my first thought is malware. If that's not the cause,
1) What is new or different since the last time everything worked properly (ie, new hw, new sw, virus, error, etc)?
2) Let's check the HD: To run checkdisk, right-click on a command prompt icon and open as administrator. In the command prompt window type: chkdsk /r (then press ENTER). You'll be told the disk is in use and asked if you want to run checkdisk on the next boot. Say yes, exit the command prompt window, and reboot.
3) Let's check ram: download memtest (
http://memtest.org/). Burn it to a cd using a dedicated .iso burning utility (
http://www.petri.co.il/how_to_write_iso_files_to_cd.htm), make sure the cd drive is at the top of the boot order in bios, then boot to the newly created cd and run the utility.