ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

winexe_pe.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef COMMON_WINEXE_PE_H
00024 #define COMMON_WINEXE_PE_H
00025 
00026 #include "common/hash-str.h"
00027 #include "common/hashmap.h"
00028 #include "common/str.h"
00029 #include "common/winexe.h"
00030 
00031 namespace Common {
00032 
00033 template<class T> class Array;
00034 class SeekableReadStream;
00035 
00040 class PEResources {
00041 public:
00042     PEResources();
00043     ~PEResources();
00044 
00046     void clear();
00047 
00049     bool loadFromEXE(const String &fileName);
00050 
00052     bool loadFromEXE(SeekableReadStream *stream);
00053 
00055     const Array<WinResourceID> getTypeList() const;
00056 
00058     const Array<WinResourceID> getNameList(const WinResourceID &type) const;
00059 
00061     const Array<WinResourceID> getLangList(const WinResourceID &type, const WinResourceID &name) const;
00062 
00064     SeekableReadStream *getResource(const WinResourceID &type, const WinResourceID &name);
00065 
00067     SeekableReadStream *getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang);
00068 
00069 private:
00070     struct Section {
00071         uint32 virtualAddress;
00072         uint32 size;
00073         uint32 offset;
00074     };
00075 
00076     HashMap<String, Section, IgnoreCase_Hash, IgnoreCase_EqualTo> _sections;
00077 
00078     SeekableReadStream *_exe;
00079 
00080     void parseResourceLevel(Section &section, uint32 offset, int level);
00081     WinResourceID _curType, _curName, _curLang;
00082 
00083     struct Resource {
00084         uint32 offset;
00085         uint32 size;
00086     };
00087 
00088     typedef HashMap<WinResourceID, Resource, WinResourceID_Hash, WinResourceID_EqualTo> LangMap;
00089     typedef HashMap<WinResourceID,  LangMap, WinResourceID_Hash, WinResourceID_EqualTo> NameMap;
00090     typedef HashMap<WinResourceID,  NameMap, WinResourceID_Hash, WinResourceID_EqualTo> TypeMap;
00091 
00092     TypeMap _resources;
00093 };
00094 
00095 } // End of namespace Common
00096 
00097 #endif


Generated on Sat Nov 16 2019 05:00:37 for ResidualVM by doxygen 1.7.1
curved edge   curved edge