SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Windows XP blocking zip files created with sharpziplib

Last post 08-01-2006 11:27 AM by kurt. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-31-2006 4:30 AM

    Windows XP blocking zip files created with sharpziplib

    I had a programmer (not me) write me a program in c# that zips a folder.  She used the sharpziplib and all seems to be working fine... execpt extracting the files from the zip file.

    I am running XP pro SP2 and it seems to be SP2 causing the problem. 

    When I go to extract the file using windows it gives me an error saying "windows has blocked access to these files to protect your pc" it says that I can unblock the file by going to the files properties and checking a box labled "unblock" however there is no such box to check.

    The file will open and extract just fine using winzip or winrar however we had this program written for windows so we wouldn't have to use a 3rd party program to extact it.

    From my research it seems that there is probably some sort of "flag" or something within zip files that tells windows that its safe and the files created by the sharpziplib don't have it.

    I can zip a file using the compress option in windows and then extract the files just fine, this only happens with the zip files created from the program.

    Has anyone seen this and have a solution??  Is this something that might be added to the library so the files register as safe with windows??

    Any help would be GREATLY appreciated!!!!

    Thanks,

    Kory

  • 01-31-2006 10:01 AM In reply to

    Re: Windows XP blocking zip files created with sharpziplib

    Maybe you are storing the full path to the files in the .zip file?
    How are you creating the zip?
    If you use ZipOutputStream, make sure you don't pass the full path ("C:\Source file.txt") to "new ZipEntry()", but only the file name ("Source file.txt").
  • 01-31-2006 8:10 PM In reply to

    • KelliZ
    • Not Ranked
    • Joined on 01-31-2006
    • Posts 1

    Re: Windows XP blocking zip files created with sharpziplib

    Hi Kory, I was in the XP chat today with you and the chat moderator ended the chat before I could ask you this question!  Is it possible for you to upload the zip file in question somewhere so I could download it?

    -KelliZ
    Windows Shell Team

  • 01-31-2006 8:30 PM In reply to

    Re: Windows XP blocking zip files created with sharpziplib

    Kelliz,

    I sent you an email through this forum with where to find this zip file and my email address.

    Did you receive the email??

    Thanks,

    Kory

  • 02-11-2006 7:54 AM In reply to

    Re: Windows XP blocking zip files created with sharpziplib

    This issue is heating up and needs to be pursued in a technical fashion.

    stewart05 provided this file to me via a link in the uSoft MSDN forums: http://www.dakretail.com/zipfile/

    It is a file that I have verified reproduces the symptoms exactly.  There is some indication

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=226335&SiteID=1

    that it could be related to a defficiency in the software included with the Windows operating system, but I have begun to suspect that a partial fault/solution is as hinted earlier.  Whether the real fault lies in the OS supporting software or not, I believe there must be something about the headers created by the SharpZipLib that uSoft cannot interpret correctly or is being interpreted somehow as a threat.

    I have no tinfoil hats of my own, so I tend to doubt that Microsoft is deliberately mishandling files generated by this library.

    Please look into the potential header issues.  I'd recommend extracting the text file imbedded in the linked sample file above and compressing it with other, commercial software and comparing the header info to that which your library creates as well as how the OS may differently treat the files.

  • 02-11-2006 12:22 PM In reply to

    Re: Windows XP blocking zip files created with sharpziplib

    Other users are using #ZipLib generated files with the Windows ZIP integration without any problems.
    Did you read what I posted earlier? (that you have to be careful not to pass any absolute paths to the "new ZipEntry()" constructor)
  • 02-22-2006 3:28 PM In reply to

    Re: Windows XP blocking zip files created with sharpziplib

    Just so everyone knows, DanielGrunwald was right.  I finallay got the programmer to take a look at how she was storing the file paths in the zip files and she was storing the full path.  She changed that and now we can use windows to view and extract the zip files.  I do think that Microsoft needs to take a look at this, but its working now.

    Thanks for ALL your help everyone!!!!!!

     

  • 07-29-2006 10:52 AM In reply to

    • kurt
    • Not Ranked
    • Joined on 07-29-2006
    • Posts 2

    Re: Windows XP blocking zip files created with sharpziplib

    Hi,

        I am facing the same problem of XP blocking the zip files that is being created by my code. I have even tried storing just the filename instead of the full path but it did not work out for me. Below is my code:

    string[] filenames = System.IO.Directory.GetFiles(dirname);

    Crc32 crc = new Crc32();

    string zipfilename = "test.zip";

    ZipOutputStream s = new ZipOutputStream(System.IO.File.Create( zipfilename));

    s.Password = passwd;

    s.SetLevel(6); // 0 - store only to 9 - means best compression

    foreach (string file in filenames)

    {

    FileStream fs = File.OpenRead(file);

    byte[] buffer = new byte[fs.Length];

    fs.Read(buffer, 0, buffer.Length);

    ZipEntry entry = new ZipEntry(file);

    entry.DateTime = DateTime.Now;

    entry.IsCrypted = true;

    entry.Size = fs.Length;

    fs.Close();

    crc.Reset();

    crc.Update(buffer);

    entry.Crc = crc.Value;

    s.PutNextEntry(entry);

    s.Write(buffer, 0, buffer.Length);

    }

    s.Finish();

    s.Close();

    s.Dispose();

    The file gets extracted if i use Winzip however when using the default XP zip it does not recognize the file.

    I would like somebody to help me in this matter ASAP.

    Thanks.

  • 07-29-2006 12:54 PM In reply to

    Re: Windows XP blocking zip files created with sharpziplib

    .Directory.GetFiles always returns fully qualified paths, so you are still passing a full file name to "new ZipEntry(file)".
    Use "new ZipEntry(Path.GetFileName(file))" instead.
  • 08-01-2006 11:27 AM In reply to

    • kurt
    • Not Ranked
    • Joined on 07-29-2006
    • Posts 2

    Re: Windows XP blocking zip files created with sharpziplib

    Oh yes... Thank you very much Daniel it has started working now..
Page 1 of 1 (10 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.