Make return value to work like in Windows where given size must match exactly for STATUS_SUCCESS result.
For more context/background info see !4832
From: Dāvis Mosāns davispuh@gmail.com
Make return value to work like in Windows where given size must match exactly for STATUS_SUCCESS result.
Co-authored-by: Haltinulo --- dlls/ntdll/unix/system.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 879a5893758..45af2e2d4a6 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2885,6 +2885,9 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, shi->Handle[i].ObjectType = handle_info[i].type; /* FIXME: Fill out ObjectPointer */ } + + if (len != size) + ret = STATUS_INFO_LENGTH_MISMATCH; } else if (ret == STATUS_BUFFER_TOO_SMALL) {
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=141841
Your paranoid android.
=== debian11 (32 bit report) ===
ntdll: info.c:914: Test failed: Expected STATUS_SUCCESS, got c0000017
=== debian11b (64 bit WoW report) ===
ntdll: info: Timeout
Could you add a test for this behavior?
On Mon Jan 15 13:47:02 2024 +0000, Etaash Mathamsetty wrote:
Could you add a test for this behavior?
Looked more into this and this is wrong, on Windows giving larger buffer still returns `STATUS_SUCCESS` but because current number of handles keeps changing it's easy to run into situation like
```c NtQuerySystemInformation(SystemHandleInformation, buffer, 0x32, &ReturnLength); status = NtQuerySystemInformation(SystemHandleInformation, buffer, ReturnLength, NULL); // status returns STATUS_INFO_LENGTH_MISMATCH because now there are more handles so need larger buffer
```
But Wine's implementation is wrong in different way, on Windows you can give smaller buffer and it will get filled with available information because it writes directly in user provided buffer, but here Wine will write output only if buffer is large enough and thus programs that give smaller buffer will fail with Wine but succeed on Windows.
This merge request was closed by Dāvis Mosāns (davispuh).