Holds exported symbols' information. ordinal: ordinal of the symbol address: address of the symbol name: name of the symbol (None if the symbol is exported by ordinal only) forwarder: if the symbol is forwarded it will contain the name of
| 1619 | |
| 1620 | |
| 1621 | class ExportData(DataContainer): |
| 1622 | """Holds exported symbols' information. |
| 1623 | |
| 1624 | ordinal: ordinal of the symbol |
| 1625 | address: address of the symbol |
| 1626 | name: name of the symbol (None if the symbol is |
| 1627 | exported by ordinal only) |
| 1628 | forwarder: if the symbol is forwarded it will |
| 1629 | contain the name of the target symbol, |
| 1630 | None otherwise. |
| 1631 | """ |
| 1632 | |
| 1633 | def __setattr__(self, name, val): |
| 1634 | |
| 1635 | # If the instance doesn't yet have an ordinal attribute |
| 1636 | # it's not fully initialized so can't do any of the |
| 1637 | # following |
| 1638 | # |
| 1639 | if ( |
| 1640 | hasattr(self, "ordinal") |
| 1641 | and hasattr(self, "address") |
| 1642 | and hasattr(self, "forwarder") |
| 1643 | and hasattr(self, "name") |
| 1644 | ): |
| 1645 | |
| 1646 | if name == "ordinal": |
| 1647 | self.pe.set_word_at_offset(self.ordinal_offset, val) |
| 1648 | elif name == "address": |
| 1649 | self.pe.set_dword_at_offset(self.address_offset, val) |
| 1650 | elif name == "name": |
| 1651 | # Complain if the length of the new name is longer than the |
| 1652 | # existing one |
| 1653 | if len(val) > len(self.name): |
| 1654 | raise PEFormatError( |
| 1655 | "The export name provided is longer than the existing one." |
| 1656 | ) |
| 1657 | self.pe.set_bytes_at_offset(self.name_offset, val) |
| 1658 | elif name == "forwarder": |
| 1659 | # Complain if the length of the new name is longer than the |
| 1660 | # existing one |
| 1661 | if len(val) > len(self.forwarder): |
| 1662 | raise PEFormatError( |
| 1663 | "The forwarder name provided is longer than the existing one." |
| 1664 | ) |
| 1665 | self.pe.set_bytes_at_offset(self.forwarder_offset, val) |
| 1666 | |
| 1667 | self.__dict__[name] = val |
| 1668 | |
| 1669 | |
| 1670 | class ResourceDirData(DataContainer): |
no outgoing calls
no test coverage detected