ref: a9ad4a4a5c75f94decff6ec0bbc3b5440f55652e
parent: 663c76c5b62faf274467d17aaa218f3fddc49606
author: Jean-Baptiste Kempf <[email protected]>
date: Mon Mar 11 07:36:47 EDT 2013
Win32: use directly SHGetFolderPath This drops support for IE < 5.0
--- a/configure.ac
+++ b/configure.ac
@@ -112,10 +112,10 @@
;;
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*)
;;
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -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 */
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -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 @@
*/
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;
}