ReactOS  0.4.14-dev-614-gbfd8a84
rtl.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel - Vista+ APIs
3  * LICENSE: GPL v2 - See COPYING in the top level directory
4  * FILE: lib/drivers/ntoskrnl_vista/rtl.c
5  * PURPOSE: Implementation of RtlIsNtDdiVersionAvailable and RtlIsServicePackVersionInstalled
6  * PROGRAMMERS: Pierre Schweitzer <pierre@reactos.org>
7  */
8 
9 #include <ntdef.h>
10 #include <ntifs.h>
11 
12 BOOLEAN
15 {
16  UNICODE_STRING ImportName;
17  ULONG Major, Minor, Current;
18  BOOLEAN (NTAPI *pRtlIsNtDdiVersionAvailable)(ULONG Version);
19 
20  /* Try to use ntoskrnl version if available */
21  RtlInitUnicodeString(&ImportName, L"RtlIsNtDdiVersionAvailable");
22  pRtlIsNtDdiVersionAvailable = MmGetSystemRoutineAddress(&ImportName);
23  if (pRtlIsNtDdiVersionAvailable)
24  {
25  return pRtlIsNtDdiVersionAvailable(Version);
26  }
27 
28  /* Only provide OS version. No SP */
29  if (SPVER(Version) || SUBVER(Version))
30  {
31  return FALSE;
32  }
33 
34  /* Compute the version and compare */
35  Major = 0;
36  Minor = 0;
37  PsGetVersion(&Major, &Minor, NULL, NULL);
38  Current = (Minor + (Major << 8)) << 16;
39 
40  return (Current >= Version);
41 }
_Out_opt_ PULONG Minor
Definition: cmfuncs.h:44
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define SPVER(Version)
Definition: sdkddkver.h:128
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3417
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI RtlInitUnicodeString(IN OUT PUNICODE_STRING DestinationString, IN PCWSTR SourceString)
Definition: rtl.c:27
#define PsGetVersion(a, b, c, d)
Definition: env_spec_w32.h:83
static BOOLEAN
Definition: rtl.c:97
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN WdmlibRtlIsNtDdiVersionAvailable(_In_ ULONG Version)
Definition: rtl.c:13
#define _In_
Definition: no_sal2.h:204
unsigned int ULONG
Definition: retypes.h:1
#define SUBVER(Version)
Definition: sdkddkver.h:129