(self, name, val)
| 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): |
nothing calls this directly
no test coverage detected