Are password protected files immune or vulnerable to virus? I constantly password protect my files using winrar. And I noticed that it raises an alarm whenever I will scan it using my antivirus software. Isn't it safe to password protect files?
The antivirus program doesn't know the password, so it can't check whether there's a virus inside.
This is probably to prevent attackers from emailing you a password-protected archive and including the password in the email.
A virus could infect a password-protected archive either by replacing the entire archive with a new one containing the virus (destroying whatever was in the original archive) or by cracking the password. (This will depend on how secure your password is and how strong the encryption is)
Password-protecting the archive will not deter a virus from completely deleting it. (There's no difference between deleting a password-protected archive and deleting any regular file)