[resend PATCH 1/2] ntdll: Implement NtQuerySystemInformationEx(SystemCpuSetInformation).

Alexandre Julliard julliard at winehq.org
Mon Mar 29 14:55:12 CDT 2021


Paul Gofman <pgofman at codeweavers.com> writes:

> On 3/29/21 22:33, Alexandre Julliard wrote:
>> Paul Gofman <pgofman at codeweavers.com> writes:
>>
>>> @@ -2651,6 +2743,10 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
>>>          break;
>>>      }
>>>  
>>> +    case SystemCpuSetInformation:
>>> +        return is_win64 ? NtQuerySystemInformationEx(class, NULL, 0, info, size, ret_size)
>>> +                : STATUS_INVALID_INFO_CLASS;
>>> +
>>>      case SystemRecommendedSharedDataAlignment:
>>>      {
>>>          len = sizeof(DWORD);
>>> @@ -2773,6 +2869,31 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
>>>          break;
>>>      }
>>>  
>>> +    case SystemCpuSetInformation:
>>> +    {
>>> +        unsigned int cpu_count = NtCurrentTeb()->Peb->NumberOfProcessors;
>>> +        PROCESS_BASIC_INFORMATION pbi;
>>> +        HANDLE process;
>>> +
>>> +        if (!query || query_len < sizeof(HANDLE) || (is_win64 && query_len != sizeof(HANDLE)))
>>> +            return STATUS_INVALID_PARAMETER;
>> I suspect these 64-bit differences are side-effects of the WoW
>> translation rather than fundamental limitations. We may not be able to
>> find a 32-bit Windows version to verify this, but there doesn't seem to
>> be a reason to deliberately break these calls on 32-bit Wine.
>>
> As for the first difference (NtQuerySystemInformation), it is just a
> matter of return error value, it doesn't work on neither 64 nor 32 bit
> as seems to always require NtQuerySystemInformationEx() to pass the
> process handle through its parameters. NtQuerySystemInformationEx()
> should work on 32 bit Wine as well.
>
> As for the second condition in NtQuerySystemInformationEx(), as far as
> my testing goes on Windows 32bit (wow64) it allows bigger query len than
> sizeof(HANDLE) and still succeeds while on win64 requires the exact
> match, so it still works on 32 bit Wine.
>
> Or did I misunderstand the concern?

The concern is having explicit is_win64 checks, we shouldn't need that.
Just pick the behavior that makes the most sense.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list