Commit 26f11bdf authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ntdll: Use public type for SystemSupportedProcessorArchitectures returned data.

parent dbeaaf2b
...@@ -108,19 +108,18 @@ USHORT WINAPI RtlWow64GetCurrentMachine(void) ...@@ -108,19 +108,18 @@ USHORT WINAPI RtlWow64GetCurrentMachine(void)
*/ */
NTSTATUS WINAPI RtlWow64GetProcessMachines( HANDLE process, USHORT *current_ret, USHORT *native_ret ) 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; USHORT current = 0, native = 0;
NTSTATUS status; NTSTATUS status;
ULONG i;
status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
machines, sizeof(machines), NULL ); machines, sizeof(machines), NULL );
if (status) return status; if (status) return status;
for (i = 0; machines[i]; i++) for (i = 0; machines[i].Machine; i++)
{ {
USHORT flags = HIWORD(machines[i]); if (machines[i].Native) native = machines[i].Machine;
USHORT machine = LOWORD(machines[i]); else if (machines[i].Process) current = machines[i].Machine;
if (flags & 4 /* native machine */) native = machine;
else if (flags & 8 /* current machine */) current = machine;
} }
if (current_ret) *current_ret = current; if (current_ret) *current_ret = current;
if (native_ret) *native_ret = native; if (native_ret) *native_ret = native;
...@@ -148,18 +147,19 @@ NTSTATUS WINAPI RtlWow64GetSharedInfoProcess( HANDLE process, BOOLEAN *is_wow64, ...@@ -148,18 +147,19 @@ NTSTATUS WINAPI RtlWow64GetSharedInfoProcess( HANDLE process, BOOLEAN *is_wow64,
*/ */
NTSTATUS WINAPI RtlWow64IsWowGuestMachineSupported( USHORT machine, BOOLEAN *supported ) NTSTATUS WINAPI RtlWow64IsWowGuestMachineSupported( USHORT machine, BOOLEAN *supported )
{ {
ULONG i, machines[8]; SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
HANDLE process = 0; HANDLE process = 0;
NTSTATUS status; NTSTATUS status;
ULONG i;
status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
machines, sizeof(machines), NULL ); machines, sizeof(machines), NULL );
if (status) return status; if (status) return status;
*supported = FALSE; *supported = FALSE;
for (i = 0; machines[i]; i++) for (i = 0; machines[i].Machine; i++)
{ {
if (HIWORD(machines[i]) & 4 /* native machine */) continue; if (machines[i].Native) continue;
if (machine == LOWORD(machines[i])) *supported = TRUE; if (machine == machines[i].Machine) *supported = TRUE;
} }
return status; return status;
} }
......
...@@ -141,40 +141,37 @@ static void init(void) ...@@ -141,40 +141,37 @@ static void init(void)
static void test_process_architecture( HANDLE process, USHORT expect_machine, USHORT expect_native ) static void test_process_architecture( HANDLE process, USHORT expect_machine, USHORT expect_native )
{ {
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
NTSTATUS status; NTSTATUS status;
ULONG i, len, buffer[8]; ULONG i, len;
len = 0xdead; len = 0xdead;
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, sizeof(buffer), &len ); machines, sizeof(machines), &len );
ok( !status, "failed %lx\n", status ); ok( !status, "failed %lx\n", status );
ok( !(len & 3), "wrong len %lx\n", len ); ok( !(len & 3), "wrong len %lx\n", len );
len /= sizeof(DWORD); len /= sizeof(machines[0]);
for (i = 0; i < len - 1; i++) for (i = 0; i < len - 1; i++)
{ {
USHORT flags = HIWORD(buffer[i]); if (machines[i].Process)
USHORT machine = LOWORD(buffer[i]); ok( machines[i].Machine == expect_machine, "wrong process machine %x\n", machines[i].Machine);
if (flags & 8)
ok( machine == expect_machine, "wrong current machine %lx\n", buffer[i]);
else 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, if (machines[i].Native)
* observed on amd64 Windows: (flags & 7) == 7 for MACHINE_AMD64 and 2 for MACHINE_I386 ok( machines[i].Machine == expect_native, "wrong native machine %x\n", machines[i].Machine);
*/
if (flags & 4)
ok( machine == expect_native, "wrong native machine %lx\n", buffer[i]);
else 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), status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, len, &len ); machines, len, &len );
ok( status == STATUS_BUFFER_TOO_SMALL, "failed %lx\n", status ); 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) if (pRtlWow64GetProcessMachines)
{ {
...@@ -191,17 +188,18 @@ static void test_process_architecture( HANDLE process, USHORT expect_machine, US ...@@ -191,17 +188,18 @@ static void test_process_architecture( HANDLE process, USHORT expect_machine, US
static void test_query_architectures(void) static void test_query_architectures(void)
{ {
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFOA si = { sizeof(si) }; STARTUPINFOA si = { sizeof(si) };
NTSTATUS status; NTSTATUS status;
HANDLE process; HANDLE process;
ULONG len, buffer[8]; ULONG len;
if (!pNtQuerySystemInformationEx) return; if (!pNtQuerySystemInformationEx) return;
process = GetCurrentProcess(); process = GetCurrentProcess();
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, sizeof(buffer), &len ); machines, sizeof(machines), &len );
if (status == STATUS_INVALID_INFO_CLASS) if (status == STATUS_INVALID_INFO_CLASS)
{ {
win_skip( "SystemSupportedProcessorArchitectures not supported\n" ); win_skip( "SystemSupportedProcessorArchitectures not supported\n" );
...@@ -211,20 +209,20 @@ static void test_query_architectures(void) ...@@ -211,20 +209,20 @@ static void test_query_architectures(void)
process = (HANDLE)0xdeadbeef; process = (HANDLE)0xdeadbeef;
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, sizeof(buffer), &len ); machines, sizeof(machines), &len );
ok( status == STATUS_INVALID_HANDLE, "failed %lx\n", status ); ok( status == STATUS_INVALID_HANDLE, "failed %lx\n", status );
process = (HANDLE)0xdeadbeef; process = (HANDLE)0xdeadbeef;
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3, status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3,
&buffer, sizeof(buffer), &len ); machines, sizeof(machines), &len );
ok( status == STATUS_INVALID_PARAMETER || broken(status == STATUS_INVALID_HANDLE), ok( status == STATUS_INVALID_PARAMETER || broken(status == STATUS_INVALID_HANDLE),
"failed %lx\n", status ); "failed %lx\n", status );
process = GetCurrentProcess(); process = GetCurrentProcess();
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3, status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3,
&buffer, sizeof(buffer), &len ); machines, sizeof(machines), &len );
ok( status == STATUS_INVALID_PARAMETER || broken( status == STATUS_SUCCESS), ok( status == STATUS_INVALID_PARAMETER || broken( status == STATUS_SUCCESS),
"failed %lx\n", status ); "failed %lx\n", status );
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, NULL, 0, status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, NULL, 0,
&buffer, sizeof(buffer), &len ); machines, sizeof(machines), &len );
ok( status == STATUS_INVALID_PARAMETER, "failed %lx\n", status ); ok( status == STATUS_INVALID_PARAMETER, "failed %lx\n", status );
test_process_architecture( GetCurrentProcess(), current_machine, native_machine ); test_process_architecture( GetCurrentProcess(), current_machine, native_machine );
......
...@@ -3365,6 +3365,7 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class, ...@@ -3365,6 +3365,7 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
case SystemSupportedProcessorArchitectures: case SystemSupportedProcessorArchitectures:
{ {
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION *machines = info;
HANDLE process; HANDLE process;
ULONG i; ULONG i;
USHORT machine = 0; USHORT machine = 0;
...@@ -3382,7 +3383,7 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class, ...@@ -3382,7 +3383,7 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
if (ret) return ret; if (ret) return ret;
} }
len = (supported_machines_count + 1) * sizeof(ULONG); len = (supported_machines_count + 1) * sizeof(*machines);
if (size < len) if (size < len)
{ {
ret = STATUS_BUFFER_TOO_SMALL; ret = STATUS_BUFFER_TOO_SMALL;
...@@ -3390,12 +3391,22 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class, ...@@ -3390,12 +3391,22 @@ NTSTATUS WINAPI NtQuerySystemInformationEx( SYSTEM_INFORMATION_CLASS class,
} }
for (i = 0; i < supported_machines_count; i++) for (i = 0; i < supported_machines_count; i++)
{ {
USHORT flags = 2; /* supported (?) */ machines[i].Machine = supported_machines[i];
if (!i) flags |= 5; /* native machine (?) */ machines[i].UserMode = 1;
if (supported_machines[i] == machine) flags |= 8; /* current machine */ machines[i].KernelMode = machines[i].Native = i == 0;
((DWORD *)info)[i] = MAKELONG( supported_machines[i], flags ); 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; ret = STATUS_SUCCESS;
break; break;
} }
......
...@@ -657,7 +657,7 @@ NTSTATUS WINAPI wow64_NtQuerySystemInformationEx( UINT *args ) ...@@ -657,7 +657,7 @@ NTSTATUS WINAPI wow64_NtQuerySystemInformationEx( UINT *args )
} }
case SystemCpuSetInformation: /* SYSTEM_CPU_SET_INFORMATION */ 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 ); return NtQuerySystemInformationEx( class, &handle, sizeof(handle), ptr, len, retlen );
default: default:
......
...@@ -6595,6 +6595,17 @@ typedef struct _SYSTEM_CPU_SET_INFORMATION ...@@ -6595,6 +6595,17 @@ typedef struct _SYSTEM_CPU_SET_INFORMATION
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} SYSTEM_CPU_SET_INFORMATION, *PSYSTEM_CPU_SET_INFORMATION; } 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 */ /* Threadpool things */
typedef DWORD TP_VERSION,*PTP_VERSION; typedef DWORD TP_VERSION,*PTP_VERSION;
......
...@@ -112,20 +112,21 @@ static LPCWSTR find_arg_start(LPCWSTR cmdline) ...@@ -112,20 +112,21 @@ static LPCWSTR find_arg_start(LPCWSTR cmdline)
static void reexec_self( WORD machine ) static void reexec_self( WORD machine )
{ {
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
WCHAR app[MAX_PATH]; WCHAR app[MAX_PATH];
LPCWSTR args; LPCWSTR args;
WCHAR *cmdline; WCHAR *cmdline;
ULONG i, machines[8];
HANDLE process = 0; HANDLE process = 0;
STARTUPINFOW si = {0}; STARTUPINFOW si = {0};
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
void *cookie; void *cookie;
ULONG i;
NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
machines, sizeof(machines), NULL ); machines, sizeof(machines), NULL );
for (i = 0; machines[i]; i++) if (LOWORD(machines[i]) == machine) break; for (i = 0; machines[i].Machine; i++) if (machines[i].Machine == machine) break;
if (!machines[i]) return; if (!machines[i].Machine) return;
if (HIWORD(machines[i]) & 4 /* native machine */) machine = IMAGE_FILE_MACHINE_TARGET_HOST; if (machines[i].Native) machine = IMAGE_FILE_MACHINE_TARGET_HOST;
if (!GetSystemWow64Directory2W( app, MAX_PATH, machine )) return; if (!GetSystemWow64Directory2W( app, MAX_PATH, machine )) return;
wcscat( app, L"\\regsvr32.exe" ); wcscat( app, L"\\regsvr32.exe" );
......
...@@ -357,6 +357,7 @@ static UINT64 read_tsc_frequency(void) ...@@ -357,6 +357,7 @@ static UINT64 read_tsc_frequency(void)
static void create_user_shared_data(void) static void create_user_shared_data(void)
{ {
SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
struct _KUSER_SHARED_DATA *data; struct _KUSER_SHARED_DATA *data;
RTL_OSVERSIONINFOEXW version; RTL_OSVERSIONINFOEXW version;
SYSTEM_CPU_INFORMATION sci; SYSTEM_CPU_INFORMATION sci;
...@@ -366,7 +367,7 @@ static void create_user_shared_data(void) ...@@ -366,7 +367,7 @@ static void create_user_shared_data(void)
UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\KernelObjects\\__wine_user_shared_data" ); UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\KernelObjects\\__wine_user_shared_data" );
NTSTATUS status; NTSTATUS status;
HANDLE handle; HANDLE handle;
ULONG i, machines[8]; ULONG i;
HANDLE process = 0; HANDLE process = 0;
InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL ); InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, NULL, NULL );
...@@ -446,9 +447,9 @@ static void create_user_shared_data(void) ...@@ -446,9 +447,9 @@ static void create_user_shared_data(void)
if (!NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), if (!NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
machines, sizeof(machines), NULL )) 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: case IMAGE_FILE_MACHINE_ARMNT:
features[PF_ARM_VFP_32_REGISTERS_AVAILABLE] = TRUE; features[PF_ARM_VFP_32_REGISTERS_AVAILABLE] = TRUE;
...@@ -1596,12 +1597,12 @@ static void update_wineprefix( BOOL force ) ...@@ -1596,12 +1597,12 @@ static void update_wineprefix( BOOL force )
if (update_timestamp( config_dir, st.st_mtime ) || force) if (update_timestamp( config_dir, st.st_mtime ) || force)
{ {
ULONG machines[8]; SYSTEM_SUPPORTED_PROCESSOR_ARCHITECTURES_INFORMATION machines[8];
HANDLE process = 0; HANDLE process = 0;
DWORD count = 0; DWORD count = 0;
if (NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process), 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 ))) if ((process = start_rundll32( inf_path, L"PreInstall", IMAGE_FILE_MACHINE_TARGET_HOST )))
{ {
...@@ -1619,11 +1620,11 @@ static void update_wineprefix( BOOL force ) ...@@ -1619,11 +1620,11 @@ static void update_wineprefix( BOOL force )
} }
CloseHandle( process ); CloseHandle( process );
} }
if (!machines[count]) break; if (!machines[count].Machine) break;
if (HIWORD(machines[count]) & 4 /* native machine */) if (machines[count].Native)
process = start_rundll32( inf_path, L"DefaultInstall", IMAGE_FILE_MACHINE_TARGET_HOST ); process = start_rundll32( inf_path, L"DefaultInstall", IMAGE_FILE_MACHINE_TARGET_HOST );
else else
process = start_rundll32( inf_path, L"Wow64Install", LOWORD(machines[count]) ); process = start_rundll32( inf_path, L"Wow64Install", machines[count].Machine );
count++; count++;
} }
DestroyWindow( hwnd ); DestroyWindow( hwnd );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment