NATUPnP IStaticPortMappingCollection::Add returns HRESULT 0x80040214
- by dauphic
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.