You must do this only if your IMEI its shown 000000000000000 or similar.
I´m not responsible for a phone damage or bricked by doing wrong this method. You must do this exactly as I wrote and will be no risk of any issue.
1-Download EFS Professional from here:
Thanks to lyriquidperfection for this wonderfull tool.
2-Download QPST installer
Thanks him again.
3-Download Samsung USB Drivers
4-Flash Original Stock Firmware for prevent issues. See on the forum on how to do that if you don't know.
5-Use the Original Samsung USB Cable.
*Read carefully before doing some of the tutorial down below*
1-Write down your Original IMEI from the back of your Phone, it has to be on the back of the phone, below the battery.
2-Install Samsung USB Drivers
3-Connect the Phone by the USB cable to the PC using only one port.
4-Let the PC do some recognition.
5-Put Phone into USB Debug mode (Settings>Applications>Development) and let it do again some recognition and configuration of the USB port.
6-Unplug and replug the USB using same port.
7-Dial *#7284# and choose "USB" Option to enable Diag mode
8-Open EFS Professional, Choose Qualcomm NV Tools
9-In Available COM Ports it has to say "SAMSUNG Android USB Diagnostic Serial port (WDM)"
10-Remove Send SPC and Read Phone Marks.
11-Clic on "Connect"
12-In The Phone Mode category The "Online" Tab has to appear to be Enabled now.
13-In the Category "IMEI Repair" Put the IMEI that you have to the IMEI Box.
14-Go to "Write To:", choose in the tab "Device", and then clic on "Write". It will appear "IMEI Succesfully Written".
FACING PROBLEMS WITH THE USB CONNECTION.
This procedure can be done if diag connection fails, but i'm not sure if this method do the trick with the USB recognition issue. I've done the two methods and it worked for me. You can choose to do one or the two together. Nothing to fear by doing the process. Its safe.
Put the phone on USB Diag mode by dialing *#7284# and choosing "USB" Option.
Install QPST installer, and open "QPST Configuration", go to "Ports", and "Add New Port...", choose the port and close the program.
Now open EFS Professional and do the steps that appeared above.
Hope it helps, so sorry for my english. I´m from Chile.