Changeset 48eb86c62db5e181ba74436b34f6d0ff11a8a14d
- 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
| rd4384d0 |
r48eb86c |
|
| 1780 | 1780 | { |
|---|
| 1781 | 1781 | #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"; |
|---|
| 1783 | 1784 | typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD, |
|---|
| 1784 | | LPSTR ); |
|---|
| | 1785 | LPWSTR ); |
|---|
| 1785 | 1786 | HINSTANCE shfolder_dll = NULL; |
|---|
| 1786 | 1787 | SHGETFOLDERPATH dSHGetFolderPath = NULL; |
|---|
| | 1788 | wchar_t wpath[PATH_MAX]; |
|---|
| 1787 | 1789 | |
|---|
| 1788 | 1790 | if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL ) |
|---|
| … | … | |
| 1790 | 1792 | dSHGetFolderPath = |
|---|
| 1791 | 1793 | (SHGETFOLDERPATH)GetProcAddress( shfolder_dll, |
|---|
| 1792 | | _T("SHGetFolderPathA") ); |
|---|
| | 1794 | _T("SHGetFolderPathW") ); |
|---|
| 1793 | 1795 | } |
|---|
| 1794 | 1796 | |
|---|
| 1795 | 1797 | if( dSHGetFolderPath != NULL && |
|---|
| 1796 | 1798 | 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 ); |
|---|
| 1803 | 1808 | strncpy( p_tmp, psz_path, sizeof( p_tmp ) - 1 ); |
|---|
| 1804 | 1809 | p_tmp[sizeof( p_tmp ) - 1] = '\0'; |
|---|
| 1805 | | LocaleFree( psz_path ); |
|---|
| | 1810 | free( psz_path ); |
|---|
| 1806 | 1811 | psz_path = p_tmp; |
|---|
| 1807 | 1812 | } |
|---|