Check-in [ec1f93c869]
Overview
Comment:Added mostly-compiling Win32 support

Added local copy of RSA PKCS#11

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ec1f93c86920f9f6841b9ef91f5f719e11d1d623
User & Date: rkeene on 2010-10-15 09:53:09
Other Links: manifest | tags
Context
2010-10-15
10:20
Added local definitions of T=1 and T=0 protocols on Win32 build (seems to be missing from library) check-in: c3a8fe4086 user: rkeene tags: trunk
09:53
Added mostly-compiling Win32 support

Added local copy of RSA PKCS#11 check-in: ec1f93c869 user: rkeene tags: trunk

2010-10-10
09:10
CACKey 0.5.20

Updated CACKey to not require pReserved to be set to NULL

Fixed bug where Sign and Decrypt operations would not terminate correctly check-in: 8aec474c2b user: rkeene tags: trunk, 0.5.20

Changes

Modified Makefile.in from [eb1d7f3b77] to [51fdebc8fd].

    49     49   	rm -f "$(DESTDIR)$(libdir)/libcackey.@SHOBJEXT@"
    50     50   	rm -f "$(DESTDIR)$(libdir)/libcackey_g.@SHOBJEXT@"
    51     51   	cp "libcackey.@SHOBJEXT@" "$(DESTDIR)$(libdir)/"
    52     52   	-cp "libcackey_g.@SHOBJEXT@" "$(DESTDIR)$(libdir)/"
    53     53   
    54     54   clean:
    55     55   	rm -f libcackey.@SHOBJEXT@ libcackey_g.@SHOBJEXT@
           56  +	rm -f libcackey.@SHOBJEXT@.def libcackey_g.@SHOBJEXT@.def
           57  +	rm -f libcackey.@SHOBJEXT@.a libcackey_g.@SHOBJEXT@.a
    56     58   	rm -f cackey.o asn1-x509.o cackey_g.o asn1-x509_g.o
    57     59   	rm -f test
    58     60   	rm -f splint-cackey.txt
    59     61   
    60     62   distclean: clean
    61     63   	rm -f config.log config.status config.h Makefile
    62     64   
    63     65   mrproper: distclean
    64     66   	rm -f configure config.h.in aclocal.m4 *~
    65     67   
    66     68   .PHONY: all clean distclean mrproper install

Added build/cackey_win32_build/build.sh version [443ec84893].

            1  +./configure --with-pcsc-headers=/home/u4423rsk/devel/pcsc_cac/cackey/build/cackey_win32_build/include --with-pcsc-libs=-L/home/u4423rsk/devel/pcsc_cac/cackey/build/cackey_win32_build/lib -lwinscard --host=i586-mingw32msvc  CPPFLAGS="-I/home/u4423rsk/devel/pcsc_cac/cackey/build/cackey_win32_build/include"

Added build/cackey_win32_build/include/SCardErr.h version [969de80f85].

            1  +/*
            2  + scarderr.mc
            3  +
            4  +   Error message codes from the Smart Card Resource Manager
            5  +   These messages must be reconciled with winerror.w
            6  +   They exist here to provide error messages on pre-Win2K systems.
            7  +
            8  +*/
            9  +#ifndef SCARD_S_SUCCESS
           10  +//
           11  +// =============================
           12  +// Facility SCARD Error Messages
           13  +// =============================
           14  +//
           15  +#define SCARD_S_SUCCESS NO_ERROR
           16  +//
           17  +//  Values are 32 bit values laid out as follows:
           18  +//
           19  +//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
           20  +//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
           21  +//  +---+-+-+-----------------------+-------------------------------+
           22  +//  |Sev|C|R|     Facility          |               Code            |
           23  +//  +---+-+-+-----------------------+-------------------------------+
           24  +//
           25  +//  where
           26  +//
           27  +//      Sev - is the severity code
           28  +//
           29  +//          00 - Success
           30  +//          01 - Informational
           31  +//          10 - Warning
           32  +//          11 - Error
           33  +//
           34  +//      C - is the Customer code flag
           35  +//
           36  +//      R - is a reserved bit
           37  +//
           38  +//      Facility - is the facility code
           39  +//
           40  +//      Code - is the facility's status code
           41  +//
           42  +//
           43  +// Define the facility codes
           44  +//
           45  +#define FACILITY_SYSTEM                  0x0
           46  +#define FACILITY_SCARD                   0x10
           47  +
           48  +
           49  +//
           50  +// Define the severity codes
           51  +//
           52  +#define STATUS_SEVERITY_WARNING          0x2
           53  +#define STATUS_SEVERITY_INFORMATIONAL    0x1
           54  +#define STATUS_SEVERITY_ERROR            0x3
           55  +
           56  +
           57  +//
           58  +// MessageId: SCARD_F_INTERNAL_ERROR
           59  +//
           60  +// MessageText:
           61  +//
           62  +// An internal consistency check failed.
           63  +//
           64  +#define SCARD_F_INTERNAL_ERROR           ((DWORD)0x80100001L)
           65  +
           66  +//
           67  +// MessageId: SCARD_E_CANCELLED
           68  +//
           69  +// MessageText:
           70  +//
           71  +// The action was cancelled by an SCardCancel request.
           72  +//
           73  +#define SCARD_E_CANCELLED                ((DWORD)0x80100002L)
           74  +
           75  +//
           76  +// MessageId: SCARD_E_INVALID_HANDLE
           77  +//
           78  +// MessageText:
           79  +//
           80  +// The supplied handle was invalid.
           81  +//
           82  +#define SCARD_E_INVALID_HANDLE           ((DWORD)0x80100003L)
           83  +
           84  +//
           85  +// MessageId: SCARD_E_INVALID_PARAMETER
           86  +//
           87  +// MessageText:
           88  +//
           89  +// One or more of the supplied parameters could not be properly interpreted.
           90  +//
           91  +#define SCARD_E_INVALID_PARAMETER        ((DWORD)0x80100004L)
           92  +
           93  +//
           94  +// MessageId: SCARD_E_INVALID_TARGET
           95  +//
           96  +// MessageText:
           97  +//
           98  +// Registry startup information is missing or invalid.
           99  +//
          100  +#define SCARD_E_INVALID_TARGET           ((DWORD)0x80100005L)
          101  +
          102  +//
          103  +// MessageId: SCARD_E_NO_MEMORY
          104  +//
          105  +// MessageText:
          106  +//
          107  +// Not enough memory available to complete this command.
          108  +//
          109  +#define SCARD_E_NO_MEMORY                ((DWORD)0x80100006L)
          110  +
          111  +//
          112  +// MessageId: SCARD_F_WAITED_TOO_LONG
          113  +//
          114  +// MessageText:
          115  +//
          116  +// An internal consistency timer has expired.
          117  +//
          118  +#define SCARD_F_WAITED_TOO_LONG          ((DWORD)0x80100007L)
          119  +
          120  +//
          121  +// MessageId: SCARD_E_INSUFFICIENT_BUFFER
          122  +//
          123  +// MessageText:
          124  +//
          125  +// The data buffer to receive returned data is too small for the returned data.
          126  +//
          127  +#define SCARD_E_INSUFFICIENT_BUFFER      ((DWORD)0x80100008L)
          128  +
          129  +//
          130  +// MessageId: SCARD_E_UNKNOWN_READER
          131  +//
          132  +// MessageText:
          133  +//
          134  +// The specified reader name is not recognized.
          135  +//
          136  +#define SCARD_E_UNKNOWN_READER           ((DWORD)0x80100009L)
          137  +
          138  +//
          139  +// MessageId: SCARD_E_TIMEOUT
          140  +//
          141  +// MessageText:
          142  +//
          143  +// The user-specified timeout value has expired.
          144  +//
          145  +#define SCARD_E_TIMEOUT                  ((DWORD)0x8010000AL)
          146  +
          147  +//
          148  +// MessageId: SCARD_E_SHARING_VIOLATION
          149  +//
          150  +// MessageText:
          151  +//
          152  +// The smart card cannot be accessed because of other connections outstanding.
          153  +//
          154  +#define SCARD_E_SHARING_VIOLATION        ((DWORD)0x8010000BL)
          155  +
          156  +//
          157  +// MessageId: SCARD_E_NO_SMARTCARD
          158  +//
          159  +// MessageText:
          160  +//
          161  +// The operation requires a Smart Card, but no Smart Card is currently in the device.
          162  +//
          163  +#define SCARD_E_NO_SMARTCARD             ((DWORD)0x8010000CL)
          164  +
          165  +//
          166  +// MessageId: SCARD_E_UNKNOWN_CARD
          167  +//
          168  +// MessageText:
          169  +//
          170  +// The specified smart card name is not recognized.
          171  +//
          172  +#define SCARD_E_UNKNOWN_CARD             ((DWORD)0x8010000DL)
          173  +
          174  +//
          175  +// MessageId: SCARD_E_CANT_DISPOSE
          176  +//
          177  +// MessageText:
          178  +//
          179  +// The system could not dispose of the media in the requested manner.
          180  +//
          181  +#define SCARD_E_CANT_DISPOSE             ((DWORD)0x8010000EL)
          182  +
          183  +//
          184  +// MessageId: SCARD_E_PROTO_MISMATCH
          185  +//
          186  +// MessageText:
          187  +//
          188  +// The requested protocols are incompatible with the protocol currently in use with the smart card.
          189  +//
          190  +#define SCARD_E_PROTO_MISMATCH           ((DWORD)0x8010000FL)
          191  +
          192  +//
          193  +// MessageId: SCARD_E_NOT_READY
          194  +//
          195  +// MessageText:
          196  +//
          197  +// The reader or smart card is not ready to accept commands.
          198  +//
          199  +#define SCARD_E_NOT_READY                ((DWORD)0x80100010L)
          200  +
          201  +//
          202  +// MessageId: SCARD_E_INVALID_VALUE
          203  +//
          204  +// MessageText:
          205  +//
          206  +// One or more of the supplied parameters values could not be properly interpreted.
          207  +//
          208  +#define SCARD_E_INVALID_VALUE            ((DWORD)0x80100011L)
          209  +
          210  +//
          211  +// MessageId: SCARD_E_SYSTEM_CANCELLED
          212  +//
          213  +// MessageText:
          214  +//
          215  +// The action was cancelled by the system, presumably to log off or shut down.
          216  +//
          217  +#define SCARD_E_SYSTEM_CANCELLED         ((DWORD)0x80100012L)
          218  +
          219  +//
          220  +// MessageId: SCARD_F_COMM_ERROR
          221  +//
          222  +// MessageText:
          223  +//
          224  +// An internal communications error has been detected.
          225  +//
          226  +#define SCARD_F_COMM_ERROR               ((DWORD)0x80100013L)
          227  +
          228  +//
          229  +// MessageId: SCARD_F_UNKNOWN_ERROR
          230  +//
          231  +// MessageText:
          232  +//
          233  +// An internal error has been detected, but the source is unknown.
          234  +//
          235  +#define SCARD_F_UNKNOWN_ERROR            ((DWORD)0x80100014L)
          236  +
          237  +//
          238  +// MessageId: SCARD_E_INVALID_ATR
          239  +//
          240  +// MessageText:
          241  +//
          242  +// An ATR obtained from the registry is not a valid ATR string.
          243  +//
          244  +#define SCARD_E_INVALID_ATR              ((DWORD)0x80100015L)
          245  +
          246  +//
          247  +// MessageId: SCARD_E_NOT_TRANSACTED
          248  +//
          249  +// MessageText:
          250  +//
          251  +// An attempt was made to end a non-existent transaction.
          252  +//
          253  +#define SCARD_E_NOT_TRANSACTED           ((DWORD)0x80100016L)
          254  +
          255  +//
          256  +// MessageId: SCARD_E_READER_UNAVAILABLE
          257  +//
          258  +// MessageText:
          259  +//
          260  +// The specified reader is not currently available for use.
          261  +//
          262  +#define SCARD_E_READER_UNAVAILABLE       ((DWORD)0x80100017L)
          263  +
          264  +//
          265  +// MessageId: SCARD_P_SHUTDOWN
          266  +//
          267  +// MessageText:
          268  +//
          269  +// The operation has been aborted to allow the server application to exit.
          270  +//
          271  +#define SCARD_P_SHUTDOWN                 ((DWORD)0x80100018L)
          272  +
          273  +//
          274  +// MessageId: SCARD_E_PCI_TOO_SMALL
          275  +//
          276  +// MessageText:
          277  +//
          278  +// The PCI Receive buffer was too small.
          279  +//
          280  +#define SCARD_E_PCI_TOO_SMALL            ((DWORD)0x80100019L)
          281  +
          282  +//
          283  +// MessageId: SCARD_E_READER_UNSUPPORTED
          284  +//
          285  +// MessageText:
          286  +//
          287  +// The reader driver does not meet minimal requirements for support.
          288  +//
          289  +#define SCARD_E_READER_UNSUPPORTED       ((DWORD)0x8010001AL)
          290  +
          291  +//
          292  +// MessageId: SCARD_E_DUPLICATE_READER
          293  +//
          294  +// MessageText:
          295  +//
          296  +// The reader driver did not produce a unique reader name.
          297  +//
          298  +#define SCARD_E_DUPLICATE_READER         ((DWORD)0x8010001BL)
          299  +
          300  +//
          301  +// MessageId: SCARD_E_CARD_UNSUPPORTED
          302  +//
          303  +// MessageText:
          304  +//
          305  +// The smart card does not meet minimal requirements for support.
          306  +//
          307  +#define SCARD_E_CARD_UNSUPPORTED         ((DWORD)0x8010001CL)
          308  +
          309  +//
          310  +// MessageId: SCARD_E_NO_SERVICE
          311  +//
          312  +// MessageText:
          313  +//
          314  +// The Smart card resource manager is not running.
          315  +//
          316  +#define SCARD_E_NO_SERVICE               ((DWORD)0x8010001DL)
          317  +
          318  +//
          319  +// MessageId: SCARD_E_SERVICE_STOPPED
          320  +//
          321  +// MessageText:
          322  +//
          323  +// The Smart card resource manager has shut down.
          324  +//
          325  +#define SCARD_E_SERVICE_STOPPED          ((DWORD)0x8010001EL)
          326  +
          327  +//
          328  +// MessageId: SCARD_E_UNEXPECTED
          329  +//
          330  +// MessageText:
          331  +//
          332  +// An unexpected card error has occurred.
          333  +//
          334  +#define SCARD_E_UNEXPECTED               ((DWORD)0x8010001FL)
          335  +
          336  +//
          337  +// MessageId: SCARD_E_ICC_INSTALLATION
          338  +//
          339  +// MessageText:
          340  +//
          341  +// No Primary Provider can be found for the smart card.
          342  +//
          343  +#define SCARD_E_ICC_INSTALLATION         ((DWORD)0x80100020L)
          344  +
          345  +//
          346  +// MessageId: SCARD_E_ICC_CREATEORDER
          347  +//
          348  +// MessageText:
          349  +//
          350  +// The requested order of object creation is not supported.
          351  +//
          352  +#define SCARD_E_ICC_CREATEORDER          ((DWORD)0x80100021L)
          353  +
          354  +//
          355  +// MessageId: SCARD_E_UNSUPPORTED_FEATURE
          356  +//
          357  +// MessageText:
          358  +//
          359  +// This smart card does not support the requested feature.
          360  +//
          361  +#define SCARD_E_UNSUPPORTED_FEATURE      ((DWORD)0x80100022L)
          362  +
          363  +//
          364  +// MessageId: SCARD_E_DIR_NOT_FOUND
          365  +//
          366  +// MessageText:
          367  +//
          368  +// The identified directory does not exist in the smart card.
          369  +//
          370  +#define SCARD_E_DIR_NOT_FOUND            ((DWORD)0x80100023L)
          371  +
          372  +//
          373  +// MessageId: SCARD_E_FILE_NOT_FOUND
          374  +//
          375  +// MessageText:
          376  +//
          377  +// The identified file does not exist in the smart card.
          378  +//
          379  +#define SCARD_E_FILE_NOT_FOUND           ((DWORD)0x80100024L)
          380  +
          381  +//
          382  +// MessageId: SCARD_E_NO_DIR
          383  +//
          384  +// MessageText:
          385  +//
          386  +// The supplied path does not represent a smart card directory.
          387  +//
          388  +#define SCARD_E_NO_DIR                   ((DWORD)0x80100025L)
          389  +
          390  +//
          391  +// MessageId: SCARD_E_NO_FILE
          392  +//
          393  +// MessageText:
          394  +//
          395  +// The supplied path does not represent a smart card file.
          396  +//
          397  +#define SCARD_E_NO_FILE                  ((DWORD)0x80100026L)
          398  +
          399  +//
          400  +// MessageId: SCARD_E_NO_ACCESS
          401  +//
          402  +// MessageText:
          403  +//
          404  +// Access is denied to this file.
          405  +//
          406  +#define SCARD_E_NO_ACCESS                ((DWORD)0x80100027L)
          407  +
          408  +//
          409  +// MessageId: SCARD_E_WRITE_TOO_MANY
          410  +//
          411  +// MessageText:
          412  +//
          413  +// The smartcard does not have enough memory to store the information.
          414  +//
          415  +#define SCARD_E_WRITE_TOO_MANY           ((DWORD)0x80100028L)
          416  +
          417  +//
          418  +// MessageId: SCARD_E_BAD_SEEK
          419  +//
          420  +// MessageText:
          421  +//
          422  +// There was an error trying to set the smart card file object pointer.
          423  +//
          424  +#define SCARD_E_BAD_SEEK                 ((DWORD)0x80100029L)
          425  +
          426  +//
          427  +// MessageId: SCARD_E_INVALID_CHV
          428  +//
          429  +// MessageText:
          430  +//
          431  +// The supplied PIN is incorrect.
          432  +//
          433  +#define SCARD_E_INVALID_CHV              ((DWORD)0x8010002AL)
          434  +
          435  +//
          436  +// MessageId: SCARD_E_UNKNOWN_RES_MNG
          437  +//
          438  +// MessageText:
          439  +//
          440  +// An unrecognized error code was returned from a layered component.
          441  +//
          442  +#define SCARD_E_UNKNOWN_RES_MNG          ((DWORD)0x8010002BL)
          443  +
          444  +//
          445  +// MessageId: SCARD_E_NO_SUCH_CERTIFICATE
          446  +//
          447  +// MessageText:
          448  +//
          449  +// The requested certificate does not exist.
          450  +//
          451  +#define SCARD_E_NO_SUCH_CERTIFICATE      ((DWORD)0x8010002CL)
          452  +
          453  +//
          454  +// MessageId: SCARD_E_CERTIFICATE_UNAVAILABLE
          455  +//
          456  +// MessageText:
          457  +//
          458  +// The requested certificate could not be obtained.
          459  +//
          460  +#define SCARD_E_CERTIFICATE_UNAVAILABLE  ((DWORD)0x8010002DL)
          461  +
          462  +//
          463  +// MessageId: SCARD_E_NO_READERS_AVAILABLE
          464  +//
          465  +// MessageText:
          466  +//
          467  +// Cannot find a smart card reader.
          468  +//
          469  +#define SCARD_E_NO_READERS_AVAILABLE     ((DWORD)0x8010002EL)
          470  +
          471  +//
          472  +// MessageId: SCARD_E_COMM_DATA_LOST
          473  +//
          474  +// MessageText:
          475  +//
          476  +// A communications error with the smart card has been detected.  Retry the operation.
          477  +//
          478  +#define SCARD_E_COMM_DATA_LOST           ((DWORD)0x8010002FL)
          479  +
          480  +//
          481  +// MessageId: SCARD_E_NO_KEY_CONTAINER
          482  +//
          483  +// MessageText:
          484  +//
          485  +// The requested key container does not exist on the smart card.
          486  +//
          487  +#define SCARD_E_NO_KEY_CONTAINER         ((DWORD)0x80100030L)
          488  +
          489  +//
          490  +// MessageId: SCARD_E_SERVER_TOO_BUSY
          491  +//
          492  +// MessageText:
          493  +//
          494  +// The Smart card resource manager is too busy to complete this operation.
          495  +//
          496  +#define SCARD_E_SERVER_TOO_BUSY          ((DWORD)0x80100031L)
          497  +
          498  +//
          499  +// MessageId: SCARD_E_PIN_CACHE_EXPIRED
          500  +//
          501  +// MessageText:
          502  +//
          503  +// The smart card PIN cache has expired.
          504  +//
          505  +#define SCARD_E_PIN_CACHE_EXPIRED        ((DWORD)0x80100032L)
          506  +
          507  +//
          508  +// MessageId: SCARD_E_NO_PIN_CACHE
          509  +//
          510  +// MessageText:
          511  +//
          512  +// The smart card PIN cannot be cached.
          513  +//
          514  +#define SCARD_E_NO_PIN_CACHE             ((DWORD)0x80100033L)
          515  +
          516  +//
          517  +// MessageId: SCARD_E_READ_ONLY_CARD
          518  +//
          519  +// MessageText:
          520  +//
          521  +// The smart card is read only and cannot be written to.
          522  +//
          523  +#define SCARD_E_READ_ONLY_CARD           ((DWORD)0x80100034L)
          524  +
          525  +//
          526  +// These are warning codes.
          527  +//
          528  +//
          529  +// MessageId: SCARD_W_UNSUPPORTED_CARD
          530  +//
          531  +// MessageText:
          532  +//
          533  +// The reader cannot communicate with the smart card, due to ATR configuration conflicts.
          534  +//
          535  +#define SCARD_W_UNSUPPORTED_CARD         ((DWORD)0x80100065L)
          536  +
          537  +//
          538  +// MessageId: SCARD_W_UNRESPONSIVE_CARD
          539  +//
          540  +// MessageText:
          541  +//
          542  +// The smart card is not responding to a reset.
          543  +//
          544  +#define SCARD_W_UNRESPONSIVE_CARD        ((DWORD)0x80100066L)
          545  +
          546  +//
          547  +// MessageId: SCARD_W_UNPOWERED_CARD
          548  +//
          549  +// MessageText:
          550  +//
          551  +// Power has been removed from the smart card, so that further communication is not possible.
          552  +//
          553  +#define SCARD_W_UNPOWERED_CARD           ((DWORD)0x80100067L)
          554  +
          555  +//
          556  +// MessageId: SCARD_W_RESET_CARD
          557  +//
          558  +// MessageText:
          559  +//
          560  +// The smart card has been reset, so any shared state information is invalid.
          561  +//
          562  +#define SCARD_W_RESET_CARD               ((DWORD)0x80100068L)
          563  +
          564  +//
          565  +// MessageId: SCARD_W_REMOVED_CARD
          566  +//
          567  +// MessageText:
          568  +//
          569  +// The smart card has been removed, so that further communication is not possible.
          570  +//
          571  +#define SCARD_W_REMOVED_CARD             ((DWORD)0x80100069L)
          572  +
          573  +//
          574  +// MessageId: SCARD_W_SECURITY_VIOLATION
          575  +//
          576  +// MessageText:
          577  +//
          578  +// Access was denied because of a security violation.
          579  +//
          580  +#define SCARD_W_SECURITY_VIOLATION       ((DWORD)0x8010006AL)
          581  +
          582  +//
          583  +// MessageId: SCARD_W_WRONG_CHV
          584  +//
          585  +// MessageText:
          586  +//
          587  +// The card cannot be accessed because the wrong PIN was presented.
          588  +//
          589  +#define SCARD_W_WRONG_CHV                ((DWORD)0x8010006BL)
          590  +
          591  +//
          592  +// MessageId: SCARD_W_CHV_BLOCKED
          593  +//
          594  +// MessageText:
          595  +//
          596  +// The card cannot be accessed because the maximum number of PIN entry attempts has been reached.
          597  +//
          598  +#define SCARD_W_CHV_BLOCKED              ((DWORD)0x8010006CL)
          599  +
          600  +//
          601  +// MessageId: SCARD_W_EOF
          602  +//
          603  +// MessageText:
          604  +//
          605  +// The end of the smart card file has been reached.
          606  +//
          607  +#define SCARD_W_EOF                      ((DWORD)0x8010006DL)
          608  +
          609  +//
          610  +// MessageId: SCARD_W_CANCELLED_BY_USER
          611  +//
          612  +// MessageText:
          613  +//
          614  +// The action was cancelled by the user.
          615  +//
          616  +#define SCARD_W_CANCELLED_BY_USER        ((DWORD)0x8010006EL)
          617  +
          618  +//
          619  +// MessageId: SCARD_W_CARD_NOT_AUTHENTICATED
          620  +//
          621  +// MessageText:
          622  +//
          623  +// No PIN was presented to the smart card.
          624  +//
          625  +#define SCARD_W_CARD_NOT_AUTHENTICATED   ((DWORD)0x8010006FL)
          626  +
          627  +//
          628  +// MessageId: SCARD_W_CACHE_ITEM_NOT_FOUND
          629  +//
          630  +// MessageText:
          631  +//
          632  +// The requested item could not be found in the cache.
          633  +//
          634  +#define SCARD_W_CACHE_ITEM_NOT_FOUND     ((DWORD)0x80100070L)
          635  +
          636  +//
          637  +// MessageId: SCARD_W_CACHE_ITEM_STALE
          638  +//
          639  +// MessageText:
          640  +//
          641  +// The requested cache item is too old and was deleted from the cache.
          642  +//
          643  +#define SCARD_W_CACHE_ITEM_STALE         ((DWORD)0x80100071L)
          644  +
          645  +//
          646  +// MessageId: SCARD_W_CACHE_ITEM_TOO_BIG
          647  +//
          648  +// MessageText:
          649  +//
          650  +// The new cache item exceeds the maximum per-item size defined for the cache.
          651  +//
          652  +#define SCARD_W_CACHE_ITEM_TOO_BIG       ((DWORD)0x80100072L)
          653  +
          654  +#endif // SCARD_S_SUCCESS
          655  +

