|
Forum
|
|
|
How to check for XP or Vista, what is the smallest quickest dirtiest way to check if the system is running vista or xp, sort of like determining if 9x or NT
|
|
| ragdog |
|

Extremely Active Member
     
Group: Moderators
Posts: 874
Member No.: 5019
Joined: 13-May 07

|
Hi willy
What mean you with check a os detection?
| CODE | GetWinOS proc oBuF:DWORD Local osvi:OSVERSIONINFOEX mov osvi.dwOSVersionInfoSize,SIZEOF OSVERSIONINFO invoke GetVersionEx, ADDR osvi
.if osvi.dwPlatformId == VER_PLATFORM_WIN32_NT .if osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 .if osvi.wProductType==VER_NT_WORKSTATION invoke lstrcpy,oBuF,CTEXT("Microsoft Windows Vista") .else invoke lstrcpy,oBuF,CTEXT("Microsoft Windows Server 2008") .endif .elseif osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 invoke lstrcpy,oBuF,CTEXT("Microsoft Windows Server 2003") .elseif osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 invoke lstrcpy,oBuF,CTEXT("Microsoft Windows XP ") .elseif osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 invoke lstrcpy,oBuF,CTEXT("Microsoft Windows 2000 ") .elseif osvi.dwMajorVersion <= 4 invoke lstrcpy,oBuF,CTEXT("Microsoft Windows NT ") .endif .endif ret GetWinOS endp
|
or this
| CODE | .386 .model flat,stdcall option casemap:none
include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib
.data
Caption db "OS version Checking!",0 Msg db "It's based on NT",0 Msg2 db "It's based on 9x",0
.code start:
mov ecx,cs xor cl,cl jecxz @NT
invoke MessageBox,NULL,addr Msg2,addr Caption,MB_OK nop nop nop nop nop invoke ExitProcess,0
@NT: invoke MessageBox,NULL,addr Msg,addr Caption,MB_OK
invoke ExitProcess,0
end start |
and here is a big routine with very many Os version
Attached File ( Number of downloads: 27 )
Login or Register to download
|
| |
|
|
|
| ragdog |
|

Extremely Active Member
     
Group: Moderators
Posts: 874
Member No.: 5019
Joined: 13-May 07

|
Hi
How can i detect os if Win7
| CODE | ;updated OSVERSIONEX structure
OSVERSIONINFOEXnew STRUCT dwOSVersionInfoSize dd ? dwMajorVersion dd ? dwMinorVersion dd ? dwBuildNumber dd ? dwPlatformId dd ? szCSDVersion db 128 dup(?) wServicePackMajor dw ? wServicePackMinor dw ? wSuiteMask dw ? wProductType db ? wReserved db ? OSVERSIONINFOEXnew ENDS
GetWinOS proc oBuF:DWORD Local osvi:OSVERSIONINFOEXnew mov osvi.dwOSVersionInfoSize,SIZEOF OSVERSIONINFO invoke GetVersionEx, ADDR osvi
.if osvi.dwPlatformId == VER_PLATFORM_WIN32_NT .if osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1
.if osvi.wProductType == VER_NT_WORKSTATION INVOKE MessageBox,0,CTEXT("Microsoft Windows 7"),0,MB_OK .elseif osvi.wProductType != VER_NT_WORKSTATION INVOKE MessageBox,0,CTEXT("Microsoft Windows Server 2008"),0,MB_OK .endif
.endif .endif ret GetWinOS endp
|
I have read by msdn with osvi.wProductType == VER_NT_WORKSTATION call my procedur i get Microsoft Windows Server 2008 I have win7 ultimate installed
|
| |
|
|
|
| ragdog |
|

Extremely Active Member
     
Group: Moderators
Posts: 874
Member No.: 5019
Joined: 13-May 07

|
| CODE | GetWinOS proc Local osvi:OSVERSIONINFOEXnew
INVOKE RtlZeroMemory, ADDR osvi, SIZEOF OSVERSIONINFOEX mov osvi.dwOSVersionInfoSize,SIZEOF OSVERSIONINFOEX invoke GetVersionEx, ADDR osvi .IF (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion > 3) ; This program does not support dwMajorVersion less than 4 .IF (osvi.dwMajorVersion == 6) .IF (osvi.dwMinorVersion == 0) ; Windows Vista or Windows Server 2008 .IF osvi.wProductType == VER_NT_WORKSTATION invoke MessageBox,0, CTEXT("Windows Vista "),0,MB_OK .ELSE invoke MessageBox,0, CTEXT("Windows Server 2008"),0,MB_OK .ENDIF .ELSEIF (osvi.dwMinorVersion == 1) ; Windows 7 or Windows Server 2008 R2 .IF osvi.wProductType == VER_NT_WORKSTATION invoke MessageBox,0, CTEXT("Windows 7 "),0,MB_OK .ELSE invoke MessageBox,0, CTEXT("Windows Server 2008 R2"),0,MB_OK .ENDIF .ENDIF .endif .endif ret GetWinOS endp
|
|
| |
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|
|
|