;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Filename: getIEver1.asm
; Function: get & display version of IE
; Author: purple endurer
; Develop: win 2K pro + masm32
; log
;---------------------------------------------------------;2005.10.23 Created!
; Use the version of file shlwapi.dll as the IE version.
; In my PC, the version of IE is 6.0.2800.1106
; and the version of shlwapi.dll is 6.0.2800.1740,
; but this program displayed version is 6.0.2800,
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;下载:您可以到http://purpleendurer.ys168.com的/myworks/demo_only中
;下载源代码和可执行文件
.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
GetIEVerStr PROTO :LPSTR
m_m2m MACRO d1, d2
push d2
pop d1
ENDM
DllVersionInfo STRUCT
cbSize dword ?
dwMajorVersion dword ?
dwMinorVersion dword ?
dwBuildNumber dword ?
dwPlatformID dword ?
DllVersionInfo ENDS
.data
g_szTitle db "IE版本", 0
g_fmt4IEVer db "Internet Explorer %d.%d.%d", 0
g_FailLoadDLL db "不能装载"
g_szShlwapiDLL db "shlwapi.dll", 0
g_FailGetProcAddr db "不能获取函数"
g_szDllGetVersion db "DllGetVersion", 0
.data?
g_szIEVer db 256 dup(?)
g_DVI DllVersionInfo <?>
g_lpfnDllGetVersion DWORD ?
g_hDll HANDLE ?
.code
start:
m_m2m g_DVI.cbSize, SIZEOF g_DVI
invoke GetIEVerStr, ADDR g_szIEVer
.if eax==1
mov eax, OFFSET g_FailLoadDLL
.elseif eax==2
mov eax, OFFSET g_FailGetProcAddr
.else
mov eax, OFFSET g_szIEVer
.endif
invoke MessageBox, NULL, eax, OFFSET g_szTitle, MB_OK
invoke ExitProcess,NULL
GetIEVerStr PROC lpszIEVer: LPSTR
invoke LoadLibrary, ADDR g_szShlwapiDLL
mov g_hDll, eax
.if eax==NULL
m_m2m eax, 1
ret
.endif
invoke GetProcAddress, g_hDll, ADDR g_szDllGetVersion
mov g_lpfnDllGetVersion,eax
.if eax==NULL
invoke FreeLibrary, g_hDll
m_m2m eax, 2
ret
.endif
;m_m2m DVI.cbSize, SIZEOF g_DVI
push OFFSET g_DVI
call g_lpfnDllGetVersion
invoke wsprintf, lpszIEVer, ADDR g_fmt4IEVer, g_DVI.dwMajorVersion, g_DVI.dwMinorVersion, g_DVI.dwBuildNumber
invoke FreeLibrary, g_hDll
xor eax, eax ;m_m2m eax, 0
ret
GetIEVerStr ENDP
end start