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 728053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:38:15+00:00 2026-05-14T06:38:15+00:00

Original Working VB_Code Private Declare Function ConnectReader Lib rfidhid.dll () As Integer Private Declare

  • 0

Original Working VB_Code

Private Declare Function ConnectReader Lib "rfidhid.dll" () As Integer
Private Declare Function DisconnectReader Lib "rfidhid.dll" () As Integer
Private Declare Function SetAntenna Lib "rfidhid.dll" (ByVal mode As Integer) As Integer
Private Declare Function Inventory Lib "rfidhid.dll" (ByRef tagdata As Byte, ByVal mode As Integer, ByRef taglen As Integer) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim desc As String
    desc = "1. Click ""Connect"" to talk to reader." & vbCr & vbCr
    desc &= "2. Click ""RF On"" to wake up the TAG." & vbCr & vbCr
    desc &= "3. Click ""Read Tag"" to get tag PCEPC."
    lblDesc.Text = desc
End Sub

Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
    If cmdConnect.Text = "Connect" Then
        If ConnectReader() Then
            cmdConnect.Text = "Disconnect"
        Else
            MsgBox("Unable to connect to RFID Reader. Please check reader connection.")
        End If
    Else
        If DisconnectReader() Then
            cmdConnect.Text = "Connect"
        End If
    End If
End Sub

Private Sub cmdRF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRF.Click
    If cmdRF.Text = "RF On" Then
        If SetAntenna(&HFF) Then
            cmdRF.Text = "RF Off"
        End If
    Else
        If SetAntenna(&H0) Then
            cmdRF.Text = "RF On"
        End If
    End If
End Sub

Private Sub cmdReadTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReadTag.Click
    Dim tagdata(64) As Byte
    Dim taglen As Integer, cnt As Integer
    Dim pcepc As String
    pcepc = ""
    If Inventory(tagdata(0), 1, taglen) Then
        For cnt = 0 To taglen - 1
            pcepc &= tagdata(cnt).ToString("X2")
        Next
        txtPCEPC.Text = pcepc
    Else
        txtPCEPC.Text = "ReadError"
    End If

End Sub

Java Code (Simplified)

import com.sun.jna.Library;
import com.sun.jna.Native;

public class HelloWorld {
public interface MyLibrary extends Library {
   public int ConnectReader();  
   public int SetAntenna (int mode);
   public int Inventory (byte tagdata, int mode, int taglen); 

 }

 public static void main(String[] args) {
MyLibrary lib = (MyLibrary) Native.loadLibrary("rfidhid", MyLibrary.class);

System.out.println(lib.ConnectReader());

System.out.println(lib.SetAntenna(255));
byte[] tagdata = new byte[64];

int taglen = 0;
int cnt;
String pcepc;
pcepc = "";

if (lib.Inventory(tagdata[0], 1, taglen) == 1) {
    for (cnt = 0; cnt < taglen; cnt++) 
        pcepc += String.valueOf(tagdata[cnt]);           
} 
}
}

The error happens when lib.Inventory is run. lib.Inventory is used to get the tag from the RFID reader. If there is no tag, no error.

The error code

 An unexpected error has been detected by Java Runtime Environment:

 EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b1d41ab, pid=5744, tid=4584

Java VM: Java HotSpot(TM) Client VM (11.2-b01 mixed mode windows-x86)
Problematic frame:
C  [rfidhid.dll+0x141ab]

An error report file with more information is saved as:
C:\eclipse\workspace\FelmiReader\hs_err_pid5744.log

  • 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-14T06:38:15+00:00Added an answer on May 14, 2026 at 6:38 am

    At first blush, I suspect the problem is an incorrect type signature in the Inventory declaration.

    If the parameter is ByRef, that implies a pointer (in C this would be a *byte instead of a byte). JNA has a DoubleByReference class type that you probably should be using. You’ll have a similar issue with the 3rd parameter (which is really an int*, not an int as you have it coded).

    As an FYI, the native crash that you are getting should leave a dump file in the application directory. If you open that up, you should find the native call that was in place when the failure occurred – I’ll bet money that it was the lib.Inventory(tagdata[0], 1, taglen) call.

    Figuring out exactly which call is causing the crash will be key to tracking it down.

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

Sidebar

Related Questions

I have a website that per original developer was working on local environment. I
I'm working on a client's PHP website which is hosted through the original company
I'm using PHP, HTML & jQuery. Lets say this is my original working index.html
I'm working with a query that has a column named Date. The original query
I am working on a project that I was the original developer on, but
Original connectionstring whitch working on MSSQL 2000: Provider=SQLOLEDB.1; Persist Security Info=True; User ID=XXXXXXXX; Initial
Original question So the project I'm working on is deathly paranoid about file uploads.
I am working on an iPhone app improvement project. Original project was done using
I am currently building a PHP framework (original, i know) and im working on
I am working on a page with several dynamically generated tables where the original

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.