From: Paul Gofman Subject: [PATCH v2] wineboot: Fill ActiveProcessorAffinity field in USD. Message-Id: <20201120133917.120151-1-pgofman@codeweavers.com> Date: Fri, 20 Nov 2020 16:39:17 +0300 Signed-off-by: Paul Gofman --- v2: - define ActiveProcessorAffinity as ULONGLONG in USD; - use ULONGLONG instead of ULONG_PTR. dlls/ntdll/tests/virtual.c | 7 +++++++ include/ddk/wdm.h | 2 +- programs/wineboot/wineboot.c | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index 9c2cf824018..f2c8343e1a6 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -579,6 +579,13 @@ static void test_user_shared_data(void) ok(user_shared_data->ActiveProcessorCount == NtCurrentTeb()->Peb->NumberOfProcessors || broken(!user_shared_data->ActiveProcessorCount) /* before Win7 */, "Got unexpected ActiveProcessorCount %u.\n", user_shared_data->ActiveProcessorCount); + if (user_shared_data->ActiveProcessorCount) + ok(user_shared_data->ActiveProcessorAffinity + == (user_shared_data->ActiveProcessorCount >= 8 * sizeof(ULONGLONG) + ? ~(ULONGLONG)0 : ((ULONGLONG)1 << user_shared_data->ActiveProcessorCount) - 1) + || broken(!user_shared_data->ActiveProcessorAffinity) /* before Win7 */, + "Got unexpected ActiveProcessorAffinity %s.\n", + wine_dbgstr_longlong(user_shared_data->ActiveProcessorAffinity)); ok(user_shared_data->ActiveGroupCount == 1 || broken(!user_shared_data->ActiveGroupCount) /* before Win7 */, "Got unexpected ActiveGroupCount %u.\n", user_shared_data->ActiveGroupCount); diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 6885de1cf89..aa2551be035 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1320,7 +1320,7 @@ typedef struct _KUSER_SHARED_DATA { USHORT UserModeGlobalLogger[16]; /* 0x380 */ ULONG ImageFileExecutionOptions; /* 0x3a0 */ ULONG LangGenerationCount; /* 0x3a4 */ - ULONG ActiveProcessorAffinity; /* 0x3a8 */ + ULONGLONG ActiveProcessorAffinity; /* 0x3a8 */ volatile ULONGLONG InterruptTimeBias; /* 0x3b0 */ volatile ULONGLONG QpcBias; /* 0x3b8 */ ULONG ActiveProcessorCount; /* 0x3c0 */ diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 05a5ee6aa62..5bf839ec520 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -332,6 +332,8 @@ static void create_user_shared_data(void) break; } data->ActiveProcessorCount = NtCurrentTeb()->Peb->NumberOfProcessors; + data->ActiveProcessorAffinity = data->ActiveProcessorCount >= 8 * sizeof(ULONGLONG) + ? ~(ULONGLONG)0 : ((ULONGLONG)1 << data->ActiveProcessorCount) - 1; data->ActiveGroupCount = 1; initialize_xstate_features( data ); -- 2.28.0