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:
This class represents an NSIS installer object.
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.
Returns the total number of files.
GetFileName
(i)Retrieves the logical (stored) name of the embedded file at the given index.
Retrieves the first header structure.
Retrieves the header structure.
Retrieves the raw header data.
Returns a
Pro.Core.CFFStruct
representing the instruction structures.
GetLanguageTableString
(table, index)Retrieves a string from a specific language table by index.
Returns the number of string entries present in each language table.
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.Returns a
Pro.Core.CFFStruct
representing the section structures.
GetString
(index)Retrieves a string by index from the installer string table.
Retrieves the NSIS version identified for this installer.
Returns
True
if one or more language tables are present; otherwiseFalse
.Returns
True
if the installer is Unicode; otherwise returnsFalse
.
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 returnsFalse
.- Return type
bool
See also
GetInstructions()
andGetOpcodeInfo()
.
- 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
See also
GetFileName()
andGetFileCount()
.
- GetFileCount() → int¶
- Returns
Returns the total number of files.
- Return type
int
See also
GetFile()
andGetFileName()
.
- 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()
andGetFileCount()
.
- GetFirstHeader() → Pro.Core.CFFStruct¶
Retrieves the first header structure.
- Returns
Returns a
Pro.Core.CFFStruct
representing the first header.- Return type
See also
GetHeader()
andGetHeaderData()
.
- GetHeader() → Pro.Core.CFFStruct¶
Retrieves the header structure.
- Returns
Returns a
Pro.Core.CFFStruct
representing the header.- Return type
See also
GetHeaderData()
.
- GetHeaderData() → Pro.Core.NTContainer¶
Retrieves the raw header data.
- Returns
Returns a
Pro.Core.NTContainer
with the header bytes.- Return type
See also
GetHeader()
andGetFirstHeader()
.
- GetInstructions() → Pro.Core.CFFStruct¶
- Returns
Returns a
Pro.Core.CFFStruct
representing the instruction structures.- Return type
See also
GetOpcodeInfo()
andDisassemble()
.
- GetLanguageTableString(table: Union[Pro.Core.CFFStruct, int], index: int) → str¶
Retrieves a string from a specific language table by index.
- Parameters
table (Union[CFFStruct, int]) – Either a
Pro.Core.CFFStruct
returned byGetLanguageTables()
, or the zero-based table index.index (int) – Zero-based string index within the selected language table.
- Returns
Returns the string for the given table and index.
- Return type
str
See also
GetLanguageTables()
andGetLanguageTableStringCount()
.
- 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()
andGetLanguageTableString()
.
- 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 returnsNone
.- 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
See also
GetPageWindowProcName()
.
- GetSections() → Pro.Core.CFFStruct¶
- Returns
Returns a
Pro.Core.CFFStruct
representing the section structures.- Return type
- 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 returnsNone
.- Return type
Optional[Tuple[int]]
See also
Parse()
.
- HasLanguageTables() → bool¶
- Returns
Returns
True
if one or more language tables are present; otherwiseFalse
.- Return type
bool
See also
GetLanguageTables()
andGetLanguageTableString()
.
- IsUnicode() → bool¶
- Returns
Returns
True
if the installer is Unicode; otherwise returnsFalse
.- 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 returnsFalse
.- Return type
bool
See also
GetVersion()
,IsUnicode()
,GetHeader()
andGetInstructions()
.
- 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:
A sequence containing the preferred names for the opcode arguments.
A sequence describing the argument types for the opcode.
The numeric opcode value.
The textual mnemonic of the opcode (e.g.,
"Call"
).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.