[HTC 10 Guides, News, & Discussion] bakasaru:
I had the hardest time figuring out the whole unlock, root and install ROM on my HTC 10. The biggest issue was that I encrypted my phone, and most guides did not take that into consideration. After consolidating all my notes from multiple sources on the interweb, here's what I have.

GOAL: To have an HTC 10 that is OEM unlocked, custom recovery on board, rooted and has S-OFF setting. This will allow for most flexible customization of software and ROM choices. This may affect your warranty, so proceed with caution.

ASSUMPTIONS: This guide is for an American stock T-Mobile HTC 10 phone with a separate microSD card. It may work with other carriers or countries, but I honestly don't know for sure. This is also written for a Windows PC with access to microSD. You have time and $25 to spare. Money is for a certain unlocking app; not for me. You understand the meaning of bootloader unlocked, custom recovery, rooted, S-OFF and custom ROM. Please look elsewhere for what these mean. They are not synonymous.

GENERAL STEPS:

Prepare stock phone for unlocking and rooting

OEM unlock the phone

Install custom recovery software

Backup stock phone image

Install root access software

Install S-OFF software

Install custom ROM

Download required software

Create folder C:\android

Download and install HTC Hotsync Manager to recognize the device by USB.

Download Google's Android Platform Tools. Unzip and place files in C:\android. Unless you want to waste 4GB of time and storage, you can also download the full Android Studio.

HTC's custom fastboot.exe will be downloaded later on.

Download latest TWRP for HTC 10. Copy file into C:\android

Download latest SuperSU. Copy file into C:\android then copy it to the microSD card.

Download latest Sunshine. Copy file into C:\android then copy it to the microSD card.

Download ROM zip file

Pick a ROM to download. Can get custom ones as listed in xda forums page. Copy ROM zip file into C:\android. If you pick a custom ROM, disregard the rest of this section.

Or pick a stock HTC ROM from website. Can pick most recent ROM for specific carrier or the Unlocked/Developer ROM.

To extract ROM zip file from *.exe, do the following.

Download Microsoft Process Monitor. Unzip folder and run program.

Press CTRL-L to set proper filters: "Process name", "is", [name of ROM with .exe] > click Add; "Path", "contains", "rom.zip" > click Add > Click OK

Run the ROM exe. Do not "install" it. Just run the program to start the "process". Go back to Process Monitor and look for the temp folder that the installer extracted the files to.

Go to the temp folder above that contains the rom.zip. Copy this to C:\android

Close the ROM exe install program.

