Convert two bytes of data to a word (little endian) 'offset' is assumed to index into a word array. So setting it to N will return a dword out of the data starting at offset N*2. Returns None if the data can't be turned into a word.
(self, data, offset)
| 6839 | return struct.pack("<H", word) |
| 6840 | |
| 6841 | def get_word_from_data(self, data, offset): |
| 6842 | """Convert two bytes of data to a word (little endian) |
| 6843 | |
| 6844 | 'offset' is assumed to index into a word array. So setting it to |
| 6845 | N will return a dword out of the data starting at offset N*2. |
| 6846 | |
| 6847 | Returns None if the data can't be turned into a word. |
| 6848 | """ |
| 6849 | |
| 6850 | if (offset + 1) * 2 > len(data): |
| 6851 | return None |
| 6852 | |
| 6853 | return struct.unpack("<H", data[offset * 2 : (offset + 1) * 2])[0] |
| 6854 | |
| 6855 | def get_word_at_rva(self, rva): |
| 6856 | """Return the word value at the given RVA. |
no test coverage detected