c++ - 如何注册 UPnP 服务

标签 c++ windows-mobile windows-ce upnp

我有一个用于 Windows Mobile 6 ARMV4I 的 Visual Studio 2008 C++ 项目,我想在其中注册一个 UPnP 服务。

我正在使用 Windows CE 6 SDK 中的 Microsoft 示例作为 UPnP 服务的实现。 WINCE600\PUBLIC\SERVERS\SDK\SAMPLES\UPNP\DEVICE

不幸的是,RegisterRunningDevice 调用失败并出现错误 E_HANDLE。

#include "upnpdevice_i.c"
#import "upnpdevice.dll" named_guids

int main()
{
    ::CoInitializeEx( NULL, COINIT_MULTITHREADED );

    using namespace UPnPHostLib;
    IUPnPDeviceControlPtr device_ctrl( CLSID_Device );
    IUPnPRegistrarPtr registrar( CLSID_UPnPRegistrar );

    bstr_t device_descr = /* contents of the device.xml file from the sample */

    // throws a _com_error exception where hr = E_HANDLE
    bstr_t device_id = registrar->RegisterRunningDevice( device_descr, 
        device_ctrl, 
        L"foo", 
        L"/windows/upnp", 
        0 );

    /* ... */

    ::CoUninitialize();
    return 0;
}

我看到其他人在我的网络搜索中提到了这个错误,但我没有看到任何结果。

  • 我已经注册了 upnpdevice.dll
  • 我已经安装了“可选的 Windows Mobile 服务器组件”upnpctrl、upnphost 和 httpd。
  • 可执行文件、upnpdevice.dll、device.xml 和 service.xml 文件都在 /windows/upnp 目录中。

有人有什么建议吗?

最佳答案

我已经解决了。问题是 Optional Windows Mobile Server Components没有签名。当 device.exe 试图在启动时将它们加载为流驱动程序时,它们被拒绝了。

-保罗

关于c++ - 如何注册 UPnP 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11528916/

相关文章:

c++ - 返回 `std::string_view` 不包括第一个字符

c# - 发送带有送达信息的短信

c# - 如何将字符串转换为控件?

c++ - WinCE 6.0 操作系统启动后如何移动鼠标指针

windows-phone-7 - 如何在 Windows Phone 7 的后退导航中跳过一个页面

c++ - 如何在 CDC 上显示位图图像

c++ - 如何使用 C++ 在运行时获取内存使用情况?

c++ - 如何计算方位角

c++ - 在 QTCreator .pro 文件中使用 QMAKE 链接标志顺序

c - 如何使用 C 为 Windows Mobile 开发应用程序?