Adam Lanza did not legally purchase the firearms, he murdered his mother in her sleep and then stole her legally purchased firearms to carry out his heinous crime. In this case, he did attempt to purchase a firearm, but was denied, so the regulations already in place prevented him from LEGALLY obtaining a firearm, it did not however keep him from finding other means to obtain said firearms utilized in the Sandy Hook Elementry shooting.
In the case of the Tuscon shooting, Gabrielle Giffords was the victim of a deranged criminal who had no prior criminal record, but due to the lack of medical files verifying that he was indeed mentally unstable (If I recall correctly, he was diagnosed and being mentally ill, but it never made it outside of his clinical files, though I could be wrong). He legally purchased his firearms and later carried out his attack on Congresswoman Giffords.
The Colorado Shooting, James Holmes legally purchased his firearms, he had no prior record with local law enforcement agencies nor any record of being mentally unstable if I'm correct.
I'm pulling this from memory, so if I'm wrong on any of this, please, someone correct me.