about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/default.nix1
-rw-r--r--pkgs/santander/default.nix144
-rw-r--r--pkgs/santander/pipelight.patch13
-rw-r--r--pkgs/santander/wine-no-unixfs.patch292
-rw-r--r--pkgs/santander/winscard.patch11
5 files changed, 461 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 074f1130..56ffc98d 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -19,6 +19,7 @@ let
     list-gamecontrollers = callPackage ./list-gamecontrollers { };
     lockdev = callPackage ./lockdev { };
     pvolctrl = callPackage ./pvolctrl { };
+    santander = callPackage ./santander { };
     show-qr-code = callPackage ./show-qr-code { };
     sidplayfp = callPackage ./sidplayfp { };
     tkabber_urgent_plugin = callPackage ./tkabber-urgent-plugin { };
diff --git a/pkgs/santander/default.nix b/pkgs/santander/default.nix
new file mode 100644
index 00000000..27fd6f6a
--- /dev/null
+++ b/pkgs/santander/default.nix
@@ -0,0 +1,144 @@
+{ stdenv, pkgsi686Linux, fetchurl, fetchgit, fetchFromBitbucket
+, runCommand, writeScript, writeScriptBin, writeText
+, xvfb_run, xdotool, coreutils, wineStaging, pipelight, dwb
+}:
+
+let
+  name = "SecurityPluginHBCIChipcard";
+  version = "2.9.8.0";
+  dllName = "NP_${name}.dll";
+
+  pluginInstaller = fetchurl {
+    url = "https://service.santanderbank.de/special/banking/files/"
+        + "SecurityPluginHBCIChipcard-${version}-Installer.exe";
+    sha256 = "0xnfb730mwxdx83dnqyplp4bxwx6g01wc87xa4dl1spxia9kjmmh";
+  };
+
+  patchedWine = let
+    libpcsclite = "${pkgsi686Linux.pcsclite}/lib/libpcsclite.so";
+  in (wineStaging.override {
+    wineBuild = "wine32";
+  }).overrideDerivation (drv: {
+    scard4wine = fetchgit {
+      url = "git://git.code.sf.net/p/scard4wine/code";
+      rev = "c14c02c80bf1f2bb4cedd1f53a3a2ab9c48bed76";
+      sha256 = "0ffmbl9mdnaih4h3ggpnzqbih3kgbwl3wv6j1ag5s4czn8gcpdq3";
+    };
+
+    prePatch = (drv.prePatch or "") + ''
+      cp -t dlls/winscard "$scard4wine/src/"*
+      sed -i -re 's,"libpcsclite\.so(\.[0-9]+)*","${libpcsclite}",' \
+        dlls/winscard/winscard.c
+    '';
+
+    patches = (drv.patches or []) ++ [ ./winscard.patch ];
+
+    postPatch = (drv.postPatch or "") + ''
+      sed -i -e '/not owned by you/d' libs/wine/config.c
+      # Modified patch from https://bugs.winehq.org/show_bug.cgi?id=22450
+      patch -p1 < "${./wine-no-unixfs.patch}"
+    '';
+  });
+
+  installPath = [ "Program Files" "ppi" "SecurityPluginHBCIChipcard" ];
+
+  scard4wine = stdenv.mkDerivation rec {
+    name = "scard4wine-${version}";
+    version = "1.2.0-2016-06-05";
+
+    src = fetchgit {
+      url = "git://git.code.sf.net/p/scard4wine/code";
+      rev = "c14c02c80bf1f2bb4cedd1f53a3a2ab9c48bed76";
+      sha256 = "0ffmbl9mdnaih4h3ggpnzqbih3kgbwl3wv6j1ag5s4czn8gcpdq3";
+    };
+  };
+
+  winePrefix = runCommand "santander-wineprefix" {
+    installPath = stdenv.lib.concatStringsSep "/" (installPath ++ [ dllName ]);
+  } ''
+    export WINEPREFIX="$out"
+    mkdir -p "$out"
+    ${patchedWine}/bin/wine wineboot.exe
+    ${xvfb_run}/bin/xvfb-run "${writeScript "install-santander-wine" ''
+      ${patchedWine}/bin/wine "${pluginInstaller}" &
+      while [ "$(jobs -r | wc -l)" -gt 0 ]; do
+        ${xdotool}/bin/xdotool \
+          search --sync --onlyvisible \
+          --name 'Security-Plugin-HBCI-Chipcard ${version}' \
+          key Return &> /dev/null || :
+        sleep 1
+      done
+      wait
+    ''}"
+    if [ ! -e "$out/drive_c/$installPath" ]; then
+      echo "Unable to find plugin in $installPath." >&2
+      exit 1
+    fi
+    ln -sf -T "${builtins.storeDir}" "$WINEPREFIX/dosdevices/z:"
+    echo disable > "$WINEPREFIX/.update-timestamp"
+  '';
+
+  pluginConfig = {
+    winePath = "$share/wine";
+    inherit winePrefix dllName;
+    wineArch = "win32";
+    pluginLoaderPath = "$share/pluginloader.exe";
+    dllPath = "c:\\${stdenv.lib.concatStringsSep "\\" installPath}";
+  };
+
+  pipelightConfigFile = let
+    mkVal = val: if val == true then "true"
+            else if val == false then "false"
+            else toString val;
+    mkCfgLine = key: val: "# ${key} = ${mkVal val}";
+  in with stdenv.lib; writeText "pipelight-santander.config" ''
+    # ---BEGIN CONFIG---
+    ${concatStringsSep "\n" (mapAttrsToList mkCfgLine pluginConfig)}
+    # ---END CONFIG---
+  '';
+
+  finalPlugin = runCommand "santander-plugin" {
+    pipelight = (pipelight.override {
+      wineStaging = patchedWine;
+    }).overrideDerivation (drv: {
+      src = fetchFromBitbucket {
+        repo = "pipelight";
+        owner = "mmueller2012";
+        rev = "181bab804f80b99cb46f63f9ed36e4fdf12ca319";
+        sha256 = "0ydivpxayzs5aklf0x5vl5bl4issz10k7zl3cv76649kxxhxkh1z";
+      };
+
+      patches = [ ./pipelight.patch ];
+
+      postPatch = (drv.postPatch or "") + ''
+        sed -i -e '/static \+bool \+openConfig.*{$/,/}/ {
+          /getConfigNameFromLibrary/a \
+            configFile.open("${pipelightConfigFile}"); \
+            if (configFile.is_open()) return true;
+        }' src/linux/libpipelight/configloader.c
+      '';
+    });
+  } ''
+    install -vD "$pipelight/lib/pipelight/libpipelight.so" \
+      "$out/lib/pipelight/libpipelight-santander.so"
+  '';
+
+  dwbWithPlugin = stdenv.lib.overrideDerivation dwb (wrapperDrv: {
+    plugins = [ "${finalPlugin}/lib/pipelight" ];
+  });
+
+in writeScriptBin "santander" ''
+  #!${stdenv.shell}
+  if tmpdir="$("${coreutils}/bin/mktemp" -d)"; then
+    trap "rm -rf '$tmpdir'" EXIT
+    export XDG_RUNTIME_DIR="$tmpdir"
+    export XDG_CONFIG_HOME="$tmpdir"
+    export XDG_DATA_HOME="$tmpdir"
+    export XDG_CACHE_HOME="$tmpdir"
+    "${dwbWithPlugin}/bin/dwb" -t https://karte.santanderbank.de/
+    exit $?
+  else
+    echo "Unable to create temporary profile directory." >&2
+    exit 1
+  fi
+''
diff --git a/pkgs/santander/pipelight.patch b/pkgs/santander/pipelight.patch
new file mode 100644
index 00000000..3a07da72
--- /dev/null
+++ b/pkgs/santander/pipelight.patch
@@ -0,0 +1,13 @@
+diff --git a/src/windows/pluginloader/pluginloader.c b/src/windows/pluginloader/pluginloader.c
+index 9e8556f..c50be2a 100644
+--- a/src/windows/pluginloader/pluginloader.c
++++ b/src/windows/pluginloader/pluginloader.c
+@@ -1510,7 +1510,7 @@ void dispatcher(int functionid, Stack &stack){
+ 				NPObject *objectValue;
+ 				NPError result;
+ 
+-				if (variable == NPPVpluginScriptableNPObject)
++				if (variable == NPPVpluginScriptableNPObject && pluginFuncs.getvalue)
+ 					result = pluginFuncs.getvalue(instance, variable, &objectValue);
+ 				else{
+ 					DBG_WARN("FUNCTION_NPP_GETVALUE_OBJECT - variable %d not allowed", variable);
diff --git a/pkgs/santander/wine-no-unixfs.patch b/pkgs/santander/wine-no-unixfs.patch
new file mode 100644
index 00000000..b0e6a9e9
--- /dev/null
+++ b/pkgs/santander/wine-no-unixfs.patch
@@ -0,0 +1,292 @@
+diff -urN wine-1.9.7-orig/dlls/krnl386.exe16/int21.c wine-1.9.7/dlls/krnl386.exe16/int21.c
+--- wine-1.9.7-orig/dlls/krnl386.exe16/int21.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/krnl386.exe16/int21.c	2016-04-10 02:33:20 +0900
+@@ -35,6 +35,7 @@
+ # include <unistd.h>
+ #endif
+ 
++#include "ntstatus.h"
+ #include "windef.h"
+ #include "winbase.h"
+ #include "winreg.h"
+@@ -842,11 +843,13 @@
+  */
+ static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name )
+ {
++    HANDLE ret;
++    NTSTATUS status;
++
++#if 0
+     static const WCHAR prefixW[] = {'\\','?','?','\\','u','n','i','x'};
+     const char *dir = wine_get_server_dir();
+     int len;
+-    HANDLE ret;
+-    NTSTATUS status;
+     OBJECT_ATTRIBUTES attr;
+     UNICODE_STRING nameW;
+     IO_STATUS_BLOCK io;
+@@ -875,12 +878,16 @@
+     status = NtCreateFile( &ret, GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE, &attr, &io, NULL, 0,
+                            FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN_IF,
+                            FILE_SYNCHRONOUS_IO_ALERT, NULL, 0 );
++    RtlFreeUnicodeString( &nameW );
++#else
++    status = STATUS_NOT_IMPLEMENTED;
++#endif
++
+     if (status)
+     {
+         ret = 0;
+         SetLastError( RtlNtStatusToDosError(status) );
+     }
+-    RtlFreeUnicodeString( &nameW );
+     return ret;
+ }
+ 
+diff -urN wine-1.9.7-orig/dlls/krnl386.exe16/vxd.c wine-1.9.7/dlls/krnl386.exe16/vxd.c
+--- wine-1.9.7-orig/dlls/krnl386.exe16/vxd.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/krnl386.exe16/vxd.c	2016-04-10 02:33:20 +0900
+@@ -113,11 +113,13 @@
+ /* create a file handle to represent a VxD, by opening a dummy file in the wineserver directory */
+ static HANDLE open_vxd_handle( LPCWSTR name )
+ {
++    HANDLE ret;
++    NTSTATUS status;
++
++#if 0
+     static const WCHAR prefixW[] = {'\\','?','?','\\','u','n','i','x'};
+     const char *dir = wine_get_server_dir();
+     int len;
+-    HANDLE ret;
+-    NTSTATUS status;
+     OBJECT_ATTRIBUTES attr;
+     UNICODE_STRING nameW;
+     IO_STATUS_BLOCK io;
+@@ -146,12 +148,16 @@
+     status = NtCreateFile( &ret, SYNCHRONIZE, &attr, &io, NULL, 0,
+                            FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN_IF,
+                            FILE_SYNCHRONOUS_IO_ALERT, NULL, 0 );
++    RtlFreeUnicodeString( &nameW );
++#else
++    status = STATUS_NOT_IMPLEMENTED;
++#endif
++
+     if (status)
+     {
+         ret = 0;
+         SetLastError( RtlNtStatusToDosError(status) );
+     }
+-    RtlFreeUnicodeString( &nameW );
+     return ret;
+ }
+ 
+diff -urN wine-1.9.7-orig/dlls/ntdll/directory.c wine-1.9.7/dlls/ntdll/directory.c
+--- wine-1.9.7-orig/dlls/ntdll/directory.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/ntdll/directory.c	2016-04-10 02:33:20 +0900
+@@ -3098,8 +3098,10 @@
+ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
+                                           UINT disposition, BOOLEAN check_case )
+ {
++#if 0
+     static const WCHAR unixW[] = {'u','n','i','x'};
+     static const WCHAR pipeW[] = {'p','i','p','e'};
++#endif
+     static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 };
+ 
+     NTSTATUS status = STATUS_SUCCESS;
+@@ -3143,11 +3145,13 @@
+     name_len -= prefix_len;
+ 
+     /* check for invalid characters (all chars except 0 are valid for unix and pipes) */
++#if 0
+     if (prefix_len == 4)
+     {
+         is_unix = !memcmp( prefix, unixW, sizeof(unixW) );
+         is_pipe = !memcmp( prefix, pipeW, sizeof(pipeW) );
+     }
++#endif
+     if (is_unix || is_pipe)
+     {
+         for (p = name; p < name + name_len; p++)
+diff -urN wine-1.9.7-orig/dlls/ntdll/path.c wine-1.9.7/dlls/ntdll/path.c
+--- wine-1.9.7-orig/dlls/ntdll/path.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/ntdll/path.c	2016-04-10 02:33:20 +0900
+@@ -1025,7 +1025,9 @@
+ NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt )
+ {
+     static const WCHAR prefixW[] = {'\\','?','?','\\','A',':','\\'};
++#if 0
+     static const WCHAR unix_prefixW[] = {'\\','?','?','\\','u','n','i','x'};
++#endif
+     unsigned int lenW, lenA = name->Length;
+     const char *path = name->Buffer;
+     char *cwd;
+@@ -1065,6 +1067,7 @@
+ 
+     if (status != STATUS_SUCCESS)
+     {
++#if 0
+         if (status == STATUS_OBJECT_PATH_NOT_FOUND)
+         {
+             lenW = ntdll_umbstowcs( 0, path, lenA, NULL, 0 );
+@@ -1084,6 +1087,7 @@
+             for (p = nt->Buffer + sizeof(unix_prefixW)/sizeof(WCHAR); *p; p++) if (*p == '/') *p = '\\';
+             status = STATUS_SUCCESS;
+         }
++#endif
+         goto done;
+     }
+     while (lenA && path[0] == '/') { lenA--; path++; }
+diff -urN wine-1.9.7-orig/dlls/shell32/folders.c wine-1.9.7/dlls/shell32/folders.c
+--- wine-1.9.7-orig/dlls/shell32/folders.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/shell32/folders.c	2016-04-10 02:33:20 +0900
+@@ -236,9 +236,11 @@
+                 *piIndex = -IDI_SHELL_MY_DOCUMENTS;
+             else if(IsEqualGUID(riid, &CLSID_NetworkPlaces))
+                 *piIndex = -IDI_SHELL_MY_NETWORK_PLACES;
++#if 0
+             else if(IsEqualGUID(riid, &CLSID_UnixFolder) ||
+                     IsEqualGUID(riid, &CLSID_UnixDosFolder))
+                 *piIndex = -IDI_SHELL_DRIVE;
++#endif
+             else
+                 *piIndex = -IDI_SHELL_FOLDER;
+ 	  }
+diff -urN wine-1.9.7-orig/dlls/shell32/shellole.c wine-1.9.7/dlls/shell32/shellole.c
+--- wine-1.9.7-orig/dlls/shell32/shellole.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/shell32/shellole.c	2016-04-10 02:33:20 +0900
+@@ -78,8 +78,10 @@
+ 	{&CLSID_ShellFSFolder,	IFSFolder_Constructor},
+ 	{&CLSID_ShellItem,	IShellItem_Constructor},
+ 	{&CLSID_ShellLink,	IShellLink_Constructor},
++#if 0
+ 	{&CLSID_UnixDosFolder,  UnixDosFolder_Constructor},
+ 	{&CLSID_UnixFolder,     UnixFolder_Constructor},
++#endif
+ 	{&CLSID_ExplorerBrowser,ExplorerBrowser_Constructor},
+ 	{&CLSID_KnownFolderManager, KnownFolderManager_Constructor},
+ 	{&CLSID_Shell,          IShellDispatch_Constructor},
+diff -urN wine-1.9.7-orig/dlls/shell32/shellpath.c wine-1.9.7/dlls/shell32/shellpath.c
+--- wine-1.9.7-orig/dlls/shell32/shellpath.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/shell32/shellpath.c	2016-04-10 02:33:20 +0900
+@@ -4481,9 +4481,11 @@
+         DWORD call_for_attr;
+     } folders[] =
+     {
++#if 0
+         { &CLSID_UnixFolder, TRUE, FALSE, FALSE },
+         { &CLSID_UnixDosFolder, TRUE, FALSE, FALSE,
+           SFGAO_FILESYSANCESTOR|SFGAO_FOLDER|SFGAO_HASSUBFOLDER, SFGAO_FILESYSTEM },
++#endif
+         { &CLSID_FolderShortcut, FALSE, FALSE, FALSE,
+           SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_LINK,
+           SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR },
+@@ -4613,9 +4615,11 @@
+             *ppidl = _ILCreateDesktop();
+             break;
+ 
++#if 0
+         case CSIDL_PERSONAL:
+             *ppidl = _ILCreateMyDocuments();
+             break;
++#endif
+ 
+         case CSIDL_INTERNET:
+             *ppidl = _ILCreateIExplore();
+diff -urN wine-1.9.7-orig/dlls/shell32/shfldr.h wine-1.9.7/dlls/shell32/shfldr.h
+--- wine-1.9.7-orig/dlls/shell32/shfldr.h	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/shell32/shfldr.h	2016-04-10 02:33:20 +0900
+@@ -75,5 +75,7 @@
+ void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags) DECLSPEC_HIDDEN;
+ BOOL SHELL_FS_HideExtension(LPCWSTR pwszPath) DECLSPEC_HIDDEN;
+ 
++#if 0
+ DEFINE_GUID( CLSID_UnixFolder, 0xcc702eb2, 0x7dc5, 0x11d9, 0xc6, 0x87, 0x00, 0x04, 0x23, 0x8a, 0x01, 0xcd );
+ DEFINE_GUID( CLSID_UnixDosFolder, 0x9d20aae8, 0x0625, 0x44b0, 0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9 );
++#endif
+diff -urN wine-1.9.7-orig/dlls/shell32/shfldr_desktop.c wine-1.9.7/dlls/shell32/shfldr_desktop.c
+--- wine-1.9.7-orig/dlls/shell32/shfldr_desktop.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/shell32/shfldr_desktop.c	2016-04-10 02:33:20 +0900
+@@ -186,26 +186,30 @@
+     }
+     else if (PathGetDriveNumberW (lpszDisplayName) >= 0)
+     {
++#if 0
+         /*
+          * UNIXFS can't handle drives without a mount point yet. We fall back
+          * to use the MyComputer interface if we can't get the file attributes
+          * on the device.
+          */
+         char drivePath[] = "A:\\";
+         drivePath[0] = 'A' + PathGetDriveNumberW(lpszDisplayName);
+ 
+         /* it's a filesystem path with a drive. Let MyComputer/UnixDosFolder parse it */
+         if (UNIXFS_is_rooted_at_desktop() &&
+             GetFileAttributesA(drivePath) != INVALID_FILE_ATTRIBUTES)
+         {
+             pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder);
+             TRACE("Using unixfs for %s\n", debugstr_w(lpszDisplayName));
+         }
+         else
+         {
++#endif
+             pidlTemp = _ILCreateMyComputer ();
+             TRACE("Using MyComputer for %s\n", debugstr_w(lpszDisplayName));
++#if 0
+         }
++#endif
+         szNext = lpszDisplayName;
+     }
+     else if (PathIsUNCW(lpszDisplayName))
+diff -urN wine-1.9.7-orig/dlls/shell32/shfldr_unixfs.c wine-1.9.7/dlls/shell32/shfldr_unixfs.c
+--- wine-1.9.7-orig/dlls/shell32/shfldr_unixfs.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/dlls/shell32/shfldr_unixfs.c	2016-04-10 02:33:20 +0900
+@@ -167,7 +167,7 @@
+ 
+ WINE_DEFAULT_DEBUG_CHANNEL(shell);
+ 
+-#if !defined(__MINGW32__) && !defined(_MSC_VER)
++#if 0
+ 
+ #define LEN_SHITEMID_FIXED_PART ((USHORT) \
+     ( sizeof(USHORT)      /* SHITEMID's cb field. */ \
+@@ -2569,6 +2569,7 @@
+  *  FALSE, if not.
+  */
+ BOOL UNIXFS_is_rooted_at_desktop(void) {
++#if 0
+     HKEY hKey;
+     WCHAR wszRootedAtDesktop[69 + CHARS_IN_GUID] = {
+         'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
+@@ -2582,5 +2583,6 @@
+         RegCloseKey(hKey);
+         return TRUE;
+     }
++#endif
+     return FALSE;
+ }
+diff -urN wine-1.9.7-orig/include/config.h.in wine-1.9.7/include/config.h.in
+--- wine-1.9.7-orig/include/config.h.in	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/include/config.h.in	2016-04-10 02:33:20 +0900
+@@ -7,6 +7,9 @@
+ /* Define to a function attribute for Microsoft hotpatch assembly prefix. */
+ #undef DECLSPEC_HOTPATCH
+ 
++/* Define to enable unixfs */
++#undef ENABLE_UNIXFS
++
+ /* Define to the file extension for executables. */
+ #undef EXEEXT
+ 
+diff -urN wine-1.9.7-orig/programs/wineboot/wineboot.c wine-1.9.7/programs/wineboot/wineboot.c
+--- wine-1.9.7-orig/programs/wineboot/wineboot.c	2016-04-02 00:02:39 +0900
++++ wine-1.9.7/programs/wineboot/wineboot.c	2016-04-10 02:33:20 +0900
+@@ -946,7 +946,7 @@
+                                      'I','n','s','t','a','l','l','H','i','n','f','S','e','c','t','i','o','n',0};
+     static const WCHAR definstall[] = {' ','D','e','f','a','u','l','t','I','n','s','t','a','l','l',0};
+     static const WCHAR wowinstall[] = {' ','W','o','w','6','4','I','n','s','t','a','l','l',0};
+-    static const WCHAR inf[] = {' ','1','2','8',' ','\\','\\','?','\\','u','n','i','x',0 };
++    static const WCHAR inf[] = {' ','1','2','8',' ','z',':',0 };
+ 
+     WCHAR app[MAX_PATH + sizeof(rundll)/sizeof(WCHAR)];
+     STARTUPINFOW si;
diff --git a/pkgs/santander/winscard.patch b/pkgs/santander/winscard.patch
new file mode 100644
index 00000000..7dfa04ac
--- /dev/null
+++ b/pkgs/santander/winscard.patch
@@ -0,0 +1,11 @@
+--- a/dlls/winscard/winscard.c	1970-01-01 01:00:01.000000000 +0100
++++ b/dlls/winscard/winscard.c	2016-06-06 01:52:53.631444433 +0200
+@@ -1527,7 +1527,7 @@
+ {

+     LONG lRet;

+     TRACE(" 0x%08X %p %p %p %p %p %p\n",(unsigned int) hCard,mszReaderNames,pcchReaderLen,pdwState,pdwProtocol,pbAtr,pcbAtrLen);

+-    if(!pcchReaderLen || !pdwState || !pdwProtocol || !pcbAtrLen)

++    if(!pcchReaderLen || !pcbAtrLen)

+         lRet = SCARD_E_INVALID_PARAMETER;

+     else if(!liteSCardStatus)

+         lRet = SCARD_F_INTERNAL_ERROR;