1 Answer
1

An RUU is a Windows executable file (HTC currently does not support Mac or Linux) that installs a ROM to your device. It will overwrite the following partitions:

System (the /system mountpoint)

Boot (the /boot mountpoint)

Recovery

User data (the /data mountpoint, this means you lose all of your personal data)

It may update your radio image (if newer)

You use an RUU by simply connecting your phone and running the executable file. I belive HTC Sync may also be required, but I haven't done this in a while.

The reason this unroots your device is sort of twofold, though it depends on your exact configuration. First, the su binary and Superuser app are typically installed to your System partition when you root. Since this is overwritten with a stock version of the partition, those two things will not be present. This prevents you from making calls to the su binary which is needed to grant root permissions to an app.

Secondly, the Boot partition has a flag which defines whether or not adbd (that is, the ADB daemon) runs with root permission, called ro.secure. The default value for this on a stock boot image is 1, which means that it is not running as root (so 1 represents "yes, it's secure"). Many custom ROMs set this to 0 so that you can immediately get a root prompt when you use adb shell, and also so that you can execute privileged commands without the need for a shell (i.e. adb pull).

Per your last question, I don't think you can run an improper RUU, but I've never tried. It does go through a verification process before the upload, at which point I assume that it checks to ensure that you have the proper device and whatnot. My guess would be that the verification would fail if you tried to use one on a device it was not designed for.

If you want more information, I managed to dig up a PDF from HTC's site which outlines how to use an RUU on the HTC Magic (Rogers wireless version). The steps are generally the same for any Android device, though.

Also of note, there is an open-source program which is designed to provide the same functionality while being cross platform. It is simply called HTCFlasher, and I have not used it myself. You can find it on Google code if it's of interest to you.