secureswitools/swianalysistoolkit/source/dumpswiregistrytool/dumpswiregistrytool.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file 
       
    21  @internalComponent 
       
    22 */
       
    23 
       
    24 #ifndef __DUMPSWIREGISTRYTOOL_H__
       
    25 #define __DUMPSWIREGISTRYTOOL_H__
       
    26 
       
    27 #pragma warning( disable : 4786) 
       
    28 
       
    29 #include "options.h"
       
    30 #include "streamreader.h"
       
    31 #include "registrytoken.h"
       
    32 #include "registrypackage.h"
       
    33 #include "siscontrollerinfo.h"
       
    34 #include "sisproperty.h"
       
    35 #include "sisdependency.h"
       
    36 #include "sisembeds.h"
       
    37 #include "sisfiledescription.h"
       
    38 #include "osinterface.h"
       
    39 
       
    40 #include <stdlib.h>
       
    41 #include <string>
       
    42 #include <algorithm>
       
    43 #include <map>
       
    44 #include <fstream>
       
    45 #include <iostream>
       
    46 
       
    47 class RegistryToken;
       
    48 class StreamReader;
       
    49 class Options;
       
    50 class RegistryPackage;
       
    51 class SISControllerInfo;
       
    52 
       
    53 /**
       
    54  * The DumpSWIRegistryTool class provides functions to extract the registry contents.
       
    55  * @internalComponent 
       
    56  */
       
    57 
       
    58 class DumpRegistryTool
       
    59 {
       
    60 public:
       
    61 
       
    62 	DumpRegistryTool();
       
    63 
       
    64 	~DumpRegistryTool();
       
    65 	/**
       
    66 	  Calls the ExtractFilesFromDirectory(),which provides a vector containing all the .reg files present in the 
       
    67 	  package directory specified,and iterates this vector one by one and calls ExtractRegistry() ,to extract the information
       
    68 	  from that particular .reg file.
       
    69 	 */
       
    70 	void Run(const Options& aOptions);
       
    71 
       
    72 private:
       
    73 	
       
    74 	/**
       
    75 	  Extracts the registry file contents.
       
    76 	  @param	aFile	.reg file .
       
    77 	  @return	true	If registry extraction is successful.This status is used to determine whether
       
    78 	 					the registry file is empty or not.
       
    79 	 */
       
    80 	bool ExtractRegistry(const char* aFile , const Options& aOptions);
       
    81 
       
    82 	/**
       
    83 	  Extracts the top level information about a package namely it's install type , whether 
       
    84 	  it is ROM Based , trust status , preinstalled status , signed status.
       
    85 	 */
       
    86 	void ExtractPackageInformation(StreamReader& aReader);
       
    87 
       
    88 	/**
       
    89 	  Extracts the information about sis dependencies,sis embeds, sis file description,sis properties , 
       
    90 	  validation status,revocation status and installed chain indices.
       
    91 	 */
       
    92 	void ExtractControllerInformation(StreamReader& aReader);
       
    93 
       
    94 	/**
       
    95 	  Checks whether the user specified registry entries(Pkg Name , Pkg UID and Vendor Name) matches
       
    96 	  the one present in the registry file.
       
    97 	  @param	aUserSpecifiedData	Registry entries(Pkg Name , Pkg UID and Vendor Name) specified
       
    98 	 								on command line.
       
    99 	  @param	aFileSpecifiedData	The package uid,name and vendor name as present in the registry file.
       
   100 	  @return	1					If the user and file data matches.
       
   101 	 */
       
   102 	int CompareUserAndFileSpecifiedData(const string& aUserSpecifiedData , const string& aFileData); 
       
   103 
       
   104 	/**
       
   105 	  Displays the top level information about a package namely it's install type , whether 
       
   106 	  it is ROM Based , trust status , preinstalled status , signed status.
       
   107 	  */
       
   108 	void DisplayPackageInformation();
       
   109     
       
   110 private:
       
   111 	
       
   112 	bool iRegistryEntryValid ;
       
   113 	ifstream iFile ; 
       
   114 	unsigned short int iFileMajorVersion ;
       
   115 	unsigned short int iFileMinorVersion ;
       
   116 	char* iPkgVendorLocalizedName ;
       
   117 	unsigned int iPkgInstallType ;
       
   118 	unsigned int iRomBasedPkg ;				
       
   119 	unsigned int iPkgPreinstalledStatus ;	
       
   120 	unsigned int iPkgSignedStatus;			
       
   121 	unsigned int iPkgTrust ;				
       
   122 	unsigned int iNotUsed ; 
       
   123 	unsigned int iTimeStampl ;
       
   124 	unsigned int iTimeStamph ;
       
   125 	map<int,string> iInstallType ;
       
   126 	map<int,string> iPackageTrust ;
       
   127 	map<int,string> iValidationStatus ;
       
   128 	map<int,string> iRevocationStatus ;
       
   129 };
       
   130 
       
   131 extern DumpRegistryTool tool;
       
   132 #endif
       
   133