Jump to content
Excelsior Forums

Farid

Members
  • Content count

    0
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About Farid

  • Rank
    Newbie
  • Birthday 01/01/01
  1. Hello, I'm trying to let work the following function as declared in C : HRESULT APIENTRY MQCreateQueue( ? ? IN PSECURITY_DESCRIPTOR pSecurityDescriptor, ? ? IN OUT MQQUEUEPROPS* pQueueProps, ? ? OUT LPWSTR lpwcsFormatName, ? ? IN OUT LPDWORD lpdwFormatNameLength ? ? ); I declared this as following in Xfunction : public int MQCreateQueue() { ? ? ? final int NUMBEROFPROPERTIES = 2; ? ? ? int[] aPropID = new int[NUMBEROFPROPERTIES]; ? ? ? MQPROPVARIANT[] aPropVar = new MQPROPVARIANT[NUMBEROFPROPERTIES]; ? ? ? int[] aStatus = new int[NUMBEROFPROPERTIES]; ? ? ? ? try { ? ? ? ? ? ? xFunction MQCreateQueue = new xFunction("mqrt", "int MQCreateQueue(traffic_simulator.SECURITY_DESCRIPTOR*, traffic_simulator.MQQUEUEPROPS*, UNICODESTRING*, int )"); ? ? ? ? ? QueueProps = new MQQUEUEPROPS(); ? ? ? ? ? for(int i = 0; i < NUMBEROFPROPERTIES; i++) { ? ? ? ? ? ? ? aPropVar[i] = new MQPROPVARIANT(); ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? String str = ".\\Private$\\myPrivateQueue"; ? ? ? ? ? ? char[] dir = new char[124]; ? ? ? ? ? ? dir = str.toCharArray(); ? ? ? ? ? ? Pointer queue_dir = (Pointer)Argument.create("char*", dir); ? ? ? ? ? ? ? ? ? ? ? ? str = "Test Queue Label"; ? ? ? ? ? ? char[] label = new char[124]; ? ? ? ? ? ? label = str.toCharArray(); ? ? ? ? ? ? Pointer queue_label = (Pointer)Argument.create("char*", label); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? aPropID[0] = 103; ? ? ? ? ? ? aPropVar[0].vt = 31; ? ? ? ? ? ? aPropVar[0].union.pwszVal = queue_dir ; ? ? ? ? ? ? aPropID[1] = 108; ? ? ? ? ? ? aPropVar[1].vt = 31; ? ? ? ? ? ? aPropVar[1].union.pwszVal = queue_label; ? ? ? ? ? //Initialize MQQUEUEPROPS structure ? ? ? ? ? ? QueueProps.cProp = NUMBEROFPROPERTIES; ? ? ? ? ? ? QueueProps.aPropID = (Pointer)Argument.create("int*",aPropID); ? ? ? ? ? ? QueueProps.aPropVar = (Pointer)Argument.create("traffic_simulator.MQPROPVARIANT*", aPropVar); ? ? ? ? ?//Set argument values ? ? ? ? ? Pointer arg1 = Pointer.create("traffic_simulator.SECURITY_DESCRIPTOR*"); ? ? ? ? ? arg1 = Pointer.NULL; ? ? ? ? ? Pointer arg2 = Pointer.createPointerTo(QueueProps); ? ? ? ? ? Pointer arg3 = Pointer.create("UNICODESTRING*"); ? ? ? ? ? arg3 = Pointer.NULL; ? ? ? ? ? Argument arg4 = new Argument(0); ? ? ? ? ? hQueue = ((Integer) MQCreateQueue.invoke(arg1, arg2, arg3, arg4)).intValue(); Only arg2 can't be NULL. This is a pointer to a MQQUEUEPROPS structure which also contains a pointer to MQPROPVARIANT structure array. MQPROPVARIANT i defined as followed: class MQPROPVARIANT extends Structure { ? ? int vt; ? ? short wReserved1; ? ? short wReserved2; ? ? short wReserved3; ? ? Union union; ? ? public String defineLayout() ? ? ? ? { ? ? ? ? ? ? return "int vt, short wReserved1, short wReserved2, short wReserved3, traffic_simulator.Union union"; ? ? ? ? } ? ? public MQPROPVARIANT() { ? ? ? ? union = new Union(); ? ? } } I don't if the Union could be declared inside the MQPROPVARIANT structure but it didn't work for me. The Union structure : public String defineLayout() ? ? ? ?{ ? ? ? ? ? ?return "char bVal, short iVal, short uiVal, short boolVal, int lVal,"+ ? ? ? ? ? ? ? ? ? ?"int ulVal, traffic_simulator.ULARGE_INTEGER uhVal, long scode, double date,"+ ? ? ? ? ? ? ? ? ? ?"traffic_simulator.CLSID* puuid, traffic_simulator.BLOB blob, UNICODESTRING* bstrVal, CSTRING pszVal,"+ ? ? ? ? ? ? ? ? ? ?"UNICODESTRING* pwszVal, traffic_simulator.CAUB caub, traffic_simulator.CAI cai, traffic_simulator.CABOOL cabool, traffic_simulator.CAL cal,"+ ? ? ? ? ? ? ? ? ? ?"traffic_simulator.CAUL caul, traffic_simulator.CACLSID cauuid, traffic_simulator.CABSTR cabstr, traffic_simulator.CALPWSTR calpwstr, traffic_simulator.CAPROPVARIANT capropvar"; ? ? ? ?} ? ? ? ?Union() { ? ? ? ? ? ? ? ? ? ? ?try{ ? ? ? ? ? ? ?uhVal = new ULARGE_INTEGER(); ? ? ? ? ? ? ?blob = new BLOB(); ? ? ? ? ? ? ?caub = new CAUB(); ? ? ? ? ? ? ?cai = new CAI(); ? ? ? ? ? ? ?caui = new CAUI(); ? ? ? ? ? ? ?cabool = new CABOOL(); ? ? ? ? ? ? ?cal = new CAL(); ? ? ? ? ? ? ?caul = new CAUL(); ? ? ? ? ? ? ?cauuid = new CACLSID(); ? ? ? ? ? ? ?cabstr = new CABSTR(); ? ? ? ? ? ? ?calpwstr = new CALPWSTR(); ? ? ? ? ? ? ?//capropvar = new CAPROPVARIANT();? ?//<-- getting error when this turned on ? ? ? ? ? ? ? ? ? ? ? ? ?puuid = Pointer.create("traffic_simulator.CLSID*"); ? ? ? ? ? ? ?bstrVal = Pointer.create("UNICODESTRING*"); ? ? ? ? ? ? ?pwszVal = Pointer.create("UNICODESTRING*"); When CAPROPVARIANT instantiated I get this error : com.excelsior.xFunction.IllegalSignatureException: Structure subclass 'traffic_simulator.MQQUEUEPROPS' must have constructor without arguments CAPROPVARIANT structure in C : typedef struct tagCAPROPVARIANT { ? ? ? ? ULONG cElems; ? ? ? ? LPPROPVARIANT pElems; }CAPROPVARIANT; I assume the LPPROPVARIANT is a pointer to another MQPROPVARIANT structure isn't it? I also get constantly the return value : -1072824314 (invalid parameter) if CAPROPVARIANT not instantiated. Could somebody please help me... what am I doing wrong ? Thanks in advance. Farid
  2. Array Excpected

    Hello I'm trying to make an UNICODESTRING* this way: String str =".\\Private$\\myPrivateQueue"; Pointer queue_dir = (Pointer)Argument.create("UNICODESTRING*", str); but I get an error message : Types Different: com.excelsior.xFunction.TypesDifferentException: Array expected what could be the problem ? Thank you, Farid
×