Pkg.NSIS — API for parsing NSIS installers

Overview

The Pkg.NSIS module contains the API for parsing the Nullsoft Scriptable Install System format.

Module API

Pkg.NSIS module API.

Classes:

NSISObject()

This class represents an NSIS installer object.

NSISOpcodeInfo()

This class describes a single NSIS instruction opcode (mnemonic, arguments, etc.).

class NSISObject

Bases: Pro.Core.CFFObject

This class represents an NSIS installer object.

Methods:

Disassemble(out, *[, wo])

Disassembles the instructions to a human-readable form.

EnumerateStrings(*[, wo])

Enumerates string-table indices present in the installer.

GetFile(i)

Retrieves the data of the embedded file at the given index.

GetFileCount()

Returns the total number of files.

GetFileName(i)

Retrieves the logical (stored) name of the embedded file at the given index.

GetFirstHeader()

Retrieves the first header structure.

GetHeader()

Retrieves the header structure.

GetHeaderData()

Retrieves the raw header data.

GetInstructions()

Returns a Pro.Core.CFFStruct representing the instruction structures.

GetLanguageTableString(table, index)

Retrieves a string from a specific language table by index.

GetLanguageTableStringCount()

Returns the number of string entries present in each language table.

GetLanguageTables()

Retrieves the collection of language tables embedded in the installer.

GetOpcodeInfo(opcode)

Retrieves metadata for a specific instruction opcode.

GetPageWindowProcName(page)

Retrieves the window procedure name for a given page entry.

GetPages()

Returns a Pro.Core.CFFStruct representing the page structures.

GetSections()

Returns a Pro.Core.CFFStruct representing the section structures.

GetString(index)

Retrieves a string by index from the installer string table.

GetVersion()

Retrieves the NSIS version identified for this installer.

HasLanguageTables()

Returns True if one or more language tables are present; otherwise False.

IsUnicode()

Returns True if the installer is Unicode; otherwise returns False.

Parse(*[, wo, version, undef])

Parses the NSIS installer.

Disassemble(out: Pro.Core.NTTextStream, *, wo: Optional[Pro.Core.NTIWait] = None)bool

Disassembles the instructions to a human-readable form.

Parameters
  • out (NTTextStream) – Output text stream receiving the disassembly.

  • wo (Optional[NTIWait]) – Optional wait object for long-running operations.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also GetInstructions() and GetOpcodeInfo().

EnumerateStrings(*, wo: Optional[Pro.Core.NTIWait] = None)List[int]

Enumerates string-table indices present in the installer.

Parameters

wo (Optional[NTIWait]) – Optional wait object for long-running operations.

Returns

Returns a list of integer indices into the installer string table.

Return type

List[int]

See also GetString().

GetFile(i: int)Pro.Core.NTContainer

Retrieves the data of the embedded file at the given index.

Parameters

i (int) – Zero-based index of the file.

Returns

Returns a Pro.Core.NTContainer.

Return type

NTContainer

See also GetFileName() and GetFileCount().

GetFileCount()int
Returns

Returns the total number of files.

Return type

int

See also GetFile() and GetFileName().

GetFileName(i: int)str

Retrieves the logical (stored) name of the embedded file at the given index.

Parameters

i (int) – Zero-based index of the file.

Returns

Returns the file name associated with the embedded file.

Return type

str

See also GetFile() and GetFileCount().

GetFirstHeader()Pro.Core.CFFStruct

Retrieves the first header structure.

Returns

Returns a Pro.Core.CFFStruct representing the first header.

Return type

CFFStruct

See also GetHeader() and GetHeaderData().

GetHeader()Pro.Core.CFFStruct

Retrieves the header structure.

Returns

Returns a Pro.Core.CFFStruct representing the header.

Return type

CFFStruct

See also GetHeaderData().

GetHeaderData()Pro.Core.NTContainer

Retrieves the raw header data.

Returns

Returns a Pro.Core.NTContainer with the header bytes.

Return type

NTContainer

See also GetHeader() and GetFirstHeader().

GetInstructions()Pro.Core.CFFStruct
Returns

Returns a Pro.Core.CFFStruct representing the instruction structures.

Return type

CFFStruct

See also GetOpcodeInfo() and Disassemble().

GetLanguageTableString(table: Union[Pro.Core.CFFStruct, int], index: int)str

