1 /* exdll.h for use with gpg4win
2 * Copyright (C) 1999-2005 Nullsoft, Inc.
4 * This license applies to everything in the NSIS package, except
5 * where otherwise noted.
7 * This software is provided 'as-is', without any express or implied
8 * warranty. In no event will the authors be held liable for any
9 * damages arising from the use of this software.
11 * Permission is granted to anyone to use this software for any
12 * purpose, including commercial applications, and to alter it and
13 * redistribute it freely, subject to the following restrictions:
15 * 1. The origin of this software must not be misrepresented; you must
16 * not claim that you wrote the original software. If you use this
17 * software in a product, an acknowledgment in the product
18 * documentation would be appreciated but is not required.
20 * 2. Altered source versions must be plainly marked as such, and must
21 * not be misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source
25 ************************************************************
26 * 2005-11-14 wk Applied license text to orginal exdll.h file from
27 * NSIS 2.0.4 and did some formatting changes.
33 /* only include this file from one place in your DLL. (it is all
34 static, if you use it in two places it will fail) */
36 #define EXDLL_INIT() { \
37 g_stringsize=string_size; \
38 g_stacktop=stacktop; \
39 g_variables=variables; }
41 /* For page showing plug-ins */
42 #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
43 #define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
44 #define NOTIFY_BYE_BYE 'x'
46 typedef struct _stack_t {
47 struct _stack_t *next;
48 char text[1]; /* This should be the length of string_size. */
52 static unsigned int g_stringsize;
53 static stack_t **g_stacktop;
54 static char *g_variables;
56 static int __stdcall popstring(char *str, size_t maxlen); /* 0 on success, 1 on empty stack */
57 static void __stdcall pushstring(const char *str);
81 INST_CMDLINE, // $CMDLINE
82 INST_INSTDIR, // $INSTDIR
83 INST_OUTDIR, // $OUTDIR
84 INST_EXEDIR, // $EXEDIR
85 INST_LANG, // $LANGUAGE
96 int XXX_cur_insttype; /* deprecated */
97 int XXX_insttype_changed; /* deprecated */
105 exec_flags_t *exec_flags;
106 int (__stdcall *ExecuteCodeSegment)(int, HWND);
107 } extra_parameters_t;
110 /* Utility functions (not required but often useful). */
112 popstring(char *str, size_t maxlen)
115 if (!g_stacktop || !*g_stacktop)
118 lstrcpyn (str, th->text, maxlen);
119 *g_stacktop = th->next;
120 GlobalFree((HGLOBAL)th);
124 static void __stdcall
125 pushstring(const char *str)
128 if (!g_stacktop) return;
129 th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize);
130 lstrcpyn(th->text,str,g_stringsize);
131 th->next=*g_stacktop;
135 static char * __stdcall
136 getuservariable(const int varnum)
138 if (varnum < 0 || varnum >= __INST_LAST) return NULL;
139 return g_variables+varnum*g_stringsize;
142 static void __stdcall
143 setuservariable(const int varnum, const char *var)
145 if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
146 lstrcpy(g_variables + varnum*g_stringsize, var);