Added build/cackey_win32_build/include/pcsclite.h version [fed57910aa].

            1  +#include <windows.h>

Added build/cackey_win32_build/include/pthread.h version [bedfe2684e].

            1  +/* Thread_emulation.h */
            2  +/* Author: Johnson M. Hart */
            3  +/* Emulate the Pthreads model for the Win32 platform */
            4  +/* The emulation is not complete, but it does provide a subset */
            5  +/* required for a first project */
            6  +/* Source: http://world.std.com/~jmhart/opensource.htm */
            7  +/* The emulation is not complete, but it does provide a subset */
            8  +/* that will work with many well-behaved programs */
            9  +/* IF YOU ARE REALLY SERIOUS ABOUT THIS, USE THE OPEN SOURCE */
           10  +/* PTHREAD LIBRARY. YOU'LL FIND IT ON THE RED HAT SITE */
           11  +
           12  +#ifndef _THREAD_EMULATION
           13  +#  define _THREAD_EMULATION
           14  +
           15  +/* Thread management macros */
           16  +#  ifdef _WIN32
           17  +#    define _WIN32_WINNT 0x500 /* WINBASE.H - Enable SignalObjectAndWait */
           18  +#    include <process.h>
           19  +#    include <windows.h>
           20  +#    define THREAD_FUNCTION_PROTO THREAD_FUNCTION_RETURN (__stdcall *) (void *)
           21  +#    define THREAD_FUNCTION_RETURN unsigned int
           22  +#    define THREAD_SPECIFIC_INDEX DWORD
           23  +#    define pthread_t HANDLE
           24  +#    define pthread_attr_t DWORD
           25  +#    define pthread_create(thhandle, attr, thfunc, tharg) ((int) ((*thhandle = (HANDLE) _beginthreadex(NULL, 0, (THREAD_FUNCTION_PROTO) thfunc, tharg, 0, NULL)) == NULL))
           26  +#    define pthread_join(thread, result) ((WaitForSingleObject((thread), INFINITE) != WAIT_OBJECT_0) || !CloseHandle(thread))
           27  +#    define pthread_detach(thread) { if (((void *) thread) != NULL) { CloseHandle((void *) thread); }}
           28  +#    define thread_sleep(nms) Sleep(nms)
           29  +#    define pthread_cancel(thread) TerminateThread(thread, 0)
           30  +#    define ts_key_create(ts_key, destructor) {ts_key = TlsAlloc();}
           31  +#    define pthread_getspecific(ts_key) TlsGetValue(ts_key)
           32  +#    define pthread_setspecific(ts_key, value) TlsSetValue(ts_key, (void *)value)
           33  +#    define pthread_self() GetCurrentThreadId()
           34  +#  else
           35  +#    include <pthread.h>
           36  +#    define THREAD_FUNCTION_RETURN void *
           37  +#  endif
           38  +
           39  +/* Syncrhronization macros: Win32->pthread */
           40  +#  ifdef _WIN32
           41  +#    define pthread_mutex_t HANDLE
           42  +#    define pthread_cond_t HANDLE
           43  +#    define pthread_mutex_lock(pobject) WaitForSingleObject(*pobject, INFINITE)
           44  +#    define pthread_mutex_unlock(pobject) (!ReleaseMutex(*pobject))
           45  +#    define pthread_mutex_init(pobject,pattr) ((*pobject=CreateMutex(NULL, FALSE, NULL)) == NULL)
           46  +#    define pthread_cond_init(pobject,pattr) (*pobject=CreateEvent(NULL, FALSE, FALSE, NULL))
           47  +#    define pthread_mutex_destroy(pobject) CloseHandle(*pobject)
           48  +#    define pthread_cond_destroy(pobject) CloseHandle(*pobject)
           49  +#    define pthread_cond_wait(pcv,pmutex) { SignalObjectAndWait(*pmutex, *pcv, INFINITE, FALSE); WaitForSingleObject(*pmutex, INFINITE); }
           50  +#    define pthread_cond_signal(pcv) SetEvent(*pcv)
           51  +#  endif
           52  +
           53  +#endif

