comdlg32: Expand initial directory path for file open dialog.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-02-21 15:35:15 +03:00 committed by Alexandre Julliard
parent b7cc44099a
commit aef84332a2
1 changed files with 7 additions and 5 deletions

View File

@ -504,15 +504,17 @@ static BOOL GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
else
fodInfos.filename = NULL;
fodInfos.initdir = NULL;
if(ofn->lpstrInitialDir)
{
/* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */
DWORD len = lstrlenW(ofn->lpstrInitialDir)+1;
DWORD len = ExpandEnvironmentStringsW(ofn->lpstrInitialDir, NULL, 0);
if (len)
{
fodInfos.initdir = MemAlloc(len * sizeof(WCHAR));
memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR));
ExpandEnvironmentStringsW(ofn->lpstrInitialDir, fodInfos.initdir, len);
}
}
else
fodInfos.initdir = NULL;
/* save current directory */
if (ofn->Flags & OFN_NOCHANGEDIR)