From 5bc7b784cbcf386a99f96238a0f488eb0eb9b4ed Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Tue, 10 Jun 2008 10:20:19 +0200 Subject: [PATCH] notepad: Improve handling of quoted filenames. --- programs/notepad/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/notepad/main.c b/programs/notepad/main.c index fb844879d0a..f231f207d00 100644 --- a/programs/notepad/main.c +++ b/programs/notepad/main.c @@ -571,8 +571,13 @@ static void HandleCommandLine(LPWSTR cmdline) if (cmdline[0] == '"') { + WCHAR* wc; cmdline++; - cmdline[lstrlen(cmdline) - 1] = 0; + wc=cmdline; + /* Note: Double-quotes are not allowed in Windows filenames */ + while (*wc && *wc != '"') wc++; + /* On Windows notepad ignores further arguments too */ + *wc = 0; } if (FileExists(cmdline))