pub struct Nsis {
pub stack: Stack,
pub vars: Variables,
pub hwnd: Hwnd,
/* private fields */
}Expand description
Everything a plug-in export receives, in one place.
Constructed for you by nsis_fn!; the equivalent of EXDLL_INIT().
Fields§
§stack: StackThe installer’s argument stack.
vars: VariablesThe installer’s 25 user variables.
hwnd: HwndThe installer’s parent window.
Implementations§
Source§impl Nsis
impl Nsis
Sourcepub unsafe fn from_raw(
hwnd: Hwnd,
string_size: c_int,
variables: *mut Tchar,
stacktop: *mut *mut StackNode,
extra: *mut ExtraParameters,
) -> Self
pub unsafe fn from_raw( hwnd: Hwnd, string_size: c_int, variables: *mut Tchar, stacktop: *mut *mut StackNode, extra: *mut ExtraParameters, ) -> Self
Builds an Nsis from the five arguments of a plug-in export.
§Safety
All five arguments must be exactly what the installer passed, and the result must not outlive the call.
Sourcepub fn string_size(&self) -> usize
pub fn string_size(&self) -> usize
The calling installer’s NSIS_MAX_STRLEN, in characters.
This is a runtime value. Never assume 1024.
Sourcepub fn extra(&self) -> Option<&ExtraParameters>
pub fn extra(&self) -> Option<&ExtraParameters>
The raw extra_parameters block, if the installer supplied one.
Sourcepub fn exec_flags(&self) -> Option<&ExecFlags>
pub fn exec_flags(&self) -> Option<&ExecFlags>
The installer’s live ExecFlags, if available.
Sourcepub fn exec_flags_mut(&mut self) -> Option<&mut ExecFlags>
pub fn exec_flags_mut(&mut self) -> Option<&mut ExecFlags>
The installer’s live ExecFlags, mutably.
Sourcepub fn plugin_api_version(&self) -> c_int
pub fn plugin_api_version(&self) -> c_int
exec_flags->plugin_api_version.
Only meaningful from NSIS 2.42 onward; older installers leave unrelated
data in this field. Compare with >=, never ==.
Sourcepub fn require_api_version(&self, required: c_int) -> Result<()>
pub fn require_api_version(&self, required: c_int) -> Result<()>
Fails unless the installer reports at least required.
Sourcepub unsafe fn execute_code_segment(&mut self, position: c_int) -> Result<c_int>
pub unsafe fn execute_code_segment(&mut self, position: c_int) -> Result<c_int>
Runs a code segment in the installer.
An honest passthrough of ExecuteCodeSegment, with the same contract:
position is zero-based, so a function address obtained from
GetFunctionAddress needs - 1.
§Safety
The installer will run arbitrary script code, which can re-enter this plug-in. Nothing here makes that safe.
Sourcepub fn validate_filename(&mut self, name: &str) -> Result<String>
pub fn validate_filename(&mut self, name: &str) -> Result<String>
Replaces characters that are invalid in a filename, via the installer’s
own validate_filename.
Sourcepub fn register_callback(&mut self, callback: NsisPluginCallback) -> Result<()>
pub fn register_callback(&mut self, callback: NsisPluginCallback) -> Result<()>
Registers an unload callback, as built by nsis_unload!.
/NOUNLOAD and SetPluginsUnload were deprecated in NSIS 3 and
plug-ins now stay loaded for the life of the installer, so this is where
cleanup belongs. Registering the same callback twice is not an error.
Source§impl Nsis
impl Nsis
Sourcepub fn error(&self) -> bool
pub fn error(&self) -> bool
The error flag IfErrors reads. Set automatically when a
nsis_fn! body returns Err.
Sourcepub fn set_error(&mut self, value: bool)
pub fn set_error(&mut self, value: bool)
The error flag IfErrors reads. Set automatically when a
nsis_fn! body returns Err.
Sourcepub fn set_silent(&mut self, value: bool)
pub fn set_silent(&mut self, value: bool)
IfSilent / SetSilent.
Sourcepub fn reboot_flag(&self) -> bool
pub fn reboot_flag(&self) -> bool
IfRebootFlag / SetRebootFlag.
Sourcepub fn set_reboot_flag(&mut self, value: bool)
pub fn set_reboot_flag(&mut self, value: bool)
IfRebootFlag / SetRebootFlag.
Sourcepub fn set_autoclose(&mut self, value: bool)
pub fn set_autoclose(&mut self, value: bool)
SetAutoClose.
Sourcepub fn all_users(&self) -> bool
pub fn all_users(&self) -> bool
SetShellVarContext: false is user context, true is machine context.
Sourcepub fn set_all_users(&mut self, value: bool)
pub fn set_all_users(&mut self, value: bool)
SetShellVarContext: false is user context, true is machine context.
Source§impl Nsis
impl Nsis
Sourcepub fn set_errlvl(&mut self, value: c_int)
pub fn set_errlvl(&mut self, value: c_int)
SetErrorLevel.
Sourcepub fn alter_reg_view(&self) -> c_int
pub fn alter_reg_view(&self) -> c_int
SetRegView: 0 is the default view.
Sourcepub fn set_alter_reg_view(&mut self, value: c_int)
pub fn set_alter_reg_view(&mut self, value: c_int)
SetRegView: 0 is the default view.
Sourcepub fn status_update(&self) -> c_int
pub fn status_update(&self) -> c_int
SetDetailsPrint.
Sourcepub fn set_status_update(&mut self, value: c_int)
pub fn set_status_update(&mut self, value: c_int)
SetDetailsPrint.
Sourcepub fn instdir_error(&self) -> c_int
pub fn instdir_error(&self) -> c_int
GetInstDirError.
Sourcepub fn set_instdir_error(&mut self, value: c_int)
pub fn set_instdir_error(&mut self, value: c_int)
GetInstDirError.