-
Notifications
You must be signed in to change notification settings - Fork 179
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
Update FileAttributes size to work across all platforms #88
Conversation
@jiria - Are you sure? _FILE_BASIC_INFO. Seems to be that its a |
@jterry75 Good catch, made me question my sanity. The pre-existing comment in the file helped. Structures are padded at the end so that the size of the structure is divisible by the size of the largest element. So in the case of 64 bit platform, sizeof(uintptr) was 8, so no extra padding was needed. On 32 bit platform, sizeof(uintptr) or sizeof(DWORD) are 4, so there is invisible 4 bytes of alignment. Since go does not observe these, the buffer size was only 36, not 40. Having said that, I do not think this change is the best way to go about fixing this. We could add 4 bytes of dummy padding into the GO structure, the Windows code seems to be testing only the minimum size of the buffer, so it would not break 64 bit platforms. Or do you have some other thoughts on how to amend this? |
The FileAttributes uint32;
pad uint32 |
This is little endian, so it should go into the low 4 bytes; why do you believe otherwise? Sounds good on the proposal, will update, retest and push a new iteration. |
LGTM. Did your tests with this work as expected? |
Yes, I had mirrored these changes on top of fork of moby/moby and I can build dockerd and run it successfully (tested docker import, docker run). Please let me know if there is more tests that you would want me to run. Other than that, I think we can complete this. |
FileAttributes is expected to be 64 bit wide when calling into Windows APIs, no matter the platform. This fix is ensuring that.