@@ -366,58 +366,6 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
366366 return path ;
367367}
368368
369- /***********************************************************************
370- * MSI_GetSourcePath (internal)
371- */
372- static UINT MSI_GetSourcePath ( MSIHANDLE hInstall , LPCWSTR szFolder ,
373- awstring * szPathBuf , LPDWORD pcchPathBuf )
374- {
375- MSIPACKAGE * package ;
376- LPWSTR path ;
377- UINT r = ERROR_FUNCTION_FAILED ;
378-
379- TRACE ("%s %p %p\n" , debugstr_w (szFolder ), szPathBuf , pcchPathBuf );
380-
381- if (!szFolder )
382- return ERROR_INVALID_PARAMETER ;
383-
384- package = msihandle2msiinfo ( hInstall , MSIHANDLETYPE_PACKAGE );
385- if (!package )
386- {
387- LPWSTR value = NULL ;
388- MSIHANDLE remote ;
389-
390- if (!(remote = msi_get_remote (hInstall )))
391- return ERROR_INVALID_HANDLE ;
392-
393- r = remote_GetSourcePath (remote , szFolder , & value );
394- if (r != ERROR_SUCCESS )
395- return r ;
396-
397- r = msi_strcpy_to_awstring (value , -1 , szPathBuf , pcchPathBuf );
398-
399- midl_user_free (value );
400- return r ;
401- }
402-
403- if (szPathBuf -> str .w && !pcchPathBuf )
404- {
405- msiobj_release ( & package -> hdr );
406- return ERROR_INVALID_PARAMETER ;
407- }
408-
409- path = msi_resolve_source_folder ( package , szFolder , NULL );
410- msiobj_release ( & package -> hdr );
411-
412- TRACE ("path = %s\n" , debugstr_w (path ));
413- if (!path )
414- return ERROR_DIRECTORY ;
415-
416- r = msi_strcpy_to_awstring ( path , -1 , szPathBuf , pcchPathBuf );
417- msi_free ( path );
418- return r ;
419- }
420-
421369/***********************************************************************
422370 * MsiGetSourcePathA (MSI.@)
423371 */
@@ -471,17 +419,42 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW
471419/***********************************************************************
472420 * MsiGetSourcePathW (MSI.@)
473421 */
474- UINT WINAPI MsiGetSourcePathW ( MSIHANDLE hInstall , LPCWSTR szFolder ,
475- LPWSTR szPathBuf , LPDWORD pcchPathBuf )
422+ UINT WINAPI MsiGetSourcePathW (MSIHANDLE hinst , const WCHAR * folder , WCHAR * buf , DWORD * sz )
476423{
477- awstring str ;
424+ MSIPACKAGE * package ;
425+ const WCHAR * path ;
426+ UINT r ;
427+
428+ TRACE ("%s %p %p\n" , debugstr_w (folder ), buf , sz );
429+
430+ if (!folder )
431+ return ERROR_INVALID_PARAMETER ;
432+
433+ package = msihandle2msiinfo (hinst , MSIHANDLETYPE_PACKAGE );
434+ if (!package )
435+ {
436+ WCHAR * path = NULL ;
437+ MSIHANDLE remote ;
478438
479- TRACE ("%s %p %p\n" , debugstr_w (szFolder ), szPathBuf , pcchPathBuf );
439+ if (!(remote = msi_get_remote (hinst )))
440+ return ERROR_INVALID_HANDLE ;
441+
442+ r = remote_GetSourcePath (remote , folder , & path );
443+ if (!r )
444+ r = msi_strncpyW (path , -1 , buf , sz );
480445
481- str .unicode = TRUE;
482- str .str .w = szPathBuf ;
446+ midl_user_free (path );
447+ return r ;
448+ }
483449
484- return MSI_GetSourcePath ( hInstall , szFolder , & str , pcchPathBuf );
450+ path = msi_resolve_source_folder (package , folder , NULL );
451+ if (path )
452+ r = msi_strncpyW (path , -1 , buf , sz );
453+ else
454+ r = ERROR_DIRECTORY ;
455+
456+ msiobj_release (& package -> hdr );
457+ return r ;
485458}
486459
487460/***********************************************************************
0 commit comments