- More path validation (drive id is an english letter, no chars under 32 in a path)

- Fixed bug #839214 - message box shown in silent mode if a file can't be opened for writing. Now it will skip the file if AllowSkipFiles is on and abort if it's not.
- Added /SD parameter for MessageBox. Allows to set default for silent installers (MessageBox MB_OKCANCEL "OK? Cancel?" /SD IDOK IDOK doOK IDCANCEL doCancel)


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3208 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-11-25 17:07:40 +00:00
parent c062ecca53
commit ec5f289696
5 changed files with 62 additions and 27 deletions

View file

@ -81,7 +81,11 @@ int NSISCALL my_GetDialogItemText(HWND dlg, UINT idx, char *val, int size)
}*/
int NSISCALL my_MessageBox(const char *text, UINT type) {
return MessageBox(g_hwnd, text, g_caption, type);
// default for silent installers
if (g_exec_flags.silent && type >> 20)
return type >> 20;
// no silent or no default, just show
return MessageBox(g_hwnd, text, g_caption, type & 0x000FFFFF);
}
void * NSISCALL my_GlobalAlloc(DWORD dwBytes) {
@ -135,7 +139,7 @@ char *NSISCALL addtrailingslash(char *str)
void NSISCALL trimslashtoend(char *buf)
{
char *p = CharPrev(buf, buf + mystrlen(buf));
char *p = buf + mystrlen(buf);
do
{
if (*p == '\\')
@ -148,7 +152,8 @@ void NSISCALL trimslashtoend(char *buf)
int NSISCALL validpathspec(char *ubuf)
{
return ((*(WORD*)ubuf==CHAR2_TO_WORD('\\','\\')) || (ubuf[0] && *CharNext(ubuf)==':'));
char dl = ubuf[0] | 0x20; // convert drive letter to lower case
return ((*(WORD*)ubuf==CHAR2_TO_WORD('\\','\\')) || (dl >= 'a' && dl <= 'z' && *CharNext(ubuf)==':'));
}
char * NSISCALL skip_root(char *path)
@ -710,7 +715,7 @@ char * NSISCALL validate_filename(char *in) {
}
out = out_save = in;
while (*(char*)&cur_char = *in) {
if (!mystrstr(nono, (char*)&cur_char)) {
if (cur_char > 31 && !mystrstr(nono, (char*)&cur_char)) {
mini_memcpy(out, in, CharNext(in) - in);
out = CharNext(out);
}