Your first code
Bug Check 0x51: REGISTRY_ERROR
The REGISTRY_ERROR bug check has a value of 0x00000051. This indicates that a severe registry error has occurred.
Cause
Something has gone wrong with the registry. If a kernel debugger is available, get a stack trace.
This error may indicate that the registry encountered an I/O error while trying to read one of its files. This can be caused by hardware problems or file system corruption.
It may also occur due to a failure in a refresh operation, which is used only in by the security system, and then only when resource limits are encountered.
Your 2nd code
Bug Check 0x4: INVALID_DATA_ACCESS_TRAP
The INVALID_DATA_ACCESS_TRAP bug check has a value of 0x00000004.
This bug check appears very infrequently.
OK that's what MS has to say. You probably don't understand that stuff, but that's OK. There are a couple things you can do. I'm hoping you have XP. When you post like this give some details about your system. It makes it a little easier for folks to help you. 1st. Right click on "My Computer" and hit properties. Go to the Hardware tab and hit device manager button. Make sure nothing has a big yellow thing next to it. If it does then double click on the item and go to the driver tab and update or uninstall the driver. If you uninstall then reboot and let the system reinstall the default XP driver.
If this started after you installed new memory you should check your memory. Go to
http://www.memtest86.com/ and download the program either to CD or floppy and follow their instructions to test your memory. If your memory is OK and you don't see any driver problems in the device manager, then close all the programs you have running. Get your XP CD or if you have a branded system (Dell HP etc.) don't worry about the CD.
Go to Start/Run. When run opens type this in exactly like this
sfc /scannow Make sure you put in the space between c and /. Hit OK The System File Checker utility will open. It will probably ask you to put the XP CD in your CDROM. do that. It will now start to analyze your system files checking for corrupted or damaged files. If it finds any it will repair them. WARNING! When you run the system file checker any Windows updates including SP2 will most likely need to be reinstalled. Go to Windows update and update your system when you are done. Hopefully this will help correct your problem. Post back and let me know how it goes. Also tell me what kind of anti virus program you are running.