org.jawin.COMException: 8000ffff: Invalid ptr null flag(原址:http://osdir.com/ml/windows.devel.jawin/2006-01/msg00013.html)
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 } } } } }