Get CID for the HTC ROM. Open multi-volume zip archive via Winrar. The usual Windows zip cannot open multi-volume archives. DO NOT extract the file. But find the text file within the ROM zip archive that contains CID, and write it down for later (just keep opening text files; some will be errors; some will open; it'll be obvious). The phone's CID and the ROM's CID must match (more on this later).

Prepare stock phone for unlocking and rooting

Save/backup everything to the cloud or microSD. All data will be deleted with this process!!

Turn on Developer options: Settings > About > Software information > More > tap "Build number" many times until you see "You are now a developer".

Settings > Developer options > check "OEM unlocking", check "USB debugging"

Reboot to Download Mode via Volume-Down+Power. Do not let go of the buttons until you see the gray HTC on a black screen (otherwise won't boot to Download Mode).

HTC OEM Unlock The Phone

Go to HTCdev website. They have screwy SSL certificate and port forwarding. You will have to create a login; and so I recommend making sure it is https -- unless you don't care. Click on Unlock Bootloader and select HTC 10. Go through all the usual prompts.

No need to download all the files on the right side panel. They were already downloaded up above.

Be sure to download the HTC Windows fastboot.exe in Step 4. In C:\android rename Google's version to fastboot-google.com and then unzip and place HTC's version into this folder.

Plug in phone (make sure it is in Download Mode) to PC.

Open command prompt. Press WINDOWS+R and type cmd. In command prompt type cd \android

In C:\android> type fastboot oem get_identifier_token

As the HTCdev website shows, copy all the text between (and including) <<<< Identifier Token Start >>>> and <<<<< Identifier Token End >>>>> into the appropriate part of the website. Make sure the extra text/characters are not included (see example from HTCdev site).

Go to email and download Unlock_code.bin sent by HTCdev. Save this file to C:\android>

In C:\android> type fastboot flash unlocktoken Unlock_code.bin

Press Volume-up or -down on phone and select YES for OEM unlock.

Allow phone to reboot and do a factory reset.

After factory reset, reboot to Download Mode via Volume-Down+Power

Flash TWRP Custom Recovery Software to Phone and Prepare for SuperSU

In C:\android> type fastboot flash recovery [twrp-file-downloaded-above]

After flashing TWRP, you MUST do a hardware reboot by pressing Volume-Down+Power. If you allow reboot by any other method, phone will erase TWRP. For example, do not use adb or fastboot to reboot at this point.

Use Volume-up and -down buttons to highlight reboot to bootloader and press Power button to select it; then do the same for boot to recovery mode.

TWRP now loads

If you happen to have encrypted your phone, you MUST enter your password here. To get phone rooted, a file needs to be created in /data/ folder. This folder can only be accessed by TWRP after putting in encryption password.

If your phone is not encrypted, TWRP should not ask for a password.

Swipe right to access TWRP (cannot use TWRP in read-only mode, if you want it to do anything to the phone ... duh).

Go to Advanced > Terminal

In # type echo KEEPFORCEENCRYPT=true >> /data/.supersu

Backup Working Phone System Image

Unless you've done this before, you will likely miss a step or two. Doing so may end up with a bootloop or other error where you can't get to a user interface. Backing up your system now is a MUST.

While in TWRP, go to Backup. Select all the folders. Rename the file to something meaningful to you. Be sure it saves to microSD card.

Now do the back up.

Install SuperSU Root Access and Prepare for Sunshine

While in TWRP, go to Install.

Select the microSD and then the most recent SuperSU file you copied there earlier.

After install, select Reboot. If phone is encrypted, you will be asked to enter password, and it will likely reboot another time or two.

After phone boots up, load the SuperSU app and go through all the prompts.

Go to Settings > Security > check "Unknown sources"

Install Sunshine S-OFF App

Go to Settings > Storage > sd card (e.g., "New Storage") > select sunshine-latest.apk

Run Sunshine app

Select Grant when SuperSU pops up. If you see this pop up, your phone was successfully rooted.

Pay Sunshine $25. If you want S-OFF, I don't know of any alternatives.

Go through all prompts. Phone will likely reboot. This is part of the process. If Sunshine does not load after reboot, then load it up again and go through all the prompts. You'll have success, once the phone automatically turns off.

Turn on to Download Mode via buttton combo. This will confirm if phone is UNLOCKED and S-OFF

If you will be changing your CID later on, note all settings here (including CID) and save in case you want to revert to this state.

Alternatively, you can get the CID and MID by fastboot.

Connect phone (make sure in Download Mode) and connect to PC. In C:\android type fastboot oem readcid and then fastboot getvar mid

Install Custom ROM to HTC 10 Phone

If you used a custom ROM from the usual sources via XDA, then follow their instructions. Disregard the rest.

DO NOT perform the steps below unless the ROM is from the official HTC ROM website above for HTC 10.

For using HTC Unlocked/Developer ROM, you must change your phone's CID. If the CID on your phone does not match the ROM CID, then you will see an error before ROM installation begins.

Plug in phone (while in Download Mode) to PC

Note CID in HTC ROM text file above. It should have been BS_US001

The following step requires S-OFF. The $25 step above.

In C:\android type fastboot oem writecid [cid-code-eg-BS_US001]

Rename HTC ROM in C:\android to 2PS6IMG.zip. Copy file to microSD.

Reboot to Download Mode.

Press Volume-Up to install HTC ROM

After HTC ROM installation, TWRP recovery and SuperSU will be overwritten.

Reinstall TWRP as above.

Reinstall SuperSU as above.

Consider back up of system via TWRP onto microSD after completing all custom ROM installation, recovery flashing and rooting.

And you're done. Congrats!!