Commit a9ad4a4a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

Win32: use directly SHGetFolderPath

This drops support for IE < 5.0
parent 663c76c5
......@@ -112,10 +112,10 @@ case x"${host_os}" in
;;
x*msvc*)
SYS_MSVC=1
AC_DEFINE([_WIN32_IE], 0x0401, [Define to '0x0401' for IE 4.01 (and shell) APIs.])
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
x*mingw* | *wince* | *mingwce*)
AC_DEFINE([_WIN32_IE], 0x0401, [Define to '0x0401' for IE 4.01 (and shell) APIs.])
AC_DEFINE([_WIN32_IE], 0x0500, [Define to '0x0500' for IE 5.0 (and shell) APIs.])
;;
x*)
;;
......
......@@ -30,13 +30,14 @@
/* #undef HPUX_SCTL_IO */
#define PACKAGE "libdvdcss"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_NAME "libdvdcss"
#define PACKAGE_STRING "libdvdcss 1.2.13"
#define PACKAGE_TARNAME "libdvdcss"
#define PACKAGE_VERSION ""
/* #undef SOLARIS_USCSI */
#define STDC_HEADERS 1
#define VERSION "1.2.11"
#define VERSION "1.2.13"
#define _WIN32_IE 0x0500
/* #undef const */
/* #undef inline */
/* #undef size_t */
......
......@@ -119,6 +119,10 @@
# include <limits.h>
#endif
#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
# include <shlobj.h>
#endif
#include "dvdcss/dvdcss.h"
#include "common.h"
......@@ -238,46 +242,15 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
*/
if( psz_cache == NULL || psz_cache[0] == '\0' )
{
#if defined(_WIN32_IE) && _WIN32_IE >= 0x401
typedef HRESULT( WINAPI *SHGETFOLDERPATH )
( HWND, int, HANDLE, DWORD, LPTSTR );
# define CSIDL_FLAG_CREATE 0x8000
# define CSIDL_APPDATA 0x1A
# define SHGFP_TYPE_CURRENT 0
#if defined(_WIN32_IE) && _WIN32_IE >= 0x500
char psz_home[MAX_PATH];
HINSTANCE p_dll;
SHGETFOLDERPATH p_getpath;
*psz_home = '\0';
/* Load the shfolder DLL to retrieve SHGetFolderPath */
p_dll = LoadLibrary( "shfolder.dll" );
if( p_dll )
{
p_getpath = (void*)GetProcAddress( p_dll, "SHGetFolderPathA" );
if( p_getpath )
{
/* Get the "Application Data" folder for the current user */
if( p_getpath( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK )
{
FreeLibrary( p_dll );
}
else
{
*psz_home = '\0';
}
}
FreeLibrary( p_dll );
}
/* Cache our keys in
* C:\Documents and Settings\$USER\Application Data\dvdcss\ */
if( *psz_home )
if (SHGetFolderPathA (NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT, psz_home ) == S_OK)
{
snprintf( psz_buffer, PATH_MAX, "%s/dvdcss", psz_home );
snprintf( psz_buffer, PATH_MAX, "%s\\dvdcss", psz_home );
psz_buffer[PATH_MAX-1] = '\0';
psz_cache = psz_buffer;
}
......
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