您的位置:逆风者 汇编技术 正文
原作者:www.upwinder.com 添加时间:2007-09-02 原文发表:2007-08-31 人气:32 来源:未知

本文章共2695字,分2页,当前第1页,快速翻页:
 

---------------------------

dos下可以调用DOS中断服务程序,
WINDOWS下可以调用 API 函数GetVersionEx()

逆风者

这是我测试PE格式的STUB的源代码, 可以在DOS和WINDOWS下运行,其功能是报告当前OS信息.

; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; FileName: os_type.asm
; function: Reports current operation system type
; Author : Purple Endurer
; Version : 0.1
;
; OS Name Offset of INT 08h Offset of INT 43h
; -------------------------------------------------------
; MS DOS 7.00 001Fh 5710h
; MS DOS 7.10 18DEh 6EE5h
; UCDOS 1AF3h
; UCDOS98 1AEBh 6E20h
; MSDOS mode 0000h
; PDOS95 0A50h 6E20h
;
; Date Summary
; -------------------------------------------------------
; 2002.04.07 Created from software paper 95P125
; 2002.06.11 Show version if os is MS-DOS
; 2002.08.07 Convert it to DOS EXE format to be stub
; program in PE format execute file
; 2004.02.09 Added the condition asm var 'UseStack'
; Question:
; Why can this program run normally with stack segment,
; though there is push and pop instruction in bin2dec proc?

UseStack equ 0
data segment
strMSDOS db "MS DOS "
cMajorVer db ' '
db '.'
cMinorVer db " $"

strUCDOS db "UCDOS"
cUCDOSVer db " 98特别版$"

strPDOS95 db "Windows95中文DOS方式PDOS95$"
data ends

if UseStack
sseg segment stack
db 10 dup(?)
sseg ends
endif
code segment
;--------------------------------------
if UseStack
assume cs: code, ds: data, ss: sseg
else
assume cs: code, ds: data
endif

main proc
start:
mov ax, data
mov ds, ax

if UseStack
mov ax, sseg
mov ss, ax
endif

mov ah, 30h ; Get Version
int 21h
add al, '0'
mov cMajorVer, al
mov bx, offset cMinorVer
call bin2dec

mov ax, 3508h
int 21h

mov dx, offset strMSDOS
mov ah, 09h
int 21h

cmp bx, 1fh
je @end ;Here is DOS 7.00 only
cmp bx, 18deh
je @End ;Here is DOS 7.10 only

mov dx, offset strUCDOS
cmp bx, 1aebh
je @Report

cmp bx, 1af3h
jne @next2
mov cUCDOSVer, '$'
jmp @report

@next2:

mov dx, offset strPDOS95
cmp bx, 0a50h
jne @End
@Report:
;mov ah, 09h
int 21h
@End:
mov ax, 4c00h
int 21h
main endp

; ========================================================
; Input : AH = the Binary will be translated)
; BX = First offset of memory us to store the result
; Output: BX = First offset of memory stored the result
; --------------------------------------------------------
bin2dec proc
push dx
mov dl, 10
@LoopDiv:
mov al, ah
xor ah, ah
div dl ; (AL) <- (AX) / (DL) (AH) <- (AX) % (DL)
add al, '0'
mov [bx], al
inc bx
cmp ah, 10
jg @LoopDiv

add ah, '0'
mov [bx], ah
pop dx
ret
bin2dec endp
;=========================================
code ends
end main

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;FileName: StubDemo.asm
; Fuction: Demo how to use the custome stub of PE exe files.
; Author: Purple Endurer
stub
;The command line refered cursom STUB program:
;\masm32\bin\link /stub:<filename.exe> /subsystem:windows <objectname.obj>
;Example:
;D:\masm32v6\WORKS\my_stub>\masm32\bin\link /stub:stub.exe /subsystem:windows stubdemo.obj
 

本文章更多内容1 - 2 - 下一页>>
相关文章

汇编源码--drivesex
输入10进制,输出2进制
汇编源码--sound
DOS6.0源程序中的硬盘引导记录源程序FDBOOT
汇编语言制作的光带菜单及源程序(1.0)
GET TIME OF DAY(获取时间)
一个有趣的打字游戏
汇编源码--CLR
汇编源码--drives
汇编源码--cdcheck
MAKE SOUNDS (发声)
汇编源码--break
V86模式切换程序
汇编源码--CALC
汇编源码--CLOCK
FASTREBOOT V1.0
汇编源码--exec
CIH V1.5版本病毒源码
获取当前系统时间
The 808 Virus

相关评论


本文章所属分类:首页 汇编技术

  热门关键字:
进制数据输出的通用程序 2007-09-12
汇编源码--showmem 2007-08-31
汇编源码--CLEAN 2007-08-31
汇编源码--hdr 2007-08-31
汇编源码--basload 2007-08-31
汇编源码--CHAR 2007-08-31
汇编源码--fxn 2007-08-31
汇编源码--alarm 2007-08-31
汇编源码--getsect 2007-08-31
汇编源码--DEV 2007-08-31
汇编源码--getspace 2007-08-31
汇编源码--frespace 2007-08-31
CIH文件型病毒检测消除程序 2007-08-31
Mixer Volume Ctrler V1.0 2007-08-31
汇编源码--COMINT 2007-08-31
自己用汇编语言写的一个病毒(源码... 2007-08-31
汇编源码--col 2007-08-31
汇编源码--BURNOUT 2007-08-31