char* 型をチェックするにはどうすればよいですか? (入力機能をチェックし、500 文字を超えるテキストまたはテキストを含むメモリ上のポインターを含む)
my_dll.dll があります。説明 dll
int my_function(char* param1, struct answer* ans);
#pragma pack(1)
struct answer{
int TType; //IN
unsigned long Amount; //IN
char Rcode [2+1]; //OUT
char AMessage[16 ]; //OUT
int CType; //OUT
char* Check; //OUT
};
Javaにはコードがあります:
public interface My_Dll extends Library {
public static class answer extends Structure {
public static class ByReference extends answer
implements Structure.ByReference {}
public int TType = 0;
public int Amount = 0;
public byte Rcode[] = new byte[3]; //OUT:
public byte AMessage[] = new byte[16]; //OUT:
public int CType = 0; //OUT:
public ??? Check; //OUT:
protected List getFieldOrder() {
return Arrays.asList(new String[] {"TType", "Amount",
"Rcode","AMessage", "CType","Check"});
}
}
public int my_function(byte track2[], answer.ByReference ans);
}
public static void Start() {
My_Dll test_dll = (My_Dll) Native.loadLibrary("my_dll", My_Dll.class);
My_Dll.answer.ByReference aa = new My_Dll.answer.ByReference();
// In
aa.Amount = 100;
aa.TType =3;
int result = test_dll.my_function(null,aa);
// OUT
System.out.println("Result: " + result);
System.out.println("Rcode: " + new String(aa.Rcode));
System.out.println("Amessage: " + new String(aa.AMessage));
}