api.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * apih
  3. *
  4. * This file is a part of NSIS.
  5. *
  6. * Copyright (C) 1999-2021 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 structure containing other interesting stuff
  34. // besides the stack, variables and HWND passed on to plug-ins.
  35. typedef struct
  36. {
  37. int autoclose; // SetAutoClose
  38. int all_user_var; // SetShellVarContext: User context = 0, Machine context = 1
  39. int exec_error; // IfErrors/ClearErrors/SetErrors
  40. int abort; // IfAbort
  41. int exec_reboot; // IfRebootFlag/SetRebootFlag (NSIS_SUPPORT_REBOOT)
  42. int reboot_called; // NSIS_SUPPORT_REBOOT
  43. int XXX_cur_insttype; // Deprecated
  44. int plugin_api_version; // Plug-in ABI. See NSISPIAPIVER_CURR (Note: used to be XXX_insttype_changed)
  45. int silent; // IfSilent/SetSilent (NSIS_CONFIG_SILENT_SUPPORT)
  46. int instdir_error; // GetInstDirError
  47. int rtl; // IfRtlLanguage: 1 if $LANGUAGE is a RTL language
  48. int errlvl; // SetErrorLevel
  49. int alter_reg_view; // SetRegView: Default View = 0, Alternative View = (sizeof(void*) > 4 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY)
  50. int status_update; // SetDetailsPrint
  51. } exec_flags_t;
  52. #ifndef NSISCALL
  53. # define NSISCALL __stdcall
  54. #endif
  55. #if !defined(_WIN32) && !defined(LPTSTR)
  56. # define LPTSTR TCHAR*
  57. #endif
  58. typedef struct {
  59. exec_flags_t *exec_flags;
  60. int (NSISCALL *ExecuteCodeSegment)(int, HWND);
  61. void (NSISCALL *validate_filename)(LPTSTR);
  62. int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
  63. } extra_parameters;
  64. // Definitions for page showing plug-ins
  65. // See Ui.c to understand better how they're used
  66. // sent to the outer window to tell it to go to the next inner window
  67. #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
  68. // custom pages should send this message to let NSIS know they're ready
  69. #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
  70. // sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
  71. #define NOTIFY_BYE_BYE 'x'
  72. #endif /* _NSIS_EXEHEAD_API_H_ */