From 7a958101d8d2da778f2c41b71f3676f8cfe31bc6 Mon Sep 17 00:00:00 2001 From: anders_k Date: Fri, 1 Apr 2016 20:17:20 +0000 Subject: [PATCH] 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 --- Contrib/nsDialogs/browse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Contrib/nsDialogs/browse.c b/Contrib/nsDialogs/browse.c index 0af4dd4f..64b862a4 100644 --- a/Contrib/nsDialogs/browse.c +++ b/Contrib/nsDialogs/browse.c @@ -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))) {