In SQL SERVER 2005, catalog view sys.master_files exposes this information.
So,
select db_name(database_id) database_name, * from sys.master_files
will return all database file names and locations (except resource database)