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---

  1. import org.jawin.COMException;
  2. import org.jawin.FuncPtr;
  3. import org.jawin.ReturnFlags;
  4. import org.jawin.COMException;
  5. import org.jawin.FuncPtr;
  6. import org.jawin.ReturnFlags;
  7. import org.jawin.io.LittleEndianOutputStream;
  8. import org.jawin.io.NakedByteStream;
  9. import java.io.PrintStream;
  10. import java.io.OutputStream;
  11. import java.io.*;
  12.  
  13. public class tApp {
  14.  
  15. public static void main(String[] args) throws Exception {
  16.  
  17. String szDomainPath = "c:/wpdomain.db"; // 4 [in] char*
  18. String szAppName = "newapp"; // 4 [in] 8
  19. String szAppDesc = "newapp description";// 4 [in] 12
  20. String szTCPAddress = "localhost"; // 4 [in] 16
  21. long uwTCPPort = 1; // 8 [in] 24
  22. String bSSLRequired = "FALSE"; // 4 [in] 28
  23. String bRequiresQueueing = "FALSE"; // 4 [in] 32
  24. String bMessageRetention = "FALSE"; // 4 [in] 36
  25. String bOverwrite = "TRUE"; // 4 [in] 40
  26. String szTrustedAppKey = ""; // 4 [out]44
  27.  
  28. FuncPtr tApp = null;
  29. try {
  30. tApp = new FuncPtr("GWTApp.dll",CreateTrustedAppObject");
  31.  
  32. // create a NakedByteStream for the serialization of Java variables
  33. NakedByteStream nbs = new NakedByteStream();
  34.  
  35. // wrap it in a LittleEndianOutputStream
  36. LittleEndianOutputStream leos = new LittleEndianOutputStream(nbs);
  37.  
  38. leos.writeStringUnicode(szDomainPath);
  39. leos.writeStringUnicode(szAppName);
  40. leos.writeStringUnicode(szAppDesc);
  41. leos.writeStringUnicode(szTCPAddress);
  42. leos.writeDouble(uwTCPPort);
  43. leos.writeStringUnicode(bSSLRequired);
  44. leos.writeStringUnicode(bRequiresQueueing);
  45. leos.writeStringUnicode(bMessageRetention);
  46. leos.writeStringUnicode(bOverwrite);
  47. leos.writeStringUnicode(szTrustedAppKey);
  48.  
  49. byte[] result = tApp.invoke("IGGI:I:", 44, nbs, null,
  50. ReturnFlags.CHECK_NONE);
  51.  
  52. } catch (COMException e) {
  53. System.out.println(e.getMessage().toString());
  54. System.out.println(e.getClass().toString());
  55.  
  56. PrintWriter out = null;
  57. try {
  58. out = new PrintWriter(new FileWriter("c:\\tApp.log"));
  59. e.printStackTrace(out);
  60. } catch (IOException a) {
  61. System.err.println("Caught IOException: " + a.getMessage());
  62. } finally {
  63. if (out != null) {
  64. System.out.println("Closing PrintWriter");
  65. out.close();
  66. } else {
  67. System.out.println("PrintWriter not open");
  68. }
  69. }
  70. // handle exception
  71. } finally {
  72. if (tApp != null) {
  73. try {
  74. tApp.close();
  75. } catch (COMException e) {
  76. // handle fatal exception
  77. }
  78. }
  79. }
  80. }
  81. }

org.jawin.COMException: 8000ffff: Invalid ptr null flag(原址:http://osdir.com/ml/windows.devel.jawin/2006-01/msg00013.html)的更多相关文章

  1. VS2008,System.Runtime.InteropServices.COMException (0x800401F3): Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))

    在VS2008环境中编译调试运行不报错,但在发布的exe文件运行就报错 System.Runtime.InteropServices.COMException (0x800401F3): Invali ...

  2. 【转】java jawin api 中文 invoke方法

    org.jawin Class FuncPtr java.lang.Object org.jawin.FuncPtr ----------------------------------------- ...

  3. C语言扩展动态内存报错:realloc(): invalid next size: 0x0000000002365010 ***

    晚上被这个内存扩展崩溃的问题折腾的有点崩溃,当答案揭晓的那一刻,恍然大悟,原来如此简单. 练习题目:输入一个字符串,根据字母进行排序,说白了就是一个简单的冒泡 #include <stdio.h ...

  4. NULL指针 Void* 和野指针

    在C和C++的语言中常常有这几个概念: NULL指针.空指针.Void *指针.野指针(Wild Pointer)甚至垂悬指针(Dangling Pointer). 1.NULL指针,一般用于指向一个 ...

  5. Null指针

    C++ Null 指针 C++ 指针 C++ 指针 在变量声明的时候,如果没有确切的地址可以赋值,为指针变量赋一个 NULL 值是一个良好的编程习惯.赋为 NULL 值的指针被称为空指针. NULL ...

  6. linq查询数值为null的问题以及数据表的关联计算问题

    说明:下面实例都是我进行项目开发时的真实部分代码,毫无保留 一.数据表的关联计算 //把当前年度的分差计算出来,建立两个关联的数据表 try { using(TransactionScope scop ...

  7. 关于空指针NULL、野指针、通用指针 (转)

    reference:https://www.cnblogs.com/losesea/archive/2012/11/16/2772590.html 首先说一下什么是指针,只要明白了指针的含义,你就明白 ...

  8. A pointer is a variable whose value is the address of another variable 指针 null pointer 空指针 内存地址0 空指针检验

    小结: 1.指针的实际值为代表内存地址的16进制数: 2.不同指针的区别是他们指向的变量.常量的类型: https://www.tutorialspoint.com/cprogramming/c_po ...

  9. Java判断对象是否为NULL

    Java使用反射判断对象是否为NULL 判断Java对象是否为null可以有两层含义: 第一层:  直接使用 object == null 去判断,对象为null的时候返回true,不为null的时候 ...

