Juan Lang : shell32: Don't overwrite the caller' s buffer when doing a dde connection.
Alexandre Julliard
julliard at winehq.org
Mon Nov 19 08:19:36 CST 2007
Module: wine
Branch: master
Commit: 987ba237aa24ab6163a7e9d12e99643e3dbb5f6a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=987ba237aa24ab6163a7e9d12e99643e3dbb5f6a
Author: Juan Lang <juan.lang at gmail.com>
Date: Fri Nov 16 12:40:56 2007 -0800
shell32: Don't overwrite the caller's buffer when doing a dde connection.
---
dlls/shell32/shlexec.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 2036a09..b5000e2 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -749,14 +749,15 @@ static HDDEDATA CALLBACK dde_cb(UINT uType, UINT uFmt, HCONV hConv,
* launching an application and trying (#2) to connect to it
*
*/
-static unsigned dde_connect(WCHAR* key, const WCHAR* start, WCHAR* ddeexec,
+static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec,
const WCHAR* lpFile, WCHAR *env,
LPCWSTR szCommandline, LPITEMIDLIST pidl, SHELL_ExecuteW32 execfunc,
const SHELLEXECUTEINFOW *psei, LPSHELLEXECUTEINFOW psei_out)
{
static const WCHAR wApplication[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0};
static const WCHAR wTopic[] = {'\\','t','o','p','i','c',0};
- WCHAR * endkey = key + strlenW(key);
+ WCHAR regkey[256];
+ WCHAR * endkey = regkey + strlenW(key);
WCHAR app[256], topic[256], ifexec[256], res[256];
LONG applen, topiclen, ifexeclen;
WCHAR * exec;
@@ -769,9 +770,10 @@ static unsigned dde_connect(WCHAR* key, const WCHAR* start, WCHAR* ddeexec,
unsigned ret = SE_ERR_NOASSOC;
BOOL unicode = !(GetVersion() & 0x80000000);
+ strcpyW(regkey, key);
strcpyW(endkey, wApplication);
applen = sizeof(app);
- if (RegQueryValueW(HKEY_CLASSES_ROOT, key, app, &applen) != ERROR_SUCCESS)
+ if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, app, &applen) != ERROR_SUCCESS)
{
WCHAR command[1024], fullpath[MAX_PATH];
static const WCHAR wSo[] = { '.','s','o',0 };
@@ -822,7 +824,7 @@ static unsigned dde_connect(WCHAR* key, const WCHAR* start, WCHAR* ddeexec,
strcpyW(endkey, wTopic);
topiclen = sizeof(topic);
- if (RegQueryValueW(HKEY_CLASSES_ROOT, key, topic, &topiclen) != ERROR_SUCCESS)
+ if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, topic, &topiclen) != ERROR_SUCCESS)
{
static const WCHAR wSystem[] = {'S','y','s','t','e','m',0};
strcpyW(topic, wSystem);
@@ -864,7 +866,7 @@ static unsigned dde_connect(WCHAR* key, const WCHAR* start, WCHAR* ddeexec,
}
strcpyW(endkey, wIfexec);
ifexeclen = sizeof(ifexec);
- if (RegQueryValueW(HKEY_CLASSES_ROOT, key, ifexec, &ifexeclen) == ERROR_SUCCESS)
+ if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, ifexec, &ifexeclen) == ERROR_SUCCESS)
{
exec = ifexec;
}
More information about the wine-cvs
mailing list