GetOSinfo تحديد نسخة النظام & BuildNumber
#1
السلام عليكم و رحمة الله و بركاته
- تحديد نسخة النظام المستخدم من الكيرنل , RtlGetVersion & NtBuilder
PHP كود :
{*******************************************************}
{       
Open source sample.                             }
{       
Free to use.                                    }
{       
Coded By TF6M | 22-11-2010 Www.Delphi4Arab.Com  }
{*******************************************************}
Unit GetOSinfo;
{
$WARNINGS OFF}{$HINTS OFF}
{
$OPTIMIZATION ON}{$OverFlowChecks Off}
interface

Uses nt_status, ntoskrnl;

function 
_DriverEntry(DriverObject:PDriverObject;
                      
RegistryPath:PUnicodeString
                      
):NTSTATUS; stdcall;

implementation
    
procedure DriverUnload
(DriverObject:PDriverObject); stdcall;
begin
 DbgPrint
('Unload Routine Called !!!');
end;

Function 
_DriverEntry(DriverObject:PDriverObject;RegistryPath:PUnicodeString):NTSTATUS; stdcall;
Var
 
_Rtk:RTL_OSVERSIONINFOEXW;
 
_Os:ANSI_STRING;
begin
 DriverObject
^.DriverUnload:=@DriverUnload;
 
Result:= STATUS_SUCCESS;
 
DbgPrint('DriverEntry Routine Called With Code Error : 0x%.8X',Result);
 
//RtlZeroMemory(@_Rtk,SizeOf(_Rtk));
 
_Rtk.dwOSVersionInfoSize:= SizeOf(RTL_OSVERSIONINFOEXW);
 If 
RtlGetVersion(PRTL_OSVERSIONINFOW(@_Rtk)) = STATUS_SUCCESS Then
  Begin
   
If (_Rtk.dwMajorVersion = 5) And (_Rtk.dwMinorVersion = 1) Then
    RtlInitAnsiString
(@_Os,'Microsoft Windows XP');
   If (
_Rtk.dwMajorVersion = 5) And (_Rtk.dwMinorVersion = 2) Then
    RtlInitAnsiString
(@_Os,'Microsoft Windows Server 2003');
   If (
_Rtk.dwMajorVersion = 6) And (_Rtk.dwMinorVersion = 0) Then
    RtlInitAnsiString
(@_Os,'Microsoft Windows Vista');
   If (
_Rtk.dwMajorVersion = 6) And (_Rtk.dwMinorVersion = 1) Then
    RtlInitAnsiString
(@_Os,'Microsoft Windows 7');
  
DbgPrint('Your OS Version is %Z < %ld.%ld.%ld > Service Pack %d.%d '
   
,@_Os,_Rtk.dwMajorVersion,_Rtk.dwMinorVersion,_Rtk.dwBuildNumber
   
,_Rtk.wServicePackMajor,_Rtk.wServicePackMinor);
  
End;
end;
end. 
- إعادة تعريف للـ RtlGetVersion : الملفات المصدرية غير مرفقة مع Meerkat

كود :
Type _OSVERSIONINFOW = Record dwOSVersionInfoSize :ULONG; dwMajorVersion :ULONG ; dwMinorVersion :ULONG ; dwBuildNumber :ULONG ; dwPlatformId :ULONG ; szCSDVersion :Array [0..127] Of WCHAR; End; RTL_OSVERSIONINFOW = _OSVERSIONINFOW; PRTL_OSVERSIONINFOW = ^RTL_OSVERSIONINFOW; Function RtlGetVersion(lpVersionInformation :PRTL_OSVERSIONINFOW ) :NTSTATUS;StdCall; implementation Function RtlGetVersion; external NtKernel name '_RtlGetVersion';
القيم الممكنة هنا :

PHP كود :
NT 3.1  - 528
NT 3.5  
- 807
NT 3.51 
-1057
NT 4    
- 1381
NT 5.2 Windows Server 2003 3790
NT 5.2 Windows XP 
(x64)    3790 
NT 6.1 Windows 7
   
2195 
- Windows 2000
2600 
- Windows XP
3790 
- Windows 2003
4052 
- Windows Longhorn aka Vista PDC
5xxx 
- Windows Vista 
[صورة: sdfsd.gif]

بالتوفيق,,


الملفات المرفقة
.rar   GetOSinfo.rar (الحجم : 8.29 ك ب / التحميلات : 82)
I'M Fly Like A G6

الرد
#2
- كإظافة نستطيع إستخدام RTL_OSVERSIONINFOEXW
كود :
Type _OSVERSIONINFOEXW = Record dwOSVersionInfoSize :ULONG; dwMajorVersion :ULONG; dwMinorVersion :ULONG; dwBuildNumber :ULONG; dwPlatformId :ULONG; szCSDVersion :Array [0..127] Of WCHAR; wServicePackMajor :USHORT; wServicePackMinor :USHORT; wSuiteMask :USHORT; wProductType :UCHAR; wReserved :UCHAR; End; RTL_OSVERSIONINFOEXW = _OSVERSIONINFOEXW; PRTL_OSVERSIONINFOEXW = ^RTL_OSVERSIONINFOEXW;
- لتحديد wServicePackxxxx .
I'M Fly Like A G6

الرد
#3
وعليكم السلام ورحمة الله وبركاته
عمل ممتاز tf6m Smile
بالتوفيق.
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم