1 /*
2  * apih
3  *
4  * This file is a part of NSIS.
5  *
6  * Copyright (C) 1999-2008 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 structures containing other interesting stuff
40 // but the stack, variables and HWND passed on to plug-ins.
41 typedef struct
42 {
43   int autoclose;
44   int all_user_var;
45   int exec_error;
46   int abort;
47   int exec_reboot; // NSIS_SUPPORT_REBOOT
48   int reboot_called; // NSIS_SUPPORT_REBOOT
49   int XXX_cur_insttype; // depreacted
50   int plugin_api_version; // see NSISPIAPIVER_CURR
51                           // used to be XXX_insttype_changed
52   int silent; // NSIS_CONFIG_SILENT_SUPPORT
53   int instdir_error;
54   int rtl;
55   int errlvl;
56   int alter_reg_view;
57   int status_update;
58 } exec_flags_t;
59 
60 #ifndef NSISCALL
61 #  define NSISCALL __stdcall
62 #endif
63 
64 typedef struct {
65   exec_flags_t *exec_flags;
66   int (NSISCALL *ExecuteCodeSegment)(int, HWND);
67   void (NSISCALL *validate_filename)(TCHAR *);
68   BOOL (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK);
69 } extra_parameters;
70 
71 // Definitions for page showing plug-ins
72 // See Ui.c to understand better how they're used
73 
74 // sent to the outer window to tell it to go to the next inner window
75 #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
76 
77 // custom pages should send this message to let NSIS know they're ready
78 #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
79 
80 // sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
81 #define NOTIFY_BYE_BYE 'x'
82 
83 #endif /* _PLUGIN_H_ */
84