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

(-)fpicker/source/win32/filepicker/getfilenamewrapper.cxx.orighs (+34 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 most applications
54
#define	MAX_WCHAR_PATH	1500
51
55
52
namespace /* private */
56
namespace /* private */
53
{
57
{
Lines 80-85 Link Here
80
		GetFileNameParam* lpgfnp = 
84
		GetFileNameParam* lpgfnp = 
81
			reinterpret_cast<GetFileNameParam*>(pParam);
85
			reinterpret_cast<GetFileNameParam*>(pParam);
82
86
87
//i21747
88
//get current working directory, to be reinstated after the open/save as
89
		wchar_t wctCurrDir[MAX_WCHAR_PATH]; //should sufficient for pratical uses
90
		wchar_t *wctErr = _wgetcwd(wctCurrDir,MAX_WCHAR_PATH);//this call only for Windows NT, 2000, XP
91
								//in Win 98, ME, 95 I'm not sure: unicows.dll ?
83
		HRESULT	hr = OleInitialize( NULL );
92
		HRESULT	hr = OleInitialize( NULL );
84
93
85
		if (lpgfnp->m_bOpen)
94
		if (lpgfnp->m_bOpen)
Lines 91-96 Link Here
91
100
92
		if ( SUCCEEDED( hr ) )
101
		if ( SUCCEEDED( hr ) )
93
			OleUninitialize();
102
			OleUninitialize();
103
//i21747
104
//add here a force cwd to the previous saved working dir
105
//if wctErr == NULL then path was too long, bug will show up (but no crash)
106
		if( wctErr )
107
			_wchdir(wctCurrDir);
94
108
95
		return 0;
109
		return 0;
96
	}
110
	}
Lines 166-171 Link Here
166
	}
180
	}
167
	else
181
	else
168
	{
182
	{
183
//i21747
184
//get current working directory, to be reinstated after the open/save as
185
		wchar_t wctCurrDir[MAX_WCHAR_PATH]; //should sufficient for pratical uses
186
		wchar_t *wctErr = _wgetcwd(wctCurrDir,MAX_WCHAR_PATH);//this call only for Windows NT, 2000, XP
187
								//in Win 98, ME, 95 I'm not sure: unicows.dll ?
169
		HRESULT	hr = OleInitialize( NULL );
188
		HRESULT	hr = OleInitialize( NULL );
170
189
171
		bRet = GetOpenFileName(lpofn);
190
		bRet = GetOpenFileName(lpofn);
Lines 173-178 Link Here
173
192
174
		if ( SUCCEEDED( hr ) ) 
193
		if ( SUCCEEDED( hr ) ) 
175
			OleUninitialize();
194
			OleUninitialize();
195
//i21747
196
//add here a force cwd to the saved working dir
197
//if wctErr == NULL then path was too long, bug will show up (but no crash)
198
		if( wctErr )
199
			_wchdir(wctCurrDir);
176
	}
200
	}
177
201
178
	return bRet;
202
	return bRet;
Lines 195-202 Link Here
195
	}
219
	}
196
	else
220
	else
197
	{
221
	{
222
//i21747
223
//get current working directory, to be reinstated after the open/save as
224
		wchar_t wctCurrDir[MAX_WCHAR_PATH]; //should sufficient for pratical uses
225
		wchar_t *wctErr = _wgetcwd(wctCurrDir,MAX_WCHAR_PATH);//this call only for Windows NT, 2000, XP
226
								//in Win 98, ME, 95 I'm not sure: unicows.dll ?
198
		bRet = GetSaveFileName(lpofn);
227
		bRet = GetSaveFileName(lpofn);
199
		m_ExtendedDialogError = CommDlgExtendedError();
228
		m_ExtendedDialogError = CommDlgExtendedError();
229
//i21747
230
//add here a force cwd to the saved working dir
231
//if wctErr == NULL then path was too long, bug will show up (but no crash)
232
		if( wctErr )
233
			_wchdir(wctCurrDir);
200
	}
234
	}
201
235
202
	return bRet;
236
	return bRet;

Return to issue 21747