Changeset 48eb86c62db5e181ba74436b34f6d0ff11a8a14d

Show
Ignore:
Timestamp:
11/11/06 18:07:56 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1163264876 +0000
git-parent:

[b8f4ee2e482ab89757bb0a5dde58830f38deef12]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1163264876 +0000
Message:

DRMS: use Unicode Win32 API

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/mp4/drms.c

    rd4384d0 r48eb86c  
    17801780    { 
    17811781#ifdef WIN32 
    1782         char *p_filename = "\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb"; 
     1782        const wchar_t *wfile = 
     1783                L"\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb"; 
    17831784        typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, 
    1784                                                    LPSTR ); 
     1785                                                   LPWSTR ); 
    17851786        HINSTANCE shfolder_dll = NULL; 
    17861787        SHGETFOLDERPATH dSHGetFolderPath = NULL; 
     1788        wchar_t wpath[PATH_MAX]; 
    17871789 
    17881790        if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL ) 
     
    17901792            dSHGetFolderPath = 
    17911793                (SHGETFOLDERPATH)GetProcAddress( shfolder_dll, 
    1792                                                  _T("SHGetFolderPathA") ); 
     1794                                                 _T("SHGetFolderPathW") ); 
    17931795        } 
    17941796 
    17951797        if( dSHGetFolderPath != NULL && 
    17961798            SUCCEEDED( dSHGetFolderPath( NULL, CSIDL_COMMON_APPDATA, 
    1797                                          NULL, 0, p_tmp ) ) ) 
    1798         { 
    1799             strncat( p_tmp, p_filename, min( strlen( p_filename ), 
    1800                      (sizeof(p_tmp) - 1) - strlen( p_tmp ) ) ); 
    1801  
    1802             psz_path = FromLocale( p_tmp ); 
     1799                                         NULL, 0, wpath ) ) ) 
     1800        { 
     1801            if (wcslen( wpath ) + wcslen( wfile ) >= PATH_MAX ) 
     1802            { 
     1803                return -1; 
     1804            } 
     1805            wcscat( wpath, wfile ); 
     1806 
     1807            psz_path = FromWide( wpath ); 
    18031808            strncpy( p_tmp, psz_path, sizeof( p_tmp ) - 1 ); 
    18041809            p_tmp[sizeof( p_tmp ) - 1] = '\0'; 
    1805             LocaleFree( psz_path ); 
     1810            free( psz_path ); 
    18061811            psz_path = p_tmp; 
    18071812        }