Added build/cackey_win32_build/include/winscard.h version [b54aa4ee89].

            1  +/*++
            2  +
            3  +Copyright (c) 1996  Microsoft Corporation
            4  +
            5  +Module Name:
            6  +
            7  +    WinSCard
            8  +
            9  +Abstract:
           10  +
           11  +    This header file provides the definitions and symbols necessary for an
           12  +    Application or Smart Card Service Provider to access the Smartcard
           13  +    Subsystem.
           14  +
           15  +Environment:
           16  +
           17  +    Win32
           18  +
           19  +Notes:
           20  +
           21  +--*/
           22  +
           23  +#ifndef _WINSCARD_H_
           24  +#define _WINSCARD_H_
           25  +
           26  +#if defined (_MSC_VER) && (_MSC_VER >= 1020)
           27  +#pragma once
           28  +#endif
           29  +
           30  +
           31  +#include <windows.h>
           32  +#include <wtypes.h>
           33  +#include <winioctl.h>
           34  +#include "winsmcrd.h"
           35  +#ifndef SCARD_S_SUCCESS
           36  +#include "SCardErr.h"
           37  +#endif
           38  +
           39  +#ifdef __cplusplus
           40  +extern "C" {
           41  +#endif
           42  +
           43  +
           44  +#if 1 /* jkm */
           45  +#ifndef __LPCGUID_DEFINED__
           46  +#define __LPCGUID_DEFINED__
           47  +typedef const GUID *LPCGUID;
           48  +#endif
           49  +#endif
           50  +
           51  +#ifndef _LPCBYTE_DEFINED
           52  +#define _LPCBYTE_DEFINED
           53  +typedef const BYTE *LPCBYTE;
           54  +#endif
           55  +#ifndef _LPCVOID_DEFINED
           56  +#define _LPCVOID_DEFINED
           57  +typedef const VOID *LPCVOID;
           58  +#endif
           59  +
           60  +#ifndef WINSCARDAPI
           61  +#define WINSCARDAPI
           62  +#endif
           63  +#ifndef WINSCARDDATA
           64  +#define WINSCARDDATA __declspec(dllimport)
           65  +#endif
           66  +
           67  +/* In clr:pure we cannot mark data export with dllimport.
           68  + * We should add small functions which returns the value of
           69  + * the global.
           70  + */
           71  +#if !defined(_M_CEE_PURE)
           72  +WINSCARDDATA extern const SCARD_IO_REQUEST
           73  +    g_rgSCardT0Pci,
           74  +    g_rgSCardT1Pci,
           75  +    g_rgSCardRawPci;
           76  +#define SCARD_PCI_T0  (&g_rgSCardT0Pci)
           77  +#define SCARD_PCI_T1  (&g_rgSCardT1Pci)
           78  +#define SCARD_PCI_RAW (&g_rgSCardRawPci)
           79  +#endif
           80  +
           81  +//
           82  +////////////////////////////////////////////////////////////////////////////////
           83  +//
           84  +//  Service Manager Access Services
           85  +//
           86  +//      The following services are used to manage user and terminal contexts for
           87  +//      Smart Cards.
           88  +//
           89  +
           90  +typedef ULONG_PTR SCARDCONTEXT;
           91  +typedef SCARDCONTEXT *PSCARDCONTEXT, *LPSCARDCONTEXT;
           92  +
           93  +typedef ULONG_PTR SCARDHANDLE;
           94  +typedef SCARDHANDLE *PSCARDHANDLE, *LPSCARDHANDLE;
           95  +
           96  +#define SCARD_AUTOALLOCATE (DWORD)(-1)
           97  +
           98  +#define SCARD_SCOPE_USER     0  // The context is a user context, and any
           99  +                                // database operations are performed within the
          100  +                                // domain of the user.
          101  +#define SCARD_SCOPE_TERMINAL 1  // The context is that of the current terminal,
          102  +                                // and any database operations are performed
          103  +                                // within the domain of that terminal.  (The
          104  +                                // calling application must have appropriate
          105  +                                // access permissions for any database actions.)
          106  +#define SCARD_SCOPE_SYSTEM    2 // The context is the system context, and any
          107  +                                // database operations are performed within the
          108  +                                // domain of the system.  (The calling
          109  +                                // application must have appropriate access
          110  +                                // permissions for any database actions.)
          111  +
          112  +extern WINSCARDAPI LONG WINAPI
          113  +SCardEstablishContext(
          114  +      DWORD dwScope,
          115  +      LPCVOID pvReserved1,
          116  +      LPCVOID pvReserved2,
          117  +     LPSCARDCONTEXT phContext);
          118  +
          119  +extern WINSCARDAPI LONG WINAPI
          120  +SCardReleaseContext(
          121  +          SCARDCONTEXT hContext);
          122  +
          123  +extern WINSCARDAPI LONG WINAPI
          124  +SCardIsValidContext(
          125  +          SCARDCONTEXT hContext);
          126  +
          127  +
          128  +//
          129  +////////////////////////////////////////////////////////////////////////////////
          130  +//
          131  +//  Smart Card Database Management Services
          132  +//
          133  +//      The following services provide for managing the Smart Card Database.
          134  +//
          135  +
          136  +#define SCARD_ALL_READERS       TEXT("SCard$AllReaders\000")
          137  +#define SCARD_DEFAULT_READERS   TEXT("SCard$DefaultReaders\000")
          138  +#define SCARD_LOCAL_READERS     TEXT("SCard$LocalReaders\000")
          139  +#define SCARD_SYSTEM_READERS    TEXT("SCard$SystemReaders\000")
          140  +
          141  +#define SCARD_PROVIDER_PRIMARY  1   // Primary Provider Id
          142  +#define SCARD_PROVIDER_CSP      2   // Crypto Service Provider Id
          143  +#define SCARD_PROVIDER_KSP      3   // Key Storage Provider Id
          144  +
          145  +
          146  +//
          147  +// Database Reader routines
          148  +//
          149  +
          150  +extern WINSCARDAPI LONG WINAPI
          151  +SCardListReaderGroupsA(
          152  +        SCARDCONTEXT hContext,
          153  +        LPSTR mszGroups,
          154  + LPDWORD pcchGroups);
          155  +extern WINSCARDAPI LONG WINAPI
          156  +SCardListReaderGroupsW(
          157  +        SCARDCONTEXT hContext,
          158  +        LPWSTR mszGroups,
          159  + LPDWORD pcchGroups);
          160  +#ifdef UNICODE
          161  +#define SCardListReaderGroups  SCardListReaderGroupsW
          162  +#else
          163  +#define SCardListReaderGroups  SCardListReaderGroupsA
          164  +#endif // !UNICODE
          165  +
          166  +extern WINSCARDAPI LONG WINAPI
          167  +SCardListReadersA(
          168  +         SCARDCONTEXT hContext,
          169  +     LPCSTR mszGroups,
          170  +      LPSTR mszReaders,
          171  +  LPDWORD pcchReaders);
          172  +extern WINSCARDAPI LONG WINAPI
          173  +SCardListReadersW(
          174  +         SCARDCONTEXT hContext,
          175  +     LPCWSTR mszGroups,
          176  +      LPWSTR mszReaders,
          177  +  LPDWORD pcchReaders);
          178  +#ifdef UNICODE
          179  +#define SCardListReaders  SCardListReadersW
          180  +#else
          181  +#define SCardListReaders  SCardListReadersA
          182  +#endif // !UNICODE
          183  +
          184  +extern WINSCARDAPI LONG WINAPI
          185  +SCardListCardsA(
          186  +          SCARDCONTEXT hContext,
          187  +      LPCBYTE pbAtr,
          188  +      LPCGUID rgquidInterfaces,
          189  +          DWORD cguidInterfaceCount,
          190  +      LPSTR mszCards,
          191  +   LPDWORD pcchCards);
          192  +extern WINSCARDAPI LONG WINAPI
          193  +SCardListCardsW(
          194  +          SCARDCONTEXT hContext,
          195  +      LPCBYTE pbAtr,
          196  +      LPCGUID rgquidInterfaces,
          197  +          DWORD cguidInterfaceCount,
          198  +      LPWSTR mszCards,
          199  +   LPDWORD pcchCards);
          200  +#ifdef UNICODE
          201  +#define SCardListCards  SCardListCardsW
          202  +#else
          203  +#define SCardListCards  SCardListCardsA
          204  +#endif // !UNICODE
          205  +//
          206  +// NOTE:    The routine SCardListCards name differs from the PC/SC definition.
          207  +//          It should be:
          208  +//
          209  +//              extern WINSCARDAPI LONG WINAPI
          210  +//              SCardListCardTypes(
          211  +//                        SCARDCONTEXT hContext,
          212  +//                    LPCBYTE pbAtr,
          213  +//                    LPCGUID rgquidInterfaces,
          214  +//                        DWORD cguidInterfaceCount,
          215  +//                   LPTSTR mszCards,
          216  +//                  out   LPDWORD pcchCards);
          217  +//
          218  +//          Here's a work-around MACRO:
          219  +#define SCardListCardTypes SCardListCards
          220  +
          221  +extern WINSCARDAPI LONG WINAPI
          222  +SCardListInterfacesA(
          223  +         SCARDCONTEXT hContext,
          224  +         LPCSTR szCard,
          225  +        LPGUID pguidInterfaces,
          226  +  LPDWORD pcguidInterfaces);
          227  +extern WINSCARDAPI LONG WINAPI
          228  +SCardListInterfacesW(
          229  +         SCARDCONTEXT hContext,
          230  +         LPCWSTR szCard,
          231  +        LPGUID pguidInterfaces,
          232  +  LPDWORD pcguidInterfaces);
          233  +#ifdef UNICODE
          234  +#define SCardListInterfaces  SCardListInterfacesW
          235  +#else
          236  +#define SCardListInterfaces  SCardListInterfacesA
          237  +#endif // !UNICODE
          238  +
          239  +extern WINSCARDAPI LONG WINAPI
          240  +SCardGetProviderIdA(
          241  +         SCARDCONTEXT hContext,
          242  +         LPCSTR szCard,
          243  +        LPGUID pguidProviderId);
          244  +extern WINSCARDAPI LONG WINAPI
          245  +SCardGetProviderIdW(
          246  +         SCARDCONTEXT hContext,
          247  +         LPCWSTR szCard,
          248  +        LPGUID pguidProviderId);
          249  +#ifdef UNICODE
          250  +#define SCardGetProviderId  SCardGetProviderIdW
          251  +#else
          252  +#define SCardGetProviderId  SCardGetProviderIdA
          253  +#endif // !UNICODE
          254  +//
          255  +// NOTE:    The routine SCardGetProviderId in this implementation uses GUIDs.
          256  +//          The PC/SC definition uses BYTEs.
          257  +//
          258  +
          259  +extern WINSCARDAPI LONG WINAPI
          260  +SCardGetCardTypeProviderNameA(
          261  +          SCARDCONTEXT hContext,
          262  +          LPCSTR szCardName,
          263  +          DWORD dwProviderId,
          264  +     LPSTR szProvider,
          265  +   LPDWORD pcchProvider);
          266  +extern WINSCARDAPI LONG WINAPI
          267  +SCardGetCardTypeProviderNameW(
          268  +          SCARDCONTEXT hContext,
          269  +          LPCWSTR szCardName,
          270  +          DWORD dwProviderId,
          271  +     LPWSTR szProvider,
          272  +   LPDWORD pcchProvider);
          273  +#ifdef UNICODE
          274  +#define SCardGetCardTypeProviderName  SCardGetCardTypeProviderNameW
          275  +#else
          276  +#define SCardGetCardTypeProviderName  SCardGetCardTypeProviderNameA
          277  +#endif // !UNICODE
          278  +//
          279  +// NOTE:    This routine is an extension to the PC/SC definitions.
          280  +//
          281  +
          282  +
          283  +//
          284  +// Database Writer routines
          285  +//
          286  +
          287  +extern WINSCARDAPI LONG WINAPI
          288  +SCardIntroduceReaderGroupA(
          289  +     SCARDCONTEXT hContext,
          290  +     LPCSTR szGroupName);
          291  +extern WINSCARDAPI LONG WINAPI
          292  +SCardIntroduceReaderGroupW(
          293  +     SCARDCONTEXT hContext,
          294  +     LPCWSTR szGroupName);
          295  +#ifdef UNICODE
          296  +#define SCardIntroduceReaderGroup  SCardIntroduceReaderGroupW
          297  +#else
          298  +#define SCardIntroduceReaderGroup  SCardIntroduceReaderGroupA
          299  +#endif // !UNICODE
          300  +
          301  +extern WINSCARDAPI LONG WINAPI
          302  +SCardForgetReaderGroupA(
          303  +     SCARDCONTEXT hContext,
          304  +     LPCSTR szGroupName);
          305  +extern WINSCARDAPI LONG WINAPI
          306  +SCardForgetReaderGroupW(
          307  +     SCARDCONTEXT hContext,
          308  +     LPCWSTR szGroupName);
          309  +#ifdef UNICODE
          310  +#define SCardForgetReaderGroup  SCardForgetReaderGroupW
          311  +#else
          312  +#define SCardForgetReaderGroup  SCardForgetReaderGroupA
          313  +#endif // !UNICODE
          314  +
          315  +extern WINSCARDAPI LONG WINAPI
          316  +SCardIntroduceReaderA(
          317  +     SCARDCONTEXT hContext,
          318  +     LPCSTR szReaderName,
          319  +     LPCSTR szDeviceName);
          320  +extern WINSCARDAPI LONG WINAPI
          321  +SCardIntroduceReaderW(
          322  +     SCARDCONTEXT hContext,
          323  +     LPCWSTR szReaderName,
          324  +     LPCWSTR szDeviceName);
          325  +#ifdef UNICODE
          326  +#define SCardIntroduceReader  SCardIntroduceReaderW
          327  +#else
          328  +#define SCardIntroduceReader  SCardIntroduceReaderA
          329  +#endif // !UNICODE
          330  +
          331  +extern WINSCARDAPI LONG WINAPI
          332  +SCardForgetReaderA(
          333  +     SCARDCONTEXT hContext,
          334  +     LPCSTR szReaderName);
          335  +extern WINSCARDAPI LONG WINAPI
          336  +SCardForgetReaderW(
          337  +     SCARDCONTEXT hContext,
          338  +     LPCWSTR szReaderName);
          339  +#ifdef UNICODE
          340  +#define SCardForgetReader  SCardForgetReaderW
          341  +#else
          342  +#define SCardForgetReader  SCardForgetReaderA
          343  +#endif // !UNICODE
          344  +
          345  +extern WINSCARDAPI LONG WINAPI
          346  +SCardAddReaderToGroupA(
          347  +     SCARDCONTEXT hContext,
          348  +     LPCSTR szReaderName,
          349  +     LPCSTR szGroupName);
          350  +extern WINSCARDAPI LONG WINAPI
          351  +SCardAddReaderToGroupW(
          352  +     SCARDCONTEXT hContext,
          353  +     LPCWSTR szReaderName,
          354  +     LPCWSTR szGroupName);
          355  +#ifdef UNICODE
          356  +#define SCardAddReaderToGroup  SCardAddReaderToGroupW
          357  +#else
          358  +#define SCardAddReaderToGroup  SCardAddReaderToGroupA
          359  +#endif // !UNICODE
          360  +
          361  +extern WINSCARDAPI LONG WINAPI
          362  +SCardRemoveReaderFromGroupA(
          363  +     SCARDCONTEXT hContext,
          364  +     LPCSTR szReaderName,
          365  +     LPCSTR szGroupName);
          366  +extern WINSCARDAPI LONG WINAPI
          367  +SCardRemoveReaderFromGroupW(
          368  +     SCARDCONTEXT hContext,
          369  +     LPCWSTR szReaderName,
          370  +     LPCWSTR szGroupName);
          371  +#ifdef UNICODE
          372  +#define SCardRemoveReaderFromGroup  SCardRemoveReaderFromGroupW
          373  +#else
          374  +#define SCardRemoveReaderFromGroup  SCardRemoveReaderFromGroupA
          375  +#endif // !UNICODE
          376  +
          377  +extern WINSCARDAPI LONG WINAPI
          378  +SCardIntroduceCardTypeA(
          379  +         SCARDCONTEXT hContext,
          380  +         LPCSTR szCardName,
          381  +     LPCGUID pguidPrimaryProvider,
          382  +     LPCGUID rgguidInterfaces,
          383  +         DWORD dwInterfaceCount,
          384  +         LPCBYTE pbAtr,
          385  +         LPCBYTE pbAtrMask,
          386  +         DWORD cbAtrLen);
          387  +extern WINSCARDAPI LONG WINAPI
          388  +SCardIntroduceCardTypeW(
          389  +         SCARDCONTEXT hContext,
          390  +         LPCWSTR szCardName,
          391  +     LPCGUID pguidPrimaryProvider,
          392  +     LPCGUID rgguidInterfaces,
          393  +         DWORD dwInterfaceCount,
          394  +         LPCBYTE pbAtr,
          395  +         LPCBYTE pbAtrMask,
          396  +         DWORD cbAtrLen);
          397  +#ifdef UNICODE
          398  +#define SCardIntroduceCardType  SCardIntroduceCardTypeW
          399  +#else
          400  +#define SCardIntroduceCardType  SCardIntroduceCardTypeA
          401  +#endif // !UNICODE
          402  +//
          403  +// NOTE:    The routine SCardIntroduceCardType's parameters' order differs from
          404  +//          the PC/SC definition.  It should be:
          405  +//
          406  +//              extern WINSCARDAPI LONG WINAPI
          407  +//              SCardIntroduceCardType(
          408  +//                       SCARDCONTEXT hContext,
          409  +//                       LPCTSTR szCardName,
          410  +//                       LPCBYTE pbAtr,
          411  +//                       LPCBYTE pbAtrMask,
          412  +//                       DWORD cbAtrLen,
          413  +//                   LPCGUID pguidPrimaryProvider,
          414  +//                   LPCGUID rgguidInterfaces,
          415  +//                       DWORD dwInterfaceCount);
          416  +//
          417  +//          Here's a work-around MACRO:
          418  +#define PCSCardIntroduceCardType(hContext, szCardName, pbAtr, pbAtrMask, cbAtrLen, pguidPrimaryProvider, rgguidInterfaces, dwInterfaceCount) \
          419  +          SCardIntroduceCardType(hContext, szCardName, pguidPrimaryProvider, rgguidInterfaces, dwInterfaceCount, pbAtr, pbAtrMask, cbAtrLen)
          420  +
          421  +extern WINSCARDAPI LONG WINAPI
          422  +SCardSetCardTypeProviderNameA(
          423  +     SCARDCONTEXT hContext,
          424  +     LPCSTR szCardName,
          425  +     DWORD dwProviderId,
          426  +     LPCSTR szProvider);
          427  +extern WINSCARDAPI LONG WINAPI
          428  +SCardSetCardTypeProviderNameW(
          429  +     SCARDCONTEXT hContext,
          430  +     LPCWSTR szCardName,
          431  +     DWORD dwProviderId,
          432  +     LPCWSTR szProvider);
          433  +#ifdef UNICODE
          434  +#define SCardSetCardTypeProviderName  SCardSetCardTypeProviderNameW
          435  +#else
          436  +#define SCardSetCardTypeProviderName  SCardSetCardTypeProviderNameA
          437  +#endif // !UNICODE
          438  +//
          439  +// NOTE:    This routine is an extention to the PC/SC specifications.
          440  +//
          441  +
          442  +extern WINSCARDAPI LONG WINAPI
          443  +SCardForgetCardTypeA(
          444  +     SCARDCONTEXT hContext,
          445  +     LPCSTR szCardName);
          446  +extern WINSCARDAPI LONG WINAPI
          447  +SCardForgetCardTypeW(
          448  +     SCARDCONTEXT hContext,
          449  +     LPCWSTR szCardName);
          450  +#ifdef UNICODE
          451  +#define SCardForgetCardType  SCardForgetCardTypeW
          452  +#else
          453  +#define SCardForgetCardType  SCardForgetCardTypeA
          454  +#endif // !UNICODE
          455  +
          456  +
          457  +//
          458  +////////////////////////////////////////////////////////////////////////////////
          459  +//
          460  +//  Service Manager Support Routines
          461  +//
          462  +//      The following services are supplied to simplify the use of the Service
          463  +//      Manager API.
          464  +//
          465  +
          466  +extern WINSCARDAPI LONG WINAPI
          467  +SCardFreeMemory(
          468  +     SCARDCONTEXT hContext,
          469  +     LPCVOID pvMem);
          470  +
          471  +#if (NTDDI_VERSION >= NTDDI_WINXP)
          472  +extern WINSCARDAPI HANDLE WINAPI
          473  +SCardAccessStartedEvent(void);
          474  +
          475  +extern WINSCARDAPI void WINAPI
          476  +SCardReleaseStartedEvent(void);
          477  +#endif // (NTDDI_VERSION >= NTDDI_WINXP)
          478  +
          479  +//
          480  +////////////////////////////////////////////////////////////////////////////////
          481  +//
          482  +//  Reader Services
          483  +//
          484  +//      The following services supply means for tracking cards within readers.
          485  +//
          486  +
          487  +typedef struct {
          488  +    LPCSTR      szReader;       // reader name
          489  +    LPVOID      pvUserData;     // user defined data
          490  +    DWORD       dwCurrentState; // current state of reader at time of call
          491  +    DWORD       dwEventState;   // state of reader after state change
          492  +    DWORD       cbAtr;          // Number of bytes in the returned ATR.
          493  +    BYTE        rgbAtr[36];     // Atr of inserted card, (extra alignment bytes)
          494  +} SCARD_READERSTATEA, *PSCARD_READERSTATEA, *LPSCARD_READERSTATEA;
          495  +typedef struct {
          496  +    LPCWSTR     szReader;       // reader name
          497  +    LPVOID      pvUserData;     // user defined data
          498  +    DWORD       dwCurrentState; // current state of reader at time of call
          499  +    DWORD       dwEventState;   // state of reader after state change
          500  +    DWORD       cbAtr;          // Number of bytes in the returned ATR.
          501  +    BYTE        rgbAtr[36];     // Atr of inserted card, (extra alignment bytes)
          502  +} SCARD_READERSTATEW, *PSCARD_READERSTATEW, *LPSCARD_READERSTATEW;
          503  +#ifdef UNICODE
          504  +typedef SCARD_READERSTATEW SCARD_READERSTATE;
          505  +typedef PSCARD_READERSTATEW PSCARD_READERSTATE;
          506  +typedef LPSCARD_READERSTATEW LPSCARD_READERSTATE;
          507  +#else
          508  +typedef SCARD_READERSTATEA SCARD_READERSTATE;
          509  +typedef PSCARD_READERSTATEA PSCARD_READERSTATE;
          510  +typedef LPSCARD_READERSTATEA LPSCARD_READERSTATE;
          511  +#endif // UNICODE
          512  +
          513  +// Backwards compatibility macros
          514  +#define SCARD_READERSTATE_A SCARD_READERSTATEA
          515  +#define SCARD_READERSTATE_W SCARD_READERSTATEW
          516  +#define PSCARD_READERSTATE_A PSCARD_READERSTATEA
          517  +#define PSCARD_READERSTATE_W PSCARD_READERSTATEW
          518  +#define LPSCARD_READERSTATE_A LPSCARD_READERSTATEA
          519  +#define LPSCARD_READERSTATE_W LPSCARD_READERSTATEW
          520  +
          521  +#define SCARD_STATE_UNAWARE     0x00000000  // The application is unaware of the
          522  +                                            // current state, and would like to
          523  +                                            // know.  The use of this value
          524  +                                            // results in an immediate return
          525  +                                            // from state transition monitoring
          526  +                                            // services.  This is represented by
          527  +                                            // all bits set to zero.
          528  +#define SCARD_STATE_IGNORE      0x00000001  // The application requested that
          529  +                                            // this reader be ignored.  No other
          530  +                                            // bits will be set.
          531  +#define SCARD_STATE_CHANGED     0x00000002  // This implies that there is a
          532  +                                            // difference between the state
          533  +                                            // believed by the application, and
          534  +                                            // the state known by the Service
          535  +                                            // Manager.  When this bit is set,
          536  +                                            // the application may assume a
          537  +                                            // significant state change has
          538  +                                            // occurred on this reader.
          539  +#define SCARD_STATE_UNKNOWN     0x00000004  // This implies that the given
          540  +                                            // reader name is not recognized by
          541  +                                            // the Service Manager.  If this bit
          542  +                                            // is set, then SCARD_STATE_CHANGED
          543  +                                            // and SCARD_STATE_IGNORE will also
          544  +                                            // be set.
          545  +#define SCARD_STATE_UNAVAILABLE 0x00000008  // This implies that the actual
          546  +                                            // state of this reader is not
          547  +                                            // available.  If this bit is set,
          548  +                                            // then all the following bits are
          549  +                                            // clear.
          550  +#define SCARD_STATE_EMPTY       0x00000010  // This implies that there is not
          551  +                                            // card in the reader.  If this bit
          552  +                                            // is set, all the following bits
          553  +                                            // will be clear.
          554  +#define SCARD_STATE_PRESENT     0x00000020  // This implies that there is a card
          555  +                                            // in the reader.
          556  +#define SCARD_STATE_ATRMATCH    0x00000040  // This implies that there is a card
          557  +                                            // in the reader with an ATR
          558  +                                            // matching one of the target cards.
          559  +                                            // If this bit is set,
          560  +                                            // SCARD_STATE_PRESENT will also be
          561  +                                            // set.  This bit is only returned
          562  +                                            // on the SCardLocateCard() service.
          563  +#define SCARD_STATE_EXCLUSIVE   0x00000080  // This implies that the card in the
          564  +                                            // reader is allocated for exclusive
          565  +                                            // use by another application.  If
          566  +                                            // this bit is set,
          567  +                                            // SCARD_STATE_PRESENT will also be
          568  +                                            // set.
          569  +#define SCARD_STATE_INUSE       0x00000100  // This implies that the card in the
          570  +                                            // reader is in use by one or more
          571  +                                            // other applications, but may be
          572  +                                            // connected to in shared mode.  If
          573  +                                            // this bit is set,
          574  +                                            // SCARD_STATE_PRESENT will also be
          575  +                                            // set.
          576  +#define SCARD_STATE_MUTE        0x00000200  // This implies that the card in the
          577  +                                            // reader is unresponsive or not
          578  +                                            // supported by the reader or
          579  +                                            // software.
          580  +#define SCARD_STATE_UNPOWERED   0x00000400  // This implies that the card in the
          581  +                                            // reader has not been powered up.
          582  +
          583  +extern WINSCARDAPI LONG WINAPI
          584  +SCardLocateCardsA(
          585  +        SCARDCONTEXT hContext,
          586  +        LPCSTR mszCards,
          587  + LPSCARD_READERSTATEA rgReaderStates,
          588  +        DWORD cReaders);
          589  +extern WINSCARDAPI LONG WINAPI
          590  +SCardLocateCardsW(
          591  +        SCARDCONTEXT hContext,
          592  +        LPCWSTR mszCards,
          593  + LPSCARD_READERSTATEW rgReaderStates,
          594  +        DWORD cReaders);
          595  +#ifdef UNICODE
          596  +#define SCardLocateCards  SCardLocateCardsW
          597  +#else
          598  +#define SCardLocateCards  SCardLocateCardsA
          599  +#endif // !UNICODE
          600  +
          601  +#if (NTDDI_VERSION >= NTDDI_WINXP)
          602  +typedef struct _SCARD_ATRMASK {
          603  +    DWORD       cbAtr;          // Number of bytes in the ATR and the mask.
          604  +    BYTE        rgbAtr[36];     // Atr of card (extra alignment bytes)
          605  +    BYTE        rgbMask[36];    // Mask for the Atr (extra alignment bytes)
          606  +} SCARD_ATRMASK, *PSCARD_ATRMASK, *LPSCARD_ATRMASK;
          607  +
          608  +
          609  +extern WINSCARDAPI LONG WINAPI
          610  +SCardLocateCardsByATRA(
          611  +        SCARDCONTEXT hContext,
          612  +        LPSCARD_ATRMASK rgAtrMasks,
          613  +        DWORD cAtrs,
          614  + LPSCARD_READERSTATEA rgReaderStates,
          615  +        DWORD cReaders);
          616  +extern WINSCARDAPI LONG WINAPI
          617  +SCardLocateCardsByATRW(
          618  +        SCARDCONTEXT hContext,
          619  +        LPSCARD_ATRMASK rgAtrMasks,
          620  +        DWORD cAtrs,
          621  + LPSCARD_READERSTATEW rgReaderStates,
          622  +        DWORD cReaders);
          623  +#ifdef UNICODE
          624  +#define SCardLocateCardsByATR  SCardLocateCardsByATRW
          625  +#else
          626  +#define SCardLocateCardsByATR  SCardLocateCardsByATRA
          627  +#endif // !UNICODE
          628  +#endif // (NTDDI_VERSION >= NTDDI_WINXP)
          629  +
          630  +extern WINSCARDAPI LONG WINAPI
          631  +SCardGetStatusChangeA(
          632  +        SCARDCONTEXT hContext,
          633  +        DWORD dwTimeout,
          634  + LPSCARD_READERSTATEA rgReaderStates,
          635  +        DWORD cReaders);
          636  +extern WINSCARDAPI LONG WINAPI
          637  +SCardGetStatusChangeW(
          638  +        SCARDCONTEXT hContext,
          639  +        DWORD dwTimeout,
          640  + LPSCARD_READERSTATEW rgReaderStates,
          641  +        DWORD cReaders);
          642  +#ifdef UNICODE
          643  +#define SCardGetStatusChange  SCardGetStatusChangeW
          644  +#else
          645  +#define SCardGetStatusChange  SCardGetStatusChangeA
          646  +#endif // !UNICODE
          647  +
          648  +extern WINSCARDAPI LONG WINAPI
          649  +SCardCancel(
          650  +        SCARDCONTEXT hContext);
          651  +
          652  +
          653  +//
          654  +////////////////////////////////////////////////////////////////////////////////
          655  +//
          656  +//  Card/Reader Communication Services
          657  +//
          658  +//      The following services provide means for communication with the card.
          659  +//
          660  +
          661  +#define SCARD_SHARE_EXCLUSIVE 1 // This application is not willing to share this
          662  +                                // card with other applications.
          663  +#define SCARD_SHARE_SHARED    2 // This application is willing to share this
          664  +                                // card with other applications.
          665  +#define SCARD_SHARE_DIRECT    3 // This application demands direct control of
          666  +                                // the reader, so it is not available to other
          667  +                                // applications.
          668  +
          669  +#define SCARD_LEAVE_CARD      0 // Don't do anything special on close
          670  +#define SCARD_RESET_CARD      1 // Reset the card on close
          671  +#define SCARD_UNPOWER_CARD    2 // Power down the card on close
          672  +#define SCARD_EJECT_CARD      3 // Eject the card on close
          673  +
          674  +extern WINSCARDAPI LONG WINAPI
          675  +SCardConnectA(
          676  +        SCARDCONTEXT hContext,
          677  +        LPCSTR szReader,
          678  +        DWORD dwShareMode,
          679  +        DWORD dwPreferredProtocols,
          680  +       LPSCARDHANDLE phCard,
          681  +       LPDWORD pdwActiveProtocol);
          682  +extern WINSCARDAPI LONG WINAPI
          683  +SCardConnectW(
          684  +        SCARDCONTEXT hContext,
          685  +        LPCWSTR szReader,
          686  +        DWORD dwShareMode,
          687  +        DWORD dwPreferredProtocols,
          688  +       LPSCARDHANDLE phCard,
          689  +       LPDWORD pdwActiveProtocol);
          690  +#ifdef UNICODE
          691  +#define SCardConnect  SCardConnectW
          692  +#else
          693  +#define SCardConnect  SCardConnectA
          694  +#endif // !UNICODE
          695  +
          696  +extern WINSCARDAPI LONG WINAPI
          697  +SCardReconnect(
          698  +          SCARDHANDLE hCard,
          699  +          DWORD dwShareMode,
          700  +          DWORD dwPreferredProtocols,
          701  +          DWORD dwInitialization,
          702  +     LPDWORD pdwActiveProtocol);
          703  +
          704  +extern WINSCARDAPI LONG WINAPI
          705  +SCardDisconnect(
          706  +        SCARDHANDLE hCard,
          707  +        DWORD dwDisposition);
          708  +
          709  +extern WINSCARDAPI LONG WINAPI
          710  +SCardBeginTransaction(
          711  +        SCARDHANDLE hCard);
          712  +
          713  +extern WINSCARDAPI LONG WINAPI
          714  +SCardEndTransaction(
          715  +        SCARDHANDLE hCard,
          716  +        DWORD dwDisposition);
          717  +
          718  +extern WINSCARDAPI LONG WINAPI
          719  +SCardCancelTransaction(
          720  +        SCARDHANDLE hCard);
          721  +//
          722  +// NOTE:    This call corresponds to the PC/SC SCARDCOMM::Cancel routine,
          723  +//          terminating a blocked SCardBeginTransaction service.
          724  +//
          725  +
          726  +
          727  +extern WINSCARDAPI LONG WINAPI
          728  +SCardState(
          729  +        SCARDHANDLE hCard,
          730  +       LPDWORD pdwState,
          731  +       LPDWORD pdwProtocol,
          732  +       LPBYTE pbAtr,
          733  + LPDWORD pcbAtrLen);
          734  +//
          735  +// NOTE:    SCardState is an obsolete routine.  PC/SC has replaced it with
          736  +//          SCardStatus.
          737  +//
          738  +
          739  +extern WINSCARDAPI LONG WINAPI
          740  +SCardStatusA(
          741  +            SCARDHANDLE hCard,
          742  +      LPSTR mszReaderNames,
          743  + LPDWORD pcchReaderLen,
          744  +       LPDWORD pdwState,
          745  +       LPDWORD pdwProtocol,
          746  +     LPBYTE pbAtr,
          747  + LPDWORD pcbAtrLen);
          748  +extern WINSCARDAPI LONG WINAPI
          749  +SCardStatusW(
          750  +            SCARDHANDLE hCard,
          751  +      LPWSTR mszReaderNames,
          752  + LPDWORD pcchReaderLen,
          753  +       LPDWORD pdwState,
          754  +       LPDWORD pdwProtocol,
          755  +     LPBYTE pbAtr,
          756  + LPDWORD pcbAtrLen);
          757  +#ifdef UNICODE
          758  +#define SCardStatus  SCardStatusW
          759  +#else
          760  +#define SCardStatus  SCardStatusA
          761  +#endif // !UNICODE
          762  +
          763  +extern WINSCARDAPI LONG WINAPI
          764  +SCardTransmit(
          765  +            SCARDHANDLE hCard,
          766  +            LPCSCARD_IO_REQUEST pioSendPci,
          767  +     LPCBYTE pbSendBuffer,
          768  +            DWORD cbSendLength,
          769  + LPSCARD_IO_REQUEST pioRecvPci,
          770  +     LPBYTE pbRecvBuffer,
          771  +     LPDWORD pcbRecvLength);
          772  +
          773  +#if (NTDDI_VERSION >= NTDDI_VISTA)
          774  +extern WINSCARDAPI LONG WINAPI
          775  +SCardGetTransmitCount(
          776  +     SCARDHANDLE hCard,
          777  +     LPDWORD pcTransmitCount);
          778  +#endif // (NTDDI_VERSION >= NTDDI_VISTA)
          779  +
          780  +//
          781  +////////////////////////////////////////////////////////////////////////////////
          782  +//
          783  +//  Reader Control Routines
          784  +//
          785  +//      The following services provide for direct, low-level manipulation of the
          786  +//      reader by the calling application allowing it control over the
          787  +//      attributes of the communications with the card.
          788  +//
          789  +
          790  +extern WINSCARDAPI LONG WINAPI
          791  +SCardControl(
          792  +        SCARDHANDLE hCard,
          793  +        DWORD dwControlCode,
          794  +     LPCVOID lpInBuffer,
          795  +        DWORD cbInBufferSize,
          796  +     LPVOID lpOutBuffer,
          797  +        DWORD cbOutBufferSize,
          798  +       LPDWORD lpBytesReturned);
          799  +
          800  +extern WINSCARDAPI LONG WINAPI
          801  +SCardGetAttrib(
          802  +        SCARDHANDLE hCard,
          803  +        DWORD dwAttrId,
          804  +     LPBYTE pbAttr,
          805  + LPDWORD pcbAttrLen);
          806  +//
          807  +// NOTE:    The routine SCardGetAttrib's name differs from the PC/SC definition.
          808  +//          It should be:
          809  +//
          810  +//              extern WINSCARDAPI LONG WINAPI
          811  +//              SCardGetReaderCapabilities(
          812  +//                      SCARDHANDLE hCard,
          813  +//                      DWORD dwTag,
          814  +//                     LPBYTE pbAttr,
          815  +//                  out LPDWORD pcbAttrLen);
          816  +//
          817  +//          Here's a work-around MACRO:
          818  +#define SCardGetReaderCapabilities SCardGetAttrib
          819  +
          820  +extern WINSCARDAPI LONG WINAPI
          821  +SCardSetAttrib(
          822  +     SCARDHANDLE hCard,
          823  +     DWORD dwAttrId,
          824  +     LPCBYTE pbAttr,
          825  +     DWORD cbAttrLen);
          826  +//
          827  +// NOTE:    The routine SCardSetAttrib's name differs from the PC/SC definition.
          828  +//          It should be:
          829  +//
          830  +//              extern WINSCARDAPI LONG WINAPI
          831  +//              SCardSetReaderCapabilities(
          832  +//                      SCARDHANDLE hCard,
          833  +//                      DWORD dwTag,
          834  +//                      LPCBYTE pbAttr,
          835  +//                      DWORD cbAttrLen);
          836  +//
          837  +//          Here's a work-around MACRO:
          838  +#define SCardSetReaderCapabilities SCardSetAttrib
          839  +
          840  +
          841  +//
          842  +////////////////////////////////////////////////////////////////////////////////
          843  +//
          844  +//  Smart Card Dialog definitions
          845  +//
          846  +//      The following section contains structures and  exported function
          847  +//      declarations for the Smart Card Common Dialog dialog.
          848  +//
          849  +
          850  +// Defined constants
          851  +// Flags
          852  +#define SC_DLG_MINIMAL_UI       0x01
          853  +#define SC_DLG_NO_UI            0x02
          854  +#define SC_DLG_FORCE_UI         0x04
          855  +
          856  +#define SCERR_NOCARDNAME        0x4000
          857  +#define SCERR_NOGUIDS           0x8000
          858  +
          859  +typedef SCARDHANDLE (WINAPI *LPOCNCONNPROCA) ( SCARDCONTEXT,  LPSTR,  LPSTR,  PVOID);
          860  +typedef SCARDHANDLE (WINAPI *LPOCNCONNPROCW) ( SCARDCONTEXT,  LPWSTR,  LPWSTR,  PVOID);
          861  +#ifdef UNICODE
          862  +#define LPOCNCONNPROC  LPOCNCONNPROCW
          863  +#else
          864  +#define LPOCNCONNPROC  LPOCNCONNPROCA
          865  +#endif // !UNICODE
          866  +typedef BOOL (WINAPI *LPOCNCHKPROC) ( SCARDCONTEXT,  SCARDHANDLE,  PVOID);
          867  +typedef void (WINAPI *LPOCNDSCPROC) ( SCARDCONTEXT,  SCARDHANDLE,  PVOID);
          868  +
          869  +
          870  +//
          871  +// OPENCARD_SEARCH_CRITERIA: In order to specify a user-extended search,
          872  +// lpfnCheck must not be NULL.  Moreover, the connection to be made to the
          873  +// card before performing the callback must be indicated by either providing
          874  +// lpfnConnect and lpfnDisconnect OR by setting dwShareMode.
          875  +// If both the connection callbacks and dwShareMode are non-NULL, the callbacks
          876  +// will be used.
          877  +//
          878  +
          879  +typedef struct {
          880  +    DWORD           dwStructSize;
          881  +    LPSTR           lpstrGroupNames;        // OPTIONAL reader groups to include in
          882  +    DWORD           nMaxGroupNames;         //          search.  NULL defaults to
          883  +                                            //          SCard$DefaultReaders
          884  +    LPCGUID         rgguidInterfaces;       // OPTIONAL requested interfaces
          885  +    DWORD           cguidInterfaces;        //          supported by card's SSP
          886  +    LPSTR           lpstrCardNames;         // OPTIONAL requested card names; all cards w/
          887  +    DWORD           nMaxCardNames;          //          matching ATRs will be accepted
          888  +    LPOCNCHKPROC    lpfnCheck;              // OPTIONAL if NULL no user check will be performed.
          889  +    LPOCNCONNPROCA  lpfnConnect;            // OPTIONAL if lpfnConnect is provided,
          890  +    LPOCNDSCPROC    lpfnDisconnect;         //          lpfnDisconnect must also be set.
          891  +    LPVOID          pvUserData;             // OPTIONAL parameter to callbacks
          892  +    DWORD           dwShareMode;            // OPTIONAL must be set if lpfnCheck is not null
          893  +    DWORD           dwPreferredProtocols;   // OPTIONAL
          894  +} OPENCARD_SEARCH_CRITERIAA, *POPENCARD_SEARCH_CRITERIAA, *LPOPENCARD_SEARCH_CRITERIAA;
          895  +typedef struct {
          896  +    DWORD           dwStructSize;
          897  +    LPWSTR          lpstrGroupNames;        // OPTIONAL reader groups to include in
          898  +    DWORD           nMaxGroupNames;         //          search.  NULL defaults to
          899  +                                            //          SCard$DefaultReaders
          900  +    LPCGUID         rgguidInterfaces;       // OPTIONAL requested interfaces
          901  +    DWORD           cguidInterfaces;        //          supported by card's SSP
          902  +    LPWSTR          lpstrCardNames;         // OPTIONAL requested card names; all cards w/
          903  +    DWORD           nMaxCardNames;          //          matching ATRs will be accepted
          904  +    LPOCNCHKPROC    lpfnCheck;              // OPTIONAL if NULL no user check will be performed.
          905  +    LPOCNCONNPROCW  lpfnConnect;            // OPTIONAL if lpfnConnect is provided,
          906  +    LPOCNDSCPROC    lpfnDisconnect;         //          lpfnDisconnect must also be set.
          907  +    LPVOID          pvUserData;             // OPTIONAL parameter to callbacks
          908  +    DWORD           dwShareMode;            // OPTIONAL must be set if lpfnCheck is not null
          909  +    DWORD           dwPreferredProtocols;   // OPTIONAL
          910  +} OPENCARD_SEARCH_CRITERIAW, *POPENCARD_SEARCH_CRITERIAW, *LPOPENCARD_SEARCH_CRITERIAW;
          911  +#ifdef UNICODE
          912  +typedef OPENCARD_SEARCH_CRITERIAW OPENCARD_SEARCH_CRITERIA;
          913  +typedef POPENCARD_SEARCH_CRITERIAW POPENCARD_SEARCH_CRITERIA;
          914  +typedef LPOPENCARD_SEARCH_CRITERIAW LPOPENCARD_SEARCH_CRITERIA;
          915  +#else
          916  +typedef OPENCARD_SEARCH_CRITERIAA OPENCARD_SEARCH_CRITERIA;
          917  +typedef POPENCARD_SEARCH_CRITERIAA POPENCARD_SEARCH_CRITERIA;
          918  +typedef LPOPENCARD_SEARCH_CRITERIAA LPOPENCARD_SEARCH_CRITERIA;
          919  +#endif // UNICODE
          920  +
          921  +
          922  +//
          923  +// OPENCARDNAME_EX: used by SCardUIDlgSelectCard; replaces obsolete OPENCARDNAME
          924  +//
          925  +
          926  +typedef struct {
          927  +    DWORD           dwStructSize;           // REQUIRED
          928  +    SCARDCONTEXT    hSCardContext;          // REQUIRED
          929  +    HWND            hwndOwner;              // OPTIONAL
          930  +    DWORD           dwFlags;                // OPTIONAL -- default is SC_DLG_MINIMAL_UI
          931  +    LPCSTR          lpstrTitle;             // OPTIONAL
          932  +    LPCSTR          lpstrSearchDesc;        // OPTIONAL (eg. "Please insert your <brandname> smart card.")
          933  +    HICON           hIcon;                  // OPTIONAL 32x32 icon for your brand insignia
          934  +    POPENCARD_SEARCH_CRITERIAA pOpenCardSearchCriteria; // OPTIONAL
          935  +    LPOCNCONNPROCA  lpfnConnect;            // OPTIONAL - performed on successful selection
          936  +    LPVOID          pvUserData;             // OPTIONAL parameter to lpfnConnect
          937  +    DWORD           dwShareMode;            // OPTIONAL - if lpfnConnect is NULL, dwShareMode and
          938  +    DWORD           dwPreferredProtocols;   // OPTIONAL dwPreferredProtocols will be used to
          939  +                                            //          connect to the selected card
          940  +    LPSTR           lpstrRdr;               // REQUIRED [IN|OUT] Name of selected reader
          941  +    DWORD           nMaxRdr;                // REQUIRED [IN|OUT]
          942  +    LPSTR           lpstrCard;              // REQUIRED [IN|OUT] Name of selected card
          943  +    DWORD           nMaxCard;               // REQUIRED [IN|OUT]
          944  +    DWORD           dwActiveProtocol;       // [OUT] set only if dwShareMode not NULL
          945  +    SCARDHANDLE     hCardHandle;            // [OUT] set if a card connection was indicated
          946  +} OPENCARDNAME_EXA, *POPENCARDNAME_EXA, *LPOPENCARDNAME_EXA;
          947  +typedef struct {
          948  +    DWORD           dwStructSize;           // REQUIRED
          949  +    SCARDCONTEXT    hSCardContext;          // REQUIRED
          950  +    HWND            hwndOwner;              // OPTIONAL
          951  +    DWORD           dwFlags;                // OPTIONAL -- default is SC_DLG_MINIMAL_UI
          952  +    LPCWSTR         lpstrTitle;             // OPTIONAL
          953  +    LPCWSTR         lpstrSearchDesc;        // OPTIONAL (eg. "Please insert your <brandname> smart card.")
          954  +    HICON           hIcon;                  // OPTIONAL 32x32 icon for your brand insignia
          955  +    POPENCARD_SEARCH_CRITERIAW pOpenCardSearchCriteria; // OPTIONAL
          956  +    LPOCNCONNPROCW  lpfnConnect;            // OPTIONAL - performed on successful selection
          957  +    LPVOID          pvUserData;             // OPTIONAL parameter to lpfnConnect
          958  +    DWORD           dwShareMode;            // OPTIONAL - if lpfnConnect is NULL, dwShareMode and
          959  +    DWORD           dwPreferredProtocols;   // OPTIONAL dwPreferredProtocols will be used to
          960  +                                            //          connect to the selected card
          961  +    LPWSTR          lpstrRdr;               // REQUIRED [IN|OUT] Name of selected reader
          962  +    DWORD           nMaxRdr;                // REQUIRED [IN|OUT]
          963  +    LPWSTR          lpstrCard;              // REQUIRED [IN|OUT] Name of selected card
          964  +    DWORD           nMaxCard;               // REQUIRED [IN|OUT]
          965  +    DWORD           dwActiveProtocol;       // [OUT] set only if dwShareMode not NULL
          966  +    SCARDHANDLE     hCardHandle;            // [OUT] set if a card connection was indicated
          967  +} OPENCARDNAME_EXW, *POPENCARDNAME_EXW, *LPOPENCARDNAME_EXW;
          968  +#ifdef UNICODE
          969  +typedef OPENCARDNAME_EXW OPENCARDNAME_EX;
          970  +typedef POPENCARDNAME_EXW POPENCARDNAME_EX;
          971  +typedef LPOPENCARDNAME_EXW LPOPENCARDNAME_EX;
          972  +#else
          973  +typedef OPENCARDNAME_EXA OPENCARDNAME_EX;
          974  +typedef POPENCARDNAME_EXA POPENCARDNAME_EX;
          975  +typedef LPOPENCARDNAME_EXA LPOPENCARDNAME_EX;
          976  +#endif // UNICODE
          977  +
          978  +#define OPENCARDNAMEA_EX OPENCARDNAME_EXA
          979  +#define OPENCARDNAMEW_EX OPENCARDNAME_EXW
          980  +#define POPENCARDNAMEA_EX POPENCARDNAME_EXA
          981  +#define POPENCARDNAMEW_EX POPENCARDNAME_EXW
          982  +#define LPOPENCARDNAMEA_EX LPOPENCARDNAME_EXA
          983  +#define LPOPENCARDNAMEW_EX LPOPENCARDNAME_EXW
          984  +
          985  +
          986  +//
          987  +// SCardUIDlgSelectCard replaces GetOpenCardName
          988  +//
          989  +
          990  +extern WINSCARDAPI LONG WINAPI
          991  +SCardUIDlgSelectCardA(
          992  +    LPOPENCARDNAMEA_EX);
          993  +extern WINSCARDAPI LONG WINAPI
          994  +SCardUIDlgSelectCardW(
          995  +    LPOPENCARDNAMEW_EX);
          996  +#ifdef UNICODE
          997  +#define SCardUIDlgSelectCard  SCardUIDlgSelectCardW
          998  +#else
          999  +#define SCardUIDlgSelectCard  SCardUIDlgSelectCardA
         1000  +#endif // !UNICODE
         1001  +
         1002  +
         1003  +//
         1004  +// "Smart Card Common Dialog" definitions for backwards compatibility
         1005  +//  with the Smart Card Base Services SDK version 1.0
         1006  +//
         1007  +
         1008  +typedef struct {
         1009  +    DWORD           dwStructSize;
         1010  +    HWND            hwndOwner;
         1011  +    SCARDCONTEXT    hSCardContext;
         1012  +    LPSTR           lpstrGroupNames;
         1013  +    DWORD           nMaxGroupNames;
         1014  +    LPSTR           lpstrCardNames;
         1015  +    DWORD           nMaxCardNames;
         1016  +    LPCGUID         rgguidInterfaces;
         1017  +    DWORD           cguidInterfaces;
         1018  +    LPSTR           lpstrRdr;
         1019  +    DWORD           nMaxRdr;
         1020  +    LPSTR           lpstrCard;
         1021  +    DWORD           nMaxCard;
         1022  +    LPCSTR          lpstrTitle;
         1023  +    DWORD           dwFlags;
         1024  +    LPVOID          pvUserData;
         1025  +    DWORD           dwShareMode;
         1026  +    DWORD           dwPreferredProtocols;
         1027  +    DWORD           dwActiveProtocol;
         1028  +    LPOCNCONNPROCA  lpfnConnect;
         1029  +    LPOCNCHKPROC    lpfnCheck;
         1030  +    LPOCNDSCPROC    lpfnDisconnect;
         1031  +    SCARDHANDLE     hCardHandle;
         1032  +} OPENCARDNAMEA, *POPENCARDNAMEA, *LPOPENCARDNAMEA;
         1033  +typedef struct {
         1034  +    DWORD           dwStructSize;
         1035  +    HWND            hwndOwner;
         1036  +    SCARDCONTEXT    hSCardContext;
         1037  +    LPWSTR          lpstrGroupNames;
         1038  +    DWORD           nMaxGroupNames;
         1039  +    LPWSTR          lpstrCardNames;
         1040  +    DWORD           nMaxCardNames;
         1041  +    LPCGUID         rgguidInterfaces;
         1042  +    DWORD           cguidInterfaces;
         1043  +    LPWSTR          lpstrRdr;
         1044  +    DWORD           nMaxRdr;
         1045  +    LPWSTR          lpstrCard;
         1046  +    DWORD           nMaxCard;
         1047  +    LPCWSTR         lpstrTitle;
         1048  +    DWORD           dwFlags;
         1049  +    LPVOID          pvUserData;
         1050  +    DWORD           dwShareMode;
         1051  +    DWORD           dwPreferredProtocols;
         1052  +    DWORD           dwActiveProtocol;
         1053  +    LPOCNCONNPROCW  lpfnConnect;
         1054  +    LPOCNCHKPROC    lpfnCheck;
         1055  +    LPOCNDSCPROC    lpfnDisconnect;
         1056  +    SCARDHANDLE     hCardHandle;
         1057  +} OPENCARDNAMEW, *POPENCARDNAMEW, *LPOPENCARDNAMEW;
         1058  +#ifdef UNICODE
         1059  +typedef OPENCARDNAMEW OPENCARDNAME;
         1060  +typedef POPENCARDNAMEW POPENCARDNAME;
         1061  +typedef LPOPENCARDNAMEW LPOPENCARDNAME;
         1062  +#else
         1063  +typedef OPENCARDNAMEA OPENCARDNAME;
         1064  +typedef POPENCARDNAMEA POPENCARDNAME;
         1065  +typedef LPOPENCARDNAMEA LPOPENCARDNAME;
         1066  +#endif // UNICODE
         1067  +
         1068  +// Backwards compatibility macros
         1069  +#define OPENCARDNAME_A OPENCARDNAMEA
         1070  +#define OPENCARDNAME_W OPENCARDNAMEW
         1071  +#define POPENCARDNAME_A POPENCARDNAMEA
         1072  +#define POPENCARDNAME_W POPENCARDNAMEW
         1073  +#define LPOPENCARDNAME_A LPOPENCARDNAMEA
         1074  +#define LPOPENCARDNAME_W LPOPENCARDNAMEW
         1075  +
         1076  +extern WINSCARDAPI LONG WINAPI
         1077  +GetOpenCardNameA(
         1078  +    LPOPENCARDNAMEA);
         1079  +extern WINSCARDAPI LONG WINAPI
         1080  +GetOpenCardNameW(
         1081  +    LPOPENCARDNAMEW);
         1082  +#ifdef UNICODE
         1083  +#define GetOpenCardName  GetOpenCardNameW
         1084  +#else
         1085  +#define GetOpenCardName  GetOpenCardNameA
         1086  +#endif // !UNICODE
         1087  +
         1088  +extern WINSCARDAPI LONG WINAPI
         1089  +SCardDlgExtendedError (void);
         1090  +
         1091  +#if (NTDDI_VERSION >= NTDDI_VISTA)
         1092  +
         1093  +//
         1094  +// Smartcard Caching API
         1095  +//
         1096  +
         1097  +extern WINSCARDAPI LONG WINAPI
         1098  +SCardReadCacheA(
         1099  +      SCARDCONTEXT hContext,
         1100  +      UUID *CardIdentifier,
         1101  +      DWORD FreshnessCounter,
         1102  +      LPSTR LookupName,
         1103  +     PBYTE Data,
         1104  +     DWORD *DataLen);
         1105  +extern WINSCARDAPI LONG WINAPI
         1106  +SCardReadCacheW(
         1107  +      SCARDCONTEXT hContext,
         1108  +      UUID *CardIdentifier,
         1109  +      DWORD FreshnessCounter,
         1110  +      LPWSTR LookupName,
         1111  +     PBYTE Data,
         1112  +     DWORD *DataLen);
         1113  +#ifdef UNICODE
         1114  +#define SCardReadCache  SCardReadCacheW
         1115  +#else
         1116  +#define SCardReadCache  SCardReadCacheA
         1117  +#endif // !UNICODE
         1118  +
         1119  +extern WINSCARDAPI LONG WINAPI
         1120  +SCardWriteCacheA(
         1121  +     SCARDCONTEXT hContext,
         1122  +     UUID *CardIdentifier,
         1123  +     DWORD FreshnessCounter,
         1124  +     LPSTR LookupName,
         1125  +     PBYTE Data,
         1126  +     DWORD DataLen);
         1127  +extern WINSCARDAPI LONG WINAPI
         1128  +SCardWriteCacheW(
         1129  +     SCARDCONTEXT hContext,
         1130  +     UUID *CardIdentifier,
         1131  +     DWORD FreshnessCounter,
         1132  +     LPWSTR LookupName,
         1133  +     PBYTE Data,
         1134  +     DWORD DataLen);
         1135  +#ifdef UNICODE
         1136  +#define SCardWriteCache  SCardWriteCacheW
         1137  +#else
         1138  +#define SCardWriteCache  SCardWriteCacheA
         1139  +#endif // !UNICODE
         1140  +
         1141  +#endif // (NTDDI_VERSION >= NTDDI_VISTA)
         1142  +
         1143  +#ifdef __cplusplus
         1144  +}
         1145  +#endif
         1146  +#endif // _WINSCARD_H_
         1147  +
         1148  +

