LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pointer to a 32 byte buffer

Dear GerdW,
 
As u told i changed bATRLen as input. But still reports same buffer error.
 
Mathan
0 Kudos
Message 11 of 33
(1,797 Views)
Hi mathan,

why do you wire 255 to the bPTRLen input, when 32 would be ok? But I guess this is probably not the source of the problem...

As I only seldomly use DLLs, my knowledge comes to an end hereSmiley Sad
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 12 of 33
(1,793 Views)

Hai GerdW,

Sorry for disturbing you again and again.

The output ATR array becomes 0 since it was initialized. Will it be a problem? As per the configuration of dll, the ATR input should be - pointer to a 32 byte buffer.

Thanks,

Mathan

Note: Learning new things will give experience and that is the starting point of our knowledge and it never ends....

0 Kudos
Message 13 of 33
(1,791 Views)
Hi Mathan,

arrays will always handed over to the dll by a pointer (it's done in the call configuration). That's why you should provide this U8 array of length 32...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 14 of 33
(1,774 Views)

Dear GerdW,

So you are telling this....

For ATRlen input, i have to give 32 as input and it should be configured as U32 and passed as pointer to value.

For ATR input, i have to use "initialize array" with 32 as dimension size, 0 as input element and output of "init array" was given as input to ATR input of dll. ATR was configured as array with U8 data and passed as array data pointer with minimum length as ATRlength.

Am i correct? any modifications required?

Thanks,

Mathan

0 Kudos
Message 15 of 33
(1,769 Views)
Hi Mathan,

PTR is given as U8 array of length 32, as you already did.
PTRLen should be given as value, not as pointer to value - MSDN is describing it as "DWord". (Scalar values are usually given as value, not as reference/pointer to value...)

As I wrote before I'm not a dll guru. That's how I would do it...


Message Edited by GerdW on 05-05-2008 02:08 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 16 of 33
(1,765 Views)

Thanks GerdW,

I will try as per ur suggestion and update you the status little later.

Thanks

Mathan

0 Kudos
Message 17 of 33
(1,758 Views)
In this case, as well as the previous case, your fundamental problem is not undestanding data types. You are trying to call Windows API functions. MSDN clearly spells out the prototypes for those functions, and you can also find out what all these "DWORD", "LPTSRT", and "LPDWORD" types are. "LPDWORD" is a pointer to a DWORD. From MSDN:
pcbAtrLen

On input, supplies the length of the pbAtr buffer. On output, receives the number of bytes in the ATR string (32 bytes maximum). If this buffer length is specified as SCARD_AUTOALLOCATE, then pbAtr is converted to a pointer to a byte pointer, and it receives the address of a block of memory that contains the multiple-string structure.


Thus, the function is expecting a pointer to an integer so that it can write the actual number of bytes that it wrote to the pbAtr buffer that you should be supplying to the function.
Message 18 of 33
(1,740 Views)

Dear smercurio,

I got understand about datatypes clearly now. Still i need some clarifications.

As you told, how to specify buffer length as scard_autoallocate?

For pbAtr, "init array with 32 as dimension size and zero as element" can be given as input?

 

Thanks,

Mathan

0 Kudos
Message 19 of 33
(1,719 Views)

Dear GerdW,

In MSDN,


pbAtr
[out] Pointer to a 32-byte buffer that receives the ATR string from the currently inserted card, if available.
pbcAtrLen
[out] Pointer to a DWORD to receive the number of bytes in the ATR string (32 bytes maximum).


So pbAtrLen is a "pointer to value" only i think as smercurio told.

0 Kudos
Message 20 of 33
(1,718 Views)