Friday, April 27, 2012

[MASM] Get Default Browser Path


;Author SubhashDasyam
;Website http://www.subhashdasyam.com
;email  luk@inbox.com
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\shlwapi.inc
includelib \masm32\lib\shlwapi.lib
include \masm32\include\masm32rt.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\shell32.lib

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

start:

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

background