コード例 #1
0
#   win_app_package_exe_config.py
#
import sys

import ctypes
import ctypes.wintypes

import struct
from namedstruct import namedstruct

is_64bit = (ctypes.sizeof( ctypes.c_voidp ) * 8) == 64

# format of .ICO file on disk
struct_IconDirHeader = namedstruct( 'IconDirHeader', '<'
    'h:idReserved '
    'h:idType '
    'h:idCount'
    )
struct_IconDirEntry = namedstruct( 'IconDirEntry', '<'
    'b:bWidth '
    'b:bHeight '
    'b:bColorCount '
    'b:bReserved '
    'h:wPlanes '
    'h:wBitCount '
    'i:dwBytesInRes '
    'i:dwImageOffset'
    )

# Resource formats
struct_GrpIconDir = namedstruct( 'GrpIconDir', '<'
コード例 #2
0
#!/usr/bin/python3
import namedstruct
import pathlib

dos_magic = b'MZ'
struct_dos_header = namedstruct.namedstruct( 'DOS header', '<'
    '2s:dos_magic '
    'h:lastsize '
    'h:nblocks '
    'h:nreloc '
    'h:hdrsize '
    'h:minalloc '
    'h:maxalloc '
    'H:ss '
    'H:sp '
    'h:checksum '
    'H:ip '
    'H:cs '
    'h:relocpos '
    'h:noverlay '
    '4H:reserved1 '
    'h:oem_id '
    'h:oem_info '
    '10H:reserved2 '
    'L:pe_offset'
    )

pe_magic = b'PE\x00\x00'
struct_pe_header = namedstruct.namedstruct( 'PE Header', '<'
    '4s:pe_magic'
    )