JNA C DLL Debug Howto?

I have a dll that accepts encoded string input and decodes it. The DLL was created on a 64-bit version of Win7 using Codeblocks and mingw64. Only C-code works fine, but when I run it through JNA in a while loop with the same line, it decodes correctly for about 70% of the calls, and the wrong one for the rest. I want to debug the situation, but I'm not sure how to do it after the Java code passes control to JNA. Alternatively, any ideas on where to look will also be helpful.

The method signature in C and JNA is as follows:

Java: int Decrypt_Blk(byte[] expkey, byte[] in, int size, byte[] out);  
C: __declspec (dllexport) int Decrypt_Blk (unsigned char *expkey, unsigned char *in, unsigned int insize, unsigned char *out);

the correctness is determined by the output, for example, if I take the string "helloworld" to encrypt it (I will not enter the encryption data because they are irrelevant), and then pass the encrypted output to this DLL method, 7 out 10 times I get "HelloWorld" 3 more times I get the wrong and different characters. And for all 10 times, I'm in the same thread, using the same variable, in the same loop. The 3 incorrect appearances are also random, the only thing I can notice is that the first start is ALWAYS fixed as many times as I tested, but the wrong run happens on any of 1-10 starts.

+5
source share
1 answer

Microsoft Visual ++ Project Project DLL Debug. Java.exe. Java. C . !

+4

All Articles