pokenav / dotnetportmapper Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/dotnetportmapper
Automatically exported from code.google.com/p/dotnetportmapper
What version of the product are you using? On what operating system?
Vista pro edition - AMD Turion64
The problem:
In: TCUPnPPortMapper.cs Procedure: RefreshExternalIPThread()
The call of "MiniUPnP.UPNP_GetIGDFromUrl(url, ref urls, ref igddata,
lanAddr, lanAddr.Length)" corrupt the program memory.
The each time you use "urls" you have an access violation.
Why: If you watch in miniupnpc.c GetIGDFromUrl call GetUPNPUrls witch make
malloc on urls. C# seem to not like that.
Probably "urls" is not well declared but i can't find the good way to make
it run.
Be aware that a malloc is done so after use you must call FreeUPNPUrls
(struct UPNPUrls * urls) in the dll!!!
Solution I've tested its works (no more accessviolation....)
-> In Class MiniUPnP (MiniUPnP.cs) i've created:
[StructLayout(LayoutKind.Sequential)]
public unsafe struct UPNPUrls_2
{
public char *controlURL;
public char *ipcondescURL;
public char* controlURL_CIF;
}
and
[DllImport("miniupnp.dll", CallingConvention = CallingConvention.Cdecl)]
public unsafe static extern void FreeUPNPUrls([In] UPNPUrls_2*
urls);
and add a new declaration of
[DllImport("miniupnp.dll", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern int UPNP_GetIGDFromUrl
([In] String rootDescUrl,
[In] UPNPUrls_2 *urls,
[In, Out] ref IGDdatas datas,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] byte[]
lanAddr,
[In] int lanAddrLength);
-> In TCUPnPPortMapper.cs:
Relace the call of MiniUPnP.UPNP_GetIGDFromUrl by
try
{
//r = MiniUPnP.UPNP_GetIGDFromUrl(url, ref urls, ref igddata, lanAddr,
lanAddr.Length);
MiniUPnP.UPNPUrls_2 urls_2 = new MiniUPnP.UPNPUrls_2();
unsafe
{
r = MiniUPnP.UPNP_GetIGDFromUrl(url, &urls_2, ref igddata,
lanAddr,
lanAddr.Length);
MiniUPnP.FreeUPNPUrls(&urls_2);
}
// Renseigne urls
GetUPNPUrls(url); // On se subsitue a miniUpnp pour renseigner
urls
}
Then create GetUPNPUrls (wich replace what it made in dll)
private void GetUPNPUrls(String url)
{
// Copie de l'URL de Base
if (igddata.urlbase != string.Empty)
urls.ipcondescURL = igddata.urlbase;
else
urls.ipcondescURL = url;
// On enleve tout apres l'URL de base
int index_fin_url = urls.ipcondescURL.IndexOf('/', 7); // 7 =
http://
if (index_fin_url >= 0)
urls.ipcondescURL = urls.ipcondescURL.Substring(0,
index_fin_url);
urls.controlURL = urls.ipcondescURL + igddata.controlurl;
urls.controlURL_CIF = urls.ipcondescURL +
igddata.controlurl_CIF;
urls.ipcondescURL += igddata.scpdurl;
}
---------------------------------------------------
This solution is not very nice but it works.
I think the best way of correct the bug is to redeclare UPNPUrls but i
can't find how to do that.
An other way is to modify the miniupnp.dll (remove the malloc) and create
the function GetUPNPUrls int the c# code
Let me know if you find something better !!!!!
Original issue reported on code.google.com by [email protected]
on 23 Jan 2009 at 10:58
What steps will reproduce the problem?
1. Run Port Map 1.0, possibly with VirtualBox installed.
2. Create a Port Mapping (e.g. external: 3000, internal 22)
What is the expected output? What do you see instead?
The IP address it's accessing makes it look like it's connecting to the correct
device, 192.168.2.1, my router, and when it finds the device, the device name
it shows is the same as my router, as it should be. But, it shows the internal
IP address is 192.168.56.1, instead of 192.168.2.3 which is what my IP address
actually is. 192.168.56.1 is the IP address my VM service (VirtualBox) assigns
me. When I create port mappings, the status icon is always red.
What version of the product are you using? On what operating system?
Port Map 1.0
Please provide any additional information below.
UPnP is enabled on my router.
If I block access to 192.168.2.1 (my router) with my firewall, Port Map shows
"No Port Mapping Protocol Found"; otherwise, it seems to work fine except the
internal IP address is wrong, and all mappings have a status of red.
Original issue reported on code.google.com by [email protected]
on 11 Dec 2010 at 5:51
What steps will reproduce the problem?
1. Try to run port mapper executable from "Port Map 1.0.zip" on 64-bit
Windows
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Latest version from svn, revision 20
Please provide any additional information below.
I tried to compile the program myself in x86 mode, but every time I try to
run the program I am getting this error:
Unable to load DLL 'natpmp.dll': Invalid access to memory location.
(Exception from HRESULT: 0x800703E6)
Original issue reported on code.google.com by [email protected]
on 22 Dec 2008 at 1:19
I've compiled my application using Microsoft Visual Studio 2008 (sp1) on
Windows 7 (64bit). I get the following error when I try to add a port
mapping:
An attempt was made to load a program with an incorrect format. (Exception
from HRESULT: 0x8007000B)
on line 400 of TCMNATPMPPortMapper.cs which reads:
r = NATPMP.initnatpmp(ref natpmp);
As further information, the "Port Map 1.0" example application also fails
(not sure what the error is, but I assume it is the same problem).
The two DLL files and the oui.txt file are in the bin/debug directory with
the EXE and the latest were downloaded today 12/01/2009.
Any suggestions?
Thanks,
Ross
Original issue reported on code.google.com by [email protected]
on 1 Dec 2009 at 11:03
Great work, only one issue.
using invoke doesn't work in wpf projects.
I removed your invoke calls and just called the delegates straight up.
This may cause some cross threading issues but its better than nothing
working at all.
Try to keep form/gui out of external DLL's if all possible.
Also I'm running 32 bit Windows 7, I changed it build in AnyCPU config and
it worked just fine. I was having the same problems as the other guy with
not loading the dll, after changing it to AnyCPU config it fixed it.
Everything is running great now.
Original issue reported on code.google.com by [email protected]
on 13 Dec 2009 at 3:33
i am running Windows 7 64bit and when i launch portmap i crashes on me do i
need a special framework or something??? Please Help (i need this for my
minecraft server!!!)
Original issue reported on code.google.com by [email protected]
on 31 Oct 2012 at 1:02
What steps will reproduce the problem?
1. Open up Tortoise SVN
2. Input SVN checkout URL
3. Getting error saying the URL doesn't exist
What is the expected output? What do you see instead?
Checked out code. but instead, the url doesn't seem to exist.
What version of the product are you using? On what operating system?
Windows 7 x64
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Oct 2012 at 9:19
Attachments:
Summary pretty much explains it
I've tried an open source C++ project and it worked, so maybe this needs
updating?
I'd love to see something in C# though : )
Also at my friend's house same thing, it might have seen more responsive
but all in all it didn't work at his house either.
I have an actiontec pk-5000 and he had some white fancy looking netgear
Thanks
Original issue reported on code.google.com by CTSSTC
on 4 Oct 2009 at 8:22
I have downloaded the binary file and ran it. But the port-mapper doesn't work.
So i have downloaded the source and built it with VC+2010 and I successfully
add new mapper entry.
I start server with port 1400 and my local IP was configured to be
static(192.168.1.50)
I use my public IP to access echo-server and fail?
http://[my router ip] :[public port] in browser
Some thing wrong ? Please help.
Original issue reported on code.google.com by [email protected]
on 18 Apr 2012 at 1:53
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.