【问题标题】:Running a dll using rundll32.exe as a windows service使用 rundll32.exe 作为 Windows 服务运行 dll
【发布时间】:2012-08-23 04:31:34
【问题描述】:

我能够使用 rundll32.exe 运行 dll。

现在我想将它作为 Windows 服务运行,但它似乎没有启动并超时。

我不确定如何传递参数。

尝试类似..

sc.exe 创建服务 binPath="c:\windows\system32\rundll32.exe -test.dll -Main"

尝试来自的建议 creating a service with sc.exe; how to pass in context parameters 但它似乎不起作用。

有什么建议吗?

谢谢,

卡提克

【问题讨论】:

  • 什么不起作用?您是否检查了服务控制小程序并查看了service 的命令行?

标签: windows winapi dll windows-services rundll32


【解决方案1】:

rundll32.exe 不能充当服务!你需要像 srvany.exe 这样的助手(来自旧的资源工具包)。

【讨论】:

  • 嗯,我似乎在 Windows 7 中没有 srvany.exe 并且 sc.exe 无法将 dll 作为服务运行..
  • 正如我所说,srvany 是旧 Windows 资源工具包的一部分。
  • 作为记录,原则上没有什么可以阻止服务作为 DLL 实现并通过 rundll32 启动。我相信你认为这不是 OP 想要做的事情是正确的。
  • @Harry Johnston,很抱歉让您失望了,但是“服务”比简单的 profram 要复杂得多。例如,服务必须在启动时调用StartServiceCtrlDispatcher。
  • @Maximus: 你认为 DLL 不能调用 StartServiceCtrlDispatcher?写过几个服务,对技术比较熟悉。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-02-24
  • 2012-08-23
  • 1970-01-01
  • 1970-01-01
  • 2016-01-29
  • 2011-06-09
  • 1970-01-01
相关资源
最近更新 更多