67 const size_t cursorCount = cursorGroup->readUint16LE();
72 cursorStreams.
resize(cursorCount);
74 uint32 startOffset = 6 + cursorCount * 16;
76 for (
size_t i = 0; i < cursorCount; i++) {
77 out.
writeByte(cursorGroup->readUint16LE());
78 out.
writeByte(cursorGroup->readUint16LE() / 2);
79 cursorGroup->readUint16LE();
80 out.
writeByte(cursorGroup->readUint16LE());
83 cursorGroup->readUint32LE();
84 uint16 id = cursorGroup->readUint16LE();
87 if (!cursorStreams[i])
94 startOffset += cursorStreams[i]->size() - 4;
97 for (
size_t i = 0; i < cursorCount; i++)
98 out.
writeStream(*cursorStreams[i], cursorStreams[i]->size() - 4);
107 for (std::vector<Common::PEResourceID>::const_iterator it = cursorList.begin(); it != cursorList.end(); ++it) {
110 if (it->getID() == 0xFFFFFFFF)
113 uint32 id = it->getID() - 1;
114 if (
id >= remap.size())
117 res.
name = remap[id];
void load(const std::vector< Common::UString > &remap)
A stream that dynamically grows as it's written to.
void reset(PointerType o=0)
Resets the pointer with the new value.
void resize(typename std::vector< T *>::size_type n, typename std::vector< T *>::value_type val=typename std::vector< T *>::value_type())
Implementing the reading stream interfaces for plain memory blocks.
Common::UString name
The resource's name.
PEFile(Common::SeekableReadStream *exe, const std::vector< Common::UString > &remap)
Take over this stream and read a PE file out of it.
Exception that provides a stack of explanations.
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource's contents.
size_t size() const
Return the number of bytes written to this stream in total.
Basic exceptions to throw.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
Implementing the writing stream interfaces for memory blocks.
std::list< Resource > ResourceList
Simple memory based 'stream', which implements the ReadStream interface for a plain memory block...
void writeUint16LE(uint16 value)
A vector storing pointer to objects, with automatic deletion.
void setDisposable(bool disposeMemory)
A resource within the archive.
void writeByte(byte value)
A class able to load resources from a Windows Portable Executable, such as cursors, bitmaps, and sounds.
const ResourceList & getResources() const
Return the list of resources.
Portable executable parsing.
FileType type
The resource's type.
A portable executable archive.
size_t writeStream(ReadStream &stream, size_t n)
Copy n bytes of the given stream into the stream.
Common::ScopedPtr< Common::PEResources > _peFile
The actual exe.
ResourceList _resources
External list of resource names and types.
Interface for a seekable & readable data stream.
void writeUint32LE(uint32 value)
uint32 index
The resource's local index within the archive.