NATUPnP IStaticPortMappingCollection::Add returns HRESULT 0x80040214
Posted
by dauphic
on Stack Overflow
See other posts from Stack Overflow
or by dauphic
Published on 2010-06-11T18:07:09Z
Indexed on
2010/06/11
18:13 UTC
Read the original article
Hit count: 1025
I'm attempting to use Microsoft's NATUPnP library to create a port mapping.
Unfortunately, I'm unable to. My router supports UPnP, it is enabled, and I can create mappings with other (pre-built) applications. I can also read existing mappings.
When I call the Add function, it fails and returns HRESULT 0x80040214 (which is undocumented). I have absolutely no idea what might be going on.
IStaticPortMapping* newMapping = NULL;
hr = portMappings->Add(27015, L"TCP", 27015, L"MYCOMPUTER", VARIANT_TRUE,
L"TestMapping", &newMapping);
You can see the reference for this function at http://msdn.microsoft.com/en-us/library/aa366148%28v=VS.85%29.aspx.
The portMappings object is, of course, valid; I use it earlier in the code to enumerate over the existing mappings.
If anyone has experience with this and might know what my problem is, I'd appreciate any help.
© Stack Overflow or respective owner