Retrieves a string from a specific language table by index.

Parameters
Returns

Returns the string for the given table and index.

Return type

str

See also GetLanguageTables() and GetLanguageTableStringCount().

GetLanguageTableStringCount()int
Returns

Returns the number of string entries present in each language table.

Return type

int

See also GetLanguageTableString().

GetLanguageTables()List[Pro.Core.CFFStruct]

Retrieves the collection of language tables embedded in the installer.

Returns

Returns a list of Pro.Core.CFFStruct objects, one per language table.

Return type

List[CFFStruct]

See also HasLanguageTables() and GetLanguageTableString().

GetOpcodeInfo(opcode: int)Optional[Pkg.NSIS.NSISOpcodeInfo]

Retrieves metadata for a specific instruction opcode.

Parameters

opcode (int) – The numeric opcode to query.

Returns

Returns an NSISOpcodeInfo if the opcode is known; otherwise returns None.

Return type

Optional[NSISOpcodeInfo]

See also NSISOpcodeInfo.

GetPageWindowProcName(page: Pro.Core.CFFStruct)str

Retrieves the window procedure name for a given page entry.

Parameters

page (CFFStruct) – A page entry from GetPages().

Returns

Returns the window procedure name for the specified page.

Return type

str

See also GetPages().

GetPages()Pro.Core.CFFStruct
Returns

Returns a Pro.Core.CFFStruct representing the page structures.

Return type

CFFStruct

See also GetPageWindowProcName().

GetSections()Pro.Core.CFFStruct
Returns

Returns a Pro.Core.CFFStruct representing the section structures.

Return type

CFFStruct

GetString(index: int)str

Retrieves a string by index from the installer string table.

Parameters

index (int) – The string-table index returned by EnumerateStrings().

Returns

Returns the string if successful; otherwise returns an empty string.

Return type

str

See also EnumerateStrings().

GetVersion()Optional[Tuple[int]]

Retrieves the NSIS version identified for this installer.

Returns

Returns a version tuple (e.g., (major, minor, build)) if available; otherwise returns None.

Return type

Optional[Tuple[int]]

See also Parse().

HasLanguageTables()bool
Returns

Returns True if one or more language tables are present; otherwise False.

Return type

bool

See also GetLanguageTables() and GetLanguageTableString().

IsUnicode()bool
Returns

Returns True if the installer is Unicode; otherwise returns False.

Return type

bool

Parse(*, wo: Optional[Pro.Core.NTIWait] = None, version: Optional[Tuple[int]] = None, undef: Optional[List[str]] = None)bool

Parses the NSIS installer.

Parameters
  • wo (Optional[NTIWait]) – Optional wait object for long-running operations.

  • version (Optional[Tuple[int]]) – Optional NSIS version tuple (e.g., (major, minor, build)) to guide parsing.

  • undef (Optional[List[str]]) – Optional list of preprocessor symbols to treat as undefined during parsing.

Returns

Returns True if successful; otherwise returns False.

Return type

bool

See also GetVersion(), IsUnicode(), GetHeader() and GetInstructions().

class NSISOpcodeInfo

This class describes a single NSIS instruction opcode (mnemonic, arguments, etc.).

Methods:

GetArgName(i)

Retrieves the preferred name of the i-th argument.

GetArgType(i)

Retrieves the type of the i-th argument.

Attributes:

arg_names

A sequence containing the preferred names for the opcode arguments.

arg_types

A sequence describing the argument types for the opcode.

code

The numeric opcode value.

mnemonic

The textual mnemonic of the opcode (e.g., "Call").

num_args

The number of arguments expected by this opcode.

GetArgName(i: int)str

Retrieves the preferred name of the i-th argument.

Parameters

i (int) – Zero-based index of the argument.

Returns

Returns the argument name for the specified index.

Return type

str

See also GetArgType().

GetArgType(i: int)int

Retrieves the type of the i-th argument.

Parameters

i (int) – Zero-based index of the argument.

Returns

Returns the argument type for the specified index.

Return type

int

See also GetArgName().

arg_names

A sequence containing the preferred names for the opcode arguments.

arg_types

A sequence describing the argument types for the opcode.

code

The numeric opcode value.

mnemonic

The textual mnemonic of the opcode (e.g., "Call").

num_args

The number of arguments expected by this opcode.