popstringn takes a character count, not a byte size as the max length!

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6732 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2016-04-01 20:17:20 +00:00
parent 8ea946bbf0
commit 7a958101d8

View file

@ -104,13 +104,13 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TC
ofn.hwndOwner = hwndParent;
ofn.lpstrFilter = filter;
ofn.lpstrFile = path;
ofn.nMaxFile = sizeof(path);
ofn.nMaxFile = COUNTOF(path);
//ofn.Flags = pField->nFlags & (OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_CREATEPROMPT | OFN_EXPLORER);
ofn.Flags = OFN_CREATEPROMPT | OFN_EXPLORER;
popstringn(type, sizeof(type));
popstringn(path, sizeof(path));
popstringn(filter, sizeof(filter));
popstringn(type, COUNTOF(type));
popstringn(path, COUNTOF(path));
popstringn(filter, COUNTOF(filter));
save = !lstrcmpi(type, _T("save"));
@ -148,7 +148,7 @@ void __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TC
*p = 0;
}
GetCurrentDirectory(sizeof(currentDirectory), currentDirectory); // save working dir
GetCurrentDirectory(COUNTOF(currentDirectory), currentDirectory); // save working dir
if ((save ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn)))
{