| 1 |
/* |
| 2 |
* apih |
| 3 |
* |
| 4 |
* This file is a part of NSIS. |
| 5 |
* |
| 6 |
* Copyright (C) 1999-2026 Nullsoft and Contributors |
| 7 |
* |
| 8 |
* Licensed under the zlib/libpng license (the "License"); |
| 9 |
* you may not use this file except in compliance with the License. |
| 10 |
* |
| 11 |
* Licence details can be found in the file COPYING. |
| 12 |
* |
| 13 |
* This software is provided 'as-is', without any express or implied |
| 14 |
* warranty. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef _NSIS_EXEHEAD_API_H_ |
| 18 |
#define _NSIS_EXEHEAD_API_H_ |
| 19 |
|
| 20 |
// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version |
| 21 |
// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x)) |
| 22 |
// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {} |
| 23 |
|
| 24 |
#define NSISPIAPIVER_1_0 0x00010000 |
| 25 |
#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0 |
| 26 |
|
| 27 |
// NSIS Plug-In Callback Messages |
| 28 |
enum NSPIM |
| 29 |
{ |
| 30 |
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup |
| 31 |
NSPIM_GUIUNLOAD, // Called after .onGUIEnd |
| 32 |
}; |
| 33 |
|
| 34 |
// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback() |
| 35 |
// Return NULL for unknown messages |
| 36 |
// Should always be __cdecl for future expansion possibilities |
| 37 |
typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM); |
| 38 |
|
| 39 |
// extra_parameters data structure containing other interesting stuff |
| 40 |
// besides the stack, variables and HWND passed on to plug-ins. |
| 41 |
typedef struct |
| 42 |
{ |
| 43 |
int autoclose; // SetAutoClose |
| 44 |
int all_user_var; // SetShellVarContext: User context = 0, Machine context = 1 |
| 45 |
int exec_error; // IfErrors/ClearErrors/SetErrors |
| 46 |
int abort; // IfAbort |
| 47 |
int exec_reboot; // IfRebootFlag/SetRebootFlag (NSIS_SUPPORT_REBOOT) |
| 48 |
int reboot_called; // NSIS_SUPPORT_REBOOT |
| 49 |
int XXX_cur_insttype; // Deprecated |
| 50 |
int plugin_api_version; // Plug-in ABI. See NSISPIAPIVER_CURR (Note: used to be XXX_insttype_changed) |
| 51 |
int silent; // IfSilent/SetSilent (NSIS_CONFIG_SILENT_SUPPORT) |
| 52 |
int instdir_error; // GetInstDirError |
| 53 |
int rtl; // IfRtlLanguage: 1 if $LANGUAGE is a RTL language |
| 54 |
int errlvl; // SetErrorLevel |
| 55 |
int alter_reg_view; // SetRegView: Default View = 0, Alternative View = (sizeof(void*) > 4 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY) |
| 56 |
int status_update; // SetDetailsPrint |
| 57 |
} exec_flags_t; |
| 58 |
|
| 59 |
#ifndef NSISCALL |
| 60 |
# define NSISCALL __stdcall |
| 61 |
#endif |
| 62 |
#if !defined(_WIN32) && !defined(LPTSTR) |
| 63 |
# define LPTSTR TCHAR* |
| 64 |
#endif |
| 65 |
|
| 66 |
typedef struct { |
| 67 |
exec_flags_t *exec_flags; |
| 68 |
int (NSISCALL *ExecuteCodeSegment)(int, HWND); |
| 69 |
void (NSISCALL *validate_filename)(LPTSTR); |
| 70 |
int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors |
| 71 |
} extra_parameters; |
| 72 |
|
| 73 |
// Definitions for page showing plug-ins |
| 74 |
// See Ui.c to understand better how they're used |
| 75 |
|
| 76 |
// sent to the outer window to tell it to go to the next inner window |
| 77 |
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) |
| 78 |
|
| 79 |
// custom pages should send this message to let NSIS know they're ready |
| 80 |
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) |
| 81 |
|
| 82 |
// sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning |
| 83 |
#define NOTIFY_BYE_BYE 'x' |
| 84 |
|
| 85 |
#endif /* _NSIS_EXEHEAD_API_H_ */ |