other-licenses/nsis/Contrib/ExDLL/exdllutil.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/other-licenses/nsis/Contrib/ExDLL/exdllutil.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,119 @@
     1.4 +// Unicode support by Jim Park -- 08/23/2007
     1.5 +// Jim Park: Should probably turn this into a nice class for C++ programs.
     1.6 +
     1.7 +#pragma once
     1.8 +#include <windows.h>
     1.9 +#include <tchar.h>
    1.10 +// only include this file from one place in your DLL.
    1.11 +// (it is all static, if you use it in two places it will fail)
    1.12 +
    1.13 +#define EXDLL_INIT()           {  \
    1.14 +        g_stringsize=string_size; \
    1.15 +        g_stacktop=stacktop;      \
    1.16 +        g_variables=variables; }
    1.17 +
    1.18 +// For page showing plug-ins
    1.19 +#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
    1.20 +#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
    1.21 +
    1.22 +/* Jim Park: This char is compared as an int value and therefore
    1.23 +   it's fine as an ASCII.  Do not need to change to wchar_t since
    1.24 +   it will get the same integer value. */
    1.25 +#define NOTIFY_BYE_BYE _T('x')
    1.26 +
    1.27 +typedef struct _stack_t {
    1.28 +  struct _stack_t *next;
    1.29 +  TCHAR text[1]; // this should be the length of string_size
    1.30 +} stack_t;
    1.31 +
    1.32 +static unsigned int g_stringsize;
    1.33 +static stack_t **g_stacktop;
    1.34 +static TCHAR *g_variables;
    1.35 +
    1.36 +
    1.37 +enum
    1.38 +{
    1.39 +INST_0,         // $0
    1.40 +INST_1,         // $1
    1.41 +INST_2,         // $2
    1.42 +INST_3,         // $3
    1.43 +INST_4,         // $4
    1.44 +INST_5,         // $5
    1.45 +INST_6,         // $6
    1.46 +INST_7,         // $7
    1.47 +INST_8,         // $8
    1.48 +INST_9,         // $9
    1.49 +INST_R0,        // $R0
    1.50 +INST_R1,        // $R1
    1.51 +INST_R2,        // $R2
    1.52 +INST_R3,        // $R3
    1.53 +INST_R4,        // $R4
    1.54 +INST_R5,        // $R5
    1.55 +INST_R6,        // $R6
    1.56 +INST_R7,        // $R7
    1.57 +INST_R8,        // $R8
    1.58 +INST_R9,        // $R9
    1.59 +INST_CMDLINE,   // $CMDLINE
    1.60 +INST_INSTDIR,   // $INSTDIR
    1.61 +INST_OUTDIR,    // $OUTDIR
    1.62 +INST_EXEDIR,    // $EXEDIR
    1.63 +INST_LANG,      // $LANGUAGE
    1.64 +__INST_LAST
    1.65 +};
    1.66 +
    1.67 +typedef struct {
    1.68 +  int autoclose;
    1.69 +  int all_user_var;
    1.70 +  int exec_error;
    1.71 +  int abort;
    1.72 +  int exec_reboot;
    1.73 +  int reboot_called;
    1.74 +  int XXX_cur_insttype; // deprecated
    1.75 +  int XXX_insttype_changed; // deprecated
    1.76 +  int silent;
    1.77 +  int instdir_error;
    1.78 +  int rtl;
    1.79 +  int errlvl;
    1.80 +  int alter_reg_view;
    1.81 +} exec_flags_type;
    1.82 +
    1.83 +typedef struct {
    1.84 +  exec_flags_type *exec_flags;
    1.85 +  int (__stdcall *ExecuteCodeSegment)(int, HWND);
    1.86 +  void (__stdcall *validate_filename)(TCHAR *);
    1.87 +} extra_parameters;
    1.88 +
    1.89 +static int    __stdcall popstring(TCHAR *str); // 0 on success, 1 on empty stack
    1.90 +static void   __stdcall pushstring(const TCHAR *str);
    1.91 +static char * __stdcall getuservariable(const int varnum);
    1.92 +static void   __stdcall setuservariable(const int varnum, const TCHAR *var);
    1.93 +
    1.94 +#ifdef _UNICODE
    1.95 +#define PopStringW(x) popstring(x)
    1.96 +#define PushStringW(x) pushstring(x)
    1.97 +#define SetUserVariableW(x,y) setuservariable(x,y)
    1.98 +
    1.99 +static int  __stdcall PopStringA(char* ansiStr);
   1.100 +static void __stdcall PushStringA(const char* ansiStr);
   1.101 +static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr);
   1.102 +static void __stdcall GetUserVariableA(const int varnum, char* ansiStr);
   1.103 +static void __stdcall SetUserVariableA(const int varnum, const char* ansiStr);
   1.104 +
   1.105 +#else
   1.106 +// ANSI defs
   1.107 +
   1.108 +#define PopStringA(x) popstring(x)
   1.109 +#define PushStringA(x) pushstring(x)
   1.110 +#define SetUserVariableA(x,y) setuservariable(x,y)
   1.111 +
   1.112 +static int  __stdcall PopStringW(wchar_t* wideStr);
   1.113 +static void __stdcall PushStringW(wchar_t* wideStr);
   1.114 +static void __stdcall GetUserVariableW(const int varnum, wchar_t* wideStr);
   1.115 +static void __stdcall GetUserVariableA(const int varnum, char* ansiStr);
   1.116 +static void __stdcall SetUserVariableW(const int varnum, const wchar_t* wideStr);
   1.117 +
   1.118 +#endif
   1.119 +
   1.120 +static BOOL __stdcall IsUnicode(void)
   1.121 +static TCHAR* __stdcall AllocString();
   1.122 +

mercurial