Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

The Reserved1 field is no longer reserved, it is now the DependentLoadFlags field. #1

Closed
wants to merge 1 commit into from

Conversation

@pstolarz
Copy link
Owner

pstolarz commented Oct 6, 2019

Thanks for the catch! Looks like MS changed IMAGE_LOAD_CONFIG_DIRECTORY for 32/64 PE formats. The DependentLoadFlags field has been provided for Win10. Additionally there are new fields related to Control Flow Guard (GuardXXX fields).
Your patch will cause compilation error on win 7 SDK (and earlier). On the other hand this code will fail on newer SDKs (win 10). I'm wondering if it'd be possible to detect type of IMAGE_LOAD_CONFIG_DIRECTORY struct (defined win winnt.h) during the compilation phase to handle Win 7/8/10 builds altogether without compilation errors.

Unfortunately I completely abandoned Win platform, so if you'd have any ideas and platforms to check them, it'd be nice.

@poizan42
Copy link
Author

poizan42 commented Oct 6, 2019

I don't think its a big problem to require the Windows 10 SDK to build it, the minimum requirements are Windows 7 SP1 (also Windows 7 is EOL in a few months).

@poizan42 poizan42 changed the title The Reserved1 is no longer reserved, it is now the DependentLoadFlags field. The Reserved1 field is no longer reserved, it is now the DependentLoadFlags field. Oct 6, 2019
@pstolarz
Copy link
Owner

pstolarz commented Oct 7, 2019

I'd like to solve this issue in more general way to compile the code on 7/8/10 w/o errors. The most obvious idea I currently have is to use WINVER / _WIN32_WINNT macros to detect the platform and use proper code to build. Give me some time - I would need to find some win 10 platform and configure SDK for it to check the solution (for DependentLoadFlags as well as new win 10 Control Flow Guard stuff).

@poizan42
Copy link
Author

poizan42 commented Oct 8, 2019

Seeing that the Windows 10 SDK both runs on and can target Windows 7 I'm not sure I see the problem. It would be weird if the output was different depending on which OS was used to build it on.

Also I just checked winnt.h (from SDK 10.0.17763) and it doesn't have any conditional on WINVER/_WIN32_WINNT in _IMAGE_LOAD_CONFIG_DIRECTORY*. So it can just be build with a Windows 10 SDK with WINVER/_WIN32_WINNT set to _WIN32_WINNT_WIN7 and it should work everywhere.

@poizan42 poizan42 closed this Oct 8, 2019
@poizan42 poizan42 reopened this Oct 8, 2019
@pstolarz
Copy link
Owner

pstolarz commented Oct 9, 2019

The problem is IMAGE_LOAD_CONFIG_DIRECTORY is defined differently on WIn 7 SDK and Win 10 SDK. If you change the code as you proposed it will fail to build on WIn7 SDK and in the current version it will fail on Win10 SDK. As I'm expecting you found the issue during compiling the code on newer SDK with DependentLoadFlags (not Reserved1), rigth?
I'd like to solve the issue to be able to compile on older as well as newer SDKs (7/8/10). Probably you are right - WINVER / _WIN32_WINNT is not the best solution. Now I've other one in mind but need to have some time to check it.

@pstolarz pstolarz closed this Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants