There have been many confused members (especially the noobs) who do not understand the difference between unlocking and debranding so I wanted to start this thread to clarify this matter once and for all.
Debranding/Flashing: : This is when you flash some firmware other than your original operator's FW. For example, if you have an AT&T or O2 branded X10, when you flash/debrand generic fw (or any other fw of your choosing) you simply get rid of the "branded" software pre-loaded on your phone. Hence, the term "de-branding". This does not mean that your phone is unlocked. You will still have to use your original operator's SIM card, like AT&T or O2, to use your phone EVEN AFTER flashing/debranding your handset.
Unlocking: This is when you "network unlock" your phone and are able to use it with any GSM operator you choose other than your original operator. For example, you have an AT&T or O2 branded X10 and you want to use it on T-Mobile US or UK, can you do that after simply flashing/debranding? The answer is NO. Why? Because your phone still requires a special code to be entered before it becomes network unlocked. For further reading, please go here.
Rooting: Rooting is a process that allows users of cellphones, and other devices, running the Android operating system to attain privileged control (known as "root access") within Android's Linux subsystem, similar to jailbreaking on Apple devices running the iOS operating system, overcoming limitations that the carriers and manufacturers put on such phones. Rooting makes it possible to use custom versions of the Android system such as CyanogenMod, supporting features unavailable in stock ROMs. It also allows for newer versions of Android not supplied by the original device manufacturer. Source: Wikipedia
Debranding, unlocking and rooting are mutually exclusive.
1. If I flash to generic firmware using Bin4ry's flash tool, will I unlock my phone?
No, you will simply debrand your phone but, you will still need to get the unlock code.
2. If I debrand my phone and then unlock it but, I would like to go back to my original branded firmware, will my phone become re-locked to that network again?
No, once you unlock your phone, it will remain that way no matter what firmware you flash in the future.
3. How do I know if my phone is network unlocked?
The simple way is to pop in another operator's SIM card, for example you have an AT&T branded X10a, then you can use a T-Mobile SIM card. If your phone reboots and you do not get a "enter code" screen and you see that you are connected to the T-Mobile network then your phone is network unlocked and can be used with any GSM operator.
Another way is to go into the hidden service menu. In the lock screen (the one with the swype animation) press the following sequence of buttons (Home, Back, Back, Home, Back, Home, Home, Back). If you are on 1.6 replace Home with Menu. Then go to service info --> SIM lock. In the top line, if you find this [X] Network 10, then your phone is locked. If you find this [ ] Network 10, then your phone is unlocked.
4. How can I get my unlock code?
There are a few sites from which people were successful in getting their unlock codes like MobileInCanada and CellUnlocker. There is also a thread by Xda-member "Lancez" here who can provide unlock codes for a fee. Currently, there is no known method of unlocking your phone for free.
I hope I have clarified this matter for everyone.