Hello,
Always dreamed about getting DLL exported functions ?
Here's the code to get'em :
'###################################
' Display DLL Exports
'###################################
Option Explicit
#DLLDECLARE imagehlp("ImageDirectoryEntryToData")
Dim $IMAGE_EXPORT_DIR,%BaseAddress,%pExportDirectory,%pSize
Dim $ExportNamePointerTable,$namefunc,%t,$filename
Dim %hList,$LV_ITEM,$sSave,%hStatus,%hMenu,%FileMenu,$filename,$divide
Begin Const
ID_OPEN = 1001
ID_EXIT = 1002
LVSCW_AUTOSIZE = -1
LVS_LIST = 0x0003
LVIF_TEXT = 0x1
LVIF_IMAGE = 0x2
LVS_REPORT = 0x0001
LVS_TYPEMASK = 0x3
LVS_EX_GRIDLINES = 0x1
LVS_EX_FULLROWSELECT = 0x20
LVS_EX_LABELTIP = 0x00004000
LVS_NOSORTHEADER = 0x8000
IMAGE_DIRECTORY_ENTRY_EXPORT = 0
End Const
Fbsl_Settext(Me,"DLL Exports")
hMenu = CreateMenu()
FileMenu = CreateMenu()
AppendMenu( FileMenu, MF_String,ID_OPEN, "&Open")
AppendMenu( FileMenu, MF_SEPARATOR,0, "")
AppendMenu( FileMenu, MF_String,ID_EXIT, "&Exit")
InsertMenu(hMenu,1,MF_PopUp, FileMenu, "&File")
SetMenu( Me,hMenu)
Alloc(LV_ITEM,36)
Alloc(IMAGE_EXPORT_DIR,40)
Alloc(ExportNamePointerTable,5120)
Alloc(namefunc,255)
Alloc(divide,12)
SetMem(LV_ITEM,LVIF_TEXT,0)
Resize(Me,0,0,420,420)
hList = FBSL_Control("SysListView32",Me,"",0,10,10,400,350,_
WS_VISIBLE + WS_CHILD + LVS_LIST + LVS_TYPEMASK + LVS_NOSORTHEADER,WS_EX_STATICEDGE)
hStatus = FBSL_Control("msctls_statusbar32",Me,"",0,0,0,0,0,WS_VISIBLE + WS_CHILD,0)
FBSL_SetFont(hList,"Lucida Console",12,FW_NORMAL,0,0,0)
SendMessage(hList,LVM_SETCOLUMNWIDTH,0,LVSCW_AUTOSIZE)
SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_LABELTIP )
SendMessage(hList,LVM_SETBKCOLOR,0,rgb(234,230,230))
SendMessage(hList,LVM_SETTEXTBKCOLOR,0,rgb(234,230,230))
SetMem(divide,250,0): SetMem(divide,420,4)
SendMessage(hStatus,SB_SETPARTS,2,divide)
ModStyle(Me,0,WS_SIZEBOX,0)
Center(Me): Show(Me)
Begin Events
Select Case cbmsg
Case WM_COMMAND
If CBCTL = ID_OPEN Then
SendMessage(hList,LVM_DELETEALLITEMS,0,0)
filename = FBSL_GetFileName( "Open", "DLL File|*.dll", 0)
BaseAddress = LoadLibrary(filename)
pExportDirectory = ImageDirectoryEntryToData(BaseAddress,1,_
IMAGE_DIRECTORY_ENTRY_EXPORT,@pSize)
MemMove(IMAGE_EXPORT_DIR,pExportDirectory,40)
Alloc(ExportNamePointerTable, GetMem(IMAGE_EXPORT_DIR,24,4) * 4)
memmove(ExportNamePointerTable, BaseAddress + GetMem(IMAGE_EXPORT_DIR,32,4),_
GetMem(IMAGE_EXPORT_DIR,24,4) * 4)
For t = 0 To GetMem(IMAGE_EXPORT_DIR,24,4) - 1
MemMove(namefunc,BaseAddress + GetMem(ExportNamePointerTable,t * 4,4),255)
SetMem(LV_ITEM,t,4)
SetMem(LV_ITEM,@namefunc,20)
SendMessage(hList,LVM_INSERTITEM,0,LV_ITEM)
Next
SendMessage(hStatus,SB_SETTEXT,0,filename)
SendMessage(hStatus,SB_SETTEXT,1,"Number of Functions: " &_
GetMem(IMAGE_EXPORT_DIR,24,4))
FreeLibrary(BaseAddress)
Erase ExportNamePointerTable
End If
If CBCTL = ID_EXIT Then EXITPROGRAM(0)
End Select
End Events
And here's a screenshot to see the result of the KERNEL32.DLL captured :
Enjoy