AndreasFagschlunger / O2Xfs

Java API for accessing CEN/XFS API, EMV Level 2 Kernel
47 stars 28 forks source link

Pinpad. Run on win10 #74

Closed AlbertRudensky closed 5 years ago

AlbertRudensky commented 5 years ago

I get fatal error when run my test progamm on Windows 10(x64) Java_8u201_x64 It's occured in native method at.o2xfs.xfs.util.MessageHandler.run0 hs_err_pid7748.log Can you help to fix this problem?

Also, I tried to run program on winXP (x32) Actions in program:

XfsServiceManager serviceManager = XfsServiceManager.getInstance();
serviceManager.initialize();
PINService service = XfsManager.openAndRegister(logicalName, PINService.class);
XfsInfoCommand infoCommand = new XfsInfoCommand(service, PINInfoCommand.STATUS);
WFSResult wfsResult = infoCommand.call();
infoCommand.cancel();
final WFSPINSTATUS widcs = new WFSPINSTATUS(service.getXfsVersion(), wfsResult.getResults());

Result: widcs.getDevice() == PINDeviceState.OFFLINE

What actions need to be performed to change device status to PINDeviceState.ONLINE ?

AndreasFagschlunger commented 5 years ago

As far as I know there is no XFS Manager (msxfs.dll) for 64 bit (yet). So try to run you program with a 32 bit JRE. When you get a PIN status, you should see the full output in the log files. The status structures do have a extra field with vendor dependent strings, maybe they indicate whats wrong. But beside that, the status "Offline" indicates that the device isn't even connected.

AlbertRudensky commented 5 years ago
  1. With win10 and JRE x32 I got same fatal error

  2. Full status:

    at.o2xfs.xfs.pin.WFSPINSTATUS@6dd108[
    device=OFFLINE,
    encStat=WFS_PIN_ENCUNDEFINED,
    extra={},
    guidLights=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    autoBeepModes=[WFS_PIN_BEEP_ON_INACTIVE],
    certificateState=WFS_PIN_CERT_UNKNOWN,
    devicePosition=WFS_PIN_DEVICEPOSNOTSUPP,
    powerSaveRecoveryTime=0,
    antiFraudModule=WFS_PIN_AFMNOTSUPP]

    This is some default answer, because it same If I remove device

I checked pinpad with a test program that comes with the xfs drivers and it works

AndreasFagschlunger commented 5 years ago

Can you use at.o2xfs.xfs.service.pin.cmd.PINStatusCommand? In your code you have a infoCommand.cancel(); directly after call() - which doens't make sense since call blocks until command the command has finished. Also it handles the copying from XFS shared memory to heap memory and frees the XFS memory.

Did you check you're using the right logical name? Can you compare logs between O²XFS and the test program? The XFS Manager itself also has a trace file (default: C:\XFSTRACE.LOG), you can compare them too (HKEY_LOCAL_MACHINE\SOFTWARE\XFS\XFS_MANAGER (TraceFile)).

AlbertRudensky commented 5 years ago

Thank you, Andreas, I found a mistake. It was wrong port settings :( In winXP device have status ONLINE, but target OS for me is win10 and fatal error in native method MessageHandler.run0 not resolved Can you recommend something else?

AndreasFagschlunger commented 5 years ago

The code should work with Windows 10, I work on Windows 10 with a 32 Bit XFS Manager, which means I run my code with a 32 bit Java 8 JVM. Can you pinpoint when the crash occurs? Can you safely initalize/shutdown XFS Manager? Does the Message loop even start, I still have those MSG LOOP - START/END entries in my code.

Also the fatal error log you attached was from a 64 bit JVM, does it look different with a 32 bit JVM? The exception itself basically is a "null dereference", so something in native code is NULL and is accessed.

You can try to build your own DLL using gradle, overwrite the existing within your user directory (C:\Users*.o2xfs\lib). Maybe by adding more printf-Statements you can find where and when the error occurs. You can debug the messages arriving through WndProc, maybe a message arrives which isn't from XFS and shouldn't be delegated to Java (CallVoidMethod).