Re: Invoke with an string array as out parameter

Eric Baelen <[email protected]> Thu, 6 Oct 2005 18:04:47 +0200
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <002d01c5ca8f$ac848ff0$1a01070a@nberic>
It seems very unstable. After several calls, I receive access violation
from JAWIN.

Can someone confirm what Christophe says is correct or not?

Tx
Eric

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Eric Baelen
Sent: Thursday, October 06, 2005 12:47 PM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

Tx Christophe. It works.

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Christophe Warland
(FRSGlobal)
Sent: Thursday, October 06, 2005 11:56 AM
To: [email protected]
Subject: Re: [JAWIN] Invoke with an string array as out parameter

With the risk of displaying my complete ignorance of the subject, may I
suggest that you try with an array of byte arrays? i.e. :

outValueRef = new Variant.ByrefHolder(new byte[0][]);

-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Eric Baelen
Sent: Thursday, October 06, 2005 11:26 AM
To: [email protected]
Subject: Invoke with an string array as out parameter

Hi,

I try to invoke a method with one of the out parameter who is an array
of String:

uint32 EnumKey([IN] uint32 hDefKey = 2147483650, [IN] string
sSubKeyName, [out] string sNames[]);

The code is

       Variant.ByrefHolder outValueRef = new Variant.ByrefHolder(new
String());
       Object[] objs = new Object[3];
       objs[0] = new Integer(0x80000002);
       objs[1] =
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
       objs[2] = outValueRef;

        result = (Integer) lSWbemObjectRegProv.invokeN("EnumKey", objs);

I've tried everything of the outValueRef:

       Variant.ByrefHolder outValueRef = new Variant.ByrefHolder(new
String[]{""});
       Variant.ByrefHolder outValueRef = new Variant.ByrefHolder(new
String[1000]);
       .

Basically I receive memory lock or access violation when the invoke is
called.

What is the correct syntax for string array of an out parameter?

Thank you for your help,
Best regards
Eric