secureswitools/swianalysistoolkit/source/dumpswiregistrytool/sisfiledescription.cpp
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 #include "sisfiledescription.h"
       
    20 
       
    21 const char* const  FileOperationOptionsList[]=
       
    22 	{
       
    23 	"Reserved",
       
    24 	"FileRunOptionInstall",
       
    25 	"FileRunOptionUninstall",
       
    26 	"FileRunOptionByMimeType",
       
    27 	"FileRunOptionWaitEnd",
       
    28 	"FileRunOptionSendEnd",
       
    29 	"Reserved",
       
    30 	"Reserved",
       
    31 	"Reserved",
       
    32 	"FileTextOptionContinue",
       
    33 	"FileTextOptionSkipIfNo",
       
    34 	"FileTextOptionAbortIfNo",
       
    35 	"FileTextOptionExitIfNo",
       
    36 	"Reserved",
       
    37 	"Reserved",
       
    38 	"VerifyOnRestore"
       
    39 	};
       
    40 
       
    41 const char* const FileOperationList[]=
       
    42 	{
       
    43 	"Install",
       
    44 	"Run",
       
    45 	"Text",
       
    46 	"Null"
       
    47 	};
       
    48 
       
    49 SISFileDescription::SISFileDescription()
       
    50 	:iTarget (0) ,
       
    51 	iMimeType (0) ,
       
    52 	iOperation (0) ,
       
    53 	iOperationOptions (0) ,
       
    54 	iAlgorithm (0) ,
       
    55 	iHash (0) ,
       
    56 	iUncompressedLengthl (0) ,
       
    57 	iUncompressedLengthh (0) ,
       
    58 	iIndex (0) ,
       
    59 	iSid (0)
       
    60 	{
       
    61 	iAlgorithms[0] = "MD2";
       
    62 	iAlgorithms[1] = "MD5";
       
    63 	iAlgorithms[2] = "SHA1";
       
    64 	iAlgorithms[3] = "HMAC";
       
    65 	}
       
    66 
       
    67 
       
    68 void SISFileDescription::ExtractSISFileDescription(StreamReader& aReader )
       
    69 	{
       
    70 	iTarget = aReader.ReadDescriptor();
       
    71 	iMimeType = aReader.ReadDescriptor();
       
    72 	iOperation = aReader.ReadInt32();
       
    73 	//indicates which options are applicable to the processing of this file during installation
       
    74 	iOperationOptions = aReader.ReadInt32();
       
    75 	//indicates the algorithm used to generate the hash
       
    76 	iAlgorithm = aReader.ReadInt32();
       
    77 	iHash = aReader.ReadDescriptor();
       
    78 	iUncompressedLengthl = aReader.ReadInt32();
       
    79 	iUncompressedLengthh = aReader.ReadInt32();
       
    80 	iIndex = aReader.ReadInt32();
       
    81 	iSid = aReader.ReadInt32();
       
    82 	}
       
    83 
       
    84 void SISFileDescription::DisplaySISFileDescription(int i)
       
    85 	{
       
    86 	int j = 0 ;
       
    87 	int k = 0 ;
       
    88 	cout << "Target" << i+1 << ":" << iTarget << endl ;
       
    89 	while(iOperation)
       
    90 			{
       
    91 			if(iOperation & 0x01)
       
    92 				{
       
    93 				cout << "File Operation Type :" << FileOperationList[j] << endl;
       
    94 				}
       
    95 			j++;
       
    96 			iOperation = iOperation >> 1;
       
    97 			}
       
    98 
       
    99 	while(iOperationOptions)
       
   100 		{
       
   101 		if(iOperationOptions & 0x01)
       
   102 			{
       
   103 			cout << "File Operation Options Type :" << FileOperationOptionsList[k] << endl;
       
   104 			}
       
   105 			k++;
       
   106 			iOperationOptions = iOperationOptions >> 1;
       
   107 		}
       
   108 	
       
   109 	if(iAlgorithms.find(iAlgorithm) !=iAlgorithms.end())
       
   110 		{
       
   111 		cout << "Algorithm :" << iAlgorithms[iAlgorithm] << endl;
       
   112 		}
       
   113 	else
       
   114 		{
       
   115 		cout << "Algorithm :" << "Unknown" << endl;
       
   116 		}
       
   117 
       
   118 	cout <<"SID :" << std::hex << "0x" << iSid << endl << endl;
       
   119 	}
       
   120 
       
   121 SISFileDescription::~SISFileDescription()
       
   122 	{
       
   123 	delete [] iTarget;
       
   124 	delete [] iMimeType;
       
   125 	delete [] iHash;
       
   126 	}
       
   127 
       
   128 
       
   129