Try google it.....
And it will be VERy hard to make! If you screw it up you may need to reformat ur pc :/
So it´s hard!
What a registry cleaner does is check if the registry is still used.
Because if you uninstall a program the registry stays most of the time.
So basicaly you need to know what programs are installed and what registries exist and then compare to see what registries can be deleted.
It will be a lot of work though.