[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/wimlib/wimlib-0.2/ -> wimextract.c (source)

   1  #define _LARGEFILE_SOURCE
   2  #define _FILE_OFFSET_BITS 64
   3  
   4  #include <stdio.h>
   5  #include <stdlib.h>
   6  #include <string.h>
   7  #include <sys/stat.h>
   8  #include "lzx.h"
   9  #include "wim.h"
  10  
  11  int main(int argc, char **argv)
  12  {
  13    FILE *fp;
  14    size_t result;
  15  
  16    if (argc != 4 )
  17    {
  18      printf("Usage: wimextract <inputwimfile> <path> <filename>\n");
  19      exit(0);
  20    }
  21  
  22    // Open input file for reading
  23    fp = fopen(argv[1],"r");
  24    if (fp == NULL)
  25    {
  26      printf("Error opening file\n");
  27      exit(3);
  28    }
  29    LARGE_INTEGER numoffsets=0;
  30    WIM_HEADER Header;
  31    ReadWimHeader(fp,&Header);
  32  
  33    FILE_RESOURCE_HEADER *frh=ReadLookupTable(fp,Header.OffsetTable.Offset,Header.OffsetTable.Size,&numoffsets);
  34    qsort(frh,numoffsets,sizeof(FILE_RESOURCE_HEADER),comparehashes);
  35    BYTE *xml=ReadXML(fp,Header.XmlData.Offset,Header.XmlData.Size);
  36    BOOT_META_DATA bmd = ReadBootMetaDataTable(fp,Header.BootMetaData);
  37  
  38    DIRENTRY *extractfile=FindFile2(bmd.DirEntry,argv[2],argv[3]);
  39    ExtractFile(extractfile,frh,numoffsets,fp,argv[3]);
  40  
  41    if( fclose( fp ))
  42        printf("Input File close error.\n");
  43  
  44    exit(0);
  45  }


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1