mirror of
https://github.com/reactos/reactos.git
synced 2026-07-07 10:40:20 +08:00
* lib/kernel32/k32.h: New file. * lib/kernel32/makefile (TARGET_CFLAGS): Add -I./. (TARGET_PCH): Set to k32.h. * lib/kernel32/except/except.c: Use <k32.h>. * lib/kernel32/file/backup.c: Ditto. * lib/kernel32/file/cnotify.c: Ditto. * lib/kernel32/file/copy.c: Ditto. * lib/kernel32/file/create.c: Ditto. * lib/kernel32/file/curdir.c: Ditto. * lib/kernel32/file/delete.c: Ditto. * lib/kernel32/file/deviceio.c: Ditto. * lib/kernel32/file/dir.c: Ditto. * lib/kernel32/file/dosdev.c: Ditto. * lib/kernel32/file/file.c: Ditto. * lib/kernel32/file/find.c: Ditto. * lib/kernel32/file/iocompl.c: Ditto. * lib/kernel32/file/lfile.c: Ditto. * lib/kernel32/file/lock.c: Ditto. * lib/kernel32/file/mailslot.c: Ditto. * lib/kernel32/file/move.c: Ditto. * lib/kernel32/file/npipe.c: Ditto. * lib/kernel32/file/pipe.c: Ditto. * lib/kernel32/file/rw.c: Ditto. * lib/kernel32/file/tape.c: Ditto. * lib/kernel32/file/volume.c: Ditto. * lib/kernel32/mem/global.c: Ditto. * lib/kernel32/mem/heap.c: Ditto. * lib/kernel32/mem/isbad.c: Ditto. * lib/kernel32/mem/local.c: Ditto. * lib/kernel32/mem/procmem.c: Ditto. * lib/kernel32/mem/section.c: Ditto. * lib/kernel32/mem/virtual.c: Ditto. * lib/kernel32/misc/atom.c: Ditto. * lib/kernel32/misc/comm.c: Ditto. * lib/kernel32/misc/console.c: Ditto. * lib/kernel32/misc/debug.c: Ditto. * lib/kernel32/misc/dllmain.c: Ditto. * lib/kernel32/misc/env.c: Ditto. * lib/kernel32/misc/error.c: Ditto. * lib/kernel32/misc/handle.c: Ditto. * lib/kernel32/misc/ldr.c: Ditto. * lib/kernel32/misc/profile.c: Ditto. * lib/kernel32/misc/res.c: Ditto. * lib/kernel32/misc/stubs.c: Ditto. * lib/kernel32/misc/sysinfo.c: Ditto. * lib/kernel32/misc/time.c: Ditto. * lib/kernel32/process/cmdline.c: Ditto. * lib/kernel32/process/create.c: Ditto. * lib/kernel32/process/proc.c: Ditto. * lib/kernel32/process/session.c: Ditto. * lib/kernel32/string/lstring.c: Ditto. * lib/kernel32/synch/critical.c: Ditto. * lib/kernel32/synch/event.c: Ditto. * lib/kernel32/synch/intrlck.c: Ditto. * lib/kernel32/synch/mutex.c: Ditto. * lib/kernel32/synch/sem.c: Ditto. * lib/kernel32/synch/timer.c: Ditto. * lib/kernel32/synch/wait.c: Ditto. * lib/kernel32/thread/fiber.c: Ditto. * lib/kernel32/thread/thread.c: Ditto. * lib/kernel32/thread/tls.c: Ditto. svn path=/trunk/; revision=4009
124 lines
2.7 KiB
C
124 lines
2.7 KiB
C
/* $Id: sysinfo.c,v 1.6 2003/01/15 21:24:35 chorns Exp $
|
|
*
|
|
* reactos/lib/kernel32/misc/sysinfo.c
|
|
*
|
|
*/
|
|
#include <k32.h>
|
|
|
|
#define NDEBUG
|
|
#include <kernel32/kernel32.h>
|
|
|
|
|
|
#define PV_NT351 0x00030033
|
|
|
|
VOID
|
|
STDCALL
|
|
GetSystemInfo (
|
|
LPSYSTEM_INFO Si
|
|
)
|
|
{
|
|
SYSTEM_BASIC_INFORMATION Sbi;
|
|
SYSTEM_PROCESSOR_INFORMATION Spi;
|
|
DWORD ProcessVersion;
|
|
NTSTATUS Status;
|
|
|
|
RtlZeroMemory (Si, sizeof (SYSTEM_INFO));
|
|
Status = NtQuerySystemInformation (
|
|
SystemBasicInformation, /* 0 */
|
|
& Sbi,
|
|
sizeof Sbi, /* 44 */
|
|
0
|
|
);
|
|
if (STATUS_SUCCESS != Status)
|
|
{
|
|
SetLastErrorByStatus (Status);
|
|
return;
|
|
}
|
|
Status = NtQuerySystemInformation (
|
|
SystemProcessorInformation, /* 1 */
|
|
& Spi,
|
|
sizeof Spi, /* 12 */
|
|
0
|
|
);
|
|
if (STATUS_SUCCESS != Status)
|
|
{
|
|
SetLastErrorByStatus (Status);
|
|
return;
|
|
}
|
|
/*
|
|
* PROCESSOR_ARCHITECTURE_INTEL 0
|
|
* PROCESSOR_ARCHITECTURE_MIPS 1
|
|
* PROCESSOR_ARCHITECTURE_ALPHA 2
|
|
* PROCESSOR_ARCHITECTURE_PPC 3
|
|
* PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
|
|
*/
|
|
Si->u.s.wProcessorArchitecture = Spi.ProcessorArchitecture;
|
|
/* For future use: always zero */
|
|
Si->u.s.wReserved = 0;
|
|
Si->dwPageSize = Sbi.PageSize;
|
|
Si->lpMinimumApplicationAddress = (PVOID)Sbi.MinimumUserModeAddress;
|
|
Si->lpMaximumApplicationAddress = (PVOID)Sbi.MaximumUserModeAddress;
|
|
Si->dwActiveProcessorMask = Sbi.ActiveProcessorsAffinityMask;
|
|
Si->dwNumberOfProcessors = Sbi.NumberOfProcessors;
|
|
/*
|
|
* Compatibility (no longer relevant):
|
|
* PROCESSOR_INTEL_386 386
|
|
* PROCESSOR_INTEL_486 486
|
|
* PROCESSOR_INTEL_PENTIUM 586
|
|
* PROCESSOR_MIPS_R4000 4000
|
|
* PROCESSOR_ALPHA_21064 21064
|
|
*/
|
|
switch (Spi.ProcessorArchitecture)
|
|
{
|
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
|
switch (Spi.ProcessorLevel)
|
|
{
|
|
case 3:
|
|
Si->dwProcessorType = PROCESSOR_INTEL_386;
|
|
break;
|
|
case 4:
|
|
Si->dwProcessorType = PROCESSOR_INTEL_486;
|
|
break;
|
|
case 5:
|
|
Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
|
|
break;
|
|
default:
|
|
/* FIXME: P2, P3, P4...? */
|
|
Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
|
|
}
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_MIPS:
|
|
Si->dwProcessorType = PROCESSOR_MIPS_R4000;
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_ALPHA:
|
|
Si->dwProcessorType = PROCESSOR_ALPHA_21064;
|
|
break;
|
|
|
|
case PROCESSOR_ARCHITECTURE_PPC:
|
|
Si->dwProcessorType = -1; /* FIXME: what value? */
|
|
break;
|
|
|
|
}
|
|
/* Once hardcoded to 64kb */
|
|
Si->dwAllocationGranularity = Sbi.AllocationGranularity;
|
|
/* */
|
|
Si->wProcessorLevel = Spi.ProcessorLevel;
|
|
Si->wProcessorRevision = Spi.ProcessorRevision;
|
|
/*
|
|
* Get the version of Windows on which
|
|
* the process expects to run.
|
|
*/
|
|
ProcessVersion = GetProcessVersion (0); /* current process */
|
|
/* In NT 3.1 and 3.5 these fields were always zero. */
|
|
if (PV_NT351 > ProcessVersion)
|
|
{
|
|
Si->wProcessorLevel = 0;
|
|
Si->wProcessorRevision = 0;
|
|
}
|
|
}
|
|
|
|
|
|
/* EOF */
|