ntdll: Use public type for SystemSupportedProcessorArchitectures returned data.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
dbeaaf2b0f
commit
26f11bdfe5
7 changed files with 76 additions and 54 deletions
|
@ -108,19 +108,18 @@ USHORT WINAPI RtlWow64GetCurrentMachine(void)
|
|||
*/
|
||||
NTSTATUS WINAPI RtlWow64GetProcessMachines( HANDLE process, USHORT *current_ret, USHORT *native_ret )
|
||||
{
|
||||
ULONG i, machines[8];
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
USHORT current = 0, native = 0;
|
||||
NTSTATUS status;
|
||||
ULONG i;
|
||||
|
||||
status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
machines, sizeof(machines), NULL );
|
||||
if (status) return status;
|
||||
for (i = 0; machines[i]; i++)
|
||||
for (i = 0; machines[i].Machine; i++)
|
||||
{
|
||||
USHORT flags = HIWORD(machines[i]);
|
||||
USHORT machine = LOWORD(machines[i]);
|
||||
if (flags & 4 /* native machine */) native = machine;
|
||||
else if (flags & 8 /* current machine */) current = machine;
|
||||
if (machines[i].Native) native = machines[i].Machine;
|
||||
else if (machines[i].Process) current = machines[i].Machine;
|
||||
}
|
||||
if (current_ret) *current_ret = current;
|
||||
if (native_ret) *native_ret = native;
|
||||
|
@ -148,18 +147,19 @@ NTSTATUS WINAPI RtlWow64GetSharedInfoProcess( HANDLE process, BOOLEAN *is_wow64,
|
|||
*/
|
||||
NTSTATUS WINAPI RtlWow64IsWowGuestMachineSupported( USHORT machine, BOOLEAN *supported )
|
||||
{
|
||||
ULONG i, machines[8];
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
HANDLE process = 0;
|
||||
NTSTATUS status;
|
||||
ULONG i;
|
||||
|
||||
status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
machines, sizeof(machines), NULL );
|
||||
if (status) return status;
|
||||
*supported = FALSE;
|
||||
for (i = 0; machines[i]; i++)
|
||||
for (i = 0; machines[i].Machine; i++)
|
||||
{
|
||||
if (HIWORD(machines[i]) & 4 /* native machine */) continue;
|
||||
if (machine == LOWORD(machines[i])) *supported = TRUE;
|
||||
if (machines[i].Native) continue;
|
||||
if (machine == machines[i].Machine) *supported = TRUE;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -141,40 +141,37 @@ static void init(void)
|
|||
|
||||
static void test_process_architecture( HANDLE process, USHORT expect_machine, USHORT expect_native )
|
||||
{
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
NTSTATUS status;
|
||||
ULONG i, len, buffer[8];
|
||||
ULONG i, len;
|
||||
|
||||
len = 0xdead;
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
&buffer, sizeof(buffer), &len );
|
||||
machines, sizeof(machines), &len );
|
||||
ok( !status, "failed %lx\n", status );
|
||||
ok( !(len & 3), "wrong len %lx\n", len );
|
||||
len /= sizeof(DWORD);
|
||||
len /= sizeof(machines[0]);
|
||||
for (i = 0; i < len - 1; i++)
|
||||
{
|
||||
USHORT flags = HIWORD(buffer[i]);
|
||||
USHORT machine = LOWORD(buffer[i]);
|
||||
|
||||
if (flags & 8)
|
||||
ok( machine == expect_machine, "wrong current machine %lx\n", buffer[i]);
|
||||
if (machines[i].Process)
|
||||
ok( machines[i].Machine == expect_machine, "wrong process machine %x\n", machines[i].Machine);
|
||||
else
|
||||
ok( machine != expect_machine, "wrong machine %lx\n", buffer[i]);
|
||||
ok( machines[i].Machine != expect_machine, "wrong machine %x\n", machines[i].Machine);
|
||||
|
||||
/* FIXME: not quite sure what the other flags mean,
|
||||
* observed on amd64 Windows: (flags & 7) == 7 for MACHINE_AMD64 and 2 for MACHINE_I386
|
||||
*/
|
||||
if (flags & 4)
|
||||
ok( machine == expect_native, "wrong native machine %lx\n", buffer[i]);
|
||||
if (machines[i].Native)
|
||||
ok( machines[i].Machine == expect_native, "wrong native machine %x\n", machines[i].Machine);
|
||||
else
|
||||
ok( machine != expect_native, "wrong machine %lx\n", buffer[i]);
|
||||
ok( machines[i].Machine != expect_native, "wrong machine %x\n", machines[i].Machine);
|
||||
|
||||
/* FIXME: test other fields */
|
||||
}
|
||||
ok( !buffer[i], "missing terminating null\n" );
|
||||
ok( !*(DWORD *)&machines[i], "missing terminating null\n" );
|
||||
|
||||
len = i * sizeof(DWORD);
|
||||
len = i * sizeof(machines[0]);
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
&buffer, len, &len );
|
||||
machines, len, &len );
|
||||
ok( status == STATUS_BUFFER_TOO_SMALL, "failed %lx\n", status );
|
||||
ok( len == (i + 1) * sizeof(DWORD), "wrong len %lu\n", len );
|
||||
ok( len == (i + 1) * sizeof(machines[0]), "wrong len %lu\n", len );
|
||||
|
||||
if (pRtlWow64GetProcessMachines)
|
||||
{
|
||||
|
@ -191,17 +188,18 @@ static void test_process_architecture( HANDLE process, USHORT expect_machine, US
|
|||
|
||||
static void test_query_architectures(void)
|
||||
{
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFOA si = { sizeof(si) };
|
||||
NTSTATUS status;
|
||||
HANDLE process;
|
||||
ULONG len, buffer[8];
|
||||
ULONG len;
|
||||
|
||||
if (!pNtQuerySystemInformationEx) return;
|
||||
|
||||
process = GetCurrentProcess();
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
&buffer, sizeof(buffer), &len );
|
||||
machines, sizeof(machines), &len );
|
||||
if (status == STATUS_INVALID_INFO_CLASS)
|
||||
{
|
||||
win_skip( "SystemSupportedProcessorArchitectures not supported\n" );
|
||||
|
@ -211,20 +209,20 @@ static void test_query_architectures(void)
|
|||
|
||||
process = (HANDLE)0xdeadbeef;
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
&buffer, sizeof(buffer), &len );
|
||||
machines, sizeof(machines), &len );
|
||||
ok( status == STATUS_INVALID_HANDLE, "failed %lx\n", status );
|
||||
process = (HANDLE)0xdeadbeef;
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3,
|
||||
&buffer, sizeof(buffer), &len );
|
||||
machines, sizeof(machines), &len );
|
||||
ok( status == STATUS_INVALID_PARAMETER || broken(status == STATUS_INVALID_HANDLE),
|
||||
"failed %lx\n", status );
|
||||
process = GetCurrentProcess();
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3,
|
||||
&buffer, sizeof(buffer), &len );
|
||||
machines, sizeof(machines), &len );
|
||||
ok( status == STATUS_INVALID_PARAMETER || broken( status == STATUS_SUCCESS),
|
||||
"failed %lx\n", status );
|
||||
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, NULL, 0,
|
||||
&buffer, sizeof(buffer), &len );
|
||||
machines, sizeof(machines), &len );
|
||||
ok( status == STATUS_INVALID_PARAMETER, "failed %lx\n", status );
|
||||
|
||||
test_process_architecture( GetCurrentProcess(), current_machine, native_machine );
|
||||
|
|
|
@ -3365,6 +3365,7 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
|
|||
|
||||
case SystemSupportedProcessorArchitectures:
|
||||
{
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION *machines = info;
|
||||
HANDLE process;
|
||||
ULONG i;
|
||||
USHORT machine = 0;
|
||||
|
@ -3382,7 +3383,7 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
|
|||
if (ret) return ret;
|
||||
}
|
||||
|
||||
len = (supported_machines_count + 1) * sizeof(ULONG);
|
||||
len = (supported_machines_count + 1) * sizeof(*machines);
|
||||
if (size < len)
|
||||
{
|
||||
ret = STATUS_BUFFER_TOO_SMALL;
|
||||
|
@ -3390,12 +3391,22 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
|
|||
}
|
||||
for (i = 0; i < supported_machines_count; i++)
|
||||
{
|
||||
USHORT flags = 2; /* supported (?) */
|
||||
if (!i) flags |= 5; /* native machine (?) */
|
||||
if (supported_machines[i] == machine) flags |= 8; /* current machine */
|
||||
((DWORD *)info)[i] = MAKELONG( supported_machines[i], flags );
|
||||
machines[i].Machine = supported_machines[i];
|
||||
machines[i].UserMode = 1;
|
||||
machines[i].KernelMode = machines[i].Native = i == 0;
|
||||
machines[i].Process = supported_machines[i] == machine;
|
||||
machines[i].WoW64Container = 0;
|
||||
machines[i].ReservedZero0 = 0;
|
||||
}
|
||||
((DWORD *)info)[i] = 0;
|
||||
|
||||
machines[i].Machine = 0;
|
||||
machines[i].KernelMode = 0;
|
||||
machines[i].UserMode = 0;
|
||||
machines[i].Native = 0;
|
||||
machines[i].Process = 0;
|
||||
machines[i].WoW64Container = 0;
|
||||
machines[i].ReservedZero0 = 0;
|
||||
|
||||
ret = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -657,7 +657,7 @@ NTSTATUS WINAPI wow64_NtQuerySystemInformationEx( UINT *args )
|
|||
}
|
||||
|
||||
case SystemCpuSetInformation: /* SYSTEM_CPU_SET_INFORMATION */
|
||||
case SystemSupportedProcessorArchitectures: /* ULONG */
|
||||
case SystemSupportedProcessorArchitectures: /* SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION */
|
||||
return NtQuerySystemInformationEx( class, &handle, sizeof(handle), ptr, len, retlen );
|
||||
|
||||
default:
|
||||
|
|
|
@ -6595,6 +6595,17 @@ typedef struct _SYSTEM_CPU_SET_INFORMATION
|
|||
} DUMMYUNIONNAME;
|
||||
} SYSTEM_CPU_SET_INFORMATION, *PSYSTEM_CPU_SET_INFORMATION;
|
||||
|
||||
typedef struct _SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION
|
||||
{
|
||||
DWORD Machine : 16;
|
||||
DWORD KernelMode : 1;
|
||||
DWORD UserMode : 1;
|
||||
DWORD Native : 1;
|
||||
DWORD Process : 1;
|
||||
DWORD WoW64Container : 1;
|
||||
DWORD ReservedZero0 : 11;
|
||||
} SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION;
|
||||
|
||||
/* Threadpool things */
|
||||
typedef DWORD TP_VERSION,*PTP_VERSION;
|
||||
|
||||
|
|
|
@ -112,20 +112,21 @@ static LPCWSTR find_arg_start(LPCWSTR cmdline)
|
|||
|
||||
static void reexec_self( WORD machine )
|
||||
{
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
WCHAR app[MAX_PATH];
|
||||
LPCWSTR args;
|
||||
WCHAR *cmdline;
|
||||
ULONG i, machines[8];
|
||||
HANDLE process = 0;
|
||||
STARTUPINFOW si = {0};
|
||||
PROCESS_INFORMATION pi;
|
||||
void *cookie;
|
||||
ULONG i;
|
||||
|
||||
NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
machines, sizeof(machines), NULL );
|
||||
for (i = 0; machines[i]; i++) if (LOWORD(machines[i]) == machine) break;
|
||||
if (!machines[i]) return;
|
||||
if (HIWORD(machines[i]) & 4 /* native machine */) machine = IMAGE_FILE_MACHINE_TARGET_HOST;
|
||||
for (i = 0; machines[i].Machine; i++) if (machines[i].Machine == machine) break;
|
||||
if (!machines[i].Machine) return;
|
||||
if (machines[i].Native) machine = IMAGE_FILE_MACHINE_TARGET_HOST;
|
||||
if (!GetSystemWow64Directory2W( app, MAX_PATH, machine )) return;
|
||||
wcscat( app, L"\\regsvr32.exe" );
|
||||
|
||||
|
|
|
@ -357,6 +357,7 @@ static UINT64 read_tsc_frequency(void)
|
|||
|
||||
static void create_user_shared_data(void)
|
||||
{
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
struct _KUSER_SHARED_DATA *data;
|
||||
RTL_OSVERSIONINFOEXW version;
|
||||
SYSTEM_CPU_INFORMATION sci;
|
||||
|
@ -366,7 +367,7 @@ static void create_user_shared_data(void)
|
|||
UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\KernelObjects\\__wine_user_shared_data" );
|
||||
NTSTATUS status;
|
||||
HANDLE handle;
|
||||
ULONG i, machines[8];
|
||||
ULONG i;
|
||||
HANDLE process = 0;
|
||||
|
||||
InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL );
|
||||
|
@ -446,9 +447,9 @@ static void create_user_shared_data(void)
|
|||
if (!NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
machines, sizeof(machines), NULL ))
|
||||
{
|
||||
for (i = 0; machines[i]; i++)
|
||||
for (i = 0; machines[i].Machine; i++)
|
||||
{
|
||||
switch (LOWORD(machines[i]))
|
||||
switch (machines[i].Machine)
|
||||
{
|
||||
case IMAGE_FILE_MACHINE_ARMNT:
|
||||
features[PF_ARM_VFP_32_REGISTERS_AVAILABLE] = TRUE;
|
||||
|
@ -1596,12 +1597,12 @@ static void update_wineprefix( BOOL force )
|
|||
|
||||
if (update_timestamp( config_dir, st.st_mtime ) || force)
|
||||
{
|
||||
ULONG machines[8];
|
||||
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
|
||||
HANDLE process = 0;
|
||||
DWORD count = 0;
|
||||
|
||||
if (NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
machines, sizeof(machines), NULL )) machines[0] = 0;
|
||||
machines, sizeof(machines), NULL )) machines[0].Machine = 0;
|
||||
|
||||
if ((process = start_rundll32( inf_path, L"PreInstall", IMAGE_FILE_MACHINE_TARGET_HOST )))
|
||||
{
|
||||
|
@ -1619,11 +1620,11 @@ static void update_wineprefix( BOOL force )
|
|||
}
|
||||
CloseHandle( process );
|
||||
}
|
||||
if (!machines[count]) break;
|
||||
if (HIWORD(machines[count]) & 4 /* native machine */)
|
||||
if (!machines[count].Machine) break;
|
||||
if (machines[count].Native)
|
||||
process = start_rundll32( inf_path, L"DefaultInstall", IMAGE_FILE_MACHINE_TARGET_HOST );
|
||||
else
|
||||
process = start_rundll32( inf_path, L"Wow64Install", LOWORD(machines[count]) );
|
||||
process = start_rundll32( inf_path, L"Wow64Install", machines[count].Machine );
|
||||
count++;
|
||||
}
|
||||
DestroyWindow( hwnd );
|
||||
|
|
Loading…
Add table
Reference in a new issue