direct.dist.pefile
from direct.dist.pefile import DataResource, IconGroupResource, PEFile, RVASize, ResourceTable, Section, VersionInfoResource, expdirtab, impdirtab
Tools for manipulating Portable Executable files.
This can be used, for example, to extract a list of dependencies from an .exe or .dll file, or to add version information and an icon resource to it.
Inheritance diagram
- class DataResource[source]
Bases:
objectA resource entry in the resource table.
- accelerator = 9
- animated_cursor = 21
- animated_icon = 22
- bitmap = 2
- cursor = 1
- cursor_group = 12
- dialog = 5
- dlg_include = 17
- property encoding
- font = 8
- font_directory = 7
- html = 23
- icon = 3
- icon_group = 14
- manifest = 24
- message_table = 11
- plug_play = 19
- rcdata = 10
- string = 6
- version = 16
- vxd = 20
- class IconGroupResource[source]
Bases:
object- class Icon(width, height, planes, bpp, size, id)
Bases:
tuple- bpp
Alias for field number 3
- height
Alias for field number 1
- id
Alias for field number 5
- planes
Alias for field number 2
- size
Alias for field number 4
- width
Alias for field number 0
- code_page = 0
- type = 14
- class PEFile[source]
Bases:
object- add_icon(icon, ordinal=2)[source]
Adds an icon resource from the given Icon object. Requires calling add_resource_section() afterwards.
- add_resource_section()[source]
Adds a resource section to the file containing the resources that were previously added via add_icon et al. Assumes the file does not contain a resource section yet.
- add_section(name, flags, data)[source]
Adds a new section with the given name, flags and data. The virtual address space is automatically resized to fit the new data.
Returns the newly created Section object.
- add_version_info(file_ver, product_ver, data, lang=1033, codepage=1200)[source]
Adds a version info resource to the file.
- imports = ()
- class RVASize(addr, size)
Bases:
tuple- addr
Alias for field number 0
- size
Alias for field number 1
- class expdirtab(flags, timdat, majver, minver, name, ordinal_base, nentries, nnames, entries, names, ordinals)
Bases:
tuple- entries
Alias for field number 8
- flags
Alias for field number 0
- majver
Alias for field number 2
- minver
Alias for field number 3
- name
Alias for field number 4
- names
Alias for field number 9
- nentries
Alias for field number 6
- nnames
Alias for field number 7
- ordinal_base
Alias for field number 5
- ordinals
Alias for field number 10
- timdat
Alias for field number 1
