Commit cccd5463 authored by Geoffroy Couprie's avatar Geoffroy Couprie

mp4: Factorize

parent 2e143045
...@@ -1563,42 +1563,14 @@ static int GetSCIData( char *psz_ipod, uint32_t **pp_sci, ...@@ -1563,42 +1563,14 @@ static int GetSCIData( char *psz_ipod, uint32_t **pp_sci,
if( psz_ipod == NULL ) if( psz_ipod == NULL )
{ {
#ifdef WIN32 #ifdef WIN32
const wchar_t *wfile = const char *SCIfile =
L"\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb"; "\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb";
typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, strncpy(p_tmp, config_GetConfDir(), sizeof(p_tmp -1));
LPWSTR ); if( strlen( p_tmp ) + strlen( SCIfile ) >= PATH_MAX )
HINSTANCE shfolder_dll = NULL; return -1;
SHGETFOLDERPATH dSHGetFolderPath = NULL; strcat(p_tmp, SCIfile);
wchar_t wpath[PATH_MAX]; p_tmp[sizeof( p_tmp ) - 1] = '\0';
psz_path = p_tmp;
if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
{
dSHGetFolderPath =
(SHGETFOLDERPATH)GetProcAddress( shfolder_dll,
_T("SHGetFolderPathW") );
}
if( dSHGetFolderPath != NULL &&
SUCCEEDED( dSHGetFolderPath( NULL, CSIDL_COMMON_APPDATA,
NULL, 0, wpath ) ) )
{
if (wcslen( wpath ) + wcslen( wfile ) >= PATH_MAX )
{
return -1;
}
wcscat( wpath, wfile );
psz_path = FromWide( wpath );
strncpy( p_tmp, psz_path, sizeof( p_tmp ) - 1 );
p_tmp[sizeof( p_tmp ) - 1] = '\0';
free( psz_path );
psz_path = p_tmp;
}
if( shfolder_dll != NULL )
{
FreeLibrary( shfolder_dll );
}
#endif #endif
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment