diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 0ada09aad96..0f74c85fcd8 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -2454,11 +2454,16 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, LPWSTR p; lstrcpyW(lpwstrTemp, lpszTemp); - p = PathFindNextComponentW(lpwstrTemp); - - if (!p) break; /* end of path */ - - *p = 0; + if (lpszTemp == lpstrPathAndFile && (p = PathSkipRootW(lpwstrTemp))) + { + *p = 0; + } + else + { + p = PathFindNextComponentW(lpwstrTemp); + if (!p) break; /* end of path */ + *p = 0; + } lpszTemp = lpszTemp + lstrlenW(lpwstrTemp); /* There are no wildcards when OFN_NOVALIDATE is set */