NSIS/Contrib/System/Source/Plugin.h
anders_k e63fa6c53b Win64 fixes
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6413 212acab6-be3b-0410-9dea-997c60f758d6
2013-09-06 23:48:59 +00:00

55 lines
1.8 KiB
C

#ifndef ___PLUGIN__H___
#define ___PLUGIN__H___
#include <nsis/pluginapi.h> // nsis plugin
// Always use system* functions to keep the size down
#define pushstring error(use system_pushstring)
#undef pushint
#define pushint error(use system_pushint)
#define pushintptr error(use system_pushintptr)
#undef myatoi
#define myatoi(str) ( (int) myatoi64(str) )
#define system_pushint(v) system_pushintptr((INT_PTR)(v))
#define popintptr system_popintptr
#ifdef _WIN64
# define StrToIntPtr(str) ( (INT_PTR)myatoi64((str)) )
#else
# define StrToIntPtr(str) ( (INT_PTR)myatoi((str)) )
#endif
#define BUGBUG64(brokencast) (brokencast) // Cast that needs fixing on x64
#define PLUGINFUNCTION(name) \
void __declspec(dllexport) name( \
HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) { \
/*g_hwndParent=hwndParent;*/ \
EXDLL_INIT(); \
extra->RegisterPluginCallback(g_hInstance, NSISCallback);
#define PLUGINFUNCTIONEND }
#define PLUGINFUNCTIONSHORT(name) void __declspec(dllexport) name(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop) { \
g_stringsize=string_size; \
g_stacktop=stacktop;
extern TCHAR *AllocStr(TCHAR *str);
extern void myitoa64(__int64 i, TCHAR *buffer);
extern TCHAR *AllocString();
extern TCHAR *system_getuservariable(int varnum);
extern TCHAR *system_setuservariable(int varnum, TCHAR *var);
extern TCHAR* system_popstring(); // NULL - stack empty
extern TCHAR* system_pushstring(TCHAR *str);
extern __int64 myatoi64(TCHAR *s);
extern INT_PTR system_popintptr(); // -1 -> stack empty
extern void system_pushintptr(INT_PTR value);
extern HANDLE GlobalCopy(HANDLE Old);
extern void *copymem(void *output, void *input, size_t cbSize);
extern UINT_PTR NSISCallback(enum NSPIM);
extern HWND g_hwndParent;
extern HINSTANCE g_hInstance;
#endif