Added build/cackey_win32_build/include/winsmcrd.h version [7735605d6f].

            1  +/*++
            2  +
            3  +Copyright (c) 1996  Microsoft Corporation
            4  +
            5  +Module Name:
            6  +
            7  +    winsmcrd.h
            8  +
            9  +Abstract:
           10  +    Smart Card class/port IOCTL codes. This file is required for all code
           11  +    user mode and kernel mode, using Smart Card IOCTL's, defines,
           12  +    data structures
           13  +
           14  +Revision History:
           15  +
           16  +--*/
           17  +
           18  +
           19  +#ifndef _NTDDSCRD_H2_
           20  +#define _NTDDSCRD_H2_
           21  +
           22  +#if defined (_MSC_VER) && (_MSC_VER >= 1020)
           23  +#pragma once
           24  +#endif
           25  +
           26  +#ifdef __cplusplus
           27  +extern "C" {
           28  +#endif
           29  +
           30  +#ifdef _WINSCARD_H_
           31  +typedef DWORD ULONG;
           32  +typedef WORD UWORD;
           33  +typedef BYTE UCHAR;
           34  +#else
           35  +typedef ULONG DWORD;
           36  +// typedef UWORD WORD;
           37  +typedef UCHAR BYTE;
           38  +#endif
           39  +
           40  +#ifndef DEVICE_TYPE_SMARTCARD
           41  +#ifndef FILE_DEVICE_SMARTCARD
           42  +#define FILE_DEVICE_SMARTCARD           0x00000031
           43  +#endif
           44  +#else
           45  +#if 0x00000031 != FILE_DEVICE_SMARTCARD
           46  +#error "Incorrect Smart Card Device Definition"
           47  +#endif
           48  +#endif
           49  +
           50  +
           51  +//
           52  +// Various constants
           53  +//
           54  +
           55  +#define SCARD_ATR_LENGTH 33  // ISO 7816-3 spec.
           56  +
           57  +//
           58  +///////////////////////////////////////////////////////////////////////////////
           59  +//
           60  +//  Protocol Flag definitions
           61  +//
           62  +
           63  +#define SCARD_PROTOCOL_UNDEFINED    0x00000000  // There is no active protocol.
           64  +#define SCARD_PROTOCOL_T0           0x00000001  // T=0 is the active protocol.
           65  +#define SCARD_PROTOCOL_T1           0x00000002  // T=1 is the active protocol.
           66  +#define SCARD_PROTOCOL_RAW          0x00010000  // Raw is the active protocol.
           67  +//
           68  +// This is the mask of ISO defined transmission protocols
           69  +//
           70  +#define SCARD_PROTOCOL_Tx           (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1)
           71  +//
           72  +// Use the default transmission parameters / card clock freq.
           73  +//
           74  +#define SCARD_PROTOCOL_DEFAULT      0x80000000
           75  +//
           76  +// Use optimal transmission parameters / card clock freq.
           77  +// Since using the optimal parameters is the default case no bit is defined to be 1
           78  +//
           79  +#define SCARD_PROTOCOL_OPTIMAL      0x00000000
           80  +
           81  +
           82  +//
           83  +// Ioctl parameters 1 for IOCTL_SMARTCARD_POWER
           84  +//
           85  +#define SCARD_POWER_DOWN 0          // Power down the card.
           86  +#define SCARD_COLD_RESET 1          // Cycle power and reset the card.
           87  +#define SCARD_WARM_RESET 2          // Force a reset on the card.
           88  +
           89  +//
           90  +///////////////////////////////////////////////////////////////////////////////
           91  +//
           92  +//  Reader Action IOCTLs
           93  +//
           94  +
           95  +#define SCARD_CTL_CODE(code)        CTL_CODE(FILE_DEVICE_SMARTCARD, \
           96  +                                            (code), \
           97  +                                            METHOD_BUFFERED, \
           98  +                                            FILE_ANY_ACCESS)
           99  +
          100  +#define IOCTL_SMARTCARD_POWER           SCARD_CTL_CODE( 1)
          101  +#define IOCTL_SMARTCARD_GET_ATTRIBUTE   SCARD_CTL_CODE( 2)
          102  +#define IOCTL_SMARTCARD_SET_ATTRIBUTE   SCARD_CTL_CODE( 3)
          103  +#define IOCTL_SMARTCARD_CONFISCATE      SCARD_CTL_CODE( 4)
          104  +#define IOCTL_SMARTCARD_TRANSMIT        SCARD_CTL_CODE( 5)
          105  +#define IOCTL_SMARTCARD_EJECT           SCARD_CTL_CODE( 6)
          106  +#define IOCTL_SMARTCARD_SWALLOW         SCARD_CTL_CODE( 7)
          107  +// #define IOCTL_SMARTCARD_READ            SCARD_CTL_CODE( 8) obsolete
          108  +// #define IOCTL_SMARTCARD_WRITE           SCARD_CTL_CODE( 9) obsolete
          109  +#define IOCTL_SMARTCARD_IS_PRESENT      SCARD_CTL_CODE(10)
          110  +#define IOCTL_SMARTCARD_IS_ABSENT       SCARD_CTL_CODE(11)
          111  +#define IOCTL_SMARTCARD_SET_PROTOCOL    SCARD_CTL_CODE(12)
          112  +#define IOCTL_SMARTCARD_GET_STATE       SCARD_CTL_CODE(14)
          113  +#define IOCTL_SMARTCARD_GET_LAST_ERROR  SCARD_CTL_CODE(15)
          114  +#define IOCTL_SMARTCARD_GET_PERF_CNTR   SCARD_CTL_CODE(16)
          115  +
          116  +
          117  +//
          118  +///////////////////////////////////////////////////////////////////////////////
          119  +//
          120  +// Tags for requesting card and reader attributes
          121  +//
          122  +
          123  +#define MAXIMUM_ATTR_STRING_LENGTH 32   // Nothing bigger than this from getAttr
          124  +#define MAXIMUM_SMARTCARD_READERS  10   // Limit the readers on the system
          125  +
          126  +#define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
          127  +
          128  +#define SCARD_CLASS_VENDOR_INFO     1   // Vendor information definitions
          129  +#define SCARD_CLASS_COMMUNICATIONS  2   // Communication definitions
          130  +#define SCARD_CLASS_PROTOCOL        3   // Protocol definitions
          131  +#define SCARD_CLASS_POWER_MGMT      4   // Power Management definitions
          132  +#define SCARD_CLASS_SECURITY        5   // Security Assurance definitions
          133  +#define SCARD_CLASS_MECHANICAL      6   // Mechanical characteristic definitions
          134  +#define SCARD_CLASS_VENDOR_DEFINED  7   // Vendor specific definitions
          135  +#define SCARD_CLASS_IFD_PROTOCOL    8   // Interface Device Protocol options
          136  +#define SCARD_CLASS_ICC_STATE       9   // ICC State specific definitions
          137  +#define SCARD_CLASS_PERF       0x7ffe   // performace counters
          138  +#define SCARD_CLASS_SYSTEM     0x7fff   // System-specific definitions
          139  +
          140  +#define SCARD_ATTR_VENDOR_NAME SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0100)
          141  +#define SCARD_ATTR_VENDOR_IFD_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0101)
          142  +#define SCARD_ATTR_VENDOR_IFD_VERSION SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0102)
          143  +#define SCARD_ATTR_VENDOR_IFD_SERIAL_NO SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO, 0x0103)
          144  +#define SCARD_ATTR_CHANNEL_ID SCARD_ATTR_VALUE(SCARD_CLASS_COMMUNICATIONS, 0x0110)
          145  +#define SCARD_ATTR_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0120)
          146  +// #define SCARD_ATTR_ASYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0120)
          147  +#define SCARD_ATTR_DEFAULT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0121)
          148  +#define SCARD_ATTR_MAX_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0122)
          149  +#define SCARD_ATTR_DEFAULT_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0123)
          150  +#define SCARD_ATTR_MAX_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0124)
          151  +#define SCARD_ATTR_MAX_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0125)
          152  +// #define SCARD_ATTR_SYNC_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL, 0x0126)
          153  +#define SCARD_ATTR_POWER_MGMT_SUPPORT SCARD_ATTR_VALUE(SCARD_CLASS_POWER_MGMT, 0x0131)
          154  +#define SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0140)
          155  +#define SCARD_ATTR_USER_AUTH_INPUT_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY, 0x0142)
          156  +#define SCARD_ATTR_CHARACTERISTICS SCARD_ATTR_VALUE(SCARD_CLASS_MECHANICAL, 0x0150)
          157  +
          158  +#define SCARD_ATTR_CURRENT_PROTOCOL_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0201)
          159  +#define SCARD_ATTR_CURRENT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0202)
          160  +#define SCARD_ATTR_CURRENT_F SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0203)
          161  +#define SCARD_ATTR_CURRENT_D SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0204)
          162  +#define SCARD_ATTR_CURRENT_N SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0205)
          163  +#define SCARD_ATTR_CURRENT_W SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0206)
          164  +#define SCARD_ATTR_CURRENT_IFSC SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0207)
          165  +#define SCARD_ATTR_CURRENT_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0208)
          166  +#define SCARD_ATTR_CURRENT_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x0209)
          167  +#define SCARD_ATTR_CURRENT_CWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020a)
          168  +#define SCARD_ATTR_CURRENT_EBC_ENCODING SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020b)
          169  +#define SCARD_ATTR_EXTENDED_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL, 0x020c)
          170  +
          171  +#define SCARD_ATTR_ICC_PRESENCE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0300)
          172  +#define SCARD_ATTR_ICC_INTERFACE_STATUS SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0301)
          173  +#define SCARD_ATTR_CURRENT_IO_STATE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0302)
          174  +#define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303)
          175  +#define SCARD_ATTR_ICC_TYPE_PER_ATR SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0304)
          176  +
          177  +#define SCARD_ATTR_ESC_RESET SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA000)
          178  +#define SCARD_ATTR_ESC_CANCEL SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA003)
          179  +#define SCARD_ATTR_ESC_AUTHREQUEST SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA005)
          180  +#define SCARD_ATTR_MAXINPUT SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA007)
          181  +
          182  +#define SCARD_ATTR_DEVICE_UNIT SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0001)
          183  +#define SCARD_ATTR_DEVICE_IN_USE SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0002)
          184  +#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0003)
          185  +#define SCARD_ATTR_DEVICE_SYSTEM_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0004)
          186  +#define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0005)
          187  +#define SCARD_ATTR_DEVICE_SYSTEM_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0006)
          188  +#define SCARD_ATTR_SUPRESS_T1_IFS_REQUEST SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM, 0x0007)
          189  +
          190  +#define SCARD_PERF_NUM_TRANSMISSIONS SCARD_ATTR_VALUE(SCARD_CLASS_PERF, 0x0001)
          191  +#define SCARD_PERF_BYTES_TRANSMITTED SCARD_ATTR_VALUE(SCARD_CLASS_PERF, 0x0002)
          192  +#define SCARD_PERF_TRANSMISSION_TIME SCARD_ATTR_VALUE(SCARD_CLASS_PERF, 0x0003)
          193  +
          194  +#ifdef UNICODE
          195  +#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_W
          196  +#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_W
          197  +#else
          198  +#define SCARD_ATTR_DEVICE_FRIENDLY_NAME SCARD_ATTR_DEVICE_FRIENDLY_NAME_A
          199  +#define SCARD_ATTR_DEVICE_SYSTEM_NAME SCARD_ATTR_DEVICE_SYSTEM_NAME_A
          200  +#endif
          201  +
          202  +
          203  +//
          204  +// T=0 Protocol Defines
          205  +//
          206  +
          207  +#define SCARD_T0_HEADER_LENGTH 7
          208  +#define SCARD_T0_CMD_LENGTH 5
          209  +
          210  +
          211  +//
          212  +// T=1 Protocol Defines
          213  +//
          214  +
          215  +#define SCARD_T1_PROLOGUE_LENGTH 3
          216  +#define SCARD_T1_EPILOGUE_LENGTH 2
          217  +#define SCARD_T1_MAX_IFS 254
          218  +
          219  +
          220  +//
          221  +///////////////////////////////////////////////////////////////////////////////
          222  +//
          223  +//  Reader states
          224  +//
          225  +
          226  +#define SCARD_UNKNOWN     0   // This value implies the driver is unaware
          227  +                              // of the current state of the reader.
          228  +#define SCARD_ABSENT      1   // This value implies there is no card in
          229  +                              // the reader.
          230  +#define SCARD_PRESENT     2   // This value implies there is a card is
          231  +                              // present in the reader, but that it has
          232  +                              // not been moved into position for use.
          233  +#define SCARD_SWALLOWED   3   // This value implies there is a card in the
          234  +                              // reader in position for use.  The card is
          235  +                              // not powered.
          236  +#define SCARD_POWERED     4   // This value implies there is power is
          237  +                              // being provided to the card, but the
          238  +                              // Reader Driver is unaware of the mode of
          239  +                              // the card.
          240  +#define SCARD_NEGOTIABLE  5   // This value implies the card has been
          241  +                              // reset and is awaiting PTS negotiation.
          242  +#define SCARD_SPECIFIC    6   // This value implies the card has been
          243  +                              // reset and specific communication
          244  +                              // protocols have been established.
          245  +
          246  +////////////////////////////////////////////////////////////////////////////////
          247  +//
          248  +//  I/O Services
          249  +//
          250  +//      The following services provide access to the I/O capabilities of the
          251  +//      reader drivers.  Services of the Smart Card are requested by placing the
          252  +//      following structure into the protocol buffer:
          253  +//
          254  +
          255  +
          256  +typedef struct _SCARD_IO_REQUEST{
          257  +    DWORD dwProtocol;   // Protocol identifier
          258  +    DWORD cbPciLength;  // Protocol Control Information Length
          259  +} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
          260  +typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
          261  +
          262  +
          263  +//
          264  +// T=0 protocol services.
          265  +//
          266  +
          267  +typedef struct {
          268  +    BYTE
          269  +        bCla,   // The instruction class
          270  +        bIns,   // The instruction code within the instruction class
          271  +        bP1,
          272  +        bP2,    // Parameters to the instruction
          273  +        bP3;    // Size of I/O Transfer
          274  +} SCARD_T0_COMMAND, *LPSCARD_T0_COMMAND;
          275  +
          276  +typedef struct {
          277  +    SCARD_IO_REQUEST ioRequest;
          278  +    BYTE
          279  +        bSw1,
          280  +        bSw2;           // Return codes from the instruction
          281  +    union
          282  +    {
          283  +        SCARD_T0_COMMAND CmdBytes;
          284  +        BYTE rgbHeader[5];
          285  +    } DUMMYUNIONNAME;
          286  +} SCARD_T0_REQUEST;
          287  +
          288  +typedef SCARD_T0_REQUEST *PSCARD_T0_REQUEST, *LPSCARD_T0_REQUEST;
          289  +
          290  +
          291  +//
          292  +//  T=1 Protocol Services
          293  +//
          294  +
          295  +typedef struct {
          296  +    SCARD_IO_REQUEST ioRequest;
          297  +} SCARD_T1_REQUEST;
          298  +typedef SCARD_T1_REQUEST *PSCARD_T1_REQUEST, *LPSCARD_T1_REQUEST;
          299  +
          300  +
          301  +//
          302  +////////////////////////////////////////////////////////////////////////////////
          303  +//
          304  +//  Driver attribute flags
          305  +//
          306  +
          307  +#define SCARD_READER_SWALLOWS       0x00000001  // Reader has a card swallowing
          308  +                                                // mechanism.
          309  +#define SCARD_READER_EJECTS         0x00000002  // Reader has a card ejection
          310  +                                                // mechanism.
          311  +#define SCARD_READER_CONFISCATES    0x00000004  // Reader has a card capture
          312  +                                                // mechanism.
          313  +
          314  +//
          315  +///////////////////////////////////////////////////////////////////////////////
          316  +//
          317  +// Type of reader
          318  +//
          319  +#define SCARD_READER_TYPE_SERIAL    0x01
          320  +#define SCARD_READER_TYPE_PARALELL  0x02
          321  +#define SCARD_READER_TYPE_KEYBOARD  0x04
          322  +#define SCARD_READER_TYPE_SCSI      0x08
          323  +#define SCARD_READER_TYPE_IDE       0x10
          324  +#define SCARD_READER_TYPE_USB       0x20
          325  +#define SCARD_READER_TYPE_PCMCIA    0x40
          326  +#define SCARD_READER_TYPE_VENDOR    0xF0
          327  +
          328  +#ifdef __cplusplus
          329  +}
          330  +#endif
          331  +#endif
          332  +
          333  +

