
Merci beaucoup El_Choni
je vais regarder de plus près
Code : Tout sélectionner
Structure finfo
FunName.s
Args.s
HelpLine.s
EndStructure
NewList allfunctions.finfo()
Structure Seeker
StructureUnion
b.b
w.w
l.l
EndStructureUnion
EndStructure
Procedure ShowLibInfo(LibFile$)
LibName$ = GetFilePart(LibFile$)
If ReadFile(0, LibFile$)
LibSize = Lof()
*LibHeader = AllocateMemory(LibSize)
ReadData(*LibHeader, LibSize)
CloseFile(0)
*LibEnd = *LibHeader+LibSize
*LHSeeker.Seeker = *LibHeader
If *LHSeeker\l='PURE' And PeekL(*LHSeeker+8)='LIB3' And PeekL(*LHSeeker+16)='3BIL'
*LHSeeker.Seeker = *LibHeader+20
While *LHSeeker\b<>0:*LHSeeker+1:Wend
*LHSeeker+2
If *LHSeeker>=*LibEnd:ProcedureReturn:EndIf
nDLL = *LHSeeker\b
If nDLL
For i=1 To nDLL
*LHSeeker+1
DLL$+", "+PeekS(*LHSeeker)
*LHSeeker+Len(PeekS(*LHSeeker))
Next i
DLL$ = Right(DLL$, Len(DLL$)-2)
*LHSeeker+1
EndIf
*LHSeeker+1
While *LHSeeker\b<>0:*LHSeeker+1:Wend
*LHSeeker+1
If *LHSeeker>=*LibEnd:ProcedureReturn:EndIf
nPL = *LHSeeker\b
If nPL
For i=1 To nPL
*LHSeeker+1
nPL$+", "+PeekS(*LHSeeker)
*LHSeeker+Len(PeekS(*LHSeeker))
Next i
nPL$ = Right(nPL$, Len(nPL$)-2)
EndIf
*LHSeeker+1
If *LHSeeker>=*LibEnd:ProcedureReturn:EndIf
While PeekL(*LHSeeker)<>'PURE' And PeekL(*LHSeeker+8)<>'DAT1'
AddElement(allfunctions())
allfunctions()\FunName = PeekS(*LHSeeker)
*LHSeeker+Len(allfunctions()\FunName)+1
*LHSeeker+*LHSeeker\b+5
While *LHSeeker\b=0:*LHSeeker+1:Wend
allfunctions()\Args = ""
allfunctions()\HelpLine = ""
If *LHSeeker\b='('
arging = 1
While *LHSeeker\b<>0
If *LHSeeker\b='-'
arging = 0
EndIf
If arging
allfunctions()\Args+Chr(*LHSeeker\b)
Else
allfunctions()\HelpLine+Chr(*LHSeeker\b)
EndIf
*LHSeeker+1
Wend
allfunctions()\Args = LTrim(RTrim(allfunctions()\Args))
allfunctions()\HelpLine = LTrim(RTrim(RemoveString(allfunctions()\HelpLine, "- ")))
*LHSeeker+1
EndIf
Wend
EndIf
FreeMemory(*LibHeader)
EndIf
Debug "Library: "+LibName$
Debug "PureLibraries used: "+nPL$
Debug "DLLs used: "+DLL$
ForEach allfunctions()
Debug ""
Debug "Function: "+allfunctions()\FunName
Debug "Arguments: "+allfunctions()\Args
Debug "Quick help: "+allfunctions()\HelpLine
Next
ClearList(allfunctions())
EndProcedure
ShowLibInfo("E:\Archivos de programa\PureBasic\PureLibraries\GadgetExtension")
El_Choni,El_Choni a écrit :Et le methode que TailBite utilise por creer une liste des API:
Code : Tout sélectionner
Procedure.s GetPBFolder() Shared hKey1, Type cbData = (#MAX_PATH*2)+2 lpbData = AllocateMemory(cbData) If GetVersion_()&$ff0000 ; Windows NT/XP If RegOpenKeyEx_(#HKEY_CLASSES_ROOT, "Applications\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @hKey1)=#ERROR_SUCCESS If RegQueryValueEx_(hKey1, "", 0, @Type, lpbData, @cbData)=#ERROR_SUCCESS Folder$ = PeekS(lpbData) Folder$ = GetPathPart(Mid(Folder$, 2, Len(Folder$)-7)) EndIf RegCloseKey_(hKey1) EndIf Else ; The same for Win9x If RegOpenKeyEx_(#HKEY_LOCAL_MACHINE, "Software\Classes\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @hKey1)=#ERROR_SUCCESS If RegQueryValueEx_(hKey1, "", 0, @Type, lpbData, @cbData)=#ERROR_SUCCESS Folder$ = PeekS(lpbData) Folder$ = GetPathPart(Mid(Folder$, 2, Len(Folder$)-7)) EndIf RegCloseKey_(hKey1) EndIf EndIf FreeMemory(lpbData) ProcedureReturn Folder$ EndProcedure Procedure BuildApiList(PBFolder$) WNL$ = Chr(13)+Chr(10) WindowsLibsFolder$ = PBFolder$+"PureLibraries\Windows" DLLCount = 0 APICount = 0 If CreateFile(6, "APILIST1.TXT") And CreateFile(7, "APILIST2.TXT") If ExamineDirectory(0, WindowsLibsFolder$, "") While NextDirectoryEntry() DLLName$ = DirectoryEntryName() If DLLName$<>"." And DLLName$<>".." And FileSize(WindowsLibsFolder$+DLLName$)<>-2 If OpenFile(1, WindowsLibsFolder$+DLLName$) ApiListSize = Lof() *ApiList = AllocateMemory(ApiListSize) ReadData(*ApiList, ApiListSize) CloseFile(1) ApiEnd = *ApiList+ApiListSize ApiSeeker = *ApiList+9+Len(DLLName$)+1 UseFile(7) While ApiSeeker<ApiEnd ThisAPIFunction$ = PeekS(ApiSeeker) ApiSeeker+Len(ThisAPIFunction$)+3 nArg = PeekB(ApiSeeker-2)*4 If PeekB(ApiSeeker-1)>0 And Right(ThisAPIFunction$, 1)<>"A" ThisAPIFunction$+"A" EndIf WriteString("_"+ThisAPIFunction$+"@"+Str(nArg)+" "+Str(DLLCount)+WNL$) APICount+1 Wend FreeMemory(*ApiList) UseFile(6) WriteString(DLLName$+".DLL"+WNL$) DLLCount+1 EndIf EndIf Wend EndIf CloseFile(7) CloseFile(6) If FileSize("APILIST.TXT")<>-1 DeleteFile("APILIST.TXT") EndIf If CreateFile(6, "APILIST.TXT") WriteString(Str(DLLCount)+WNL$) If OpenFile(7, "APILIST1.TXT") ApiListSize = Lof() *ApiList = AllocateMemory(ApiListSize) ReadData(*ApiList, ApiListSize) CloseFile(7) UseFile(6) WriteData(*ApiList, ApiListSize) FreeMemory(*ApiList) WriteString(Str(APICount)+WNL$) If OpenFile(7, "APILIST2.TXT") ApiListSize = Lof() *ApiList = AllocateMemory(ApiListSize) ReadData(*ApiList, ApiListSize) CloseFile(7) UseFile(6) WriteData(*ApiList, ApiListSize) FreeMemory(*ApiList) EndIf EndIf CloseFile(6) DeleteFile("APILIST1.TXT") DeleteFile("APILIST2.TXT") EndIf EndIf EndProcedure BuildApiList(GetPBFolder())