On Mar 22, 2008, at 8:31 PM, LUCKY LUCKE wrote:
Hi Timothy
Your having been so patient with my questions gives me the courage
to post again
Despite the many trial and error attempts, i have not been able so
far to read a memory card or write to it
as i dont do the right mapping of the native function parameters.
Unfortunately i dont have any manufacturer manual.
The only thing i know for sure is that the dataIn and dataOut params
of the SCardComand
are pointers to string arrays and are of type LPCSTR.
A quick google for the API shows this definition for Delphi:
Response = SCardComand (Handle, Cmd, CmdLen, DataIn, DataInLen, DataOut,
DataOutLen );
LPINT Handle /* pointer to a 32 bit signed integer */
LPSTR Cmd /* pointer to a zero terminated string */
LPINT CmdLen /* pointer to a 32 bit signed integer */
LPSTR DataIn /* pointer to an array of byte or a string */
LPINT DataInLen /* pointer to a 32 bit signed integer */
LPSTR DataOut /* pointer to an array of byte or a string */
LPINT DataOutLen /* pointer to a 32 bit signed integer */
INT Response /* 32 bit signed integer */
You can use java.lang.String for a zero-terminated (read-only) string,
but you must use byte[] if the native code writes to the memory you
give it.
Note that the "len" arguments are all pointers to int, which implies
that you may need to use IntByReference rather than a plain old
"int". While this may just be symptomatic of the Delphi API (I know
nothing of Delphi), an "int" given where "int*" is required would
certainly cause a VM crash.