Private media files


I am trying to setup wordpress-mu blog where everything is protected (including mediafiles). I am looking a plugin which protects media files so that only logged users can download/view them. More better would be the feature where I can set permissions to the media file by user role. I have tried the 'Private Files' but I can't get it working in wordpress-mu.

Does anyone know any working solution?

I am also looking a way to write such plugin by my self but I haven't found suitable 'hook'. Far as I understand, all references to the media files are redirected by '/.htaccess' to the '/wp-content/blogs.php'. I think that it would possible to write such plugin if I found a way to hook my plugin so that it runs before or beginning of '/wp-content/blogs.php'.

Does anyone know suitable hook for this? I allready tried 'init' hook but it does't work. Maybe because of 'SHORTINIT' at the begining of '/wp-content/blogs.php'.

Best regards,