Method 1 for obtaining and displaying ie versions in masm32

Source: Internet
Author: User

; <<
; Filename: getiever2.asm
; Function: Get & display version of IE
; Author: Purple endurer
; Develop: Win 2 K Pro + masm32
; Log
;------------------------------------------------------------------
; 2005.10.23 created!
; Get the version of IE from Value of key "vesion"
;/HKEY_LOCAL_MACHINE/software/Microsoft/Internet Explorer
; In my PC, the version of IE is 6.0.2800.1106
; And this program displayed version is 6.0.2800.1106
; <<
; Download: You can go to/myworks/demo_only in the http://purpleendurer.ys168.com
; Download source code and executable files

. 386
. Model flat, stdcall
Option Casemap: None
Include/masm32/include/Windows. inc

Include/masm32/include/advapi32.inc
Include/masm32/include/kernel32.inc
Include/masm32/include/user32.inc

Includelib/masm32/lib/advapi32.lib
Includelib/masm32/lib/kernel32.lib
Includelib/masm32/lib/user32.lib

Getieverstr proto: lpstr

M_m2m macro D1, D2
Push D2
Pop d1
Endm

. Data
G_sztitle DB "IE version", 0
G_szregpath DB "software/Microsoft/Internet Explorer", 0
G_szfailregopenkeyex DB "regopenkeyex failed! ", 0
G_szfailregqueryvalueex DB "regqueryvalueex failed! ", 0
G_szvaluename DB "version", 0

. Data?
G_sziever dB 256 DUP (?)
G_hregkey4ie hkey?
. Code
Start:
Invoke getieverstr, ADDR g_sziever
. If eax = 1
MoV eax, offset g_szfailregopenkeyex
. Elseif eax = 2
MoV eax, offset g_szfailregqueryvalueex
. Else
MoV eax, offset g_sziever
. Endif
Invoke MessageBox, null, eax, offset g_sztitle, mb_ OK

Invoke exitprocess, null

Getieverstr proc lpsziever: lpstr
Local dwcbdata: DWORD
; Long regopenkey (
; Hkey, // handle of open key
; Lpctstr lpsubkey, // address of name of subkey to open
; Phkey phkresult // address of handle of open key
;);

Invoke regopenkey, HKEY_LOCAL_MACHINE, ADDR g_szregpath, ADDR g_hregkey4ie
. If eax! = Error_success
M_m2m eax, 1
RET
. Endif

; Long regqueryvalueex (
; Hkey, // 1. Handle of key to query
; Lptstr lpvaluename, // 2. Address of name of value to query
; Lpdword lpreserved, // 3. Reserved
; Lpdword lptype, // 4. Address of buffer for Value Type
; Lpbyte lpdata, // 5. Address of Data Buffer
; Lpdword lpcbdata // 6. Address of data buffer size
;);

M_m2m dwcbdata, sizeof g_sziever
Invoke regqueryvalueex, g_hregkey4ie, ADDR g_szvaluename, null, null, ADDR g_sziever, ADDR dwcbdata

. If eax! = Error_success
M_m2m eax, 2
. Else
XOR eax, eax
. Endif

; Long regclosekey (
; Hkey // handle of key to close
;);
Invoke regclosekey, g_hregkey4ie


RET
Getieverstr 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.