- Implement RtlGetVersion.
authorFilip Navara <filip.navara@gmail.com>
Mon, 8 Mar 2004 08:05:27 +0000 (08:05 +0000)
committerFilip Navara <filip.navara@gmail.com>
Mon, 8 Mar 2004 08:05:27 +0000 (08:05 +0000)
- 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
reactos/drivers/video/videoprt/videoprt.h
reactos/ntoskrnl/Makefile
reactos/ntoskrnl/ntoskrnl.def
reactos/ntoskrnl/ntoskrnl.edf
reactos/ntoskrnl/rtl/version.c [new file with mode: 0644]

index e144dca..8e74b31 100644 (file)
@@ -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
index 5b581cb..4d358af 100644 (file)
@@ -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 <ddk/video.h>
 #include <ddk/ntddvdeo.h>
 #include "internal/ps.h"
-#define NDEBUG
+/* #define NDEBUG */
 #include <debug.h>
 
 /*
index 73e607e..3ec1c62 100644 (file)
@@ -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
 
index ecedab6..55ad8d0 100644 (file)
@@ -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
index b637686..689c707 100644 (file)
@@ -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 (file)
index 0000000..0f483fd
--- /dev/null
@@ -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 <ddk/ntddk.h>
+#include <internal/safe.h>
+
+/* 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 */