Merge back commit from winehq

svn path=/trunk/; revision=10933
This commit is contained in:
Gé van Geldorp 2004-09-20 15:07:21 +00:00
parent 91923bdc1d
commit 56dec0d9ee

View file

@ -77,7 +77,7 @@ static const WCHAR wszEmpty[] = {0};
* %* all following parameters (see batfile) * %* all following parameters (see batfile)
* *
* FIXME: use 'len' * FIXME: use 'len'
* FIXME: Careful of going over string-boundries. No checking is done to 'res'... * FIXME: Careful of going over string boundaries. No checking is done to 'res'...
*/ */
static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lpFile, LPITEMIDLIST pidl, LPCWSTR args) static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lpFile, LPITEMIDLIST pidl, LPCWSTR args)
{ {
@ -86,13 +86,6 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
PWSTR res = out; PWSTR res = out;
PCWSTR cmd; PCWSTR cmd;
LPVOID pv; LPVOID pv;
WCHAR tmpBuffer[1024];
PWSTR tmpB = tmpBuffer;
WCHAR tmpEnvBuff[MAX_PATH];
WCHAR* tmpE = tmpEnvBuff;
DWORD envRet;
static const WCHAR wszSPerc[] = {'%','s',0};
static const WCHAR wszPerc[] = {'%',0};
TRACE("%p, %d, %s, %s, %p, %p\n", out, len, debugstr_w(fmt), TRACE("%p, %d, %s, %s, %p, %p\n", out, len, debugstr_w(fmt),
debugstr_w(lpFile), pidl, args); debugstr_w(lpFile), pidl, args);
@ -192,32 +185,30 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
*/ */
/* Make sure that we have at least one more %.*/ /* Make sure that we have at least one more %.*/
if (strstrW(fmt, wszPerc)) if (strchrW(fmt, '%'))
{ {
WCHAR tmpBuffer[1024];
PWSTR tmpB = tmpBuffer;
WCHAR tmpEnvBuff[MAX_PATH];
DWORD envRet;
while (*fmt != '%') while (*fmt != '%')
*tmpB++ = *fmt++; *tmpB++ = *fmt++;
*tmpB++ = 0; *tmpB++ = 0;
TRACE("Checking %s to be a env-var\n", debugstr_w(tmpBuffer)); TRACE("Checking %s to be a env-var\n", debugstr_w(tmpBuffer));
envRet = GetEnvironmentVariableW(tmpBuffer, tmpE, MAX_PATH); envRet = GetEnvironmentVariableW(tmpBuffer, tmpEnvBuff, MAX_PATH);
if (envRet == 0 || envRet > MAX_PATH) if (envRet == 0 || envRet > MAX_PATH)
{ strcpyW( res, tmpBuffer );
TRACE("The env. var can't be found or is bigger than MAX_PATH => useless.");
res += sprintfW(res, wszSPerc, tmpBuffer);
}
else else
{ strcpyW( res, tmpEnvBuff );
TRACE("Found it %s. Replacing... \n", debugstr_w(tmpEnvBuff)); res += strlenW(res);
res += sprintfW(res, wszSPerc, tmpEnvBuff);
} }
}
} /* switch */
fmt++; fmt++;
done = TRUE; done = TRUE;
break;
}
} }
else else
*res++ = *fmt++; *res++ = *fmt++;