Skip to content
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

Support newly-defined symbols in newer versions of the Windows 10 SDK #1133

Merged
merged 1 commit into from
Sep 28, 2017

Conversation

maxbelanger
Copy link
Contributor

We've been testing with the 10.0.16278 SDK, which now defines struct _CLIENT_ID and struct _SYSTEM_THREAD_INFORMATION. To fix this, we've patched ntextapi.h to use the same technique as for SYSTEM_PROCESS_INFORMATION. This worked nicely for us locally!

@giampaolo
Copy link
Owner

Sorry for the ignorance but is 10.0.16278 SDK the latest VS version? What problem is this PR solving specifically? A compilation waning which occurs with this specific VS version? In general I'm OK with changes like this one as long as they don't break compatibility.

@maxbelanger
Copy link
Contributor Author

To clarify, the 16278 SDK is included in the Visual Studio 2017 15.4 Preview and it corresponds to the Windows 10 Fall Creators Update. This is solving a problem where trying to build with this version of the SDK causes errors in ntextapi.h because some symbols are newly defined in winternl.h, and the re-definition breaks the build (the official definition is mostly opaque):

    c:\users\max\appdata\local\temp\pip-build-wkpbne\psutil\psutil\arch\windows\ntextapi.h(166): error C2011: '_CLIENT_ID': 'struct' type redefinition
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16278.0\um\winternl.h(80): note: see declaration of '_CLIENT_ID'
    c:\users\max\appdata\local\temp\pip-build-wkpbne\psutil\psutil\arch\windows\ntextapi.h(172): error C2011: '_SYSTEM_THREAD_INFORMATION': 'struct' type redefinition
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16278.0\um\winternl.h(286): note: see declaration of '_SYSTEM_THREAD_INFORMATION'
    c:\users\max\appdata\local\temp\pip-build-wkpbne\psutil\psutil\arch/windows/inet_ntop.h(15): warning C4028: formal parameter 2 different from declaration
    psutil/_psutil_windows.c(2769): error C2039: 'ContextSwitches': is not a member of '_SYSTEM_THREAD_INFORMATION'
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16278.0\um\winternl.h(286): note: see declaration of '_SYSTEM_THREAD_INFORMATION'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe' failed with exit status 2

This should technically be fine for backwards compatibility, as in previous versions the symbols aren't defined at all.

@maxbelanger maxbelanger changed the title Support newly-fined structures in new versions of the Windows 10 SDK Support newly-defined symbols in newer versions of the Windows 10 SDK Sep 26, 2017
@giampaolo giampaolo merged commit cbbf1bd into giampaolo:master Sep 28, 2017
giampaolo added a commit that referenced this pull request Sep 28, 2017
@maxbelanger maxbelanger deleted the new-structures branch September 28, 2017 20:38
@maxbelanger
Copy link
Contributor Author

Thanks again for the quick turnaround! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants