其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
[原创]用MASM32获取windows类型

作者:未知 来源:月光软件站 加入时间:2005-5-13 月光软件站

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;Function: Display the Windows type
; Author:purple endurer
; Develop: MASM32 V8
;Log
;------------------------------------
; 2005-04-29 Create
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.386
.model flatstdcall
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 GetVersionExADDR g_OsVerInfo
    .if eax != 0
        invoke GetWinType
        invoke MessageBox, NULL, eaxeax, 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    ;用ebx作为临时变量
    mov eaxOFFSET g_szUnknow;假设返回值为Unknow
    mov ebx, g_OsVerInfo.dwPlatformId
    .if  ebx==1
        mov ebx, g_OsVerInfo.dwMinorVersion
        .IF ebx==0
            mov eaxOFFSET g_szWin95
        .ELSEIF ebx==10
            mov eaxOFFSET g_szWin98
        .ELSEIF ebx==90
            mov eaxOFFSET g_szWinMe
        .ENDIF
    .elseif ebx==2
        mov ebx, g_OsVerInfo.dwMajorVersion
        .IF ebx==3
            mov eaxOFFSET g_szWinNT351
        .ELSEIF ebx==4
            mov eaxOFFSET g_szWinNT40
        .ELSEIF ebx==5
            mov ebx, g_OsVerInfo.dwMinorVersion
            .if ebx==0
                mov eaxOFFSET g_szWin2000
            .elseif ebx==1
                mov eaxOFFSET g_szWinXP
            .elseif ebx==2
                mov eaxOFFSET g_szWin2003
            .endif
        .ENDIF
    .endif

    pop ebx

    ret
GetWinType endp

end start



相关文章

相关软件