api.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * apih
  3. *
  4. * This file is a part of NSIS.
  5. *
  6. * Copyright (C) 1999-2017 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. #ifndef _NSIS_EXEHEAD_API_H_
  17. #define _NSIS_EXEHEAD_API_H_
  18. // Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
  19. // The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
  20. // When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
  21. #define NSISPIAPIVER_1_0 0x00010000
  22. #define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
  23. // NSIS Plug-In Callback Messages
  24. enum NSPIM
  25. {
  26. NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
  27. NSPIM_GUIUNLOAD, // Called after .onGUIEnd
  28. };
  29. // Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
  30. // Return NULL for unknown messages
  31. // Should always be __cdecl for future expansion possibilities
  32. typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
  33. // extra_parameters data structures containing other interesting stuff
  34. // but the stack, variables and HWND passed on to plug-ins.
  35. typedef struct
  36. {
  37. int autoclose;
  38. int all_user_var;
  39. int exec_error;
  40. int abort;
  41. int exec_reboot; // NSIS_SUPPORT_REBOOT
  42. int reboot_called; // NSIS_SUPPORT_REBOOT
  43. int XXX_cur_insttype; // Deprecated
  44. int plugin_api_version; // see NSISPIAPIVER_CURR
  45. // used to be XXX_insttype_changed
  46. int silent; // NSIS_CONFIG_SILENT_SUPPORT
  47. int instdir_error;
  48. int rtl;
  49. int errlvl;
  50. int alter_reg_view;
  51. int status_update;
  52. } exec_flags_t;
  53. #ifndef NSISCALL
  54. # define NSISCALL __stdcall
  55. #endif
  56. #if !defined(_WIN32) && !defined(LPTSTR)
  57. # define LPTSTR TCHAR*
  58. #endif
  59. typedef struct {
  60. exec_flags_t *exec_flags;
  61. int (NSISCALL *ExecuteCodeSegment)(int, HWND);
  62. void (NSISCALL *validate_filename)(LPTSTR);
  63. int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
  64. } extra_parameters;
  65. // Definitions for page showing plug-ins
  66. // See Ui.c to understand better how they're used
  67. // sent to the outer window to tell it to go to the next inner window
  68. #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
  69. // custom pages should send this message to let NSIS know they're ready
  70. #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
  71. // sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
  72. #define NOTIFY_BYE_BYE 'x'
  73. #endif /* _PLUGIN_H_ */