hello,
I am trying to implement browser (IE) file-click monitoring feature for my application (i.e. like in misc. download managers), but truly speaking I don't know where to start. My guess is so far is to intercept some procedure that responsible for this. But which one? Or is there any other way to do this?
I am trying to implement browser (IE) file-click monitoring feature for my application (i.e. like in misc. download managers), but truly speaking I don't know where to start. My guess is so far is to intercept some procedure that responsible for this. But which one? Or is there any other way to do this?
ahh nevermind. found a couple of solutions :-D
assembler or c code snippets of APP implementations are highly welcome though :)
assembler or c code snippets of APP implementations are highly welcome though :)
Test_1BrowseFolder.asm
;@echo off
;goto make
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\shell32.inc
includelib \masm32\lib\shell32.lib
include \masm32\include\ole32.inc
includelib \masm32\lib\ole32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
szPath db MAX_PATH dup (?)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
szSelect db 'Path that you selected',0
szNoSelect db 'You push the CANCEL button',0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
include Test_1BrowseFolder.asm
start:
invoke GetCurrentDirectory,sizeof szPath,addr szPath
invoke _BrowseFolder,NULL,addr szPath
.if eax
invoke MessageBox,NULL,offset szPath,offset szSelect,MB_OK
.else
invoke MessageBox,NULL,offset szNoSelect,NULL,MB_OK
.endif
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
:make
set name=Test_BrowseFolder
\masm32\bin\ml /c /coff %name%.bat
\masm32\bin\Link /subsystem:windows %name%.obj
if exist %name%.bak del *.bak
if exist %name%.obj del *.obj
echo.
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
externdef IID_IUnknown:IID
LPUNKNOWN typedef DWORD
LPPUNKNOWN typedef ptr LPUNKNOWN
IUnknown_QueryInterfaceProto typedef proto :DWORD, :DWORD, :DWORD
IUnknown_AddRefProto typedef proto :DWORD
IUnknown_ReleaseProto typedef proto :DWORD
IUnknown_QueryInterface typedef ptr IUnknown_QueryInterfaceProto
IUnknown_AddRef typedef ptr IUnknown_AddRefProto
IUnknown_Release typedef ptr IUnknown_ReleaseProto
IUnknown struct DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
IUnknown ends
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
externdef IID_IMalloc:IID
LPMALLOC typedef DWORD
LPPMALLOC typedef ptr LPMALLOC
IMalloc_AllocProto typedef proto :DWORD, :DWORD
IMalloc_ReallocProto typedef proto :DWORD, :DWORD, :DWORD
IMalloc_FreeProto typedef proto :DWORD, :DWORD
IMalloc_GetSizeProto typedef proto :DWORD, :DWORD
IMalloc_DidAllocProto typedef proto :DWORD, :DWORD
IMalloc_HeapMinimizeProto typedef proto :DWORD
IMalloc_Alloc typedef ptr IMalloc_AllocProto
IMalloc_Realloc typedef ptr IMalloc_ReallocProto
IMalloc_Free typedef ptr IMalloc_FreeProto
IMalloc_GetSize typedef ptr IMalloc_GetSizeProto
IMalloc_DidAlloc typedef ptr IMalloc_DidAllocProto
IMalloc_HeapMinimize typedef ptr IMalloc_HeapMinimizeProto
IMalloc struct DWORD
QueryInterface IUnknown_QueryInterface ?
AddRef IUnknown_AddRef ?
Release IUnknown_Release ?
Alloc IMalloc_Alloc ?
Realloc IMalloc_Realloc ?
Free IMalloc_Free ?
GetSize IMalloc_GetSize ?
DidAlloc IMalloc_DidAlloc ?
HeapMinimize IMalloc_HeapMinimize ?
IMalloc ends
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
_BrowseFolderTmp dd ?
.const
_szDirInfo db 'Please select the Path?',0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
_BrowseFolderCallBack proc hWnd,uMsg,lParam,lpData
local @szBuffer[260]:byte
mov eax,uMsg
.if eax == BFFM_INITIALIZED
invoke SendMessage,hWnd,BFFM_SETSELECTION,TRUE,_BrowseFolderTmp
.elseif eax == BFFM_SELCHANGED
invoke SHGetPathFromIDList,lParam,addr @szBuffer
invoke SendMessage,hWnd,BFFM_SETSTATUSTEXT,0,addr @szBuffer
.endif
xor eax,eax
ret
_BrowseFolderCallBack endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_BrowseFolder proc _hWnd,_lpszBuffer
local @stBrowseInfo:BROWSEINFO
local @stMalloc
local @pidlParent,@dwReturn
pushad
invoke CoInitialize,NULL
invoke SHGetMalloc,addr @stMalloc
.if eax == E_FAIL
mov @dwReturn,FALSE
jmp @F
.endif
invoke RtlZeroMemory,addr @stBrowseInfo,sizeof @stBrowseInfo
;-------------------------------------------------------------------------
push _hWnd
pop @stBrowseInfo.hwndOwner
push _lpszBuffer
pop _BrowseFolderTmp
mov @stBrowseInfo.lpfn,offset _BrowseFolderCallBack
mov @stBrowseInfo.lpszTitle,offset _szDirInfo
mov @stBrowseInfo.ulFlags,BIF_RETURNONLYFSDIRS or BIF_STATUSTEXT
invoke SHBrowseForFolder,addr @stBrowseInfo
mov @pidlParent,eax
.if eax != NULL
invoke SHGetPathFromIDList,eax,_lpszBuffer
mov eax,TRUE
.else
mov eax,FALSE
.endif
mov @dwReturn,eax
mov eax,@stMalloc
mov eax,[eax]
invoke (IMalloc PTR [eax]).Free,@stMalloc,@pidlParent
mov eax,@stMalloc
mov eax,[eax]
invoke (IMalloc PTR [eax]).Release,@stMalloc
@@:
invoke CoUninitialize
popad
mov eax,@dwReturn
ret
_BrowseFolder endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;@echo off
;goto make
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\shell32.inc
includelib \masm32\lib\shell32.lib
include \masm32\include\ole32.inc
includelib \masm32\lib\ole32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
szPath db MAX_PATH dup (?)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
szSelect db 'Path that you selected',0
szNoSelect db 'You push the CANCEL button',0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
include Test_1BrowseFolder.asm
start:
invoke GetCurrentDirectory,sizeof szPath,addr szPath
invoke _BrowseFolder,NULL,addr szPath
.if eax
invoke MessageBox,NULL,offset szPath,offset szSelect,MB_OK
.else
invoke MessageBox,NULL,offset szNoSelect,NULL,MB_OK
.endif
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
:make
set name=Test_BrowseFolder
\masm32\bin\ml /c /coff %name%.bat
\masm32\bin\Link /subsystem:windows %name%.obj
if exist %name%.bak del *.bak
if exist %name%.obj del *.obj
echo.