Added build/cackey_win32_build/include/zconf.h version [8758c02117].

            1  +/* zconf.h -- configuration of the zlib compression library
            2  + * Copyright (C) 1995-2005 Jean-loup Gailly.
            3  + * For conditions of distribution and use, see copyright notice in zlib.h
            4  + */
            5  +
            6  +/* @(#) $Id$ */
            7  +
            8  +#ifndef ZCONF_H
            9  +#define ZCONF_H
           10  +
           11  +/*
           12  + * If you *really* need a unique prefix for all types and library functions,
           13  + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
           14  + */
           15  +#ifdef Z_PREFIX
           16  +#  define deflateInit_          z_deflateInit_
           17  +#  define deflate               z_deflate
           18  +#  define deflateEnd            z_deflateEnd
           19  +#  define inflateInit_          z_inflateInit_
           20  +#  define inflate               z_inflate
           21  +#  define inflateEnd            z_inflateEnd
           22  +#  define deflateInit2_         z_deflateInit2_
           23  +#  define deflateSetDictionary  z_deflateSetDictionary
           24  +#  define deflateCopy           z_deflateCopy
           25  +#  define deflateReset          z_deflateReset
           26  +#  define deflateParams         z_deflateParams
           27  +#  define deflateBound          z_deflateBound
           28  +#  define deflatePrime          z_deflatePrime
           29  +#  define inflateInit2_         z_inflateInit2_
           30  +#  define inflateSetDictionary  z_inflateSetDictionary
           31  +#  define inflateSync           z_inflateSync
           32  +#  define inflateSyncPoint      z_inflateSyncPoint
           33  +#  define inflateCopy           z_inflateCopy
           34  +#  define inflateReset          z_inflateReset
           35  +#  define inflateBack           z_inflateBack
           36  +#  define inflateBackEnd        z_inflateBackEnd
           37  +#  define compress              z_compress
           38  +#  define compress2             z_compress2
           39  +#  define compressBound         z_compressBound
           40  +#  define uncompress            z_uncompress
           41  +#  define adler32               z_adler32
           42  +#  define crc32                 z_crc32
           43  +#  define get_crc_table         z_get_crc_table
           44  +#  define zError                z_zError
           45  +
           46  +#  define alloc_func            z_alloc_func
           47  +#  define free_func             z_free_func
           48  +#  define in_func               z_in_func
           49  +#  define out_func              z_out_func
           50  +#  define Byte                  z_Byte
           51  +#  define uInt                  z_uInt
           52  +#  define uLong                 z_uLong
           53  +#  define Bytef                 z_Bytef
           54  +#  define charf                 z_charf
           55  +#  define intf                  z_intf
           56  +#  define uIntf                 z_uIntf
           57  +#  define uLongf                z_uLongf
           58  +#  define voidpf                z_voidpf
           59  +#  define voidp                 z_voidp
           60  +#endif
           61  +
           62  +#if defined(__MSDOS__) && !defined(MSDOS)
           63  +#  define MSDOS
           64  +#endif
           65  +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
           66  +#  define OS2
           67  +#endif
           68  +#if defined(_WINDOWS) && !defined(WINDOWS)
           69  +#  define WINDOWS
           70  +#endif
           71  +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
           72  +#  ifndef WIN32
           73  +#    define WIN32
           74  +#  endif
           75  +#endif
           76  +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
           77  +#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
           78  +#    ifndef SYS16BIT
           79  +#      define SYS16BIT
           80  +#    endif
           81  +#  endif
           82  +#endif
           83  +
           84  +/*
           85  + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
           86  + * than 64k bytes at a time (needed on systems with 16-bit int).
           87  + */
           88  +#ifdef SYS16BIT
           89  +#  define MAXSEG_64K
           90  +#endif
           91  +#ifdef MSDOS
           92  +#  define UNALIGNED_OK
           93  +#endif
           94  +
           95  +#ifdef __STDC_VERSION__
           96  +#  ifndef STDC
           97  +#    define STDC
           98  +#  endif
           99  +#  if __STDC_VERSION__ >= 199901L
          100  +#    ifndef STDC99
          101  +#      define STDC99
          102  +#    endif
          103  +#  endif
          104  +#endif
          105  +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
          106  +#  define STDC
          107  +#endif
          108  +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
          109  +#  define STDC
          110  +#endif
          111  +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
          112  +#  define STDC
          113  +#endif
          114  +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
          115  +#  define STDC
          116  +#endif
          117  +
          118  +#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
          119  +#  define STDC
          120  +#endif
          121  +
          122  +#ifndef STDC
          123  +#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
          124  +#    define const       /* note: need a more gentle solution here */
          125  +#  endif
          126  +#endif
          127  +
          128  +/* Some Mac compilers merge all .h files incorrectly: */
          129  +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
          130  +#  define NO_DUMMY_DECL
          131  +#endif
          132  +
          133  +/* Maximum value for memLevel in deflateInit2 */
          134  +#ifndef MAX_MEM_LEVEL
          135  +#  ifdef MAXSEG_64K
          136  +#    define MAX_MEM_LEVEL 8
          137  +#  else
          138  +#    define MAX_MEM_LEVEL 9
          139  +#  endif
          140  +#endif
          141  +
          142  +/* Maximum value for windowBits in deflateInit2 and inflateInit2.
          143  + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
          144  + * created by gzip. (Files created by minigzip can still be extracted by
          145  + * gzip.)
          146  + */
          147  +#ifndef MAX_WBITS
          148  +#  define MAX_WBITS   15 /* 32K LZ77 window */
          149  +#endif
          150  +
          151  +/* The memory requirements for deflate are (in bytes):
          152  +            (1 << (windowBits+2)) +  (1 << (memLevel+9))
          153  + that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
          154  + plus a few kilobytes for small objects. For example, if you want to reduce
          155  + the default memory requirements from 256K to 128K, compile with
          156  +     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
          157  + Of course this will generally degrade compression (there's no free lunch).
          158  +
          159  +   The memory requirements for inflate are (in bytes) 1 << windowBits
          160  + that is, 32K for windowBits=15 (default value) plus a few kilobytes
          161  + for small objects.
          162  +*/
          163  +
          164  +                        /* Type declarations */
          165  +
          166  +#ifndef OF /* function prototypes */
          167  +#  ifdef STDC
          168  +#    define OF(args)  args
          169  +#  else
          170  +#    define OF(args)  ()
          171  +#  endif
          172  +#endif
          173  +
          174  +/* The following definitions for FAR are needed only for MSDOS mixed
          175  + * model programming (small or medium model with some far allocations).
          176  + * This was tested only with MSC; for other MSDOS compilers you may have
          177  + * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
          178  + * just define FAR to be empty.
          179  + */
          180  +#ifdef SYS16BIT
          181  +#  if defined(M_I86SM) || defined(M_I86MM)
          182  +     /* MSC small or medium model */
          183  +#    define SMALL_MEDIUM
          184  +#    ifdef _MSC_VER
          185  +#      define FAR _far
          186  +#    else
          187  +#      define FAR far
          188  +#    endif
          189  +#  endif
          190  +#  if (defined(__SMALL__) || defined(__MEDIUM__))
          191  +     /* Turbo C small or medium model */
          192  +#    define SMALL_MEDIUM
          193  +#    ifdef __BORLANDC__
          194  +#      define FAR _far
          195  +#    else
          196  +#      define FAR far
          197  +#    endif
          198  +#  endif
          199  +#endif
          200  +
          201  +#if defined(WINDOWS) || defined(WIN32)
          202  +   /* If building or using zlib as a DLL, define ZLIB_DLL.
          203  +    * This is not mandatory, but it offers a little performance increase.
          204  +    */
          205  +#  ifdef ZLIB_DLL
          206  +#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
          207  +#      ifdef ZLIB_INTERNAL
          208  +#        define ZEXTERN extern __declspec(dllexport)
          209  +#      else
          210  +#        define ZEXTERN extern __declspec(dllimport)
          211  +#      endif
          212  +#    endif
          213  +#  endif  /* ZLIB_DLL */
          214  +   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
          215  +    * define ZLIB_WINAPI.
          216  +    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
          217  +    */
          218  +#  ifdef ZLIB_WINAPI
          219  +#    ifdef FAR
          220  +#      undef FAR
          221  +#    endif
          222  +#    include <windows.h>
          223  +     /* No need for _export, use ZLIB.DEF instead. */
          224  +     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
          225  +#    define ZEXPORT WINAPI
          226  +#    ifdef WIN32
          227  +#      define ZEXPORTVA WINAPIV
          228  +#    else
          229  +#      define ZEXPORTVA FAR CDECL
          230  +#    endif
          231  +#  endif
          232  +#endif
          233  +
          234  +#if defined (__BEOS__)
          235  +#  ifdef ZLIB_DLL
          236  +#    ifdef ZLIB_INTERNAL
          237  +#      define ZEXPORT   __declspec(dllexport)
          238  +#      define ZEXPORTVA __declspec(dllexport)
          239  +#    else
          240  +#      define ZEXPORT   __declspec(dllimport)
          241  +#      define ZEXPORTVA __declspec(dllimport)
          242  +#    endif
          243  +#  endif
          244  +#endif
          245  +
          246  +#ifndef ZEXTERN
          247  +#  define ZEXTERN extern
          248  +#endif
          249  +#ifndef ZEXPORT
          250  +#  define ZEXPORT
          251  +#endif
          252  +#ifndef ZEXPORTVA
          253  +#  define ZEXPORTVA
          254  +#endif
          255  +
          256  +#ifndef FAR
          257  +#  define FAR
          258  +#endif
          259  +
          260  +#if !defined(__MACTYPES__)
          261  +typedef unsigned char  Byte;  /* 8 bits */
          262  +#endif
          263  +typedef unsigned int   uInt;  /* 16 bits or more */
          264  +typedef unsigned long  uLong; /* 32 bits or more */
          265  +
          266  +#ifdef SMALL_MEDIUM
          267  +   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
          268  +#  define Bytef Byte FAR
          269  +#else
          270  +   typedef Byte  FAR Bytef;
          271  +#endif
          272  +typedef char  FAR charf;
          273  +typedef int   FAR intf;
          274  +typedef uInt  FAR uIntf;
          275  +typedef uLong FAR uLongf;
          276  +
          277  +#ifdef STDC
          278  +   typedef void const *voidpc;
          279  +   typedef void FAR   *voidpf;
          280  +   typedef void       *voidp;
          281  +#else
          282  +   typedef Byte const *voidpc;
          283  +   typedef Byte FAR   *voidpf;
          284  +   typedef Byte       *voidp;
          285  +#endif
          286  +
          287  +#if 1           /* HAVE_UNISTD_H -- this line is updated by ./configure */
          288  +#  include <sys/types.h> /* for off_t */
          289  +#  include <unistd.h>    /* for SEEK_* and off_t */
          290  +#  ifdef VMS
          291  +#    include <unixio.h>   /* for off_t */
          292  +#  endif
          293  +#  define z_off_t off_t
          294  +#endif
          295  +#ifndef SEEK_SET
          296  +#  define SEEK_SET        0       /* Seek from beginning of file.  */
          297  +#  define SEEK_CUR        1       /* Seek from current position.  */
          298  +#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
          299  +#endif
          300  +#ifndef z_off_t
          301  +#  define z_off_t long
          302  +#endif
          303  +
          304  +#if defined(__OS400__)
          305  +#  define NO_vsnprintf
          306  +#endif
          307  +
          308  +#if defined(__MVS__)
          309  +#  define NO_vsnprintf
          310  +#  ifdef FAR
          311  +#    undef FAR
          312  +#  endif
          313  +#endif
          314  +
          315  +/* MVS linker does not support external names larger than 8 bytes */
          316  +#if defined(__MVS__)
          317  +#   pragma map(deflateInit_,"DEIN")
          318  +#   pragma map(deflateInit2_,"DEIN2")
          319  +#   pragma map(deflateEnd,"DEEND")
          320  +#   pragma map(deflateBound,"DEBND")
          321  +#   pragma map(inflateInit_,"ININ")
          322  +#   pragma map(inflateInit2_,"ININ2")
          323  +#   pragma map(inflateEnd,"INEND")
          324  +#   pragma map(inflateSync,"INSY")
          325  +#   pragma map(inflateSetDictionary,"INSEDI")
          326  +#   pragma map(compressBound,"CMBND")
          327  +#   pragma map(inflate_table,"INTABL")
          328  +#   pragma map(inflate_fast,"INFA")
          329  +#   pragma map(inflate_copyright,"INCOPY")
          330  +#endif
          331  +
          332  +#endif /* ZCONF_H */

