Click here to Skip to main content
15,886,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi dear sir
i have create zip file and this is password protected.
and how to check this Rar file is password protected file throw code in vb6.0;

plz help me
Posted
Updated 10-Apr-14 19:58pm
v3
Comments
Vedat Ozan Oner 7-Mar-14 7:41am    
google it first.

All you need to do is look at the entries in the file.
Assuming you are using SharpZipLib:
C#
public static bool IsPasswordProtected(string path)
    {
    using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
        {
        using (ZipInputStream zip = new ZipInputStream(fs))
            {
            ZipEntry entry = zip.GetNextEntry();
            return entry.IsCrypted;
            }
        }
    }

Should do it.
 
Share this answer
 
This cannot be done without using a third party like SharpZipLib[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900