在masm32中擷取IE版本的方法2

來源:互聯網
上載者:User
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; 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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.