Hook into Drupal registration and validate user info against business logic
I want to hook into the registration module. I already have a database of 50000 users who use my old website. Now I am migrating to Drupal. I still haven't migrated the entries to drupal database. I will be checking against my old database. When a user tries to register in Drupal, I need to check whether the username he gave is already present in that list of 50000 (and growing) entries. If it exists, I need to cancel the registration showing an error msg saying username exists.. Which hook should I use? If my code figures that the validation failed, How can I tell drupal to display an error