News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

EnumDeviceDrivers.asm

Started by correy, December 15, 2010, 07:55:18 AM

Previous topic - Next topic

correy

;本文改编自masm32v10的一个程序。
;相关的api资料在windows的win32.hlp里面没有找到。
;不足之处,敬请指导。
;QQ;112426112
;Email:leguanyuan@126.com
;Homepage:http://correy.webs.com

.386
.model flat,stdcall
option casemap:none
include kernel32.inc
includelib kernel32.lib
include psapi.inc
includelib psapi.lib

.data
correy db "made by correy",0
entry db 13,10
outtitle db "按回车键退出!",0

.data?
paths db 512 dup (?)
x dd ?
buffer db 512 dup (?)
hstdin dd ?
hstdout dd ?

.code
start:
invoke GetStdHandle,-10
mov hstdin,eax
invoke GetStdHandle,-11
mov hstdout,eax
    invoke EnumDeviceDrivers,0,0,ADDR x
    invoke EnumDeviceDrivers,addr paths,x,ADDR x
    shr x, 2
    lea esi,paths
again:
    invoke GetDeviceDriverFileName,[esi],addr buffer,512
    invoke lstrlen,addr buffer
    invoke WriteFile,hstdout,addr buffer,eax,0,0
    invoke WriteFile,hstdout,addr entry,2,0,0
    add esi, 4
    sub x, 1
    cmp x,0
    jne again
   
invoke WriteFile,hstdout,addr outtitle,sizeof outtitle,0,0
invoke ReadFile,hstdin,addr buffer,sizeof buffer,addr x,0
ret
end start
;made at 2010.09.09