-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added getting IPv4 netmask in Windows 7 and above #874
Conversation
This is great, thanks. I only have one complaint. With this:
...if the exe/wheel is compiled with Windows 7 the resulting exe/wheel will not be compatible with win < 7 (e.g. Vista). On Vista, the wheel / exe will "believe" it's running on Windows 7 when it's not. As such you should use some other strategy to determine the Windows version at runtime (a Windows API call). |
Ok, I'll try to find a solution to that. |
Actually, reading your consideration a second time I am not sure if I understand what you mean. Even if you are compiling on let's say Windows 7 for Windows Vista, _WIN32_WINNT should have the value indicating Windows Vista, right? The check I used #ifdef's for is needed for two reasons:
(as I side note I realised actually my check was excessive, I should check for >= Vista, not Windows 7) In order to avoid the preprocessor command, I could call GetProcAddress in order to check whether the function is available at runtime, and I agree that it is a more correct solution, but checking for the presence of the struct member OnLinkPrefixLength at runtime would be more complicated. So basically, before trying a complicated solution for checking for OnLinkPrefixLength at runtime, I wanted to be sure that it is really needed. I am not very familiar with how the build procedure works, but AFAIK you would not compile for Windows Vista using Windows 7 libriaries? Or am I missing something? |
No, it won't.
Are you sure? Does this functionality require Win >= Vista? |
According to it is from Windows Vista or Windows server 2008 of and later. (Windows server 2008 has the same value of _WIN32_WINNT as Vista).
I will fix the version and commit. |
Looking back at this, if the change is Windows Vista + only I think this is good for merging. |
That would be great! |
This adds support for getting the IPv4 netmask on Windows (7 and above). On older versions of Windows, it returns a netmask of value None as before. Tested on Windows 7 and 10 with Python 2.7. I have not managed to build it on Windows XP so not tested there.