#1000 closed defect (fixed)
IPHLPAPI.DLL issues on Windows Mobile targets and with IPv6 enumeration
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | normal | Milestone: | release-1.5.5 |
Component: | pjlib | Version: | trunk |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: |
Description (last modified by bennylp)
Windows Mobile targets issue
Ticket #989 for release 1.5 changed the call to GetProcAddress() to always use ANSI string. This is broken for Windows Mobile.
There seems to be a difference with GetProcAddress() API signature between Windows (i.e. Win32) and Windows CE (e.g. Windows Mobile). On Windows, the API is declared as:
FARPROC GetProcAddress( HMODULE hModule, LPCSTR lpProcName);
while on Windows CE:
FARPROC GetProcAddress( HMODULE hModule, LPCWSTR lpProcName);
Notice the difference with lpProcName argument type. This means that on Windows, even on Unicode Windows, the lpProcName always takes ANSI format, while on Windows CE, the argument follows the UNICODE setting.
Because of this, yet a different Unicode treatment needs to be used when calling GetProcAddress() (i.e. not following PJLIB's Unicode setting)
IPv6 interface enumeration fails due to typo error in Windows targets
The PJLIB pj_enum_ip_interface() API enumerates all IP interfaces in the system with the specified address family. On Windows, the function should use GetAdaptersAddresses() Windows API if IPv6 is enabled, and fallback to use GetIpAddrTable() Windows API if GetAdaptersAddresses() fails.
However the GetAdaptersAddresses() was searched in the IPHLPAPI.DLL as "GetAdapterAddresses" (missing "s" after "Adapter"), causing the function to be failed to be loaded.
Change History (9)
comment:1 Changed 15 years ago by bennylp
- Resolution set to fixed
- Status changed from new to closed
comment:2 Changed 15 years ago by bennylp
Additional notes about r3029 fix above:
- it removed the restrictions that GetAdaptersAddresses() is only used when IPv6 is enabled. It is now used by default.
- on some Windows Mobile devices (Motorola Q), GetIpAddrTable() is not present in IPHLPAPI.DLL, but GetAdaptersAddresses() is. This fix solved this problem. Thanks Emil Sturniolo for the report.
comment:3 Changed 15 years ago by bennylp
In r3030:
- fixed crash if GetAdaptersAddresses?() returns adapter with NULL "firstUnicastAddress". This happens when the interface is disabled.
comment:4 Changed 15 years ago by bennylp
- Description modified (diff)
- Resolution fixed deleted
- Status changed from closed to reopened
- Summary changed from IPv6 interface enumeration fails due to typo error in Windows targets to IPHLPAPI.DLL issues on Windows Mobile targets and with IPv6 enumeration and
comment:5 Changed 15 years ago by bennylp
- Resolution set to fixed
- Status changed from reopened to closed
In r3033:
- fixed the Unicode bug
comment:6 Changed 15 years ago by bennylp
comment:7 Changed 15 years ago by bennylp
- Summary changed from IPHLPAPI.DLL issues on Windows Mobile targets and with IPv6 enumeration and to IPHLPAPI.DLL issues on Windows Mobile targets and with IPv6 enumeration
comment:8 Changed 15 years ago by bennylp
Few related fixes and enhancements in r3040:
- improved buffer robustness for enum_ipv4_interface() and enum_ipv4_ipv6_interface() functions, by supplying only small buffer, but added fallback to allocate the buffer from heap if the buffer is not large enough to contain the result.
- enum_ipv4_ipv6_interface() function:
- bug fix: function should return error if no interface is found
- do not include interfaces that are down, loopback interface, interface with 0.0.0.0/24 address, interface with zero address, etc.
comment:9 Changed 15 years ago by ismangil
- Milestone changed from release-1.6 to release-1.5.5
Fixed in r3029