In case of error, Reg* functions set the output handle to NULL. Don't rely on it...