imgtools/romtools/readimage/inc/common.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     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 * @internalComponent
       
    16 * @released
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __IMAGE_READER_COMMON_H_
       
    22 #define __IMAGE_READER_COMMON_H_
       
    23 
       
    24 #include <string>
       
    25 #include <iostream>
       
    26 #include <iomanip>
       
    27 #ifdef __MSVCDOTNET__ 
       
    28 #include <ctype.h>
       
    29 #endif
       
    30 
       
    31 using namespace std ;
       
    32 
       
    33 #include <e32std.h>
       
    34 #include <e32std_private.h>
       
    35 #include <e32rom.h>
       
    36 #include <u32std.h>
       
    37 #include <f32file.h>
       
    38 
       
    39 #include "e32image.h"
       
    40 
       
    41 #define EXIT_SUCCESS 0
       
    42 #define EXIT_FAILURE 1
       
    43 
       
    44 extern ostream *out;
       
    45 
       
    46 #define DLL_UID1	10000079
       
    47 #define EXE_UID1	1000007a
       
    48 
       
    49 typedef enum EImageType
       
    50 {
       
    51 	EUNKNOWN_IMAGE,
       
    52 	EROM_IMAGE,
       
    53 	EROMX_IMAGE,
       
    54 	EROFS_IMAGE,
       
    55 	EROFX_IMAGE,
       
    56 	//more here...
       
    57 	EE32_IMAGE,
       
    58     //EBAREROM_IMAGE is introduced for handling bare ROM image (an image without loader header)
       
    59     EBAREROM_IMAGE
       
    60 };
       
    61 
       
    62 #define DIR_SEPARATOR  "/"
       
    63 #define DUMP_HDR_FLAG			0x1
       
    64 #define DUMP_VERBOSE_FLAG		0x2
       
    65 #define DUMP_DIR_ENTRIES_FLAG	0x4
       
    66 #define DUMP_E32_IMG_FLAG		0x8
       
    67 
       
    68 #define LOG_IMAGE_CONTENTS_FLAG	0x10
       
    69 #define EXTRACT_FILES_FLAG		0x20
       
    70 #define MODE_SIS2IBY			0x40
       
    71 #define RECURSIVE_FLAG			0x80
       
    72 #define EXTRACT_FILE_SET_FLAG	0x100
       
    73 
       
    74 // maximum buffer size.
       
    75 #define _MAX_BUFFER_SIZE_		128 
       
    76 
       
    77 class ReaderUtil
       
    78 {
       
    79 public:
       
    80 	static bool IsExecutable(TUint8* Uids1);
       
    81 };
       
    82 
       
    83 class ImageReaderException
       
    84 {
       
    85 public:
       
    86 	ImageReaderException(const char* aFile, const char* aErrMessage);
       
    87 	virtual ~ImageReaderException(){}
       
    88 	virtual void Report();
       
    89 
       
    90 	string iImgFileName;
       
    91 	string iErrMessage;
       
    92 };
       
    93 
       
    94 class ImageReaderUsageException : public ImageReaderException
       
    95 {
       
    96 public:
       
    97 	ImageReaderUsageException(const char* aFile, const char* aErrMessage);
       
    98 	void Report();
       
    99 };
       
   100 
       
   101 ostream& DumpInHex(char* aDesc, TUint32 aData, bool aContinue = false,TUint aDataWidth=8,\
       
   102 				   char aFiller='0', TUint aMaxDescWidth=28);
       
   103 
       
   104 #endif //__IMAGE_READER_COMMON_H_