Added build/cackey_win32_build/include/zlib.h version [1a18ba7ea3].

            1  +/* zlib.h -- interface of the 'zlib' general purpose compression library
            2  +  version 1.2.3, July 18th, 2005
            3  +
            4  +  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
            5  +
            6  +  This software is provided 'as-is', without any express or implied
            7  +  warranty.  In no event will the authors be held liable for any damages
            8  +  arising from the use of this software.
            9  +
           10  +  Permission is granted to anyone to use this software for any purpose,
           11  +  including commercial applications, and to alter it and redistribute it
           12  +  freely, subject to the following restrictions:
           13  +
           14  +  1. The origin of this software must not be misrepresented; you must not
           15  +     claim that you wrote the original software. If you use this software
           16  +     in a product, an acknowledgment in the product documentation would be
           17  +     appreciated but is not required.
           18  +  2. Altered source versions must be plainly marked as such, and must not be
           19  +     misrepresented as being the original software.
           20  +  3. This notice may not be removed or altered from any source distribution.
           21  +
           22  +  Jean-loup Gailly        Mark Adler
           23  +  jloup@gzip.org          madler@alumni.caltech.edu
           24  +
           25  +
           26  +  The data format used by the zlib library is described by RFCs (Request for
           27  +  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
           28  +  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
           29  +*/
           30  +
           31  +#ifndef ZLIB_H
           32  +#define ZLIB_H
           33  +
           34  +#include "zconf.h"
           35  +
           36  +#ifdef __cplusplus
           37  +extern "C" {
           38  +#endif
           39  +
           40  +#define ZLIB_VERSION "1.2.3"
           41  +#define ZLIB_VERNUM 0x1230
           42  +
           43  +/*
           44  +     The 'zlib' compression library provides in-memory compression and
           45  +  decompression functions, including integrity checks of the uncompressed
           46  +  data.  This version of the library supports only one compression method
           47  +  (deflation) but other algorithms will be added later and will have the same
           48  +  stream interface.
           49  +
           50  +     Compression can be done in a single step if the buffers are large
           51  +  enough (for example if an input file is mmap'ed), or can be done by
           52  +  repeated calls of the compression function.  In the latter case, the
           53  +  application must provide more input and/or consume the output
           54  +  (providing more output space) before each call.
           55  +
           56  +     The compressed data format used by default by the in-memory functions is
           57  +  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
           58  +  around a deflate stream, which is itself documented in RFC 1951.
           59  +
           60  +     The library also supports reading and writing files in gzip (.gz) format
           61  +  with an interface similar to that of stdio using the functions that start
           62  +  with "gz".  The gzip format is different from the zlib format.  gzip is a
           63  +  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
           64  +
           65  +     This library can optionally read and write gzip streams in memory as well.
           66  +
           67  +     The zlib format was designed to be compact and fast for use in memory
           68  +  and on communications channels.  The gzip format was designed for single-
           69  +  file compression on file systems, has a larger header than zlib to maintain
           70  +  directory information, and uses a different, slower check method than zlib.
           71  +
           72  +     The library does not install any signal handler. The decoder checks
           73  +  the consistency of the compressed data, so the library should never
           74  +  crash even in case of corrupted input.
           75  +*/
           76  +
           77  +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
           78  +typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
           79  +
           80  +struct internal_state;
           81  +
           82  +typedef struct z_stream_s {
           83  +    Bytef    *next_in;  /* next input byte */
           84  +    uInt     avail_in;  /* number of bytes available at next_in */
           85  +    uLong    total_in;  /* total nb of input bytes read so far */
           86  +
           87  +    Bytef    *next_out; /* next output byte should be put there */
           88  +    uInt     avail_out; /* remaining free space at next_out */
           89  +    uLong    total_out; /* total nb of bytes output so far */
           90  +
           91  +    char     *msg;      /* last error message, NULL if no error */
           92  +    struct internal_state FAR *state; /* not visible by applications */
           93  +
           94  +    alloc_func zalloc;  /* used to allocate the internal state */
           95  +    free_func  zfree;   /* used to free the internal state */
           96  +    voidpf     opaque;  /* private data object passed to zalloc and zfree */
           97  +
           98  +    int     data_type;  /* best guess about the data type: binary or text */
           99  +    uLong   adler;      /* adler32 value of the uncompressed data */
          100  +    uLong   reserved;   /* reserved for future use */
          101  +} z_stream;
          102  +
          103  +typedef z_stream FAR *z_streamp;
          104  +
          105  +/*
          106  +     gzip header information passed to and from zlib routines.  See RFC 1952
          107  +  for more details on the meanings of these fields.
          108  +*/
          109  +typedef struct gz_header_s {
          110  +    int     text;       /* true if compressed data believed to be text */
          111  +    uLong   time;       /* modification time */
          112  +    int     xflags;     /* extra flags (not used when writing a gzip file) */
          113  +    int     os;         /* operating system */
          114  +    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
          115  +    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
          116  +    uInt    extra_max;  /* space at extra (only when reading header) */
          117  +    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
          118  +    uInt    name_max;   /* space at name (only when reading header) */
          119  +    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
          120  +    uInt    comm_max;   /* space at comment (only when reading header) */
          121  +    int     hcrc;       /* true if there was or will be a header crc */
          122  +    int     done;       /* true when done reading gzip header (not used
          123  +                           when writing a gzip file) */
          124  +} gz_header;
          125  +
          126  +typedef gz_header FAR *gz_headerp;
          127  +
          128  +/*
          129  +   The application must update next_in and avail_in when avail_in has
          130  +   dropped to zero. It must update next_out and avail_out when avail_out
          131  +   has dropped to zero. The application must initialize zalloc, zfree and
          132  +   opaque before calling the init function. All other fields are set by the
          133  +   compression library and must not be updated by the application.
          134  +
          135  +   The opaque value provided by the application will be passed as the first
          136  +   parameter for calls of zalloc and zfree. This can be useful for custom
          137  +   memory management. The compression library attaches no meaning to the
          138  +   opaque value.
          139  +
          140  +   zalloc must return Z_NULL if there is not enough memory for the object.
          141  +   If zlib is used in a multi-threaded application, zalloc and zfree must be
          142  +   thread safe.
          143  +
          144  +   On 16-bit systems, the functions zalloc and zfree must be able to allocate
          145  +   exactly 65536 bytes, but will not be required to allocate more than this
          146  +   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
          147  +   pointers returned by zalloc for objects of exactly 65536 bytes *must*
          148  +   have their offset normalized to zero. The default allocation function
          149  +   provided by this library ensures this (see zutil.c). To reduce memory
          150  +   requirements and avoid any allocation of 64K objects, at the expense of
          151  +   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
          152  +
          153  +   The fields total_in and total_out can be used for statistics or
          154  +   progress reports. After compression, total_in holds the total size of
          155  +   the uncompressed data and may be saved for use in the decompressor
          156  +   (particularly if the decompressor wants to decompress everything in
          157  +   a single step).
          158  +*/
          159  +
          160  +                        /* constants */
          161  +
          162  +#define Z_NO_FLUSH      0
          163  +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
          164  +#define Z_SYNC_FLUSH    2
          165  +#define Z_FULL_FLUSH    3
          166  +#define Z_FINISH        4
          167  +#define Z_BLOCK         5
          168  +/* Allowed flush values; see deflate() and inflate() below for details */
          169  +
          170  +#define Z_OK            0
          171  +#define Z_STREAM_END    1
          172  +#define Z_NEED_DICT     2
          173  +#define Z_ERRNO        (-1)
          174  +#define Z_STREAM_ERROR (-2)
          175  +#define Z_DATA_ERROR   (-3)
          176  +#define Z_MEM_ERROR    (-4)
          177  +#define Z_BUF_ERROR    (-5)
          178  +#define Z_VERSION_ERROR (-6)
          179  +/* Return codes for the compression/decompression functions. Negative
          180  + * values are errors, positive values are used for special but normal events.
          181  + */
          182  +
          183  +#define Z_NO_COMPRESSION         0
          184  +#define Z_BEST_SPEED             1
          185  +#define Z_BEST_COMPRESSION       9
          186  +#define Z_DEFAULT_COMPRESSION  (-1)
          187  +/* compression levels */
          188  +
          189  +#define Z_FILTERED            1
          190  +#define Z_HUFFMAN_ONLY        2
          191  +#define Z_RLE                 3
          192  +#define Z_FIXED               4
          193  +#define Z_DEFAULT_STRATEGY    0
          194  +/* compression strategy; see deflateInit2() below for details */
          195  +
          196  +#define Z_BINARY   0
          197  +#define Z_TEXT     1
          198  +#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
          199  +#define Z_UNKNOWN  2
          200  +/* Possible values of the data_type field (though see inflate()) */
          201  +
          202  +#define Z_DEFLATED   8
          203  +/* The deflate compression method (the only one supported in this version) */
          204  +
          205  +#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
          206  +
          207  +#define zlib_version zlibVersion()
          208  +/* for compatibility with versions < 1.0.2 */
          209  +
          210  +                        /* basic functions */
          211  +
          212  +ZEXTERN const char * ZEXPORT zlibVersion OF((void));
          213  +/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
          214  +   If the first character differs, the library code actually used is
          215  +   not compatible with the zlib.h header file used by the application.
          216  +   This check is automatically made by deflateInit and inflateInit.
          217  + */
          218  +
          219  +/*
          220  +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
          221  +
          222  +     Initializes the internal stream state for compression. The fields
          223  +   zalloc, zfree and opaque must be initialized before by the caller.
          224  +   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
          225  +   use default allocation functions.
          226  +
          227  +     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
          228  +   1 gives best speed, 9 gives best compression, 0 gives no compression at
          229  +   all (the input data is simply copied a block at a time).
          230  +   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
          231  +   compression (currently equivalent to level 6).
          232  +
          233  +     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
          234  +   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
          235  +   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
          236  +   with the version assumed by the caller (ZLIB_VERSION).
          237  +   msg is set to null if there is no error message.  deflateInit does not
          238  +   perform any compression: this will be done by deflate().
          239  +*/
          240  +
          241  +
          242  +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
          243  +/*
          244  +    deflate compresses as much data as possible, and stops when the input
          245  +  buffer becomes empty or the output buffer becomes full. It may introduce some
          246  +  output latency (reading input without producing any output) except when
          247  +  forced to flush.
          248  +
          249  +    The detailed semantics are as follows. deflate performs one or both of the
          250  +  following actions:
          251  +
          252  +  - Compress more input starting at next_in and update next_in and avail_in
          253  +    accordingly. If not all input can be processed (because there is not
          254  +    enough room in the output buffer), next_in and avail_in are updated and
          255  +    processing will resume at this point for the next call of deflate().
          256  +
          257  +  - Provide more output starting at next_out and update next_out and avail_out
          258  +    accordingly. This action is forced if the parameter flush is non zero.
          259  +    Forcing flush frequently degrades the compression ratio, so this parameter
          260  +    should be set only when necessary (in interactive applications).
          261  +    Some output may be provided even if flush is not set.
          262  +
          263  +  Before the call of deflate(), the application should ensure that at least
          264  +  one of the actions is possible, by providing more input and/or consuming
          265  +  more output, and updating avail_in or avail_out accordingly; avail_out
          266  +  should never be zero before the call. The application can consume the
          267  +  compressed output when it wants, for example when the output buffer is full
          268  +  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
          269  +  and with zero avail_out, it must be called again after making room in the
          270  +  output buffer because there might be more output pending.
          271  +
          272  +    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
          273  +  decide how much data to accumualte before producing output, in order to
          274  +  maximize compression.
          275  +
          276  +    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
          277  +  flushed to the output buffer and the output is aligned on a byte boundary, so
          278  +  that the decompressor can get all input data available so far. (In particular
          279  +  avail_in is zero after the call if enough output space has been provided
          280  +  before the call.)  Flushing may degrade compression for some compression
          281  +  algorithms and so it should be used only when necessary.
          282  +
          283  +    If flush is set to Z_FULL_FLUSH, all output is flushed as with
          284  +  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
          285  +  restart from this point if previous compressed data has been damaged or if
          286  +  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
          287  +  compression.
          288  +
          289  +    If deflate returns with avail_out == 0, this function must be called again
          290  +  with the same value of the flush parameter and more output space (updated
          291  +  avail_out), until the flush is complete (deflate returns with non-zero
          292  +  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
          293  +  avail_out is greater than six to avoid repeated flush markers due to
          294  +  avail_out == 0 on return.
          295  +
          296  +    If the parameter flush is set to Z_FINISH, pending input is processed,
          297  +  pending output is flushed and deflate returns with Z_STREAM_END if there
          298  +  was enough output space; if deflate returns with Z_OK, this function must be
          299  +  called again with Z_FINISH and more output space (updated avail_out) but no
          300  +  more input data, until it returns with Z_STREAM_END or an error. After
          301  +  deflate has returned Z_STREAM_END, the only possible operations on the
          302  +  stream are deflateReset or deflateEnd.
          303  +
          304  +    Z_FINISH can be used immediately after deflateInit if all the compression
          305  +  is to be done in a single step. In this case, avail_out must be at least
          306  +  the value returned by deflateBound (see below). If deflate does not return
          307  +  Z_STREAM_END, then it must be called again as described above.
          308  +
          309  +    deflate() sets strm->adler to the adler32 checksum of all input read
          310  +  so far (that is, total_in bytes).
          311  +
          312  +    deflate() may update strm->data_type if it can make a good guess about
          313  +  the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
          314  +  binary. This field is only for information purposes and does not affect
          315  +  the compression algorithm in any manner.
          316  +
          317  +    deflate() returns Z_OK if some progress has been made (more input
          318  +  processed or more output produced), Z_STREAM_END if all input has been
          319  +  consumed and all output has been produced (only when flush is set to
          320  +  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
          321  +  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
          322  +  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
          323  +  fatal, and deflate() can be called again with more input and more output
          324  +  space to continue compressing.
          325  +*/
          326  +
          327  +
          328  +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
          329  +/*
          330  +     All dynamically allocated data structures for this stream are freed.
          331  +   This function discards any unprocessed input and does not flush any
          332  +   pending output.
          333  +
          334  +     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
          335  +   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
          336  +   prematurely (some input or output was discarded). In the error case,
          337  +   msg may be set but then points to a static string (which must not be
          338  +   deallocated).
          339  +*/
          340  +
          341  +
          342  +/*
          343  +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
          344  +
          345  +     Initializes the internal stream state for decompression. The fields
          346  +   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
          347  +   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
          348  +   value depends on the compression method), inflateInit determines the
          349  +   compression method from the zlib header and allocates all data structures
          350  +   accordingly; otherwise the allocation will be deferred to the first call of
          351  +   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
          352  +   use default allocation functions.
          353  +
          354  +     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
          355  +   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
          356  +   version assumed by the caller.  msg is set to null if there is no error
          357  +   message. inflateInit does not perform any decompression apart from reading
          358  +   the zlib header if present: this will be done by inflate().  (So next_in and
          359  +   avail_in may be modified, but next_out and avail_out are unchanged.)
          360  +*/
          361  +
          362  +
          363  +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
          364  +/*
          365  +    inflate decompresses as much data as possible, and stops when the input
          366  +  buffer becomes empty or the output buffer becomes full. It may introduce
          367  +  some output latency (reading input without producing any output) except when
          368  +  forced to flush.
          369  +
          370  +  The detailed semantics are as follows. inflate performs one or both of the
          371  +  following actions:
          372  +
          373  +  - Decompress more input starting at next_in and update next_in and avail_in
          374  +    accordingly. If not all input can be processed (because there is not
          375  +    enough room in the output buffer), next_in is updated and processing
          376  +    will resume at this point for the next call of inflate().
          377  +
          378  +  - Provide more output starting at next_out and update next_out and avail_out
          379  +    accordingly.  inflate() provides as much output as possible, until there
          380  +    is no more input data or no more space in the output buffer (see below
          381  +    about the flush parameter).
          382  +
          383  +  Before the call of inflate(), the application should ensure that at least
          384  +  one of the actions is possible, by providing more input and/or consuming
          385  +  more output, and updating the next_* and avail_* values accordingly.
          386  +  The application can consume the uncompressed output when it wants, for
          387  +  example when the output buffer is full (avail_out == 0), or after each
          388  +  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
          389  +  must be called again after making room in the output buffer because there
          390  +  might be more output pending.
          391  +
          392  +    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
          393  +  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
          394  +  output as possible to the output buffer. Z_BLOCK requests that inflate() stop
          395  +  if and when it gets to the next deflate block boundary. When decoding the
          396  +  zlib or gzip format, this will cause inflate() to return immediately after
          397  +  the header and before the first block. When doing a raw inflate, inflate()
          398  +  will go ahead and process the first block, and will return when it gets to
          399  +  the end of that block, or when it runs out of data.
          400  +
          401  +    The Z_BLOCK option assists in appending to or combining deflate streams.
          402  +  Also to assist in this, on return inflate() will set strm->data_type to the
          403  +  number of unused bits in the last byte taken from strm->next_in, plus 64
          404  +  if inflate() is currently decoding the last block in the deflate stream,
          405  +  plus 128 if inflate() returned immediately after decoding an end-of-block
          406  +  code or decoding the complete header up to just before the first byte of the
          407  +  deflate stream. The end-of-block will not be indicated until all of the
          408  +  uncompressed data from that block has been written to strm->next_out.  The
          409  +  number of unused bits may in general be greater than seven, except when
          410  +  bit 7 of data_type is set, in which case the number of unused bits will be
          411  +  less than eight.
          412  +
          413  +    inflate() should normally be called until it returns Z_STREAM_END or an
          414  +  error. However if all decompression is to be performed in a single step
          415  +  (a single call of inflate), the parameter flush should be set to
          416  +  Z_FINISH. In this case all pending input is processed and all pending
          417  +  output is flushed; avail_out must be large enough to hold all the
          418  +  uncompressed data. (The size of the uncompressed data may have been saved
          419  +  by the compressor for this purpose.) The next operation on this stream must
          420  +  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
          421  +  is never required, but can be used to inform inflate that a faster approach
          422  +  may be used for the single inflate() call.
          423  +
          424  +     In this implementation, inflate() always flushes as much output as
          425  +  possible to the output buffer, and always uses the faster approach on the
          426  +  first call. So the only effect of the flush parameter in this implementation
          427  +  is on the return value of inflate(), as noted below, or when it returns early
          428  +  because Z_BLOCK is used.
          429  +
          430  +     If a preset dictionary is needed after this call (see inflateSetDictionary
          431  +  below), inflate sets strm->adler to the adler32 checksum of the dictionary
          432  +  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
          433  +  strm->adler to the adler32 checksum of all output produced so far (that is,
          434  +  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
          435  +  below. At the end of the stream, inflate() checks that its computed adler32
          436  +  checksum is equal to that saved by the compressor and returns Z_STREAM_END
          437  +  only if the checksum is correct.
          438  +
          439  +    inflate() will decompress and check either zlib-wrapped or gzip-wrapped
          440  +  deflate data.  The header type is detected automatically.  Any information
          441  +  contained in the gzip header is not retained, so applications that need that
          442  +  information should instead use raw inflate, see inflateInit2() below, or
          443  +  inflateBack() and perform their own processing of the gzip header and
          444  +  trailer.
          445  +
          446  +    inflate() returns Z_OK if some progress has been made (more input processed
          447  +  or more output produced), Z_STREAM_END if the end of the compressed data has
          448  +  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
          449  +  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
          450  +  corrupted (input stream not conforming to the zlib format or incorrect check
          451  +  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
          452  +  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
          453  +  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
          454  +  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
          455  +  inflate() can be called again with more input and more output space to
          456  +  continue decompressing. If Z_DATA_ERROR is returned, the application may then
          457  +  call inflateSync() to look for a good compression block if a partial recovery
          458  +  of the data is desired.
          459  +*/
          460  +
          461  +
          462  +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
          463  +/*
          464  +     All dynamically allocated data structures for this stream are freed.
          465  +   This function discards any unprocessed input and does not flush any
          466  +   pending output.
          467  +
          468  +     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
          469  +   was inconsistent. In the error case, msg may be set but then points to a
          470  +   static string (which must not be deallocated).
          471  +*/
          472  +
          473  +                        /* Advanced functions */
          474  +
          475  +/*
          476  +    The following functions are needed only in some special applications.
          477  +*/
          478  +
          479  +/*
          480  +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
          481  +                                     int  level,
          482  +                                     int  method,
          483  +                                     int  windowBits,
          484  +                                     int  memLevel,
          485  +                                     int  strategy));
          486  +
          487  +     This is another version of deflateInit with more compression options. The
          488  +   fields next_in, zalloc, zfree and opaque must be initialized before by
          489  +   the caller.
          490  +
          491  +     The method parameter is the compression method. It must be Z_DEFLATED in
          492  +   this version of the library.
          493  +
          494  +     The windowBits parameter is the base two logarithm of the window size
          495  +   (the size of the history buffer). It should be in the range 8..15 for this
          496  +   version of the library. Larger values of this parameter result in better
          497  +   compression at the expense of memory usage. The default value is 15 if
          498  +   deflateInit is used instead.
          499  +
          500  +     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
          501  +   determines the window size. deflate() will then generate raw deflate data
          502  +   with no zlib header or trailer, and will not compute an adler32 check value.
          503  +
          504  +     windowBits can also be greater than 15 for optional gzip encoding. Add
          505  +   16 to windowBits to write a simple gzip header and trailer around the
          506  +   compressed data instead of a zlib wrapper. The gzip header will have no
          507  +   file name, no extra data, no comment, no modification time (set to zero),
          508  +   no header crc, and the operating system will be set to 255 (unknown).  If a
          509  +   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
          510  +
          511  +     The memLevel parameter specifies how much memory should be allocated
          512  +   for the internal compression state. memLevel=1 uses minimum memory but
          513  +   is slow and reduces compression ratio; memLevel=9 uses maximum memory
          514  +   for optimal speed. The default value is 8. See zconf.h for total memory
          515  +   usage as a function of windowBits and memLevel.
          516  +
          517  +     The strategy parameter is used to tune the compression algorithm. Use the
          518  +   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
          519  +   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
          520  +   string match), or Z_RLE to limit match distances to one (run-length
          521  +   encoding). Filtered data consists mostly of small values with a somewhat
          522  +   random distribution. In this case, the compression algorithm is tuned to
          523  +   compress them better. The effect of Z_FILTERED is to force more Huffman
          524  +   coding and less string matching; it is somewhat intermediate between
          525  +   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
          526  +   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
          527  +   parameter only affects the compression ratio but not the correctness of the
          528  +   compressed output even if it is not set appropriately.  Z_FIXED prevents the
          529  +   use of dynamic Huffman codes, allowing for a simpler decoder for special
          530  +   applications.
          531  +
          532  +      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
          533  +   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
          534  +   method). msg is set to null if there is no error message.  deflateInit2 does
          535  +   not perform any compression: this will be done by deflate().
          536  +*/
          537  +
          538  +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
          539  +                                             const Bytef *dictionary,
          540  +                                             uInt  dictLength));
          541  +/*
          542  +     Initializes the compression dictionary from the given byte sequence
          543  +   without producing any compressed output. This function must be called
          544  +   immediately after deflateInit, deflateInit2 or deflateReset, before any
          545  +   call of deflate. The compressor and decompressor must use exactly the same
          546  +   dictionary (see inflateSetDictionary).
          547  +
          548  +     The dictionary should consist of strings (byte sequences) that are likely
          549  +   to be encountered later in the data to be compressed, with the most commonly
          550  +   used strings preferably put towards the end of the dictionary. Using a
          551  +   dictionary is most useful when the data to be compressed is short and can be
          552  +   predicted with good accuracy; the data can then be compressed better than
          553  +   with the default empty dictionary.
          554  +
          555  +     Depending on the size of the compression data structures selected by
          556  +   deflateInit or deflateInit2, a part of the dictionary may in effect be
          557  +   discarded, for example if the dictionary is larger than the window size in
          558  +   deflate or deflate2. Thus the strings most likely to be useful should be
          559  +   put at the end of the dictionary, not at the front. In addition, the
          560  +   current implementation of deflate will use at most the window size minus
          561  +   262 bytes of the provided dictionary.
          562  +
          563  +     Upon return of this function, strm->adler is set to the adler32 value
          564  +   of the dictionary; the decompressor may later use this value to determine
          565  +   which dictionary has been used by the compressor. (The adler32 value
          566  +   applies to the whole dictionary even if only a subset of the dictionary is
          567  +   actually used by the compressor.) If a raw deflate was requested, then the
          568  +   adler32 value is not computed and strm->adler is not set.
          569  +
          570  +     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
          571  +   parameter is invalid (such as NULL dictionary) or the stream state is
          572  +   inconsistent (for example if deflate has already been called for this stream
          573  +   or if the compression method is bsort). deflateSetDictionary does not
          574  +   perform any compression: this will be done by deflate().
          575  +*/
          576  +
          577  +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
          578  +                                    z_streamp source));
          579  +/*
          580  +     Sets the destination stream as a complete copy of the source stream.
          581  +
          582  +     This function can be useful when several compression strategies will be
          583  +   tried, for example when there are several ways of pre-processing the input
          584  +   data with a filter. The streams that will be discarded should then be freed
          585  +   by calling deflateEnd.  Note that deflateCopy duplicates the internal
          586  +   compression state which can be quite large, so this strategy is slow and
          587  +   can consume lots of memory.
          588  +
          589  +     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
          590  +   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
          591  +   (such as zalloc being NULL). msg is left unchanged in both source and
          592  +   destination.
          593  +*/
          594  +
          595  +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
          596  +/*
          597  +     This function is equivalent to deflateEnd followed by deflateInit,
          598  +   but does not free and reallocate all the internal compression state.
          599  +   The stream will keep the same compression level and any other attributes
          600  +   that may have been set by deflateInit2.
          601  +
          602  +      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
          603  +   stream state was inconsistent (such as zalloc or state being NULL).
          604  +*/
          605  +
          606  +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
          607  +                                      int level,
          608  +                                      int strategy));
          609  +/*
          610  +     Dynamically update the compression level and compression strategy.  The
          611  +   interpretation of level and strategy is as in deflateInit2.  This can be
          612  +   used to switch between compression and straight copy of the input data, or
          613  +   to switch to a different kind of input data requiring a different
          614  +   strategy. If the compression level is changed, the input available so far
          615  +   is compressed with the old level (and may be flushed); the new level will
          616  +   take effect only at the next call of deflate().
          617  +
          618  +     Before the call of deflateParams, the stream state must be set as for
          619  +   a call of deflate(), since the currently available input may have to
          620  +   be compressed and flushed. In particular, strm->avail_out must be non-zero.
          621  +
          622  +     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
          623  +   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
          624  +   if strm->avail_out was zero.
          625  +*/
          626  +
          627  +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
          628  +                                    int good_length,
          629  +                                    int max_lazy,
          630  +                                    int nice_length,
          631  +                                    int max_chain));
          632  +/*
          633  +     Fine tune deflate's internal compression parameters.  This should only be
          634  +   used by someone who understands the algorithm used by zlib's deflate for
          635  +   searching for the best matching string, and even then only by the most
          636  +   fanatic optimizer trying to squeeze out the last compressed bit for their
          637  +   specific input data.  Read the deflate.c source code for the meaning of the
          638  +   max_lazy, good_length, nice_length, and max_chain parameters.
          639  +
          640  +     deflateTune() can be called after deflateInit() or deflateInit2(), and
          641  +   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
          642  + */
          643  +
          644  +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
          645  +                                       uLong sourceLen));
          646  +/*
          647  +     deflateBound() returns an upper bound on the compressed size after
          648  +   deflation of sourceLen bytes.  It must be called after deflateInit()
          649  +   or deflateInit2().  This would be used to allocate an output buffer
          650  +   for deflation in a single pass, and so would be called before deflate().
          651  +*/
          652  +
          653  +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
          654  +                                     int bits,
          655  +                                     int value));
          656  +/*
          657  +     deflatePrime() inserts bits in the deflate output stream.  The intent
          658  +  is that this function is used to start off the deflate output with the
          659  +  bits leftover from a previous deflate stream when appending to it.  As such,
          660  +  this function can only be used for raw deflate, and must be used before the
          661  +  first deflate() call after a deflateInit2() or deflateReset().  bits must be
          662  +  less than or equal to 16, and that many of the least significant bits of
          663  +  value will be inserted in the output.
          664  +
          665  +      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
          666  +   stream state was inconsistent.
          667  +*/
          668  +
          669  +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
          670  +                                         gz_headerp head));
          671  +/*
          672  +      deflateSetHeader() provides gzip header information for when a gzip
          673  +   stream is requested by deflateInit2().  deflateSetHeader() may be called
          674  +   after deflateInit2() or deflateReset() and before the first call of
          675  +   deflate().  The text, time, os, extra field, name, and comment information
          676  +   in the provided gz_header structure are written to the gzip header (xflag is
          677  +   ignored -- the extra flags are set according to the compression level).  The
          678  +   caller must assure that, if not Z_NULL, name and comment are terminated with
          679  +   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
          680  +   available there.  If hcrc is true, a gzip header crc is included.  Note that
          681  +   the current versions of the command-line version of gzip (up through version
          682  +   1.3.x) do not support header crc's, and will report that it is a "multi-part
          683  +   gzip file" and give up.
          684  +
          685  +      If deflateSetHeader is not used, the default gzip header has text false,
          686  +   the time set to zero, and os set to 255, with no extra, name, or comment
          687  +   fields.  The gzip header is returned to the default state by deflateReset().
          688  +
          689  +      deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
          690  +   stream state was inconsistent.
          691  +*/
          692  +
          693  +/*
          694  +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
          695  +                                     int  windowBits));
          696  +
          697  +     This is another version of inflateInit with an extra parameter. The
          698  +   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
          699  +   before by the caller.
          700  +
          701  +     The windowBits parameter is the base two logarithm of the maximum window
          702  +   size (the size of the history buffer).  It should be in the range 8..15 for
          703  +   this version of the library. The default value is 15 if inflateInit is used
          704  +   instead. windowBits must be greater than or equal to the windowBits value
          705  +   provided to deflateInit2() while compressing, or it must be equal to 15 if
          706  +   deflateInit2() was not used. If a compressed stream with a larger window
          707  +   size is given as input, inflate() will return with the error code
          708  +   Z_DATA_ERROR instead of trying to allocate a larger window.
          709  +
          710  +     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
          711  +   determines the window size. inflate() will then process raw deflate data,
          712  +   not looking for a zlib or gzip header, not generating a check value, and not
          713  +   looking for any check values for comparison at the end of the stream. This
          714  +   is for use with other formats that use the deflate compressed data format
          715  +   such as zip.  Those formats provide their own check values. If a custom
          716  +   format is developed using the raw deflate format for compressed data, it is
          717  +   recommended that a check value such as an adler32 or a crc32 be applied to
          718  +   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
          719  +   most applications, the zlib format should be used as is. Note that comments
          720  +   above on the use in deflateInit2() applies to the magnitude of windowBits.
          721  +
          722  +     windowBits can also be greater than 15 for optional gzip decoding. Add
          723  +   32 to windowBits to enable zlib and gzip decoding with automatic header
          724  +   detection, or add 16 to decode only the gzip format (the zlib format will
          725  +   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is
          726  +   a crc32 instead of an adler32.
          727  +
          728  +     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
          729  +   memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
          730  +   is set to null if there is no error message.  inflateInit2 does not perform
          731  +   any decompression apart from reading the zlib header if present: this will
          732  +   be done by inflate(). (So next_in and avail_in may be modified, but next_out
          733  +   and avail_out are unchanged.)
          734  +*/
          735  +
          736  +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
          737  +                                             const Bytef *dictionary,
          738  +                                             uInt  dictLength));
          739  +/*
          740  +     Initializes the decompression dictionary from the given uncompressed byte
          741  +   sequence. This function must be called immediately after a call of inflate,
          742  +   if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
          743  +   can be determined from the adler32 value returned by that call of inflate.
          744  +   The compressor and decompressor must use exactly the same dictionary (see
          745  +   deflateSetDictionary).  For raw inflate, this function can be called
          746  +   immediately after inflateInit2() or inflateReset() and before any call of
          747  +   inflate() to set the dictionary.  The application must insure that the
          748  +   dictionary that was used for compression is provided.
          749  +
          750  +     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
          751  +   parameter is invalid (such as NULL dictionary) or the stream state is
          752  +   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
          753  +   expected one (incorrect adler32 value). inflateSetDictionary does not
          754  +   perform any decompression: this will be done by subsequent calls of
          755  +   inflate().
          756  +*/
          757  +
          758  +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
          759  +/*
          760  +    Skips invalid compressed data until a full flush point (see above the
          761  +  description of deflate with Z_FULL_FLUSH) can be found, or until all
          762  +  available input is skipped. No output is provided.
          763  +
          764  +    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
          765  +  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
          766  +  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
          767  +  case, the application may save the current current value of total_in which
          768  +  indicates where valid compressed data was found. In the error case, the
          769  +  application may repeatedly call inflateSync, providing more input each time,
          770  +  until success or end of the input data.
          771  +*/
          772  +
          773  +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
          774  +                                    z_streamp source));
          775  +/*
          776  +     Sets the destination stream as a complete copy of the source stream.
          777  +
          778  +     This function can be useful when randomly accessing a large stream.  The
          779  +   first pass through the stream can periodically record the inflate state,
          780  +   allowing restarting inflate at those points when randomly accessing the
          781  +   stream.
          782  +
          783  +     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
          784  +   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
          785  +   (such as zalloc being NULL). msg is left unchanged in both source and
          786  +   destination.
          787  +*/
          788  +
          789  +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
          790  +/*
          791  +     This function is equivalent to inflateEnd followed by inflateInit,
          792  +   but does not free and reallocate all the internal decompression state.
          793  +   The stream will keep attributes that may have been set by inflateInit2.
          794  +
          795  +      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
          796  +   stream state was inconsistent (such as zalloc or state being NULL).
          797  +*/
          798  +
          799  +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
          800  +                                     int bits,
          801  +                                     int value));
          802  +/*
          803  +     This function inserts bits in the inflate input stream.  The intent is
          804  +  that this function is used to start inflating at a bit position in the
          805  +  middle of a byte.  The provided bits will be used before any bytes are used
          806  +  from next_in.  This function should only be used with raw inflate, and
          807  +  should be used before the first inflate() call after inflateInit2() or
          808  +  inflateReset().  bits must be less than or equal to 16, and that many of the
          809  +  least significant bits of value will be inserted in the input.
          810  +
          811  +      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
          812  +   stream state was inconsistent.
          813  +*/
          814  +
          815  +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
          816  +                                         gz_headerp head));
          817  +/*
          818  +      inflateGetHeader() requests that gzip header information be stored in the
          819  +   provided gz_header structure.  inflateGetHeader() may be called after
          820  +   inflateInit2() or inflateReset(), and before the first call of inflate().
          821  +   As inflate() processes the gzip stream, head->done is zero until the header
          822  +   is completed, at which time head->done is set to one.  If a zlib stream is
          823  +   being decoded, then head->done is set to -1 to indicate that there will be
          824  +   no gzip header information forthcoming.  Note that Z_BLOCK can be used to
          825  +   force inflate() to return immediately after header processing is complete
          826  +   and before any actual data is decompressed.
          827  +
          828  +      The text, time, xflags, and os fields are filled in with the gzip header
          829  +   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
          830  +   was valid if done is set to one.)  If extra is not Z_NULL, then extra_max
          831  +   contains the maximum number of bytes to write to extra.  Once done is true,
          832  +   extra_len contains the actual extra field length, and extra contains the
          833  +   extra field, or that field truncated if extra_max is less than extra_len.
          834  +   If name is not Z_NULL, then up to name_max characters are written there,
          835  +   terminated with a zero unless the length is greater than name_max.  If
          836  +   comment is not Z_NULL, then up to comm_max characters are written there,
          837  +   terminated with a zero unless the length is greater than comm_max.  When
          838  +   any of extra, name, or comment are not Z_NULL and the respective field is
          839  +   not present in the header, then that field is set to Z_NULL to signal its
          840  +   absence.  This allows the use of deflateSetHeader() with the returned
          841  +   structure to duplicate the header.  However if those fields are set to
          842  +   allocated memory, then the application will need to save those pointers
          843  +   elsewhere so that they can be eventually freed.
          844  +
          845  +      If inflateGetHeader is not used, then the header information is simply
          846  +   discarded.  The header is always checked for validity, including the header
          847  +   CRC if present.  inflateReset() will reset the process to discard the header
          848  +   information.  The application would need to call inflateGetHeader() again to
          849  +   retrieve the header from the next gzip stream.
          850  +
          851  +      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
          852  +   stream state was inconsistent.
          853  +*/
          854  +
          855  +/*
          856  +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
          857  +                                        unsigned char FAR *window));
          858  +
          859  +     Initialize the internal stream state for decompression using inflateBack()
          860  +   calls.  The fields zalloc, zfree and opaque in strm must be initialized
          861  +   before the call.  If zalloc and zfree are Z_NULL, then the default library-
          862  +   derived memory allocation routines are used.  windowBits is the base two
          863  +   logarithm of the window size, in the range 8..15.  window is a caller
          864  +   supplied buffer of that size.  Except for special applications where it is
          865  +   assured that deflate was used with small window sizes, windowBits must be 15
          866  +   and a 32K byte window must be supplied to be able to decompress general
          867  +   deflate streams.
          868  +
          869  +     See inflateBack() for the usage of these routines.
          870  +
          871  +     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
          872  +   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
          873  +   be allocated, or Z_VERSION_ERROR if the version of the library does not
          874  +   match the version of the header file.
          875  +*/
          876  +
          877  +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
          878  +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
          879  +
          880  +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
          881  +                                    in_func in, void FAR *in_desc,
          882  +                                    out_func out, void FAR *out_desc));
          883  +/*
          884  +     inflateBack() does a raw inflate with a single call using a call-back
          885  +   interface for input and output.  This is more efficient than inflate() for
          886  +   file i/o applications in that it avoids copying between the output and the
          887  +   sliding window by simply making the window itself the output buffer.  This
          888  +   function trusts the application to not change the output buffer passed by
          889  +   the output function, at least until inflateBack() returns.
          890  +
          891  +     inflateBackInit() must be called first to allocate the internal state
          892  +   and to initialize the state with the user-provided window buffer.
          893  +   inflateBack() may then be used multiple times to inflate a complete, raw
          894  +   deflate stream with each call.  inflateBackEnd() is then called to free
          895  +   the allocated state.
          896  +
          897  +     A raw deflate stream is one with no zlib or gzip header or trailer.
          898  +   This routine would normally be used in a utility that reads zip or gzip
          899  +   files and writes out uncompressed files.  The utility would decode the
          900  +   header and process the trailer on its own, hence this routine expects
          901  +   only the raw deflate stream to decompress.  This is different from the
          902  +   normal behavior of inflate(), which expects either a zlib or gzip header and
          903  +   trailer around the deflate stream.
          904  +
          905  +     inflateBack() uses two subroutines supplied by the caller that are then
          906  +   called by inflateBack() for input and output.  inflateBack() calls those
          907  +   routines until it reads a complete deflate stream and writes out all of the
          908  +   uncompressed data, or until it encounters an error.  The function's
          909  +   parameters and return types are defined above in the in_func and out_func
          910  +   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
          911  +   number of bytes of provided input, and a pointer to that input in buf.  If
          912  +   there is no input available, in() must return zero--buf is ignored in that
          913  +   case--and inflateBack() will return a buffer error.  inflateBack() will call
          914  +   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
          915  +   should return zero on success, or non-zero on failure.  If out() returns
          916  +   non-zero, inflateBack() will return with an error.  Neither in() nor out()
          917  +   are permitted to change the contents of the window provided to
          918  +   inflateBackInit(), which is also the buffer that out() uses to write from.
          919  +   The length written by out() will be at most the window size.  Any non-zero
          920  +   amount of input may be provided by in().
          921  +
          922  +     For convenience, inflateBack() can be provided input on the first call by
          923  +   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
          924  +   in() will be called.  Therefore strm->next_in must be initialized before
          925  +   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
          926  +   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
          927  +   must also be initialized, and then if strm->avail_in is not zero, input will
          928  +   initially be taken from strm->next_in[0 .. strm->avail_in - 1].
          929  +
          930  +     The in_desc and out_desc parameters of inflateBack() is passed as the
          931  +   first parameter of in() and out() respectively when they are called.  These
          932  +   descriptors can be optionally used to pass any information that the caller-
          933  +   supplied in() and out() functions need to do their job.
          934  +
          935  +     On return, inflateBack() will set strm->next_in and strm->avail_in to
          936  +   pass back any unused input that was provided by the last in() call.  The
          937  +   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
          938  +   if in() or out() returned an error, Z_DATA_ERROR if there was a format
          939  +   error in the deflate stream (in which case strm->msg is set to indicate the
          940  +   nature of the error), or Z_STREAM_ERROR if the stream was not properly
          941  +   initialized.  In the case of Z_BUF_ERROR, an input or output error can be
          942  +   distinguished using strm->next_in which will be Z_NULL only if in() returned
          943  +   an error.  If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
          944  +   out() returning non-zero.  (in() will always be called before out(), so
          945  +   strm->next_in is assured to be defined if out() returns non-zero.)  Note
          946  +   that inflateBack() cannot return Z_OK.
          947  +*/
          948  +
          949  +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
          950  +/*
          951  +     All memory allocated by inflateBackInit() is freed.
          952  +
          953  +     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
          954  +   state was inconsistent.
          955  +*/
          956  +
          957  +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
          958  +/* Return flags indicating compile-time options.
          959  +
          960  +    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
          961  +     1.0: size of uInt
          962  +     3.2: size of uLong
          963  +     5.4: size of voidpf (pointer)
          964  +     7.6: size of z_off_t
          965  +
          966  +    Compiler, assembler, and debug options:
          967  +     8: DEBUG
          968  +     9: ASMV or ASMINF -- use ASM code
          969  +     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
          970  +     11: 0 (reserved)
          971  +
          972  +    One-time table building (smaller code, but not thread-safe if true):
          973  +     12: BUILDFIXED -- build static block decoding tables when needed
          974  +     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
          975  +     14,15: 0 (reserved)
          976  +
          977  +    Library content (indicates missing functionality):
          978  +     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
          979  +                          deflate code when not needed)
          980  +     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
          981  +                    and decode gzip streams (to avoid linking crc code)
          982  +     18-19: 0 (reserved)
          983  +
          984  +    Operation variations (changes in library functionality):
          985  +     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
          986  +     21: FASTEST -- deflate algorithm with only one, lowest compression level
          987  +     22,23: 0 (reserved)
          988  +
          989  +    The sprintf variant used by gzprintf (zero is best):
          990  +     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
          991  +     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
          992  +     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
          993  +
          994  +    Remainder:
          995  +     27-31: 0 (reserved)
          996  + */
          997  +
          998  +
          999  +                        /* utility functions */
         1000  +
         1001  +/*
         1002  +     The following utility functions are implemented on top of the
         1003  +   basic stream-oriented functions. To simplify the interface, some
         1004  +   default options are assumed (compression level and memory usage,
         1005  +   standard memory allocation functions). The source code of these
         1006  +   utility functions can easily be modified if you need special options.
         1007  +*/
         1008  +
         1009  +ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
         1010  +                                 const Bytef *source, uLong sourceLen));
         1011  +/*
         1012  +     Compresses the source buffer into the destination buffer.  sourceLen is
         1013  +   the byte length of the source buffer. Upon entry, destLen is the total
         1014  +   size of the destination buffer, which must be at least the value returned
         1015  +   by compressBound(sourceLen). Upon exit, destLen is the actual size of the
         1016  +   compressed buffer.
         1017  +     This function can be used to compress a whole file at once if the
         1018  +   input file is mmap'ed.
         1019  +     compress returns Z_OK if success, Z_MEM_ERROR if there was not
         1020  +   enough memory, Z_BUF_ERROR if there was not enough room in the output
         1021  +   buffer.
         1022  +*/
         1023  +
         1024  +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
         1025  +                                  const Bytef *source, uLong sourceLen,
         1026  +                                  int level));
         1027  +/*
         1028  +     Compresses the source buffer into the destination buffer. The level
         1029  +   parameter has the same meaning as in deflateInit.  sourceLen is the byte
         1030  +   length of the source buffer. Upon entry, destLen is the total size of the
         1031  +   destination buffer, which must be at least the value returned by
         1032  +   compressBound(sourceLen). Upon exit, destLen is the actual size of the
         1033  +   compressed buffer.
         1034  +
         1035  +     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
         1036  +   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
         1037  +   Z_STREAM_ERROR if the level parameter is invalid.
         1038  +*/
         1039  +
         1040  +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
         1041  +/*
         1042  +     compressBound() returns an upper bound on the compressed size after
         1043  +   compress() or compress2() on sourceLen bytes.  It would be used before
         1044  +   a compress() or compress2() call to allocate the destination buffer.
         1045  +*/
         1046  +
         1047  +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
         1048  +                                   const Bytef *source, uLong sourceLen));
         1049  +/*
         1050  +     Decompresses the source buffer into the destination buffer.  sourceLen is
         1051  +   the byte length of the source buffer. Upon entry, destLen is the total
         1052  +   size of the destination buffer, which must be large enough to hold the
         1053  +   entire uncompressed data. (The size of the uncompressed data must have
         1054  +   been saved previously by the compressor and transmitted to the decompressor
         1055  +   by some mechanism outside the scope of this compression library.)
         1056  +   Upon exit, destLen is the actual size of the compressed buffer.
         1057  +     This function can be used to decompress a whole file at once if the
         1058  +   input file is mmap'ed.
         1059  +
         1060  +     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
         1061  +   enough memory, Z_BUF_ERROR if there was not enough room in the output
         1062  +   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
         1063  +*/
         1064  +
         1065  +
         1066  +typedef voidp gzFile;
         1067  +
         1068  +ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
         1069  +/*
         1070  +     Opens a gzip (.gz) file for reading or writing. The mode parameter
         1071  +   is as in fopen ("rb" or "wb") but can also include a compression level
         1072  +   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
         1073  +   Huffman only compression as in "wb1h", or 'R' for run-length encoding
         1074  +   as in "wb1R". (See the description of deflateInit2 for more information
         1075  +   about the strategy parameter.)
         1076  +
         1077  +     gzopen can be used to read a file which is not in gzip format; in this
         1078  +   case gzread will directly read from the file without decompression.
         1079  +
         1080  +     gzopen returns NULL if the file could not be opened or if there was
         1081  +   insufficient memory to allocate the (de)compression state; errno
         1082  +   can be checked to distinguish the two cases (if errno is zero, the
         1083  +   zlib error is Z_MEM_ERROR).  */
         1084  +
         1085  +ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
         1086  +/*
         1087  +     gzdopen() associates a gzFile with the file descriptor fd.  File
         1088  +   descriptors are obtained from calls like open, dup, creat, pipe or
         1089  +   fileno (in the file has been previously opened with fopen).
         1090  +   The mode parameter is as in gzopen.
         1091  +     The next call of gzclose on the returned gzFile will also close the
         1092  +   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
         1093  +   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
         1094  +     gzdopen returns NULL if there was insufficient memory to allocate
         1095  +   the (de)compression state.
         1096  +*/
         1097  +
         1098  +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
         1099  +/*
         1100  +     Dynamically update the compression level or strategy. See the description
         1101  +   of deflateInit2 for the meaning of these parameters.
         1102  +     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
         1103  +   opened for writing.
         1104  +*/
         1105  +
         1106  +ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
         1107  +/*
         1108  +     Reads the given number of uncompressed bytes from the compressed file.
         1109  +   If the input file was not in gzip format, gzread copies the given number
         1110  +   of bytes into the buffer.
         1111  +     gzread returns the number of uncompressed bytes actually read (0 for
         1112  +   end of file, -1 for error). */
         1113  +
         1114  +ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
         1115  +                                   voidpc buf, unsigned len));
         1116  +/*
         1117  +     Writes the given number of uncompressed bytes into the compressed file.
         1118  +   gzwrite returns the number of uncompressed bytes actually written
         1119  +   (0 in case of error).
         1120  +*/
         1121  +
         1122  +ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
         1123  +/*
         1124  +     Converts, formats, and writes the args to the compressed file under
         1125  +   control of the format string, as in fprintf. gzprintf returns the number of
         1126  +   uncompressed bytes actually written (0 in case of error).  The number of
         1127  +   uncompressed bytes written is limited to 4095. The caller should assure that
         1128  +   this limit is not exceeded. If it is exceeded, then gzprintf() will return
         1129  +   return an error (0) with nothing written. In this case, there may also be a
         1130  +   buffer overflow with unpredictable consequences, which is possible only if
         1131  +   zlib was compiled with the insecure functions sprintf() or vsprintf()
         1132  +   because the secure snprintf() or vsnprintf() functions were not available.
         1133  +*/
         1134  +
         1135  +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
         1136  +/*
         1137  +      Writes the given null-terminated string to the compressed file, excluding
         1138  +   the terminating null character.
         1139  +      gzputs returns the number of characters written, or -1 in case of error.
         1140  +*/
         1141  +
         1142  +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
         1143  +/*
         1144  +      Reads bytes from the compressed file until len-1 characters are read, or
         1145  +   a newline character is read and transferred to buf, or an end-of-file
         1146  +   condition is encountered.  The string is then terminated with a null
         1147  +   character.
         1148  +      gzgets returns buf, or Z_NULL in case of error.
         1149  +*/
         1150  +
         1151  +ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
         1152  +/*
         1153  +      Writes c, converted to an unsigned char, into the compressed file.
         1154  +   gzputc returns the value that was written, or -1 in case of error.
         1155  +*/
         1156  +
         1157  +ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
         1158  +/*
         1159  +      Reads one byte from the compressed file. gzgetc returns this byte
         1160  +   or -1 in case of end of file or error.
         1161  +*/
         1162  +
         1163  +ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file));
         1164  +/*
         1165  +      Push one character back onto the stream to be read again later.
         1166  +   Only one character of push-back is allowed.  gzungetc() returns the
         1167  +   character pushed, or -1 on failure.  gzungetc() will fail if a
         1168  +   character has been pushed but not read yet, or if c is -1. The pushed
         1169  +   character will be discarded if the stream is repositioned with gzseek()
         1170  +   or gzrewind().
         1171  +*/
         1172  +
         1173  +ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
         1174  +/*
         1175  +     Flushes all pending output into the compressed file. The parameter
         1176  +   flush is as in the deflate() function. The return value is the zlib
         1177  +   error number (see function gzerror below). gzflush returns Z_OK if
         1178  +   the flush parameter is Z_FINISH and all output could be flushed.
         1179  +     gzflush should be called only when strictly necessary because it can
         1180  +   degrade compression.
         1181  +*/
         1182  +
         1183  +ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
         1184  +                                      z_off_t offset, int whence));
         1185  +/*
         1186  +      Sets the starting position for the next gzread or gzwrite on the
         1187  +   given compressed file. The offset represents a number of bytes in the
         1188  +   uncompressed data stream. The whence parameter is defined as in lseek(2);
         1189  +   the value SEEK_END is not supported.
         1190  +     If the file is opened for reading, this function is emulated but can be
         1191  +   extremely slow. If the file is opened for writing, only forward seeks are
         1192  +   supported; gzseek then compresses a sequence of zeroes up to the new
         1193  +   starting position.
         1194  +
         1195  +      gzseek returns the resulting offset location as measured in bytes from
         1196  +   the beginning of the uncompressed stream, or -1 in case of error, in
         1197  +   particular if the file is opened for writing and the new starting position
         1198  +   would be before the current position.
         1199  +*/
         1200  +
         1201  +ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
         1202  +/*
         1203  +     Rewinds the given file. This function is supported only for reading.
         1204  +
         1205  +   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
         1206  +*/
         1207  +
         1208  +ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
         1209  +/*
         1210  +     Returns the starting position for the next gzread or gzwrite on the
         1211  +   given compressed file. This position represents a number of bytes in the
         1212  +   uncompressed data stream.
         1213  +
         1214  +   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
         1215  +*/
         1216  +
         1217  +ZEXTERN int ZEXPORT gzeof OF((gzFile file));
         1218  +/*
         1219  +     Returns 1 when EOF has previously been detected reading the given
         1220  +   input stream, otherwise zero.
         1221  +*/
         1222  +
         1223  +ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
         1224  +/*
         1225  +     Returns 1 if file is being read directly without decompression, otherwise
         1226  +   zero.
         1227  +*/
         1228  +
         1229  +ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
         1230  +/*
         1231  +     Flushes all pending output if necessary, closes the compressed file
         1232  +   and deallocates all the (de)compression state. The return value is the zlib
         1233  +   error number (see function gzerror below).
         1234  +*/
         1235  +
         1236  +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
         1237  +/*
         1238  +     Returns the error message for the last error which occurred on the
         1239  +   given compressed file. errnum is set to zlib error number. If an
         1240  +   error occurred in the file system and not in the compression library,
         1241  +   errnum is set to Z_ERRNO and the application may consult errno
         1242  +   to get the exact error code.
         1243  +*/
         1244  +
         1245  +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
         1246  +/*
         1247  +     Clears the error and end-of-file flags for file. This is analogous to the
         1248  +   clearerr() function in stdio. This is useful for continuing to read a gzip
         1249  +   file that is being written concurrently.
         1250  +*/
         1251  +
         1252  +                        /* checksum functions */
         1253  +
         1254  +/*
         1255  +     These functions are not related to compression but are exported
         1256  +   anyway because they might be useful in applications using the
         1257  +   compression library.
         1258  +*/
         1259  +
         1260  +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
         1261  +/*
         1262  +     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
         1263  +   return the updated checksum. If buf is NULL, this function returns
         1264  +   the required initial value for the checksum.
         1265  +   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
         1266  +   much faster. Usage example:
         1267  +
         1268  +     uLong adler = adler32(0L, Z_NULL, 0);
         1269  +
         1270  +     while (read_buffer(buffer, length) != EOF) {
         1271  +       adler = adler32(adler, buffer, length);
         1272  +     }
         1273  +     if (adler != original_adler) error();
         1274  +*/
         1275  +
         1276  +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
         1277  +                                          z_off_t len2));
         1278  +/*
         1279  +     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
         1280  +   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
         1281  +   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
         1282  +   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
         1283  +*/
         1284  +
         1285  +ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
         1286  +/*
         1287  +     Update a running CRC-32 with the bytes buf[0..len-1] and return the
         1288  +   updated CRC-32. If buf is NULL, this function returns the required initial
         1289  +   value for the for the crc. Pre- and post-conditioning (one's complement) is
         1290  +   performed within this function so it shouldn't be done by the application.
         1291  +   Usage example:
         1292  +
         1293  +     uLong crc = crc32(0L, Z_NULL, 0);
         1294  +
         1295  +     while (read_buffer(buffer, length) != EOF) {
         1296  +       crc = crc32(crc, buffer, length);
         1297  +     }
         1298  +     if (crc != original_crc) error();
         1299  +*/
         1300  +
         1301  +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
         1302  +
         1303  +/*
         1304  +     Combine two CRC-32 check values into one.  For two sequences of bytes,
         1305  +   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
         1306  +   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
         1307  +   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
         1308  +   len2.
         1309  +*/
         1310  +
         1311  +
         1312  +                        /* various hacks, don't look :) */
         1313  +
         1314  +/* deflateInit and inflateInit are macros to allow checking the zlib version
         1315  + * and the compiler's view of z_stream:
         1316  + */
         1317  +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
         1318  +                                     const char *version, int stream_size));
         1319  +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
         1320  +                                     const char *version, int stream_size));
         1321  +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
         1322  +                                      int windowBits, int memLevel,
         1323  +                                      int strategy, const char *version,
         1324  +                                      int stream_size));
         1325  +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
         1326  +                                      const char *version, int stream_size));
         1327  +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
         1328  +                                         unsigned char FAR *window,
         1329  +                                         const char *version,
         1330  +                                         int stream_size));
         1331  +#define deflateInit(strm, level) \
         1332  +        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
         1333  +#define inflateInit(strm) \
         1334  +        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
         1335  +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
         1336  +        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
         1337  +                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
         1338  +#define inflateInit2(strm, windowBits) \
         1339  +        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
         1340  +#define inflateBackInit(strm, windowBits, window) \
         1341  +        inflateBackInit_((strm), (windowBits), (window), \
         1342  +        ZLIB_VERSION, sizeof(z_stream))
         1343  +
         1344  +
         1345  +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
         1346  +    struct internal_state {int dummy;}; /* hack for buggy compilers */
         1347  +#endif
         1348  +
         1349  +ZEXTERN const char   * ZEXPORT zError           OF((int));
         1350  +ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
         1351  +ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
         1352  +
         1353  +#ifdef __cplusplus
         1354  +}
         1355  +#endif
         1356  +
         1357  +#endif /* ZLIB_H */

