1 //
2 // Copyright (C) Anders Kjersem. Licensed under the zlib/libpng license
3 //
4 
5 #ifdef UNICODE
6 # ifndef _UNICODE
7 #    define _UNICODE
8 #  endif
9 #endif
10 
11 #define _WIN32_WINNT 0x0400
12 #include <windows.h>
13 #include <tchar.h>
14 #include <wininet.h>
15 
16 #if defined(_DEBUG) || 0
17 #  define PLUGIN_DEBUG 1
MYTRACE(LPCTSTR fmt,...)18 void MYTRACE(LPCTSTR fmt, ...)
19 {
20   va_list argptr;
21   va_start(argptr, fmt);
22   TCHAR buffer[2048] = { _T('\0') };
23   wvsprintf(buffer, fmt, argptr);
24   buffer[(sizeof(buffer)/sizeof(*buffer)) - 1] = _T('\0');
25   OutputDebugString(buffer);
26   va_end(argptr);
27 }
28 #else
MYTRACE(...)29 void MYTRACE(...) { }
30 #endif
31 #  define TRACE MYTRACE
32 
33 #ifndef ASSERT
34 #  define ASSERT(x)
35 #endif
36 
37 #define NSISPIEXPORTFUNC EXTERN_C void __declspec(dllexport) __cdecl
38 
39 namespace NSIS {
40 
41 #define NSISCALL __stdcall
42 typedef struct _xparams_t {
43   LPVOID xx1;//exec_flags_type *exec_flags;
44   int (NSISCALL *ExecuteCodeSegment)(int, HWND);
45   void (NSISCALL *validate_filename)(TCHAR*);
46   int (NSISCALL *RegisterPluginCallback)(HMODULE,LPVOID);
47 } xparams_t;
48 typedef struct _stack_t {
49   struct _stack_t *next;
50   TCHAR text[1];
51 } stack_t;
52 
53 } // namespace NSIS
54 
55 enum NSPIM
56 {
57   NSPIM_UNLOAD,
58   NSPIM_GUIUNLOAD,
59 };
60