Author: tfaber
Date: Mon Oct 10 12:14:12 2011
New Revision: 54071
URL:
http://svn.reactos.org/svn/reactos?rev=54071&view=rev
Log:
[KERNEL32]
- Properly copy image name in TH32CreateSnapshotSectionInitialize. Fixes truncated file
names in kernel32:toolhelp test
Modified:
trunk/reactos/dll/win32/kernel32/client/toolhelp.c
Modified: trunk/reactos/dll/win32/kernel32/client/toolhelp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/toolhelp.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/toolhelp.c [iso-8859-1] Mon Oct 10 12:14:12
2011
@@ -409,9 +409,12 @@
ProcessListEntry->dwFlags = 0; /* no longer used */
if(ProcessInfo->ImageName.Buffer != NULL)
{
- lstrcpynW(ProcessListEntry->szExeFile,
- ProcessInfo->ImageName.Buffer,
- min(ProcessInfo->ImageName.Length / sizeof(WCHAR),
sizeof(ProcessListEntry->szExeFile) / sizeof(ProcessListEntry->szExeFile[0])));
+ ULONG ExeFileLength = min(ProcessInfo->ImageName.Length,
+ sizeof(ProcessListEntry->szExeFile) -
sizeof(WCHAR));
+ RtlCopyMemory(ProcessListEntry->szExeFile,
+ ProcessInfo->ImageName.Buffer,
+ ExeFileLength);
+ ProcessListEntry->szExeFile[ExeFileLength / sizeof(WCHAR)] = UNICODE_NULL;
}
else
{