fixed bug in PhSetFileDialogFileName

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@4177 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2011-04-25 21:29:31 +00:00
parent 555e506504
commit 45c8f4ebe4
2 changed files with 7 additions and 2 deletions
+1
View File
@@ -8,6 +8,7 @@ Process Hacker
* Image file versions
* Workaround for an IPv6-related bug in Windows XP
* DPCs and Interrupts in System Information tooltips
* File dialog crash on Windows XP
2.14
* NEW/IMPROVED:
+6 -2
View File
@@ -4177,6 +4177,7 @@ VOID PhSetFileDialogFileName(
else
{
OPENFILENAME *ofn = (OPENFILENAME *)FileDialog;
SIZE_T length;
if (wcschr(FileName, '/') || wcschr(FileName, '\"'))
{
@@ -4185,8 +4186,11 @@ VOID PhSetFileDialogFileName(
}
PhFree(ofn->lpstrFile);
ofn->nMaxFile = max((ULONG)wcslen(FileName) + 1, 0x400);
ofn->lpstrFile = PhAllocateCopy(FileName, ofn->nMaxFile * 2);
length = wcslen(FileName);
ofn->nMaxFile = max(length + 1, 0x400);
ofn->lpstrFile = PhAllocate(ofn->nMaxFile * 2);
memcpy(ofn->lpstrFile, FileName, (length + 1) * 2);
}
}