Some Windows version expect output to be aligned on 4 bytes.
Notes (from i386 and x86_64 tests): - MSVC and Mingw/gcc don't layout the two variables (sdki, sdki_ex) the same way. - MSVC aligns each variable on 4-byte boundary, - MingW/GCC stores them in a 8-byte chunk, but starting from the end of the buffer: hence none of them is on a 4-byte boundary.
So, fixing the alignment of variables is not sufficient to workaround the compilers' discrepancy on all source code.
I didn't find a generic way to align on 4 bytes structures of size smaller than 4 bytes (apart from adding the DECLSPEC_ALIGN to each of the offending structures, likely not that many though). Ideas welcomed.
Wine-Bugs: https://bugs.winehq.org/show_bug.cgi?id=53684
Signed-off-by: Eric Pouech eric.pouech@gmail.com
From: Eric Pouech eric.pouech@gmail.com
Some Windows version expect output to be aligned on 4 bytes.
Notes (from i386 and x86_64 tests): - MSVC and Mingw/gcc don't layout the two variables (sdki, sdki_ex) the same way. - MSVC aligns each variable on 4-byte boundary, - MingW/GCC stores them in a 8-byte chunk, but starting from the end of the buffer: hence none of them is on a 4-byte boundary.
So, fixing the alignment of variables is not sufficient to workaround the compilers' discrepancy on all source code.
I didn't find a generic way to align on 4 bytes structures of size smaller than 4 bytes (apart from adding the DECLSPEC_ALIGN to each of the offending structures, likely not that many though). Ideas welcomed.
Wine-Bugs: https://bugs.winehq.org/show_bug.cgi?id=53684
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/ntdll/tests/info.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 0af4259b85d..bef982b20b0 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -1066,8 +1066,9 @@ static void test_query_kerndebug(void) { NTSTATUS status; ULONG ReturnLength; - SYSTEM_KERNEL_DEBUGGER_INFORMATION_EX skdi_ex; - SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi; + /* some Windows version expect alignment */ + SYSTEM_KERNEL_DEBUGGER_INFORMATION_EX DECLSPEC_ALIGN(4) skdi_ex; + SYSTEM_KERNEL_DEBUGGER_INFORMATION DECLSPEC_ALIGN(4) skdi;
status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, 0, &ReturnLength); ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
On 10/20/22 03:54, Eric Pouech wrote:
From: Eric Pouech eric.pouech@gmail.com
Some Windows version expect output to be aligned on 4 bytes.
Notes (from i386 and x86_64 tests):
- MSVC and Mingw/gcc don't layout the two variables (sdki, sdki_ex) the same way.
- MSVC aligns each variable on 4-byte boundary,
- MingW/GCC stores them in a 8-byte chunk, but starting from the end of the buffer: hence none of them is on a 4-byte boundary.
So, fixing the alignment of variables is not sufficient to workaround the compilers' discrepancy on all source code.
I didn't find a generic way to align on 4 bytes structures of size smaller than 4 bytes (apart from adding the DECLSPEC_ALIGN to each of the offending structures, likely not that many though). Ideas welcomed.
Should we put those structs in pshpack4/poppack in the header? (They aren't defined anywhere publicly on Windows, so we can't compare there.)