[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/wimlib/wimlib-0.2/ -> wiminfo.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  BYTE *InitHash(DWORD myint)
  12  {
  13     unsigned char *mystr=(unsigned char *) &myint;
  14     BYTE *result=(BYTE *)malloc(sizeof(BYTE)*20);
  15     int i=0;
  16     int j=0;
  17     for(j=0;j<5;j++)
  18     {
  19       for(i=0;i<4;i++)
  20       {
  21          result[i+j*5]=mystr[i];
  22       }
  23     }
  24    return result;
  25  }
  26  
  27  int main(int argc, char **argv)
  28  {
  29    FILE *fp;
  30    size_t result;
  31  
  32    if (argc != 2 && argc != 3)
  33    {
  34      printf("Usage: wiminfo <inputwimfile> [info]\n");
  35      printf("    info can be:\n");
  36      printf("        all     : Prints all categories\n");
  37      printf("        header  : Printf WIM Header\n");
  38      printf("        meta    : Prints Boot Metadata\n");
  39      printf("        lookup  : Prints Lookup Table\n");
  40      printf("        xml     : Prints XML Data\n");
  41      exit(0);
  42    }
  43  
  44    // Open input file for reading
  45    fp = fopen(argv[1],"r");
  46    if (fp == NULL)
  47    {
  48      printf("Error opening file\n");
  49      exit(3);
  50    }
  51    LARGE_INTEGER numoffsets=0;
  52    WIM_HEADER Header;
  53    ReadWimHeader(fp,&Header);
  54  
  55    FILE_RESOURCE_HEADER *frh=ReadLookupTable(fp,Header.OffsetTable.Offset,Header.OffsetTable.Size,&numoffsets);
  56    BYTE *xml=ReadXML(fp,Header.XmlData.Offset,Header.XmlData.Size);
  57    BOOT_META_DATA bmd = ReadBootMetaDataTable(fp,Header.BootMetaData);
  58    if( fclose( fp ))
  59        printf("Input File close error.\n");
  60  
  61    if (argc == 2 ||  (!strcmp(argv[2],strdup("header")) || !strcmp(argv[2],strdup("all"))))
  62    {
  63      PrintHeader(Header);
  64    }
  65  
  66    if (argc == 2 ||  (!strcmp(argv[2],strdup("lookup")) || !strcmp(argv[2],strdup("all"))))
  67    {
  68      PrintLookupTable(frh,numoffsets);
  69    }
  70  
  71    if (argc == 2 ||  (!strcmp(argv[2],strdup("xml")) || !strcmp(argv[2],strdup("all"))))
  72    {
  73      PrintXML(xml,Header.XmlData.Size);
  74    }
  75  
  76    if (argc == 2 ||  (!strcmp(argv[2],strdup("meta")) || !strcmp(argv[2],strdup("all"))))
  77    {
  78      PrintBootMetaData(bmd);
  79    }
  80  
  81    exit(0);
  82  }


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