Embarcadero XE7 VCL : TZipFile problem with TZipMode zmRead

We inspect java .jar-files looking for directives in their manifest. Later on, we start them by passing them to java on the command line. But when using TZipFile to extract the manifest information, we ran across the problem that as soon as a .jar-file was opened by Java, we could not access it anymore, even though we specified the zmRead open mode.

The solution is as follows (here argument zippedFile will be "META-INF/MANIFEST.MF") :

String UnzipToString(String zipFile, String zippedFile)
{
  String wsResult = String("");
  TZipFile * zf = new TZipFile();
  TFileStream * fs = NULL;
  try
    {
    // TZipFile * zf = new TZipFile();
    // zf->Open(fileName, zmRead)
    // does not work as expected : even when opened with zmRead,
    // sharing does behave unexpectedly (no access to file because it is in use by another process,
    // even when the other process also uses the file read-only).
    // Solution first create a stream, where sharing mode can be specified explicitly.
    fs = new TFileStream(zipFile,fmOpenRead | fmShareDenyWrite);
    zf->Open(fs,zmRead);

    DynamicArray bda;
    zf->Read(zippedFile, bda);
    char * bytes = new char[bda.Length];
    for (int i = 0; i < bda.Length; i++) {
      bytes[i] = bda[i];
      }
    wsResult = UnicodeString(bytes, bda.Length);
    delete[] bytes;
    zf->Close();
    }
  __finally
    {
    delete zf;
    delete fs;
    }
  return wsResult;
}