Win32 build fixes for smartcard

These are some minor changes I had to make to get a good build under Windows supporting smartcard.  These changes are based off the latest master branch.