tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

exdll.h (2298B)


      1 // This Source Code Form is subject to the terms of the Mozilla Public
      2 // License, v. 2.0.If a copy of the MPL was not distributed with this
      3 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 #ifndef _EXDLL_H_
      6 #define _EXDLL_H_
      7 
      8 #include <windows.h>
      9 #include <tchar.h>
     10 
     11 #define PLUGINFUNCTION(name)                                   \
     12  extern "C" void __declspec(dllexport)                        \
     13      name(HWND hWndParent, int string_size, TCHAR* variables, \
     14           stack_t** stacktop, extra_parameters* extra)
     15 
     16 #define EXDLL_INIT()                                  \
     17  {                                                   \
     18    g_stringsize = string_size;                       \
     19    g_stacktop = stacktop;                            \
     20    g_executeCodeSegment = extra->ExecuteCodeSegment; \
     21    g_hwndParent = hWndParent;                        \
     22  }
     23 
     24 #define WM_NOTIFY_OUTER_NEXT (WM_USER + 0x8)
     25 #define WM_NOTIFY_CUSTOM_READY (WM_USER + 0xd)
     26 
     27 typedef struct _stack_t {
     28  struct _stack_t* next;
     29  TCHAR text[1];  // the real length of this buffer should be string_size
     30 } stack_t;
     31 
     32 extern unsigned int g_stringsize;
     33 extern stack_t** g_stacktop;
     34 extern int(__stdcall* g_executeCodeSegment)(int pos, HWND hwndProgress);
     35 extern HWND g_hwndParent;
     36 extern HINSTANCE gHInst;
     37 
     38 typedef struct {
     39  int autoclose;
     40  int all_user_var;
     41  int exec_error;
     42  int abort;
     43  int exec_reboot;
     44  int reboot_called;
     45  int XXX_cur_insttype;      // deprecated
     46  int XXX_insttype_changed;  // deprecated
     47  int silent;
     48  int instdir_error;
     49  int rtl;
     50  int errlvl;
     51 } exec_flags;
     52 
     53 // NSIS Plug-In Callback Messages
     54 enum NSPIM {
     55  NSPIM_UNLOAD,     // This is the last message a plugin gets, do final cleanup
     56  NSPIM_GUIUNLOAD,  // Called after .onGUIEnd
     57 };
     58 
     59 typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
     60 
     61 typedef struct {
     62  exec_flags* exec_flags;
     63  int(__stdcall* ExecuteCodeSegment)(int pos, HWND hwndProgress);
     64  void(__stdcall* validate_filename)(LPWSTR);
     65  int(__stdcall* RegisterPluginCallback)(
     66      HMODULE,
     67      NSISPLUGINCALLBACK);  // returns 0 on success, 1 if already
     68                            // registered and < 0 on errors
     69 } extra_parameters;
     70 
     71 int popstring(TCHAR* str);
     72 void pushstring(const TCHAR* str);
     73 
     74 UINT_PTR __cdecl NSISPluginCallback(NSPIM msg);
     75 
     76 #endif  //_EXDLL_H_