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++;
while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline);
if (*cmdline) cmdline=CharNext(cmdline);
cmdline=CharNext(cmdline);
realcmds=cmdline;
for (;;)

View file

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

View file

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