KERNEL32.GetProcessVersion partial implementation.

KERNEL32.GetSystemInfo about finished.

svn path=/trunk/; revision=1612
This commit is contained in:
Emanuele Aliberti 2001-02-10 22:01:50 +00:00
parent 37361ed1e8
commit b611b79b36
3 changed files with 72 additions and 25 deletions

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.23 2001/01/20 12:19:57 ekohl Exp $ /* $Id: stubs.c,v 1.24 2001/02/10 22:01:50 ea Exp $
* *
* KERNEL32.DLL stubs (unimplemented functions) * KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them. * Remove from this file, if you implement them.
@ -1764,17 +1764,6 @@ GetProcessShutdownParameters (
} }
DWORD
STDCALL
GetProcessVersion (
DWORD Unknown0
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
WINBOOL WINBOOL
STDCALL STDCALL
GetProcessWorkingSetSize ( GetProcessWorkingSetSize (

View file

@ -1,4 +1,4 @@
/* $Id: sysinfo.c,v 1.2 2000/11/04 13:52:12 ekohl Exp $ /* $Id: sysinfo.c,v 1.3 2001/02/10 22:01:50 ea Exp $
* *
* reactos/lib/kernel32/misc/sysinfo.c * reactos/lib/kernel32/misc/sysinfo.c
* *
@ -8,6 +8,9 @@
#include <kernel32/kernel32.h> #include <kernel32/kernel32.h>
#include <kernel32/error.h> #include <kernel32/error.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define PV_NT351 0x00030033 #define PV_NT351 0x00030033
@ -61,34 +64,57 @@ GetSystemInfo (
Si->dwActiveProcessorMask = Sbi.ActiveProcessorsAffinityMask; Si->dwActiveProcessorMask = Sbi.ActiveProcessorsAffinityMask;
Si->dwNumberOfProcessors = Sbi.NumberOfProcessors; Si->dwNumberOfProcessors = Sbi.NumberOfProcessors;
/* /*
* Compatibility: * Compatibility (no longer relevant):
* PROCESSOR_INTEL_386 386 * PROCESSOR_INTEL_386 386
* PROCESSOR_INTEL_486 486 * PROCESSOR_INTEL_486 486
* PROCESSOR_INTEL_PENTIUM 586 * PROCESSOR_INTEL_PENTIUM 586
* PROCESSOR_MIPS_R4000 4000 * PROCESSOR_MIPS_R4000 4000
* PROCESSOR_ALPHA_21064 21064 * PROCESSOR_ALPHA_21064 21064
*/ */
#if 0
switch (Spi.ProcessorArchitecture) switch (Spi.ProcessorArchitecture)
{ {
case : case PROCESSOR_ARCHITECTURE_INTEL:
#endif switch (Spi.ProcessorLevel)
Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; {
#if 0 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; 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;
} }
#endif /* Once hardcoded to 64kb */
Si->dwAllocationGranularity = Sbi.AllocationGranularity; Si->dwAllocationGranularity = Sbi.AllocationGranularity;
/* */
Si->wProcessorLevel = Spi.ProcessorLevel;
Si->wProcessorRevision = Spi.ProcessorRevision; Si->wProcessorRevision = Spi.ProcessorRevision;
/* /*
* Get the version of Windows on which * Get the version of Windows on which
* the process expects to run. * the process expects to run.
*/ */
#if 0
ProcessVersion = GetProcessVersion (0); /* current process */ ProcessVersion = GetProcessVersion (0); /* current process */
#endif /* In NT 3.1 and 3.5 these fields were always zero. */
/* In NT 3.1, these fields were always zero. */
if (PV_NT351 > ProcessVersion) if (PV_NT351 > ProcessVersion)
{ {
Si->wProcessorLevel = 0; Si->wProcessorLevel = 0;

View file

@ -1,4 +1,4 @@
/* $Id: proc.c,v 1.37 2001/02/06 00:11:18 dwelch Exp $ /* $Id: proc.c,v 1.38 2001/02/10 22:01:50 ea Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -629,4 +629,36 @@ SetPriorityClass (
} }
DWORD
STDCALL
GetProcessVersion (
DWORD ProcessId
)
{
DWORD Version = 0;
PIMAGE_NT_HEADERS NtHeader = NULL;
PVOID BaseAddress = NULL;
/* Caller's */
if (0 == ProcessId)
{
BaseAddress = (PVOID) NtCurrentPeb()->ImageBaseAddress;
NtHeader = RtlImageNtHeader (BaseAddress);
if (NULL != NtHeader)
{
Version =
(NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16)
| (NtHeader->OptionalHeader.MinorOperatingSystemVersion);
}
}
else /* other process */
{
/* FIXME: open the other process */
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
}
return (Version);
}
/* EOF */ /* EOF */