Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef COMMON_WINEXE_NE_H
00024 #define COMMON_WINEXE_NE_H
00025
00026 #include "common/list.h"
00027 #include "common/str.h"
00028 #include "common/winexe.h"
00029
00030 namespace Common {
00031
00032 template<class T> class Array;
00033 class SeekableReadStream;
00034
00036 enum NEResourceType {
00037 kNECursor = 0x01,
00038 kNEBitmap = 0x02,
00039 kNEIcon = 0x03,
00040 kNEMenu = 0x04,
00041 kNEDialog = 0x05,
00042 kNEString = 0x06,
00043 kNEFontDir = 0x07,
00044 kNEFont = 0x08,
00045 kNEAccelerator = 0x09,
00046 kNERCData = 0x0A,
00047 kNEMessageTable = 0x0B,
00048 kNEGroupCursor = 0x0C,
00049 kNEGroupIcon = 0x0E,
00050 kNEVersion = 0x10,
00051 kNEDlgInclude = 0x11,
00052 kNEPlugPlay = 0x13,
00053 kNEVXD = 0x14,
00054 kNEAniCursor = 0x15,
00055 kNEAniIcon = 0x16,
00056 kNEHTML = 0x17,
00057 kNEManifest = 0x18
00058 };
00059
00066 class NEResources {
00067 public:
00068 NEResources();
00069 ~NEResources();
00070
00072 void clear();
00073
00075 bool loadFromEXE(const String &fileName);
00076
00078 bool loadFromCompressedEXE(const String &fileName);
00079
00081 bool loadFromEXE(SeekableReadStream *stream);
00082
00084 const Array<WinResourceID> getIDList(const WinResourceID &type) const;
00085
00087 SeekableReadStream *getResource(const WinResourceID &type, const WinResourceID &id);
00088
00089 private:
00091 struct Resource {
00092 WinResourceID id;
00093
00094 WinResourceID type;
00095
00096 uint32 offset;
00097 uint32 size;
00098
00099 uint16 flags;
00100 uint16 handle;
00101 uint16 usage;
00102 };
00103
00104 SeekableReadStream *_exe;
00105
00107 List<Resource> _resources;
00108
00110 uint32 getResourceTableOffset();
00112 bool readResourceTable(uint32 offset);
00113
00115 const Resource *findResource(const WinResourceID &type, const WinResourceID &id) const;
00116
00118 static String getResourceString(SeekableReadStream &exe, uint32 offset);
00119 };
00120
00121 }
00122
00123 #endif