trafaluk - 2010-07-08

Hello everyone,

I'm trying to write a pice of code to use a DLL function like this:

- Funcion name: Occ_Init
- Parameters: 3
  name:mode         name: list1            name: list2
  I/O: In                     I/O: Out                   I/O: Out
  attribute: Int          attribute: String     attribute: String
  to set mode          to store list            to store list
- Return value: Int

I've written some like this:

                     

  String modellist = "modellist";
                        String conlist="conlist";
                        FuncPtr  ListarDispositivos = new FuncPtr(ruta,"Occ_Init");
                        NakedByteStream nbs = new NakedByteStream();
            LittleEndianOutputStream leos = new LittleEndianOutputStream(nbs);
            leos.writeInt(0);
            leos.writeStringUnicode(modellist);
            leos.writeStringUnicode(conlist);

            byte[] Listar_result = ListarDispositivos.invoke("I:I:GG", 12, nbs, null, ReturnFlags.CHECK_HRESULT);

            LittleEndianInputStream leis = new LittleEndianInputStream(new ByteArrayInputStream(Listar_result));

            System.out.println(leis.readInt());
            System.out.println(leis.readStringUnicode());
            System.out.println(leis.readStringUnicode());

and the result is:

0
null
null

I need to get the content of both strings. I guess it has something to do with the instructions string.

Thanks,