[Desire 816 Q&A, Help & Troubleshooting] nukaru:
Since I was having a hard time flashing these files the first time, here's a guide how it worked for me. :)

There’s no going back once you do this. All your data will be lost, so make sure you've got your own data backup and placed it somewhere safe!

First of all, if you need to flash the recovery too (eg. black screen in recovery, bootloop), make sure USB-Debugging is enabled on your device, all drivers are up-to-date (HTC Sync, Java and fastboot) and your bootloader is unlocked.

If it's still locked/relocked visit the HTC Developer Center and follow the guide to unlock your bootloader.

- Create a folder 'ADB' in disc drive C and copy all files into this folder, this way you can just copy/paste the commands.

ADB fastboot folder (just extract it to C:\ and you're good to go)

- Connect your device and PC using usb data cable.

Step 1

Flashing recovery (before relocking your bootloader)

- Download recovery.img

- Save it to C:\ADB folder

- Navigate to ADB folder and click on any free space while holding the shift Key

- Choose 'Open command window' here

- Once cmd is started use this command

fastboot devices

and check if your device is listed, then type

adb reboot fastboot

to reboot your device. It should start in fastboot mode.

If it's not, shut down your phone and restart using power + volume down buttons, pressed at the same time. Once Hboot starts just navigate (using volume up or volume down buttons on your device) to Fastboot and press the power button. Make sure FASTBOOT USB is display under your specs.

- Enter

fastboot flash recovery recovery.img

into the cmd window and press enter to flash your recovery.

- If it's successful go to step 2, if it's not try again. Most of the time, the first flashing process isn't successful.

Step 2

Relock Bootloader using Fastboot:

Now you need to relock the bootloader, otherwise the Stock RUU can't be installed.

- Copy command to the cmd window

fastboot oem lock

- Press enter

Your device should now be relocked.

Step 3.a

Flashing Stock RUU using fastboot commands

- Download 0P9CIMG.zip

- Place it in ADB folder

- now type the following command in the cmd window

fastboot flash zip 0P9CIMG.zip

- Wait for the flashing process to finish.

If that doesn't work go to the next step..

Step 3.b

Flashing Stock RUU using HBOOT

- Save 0P9CIMG.zip to the root folder of an sd-card (min. 2GB )

- Put sd-card into your device

- Start the device by pushing Power + Vol Down at the same time

- At this point, your device should pick the 0P9CIMG.zip you downloaded up and install it as an update.

- Wait till the flashing process is finished. (Might take some time ;) )

- remove sd-card from device once the flashing is finished, otherwise hboot will flash again once you enter hboot.

Now, you're back to Stock Android Lollipop 5.0.2 :)

At this point, you should really consider making your own backup.

If this fails and you're still unable to get back to Stock Android, follow the next guide:

Restore system using clean twrp Android 5.0.1 nandroid backup

Make sure your device battery is charged upto 80%.

Make sure your bootloader is unlocked and usb debugging is activated

- Download twrp for your device (HTC Desire 816 a5 )

- Follow the guide Fastboot Install Method (No Root Required) to flash custom recovery

- Download TWRP Nandroid backup

- Boot to bootloader (volume down + power), use volume buttons to navigate to Fastboot and then select recovery

- Once twrp is running, tab the Wipe button, followed by Advanced Wipe

- Select Dalvik Cache, System, Cache and Internal Storage

- Swipe to confirm, wait till it's finished

- Unzip A5_UL TWRP Nandroid 2016-01-25--03-37-20 UNROOTED.zip file to desktop

!!! IMPORTANT !!!

You will need to insert your device ID into the folder structure otherwise the folder won't be listed.

To get your device ID, start cmd in your adb folder and enter adb devices. The number/letter combination is your device id. (eg. SH45...)

Browse through the TWRP folder until you get to

fastboot_getvar (bootloader) serialno

folder and replace the text with your serialno.

- Move TWRP folder to sd-card

- Connect device to pc

- Insert sd-card into device

- Tab Restore button

- Choose nandroid backup folder

- Swipe on screen to confirm restore

After this you will have a functional factory reset device.