13 #ifndef RETDEC_PELIB_TLSDIRECTORY_H
14 #define RETDEC_PELIB_TLSDIRECTORY_H
35 void rebuild(std::vector<std::uint8_t>& vBuffer)
const;
37 unsigned int size()
const;
39 int write(
const std::string& strFilename,
unsigned int dwOffset)
const;
81 std::uint32_t bytesRead;
83 if((rva +
size) >= sizeOfImage)
123 std::uint64_t AddressOfCallBack = 0;
125 if(imageLoader.
readPointer(rva, AddressOfCallBack) == 0)
127 if(AddressOfCallBack == 0)
184 std::fstream ofFile(strFilename.c_str(), std::ios_base::in);
189 ofFile.open(strFilename.c_str(), std::ios_base::out | std::ios_base::binary);
194 ofFile.open(strFilename.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::binary);
202 ofFile.seekp(dwOffset, std::ios::beg);
204 std::vector<unsigned char> vBuffer;
207 ofFile.write(
reinterpret_cast<const char*
>(vBuffer.data()), vBuffer.size());
Definition: ImageLoader.h:138
std::uint32_t readPointer(std::uint32_t rva, std::uint64_t &pointerValue)
Definition: ImageLoader.cpp:291
std::uint32_t getDataDirSize(std::size_t dataDirIndex) const
Definition: ImageLoader.h:321
std::uint32_t getDataDirRva(std::size_t dataDirIndex) const
Definition: ImageLoader.h:315
std::uint32_t getImageBitability() const
Definition: ImageLoader.cpp:432
std::uint64_t getImageBase() const
Definition: ImageLoader.h:265
std::uint32_t readImage(void *buffer, std::uint32_t rva, std::uint32_t bytesToRead)
Definition: ImageLoader.cpp:171
std::uint32_t getSizeOfImage() const
Definition: ImageLoader.h:280
std::uint32_t getPointerSize() const
Definition: ImageLoader.cpp:322
Class that handles the TLS directory.
Definition: TlsDirectory.h:25
PELIB_IMAGE_TLS_DIRECTORY m_tls
Structure that holds all information about the directory.
Definition: TlsDirectory.h:27
void setCharacteristics(std::uint32_t dwValue)
Sets the Characteristics value of the TLS header.
Definition: TlsDirectory.h:326
std::vector< uint64_t > m_Callbacks
Definition: TlsDirectory.h:28
std::uint64_t getEndAddressOfRawData() const
Returns the EndAddressOfRawData value of the TLS header.
Definition: TlsDirectory.h:236
unsigned int size() const
Returns the size of the TLS Directory.
Definition: TlsDirectory.h:172
std::uint64_t getStartAddressOfRawData() const
Returns the StartAddressOfRawData value of the TLS header.
Definition: TlsDirectory.h:227
std::uint64_t getAddressOfCallBacks() const
Returns the AddressOfCallBacks value of the TLS header.
Definition: TlsDirectory.h:254
std::size_t pointerSize
Definition: TlsDirectory.h:29
std::uint64_t getAddressOfIndex() const
Returns the AddressOfIndex value of the TLS header.
Definition: TlsDirectory.h:245
int read(ImageLoader &imageLoader)
Reads a file's TLS directory.
Definition: TlsDirectory.h:75
void rebuild(std::vector< std::uint8_t > &vBuffer) const
Rebuilds the TLS directory.
Definition: TlsDirectory.h:143
void setStartAddressOfRawData(std::uint64_t value)
Sets the StartAddressOfRawData value of the TLS header.
Definition: TlsDirectory.h:281
void setEndAddressOfRawData(std::uint64_t value)
Sets the EndAddressOfRawData value of the TLS header.
Definition: TlsDirectory.h:290
std::uint32_t getSizeOfZeroFill() const
Returns the SizeOfZeroFill value of the TLS header.
Definition: TlsDirectory.h:263
std::uint32_t getCharacteristics() const
Returns the Characteristics value of the TLS header.
Definition: TlsDirectory.h:272
void setSizeOfZeroFill(std::uint32_t dwValue)
Sets the SizeOfZeroFill value of the TLS header.
Definition: TlsDirectory.h:317
int write(const std::string &strFilename, unsigned int dwOffset) const
Writes the TLS directory to a file.
Definition: TlsDirectory.h:182
void setAddressOfIndex(std::uint64_t value)
Sets the AddressOfIndex value of the TLS header.
Definition: TlsDirectory.h:299
void setAddressOfCallBacks(std::uint64_t value)
Sets the AddressOfCallBacks value of the TLS header.
Definition: TlsDirectory.h:308
const std::vector< std::uint64_t > & getCallbacks() const
Returns vector of TLS callbacks.
Definition: TlsDirectory.h:218
Definition: BoundImportDirectory.h:21
@ PELIB_IMAGE_DIRECTORY_ENTRY_TLS
Definition: PeLibAux.h:178
const std::uint32_t PELIB_MAX_TLS_CALLBACKS
Definition: PeLibAux.h:151
@ ERROR_NONE
Definition: PeLibAux.h:33
@ ERROR_OPENING_FILE
Definition: PeLibAux.h:34
@ ERROR_INVALID_FILE
Definition: PeLibAux.h:35
Definition: PeLibAux.h:1180
std::uint32_t StartAddressOfRawData
Definition: PeLibAux.h:1181
std::uint32_t Characteristics
Definition: PeLibAux.h:1186
std::uint32_t SizeOfZeroFill
Definition: PeLibAux.h:1185
std::uint32_t AddressOfIndex
Definition: PeLibAux.h:1183
std::uint32_t EndAddressOfRawData
Definition: PeLibAux.h:1182
std::uint32_t AddressOfCallBacks
Definition: PeLibAux.h:1184
Definition: PeLibAux.h:1190
std::uint64_t StartAddressOfRawData
Definition: PeLibAux.h:1191
std::uint32_t SizeOfZeroFill
Definition: PeLibAux.h:1195
std::uint32_t Characteristics
Definition: PeLibAux.h:1196
std::uint64_t AddressOfIndex
Definition: PeLibAux.h:1193
std::uint64_t EndAddressOfRawData
Definition: PeLibAux.h:1192
std::uint64_t AddressOfCallBacks
Definition: PeLibAux.h:1194