【问题标题】:Getting nca_proto_error/DCERPC_FAULT_PROTO_ERROR when using JCIFS to communicate with a remote Windows Instance使用 JCIFS 与远程 Windows 实例通信时获取 nca_proto_error/DCERPC_FAULT_PROTO_ERROR
【发布时间】:2012-02-02 06:44:25
【问题描述】:

我目前正在尝试做一些类似于 PSExec 但完全使用 Java 的事情。 我认为我的问题与我实际上在做什么没有直接关系,而是如何。 目前我正在尝试远程实现服务的创建和启动。

为此,我使用了 midlc 工具(版本 0.6.1)并使用 CreateService 和 DeleteService 调用扩展了 svcctl.idl。之后,我使用 midlc 生成用于 jcifs ( -t jcifs ) 的代码。然后我创建了一个测试程序来使用该类和 jcifs 与远程 Windows 机器进行通信。

代码如下:

        rpc.policy_handle scHandle = new rpc.policy_handle();
        SvcCtl.OpenSCManager openSCManagerRpc = new SvcCtl.OpenSCManager(host, null, 0x0001 | 0x0002, scHandle);

        // Connection-oriented DCE/RPC over SMB named pipes.
        DcerpcHandle handle = DcerpcHandle.getHandle("ncacn_np:" + host + "[\\PIPE\\svcctl]",
                ConcurrentNtlmAuthenticator.getInstance().getNtlmPasswordAuthentication());
        try {
            handle.sendrecv(openSCManagerRpc);
            if (openSCManagerRpc.retval != 0) {
                throw new SmbException(openSCManagerRpc.retval, true);
            }
        } catch(Exception e) {
            e.printStackTrace();
        } finally {
            try {
                handle.close();
            } catch(IOException ioe) {
                ioe.printStackTrace();
            }
        }

不幸的是,我收到了 DCERPC_FAULT_PROTO_ERROR 别名 nca_proto_error alias 0x1c01000b

所以我的简单问题是......我做错了什么?

克里斯

【问题讨论】:

    标签: java rpc psexec jcifs


    【解决方案1】:

    好的,

    我解决了这个问题。问题是,请求类型未初始化,因此设置为 -1,这不是一个有效值。通过手动设置,我能够实际执行我尝试执行的任务:

    https://dev.c-ware.de/confluence/pages/viewpage.action?pageId=15007754

    克里斯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 2015-10-05
      • 1970-01-01
      • 2019-10-05
      相关资源
      最近更新 更多