From: Jactry Zeng Subject: [PATCH] explorer: Fix copy_path_string() when an unnecessary \ follow the path. Message-Id: <546DDE9D.3040508@codeweavers.com> Date: Thu, 20 Nov 2014 20:29:17 +0800 --- programs/explorer/explorer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c index 1b900d0..1d2b384 100644 --- a/programs/explorer/explorer.c +++ b/programs/explorer/explorer.c @@ -623,6 +623,7 @@ static IShellFolder* get_starting_shell_folder(parameters_struct* params) static int copy_path_string(LPWSTR target, LPWSTR source) { INT i = 0; + INT last; while (isspaceW(*source)) source++; @@ -639,6 +640,11 @@ static int copy_path_string(LPWSTR target, LPWSTR source) while (*source && *source != ',') target[i++] = *source++; target[i] = 0; } + + last = strlenW(target) - 1; + if (target[0] && target[last] == '\\') + target[last] = 0; + return i; }