Fw: shell32 - RegQueryValueW()
Martin Fuchs
martin-fuchs at gmx.net
Fri Apr 9 16:26:36 CDT 2004
Changelog:
We should avoid to use the returned length of RegQueryValueW() calls because it has
to be interpreted different depending on the registry value type
(characters for REG_EXPAND_SZ, bytes for REG_SZ).
In fact it is not needed - the returned strings are already null terminated.
Index: shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.41
diff -u -p -d -r1.41 shlexec.c
--- shlexec.c 9 Apr 2004 19:04:03 -0000 1.41
+++ shlexec.c 9 Apr 2004 21:20:38 -0000
@@ -459,7 +459,6 @@ static UINT SHELL_FindExecutableByOperat
if (RegQueryValueW(HKEY_CLASSES_ROOT, filetype, command,
&commandlen) == ERROR_SUCCESS)
{
- commandlen /= sizeof(WCHAR);
if (key) strcpyW(key, filetype);
#if 0
LPWSTR tmp;
@@ -480,15 +479,11 @@ static UINT SHELL_FindExecutableByOperat
if (RegQueryValueW(HKEY_CLASSES_ROOT, filetype, param,
¶mlen) == ERROR_SUCCESS)
{
- paramlen /= sizeof(WCHAR);
strcatW(command, wSpace);
strcatW(command, param);
- commandlen += paramlen;
}
#endif
- command[commandlen] = '\0';
-
return 33; /* FIXME see SHELL_FindExecutable() */
}
@@ -609,8 +604,6 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath
if (RegQueryValueW(HKEY_CLASSES_ROOT, extension, filetype,
&filetypelen) == ERROR_SUCCESS)
{
- filetypelen /= sizeof(WCHAR);
- filetype[filetypelen] = '\0';
TRACE("File type: %s\n", debugstr_w(filetype));
}
@@ -619,7 +612,6 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath
if (lpOperation)
{
/* pass the operation string to SHELL_FindExecutableByOperation() */
- filetype[filetypelen] = '\0';
retval = SHELL_FindExecutableByOperation(lpPath, lpFile, lpOperation, key, filetype, command, sizeof(command));
}
else
@@ -627,6 +619,8 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath
WCHAR operation[MAX_PATH];
HKEY hkey;
+ filetypelen = strlenW(filetype);
+
/* Looking for ...buffer\shell\<operation>\command */
strcatW(filetype, wszShell);
@@ -838,8 +832,6 @@ static UINT execute_from_key(LPWSTR key,
else
{
/* Is there a replace() function anywhere? */
- cmdlen /= sizeof(WCHAR);
- cmd[cmdlen] = '\0';
SHELL_ArgifyW(param, sizeof(param)/sizeof(WCHAR), cmd, lpFile, psei->lpIDList, szCommandline);
retval = execfunc(param, env, FALSE, psei, psei_out);
}
More information about the wine-patches
mailing list