Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:32:13+00:00 2026-05-16T06:32:13+00:00

I have to access a POS terminal under ms windows xp. I am using

  • 0

I have to access a POS terminal under ms windows xp. I am using python 2.7.
The crucial function in the DLL I load that does the payment accepts two pointer to structures, but it crashes returning 1 (Communication error) but without further messages.
Please note that when the payment function is called, not all the elements of POSData structure receive a value. Other function I tried (GetVersion) does work.
Here specifications and my code:

typedef struct
{
  char IPAddress[16]; //xxx.xxx.xxx.xxx
  int Port;
} TETHParameters;   
typedef struct
{
  char TerminalId[8+1];
  char AcquirerId[11+1];
  char TransactionType[3+1];
  char TransactionResult[2+1];
  char KODescription[24+1];
  char CardType[1+1];
  char STAN[6+1];
  char PAN[19+1];
  char AuthorizationCode[6+1];
  char OperationNumber[6+1];
  char DataTrs[7+1];
} TPOSData;

typedef struct
{
  char Amount[8+1];
  char ECRId[8+1];
  char PaymentType[1+1];
  char TerminalId[8+1];
} TECRData;

__declspec(dllexport) void IAE17_GetVersion(char *Version);
__declspec(dllexport) void IAE17_InitEth(TETHParameters *ETHParameters);

__declspec(dllexport) void IAE17_Free(void);

__declspec(dllexport) int IAE17_Payment(TECRData *ECRData, TPOSData *POSData);

from ctypes import *
#da python 3.x sara' configparser
import ConfigParser  
import logging
from time import  localtime,  strftime

    #STRUTTURE DATI
class TETHParameters(Structure):
    _fields_ =  [("IPAddress" , c_char_p), ("Port" , c_int )]


class TECRData(Structure):
    _fields_ = [("Amount" , c_char_p),
    ("ECRId", c_char_p),
    ("PaymentType", c_char_p),
    ("TerminalId", c_char_p),
    ("Contract", c_char_p),
    ("PreauthorizationCode", c_char_p),
    ("STAN", c_char_p),
    ("Ticket2Ecr", c_char_p)]


class TPOSData(Structure):
    _fields_ = [
    ("TerminalId" , c_char_p),
    ("AcquirerId" , c_char_p),
    ("TransactionType" , c_char_p),
    ("TransactionResult" , c_char_p),
    ("KODescription" , c_char_p),
    ("CardType" , c_char_p),
    ("STAN" , c_char_p),
    ("POSBalance" , c_char_p),
    ("BankBalance" , c_char_p),
    ("PAN" , c_char_p),
    ("AuthorizationCode" , c_char_p),
    ("OperationNumber" , c_char_p),
    ("AmountAuth" , c_char_p),
    ("PreauthorizationCode" , c_char_p),
    ("ActionCode" , c_char_p),
    ("DataTrs" , c_char_p),
    ("AmountEcho" , c_char_p),
    ("Ticket" , c_char_p)
    ] 

ECRData = TECRData( ECRId = c_char_p( '012345678' ), 
                    Amount  = c_char_p( '00000000')  , 
                    TerminalID = c_char_p( '01234567' ), 
                    PaymentType = c_char_p ("0")
                       )    


POSData = TPOSData( KODescription = c_char_p('                        '),
                            TerminalId = c_char_p('        '),  
                            AcquirerId = c_char_p('           '), 
                            TransactionType = c_char_p('   '), 
                            TransactionResult = c_char_p('   '),
                            CardType = c_char_p('  '), 
                            STAN = c_char_p('      '),
                            PAN = c_char_p('                   '), 
                            AuthorizationCode = c_char_p('      '),
                            OperationNumber = c_char_p('      '), 
                            DataTrs = c_char_p('       ')  
                            )   
ETHParameters = TETHParameters( IPAddress = c_char_p( '192.168.127.190' ) ,  Port = c_int(45119))                           
iae17 = windll.LoadLibrary('iae17')     
iae17.IAE17_InitEth( byref( ETHParameters) )   
result =  iae17.IAE17_Payment( byref(ECRData), byref(POSData))                      
print result
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:32:13+00:00Added an answer on May 16, 2026 at 6:32 am

    c_char_p is a direct translation of a C’s char *. So, it seems to me that while your C structure is

    typedef struct
    {
      char TerminalId[8+1];
      char AcquirerId[11+1];
      char TransactionType[3+1];
    
    &c
    

    the allegedly-corresponding one you’re making in ctypes is, instead, equivalent to

    typedef struct
    {
      char* TerminalId;
      char* AcquirerId;
      char* TransactionType;
    
    &c
    

    which is of course a drastically different thing. Why are you using “pointers” instead of ctypes’ arrays?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have access to an Oracle server that has some databases that I would
If I have a resource that a requesting client doesn't have access to but
In an actionscript function (method) I have access to arguments.caller which returns a Function
EDIT: I also have access to ESXLT functions. I have two node sets of
Unfortunately I don't have access to a *nix box at work or at home.
Many of our customers have access to InstallShield, WISE or AdminStudio. These aren't a
We have a system with an Oracle backend to which we have access (though
Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr,
How can I programmatically determine if I have access to a server (TCP) with
I'd like my .exe to have access to a resource string with my svn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.