; <
; Function: display the Windows type
; Author: Purple endurer
; Develop: masm32 V8
; Log
;------------------------------------
; Create
; <
. 386
. Model flat, stdcall
Option Casemap: None
Include/masm32/include/Windows. inc
Include/masm32/include/kernel32.inc
Include/masm32/include/user32.inc
Includelib/masm32/lib/user32.lib
Includelib/masm32/lib/kernel32.lib
Getwintype proto
. Data
G_szwin95 DB "Windows 95", 0
G_szwin98 DB "Windows 98", 0
G_szwinme DB "Windows mellinnium", 0
G_szwinnt351 DB "Windows NT 3.51", 0
G_szwinnt40 DB "Windows NT 4.0", 0
G_szwin2000 DB "Windows 2000", 0
G_szwinxp DB "Windows XP", 0
G_szwin2003 DB "Windows Server 2003", 0
G_szunknow DB "unknow", 0
. Data?
G_osverinfo osversioninfo <>
. Code
Start:
MoV g_osverinfo.dwosversioninfosize, sizeof osversioninfo
Invoke getversionex, ADDR g_osverinfo
. If eax! = 0
Invoke getwintype
Invoke MessageBox, null, eax, eax, mb_ OK
. Endif
Invoke exitprocess, null
; //////////////////////////////////////// //
; Function: Get the Windows type
; Input: g_osverinfo
; Output: pointer to the string of Windows type
; //////////////////////////////////////// //
Getwintype proc
Push EBX; Use EBX as the Temporary Variable
MoV eax, offset g_szunknow; assume that the returned value is unknow.
MoV EBX, g_osverinfo.dwplatformid
. If EBX = 1
MoV EBX, g_osverinfo.dwminorversion
. If EBX = 0
MoV eax, offset g_szwin95
. Elseif EBX = 10
MoV eax, offset g_szwin98
. Elseif EBX = 90
MoV eax, offset g_szwinme
. Endif
. Elseif EBX = 2
MoV EBX, g_osverinfo.dwmajorversion
. If EBX = 3
MoV eax, offset g_szwinnt351
. Elseif EBX = 4
MoV eax, offset g_szwinnt40
. Elseif EBX = 5
MoV EBX, g_osverinfo.dwminorversion
. If EBX = 0
MoV eax, offset g_szwin2000
. Elseif EBX = 1
MoV eax, offset g_szwinxp
. Elseif EBX = 2
MoV eax, offset g_szwin2003
. Endif
. Endif
. Endif
Pop EBX
RET
Getwintype endp
End start