我有一个适用于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移动服务器组件"upnpctrl、upnphost和httpd
- 可执行文件、upnpdevice.dll、device.xml和service.xml都在
/windows/upnp
目录中
有人有什么建议吗?
我已经解决了。问题是可选的Windows Mobile Server组件没有签名。当device.exe试图在启动时将它们作为流驱动程序加载时,它们被拒绝了。
-PaulH