Skip to content

Conversation

mexmer
Copy link
Contributor

@mexmer mexmer commented Apr 24, 2025

replacing WSAAddressToString (universal version) with ansi version of inet_ntop when compilining under windows to remove unicode compilation dependency.

@mexmer
Copy link
Contributor Author

mexmer commented Apr 24, 2025

just a sidenote, InetNtop function is available from windows vista onwards, i decided to use this function and not maintain older windows compatibility (WSAAddressToString was available since windows XP), main reason is, that it has same arguments as inet_ntop (since windows vista inet_ntop is defined and wraps arround InetNtop)

@nikias
Copy link
Member

nikias commented May 17, 2025

I am checking to see how to still allow older Windows versions to compile this conditionally (I know it might not really be needed but I kinda like to keep stuff available just in case). Older versions should use WSAAddressToStringA while newer can use InetNtopA, that would be ideal IMO.

@mexmer
Copy link
Contributor Author

mexmer commented May 18, 2025

there are two ways how to approach it. either call this function with wrapper from DLL, that way you can compile code with older SDK, and run on newer or older platforms. or you can just add conditional compilation depending on windows SDK version, eg. when compiling under NT6 or newer SDK use this, for older use WSA

tbh. i'm not sure, if it's even possible to compile libimobile for windows xp in current state.

@nikias
Copy link
Member

nikias commented May 18, 2025

It compiles for Windows XP, I tested in a VM. Maybe we can just have #if _WIN32_WINNT < 0x600 in the code around WSAAddressToStringA and then have a configure option to set a minimum windows version (currently 0x501 which should probably be 0x502).

@mexmer
Copy link
Contributor Author

mexmer commented May 19, 2025

It compiles for Windows XP, I tested in a VM. Maybe we can just have #if _WIN32_WINNT < 0x600 in the code around WSAAddressToStringA and then have a configure option to set a minimum windows version (currently 0x501 which should probably be 0x502).

yes, thats's what i meant by SDK dependent compilation.

@nikias
Copy link
Member

nikias commented Jun 4, 2025

I pushed commit 050ff3b that will use the old method when _WIN32_WINNT < 0x600 (Vista) and otherwise uses inet_ntop (which is the ANSI version of InetNtop). Turned out that I already had similar compile time conditions throughout the code anyway, so this makes perfect sense.
I will also add a --with-winver option to configure, so passing --with-winver=0x0502 would set the mininum supported Windows version to XP SP2.

@nikias
Copy link
Member

nikias commented Jun 4, 2025

And af3ab2e adds support for the --with-winver= option.

@nikias nikias closed this Jun 4, 2025
@mexmer
Copy link
Contributor Author

mexmer commented Jun 4, 2025

thanks

@mexmer mexmer deleted the socket_addr_to_string_unicode_fix branch June 4, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants