Home > database >  Call DLL in PB structure parameter error
Call DLL in PB structure parameter error

Time:10-26

Everybody is good:
I have such a problem now, hope everybody can comment.
I have a DLL, there is an interface function is:

Int Bank_Balance (BANK_Input * p_Input, byte * PacketData, int * Datalen);
There is a structure parameters are defined as follows:
Typedef struct
{
Byte track 1 [37]./* 2 track information, asc format the longest 37 byte */
Byte Track3 [104]./* 3 track information, asc format the longest 104 bytes */
Byte Pwd [8]./* the encrypted password 8 bytes */
Byte Amount [12]. 000000000001/* amount, divided into units on behalf of 1 minute, don't allow 0 amount, integral when the ticket for the integral */
Byte Trace [6]./* terminal water, not a dynamic library water */
Byte OtherData [60]./* third party associated data, fill the blank space after less than 60 see note 1 */
Byte MerId [12]./* merchants */
Byte TerminalId [15]. Terminal number/* */
Byte OrdTrace [6]./* the original terminal serial number, offline sending to do offline trading when the batch Bank_GetBankTrace into water */
Byte OrgRetRefNo [8]./* the original transaction retrieval reference number */
Byte AccumulateCountAmount [108]./* only clearing trades, format see note 3 */
+ 1 byte PrmVersionInfo [12]; Version number/* parameters, the initial value is 010101000000 */
Byte CAVersionInfo 8 + [1];/* public key version number. The initial value of 01010100 */
Byte an InputMode;/* swipe of 0 x31, fallback to 0 x32, insert IC card is 0 x33 */
Byte PinInFlag;/* if lose, 0 x31 for the input password, secret * 0 x30 no losses/
Byte Field55 [255]./* IC 55 domain information see note 6 */
Byte Field55len;/* * 55 domain length/
Byte SeqNum [2]./* the first byte: is there a card serial number mark, 0 x01 said have 0 x00 said no, the second byte: actual card serial number */
Byte OTranDate [8]./* the original transaction date YYYYMMDD */
Byte OTranTime [6]./* * the original time/
Byte PreRetRefNo [15]./* to retrieve reference number prefix, sending, TC batch script notifications, add up and retrieve reference number is 23 retrieval reference number */
Byte BatchNum [6]./* batch number */
Byte Pan [20]./* to the card number at the end of 0 x00, sending, TC batch script notifications will */
+ 1 byte CtlsPrmVersionInfo [12];/* the parameter version number, the initial value is 010101000000 */
Byte AuthID [6]./* authorization code */
Byte OrgTermId [15]./* the original trading terminal number, return with */
Byte PaymentCode [40]. Self-help dealing)/* (a card payment code, format: 14 YYYYMMDDHHMMSS + 15 Banks terminal number, fill the rest of a right to fill the blank space of 40 bytes */
Byte JifenType;/* integral type integral sign values: 0-1 - a particular contribution to the comprehensive activity 1 2 3-2 - specific activities specific activity 3 activity 4 5-4 - at a specific activity 5 6 - specific activities - joint points and type of ASCII if 0 0 x30 */
Byte OfflineFlag;/* offline trade marks that 1-0 x31 for normal trading, 0 0 x30 as has the cancellation trading x33 revoked the fixed amount, 0 x32 fixed amount, 0 x34 buckles money and go online */
Byte CupContactlessCard;/* whether unionpay CARDS, electronic cash value 0 x0 or 0 x1
Electronic cash, a '4', '5' heading card */
Byte ExpDate [4]./* the period of validity, sending when send */offline trading group
Byte ContactlessSupFlg; Check-in/* whether to support the answer the incoming, value 0 x0 or 0 x1 */
Byte CNPCFlag;/* if the medium oil terminal, the default is not, send 1 is medium oil terminal value 0 x0 or 0 x1 */
Byte FCardFlag; The/* wild card, is supported, the default does not support, to support the value 0 x0 1 or 0 x1 */
Byte Reverse [256]./* keep */
} BANK_Input;

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
I used to call this PB11.5 interface, my reputation is as follows:

The FUNCTION long Bank_Balance (ref bank_input p_Input, ref byte PacketData [], ref long Datalen) LIBRARY "ICBCTRansLib. DLL" alias for "Bank_Balance; Ansi
"
In PB11 corresponding structure is as follows:
Global type bank_input from structure
Byte track 1 [37]
Byte track3 [104]
Byte PWD [8]
Byte amount [12]
Byte trace [6]
Byte otherdata [60]
Byte merid [12]
Byte terminalid [15]
Byte ordtrace [6]
Byte orgretrefno [8]
Byte accumulatecountamount [108]
Byte prmversioninfo [13]
Byte caversioninfo [9]
Byte an inputmode
Byte pininflag
Byte field55 [255]
Byte field55len
Byte seqnum [2]
Byte otrandate [8]
Byte otrantime [6]
Byte preretrefno [15]
Byte batchnum [6]
Byte pan [20]
Byte ctlsprmversioninfo [13]
Byte authid [6]
Byte orgtermid [15]
Byte paymentcode [40]
Byte jifentype [1]
Byte offlineflag [1]
Byte cupcontactlesscard
Byte expdate [4]
Byte contactlesssupflg
Byte cnpcflag
Byte fcardflag
Byte reverse [256]
End type


But in PB calls to Bank_Balance is submitted to the following error:

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The original concept Application Execution Error (R0042)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The Application terminated.

Error: the Specified argument type differs from the required argument type at runtime DLL function in hsformat.
(invalid stack pointer on the return from the function call) at line 37 clicked in the event of object cb_hk_format of w_examplecode_main.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sure
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Looked through the data:
1. There is also a the elder brothers had sent post:
http://bbs.csdn.net/topics/200028452
A DLL in the structure and the types of structures in PB mismatch
2. Another post said his mistakes, the DLL
Int _stdcall rtunyeartest (AbsoluteTime stuAbsoluteTime)

Into this fix
Int _stdcall rtunyeartest (AbsoluteTime * stuAbsoluteTime)

Ask each prawn to help busy, see what is the cause,

Thank you,

CodePudding user response:

1. If the DLL can adjust, it is suggested that the structural adjustment of string or an array of strings, this pb call up no problem

2. If the DLL cannot adjust, suggest you use other languages to encapsulate a DLL, string passed on pb to adjust your DLL, the DLL you call the DLL

3. Or pbni technique was used to realize
  • Related