diff --git a/Contrib/nsDialogs/SConscript b/Contrib/nsDialogs/SConscript index 2e81762e..5e9271bb 100644 --- a/Contrib/nsDialogs/SConscript +++ b/Contrib/nsDialogs/SConscript @@ -5,7 +5,6 @@ files = Split(""" input.c nsDialogs.c nsDialogs.def - nsis.c rtl.c """) diff --git a/Contrib/nsDialogs/browse.c b/Contrib/nsDialogs/browse.c index 118a7756..1fc85cc8 100644 --- a/Contrib/nsDialogs/browse.c +++ b/Contrib/nsDialogs/browse.c @@ -1,8 +1,9 @@ #include #include +#include // nsis plugin.h + #include "defs.h" -#include "nsis.h" int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) { if (uMsg == BFFM_INITIALIZED) @@ -22,13 +23,13 @@ void __declspec(dllexport) SelectFolderDialog(HWND hwndParent, int string_size, EXDLL_INIT(); - if (popstring(title, sizeof(initial))) + if (popstringn(title, sizeof(initial))) { pushstring("error"); return; } - if (popstring(initial, sizeof(title))) + if (popstringn(initial, sizeof(title))) { pushstring("error"); return; @@ -100,9 +101,9 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, ch //ofn.Flags = pField->nFlags & (OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_CREATEPROMPT | OFN_EXPLORER); ofn.Flags = OFN_CREATEPROMPT | OFN_EXPLORER; - popstring(type, sizeof(type)); - popstring(path, sizeof(path)); - popstring(filter, sizeof(filter)); + popstringn(type, sizeof(type)); + popstringn(path, sizeof(path)); + popstringn(filter, sizeof(filter)); save = !lstrcmpi(type, "save"); diff --git a/Contrib/nsDialogs/input.c b/Contrib/nsDialogs/input.c index 7dd85e95..35e42ac6 100644 --- a/Contrib/nsDialogs/input.c +++ b/Contrib/nsDialogs/input.c @@ -1,8 +1,9 @@ #include +#include // nsis plugin.h + #include "input.h" #include "defs.h" -#include "nsis.h" #include "rtl.h" extern struct nsDialog g_dialog; @@ -55,22 +56,22 @@ int NSDFUNC PopPlacement(int *x, int *y, int *width, int *height) dialogWidth = dialogRect.right; dialogHeight = dialogRect.bottom; - if (popstring(buf, 1024)) + if (popstringn(buf, 1024)) return 1; *x = ConvertPlacement(buf, dialogWidth, 0); - if (popstring(buf, 1024)) + if (popstringn(buf, 1024)) return 1; *y = ConvertPlacement(buf, dialogHeight, 1); - if (popstring(buf, 1024)) + if (popstringn(buf, 1024)) return 1; *width = ConvertPlacement(buf, dialogWidth, 0); - if (popstring(buf, 1024)) + if (popstringn(buf, 1024)) return 1; *height = ConvertPlacement(buf, dialogHeight, 1); diff --git a/Contrib/nsDialogs/nsDialogs.c b/Contrib/nsDialogs/nsDialogs.c index a166a4e0..44fc8ac2 100644 --- a/Contrib/nsDialogs/nsDialogs.c +++ b/Contrib/nsDialogs/nsDialogs.c @@ -1,7 +1,8 @@ #include +#include // nsis plugin.h + #include "defs.h" -#include "nsis.h" #include "input.h" #include "rtl.h" @@ -299,19 +300,19 @@ void __declspec(dllexport) CreateControl(HWND hwndParent, int string_size, char return; } - if (popstring(className, 0)) + if (popstringn(className, 0)) { pushstring("error"); HeapFree(GetProcessHeap(), 0, className); return; } - style = (DWORD) popint(); - exStyle = (DWORD) popint(); + style = (DWORD) popint_or(); + exStyle = (DWORD) popint_or(); PopPlacement(&x, &y, &width, &height); - if (popstring(text, 0)) + if (popstringn(text, 0)) { pushstring("error"); HeapFree(GetProcessHeap(), 0, className); @@ -418,7 +419,7 @@ void __declspec(dllexport) SetUserData(HWND hwndParent, int string_size, char *v // set user data - popstring(ctl->userData, USERDATA_SIZE); + popstringn(ctl->userData, USERDATA_SIZE); } void __declspec(dllexport) GetUserData(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra) diff --git a/Contrib/nsDialogs/nsis.c b/Contrib/nsDialogs/nsis.c deleted file mode 100644 index fdda41a3..00000000 --- a/Contrib/nsDialogs/nsis.c +++ /dev/null @@ -1,95 +0,0 @@ -#include - -#include "nsis.h" - -int g_stringsize; -stack_t **g_stacktop; -char *g_variables; - -int NSDFUNC myatoi(const char *s) -{ - int v=0; - if (*s == '0' && (s[1] == 'x' || s[1] == 'X')) - { - s++; - for (;;) - { - int c=*(++s); - if (c >= '0' && c <= '9') c-='0'; - else if (c >= 'a' && c <= 'f') c-='a'-10; - else if (c >= 'A' && c <= 'F') c-='A'-10; - else break; - v<<=4; - v+=c; - } - } - else if (*s == '0' && s[1] <= '7' && s[1] >= '0') - { - for (;;) - { - int c=*(++s); - if (c >= '0' && c <= '7') c-='0'; - else break; - v<<=3; - v+=c; - } - } - else - { - int sign=0; - if (*s == '-') sign++; else s--; - for (;;) - { - int c=*(++s) - '0'; - if (c < 0 || c > 9) break; - v*=10; - v+=c; - } - if (sign) v = -v; - } - - // Support for simple ORed expressions - if (*s == '|') - { - v |= myatoi(s+1); - } - - return v; -} - -int NSDFUNC popstring(char *str, int size) -{ - stack_t *th; - if (!g_stacktop || !*g_stacktop) return 1; - th=(*g_stacktop); - lstrcpyn(str,th->text,size?size:g_stringsize); - *g_stacktop = th->next; - GlobalFree((HGLOBAL)th); - return 0; -} - -void NSDFUNC pushstring(const char *str) -{ - stack_t *th; - if (!g_stacktop) return; - th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize); - lstrcpyn(th->text,str,g_stringsize); - th->next=*g_stacktop; - *g_stacktop=th; -} - -int NSDFUNC popint() -{ - char buf[1024]; - if (popstring(buf,sizeof(buf))) - return 0; - - return myatoi(buf); -} - -void NSDFUNC pushint(int value) -{ - char buffer[1024]; - wsprintf(buffer, "%d", value); - pushstring(buffer); -} diff --git a/Contrib/nsDialogs/nsis.h b/Contrib/nsDialogs/nsis.h deleted file mode 100644 index 83ca75de..00000000 --- a/Contrib/nsDialogs/nsis.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __NS_DIALOGS__NSIS_H__ -#define __NS_DIALOGS__NSIS_H__ - -#include -#include "defs.h" - -#define EXDLL_INIT() { \ - g_stringsize=string_size; \ - g_stacktop=stacktop; \ - g_variables=variables; } - -// For page showing plug-ins -#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) -#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) -#define NOTIFY_BYE_BYE 'x' - -typedef struct _stack_t { - struct _stack_t *next; - char text[1]; // this should be the length of string_size -} stack_t; - -extern int g_stringsize; -extern stack_t **g_stacktop; -extern char *g_variables; - -int NSDFUNC myatoi(const char *s); -int NSDFUNC popstring(char *str, int size); -void NSDFUNC pushstring(const char *str); -int NSDFUNC popint(); -void NSDFUNC pushint(int value); - -typedef struct { - int autoclose; - int all_user_var; - int exec_error; - int abort; - int exec_reboot; - int reboot_called; - int XXX_cur_insttype; // deprecated - int XXX_insttype_changed; // deprecated - int silent; - int instdir_error; - int rtl; - int errlvl; - int alter_reg_view; -} exec_flags_type; - -typedef struct { - exec_flags_type *exec_flags; - int (__stdcall *ExecuteCodeSegment)(int, HWND); - void (__stdcall *validate_filename)(char *); -} extra_parameters; - - -#endif//__NS_DIALOGS__NSIS_H__ diff --git a/Contrib/nsDialogs/rtl.c b/Contrib/nsDialogs/rtl.c index e1a30dfb..fef44a11 100644 --- a/Contrib/nsDialogs/rtl.c +++ b/Contrib/nsDialogs/rtl.c @@ -1,8 +1,9 @@ #include #include +#include // nsis plugin.h + #include "defs.h" -#include "nsis.h" #ifndef WS_EX_RIGHT # define WS_EX_RIGHT 0x1000