passed end of stream in the marshalling layer?
Cai Qiang <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
this is the c++ struct and function:
typedef struct tagMESSAGE
{
char strFlag[8];
WORD wType;
bool fBoolean[8];
BYTE fByte[8];
WORD fWord[8];
DWORD fDword[8];
char fString[80];
}TMessage;
HTC_CLIENT_API LONG __stdcall Htc_Client_SendTMessage(HANDLE
hClient,TMessage tMsg);
// hClient and TMsg are [in] params.
My core Java code is :
------------------------Java code ---------------------------------
FuncPtr ht=null;
ht=new FuncPtr("HtcClient.dll", "Htc_Client_SendTMessage");
NakedByteStream nbs=new NakedByteStream();
LittleEndianOutputStream leos=new LittleEndianOutputStream(nbs);
leos.writeInt(1);
leos.writeBytes("010101");
leos.writeZeroBytes(2);
leos.writeShort(10009);
leos.writeBytes("111110");
leos.writeZeroBytes(2);
leos.writeBytes("232424");
leos.writeZeroBytes(2);
short[] value={12,3,4,3,4};
for (int i=0;i<value.length;i++)
{
leos.writeShort(value[i]);
}
leos.writeZeroBytes((8-value.length)*2);
int[] ivalue={132,33,24,33,42};
for (int i=0;i<ivalue.length;i++)
{
leos.writeInt(ivalue[i]);
}
leos.writeZeroBytes((8-ivalue.length)*4);
String test="test string ";
leos.writeBytes(test);
leos.writeZeroBytes(80-test.length()) ;
byte[] result=
ht.invoke("IP8SP8P8P16P32P80",32,nbs,null,ReturnFlags.CHECK_NONE);
LittleEndianInputStream leis=new LittleEndianInputStream(new
ByteArrayInputStream(result));
int ret=leis.readInt();
ht.close();
-----------------------------error-----------------------------------
where compile ,it returns the following errors:
org.jawin.COMException: 8000ffff: passed end of stream in the marshalling
layer
org.jawin.marshal.GenericStub.win32Invoke0(Native Method)
org.jawin.marshal.GenericStub.win32Invoke(GenericStub.java:152)
org.jawin.FuncPtr.invoke(FuncPtr.java:186)
org.jawin.FuncPtr.invoke(FuncPtr.java:205)
org.apache.jsp.test.testdll_jsp._jspService(testdll_jsp.java:132)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter
(ReplyHeaderFilter.java:75)
-----------------------------------------------------------------------
I think my instruction is right,who knows why and how to correct it?
Thanks in advance for the help.