- Fixed ComponentText without InstTypes
- Made it impossible to install to non-existing drives/removable drives with no media - Fixed a crash caused by using a LangString in InstallDir - No more Windows error message when a registered DLL dependency can't be found git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2957 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3988e924f7
commit
6d63dd3a58
6 changed files with 68 additions and 70 deletions
|
@ -1892,7 +1892,11 @@ again:
|
|||
p->parms[1] = DefineInnerLangString(LS(NLF_COMP_SUBTEXT1, NLF_UCOMP_SUBTEXT1));
|
||||
if (!p->parms[2])
|
||||
p->parms[2] = DefineInnerLangString(LS(NLF_COMP_SUBTEXT2, NLF_UCOMP_SUBTEXT2));
|
||||
if (!p->parms[4])
|
||||
if (!p->parms[3] && !uninstall_mode && HasUserDefined(NLF_COMP_SUBTEXT1))
|
||||
p->parms[3] = p->parms[1];
|
||||
if (!p->parms[4] && !uninstall_mode && HasUserDefined(NLF_COMP_SUBTEXT2))
|
||||
p->parms[4] = p->parms[2];
|
||||
else if (!p->parms[4])
|
||||
p->parms[4] = DefineInnerLangString(LS(NLF_COMP_SUBTEXT1_NO_INST_TYPES, NLF_UCOMP_SUBTEXT1_NO_INST_TYPES));
|
||||
|
||||
DefineInnerLangString(NLF_SPACE_REQ);
|
||||
|
|
|
@ -110,6 +110,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
if (cmdline[0] != '/') break;
|
||||
cmdline++;
|
||||
|
||||
// this only works with spaces because they have just one bit on
|
||||
#define END_OF_ARG(c) (((c)|' ')==' ')
|
||||
|
||||
#if defined(NSIS_CONFIG_VISIBLE_SUPPORT) && defined(NSIS_CONFIG_SILENT_SUPPORT)
|
||||
|
|
|
@ -171,6 +171,8 @@ int NSISCALL ui_doinstall(void)
|
|||
static WNDCLASS wc; // richedit subclassing and bgbg creation
|
||||
g_exec_flags.autoclose=g_flags&CH_FLAGS_AUTO_CLOSE;
|
||||
|
||||
set_language();
|
||||
|
||||
if (!is_valid_instpath(state_install_directory))
|
||||
{
|
||||
if (header->install_reg_key_ptr)
|
||||
|
@ -201,8 +203,9 @@ int NSISCALL ui_doinstall(void)
|
|||
d=GetFileAttributes(p);
|
||||
if (d == (DWORD)-1 || !(d&FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
e=scanendslash(p);
|
||||
if (e>=p) *e=0;
|
||||
// if there is no back-slash, the string will become empty, but that's ok because
|
||||
// it would make an invalid instdir anyway
|
||||
trimslashtoend(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,8 +227,6 @@ int NSISCALL ui_doinstall(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
set_language();
|
||||
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
g_hIcon=LoadImage(g_hInstance,MAKEINTRESOURCE(IDI_ICON2),IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_SHARED);
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
|
@ -790,6 +791,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (uMsg == WM_IN_UPDATEMSG || uMsg == WM_NOTIFY_START)
|
||||
{
|
||||
static char s[NSIS_MAX_STRLEN];
|
||||
char *p;
|
||||
int is_valid_path;
|
||||
int x;
|
||||
int total=0, available=-1;
|
||||
|
@ -799,16 +801,9 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
is_valid_path=is_valid_instpath(dir);
|
||||
|
||||
mystrcpy(s,dir);
|
||||
if (s[1] == ':') s[3]=0;
|
||||
else if (*(WORD*)s == CHAR2_TO_WORD('\\','\\')) // \\ path
|
||||
{
|
||||
char *p = mystrstr(s+2,"\\");
|
||||
if (p) {
|
||||
p = mystrstr(p+1,"\\");
|
||||
if (p) *p = 0;
|
||||
}
|
||||
addtrailingslash(s);
|
||||
}
|
||||
p=skip_root(s);
|
||||
if (p)
|
||||
*p=0;
|
||||
|
||||
if (GetDiskFreeSpace(s,&spc,&bps,&fc,&tc))
|
||||
{
|
||||
|
|
|
@ -229,21 +229,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
char *buf1=GetStringFromParm(-0x10);
|
||||
log_printf3("CreateDirectory: \"%s\" (%d)",buf1,parm1);
|
||||
{
|
||||
char *tp=CharNext(buf1);
|
||||
char *p=buf1;
|
||||
char c='c';
|
||||
if (*p) {
|
||||
if (*(WORD*)tp == CHAR2_TO_WORD(':','\\')) p=tp+2;
|
||||
else if (*(WORD*)p == CHAR2_TO_WORD('\\','\\'))
|
||||
{
|
||||
int x=4;
|
||||
while (x--)
|
||||
{
|
||||
while (*p != '\\' && *p) p=CharNext(p); // skip host then share
|
||||
p=CharNext(p);
|
||||
}
|
||||
}
|
||||
else break;
|
||||
p = skip_root(buf1);
|
||||
if (!p)
|
||||
break;
|
||||
while (c)
|
||||
{
|
||||
WIN32_FIND_DATA *fd;
|
||||
|
@ -767,8 +758,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
0,
|
||||
GetStringFromParm(0x00),
|
||||
IMAGE_BITMAP,
|
||||
parm2?r.right:0,
|
||||
parm2?r.bottom:0,
|
||||
parm2*r.right,
|
||||
parm2*r.bottom,
|
||||
LR_LOADFROMFILE
|
||||
);
|
||||
hImage = (HANDLE)SendMessage(
|
||||
|
@ -924,6 +915,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_REGISTERDLL:
|
||||
{
|
||||
exec_error++;
|
||||
SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
|
||||
if (SUCCEEDED(g_hres))
|
||||
{
|
||||
HANDLE h;
|
||||
|
@ -978,6 +970,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
update_status_text(LANG_NOOLE,buf1);
|
||||
log_printf("Error registering DLL: Could not initialize OLE");
|
||||
}
|
||||
SetErrorMode(0);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -133,24 +133,15 @@ char *NSISCALL addtrailingslash(char *str)
|
|||
|
||||
void NSISCALL trimslashtoend(char *buf)
|
||||
{
|
||||
char *p=scanendslash(buf);
|
||||
if (p<buf) p=buf;
|
||||
*p=0;
|
||||
}
|
||||
|
||||
|
||||
char * NSISCALL scanendslash(const char *str)
|
||||
{
|
||||
char *s=CharPrev(str,str+mystrlen(str));
|
||||
if (!*str) return (char*)str-1;
|
||||
for (;;)
|
||||
char *p = CharPrev(buf, buf + mystrlen(buf));
|
||||
do
|
||||
{
|
||||
char *t;
|
||||
if ('\\' == *s) return s;
|
||||
t=CharPrev(str,s);
|
||||
if (t==s) return (char*)str-1;
|
||||
s=t;
|
||||
}
|
||||
if (*p == '\\')
|
||||
break;
|
||||
p = CharPrev(buf, p);
|
||||
} while (p > buf);
|
||||
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
int NSISCALL validpathspec(char *ubuf)
|
||||
|
@ -158,34 +149,48 @@ int NSISCALL validpathspec(char *ubuf)
|
|||
return ((*(WORD*)ubuf==CHAR2_TO_WORD('\\','\\')) || (ubuf[0] && *CharNext(ubuf)==':'));
|
||||
}
|
||||
|
||||
int NSISCALL is_valid_instpath(char *s)
|
||||
char * NSISCALL skip_root(char *path)
|
||||
{
|
||||
int ivp=0;
|
||||
// if CH_FLAGS_NO_ROOT_DIR is set, req is 0, which means rootdirs are not allowed.
|
||||
int req=!(g_flags&CH_FLAGS_NO_ROOT_DIR);
|
||||
if (*(WORD*)s == CHAR2_TO_WORD('\\','\\')) // \\ path
|
||||
char *p = CharNext(path);
|
||||
char *p2 = CharNext(p);
|
||||
|
||||
if (*path && *(WORD*)p == CHAR2_TO_WORD(':', '\\'))
|
||||
{
|
||||
if (lastchar(s)!='\\') ivp++;
|
||||
while (*s)
|
||||
return CharNext(p2);
|
||||
}
|
||||
else if (*(WORD*)path == CHAR2_TO_WORD('\\','\\'))
|
||||
{
|
||||
// skip host and share name
|
||||
int x = 2;
|
||||
while (x--)
|
||||
{
|
||||
if (*s == '\\') ivp++;
|
||||
s=CharNext(s);
|
||||
while (*p2 != '\\')
|
||||
{
|
||||
if (!*p2)
|
||||
return NULL;
|
||||
p2 = CharNext(p2);
|
||||
}
|
||||
p2 = CharNext(p2);
|
||||
}
|
||||
ivp/=5-req;
|
||||
|
||||
return p2;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int NSISCALL is_valid_instpath(char *s)
|
||||
{
|
||||
int ret = 0;
|
||||
char *p = skip_root(s);
|
||||
if (p && ((*p && *p != '\\') || !(g_flags & CH_FLAGS_NO_ROOT_DIR)))
|
||||
{
|
||||
if (*s)
|
||||
{
|
||||
s=CharNext(s);
|
||||
if (*(WORD*)s == CHAR2_TO_WORD(':','\\'))
|
||||
{
|
||||
s+=2;
|
||||
if (req || (*s && *s != '\\')) ivp++;
|
||||
}
|
||||
}
|
||||
char pb = *p;
|
||||
*p = 0;
|
||||
ret = GetFileAttributes(s) != (DWORD)-1;
|
||||
*p = pb;
|
||||
}
|
||||
return ivp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char * NSISCALL mystrstr(char *a, char *b)
|
||||
|
@ -674,13 +679,13 @@ char * NSISCALL validate_filename(char *in) {
|
|||
char *out;
|
||||
char *out_save;
|
||||
while (*in == ' ') in=CharNext(in);
|
||||
if (in[0] && in[1] && in[2]) {
|
||||
if (in[0] == '\\' && in[1] == '\\' && in[2] == '?' && in[3] == '\\') {
|
||||
// at least four bytes
|
||||
if (*(DWORD*)in == CHAR4_TO_DWORD('\\', '\\', '?', '\\')) in += 4;
|
||||
in += 4;
|
||||
}
|
||||
if (*in) {
|
||||
// at least two bytes
|
||||
if (in[0] && validpathspec(in)) in += 2;
|
||||
if (validpathspec(in)) in += 2;
|
||||
}
|
||||
out = out_save = in;
|
||||
while (*(char*)&cur_char = *in) {
|
||||
|
|
|
@ -56,7 +56,7 @@ char * NSISCALL addtrailingslash(char *str);
|
|||
//char NSISCALL lastchar(const char *str);
|
||||
#define lastchar(str) *CharPrev(str,str+mystrlen(str))
|
||||
void NSISCALL trimslashtoend(char *buf);
|
||||
char * NSISCALL scanendslash(const char *str);
|
||||
char * NSISCALL skip_root(char *path);
|
||||
int NSISCALL is_valid_instpath(char *s);
|
||||
char * NSISCALL validate_filename(char *fn);
|
||||
void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue