"When the muzzle of the firearm gets next to or is in contact with the target, hot gases escaping from the muzzle at high velocity will typically rip, tear, shred, and/or melt the material of the target. A very intense deposit of gunshot residues will be found around the margins of a contact or near contact entrance hole.
There have actually been cases where a hard contact gunshot (muzzle pressed hard against the victim) caused the residues to blow through the wound tract in the victim and be deposited around the inside of the exit hole of the victim's clothing.
Gunshot residue is normally a combination of gunpowder residues and lead residues. I say normally because some newer ammunition is virtually lead-free. More and more ammunition manufacturers are using lead free or low lead propellants because of the toxicity of lead.
Gunpowder residue can contain unburned gunpowder particles, partially burned gunpowder particles or the carbonaceous soot from completely burned gunpowder. The image below show a bullet hole surrounded by gunpowder particulate residue
Modern smokeless gunpowder, and black powder, contains nitrate compounds. Black powder normally contains a combination of potassium nitrate (75%), charcoal (15%), and sulfur (10%). Smokeless powders can either be single based or double based. Single based gunpowder will contain nitrocellulose (cellulose hexanitrate) as its main ingredient. Double based gunpowder contains nitrocellulose and nitroglycerin (glyceral trinitrate) as its base. Some triple-based powders are also now available.
When either of these types of gunpowder burns the residue left behind will be in the form of a nitrite-based compound. Nitrite particles when emitted from the muzzle of a firearm will strike a nearby target and either be imbedded in the target's surface or leave a deposit of nitrite residue.
Lead residues will be in a vaporous or particulate form and can come from a couple sources within a discharged cartridge. The most common source is the primer. Primers are used to start the ignition process in cartridges and commonly contain lead styphnate, barium nitrate, and antimony sulfide compounds. However, some newer primer compounds are being used that are lead and/or barium free.
Cartridges containing lead based primers, when ignited, produce a vaporous cloud of residue that is expelled from the muzzle of the firearm. Additional vaporous lead residues can be produced when the hot gases pushing a lead bullet down a barrel melt lead from the base of the bullet.
A third form of lead residue will be in a particulate form. Particulate lead residue comes from minute lead particles that are shaved from the sides of a lead bullet as it travels down the barrel. Lead particulate has more mass than vaporous lead and travels greater distances. Also, gunpowder particles can be coated by the vaporous lead residues and leave what appears to be a lead particulate deposit upon striking the target."
Complicated, isn't it?
http://www.firearmsid.com/a_distancegsr.htm