* drms.c : DRMS
*****************************************************************************
* Copyright (C) 2004 VideoLAN
- * $Id: drms.c,v 1.3 2004/01/09 13:08:08 hartman Exp $
+ * $Id: drms.c,v 1.4 2004/01/09 17:29:17 jlj Exp $
*
* Author: Jon Lech Johansen <jon-vl@nanocrew.net>
*
TCHAR p_path[ PATH_MAX ];
TCHAR *p_filename = _T("\\Apple Computer\\iTunes\\SC Info\\SC Info.sidb");
- if( SUCCEEDED( SHGetFolderPath( NULL, CSIDL_COMMON_APPDATA,
- NULL, 0, p_path ) ) )
+ typedef HRESULT (WINAPI *SHGETFOLDERPATH)( HWND, int, HANDLE, DWORD,
+ LPTSTR );
+
+ HINSTANCE shfolder_dll = NULL;
+ SHGETFOLDERPATH dSHGetFolderPath = NULL;
+
+ if( ( shfolder_dll = LoadLibrary( _T("SHFolder.dll") ) ) != NULL )
+ {
+ dSHGetFolderPath =
+ (SHGETFOLDERPATH)GetProcAddress( shfolder_dll,
+#ifdef _UNICODE
+ _T("SHGetFolderPathW") );
+#else
+ _T("SHGetFolderPathA") );
+#endif
+ }
+
+ if( dSHGetFolderPath != NULL &&
+ SUCCEEDED( dSHGetFolderPath( NULL, CSIDL_COMMON_APPDATA,
+ NULL, 0, p_path ) ) )
{
_tcsncat( p_path, p_filename, min( _tcslen( p_filename ),
(PATH_MAX-1) - _tcslen( p_path ) ) );
CloseHandle( i_file );
}
}
+
+ if( shfolder_dll != NULL )
+ {
+ FreeLibrary( shfolder_dll );
+ }
#endif
return( i_ret );