From 5a1180477cb24809fdb8df791195caf7a1a3793c Mon Sep 17 00:00:00 2001 From: Jens Collin Date: Sun, 12 Sep 2004 11:21:30 +0000 Subject: [PATCH] Merged with wine. (Fixed const string handling) svn path=/trunk/; revision=10827 --- reactos/lib/shell32/shlexec.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/reactos/lib/shell32/shlexec.c b/reactos/lib/shell32/shlexec.c index c5689be48d4..0f0ad1f1b75 100644 --- a/reactos/lib/shell32/shlexec.c +++ b/reactos/lib/shell32/shlexec.c @@ -86,11 +86,13 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp PWSTR res = out; PCWSTR cmd; LPVOID pv; - WCHAR tmpBuffer[1024]; - PWSTR tmpB = tmpBuffer; - WCHAR tmpEnvBuff[MAX_PATH]; - WCHAR* tmpE = tmpEnvBuff; - DWORD envRet; + 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), debugstr_w(lpFile), pidl, args); @@ -189,8 +191,8 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp * Check if this is a env-variable here... */ - // Make sure that we have at least one more %. - if (strstrW(fmt, L"%")) + /* Make sure that we have at least one more %.*/ + if (strstrW(fmt, wszPerc)) { while (*fmt != '%') *tmpB++ = *fmt++; @@ -202,16 +204,16 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp if (envRet == 0 || envRet > MAX_PATH) { TRACE("The env. var can't be found or is bigger than MAX_PATH => useless."); - res += sprintfW(res, L"%s%%", tmpBuffer); + res += sprintfW(res, wszSPerc, tmpBuffer); } else { TRACE("Found it %s. Replacing... \n", debugstr_w(tmpEnvBuff)); - res += sprintfW(res, L"%s", tmpEnvBuff); + res += sprintfW(res, wszSPerc, tmpEnvBuff); } } - } // switch + } /* switch */ fmt++;