MBCS support for validate_filename and error flag for CreateDirectory/SetOutPath

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2184 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-02-19 20:36:20 +00:00
parent 8dd7703d01
commit f9e4da2fea
3 changed files with 16 additions and 19 deletions

View file

@ -110,7 +110,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
if (*cmdline == '\"') seekchar = *cmdline++; if (*cmdline == '\"') seekchar = *cmdline++;
while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline); while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline);
if (*cmdline) cmdline=CharNext(cmdline); cmdline=CharNext(cmdline);
realcmds=cmdline; realcmds=cmdline;
for (;;) for (;;)

View file

@ -237,12 +237,10 @@ static int NSISCALL ExecuteEntry(entry *entry_)
} }
else update_status_text_from_lang(LANG_CREATEDIR,buf1); else update_status_text_from_lang(LANG_CREATEDIR,buf1);
{ {
char *tp; char *tp=CharNext(buf1);
char *p; char *p=buf1;
p=buf1; char c = 'c';
while (*p == ' ') p=CharNext(p);
if (*p) { if (*p) {
tp=CharNext(p);
if (*(WORD*)tp == CHAR2_TO_WORD(':','\\')) p=tp+2; if (*(WORD*)tp == CHAR2_TO_WORD(':','\\')) p=tp+2;
else if (*(WORD*)p == CHAR2_TO_WORD('\\','\\')) else if (*(WORD*)p == CHAR2_TO_WORD('\\','\\'))
{ {
@ -250,21 +248,18 @@ static int NSISCALL ExecuteEntry(entry *entry_)
for (x = 0; x < 2; x ++) for (x = 0; x < 2; x ++)
{ {
while (*p != '\\' && *p) p=CharNext(p); // skip host then share while (*p != '\\' && *p) p=CharNext(p); // skip host then share
if (*p) p=CharNext(p); p=CharNext(p);
} }
} }
else return 0; else return 0;
while (*p) while (c)
{ {
while (*p != '\\' && *p) p=CharNext(p); while (*p != '\\' && *p) p=CharNext(p);
if (!*p) CreateDirectory(buf1,NULL); c=*p;
else *p=0;
{ g_flags.exec_error += !CreateDirectory(buf1,NULL);
*p=0; *p++ = c;
CreateDirectory(buf1,NULL);
*p++ = '\\';
}
} }
} }
} }

View file

@ -521,6 +521,7 @@ char * NSISCALL validate_filename(char *in) {
short cur_char = 0; short cur_char = 0;
char *out; char *out;
char *out_save; char *out_save;
while (*in == ' ') in=CharNext(in);
if (in[0] && in[1] && in[2]) { if (in[0] && in[1] && in[2]) {
// at least four bytes // at least four bytes
if (*(DWORD*)in == CHAR4_TO_DWORD('\\', '\\', '?', '\\')) in += 4; if (*(DWORD*)in == CHAR4_TO_DWORD('\\', '\\', '?', '\\')) in += 4;
@ -529,11 +530,12 @@ char * NSISCALL validate_filename(char *in) {
// at least two bytes // at least two bytes
if (in[0] && validpathspec(in)) in += 2; if (in[0] && validpathspec(in)) in += 2;
} }
out = in; out = out_save = in;
out_save = out; while (*(char*)&cur_char = *in) {
while (*(char*)&cur_char = *in++) {
if (!mystrstr(nono, (char*)&cur_char)) if (!mystrstr(nono, (char*)&cur_char))
*out++ = *(char*)&cur_char; mini_memcpy(out, in, CharNext(in) - in);
in = CharNext(in);
out = CharNext(out);
} }
do { do {
*out = 0; *out = 0;