View | Details | Raw Unified | Return to issue 21747
Collapse All | Expand All

(-)fpicker/source/win32/filepicker/getfilenamewrapper.cxx (+27 lines)
Lines 48-53 Link Here
48
#include <objbase.h>
48
#include <objbase.h>
49
#include <process.h>
49
#include <process.h>
50
50
51
//i21747
52
#include <direct.h>
53
//max path lenght. Should be OK for all applications, the Windows directory is usually
54
//something as c:\Windows or similar
55
#define	MAX_WCHAR_PATH	1500
56
#define ELEMENTS_OF_ARRAY(arr) (sizeof(arr)/(sizeof((arr)[0])))
51
57
52
namespace /* private */
58
namespace /* private */
53
{
59
{
Lines 92-97 namespace /* private */ Link Here
92
		if ( SUCCEEDED( hr ) )
98
		if ( SUCCEEDED( hr ) )
93
			OleUninitialize();
99
			OleUninitialize();
94
100
101
		CGetFileNameWrapper::setCwdToWindowsDir();
95
		return 0;
102
		return 0;
96
	}
103
	}
97
104
Lines 173-178 bool CGetFileNameWrapper::getOpenFileNam Link Here
173
180
174
		if ( SUCCEEDED( hr ) ) 
181
		if ( SUCCEEDED( hr ) ) 
175
			OleUninitialize();
182
			OleUninitialize();
183
		CGetFileNameWrapper::setCwdToWindowsDir();
176
	}
184
	}
177
185
178
	return bRet;
186
	return bRet;
Lines 197-202 bool CGetFileNameWrapper::getSaveFileNam Link Here
197
	{
205
	{
198
		bRet = GetSaveFileName(lpofn);
206
		bRet = GetSaveFileName(lpofn);
199
		m_ExtendedDialogError = CommDlgExtendedError();
207
		m_ExtendedDialogError = CommDlgExtendedError();
208
		CGetFileNameWrapper::setCwdToWindowsDir();
200
	}
209
	}
201
210
202
	return bRet;
211
	return bRet;
Lines 211-213 int CGetFileNameWrapper::commDlgExtended Link Here
211
    return m_ExtendedDialogError;
220
    return m_ExtendedDialogError;
212
}
221
}
213
222
223
//-----------------------------------------------
224
//
225
//-----------------------------------------------
226
227
void CGetFileNameWrapper::setCwdToWindowsDir()
228
{
229
//i21747
230
//get current windows directory, to be forced after the open/save as
231
		WCHAR	wcWinDir[MAX_WCHAR_PATH];
232
		LPWSTR	lpBuffer = wcWinDir;
233
		DWORD	nBufferLength = ELEMENTS_OF_ARRAY(wcWinDir) - 1;
234
		DWORD	nLength;
235
236
//this call only for Windows NT, 2000, XP, in Win 98, ME, 95 I'm not sure: unicows.dll ?
237
		nLength = GetWindowsDirectoryW(  lpBuffer, ELEMENTS_OF_ARRAY(wcWinDir) );
238
		if( nLength < nBufferLength )
239
			_wchdir(wcWinDir);
240
}
(-)fpicker/source/win32/filepicker/getfilenamewrapper.hxx (+1 lines)
Lines 62-67 public: Link Here
62
    bool getOpenFileName(LPOPENFILENAME lpofn);
62
    bool getOpenFileName(LPOPENFILENAME lpofn);
63
    bool getSaveFileName(LPOPENFILENAME lpofn);
63
    bool getSaveFileName(LPOPENFILENAME lpofn);
64
    int  commDlgExtendedError();
64
    int  commDlgExtendedError();
65
	static void setCwdToWindowsDir();
65
66
66
private:
67
private:
67
	int m_ExtendedDialogError;
68
	int m_ExtendedDialogError;

Return to issue 21747