Added build/cackey_win32_build/lib/WinSCard.dll version [c65243081f].

cannot compute difference between binary files

Added build/cackey_win32_build/lib/winscard.dll version [c65243081f].

cannot compute difference between binary files

Added build/cackey_win32_build/lib/winscard.lib version [eadd06eb72].

cannot compute difference between binary files

Added build/pkcs-11v2-11r1.pdf version [6d2477d226].

cannot compute difference between binary files

Modified cackey.c from [195b1c0ba3] to [426f7e236e].

   162    162   
   163    163   /** Applet IDs **/
   164    164   #define GSCIS_AID_CCC                 0xA0, 0x00, 0x00, 0x01, 0x16, 0xDB, 0x00
   165    165   
   166    166   /* Maximum size of data portion of APDUs */
   167    167   /** Do not set this above 250 **/
   168    168   #define CACKEY_APDU_MTU               250
          169  +
          170  +/* ATR If not available */
          171  +#ifndef MAX_ATR_SIZE
          172  +#define MAX_ATR_SIZE 1024
          173  +#endif
   169    174   
   170    175   #ifdef CACKEY_DEBUG
   171    176   #  ifdef HAVE_TIME_H
   172    177   #    include <time.h>
   173    178   static time_t cackey_debug_start_time = 0;
   174    179   #    define CACKEY_DEBUG_PRINTTIME { if (cackey_debug_start_time == 0) { cackey_debug_start_time = time(NULL); }; fprintf(stderr, "[%lu]: ", (unsigned long) (time(NULL) - cackey_debug_start_time)); }
   175    180   #  else

