From: sisimma on
Hi, Arsalan.
I need your help.
I'm developing UPnP device on windows mobile.
As you removed CoInitializeSecurity() in PocketPC, I did.
then I've got stuck in " hr =
pReg->RegisterRunningDevice(desDoc,punk,initBSTR,resourcePathBSTR,lifeTime,&DeviceID);
" returning "E_HANDLE"

Can you help me how to get through this problem?
If you need more detail information about this question, refer this link
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2688959&SiteID=1

thank you.
"Arsalan" wrote:

> Thanks John. It worked out. There is no need to call CoInitializeSecurity()
> on Win CE unlike desktop environment where it is a must.
>
> "John Spaith [MS]" wrote:
>
> > Nothing in UPNP itself requires th CoInitializeSecurity() call to happen (or
> > else it wouldn't work on CE!). I think the root problem here is that
> > whatever is generating your code (MFC?) is sprinkling in these DCOM only API
> > calls.
> >
> > To fix this you can
> > 1) Check out MFC docs and understand why it's doing this and how to make it
> > stop. Since some flavors of WinCE do support DCOM, it's possible that your
> > build environment is confused somehow and generating code for a DCOM winCE.
> > 2) Hand-edit the code MFC is generating, if you can get at it.
> > 3) Don't use MFC at all for UPNP related calls.
> >
> > The WinCE documentation on MSDN (it may be in only general embedded section,
> > not Windows Mobile SDK -- I don't know) should contain samples of using
> > UPNP.
> >
> > --
> > John Spaith
> > Development Lead, Windows CE
> > Microsoft Corporation
> >
> > Check out the CE Networking Team Blog at http://blogs.msdn.com/cenet/.
> >
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > You assume all risk for your use. © 2006 Microsoft Corporation. All rights
> > reserved.
> >
> > "Arsalan" <Arsalan(a)discussions.microsoft.com> wrote in message
> > news:D6EC60C4-5A98-40C8-8656-8F397A0093F5(a)microsoft.com...
> > >I have written a UPnP device as an ATL COM Component (dll) in C++. In order
> > > to register it with the Device Host, I have written another MFC
> > > Application
> > > that simply initializes COM Library (using CoInitializeEx()), creates
> > > security context (using CoInitializeSecurity()) and then registers the
> > > device
> > > with the UPnP Host (using IUPnPRegistrar interface). This works perfectly
> > > on
> > > a desktop environment but not on pocket pc (Windows Mobile 5.0 Pocket PC)
> > > which does not support DCOM. Hence CoInitializeSecurity() does not work
> > > and
> > > other alternate APIs like CoCreateInstanceEx() also do not work as all of
> > > them are DCOM Only APIs. Is there any solution to this problem? How can my
> > > application register the dll with the UPnP Host without using DCOM APIs?
> > > Any
> > > alternate way? I shall appreciate any clue or idea from anyone. Thanks.
> >
> >
> >