[Original] Use masm32 programming to obtain the Windows type

Source: Internet
Author: User
; <
; 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.