随机推荐

  1. C语言常用的库文件(头文件、函数库)

    C语言常用的库文件(头文件.函数库) C系统提供了丰富的系统文件,称为库文件.C的库文件分为两类,一类是扩展名为".h"的文件,称为头文件,在前面的包含命令中我们已多次使用过.在& ...

  2. Python面向对象关系

    首先了解一下Python面向对象中类型-实例和父类-子类的关系.下面的一些规则很有用. 当我们介绍许多不同的对象时,我们只用了两种关系(图4.1 关系): 是一类(is a kind of)(实线): ...

  3. OpenGL鼠标旋转图像

    (鼠标旋转功能) #include <iostream> using namespace std; #include<gl/glut.h> GLfloat transx,tra ...

  4. querySelectorAll 方法相比 getElementsBy 系列方法有什么区别

    感谢 http://www.zhihu.com/question/24702250 简生 的回答 1. W3C 标准 querySelectorAll 属于 W3C 中的 Selectors API ...

  5. 对discuz的代码分析学习(四)论坛入口文件

    只是大致分析下执行流程,主要就是取得mod参数的值,根据取值加载控制器,控制器位置在最后一行指定了. 1 )定义应用名称,加载两个必要文件 define('APPTYPEID', 2); define ...

  6. Asp.net MVC1 学习1

    此次博客的编写纯属是为了记录自己的学习情况 asp.net mvc学习教程来自于重点,地址:http://v.youku.com/v_show/id_XNDQ4MDQ1MzI=.html?f=2416 ...

  7. [Node.js]expressjs简单测试连接mysql

    下载好node.js和通过npm安装好express.js后,先写package.json { "name": "application-name", &quo ...

  8. [转]JavaScript ES6 class指南

    [转]JavaScript ES6 class指南 前言 EcmaScript 2015 (又称ES6)通过一些新的关键字,使类成为了JS中一个新的一等公民.但是目前为止,这些关于类的新关键字仅仅是建 ...

  9. Delphi下获取IE的UserAgent的方法

    方法一:使用SHDocVw, MSHtml单元提供的一些方法利用浏览器的特性来获取. uses SHDocVw, MSHtml; function GetUserAgent: string;var   ...

  10. Delphi多线程数据库查询(ADO)

    ADO多线程数据库查询通常会出现3个问题: 1.CoInitialize 没有调用(CoInitialize was not called):所以,在使用任何dbGo对象前,必须手 调用CoIniti ...