Modified pkcs11/pkcs11.h from [67c147948d] to [3299bf8a7b].

   219    219    * this should best be defined by
   220    220    *
   221    221    * #ifndef NULL_PTR
   222    222    * #define NULL_PTR 0
   223    223    * #endif
   224    224    */
   225    225   
          226  +#ifdef _WIN32
          227  +#pragma pack(push, cryptoki, 1)
          228  +#endif
   226    229   
   227    230   /* All the various Cryptoki types and #define'd values are in the
   228    231    * file pkcs11t.h. */
   229    232   #include "pkcs11t.h"
   230    233   
   231    234   #define __PASTE(x,y)      x##y
   232    235   
................................................................................
   285    288   
   286    289   /* Pile all the function pointers into the CK_FUNCTION_LIST. */
   287    290   /* pkcs11f.h has all the information about the Cryptoki
   288    291    * function prototypes. */
   289    292   #include "pkcs11f.h"
   290    293   
   291    294   };
          295  +
          296  +#ifdef _WIN32
          297  +#pragma pack(pop, cryptoki)
          298  +#endif
   292    299   
   293    300   #undef CK_PKCS11_FUNCTION_INFO
   294    301   
   295    302   
   296    303   #undef __PASTE
   297    304   
   298    305   #ifdef __cplusplus
   299    306   }
   300    307   #endif
   301    308   
   302    309   #endif