Friday, April 27, 2012

[MASM] Get Default Browser Path

;Author SubhashDasyam
.model flat, stdcall
option casemap:none
include \masm32\include\
include \masm32\include\
includelib \masm32\lib\kernel32.lib
include \masm32\include\
includelib \masm32\lib\shlwapi.lib
include \masm32\include\
include \masm32\include\
includelib \masm32\lib\shell32.lib

    prot     db  ".htm",0
    opn      db  "open",0
    sBufsize    dd  ?
    szExe       dd  ?


invoke AssocQueryStringA,0,2,ADDR prot,0,0,ADDR sBufsize ;allocate 0 bytes first it return error how many bytes needed
invoke crt_malloc,sBufsize ;now call malloc and allocate the memory of the bytes returned
mov szExe,eax ;Now allocate the szExe size returned by malloc
invoke AssocQueryStringA,0,2,addr prot,ADDR opn,ADDR szExe,ADDR sBufsize ;pass correct Buffer Size
invoke MessageBoxA,0,ADDR szExe,ADDR szExe,MB_OK ;Get the path :) in szExe
end start

0 comments for "[MASM] Get Default Browser Path"

Post a Comment