Compare commits

..

No commits in common. "master" and "v0.5.0" have entirely different histories.

13 changed files with 224 additions and 548 deletions

7
.gitignore vendored
View file

@ -1,7 +1,3 @@
nbproject/
*.dep
# Object files # Object files
*.o *.o
*.lo *.lo
@ -32,14 +28,11 @@ config.cache
config.guess config.guess
config.h config.h
config.h.in config.h.in
config.h.in~
config.log config.log
config.nice config.nice
config.status config.status
config.sub config.sub
configure configure
configure~
configure.ac
configure.in configure.in
conftest conftest
conftest.c conftest.c

2
CREDITS Normal file
View file

@ -0,0 +1,2 @@
pcsc
Johann Dantant, Johannes Findeisen, Marco Schuster, Calvin Buckley

231
README.md
View file

@ -1,227 +1,90 @@
# PC/SC for PHP <h2 id="About">About</h2>
## About <p>This is the only extension for using <a href="http://www.pcscworkgroup.com/" class="ext">PC/SC</a> based smart cards with <a href="http://www.php.net" class="ext">PHP</a>. It is a wrapper to the wonderful and free project by Ludovic Rousseau, <a href="https://pcsclite.apdu.fr/" class="ext">PCSC-Lite</a>, which is the middleware to access a smart card using SCard API (PC/SC). Since PCSC-Lite is compatible to the winscard API it should be possible to compile this extension using a Windows or macOS operating system.</p>
This is the only extension for using [PC/SC](http://www.pcscworkgroup.com/) based smart cards with [PHP](http://www.php.net). It is a wrapper to the wonderful and free project by Ludovic Rousseau, [PCSC-Lite](https://pcsclite.apdu.fr/), which is the middleware to access a smart card using SCard API (PC/SC). Since PCSC-Lite is compatible to the winscard API it should be possible to compile this extension using a Windows or macOS operating system. <p>Thanks are going to Johann Dantant! He provides a PC/SC extension for PHP since 2005 and I reused some of his code. He allowed me to relicense these parts under the terms of the PHP license so I could integrate PCSC-Lite natively into PHP.</p>
Thanks are going to Johann Dantant! He provided a PC/SC extension for PHP since 2005 and I reused some of his code. He allowed me to relicense these parts under the terms of the PHP license so I could integrate PCSC-Lite native into PHP. <h2 id="Installation">Installation</h2>
## Installation <p>I recommend to install the PECL extension the "PHP" way:</p>
I recommend to install the PECL extension the "PHP" way: <pre>pecl install pcsc-beta</pre>
``` <p>You can install the latest code by downloading the sources and compile yourself too.</p>
pecl install pcsc-beta
```
You can install the latest code by downloading the sources and compile yourself too. <pre>git clone https://github.com/pcsc-for-php/pcsc.git
```
git clone https://github.com/pcsc-for-php/pcsc.git
cd pcsc cd pcsc
phpize phpize
./configure ./configure
make make
make install make install</pre>
```
After that you have all needed files in ./modules/ . <p>After that you have all needed files in ./modules/</p>
## API <h2 id="API">API</h2>
The extension currently provides the following API (alphabetical order): <p>The extension currently provides the following API:</p>
### pcsc_stringify_error($errno); <h3 id="scard_establish_context">scard_establish_context();</h3>
Returns $errstr for $errno or NULL. <p>Returns the application $context to the PC/SC resource manager.</p>
**NOT IMPLEMENTED!** - Should be available! <h3 id="scard_is_valid_context">scard_is_valid_context($context);</h3>
Duplicate of scard_errstr() but this should be the default. <p>Returns TRUE if $context is valid or FALSE if $context is not valid.</p>
### scard_begin_transaction($connection); <h3 id="scard_release_context">scard_release_context($context);</h3>
**NOT IMPLEMENTED!** - Should be available! <p>Releases the application $context.</p>
Establishes a temporary exclusive access mode for doing a serie of commands in a transaction. <h3 id="scard_list_readers">scard_list_readers($context);</h3>
You might want to use this when you are selecting a few files and then writing a large file so you can make sure that another application will not change the current file. If another application has a lock on this reader or this application is in SCARD_SHARE_EXCLUSIVE there will be no action taken. <p>Returns an array of available readers or FALSE.</p>
### scard_cancel($context); <h5>Example:</h5>
**NOT IMPLEMENTED!** - Maybe not useful because of this extension is for server side usage designed but since we want the API implemented it should be available. <pre>array(3) {
[0]=&gt;
### scard_connect($context, "OMNIKEY CardMan 5x21 00 00" [, int $protocol]);
Connects to a card. Returns the $connection to a reader or FALSE.
Where optional $protocol is:
* 1 = T=0
* 2 = T=1
Default $protocol is T=1.
### scard_control($connection);
**NOT IMPLEMENTED!** - Should be available!
Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.
### scard_disconnect($connection);
Disconnects the $connection to a card. Returns the TRUE if disconnecting was succesful or FALSE.
### scard_end_transaction($connection);
**NOT IMPLEMENTED!** - Should be available!
Ends a previously begun transaction.
The calling application must be the owner of the previously begun transaction or an error will occur.
### scard_errstr($errno); - Not PC/SC standard.
Returns $errstr for $errno or NULL.
### scard_establish_context();
Returns the application $context to the PC/SC resource manager.
### scard_get_attrib($connection);
**NOT IMPLEMENTED!** - Should be available!
Get an attribute from the IFD Handler (reader driver).
### scard_get_status_change($context);
**NOT IMPLEMENTED!** - Should be available!
Blocks execution until the current availability of the cards in a specific set of readers changes.
### scard_is_valid_context($context);
Returns TRUE if $context is valid or FALSE if $context is not valid.
### scard_last_errno(); - Not PC/SC standard.
Returns the last $errno or nothing? NULL or FALSE? (TODO)
### scard_list_reader_groups($context);
**NOT IMPLEMENTED!** - Should be available!
Returns a list of currently available reader groups on the system.
### scard_list_readers($context);
Returns an array of available readers or FALSE.
#### Example:
```
array(3) {
[0]=>
string(26) "OMNIKEY CardMan 5x21 00 00" string(26) "OMNIKEY CardMan 5x21 00 00"
[1]=> [1]=&gt;
string(26) "OMNIKEY CardMan 5x21 00 01" string(26) "OMNIKEY CardMan 5x21 00 01"
[2]=> [2]=&gt;
string(76) "SCL01x Contactless Reader [SCL01x Contactless Reader] (21161009200722) 00 00" string(76) "SCL01x Contactless Reader [SCL01x Contactless Reader] (21161009200722) 00 00"
} }
``` </pre>
### scard_reconnect($connection); <h3 id="scard_connect">scard_connect($context, "OMNIKEY CardMan 5x21 00 00");</h3>
**NOT IMPLEMENTED!** - Should be available! <p>Connects to a card. Returns the $connection to a reader or FALSE.</p>
Returns the $connection to a reader or FALSE. <h3 id="scard_reconnect">scard_reconnect($connection);</h3>
### scard_release_context($context); <p>Returns the $connection to a reader or FALSE.</p>
Releases the application $context. <h3 id="scard_disconnect">scard_disconnect($connection);</h3>
### scard_set_attrib($connection); <p>Disconnects the $connection to a card. Returns the TRUE if disconnecting was succesful or FALSE.</p>
**NOT IMPLEMENTED!** - Should be available! <h3 id="scard_transmit">scard_transmit($connection, $apdu);</h3>
Set an attribute of the IFD Handler. <p>Returns the response $apdu as string or FALSE.</p>
### scard_status($connection); <h3 id="scard_status">scard_status($connection);</h3>
Returns the status array or FALSE. <p>Returns the status or FALSE.</p>
#### Example: <h3 id="scard_cancel">scard_cancel($context);</h3>
``` <h2 id="License">License</h2>
array(7) {
["state"]=>
int(52)
["SCARD_PRESENT"]=>
int(1)
["SCARD_POWERED"]=>
int(1)
["SCARD_NEGOTIABLE"]=>
int(1)
["SCARD_PROTOCOL_T1"]=>
int(1)
["PROTOCOL"]=>
string(3) "T=1"
["ATR"]=>
string(28) "3B8980014A434F5033315632324A"
}
```
### scard_transmit($connection, $apdu); <p>This code is licensed under the terms of the PHP License version 3.01. PCSC-Lite is licensed in a way where it is possible to integrate it native in the PHP environment.</p>
Returns the response $apdu as string or FALSE. <h2 id="Links">Links</h2>
## To do:
There is some stuff to do. Some things are important but some are not.
### Implement important missing PC/SC functions and write documentation:
* SCardBeginTransaction()
* SCardEndTransaction()
* SCardControl()
* SCardGetStatusChange()
* Write complete API documentation
### Implement less important missing PC/SC functions:
* SCardGetAttrib()
* SCardSetAttrib()
* SCardListReaderGroups()
* SCardReconnect()
### Goal:
Completely implement the full API from [PC/SC API from PCSC-Lite](https://pcsclite.apdu.fr/api/group__API.html)
## License
This code is licensed under the terms of the PHP License version 3.01. PCSC-Lite is licensed in a way where it is possible to integrate it native in the PHP environment.
## Credits
This extension was originally written in 2005 by Johann Dantant. In 2011 Johannes Findeisen took his code and updated it to work with the current PHP version. Johannes maintains the code to this day, but there have been some contributions from other people in the past. All people who have worked on extending or porting the "pcsc" extension are listed below in alphabetical order by their last name. Thanks to all!
* [Anatol Belski](https://github.com/weltling) (Contributor)
* [Calvin Buckley](https://github.com/NattyNarwhal) (Contributor)
* [Remi Collet](https://github.com/remicollet) (Contributor)
* Johann Dantant (Original author)
* [Jan Ehrhardt](https://github.com/Jan-E) (Contributor)
* [Johannes Findeisen](https://github.com/hanez) (Maintainer)
* Marco Schuster (Contributor)
## Links
* [PECL Project Page](http://pecl.php.net/package/pcsc) - Page for package download at PHP.net
* [PC/SC Worgroup](http://www.pcscworkgroup.com/) - Homepage and definition file downloads
* [PC/SC](http://en.wikipedia.org/wiki/PC/SC) - PC/SC at Wikipedia
* [PC/SC-Lite](https://pcsclite.apdu.fr/) - The free and open implementation of the PC/SC SCard API for UNIX
* [PC/SC API from PCSC-Lite](https://pcsclite.apdu.fr/api/group__API.html) - Documentation of the PCSC-Lite API
* [PCSC sample in PHP5](https://blog.apdu.fr/posts/2015/01/pcsc-sample-in-php5/) - Ludovic Rousseau about "PC/SC for PHP"
* [winscard.h header](https://docs.microsoft.com/en-us/windows/win32/api/winscard/) - Microsoft Documentation
<ul>
<li><a href="http://pecl.php.net/package/pcsc" class="ext">PECL Project Page</a> - Page for package download at PHP.net</li>
<li><a href="http://www.pcscworkgroup.com/" class="ext">PC/SC Worgroup</a> - Homepage and definition file downloads.</li>
<li><a href="http://en.wikipedia.org/wiki/PC/SC" class="ext">PC/SC</a> - PC/SC at Wikipedia.</li>
<li><a href="https://pcsclite.apdu.fr/" class="ext">PC/SC-Lite</a> - The free and open implementation of the PC/SC SCard API for UNIX</li>
<li><a href="http://ludovicrousseau.blogspot.de/2015/01/pcsc-sample-in-php5.html" class="ext">PCSC sample in PHP5</a> - Ludovic Rousseau about "PC/SC for PHP"</li>
</ul>

15
TODO Normal file
View file

@ -0,0 +1,15 @@
Implement important missing PC/SC functions:
- SCardControl(),
SCardGetStatusChange(),
SCardBeginTransaction(),
SCardEndTransaction()
Implement less important missing PC/SC functions:
- SCardGetAttrib(),
SCardSetAttrib(),
SCardListReaderGroups(),
SCardReconnect
Write complete API documentation

View file

@ -15,9 +15,9 @@ class PCSC {
$this->context = scard_establish_context(); $this->context = scard_establish_context();
} }
/*function __destruct() { function __destruct() {
$this->context = scard_release_context($this->context); $this->context = scard_release_context($this->context);
}*/ }
function connect($reader) { function connect($reader) {
return $this->connection = scard_connect($this->context, $reader); return $this->connection = scard_connect($this->context, $reader);

View file

@ -1,119 +0,0 @@
<?php
if (!extension_loaded('pcsc')) {
dl('pcsc.so');
}
# Get a PC/SC context
echo ">> Create Context\n";
$context = scard_establish_context();
var_dump($context);
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Get the reader list
echo ">> Get Readers\n";
$readers = scard_list_readers($context);
var_dump($readers);
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Use the first reader
echo ">> Select Reader\n";
$reader = $readers[1];
echo "Using reader: ", $reader, "\n";
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Connect to the card
echo ">> Connect to Card\n";
$card = scard_connect($context, $reader, 2);
var_dump( $card );
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Begin Transaction
echo ">> Begin Transaction\n";
$begin= scard_begin_transaction($card);
var_dump($begin);
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Select Applet APDU
echo ">> Select Applet\n";
$apdu = "00a4040c0cD2760001354B414E4D30310000";
$res = scard_transmit($card , $apdu);
var_dump($res);
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# test APDU
echo ">> Send APDU\n";
$apdu = "0084000008";
$res = scard_transmit($card, $apdu);
var_dump($res);
#echo pack("H*", $res), "\n";
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# End Transaction
echo ">> End Transaction\n";
$begin= scard_end_transaction($card);
var_dump( $card );
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Show Status
echo ">> Show Status\n";
$status = scard_status($card);
var_dump($status);
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
# Release the PC/SC context
echo ">> Release Context\n";
scard_release_context($context);
$errno = scard_last_errno();
var_dump($errno);
$errstr = scard_errstr($errno);
var_dump($errstr);
echo "\n";
?>

View file

@ -13,22 +13,19 @@ $foo = new PCSC();
echo "Create Context:\n"; echo "Create Context:\n";
var_dump($foo->context); var_dump($foo->context);
#echo "Last Error String:";
#var_dump($foo->scard_errstr($foo->scard_last_errno()));
echo "List Readers:\n"; echo "List Readers:\n";
var_dump($foo->listreaders()); var_dump($foo->listreaders());
echo "Connect Card:\n"; echo "Connect Card:\n";
var_dump($foo->connect("OMNIKEY CardMan (076B:5321) 5321 00 01")); var_dump($foo->connect("OMNIKEY CardMan 5x21 00 01"));
#echo "Reconnect:\n"; #echo "Reconnect:\n";
#var_dump($foo->reconnect()); #var_dump($foo->reconnect());
echo "Some Transmits:\n"; echo "Some Transmits:\n";
// Select applet
var_dump($foo->transmit("00a4040c0cD2760001354B414E4D30310000")); var_dump($foo->transmit("00a4040c0cD2760001354B414E4D30310000"));
// APDU to execute RNG function on card applet var_dump($foo->transmit("0084000008"));
var_dump($foo->transmit("0084000008"));
var_dump($foo->transmit("0084000008")); var_dump($foo->transmit("0084000008"));
echo "Is Valid Context?\n"; echo "Is Valid Context?\n";

View file

@ -20,10 +20,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
<email>calvin@cmpct.info</email> <email>calvin@cmpct.info</email>
<active>yes</active> <active>yes</active>
</developer> </developer>
<date>2021-02-21</date> <date>2021-02-20</date>
<time>01:26:42</time> <time>23:44:26</time>
<version> <version>
<release>0.6.0</release> <release>0.5.0</release>
<api>0.3.1</api> <api>0.3.1</api>
</version> </version>
<stability> <stability>
@ -31,10 +31,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
<api>stable</api> <api>stable</api>
</stability> </stability>
<license uri="http://www.php.net/license">PHP</license> <license uri="http://www.php.net/license">PHP</license>
<notes>Added and updated content like README.md; No bug or feature updates.</notes> <notes>Updated for PHP 8 compatibility.</notes>
<contents> <contents>
<dir name="/"> <dir name="/">
<file name="COPYING" role="doc" /> <file name="COPYING" role="doc" />
<file name="CREDITS" role="doc" />
<file name="config.m4" role="src" /> <file name="config.m4" role="src" />
<file name="config.w32" role="src" /> <file name="config.w32" role="src" />
<file name="pcsc.c" role="src" /> <file name="pcsc.c" role="src" />
@ -42,7 +43,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="pcsc.stub.php" role="src" /> <file name="pcsc.stub.php" role="src" />
<file name="pcsc_arginfo.h" role="src" /> <file name="pcsc_arginfo.h" role="src" />
<file name="pcsc_legacy_arginfo.h" role="src" /> <file name="pcsc_legacy_arginfo.h" role="src" />
<file name="README.md" role="doc" /> <file name="TODO" role="doc" />
</dir> <!-- / --> </dir> <!-- / -->
</contents> </contents>
<dependencies> <dependencies>

45
pcsc.c
View file

@ -575,7 +575,7 @@ PHP_FUNCTION(scard_list_readers)
Return a handle to the card */ Return a handle to the card */
PHP_FUNCTION(scard_connect) PHP_FUNCTION(scard_connect)
{ {
DWORD dwPreferredProtocol = SCARD_PROTOCOL_RAW | SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1; DWORD dwPreferredProtocol = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
DWORD dwCurrentProtocol; DWORD dwCurrentProtocol;
SCARDHANDLE hCard = 0; SCARDHANDLE hCard = 0;
LONG rc = 0; LONG rc = 0;
@ -636,48 +636,6 @@ PHP_FUNCTION(scard_disconnect)
} }
/* }}} */ /* }}} */
/* {{{ proto boolean scard_begin_transaction(resource card_handle)
Begin transaction on a card connection obtained with scard_connect */
PHP_FUNCTION(scard_begin_transaction)
{
LONG rc;
zval* conn_res;
SCARDHANDLE hCard;
ZEND_FETCH_RESOURCE(hCard, SCARDHANDLE, &conn_res, -1, PHP_PCSC_CONN_RES_NAME, le_pcsc_conn_res);
rc = SCardBeginTransaction(hCard);
if (rc != SCARD_S_SUCCESS) {
PCSC_G(last_errno) = rc;
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto boolean scard_end_transaction(resource card_handle, [long disposition = SCARD_LEAVE_CARD])
End a previously begun transaction invoked by scard_begin_transaction on a card connection obtained with scard_connect; If no transaction began, do nothing. */
PHP_FUNCTION(scard_end_transaction)
{
zend_long dwDisposition = SCARD_LEAVE_CARD;
LONG rc;
zval* conn_res;
SCARDHANDLE hCard;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &conn_res, &dwDisposition) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(hCard, SCARDHANDLE, &conn_res, -1, PHP_PCSC_CONN_RES_NAME, le_pcsc_conn_res);
rc = SCardEndTransaction(hCard, (DWORD)dwDisposition);
if (rc != SCARD_S_SUCCESS) {
PCSC_G(last_errno) = rc;
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string scard_transmit(resource card_handle, string send_command) /* {{{ proto string scard_transmit(resource card_handle, string send_command)
Transmit (and receive) data to (and from) the card */ Transmit (and receive) data to (and from) the card */
PHP_FUNCTION(scard_transmit) PHP_FUNCTION(scard_transmit)
@ -793,6 +751,7 @@ PHP_FUNCTION(scard_status)
add_assoc_long(return_value, "SCARD_SPECIFIC", 1); add_assoc_long(return_value, "SCARD_SPECIFIC", 1);
switch (dwProtocol) { switch (dwProtocol) {
/* Maybe change to bool type here instead of add_assoc_long...? */
case SCARD_PROTOCOL_RAW : add_assoc_long(return_value, "SCARD_PROTOCOL_RAW", 1); case SCARD_PROTOCOL_RAW : add_assoc_long(return_value, "SCARD_PROTOCOL_RAW", 1);
add_assoc_string(return_value, "PROTOCOL", "RAW"); add_assoc_string(return_value, "PROTOCOL", "RAW");
break; break;

View file

@ -37,18 +37,6 @@ function scard_connect($context, string $reader_name, int $preferred_protocol=SC
*/ */
function scard_disconnect($card, int $disposition=SCARD_EJECT_CARD): bool {} function scard_disconnect($card, int $disposition=SCARD_EJECT_CARD): bool {}
/**
* @param resource $card
* @return resource|false
*/
function scard_begin_transaction($card): bool {}
/**
* @param resource $card
* @return resource|false
*/
function scard_end_transaction($card, int $disposition=SCARD_LEAVE_CARD): bool {}
/** /**
* @param resource $card * @param resource $card
* @return resource|false * @return resource|false

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 676b86ff0a1ee4d762d86126e8068f4cb6805272 */ * Stub hash: 3e1df1d509b6416c1eb997f61295c26d9ad0fd03 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_establish_context, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_establish_context, 0, 0, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
@ -26,15 +26,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_scard_disconnect, 0, 1, _IS_BOOL
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, disposition, IS_LONG, 0, "SCARD_EJECT_CARD") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, disposition, IS_LONG, 0, "SCARD_EJECT_CARD")
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_scard_begin_transaction, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, card)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_scard_end_transaction, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, card)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, disposition, IS_LONG, 0, "SCARD_LEAVE_CARD")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_scard_transmit, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_scard_transmit, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, card) ZEND_ARG_INFO(0, card)
ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
@ -58,8 +49,6 @@ ZEND_FUNCTION(scard_is_valid_context);
ZEND_FUNCTION(scard_list_readers); ZEND_FUNCTION(scard_list_readers);
ZEND_FUNCTION(scard_connect); ZEND_FUNCTION(scard_connect);
ZEND_FUNCTION(scard_disconnect); ZEND_FUNCTION(scard_disconnect);
ZEND_FUNCTION(scard_begin_transaction);
ZEND_FUNCTION(scard_end_transaction);
ZEND_FUNCTION(scard_transmit); ZEND_FUNCTION(scard_transmit);
ZEND_FUNCTION(scard_status); ZEND_FUNCTION(scard_status);
ZEND_FUNCTION(scard_last_errno); ZEND_FUNCTION(scard_last_errno);
@ -73,8 +62,6 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(scard_list_readers, arginfo_scard_list_readers) ZEND_FE(scard_list_readers, arginfo_scard_list_readers)
ZEND_FE(scard_connect, arginfo_scard_connect) ZEND_FE(scard_connect, arginfo_scard_connect)
ZEND_FE(scard_disconnect, arginfo_scard_disconnect) ZEND_FE(scard_disconnect, arginfo_scard_disconnect)
ZEND_FE(scard_begin_transaction, arginfo_scard_begin_transaction)
ZEND_FE(scard_end_transaction, arginfo_scard_end_transaction)
ZEND_FE(scard_transmit, arginfo_scard_transmit) ZEND_FE(scard_transmit, arginfo_scard_transmit)
ZEND_FE(scard_status, arginfo_scard_status) ZEND_FE(scard_status, arginfo_scard_status)
ZEND_FE(scard_last_errno, arginfo_scard_last_errno) ZEND_FE(scard_last_errno, arginfo_scard_last_errno)

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead. /* This is a generated file, edit the .stub.php file instead.
* Stub hash: 676b86ff0a1ee4d762d86126e8068f4cb6805272 */ * Stub hash: 3e1df1d509b6416c1eb997f61295c26d9ad0fd03 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_establish_context, 0, 0, 0) ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_establish_context, 0, 0, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
@ -24,18 +24,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_disconnect, 0, 0, 1)
ZEND_ARG_INFO(0, disposition) ZEND_ARG_INFO(0, disposition)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_begin_transaction, 0, 0, 1)
ZEND_ARG_INFO(0, card)
ZEND_END_ARG_INFO()
#define arginfo_scard_end_transaction arginfo_scard_disconnect
ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_transmit, 0, 0, 2) ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_transmit, 0, 0, 2)
ZEND_ARG_INFO(0, card) ZEND_ARG_INFO(0, card)
ZEND_ARG_INFO(0, command) ZEND_ARG_INFO(0, command)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define arginfo_scard_status arginfo_scard_begin_transaction ZEND_BEGIN_ARG_INFO_EX(arginfo_scard_status, 0, 0, 1)
ZEND_ARG_INFO(0, card)
ZEND_END_ARG_INFO()
#define arginfo_scard_last_errno arginfo_scard_establish_context #define arginfo_scard_last_errno arginfo_scard_establish_context
@ -50,8 +46,6 @@ ZEND_FUNCTION(scard_is_valid_context);
ZEND_FUNCTION(scard_list_readers); ZEND_FUNCTION(scard_list_readers);
ZEND_FUNCTION(scard_connect); ZEND_FUNCTION(scard_connect);
ZEND_FUNCTION(scard_disconnect); ZEND_FUNCTION(scard_disconnect);
ZEND_FUNCTION(scard_begin_transaction);
ZEND_FUNCTION(scard_end_transaction);
ZEND_FUNCTION(scard_transmit); ZEND_FUNCTION(scard_transmit);
ZEND_FUNCTION(scard_status); ZEND_FUNCTION(scard_status);
ZEND_FUNCTION(scard_last_errno); ZEND_FUNCTION(scard_last_errno);
@ -65,8 +59,6 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(scard_list_readers, arginfo_scard_list_readers) ZEND_FE(scard_list_readers, arginfo_scard_list_readers)
ZEND_FE(scard_connect, arginfo_scard_connect) ZEND_FE(scard_connect, arginfo_scard_connect)
ZEND_FE(scard_disconnect, arginfo_scard_disconnect) ZEND_FE(scard_disconnect, arginfo_scard_disconnect)
ZEND_FE(scard_begin_transaction, arginfo_scard_begin_transaction)
ZEND_FE(scard_end_transaction, arginfo_scard_end_transaction)
ZEND_FE(scard_transmit, arginfo_scard_transmit) ZEND_FE(scard_transmit, arginfo_scard_transmit)
ZEND_FE(scard_status, arginfo_scard_status) ZEND_FE(scard_status, arginfo_scard_status)
ZEND_FE(scard_last_errno, arginfo_scard_last_errno) ZEND_FE(scard_last_errno, arginfo_scard_last_errno)

View file

@ -4,7 +4,7 @@
extern zend_module_entry pcsc_module_entry; extern zend_module_entry pcsc_module_entry;
#define phpext_pcsc_ptr &pcsc_module_entry #define phpext_pcsc_ptr &pcsc_module_entry
#define PHP_PCSC_VERSION "0.6.0" #define PHP_PCSC_VERSION "0.5.0"
#ifdef PHP_WIN32 #ifdef PHP_WIN32
#define PHP_PCSC_API __declspec(dllexport) #define PHP_PCSC_API __declspec(dllexport)
@ -32,8 +32,6 @@ PHP_FUNCTION(scard_list_readers);
PHP_FUNCTION(scard_connect); PHP_FUNCTION(scard_connect);
//PHP_FUNCTION(scard_reconnect); //PHP_FUNCTION(scard_reconnect);
PHP_FUNCTION(scard_disconnect); PHP_FUNCTION(scard_disconnect);
PHP_FUNCTION(scard_begin_transaction);
PHP_FUNCTION(scard_end_transaction);
PHP_FUNCTION(scard_status); PHP_FUNCTION(scard_status);
//PHP_FUNCTION(scard_get_status_change); //PHP_FUNCTION(scard_get_status_change);
PHP_FUNCTION(scard_transmit); PHP_FUNCTION(scard_transmit);