From 17ad90f8d0b873d8d8d193ac1989377b27ef2ed6 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Mon, 8 Mar 2004 08:05:27 +0000 Subject: [PATCH] - Implement RtlGetVersion. - Rewrite VideoPortGetVersion using RtlGetVersion. - Added debugging messages to InternalMapMemory. - Changed VideoPortAllocateBuffer back to PagedPool. svn path=/trunk/; revision=8585 --- reactos/drivers/video/videoprt/videoprt.c | 44 ++++++++-------- reactos/drivers/video/videoprt/videoprt.h | 4 +- reactos/ntoskrnl/Makefile | 3 +- reactos/ntoskrnl/ntoskrnl.def | 3 +- reactos/ntoskrnl/ntoskrnl.edf | 3 +- reactos/ntoskrnl/rtl/version.c | 63 +++++++++++++++++++++++ 6 files changed, 94 insertions(+), 26 deletions(-) create mode 100644 reactos/ntoskrnl/rtl/version.c diff --git a/reactos/drivers/video/videoprt/videoprt.c b/reactos/drivers/video/videoprt/videoprt.c index e144dca997e..8e74b316d1f 100644 --- a/reactos/drivers/video/videoprt/videoprt.c +++ b/reactos/drivers/video/videoprt/videoprt.c @@ -18,7 +18,7 @@ * If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: videoprt.c,v 1.11 2004/03/08 04:41:20 jimtabor Exp $ + * $Id: videoprt.c,v 1.12 2004/03/08 08:05:26 navaraf Exp $ */ #include "videoprt.h" @@ -1266,6 +1266,9 @@ InternalMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, PVOID MappedAddress; PLIST_ENTRY Entry; + DPRINT("- IoAddress: %lx\n", IoAddress.u.LowPart); + DPRINT("- NumberOfUchars: %lx\n", NumberOfUchars); + DPRINT("- InIoSpace: %c\n", InIoSpace); if (0 != (InIoSpace & VIDEO_MEMORY_SPACE_P6CACHE)) { DPRINT("VIDEO_MEMORY_SPACE_P6CACHE not supported, turning off\n"); @@ -1411,7 +1414,7 @@ VideoPortAllocateBuffer(IN PVOID HwDeviceExtension, { DPRINT("VideoPortAllocateBuffer()\n"); - Buffer = ExAllocatePool (NonPagedPool, Size) ; + Buffer = ExAllocatePool(PagedPool, Size); return STATUS_SUCCESS; } @@ -1605,25 +1608,24 @@ STDCALL VideoPortGetVersion ( IN PVOID HwDeviceExtension, IN OUT PVPOSVERSIONINFO VpOsVersionInfo ) { - PPEB Peb; - - DPRINT1("VideoPortGetVersion()\n"); - if(KeGetCurrentIrql() == PASSIVE_LEVEL) - { - if(VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO)) - { - Peb = NtCurrentPeb(); - VpOsVersionInfo->MajorVersion = Peb->OSMajorVersion; - VpOsVersionInfo->MinorVersion = Peb->OSMinorVersion; - VpOsVersionInfo->BuildNumber = Peb->OSBuildNumber; - VpOsVersionInfo->ServicePackMajor = Peb->SPMajorVersion; - VpOsVersionInfo->ServicePackMinor = Peb->SPMinorVersion; - return STATUS_SUCCESS; - } - else - return ERROR_INVALID_PARAMETER; - } - return STATUS_UNSUCCESSFUL; + RTL_OSVERSIONINFOEXW Version; + + Version.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW); + if (VpOsVersionInfo->Size >= sizeof(VPOSVERSIONINFO)) + { + if (NT_SUCCESS(RtlGetVersion((PRTL_OSVERSIONINFOW)&Version))) + { + VpOsVersionInfo->MajorVersion = Version.dwMajorVersion; + VpOsVersionInfo->MinorVersion = Version.dwMinorVersion; + VpOsVersionInfo->BuildNumber = Version.dwBuildNumber; + VpOsVersionInfo->ServicePackMajor = Version.wServicePackMajor; + VpOsVersionInfo->ServicePackMinor = Version.wServicePackMinor; + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; + } + + return ERROR_INVALID_PARAMETER; } PVOID diff --git a/reactos/drivers/video/videoprt/videoprt.h b/reactos/drivers/video/videoprt/videoprt.h index 5b581cb0acd..4d358afacc6 100644 --- a/reactos/drivers/video/videoprt/videoprt.h +++ b/reactos/drivers/video/videoprt/videoprt.h @@ -18,7 +18,7 @@ * If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: videoprt.h,v 1.4 2004/03/07 04:43:55 dwelch Exp $ + * $Id: videoprt.h,v 1.5 2004/03/08 08:05:26 navaraf Exp $ */ #ifndef VIDEOPRT_H @@ -28,7 +28,7 @@ #include #include #include "internal/ps.h" -#define NDEBUG +/* #define NDEBUG */ #include /* diff --git a/reactos/ntoskrnl/Makefile b/reactos/ntoskrnl/Makefile index 73e607e5880..3ec1c62db62 100644 --- a/reactos/ntoskrnl/Makefile +++ b/reactos/ntoskrnl/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.116 2004/03/02 22:36:17 dwelch Exp $ +# $Id: Makefile,v 1.117 2004/03/08 08:05:27 navaraf Exp $ # # ReactOS Operating System # @@ -121,6 +121,7 @@ OBJECTS_RTL = \ rtl/time.o \ rtl/timezone.o \ rtl/unicode.o \ + rtl/version.o \ rtl/wstring.o \ rtl/capture.o diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index ecedab6c9e6..55ad8d0c3d7 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.177 2004/03/07 20:31:53 navaraf Exp $ +; $Id: ntoskrnl.def,v 1.178 2004/03/08 08:05:27 navaraf Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -777,6 +777,7 @@ RtlGetDefaultCodePage@8 ;RtlGetElementGenericTable RtlGetGroupSecurityDescriptor@12 RtlGetOwnerSecurityDescriptor@12 +RtlGetVersion@4 RtlImageNtHeader@4 RtlImageDirectoryEntryToData@16 RtlInitAnsiString@8 diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index b6376860b5b..689c7077100 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.edf,v 1.163 2004/03/07 20:31:53 navaraf Exp $ +; $Id: ntoskrnl.edf,v 1.164 2004/03/08 08:05:27 navaraf Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -778,6 +778,7 @@ RtlGetDefaultCodePage=RtlGetDefaultCodePage@8 ;RtlGetElementGenericTable RtlGetGroupSecurityDescriptor=RtlGetGroupSecurityDescriptor@12 RtlGetOwnerSecurityDescriptor=RtlGetOwnerSecurityDescriptor@12 +RtlGetVersion=RtlGetVersion@4 RtlImageNtHeader=RtlImageNtHeader@4 RtlImageDirectoryEntryToData=RtlImageDirectoryEntryToData@16 RtlInitAnsiString=RtlInitAnsiString@8 diff --git a/reactos/ntoskrnl/rtl/version.c b/reactos/ntoskrnl/rtl/version.c new file mode 100644 index 00000000000..0f483fd527b --- /dev/null +++ b/reactos/ntoskrnl/rtl/version.c @@ -0,0 +1,63 @@ +/* + * ReactOS kernel + * Copyright (C) 2004 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id: version.c,v 1.1 2004/03/08 08:05:27 navaraf Exp $ + * + * PROJECT: ReactOS kernel + * PURPOSE: Runtime code + * FILE: ntoskrnl/rtl/version.c + * PROGRAMER: Filip Navara + */ + +/* INCLUDES *****************************************************************/ + +#define __USE_W32API +#include +#include + +/* FUNCTIONS ****************************************************************/ + +NTSTATUS STDCALL +RtlGetVersion(RTL_OSVERSIONINFOW *Info) +{ + PWCHAR CSDString = L"Service Pack 6"; + + if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) || + Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW)) + { + Info->dwMajorVersion = 4; + Info->dwMinorVersion = 0; + Info->dwBuildNumber = 1381; + Info->dwPlatformId = VER_PLATFORM_WIN32_NT; + MmCopyToCaller(Info->szCSDVersion, CSDString, sizeof(CSDString)); + if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW)) + { + RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)Info; + InfoEx->wServicePackMajor = 6; + InfoEx->wServicePackMinor = 0; + InfoEx->wSuiteMask = 0; + InfoEx->wProductType = VER_NT_WORKSTATION; + } + + return STATUS_SUCCESS; + } + + return STATUS_INVALID_PARAMETER; +} + +/* EOF */