http://bugs.winehq.org/show_bug.cgi?id=31772
Bug #: 31772 Summary: NtQuerySystemInformation doesn't fill ReturnLength properly with SystemProcessInformation Product: Wine Version: 1.5.13 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: nospam.kotarou.dono@gmail.com Classification: Unclassified
Created attachment 41804 --> http://bugs.winehq.org/attachment.cgi?id=41804 Test program for calling NtTerminateProcess with it's handle as 0
While I was writing a test program for calling NtTerminateProcess with 0 as it's handle, I found out NtQuerySystemInformation doesn't correctly fill ReturnLength when called with SystemProcessInformation.
Code --- SIZE_T spiSize; NtQuerySystemInformation(SystemProcessInformation, NULL, 0, (ULONG*)&spiSize);
Expected result --- spiSize contains the size of the needed buffer to completely contain all the SYSTEM_PROCESS_INFORMATION and SYSTEM_THREAD_INFORMATION structures of the processes and threads of the system.
Actual result --- spiSize contains 0
On a side note, after hacking my code by pre-setting spiSize to an amount and commenting out the first NtQuerySystemInformation call, the behaviour of NtTerminateProcess is not what I expected: It should return STATUS_SUCCESS and kill all threads except for the calling one, but it returns STATUS_INVALID_HANDLE instead.
http://bugs.winehq.org/show_bug.cgi?id=31772
--- Comment #1 from nospam.kotarou.dono@gmail.com 2012-09-23 23:05:03 CDT --- Postscript: I cross-compiled the test program from x86_64 linux to i686 windows with mingw-w64 if that makes any difference with the argument "-lntdll"
http://bugs.winehq.org/show_bug.cgi?id=31772
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase
http://bugs.winehq.org/show_bug.cgi?id=31772
Sagawa sagawa.aki+winebugs@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sagawa.aki+winebugs@gmail.c | |om
--- Comment #2 from Sagawa sagawa.aki+winebugs@gmail.com 2012-10-15 11:31:14 CDT --- Hi,
You mentioned following two issues: 1) NtQuerySystemInformation doesn't fill ReturnLength properly with SystemProcessInformation. 2) Calling NtTerminateProcess with it's handle as 0 doesn't work well.
Please open a separate bug for the latter case. And what application depends on this?
http://bugs.winehq.org/show_bug.cgi?id=31772
Christian Costa titan.costa@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |titan.costa@gmail.com
--- Comment #3 from Christian Costa titan.costa@gmail.com 2013-06-15 12:33:48 CDT --- This is fixed in current wine. This case is cover by tests. This bu can be closed then.
/* test ReturnLength */ ReturnLength = 0; status = pNtQuerySystemInformation(SystemProcessInformation, NULL, 0, &ReturnLength); ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_LENGTH_MISMATCH got %08x\n", status); ok( ReturnLength > 0 || broken(ReturnLength == 0) /* NT4, Win2K */, "Expected a ReturnLength to show the needed length\n");
http://bugs.winehq.org/show_bug.cgi?id=31772
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com 2013-06-22 14:03:08 CDT --- Assuming fixed as per last comment.
http://bugs.winehq.org/show_bug.cgi?id=31772
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org 2013-06-28 15:03:46 CDT --- Closing bugs fixed in 1.6-rc4.