Re: Error: 8000ffff: Invalid ptr null flag when calling a DLL method
Adam Bradley <[email protected]> Mon, 16 Jan 2006 15:01:45 +1000
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <[email protected]> |
I now realise my arguments to invoke should be more along the lines of
byte[] result = tApp.invoke("GGGGIGGGG:I:G64", leos.size(), nbs, null,
ReturnFlags.CHECK_NONE);
Though I know this is 100% correct! Once again, the parameters
to this method are as follows:
> ---snip---
> INT WINAPI CreateTrustedAppObject(
> char *szDomainPath,
> char *szAppName,
> char *szAppDesc,
> char *szTCPAddress,
> WORD uwTCPPort,
> BOOL bSSLRequired,
> BOOL bRequiresQueueing,
> BOOL bMessageRetention,
> BOOL bOverwrite,
> char *szTrustedAppKey);
> ---snip---
szTrustedAppKey
(OUT) Points to the unique access key assigned to the trusted
application. Returns a 64 byte key plus null.
I have noticed discussion around using win32Invoke. When I
attempt to use this method (along the lines of how others have
described) I receive the following:
---snip---
The method win32Invoke(int, String, int, int, byte[], Object[],
ReturnFlags) in the type GenericStub is not applicable for the arguments
(int, String, int, int, byte[], null)
---snip---
Thanks again!
Adam Bradley
Adam Bradley wrote:
> Hi all,
>
> Dipping my toe into COM/DLL type things and I was trying to write a
> jawin wrapper to call a DLL function. The method I want to use is well
> documented but I keep receiving the following error!?
>
> Anyone have any ideas - thanks in advance!
> Adam
>
> ---snip---
> org.jawin.COMException: 8000ffff: Invalid ptr null flag
> at org.jawin.marshal.GenericStub.win32Invoke0(Native Method)
> at org.jawin.marshal.GenericStub.win32Invoke(GenericStub.java:152)
> at org.jawin.FuncPtr.invoke(FuncPtr.java:186)
> at org.jawin.FuncPtr.invoke(FuncPtr.java:205)
> at tApp.main(tApp.java:51)
> ---snip---
>
> The method in question is as follows
>
> ---snip---
> INT WINAPI CreateTrustedAppObject(
> char *szDomainPath,
> char *szAppName,
> char *szAppDesc,
> char *szTCPAddress,
> WORD uwTCPPort,
> BOOL bSSLRequired,
> BOOL bRequiresQueueing,
> BOOL bMessageRetention,
> BOOL bOverwrite,
> char *szTrustedAppKey);
> ---snip---
>
> And the application
>
> ---snip---
> import org.jawin.COMException;
> import org.jawin.FuncPtr;
> import org.jawin.ReturnFlags;
> import org.jawin.COMException;
> import org.jawin.FuncPtr;
> import org.jawin.ReturnFlags;
> import org.jawin.io.LittleEndianOutputStream;
> import org.jawin.io.NakedByteStream;
> import java.io.PrintStream;
> import java.io.OutputStream;
> import java.io.*;
>
> public class tApp {
> public static void main(String[] args) throws Exception {
>
> String szDomainPath = "c:/wpdomain.db"; // 4 [in] char*
> String szAppName = "newapp"; // 4 [in] 8
> String szAppDesc = "newapp description";// 4 [in] 12
> String szTCPAddress = "localhost"; // 4 [in] 16
> long uwTCPPort = 1; // 8 [in] 24
> String bSSLRequired = "FALSE"; // 4 [in] 28
> String bRequiresQueueing = "FALSE"; // 4 [in] 32
> String bMessageRetention = "FALSE"; // 4 [in] 36
> String bOverwrite = "TRUE"; // 4 [in] 40
> String szTrustedAppKey = ""; // 4 [out]44
>
> FuncPtr tApp = null;
> try {
> tApp = new FuncPtr("GWTApp.dll",CreateTrustedAppObject");
>
> // create a NakedByteStream for the serialization of Java variables
> NakedByteStream nbs = new NakedByteStream();
>
> // wrap it in a LittleEndianOutputStream
> LittleEndianOutputStream leos = new LittleEndianOutputStream(nbs);
>
> leos.writeStringUnicode(szDomainPath);
> leos.writeStringUnicode(szAppName);
> leos.writeStringUnicode(szAppDesc);
> leos.writeStringUnicode(szTCPAddress);
> leos.writeDouble(uwTCPPort);
> leos.writeStringUnicode(bSSLRequired);
> leos.writeStringUnicode(bRequiresQueueing);
> leos.writeStringUnicode(bMessageRetention);
> leos.writeStringUnicode(bOverwrite);
> leos.writeStringUnicode(szTrustedAppKey);
>
> byte[] result = tApp.invoke("IGGI:I:", 44, nbs, null,
> ReturnFlags.CHECK_NONE);
>
> } catch (COMException e) {
> System.out.println(e.getMessage().toString());
> System.out.println(e.getClass().toString());
>
> PrintWriter out = null;
> try {
> out = new PrintWriter(new FileWriter("c:\\tApp.log"));
> e.printStackTrace(out);
> } catch (IOException a) {
> System.err.println("Caught IOException: " + a.getMessage());
> } finally {
> if (out != null) {
> System.out.println("Closing PrintWriter");
> out.close();
> } else {
> System.out.println("PrintWriter not open");
> }
> }
> // handle exception
> } finally {
> if (tApp != null) {
> try {
> tApp.close();
> } catch (COMException e) {
> // handle fatal exception
> }
> }
> }
> }
> }
>
>
> HyperWeb Internet Services
> P.O. Box 451 Hamilton
> Brisbane, QLD 4007
> Mobile : +61 419 637 518
> email: [email protected]
> IM : [email protected]
> Skype : adam_j_bradley
> Web : http://www.hyperwebis.com.au <http://www.hyperwebis.com.au/>
>