WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
Pages (2) [1] 2   ( Go to first unread post )

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

ChillyWilly
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 91
Member No.: 5730
Joined: 5-January 08


Whats the smallest quickest dirtiest way to check if the system is running vista or xp sort of like determining if 9x or nt
used to be
mov eax, ds
test al, 4
jz its_nt
PMEmail Poster
Top
ChillyWilly
Quote Post


Very Very Active Member
*****

Group: Members
Posts: 91
Member No.: 5730
Joined: 5-January 08


anyone?
PMEmail Poster
Top
ragdog
Quote Post


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
PMUsers Website
Top
ragdog
Quote Post


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 blink.gif
PMUsers Website
Top
ragdog
Quote Post


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
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages (2) [1] 2  Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google