Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IncludeFile "Pb_PeExplorer.Pbi"
- Structure VS_VERSION_INFO
- wLength.u;
- wValueLength.u;
- wType.u ;
- szKey.u[15] ;
- Padding1.u[2] ;
- Value.VS_FIXEDFILEINFO;
- ; Padding2.u ;
- ; Children.u ;
- EndStructure
- Macro HiWord(a)
- (a>>16 & $ffff)
- EndMacro
- Macro LowWord(a)
- (a & $ffff)
- EndMacro
- EnableExplicit
- CoInitializeEx_(0, #COINIT_MULTITHREADED)
- Global pIShellLink.IShellLinkW
- Global pIPersistFile.IPersistFile
- If CoCreateInstance_(?CLSID_ShellLink, 0,
- #CLSCTX_INPROC_SERVER, ?IID_IShellLink, @pIShellLink) = 0
- pIShellLink\QueryInterface(?IID_IPersistFile , @pIPersistFile)
- EndIf
- #File_Info="File Info"
- #DOS_HEADER="DOS_HEADER"
- #IMAGE_NT_HEADERS="IMAGE_NT_HEADERS"
- #FILE_HEADER="FILE_HEADER"
- #OPTIONAL_HEADER="OPTIONAL_HEADER"
- #SECTION_HEADER="SECTION_HEADER"
- #DESCRIPTOR_IMPORT="DESCRIPTOR_IMPORT"
- #DESCRIPTOR_EXPORT="DESCRIPTOR_EXPORT"
- #DESCRIPTOR_RESOURCE="DESCRIPTOR_RESOURCE"
- #DESCRIPTOR_RELOCATION="DESCRIPTOR_RELOCATION"
- #ENDOFDATA="+Overlay"
- Enumeration Window_PeExplorer
- #Window_PeExplorer
- EndEnumeration
- Enumeration Window_Gadget_PeExplorer
- #Gadget_ListIcon_PeExplorer
- #Gadget_Tree_PeExplorer
- #Gadget_Splitter_PeExplorer
- EndEnumeration
- Enumeration FormMenu_PeExplorer
- #Menu_Window_PeExplorer
- EndEnumeration
- Enumeration FormMenuItem_PeExplorer
- #MenuItem_SelectFile
- #MenuItem_Exit
- EndEnumeration
- Enumeration FormStatusBar_PeExplorer
- #StatusBar_PeExplorer
- EndEnumeration
- Enumeration FormStatusBarItem_PeExplorer
- #StatusBarItem_PeInfo
- #StatusBarItem_PeProgress
- EndEnumeration
- Global CurrentPB_PEExplorerFile.PB_PEExplorer
- Global CurrentFileLoc.s{#MAX_PATH}
- Procedure.s GetFilePathFromLnk(Lnk.s)
- Protected pWIN32_FIND_DATA.WIN32_FIND_DATA
- Protected Path.s{#MAX_PATH}
- If pIPersistFile And pIShellLink
- If pIPersistFile\Load(Lnk,0) = 0
- If pIShellLink\GetPath(@Path,#MAX_PATH*2,@pWIN32_FIND_DATA,1) = 0
- ProcedureReturn Path
- EndIf
- EndIf
- EndIf
- EndProcedure
- Procedure.s GetLongPathName(lpszShortPath.s)
- Protected lpszLongPath.s{#MAX_PATH}
- GetLongPathName_(@lpszShortPath,@lpszLongPath,#MAX_PATH)
- ProcedureReturn lpszLongPath
- EndProcedure
- Procedure.s GetShortPathName(lpszLongPath.s)
- Protected lpszShortPath.s{#MAX_PATH}
- GetShortPathName_(@lpszLongPath,@lpszShortPath,#MAX_PATH)
- ProcedureReturn lpszShortPath
- EndProcedure
- Procedure.s FindFile(Pthdll$,aDll$,SubDirCount.l=0,Pcall.b=1)
- Protected iReturn$,DirectoryEntryName$
- Protected ed=ExamineDirectory(#PB_Any, Pthdll$, "*.*")
- If ed
- While NextDirectoryEntry(ed)
- DirectoryEntryName$=DirectoryEntryName(ed)
- If DirectoryEntryType(ed) = #PB_DirectoryEntry_File
- If FindString(DirectoryEntryName$, aDll$,1,#PB_String_NoCase)
- iReturn$ = Pthdll$ + "\" + aDll$
- EndIf
- ElseIf SubDirCount < 5
- If DirectoryEntryName$="." Or DirectoryEntryName$=".." :Continue:EndIf
- SubDirCount+1
- iReturn$=FindFile(Pthdll$+"\" + DirectoryEntryName$,aDll$,SubDirCount,0)
- Else
- If Pcall=1
- SubDirCount=0
- EndIf
- EndIf
- If iReturn$:Break:EndIf
- Wend
- FinishDirectory(ed)
- EndIf
- ProcedureReturn iReturn$
- EndProcedure
- Macro AddList(strlist,s)
- AddElement(strlist):strlist = s
- EndMacro
- Procedure ResizeGadgetsWindow_PeExplorer()
- Protected FormWindowWidth, FormWindowHeight
- FormWindowWidth = WindowWidth(#Window_PeExplorer)
- FormWindowHeight = WindowHeight(#Window_PeExplorer)
- ResizeGadget(#Gadget_Splitter_PeExplorer, 5, 5, FormWindowWidth-10, FormWindowHeight - MenuHeight() - StatusBarHeight(#StatusBar_PeExplorer) - 10)
- EndProcedure
- Procedure CloseWindow_PeExplorer()
- PostEvent(#PB_Event_CloseWindow, #Window_PeExplorer, 0)
- EndProcedure
- Procedure LoadPlugins_PeExplorer()
- Protected ed=ExamineDirectory(#PB_Any, "Plugins", "*.dll")
- If ed
- While NextDirectoryEntry(ed)
- If DirectoryEntryType(ed) = #PB_DirectoryEntry_File
- Protected ol=OpenLibrary(#PB_Any,"Plugins\"+DirectoryEntryName(ed))
- If ol
- If Not CallFunction(ol,"PeExplorer_Plugin_Ini",WindowID(#Window_PeExplorer),@CurrentFileLoc)
- CloseLibrary(ol)
- EndIf
- EndIf
- EndIf
- Wend
- FinishDirectory(ed)
- EndIf
- EndProcedure
- Procedure.s Pex_Hex_Value(Value.q,Type.l, Addx.s="0x")
- Protected slong.l
- Select Type
- Case #PB_Byte
- slong=2
- Case #PB_Word
- slong=4
- Case #PB_Long
- slong=8
- Case #PB_Quad
- slong=16
- EndSelect
- ProcedureReturn Addx+RSet (Hex(Value,Type),slong,"0")
- EndProcedure
- Procedure.s Pex_Resource_Type (nRes.u)
- Select nRes
- Case #RT_ACCELERATOR:ProcedureReturn "#RT_ACCELERATOR"
- Case #RT_ANICURSOR:ProcedureReturn "#RT_ANICURSOR"
- Case #RT_ANIICON:ProcedureReturn "#RT_ANIICON"
- Case #RT_BITMAP:ProcedureReturn "#RT_BITMAP"
- Case #RT_CURSOR:ProcedureReturn "#RT_CURSOR"
- Case #RT_DIALOG:ProcedureReturn "#RT_DIALOG"
- Case #RT_DLGINCLUDE:ProcedureReturn "#RT_DLGINCLUDE"
- Case #RT_FONT:ProcedureReturn "#RT_FONT"
- Case #RT_FONTDIR:ProcedureReturn "#RT_FONTDIR"
- Case #RT_GROUP_CURSOR:ProcedureReturn "#RT_GROUP_CURSOR"
- Case #RT_GROUP_ICON:ProcedureReturn "#RT_GROUP_ICON"
- Case #RT_HTML:ProcedureReturn "#RT_HTML"
- Case #RT_ICON:ProcedureReturn "#RT_ICON"
- Case #RT_MANIFEST:ProcedureReturn "#RT_MANIFEST"
- Case #RT_MENU:ProcedureReturn "#RT_MENU"
- Case #RT_MESSAGETABLE:ProcedureReturn "#RT_MESSAGETABLE"
- Case #RT_PLUGPLAY:ProcedureReturn "#RT_PLUGPLAY"
- Case #RT_RCDATA:ProcedureReturn "#RT_RCDATA"
- Case #RT_STRING:ProcedureReturn "#RT_STRING"
- Case #RT_VERSION:ProcedureReturn "#RT_VERSION"
- Case #RT_VXD:ProcedureReturn "#RT_VXD"
- EndSelect
- ProcedureReturn Str(nRes)
- EndProcedure
- Procedure.s Pex_Machine_Type(Machine.u)
- Select Machine
- Case #IMAGE_FILE_MACHINE_I386:ProcedureReturn "X86"
- Case #IMAGE_FILE_MACHINE_IA64:ProcedureReturn "Intel Itanium"
- Case #IMAGE_FILE_MACHINE_AMD64:ProcedureReturn "X64"
- EndSelect
- EndProcedure
- Procedure.s Pex_Exe_Type(Characteristics.u)
- If Characteristics &#IMAGE_FILE_DLL = #IMAGE_FILE_DLL
- ProcedureReturn "Image is a DLL"
- ElseIf Characteristics &#IMAGE_FILE_EXECUTABLE_IMAGE = #IMAGE_FILE_EXECUTABLE_IMAGE
- ProcedureReturn "Image is a EXE"
- EndIf
- EndProcedure
- Procedure.s Pex_Image_Type(Magic.u)
- Select Magic
- Case #IMAGE_NT_OPTIONAL_HDR32_MAGIC
- ProcedureReturn "32bit"
- Case #IMAGE_NT_OPTIONAL_HDR64_MAGIC
- ProcedureReturn "64bit"
- Case #IMAGE_ROM_OPTIONAL_HDR_MAGIC
- ProcedureReturn "Rom image"
- EndSelect
- EndProcedure
- Structure ImageFile_Type
- Characteristics.u
- Desc.s
- EndStructure
- Procedure.s Pex_ImageFile_Type(Characteristics.w)
- Dim aImageFile_Type.ImageFile_Type(14)
- aImageFile_Type(0)\Characteristics = #IMAGE_FILE_RELOCS_STRIPPED
- aImageFile_Type(1)\Characteristics = #IMAGE_FILE_EXECUTABLE_IMAGE
- aImageFile_Type(2)\Characteristics = #IMAGE_FILE_LINE_NUMS_STRIPPED
- aImageFile_Type(3)\Characteristics = #IMAGE_FILE_LOCAL_SYMS_STRIPPED
- aImageFile_Type(4)\Characteristics = #IMAGE_FILE_AGGRESIVE_WS_TRIM
- aImageFile_Type(5)\Characteristics = #IMAGE_FILE_LARGE_ADDRESS_AWARE
- aImageFile_Type(6)\Characteristics = #IMAGE_FILE_BYTES_REVERSED_LO
- aImageFile_Type(7)\Characteristics = #IMAGE_FILE_32BIT_MACHINE
- aImageFile_Type(8)\Characteristics = #IMAGE_FILE_DEBUG_STRIPPED
- aImageFile_Type(9)\Characteristics = #IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP
- aImageFile_Type(10)\Characteristics = #IMAGE_FILE_NET_RUN_FROM_SWAP
- aImageFile_Type(11)\Characteristics = #IMAGE_FILE_SYSTEM
- aImageFile_Type(12)\Characteristics = #IMAGE_FILE_DLL
- aImageFile_Type(13)\Characteristics = #IMAGE_FILE_UP_SYSTEM_ONLY
- aImageFile_Type(14)\Characteristics = #IMAGE_FILE_BYTES_REVERSED_HI
- aImageFile_Type(0)\Desc = "IMAGE_FILE_RELOCS_STRIPPED"
- aImageFile_Type(1)\Desc = "IMAGE_FILE_EXECUTABLE_IMAGE"
- aImageFile_Type(2)\Desc = "IMAGE_FILE_LINE_NUMS_STRIPPED"
- aImageFile_Type(3)\Desc = "IMAGE_FILE_LOCAL_SYMS_STRIPPED"
- aImageFile_Type(4)\Desc = "IMAGE_FILE_AGGRESIVE_WS_TRIM"
- aImageFile_Type(5)\Desc = "IMAGE_FILE_LARGE_ADDRESS_AWARE"
- aImageFile_Type(6)\Desc = "IMAGE_FILE_BYTES_REVERSED_LO"
- aImageFile_Type(7)\Desc = "IMAGE_FILE_32BIT_MACHINE"
- aImageFile_Type(8)\Desc = "IMAGE_FILE_DEBUG_STRIPPED"
- aImageFile_Type(9)\Desc = "IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP"
- aImageFile_Type(10)\Desc = "IMAGE_FILE_NET_RUN_FROM_SWAP"
- aImageFile_Type(11)\Desc = "IMAGE_FILE_SYSTEM"
- aImageFile_Type(12)\Desc = "IMAGE_FILE_DLL"
- aImageFile_Type(13)\Desc = "IMAGE_FILE_UP_SYSTEM_ONLY"
- aImageFile_Type(14)\Desc = "IMAGE_FILE_BYTES_REVERSED_HI"
- Protected sReturn.s,o
- For o = 0 To 14
- If aImageFile_Type(o)\Characteristics & Characteristics = aImageFile_Type(o)\Characteristics
- sReturn + aImageFile_Type(o)\Desc + " | "
- EndIf
- Next
- ProcedureReturn Mid(sReturn,1,Len(sReturn) - 3)
- EndProcedure
- Procedure.s Pex_Subsystem_Type(Subsystem.u)
- Select Subsystem
- Case #IMAGE_SUBSYSTEM_NATIVE
- ProcedureReturn "Subsystem : native"
- Case #IMAGE_SUBSYSTEM_WINDOWS_GUI
- ProcedureReturn "Subsystem : Windows GUI"
- Case #IMAGE_SUBSYSTEM_WINDOWS_CUI
- ProcedureReturn "Subsystem : Windows CUI"
- Case #IMAGE_SUBSYSTEM_OS2_CUI
- ProcedureReturn "Subsystem : OS2."
- Case #IMAGE_SUBSYSTEM_POSIX_CUI
- ProcedureReturn "Subsystem : Posix."
- Case #IMAGE_SUBSYSTEM_WINDOWS_CE_GUI
- ProcedureReturn "Subsystem : Windows CE."
- Case #IMAGE_SUBSYSTEM_EFI_APPLICATION
- ProcedureReturn "Subsystem : Extensible Firmware Interface."
- Case #IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
- ProcedureReturn "Subsystem : Extensible Firmware Interface."
- Case #IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
- ProcedureReturn "Subsystem : Extensible Firmware Interface."
- Case #IMAGE_SUBSYSTEM_EFI_ROM
- ProcedureReturn "Subsystem : Extensible Firmware Interface."
- Case #IMAGE_SUBSYSTEM_XBOX
- ProcedureReturn "Subsystem : Xbox."
- Case #IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION
- ProcedureReturn "Subsystem : Boot Application."
- Default
- ProcedureReturn "unknown Subsystem"
- EndSelect
- EndProcedure
- Procedure.s Pex_Dll_Characteristics(DllCharacteristics.u)
- Select DllCharacteristics
- Case #IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
- ProcedureReturn "The DLL can be relocated at load time."
- Case #IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY
- ProcedureReturn "Code integrity checks are forced."
- Case #IMAGE_DLLCHARACTERISTICS_NX_COMPAT
- ProcedureReturn "The image is compatible With Data execution prevention (DEP)."
- Case #IMAGE_DLLCHARACTERISTICS_NO_ISOLATION
- ProcedureReturn "The image is isolation aware, but should Not be isolated."
- Case #IMAGE_DLLCHARACTERISTICS_NO_SEH
- ProcedureReturn "The image does Not use structured exception handling (SEH)."
- Case #IMAGE_DLLCHARACTERISTICS_NO_BIND
- ProcedureReturn "Do Not bind the image"
- Case #IMAGE_DLLCHARACTERISTICS_WDM_DRIVER
- ProcedureReturn "A WDM driver"
- Case #IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE
- ProcedureReturn "The image is terminal server aware."
- EndSelect
- EndProcedure
- Procedure.s Pex_HexRawData_Read(ResOffset.l,ResSize.l,ReadSize.l,ReturnHex.b=1)
- Protected Rd = ReadFile(#PB_Any, CurrentFileLoc)
- If Rd
- If ReadSize >= ResSize:ReadSize=ResSize:EndIf
- If ReadSize > 0 And ResOffset > 0 And ResOffset + ReadSize <= Lof(Rd)
- FileSeek(Rd,ResOffset)
- Protected u.l,pb.a,Returna$ ,Returns$
- For u=1 To ReadSize
- pb = ReadAsciiCharacter(Rd)
- Returna$ + Pex_Hex_Value(pb,#PB_Byte,"") + " "
- If pb=0:pb=Asc("."):EndIf
- Returns$ + Chr(pb)
- Next
- EndIf
- CloseFile(Rd)
- EndIf
- If ReturnHex
- ProcedureReturn Returna$
- EndIf
- ProcedureReturn Returns$
- EndProcedure
- Procedure.i Pex_MemRawData_Read(ResOffset.l,ReadSize.l)
- Protected Rd = ReadFile(#PB_Any, CurrentFileLoc)
- If Rd
- If ReadSize > 0 And ResOffset > 0 And ResOffset + ReadSize <= Lof(Rd)
- Protected *Almem=AllocateMemory(ReadSize)
- If *Almem
- FileSeek(Rd,ResOffset)
- ReadData(Rd,*Almem,ReadSize)
- EndIf
- EndIf
- CloseFile(Rd)
- EndIf
- ProcedureReturn *Almem
- EndProcedure
- Procedure.b Pex_UpxPacker_Detect()
- Protected IspUpx.b
- With CurrentPB_PEExplorerFile
- ForEach \IMAGE_SECTION_HEADERList()
- If Left(\IMAGE_SECTION_HEADERList()\__File_Selction_Name,3) = "UPX"
- IspUpx+1
- EndIf
- Next
- EndWith
- ProcedureReturn IspUpx
- EndProcedure
- Procedure.b Pex_UpxPacker_UnPacked()
- Protected ru,Sortie$,Rderr$
- If MessageRequester("","UPX packer Detected.. "+#CRLF$ + "Do you want decompress file !", #PB_MessageRequester_YesNo)<>#PB_MessageRequester_Yes
- ProcedureReturn
- EndIf
- If FileSize("upx.exe") < 1
- ProcedureReturn MessageRequester("","Upx.exe not found!")
- EndIf
- ru=RunProgram("upx","-d " + GetShortPathName(CurrentFileLoc), GetCurrentDirectory(), #PB_Program_Open | #PB_Program_Read |#PB_Program_Error|#PB_Program_Hide)
- If ru
- While ProgramRunning(ru)
- If AvailableProgramOutput(ru)
- ReadProgramString(ru)
- Rderr$=ReadProgramError(ru)
- If Rderr$
- Sortie$ + Rderr$ + Chr(13)
- EndIf
- EndIf
- Wend
- If ProgramExitCode(ru)=1
- MessageRequester("UPX Error!",Sortie$)
- ProcedureReturn 0
- EndIf
- ProcedureReturn 1
- EndIf
- EndProcedure
- Procedure.s Pex_DLL_FindPath(aDll$)
- Protected WindowsDirectory.s{#MAX_PATH},SystemWindowsDirectory.s{#MAX_PATH}
- GetWindowsDirectory_(@WindowsDirectory,#MAX_PATH)
- GetSystemDirectory_(@SystemWindowsDirectory,#MAX_PATH)
- If FileSize(WindowsDirectory+"\"+aDll$) > 0
- ProcedureReturn WindowsDirectory+"\"+aDll$
- EndIf
- If FileSize(SystemWindowsDirectory+"\"+aDll$) > 0
- ProcedureReturn SystemWindowsDirectory+"\"+aDll$
- EndIf
- Protected DllPath.s{#MAX_PATH}
- Protected lb,CloseLib.b
- lb= GetModuleHandle_(aDll$)
- If Not lb
- lb=LoadLibraryEx_(aDll$,0,$00000001)
- CloseLib = 1
- EndIf
- If lb
- GetModuleFileName_(lb,@DllPath,#MAX_PATH)
- If CloseLib
- FreeLibrary_(lb)
- EndIf
- If DllPath
- ProcedureReturn DllPath
- EndIf
- EndIf
- Protected Pthdll$=RTrim(GetPathPart(CurrentFileLoc),"\")
- If Pthdll$
- Protected iFind$=FindFile(Pthdll$,aDll$)
- If iFind$
- ProcedureReturn iFind$
- EndIf
- EndIf
- ProcedureReturn "?\"+aDll$
- EndProcedure
- Procedure.s Pex_RawData_Hash(ReadOffset.l=0,ReadSize.l=0)
- Protected Rdf=ReadFile(#PB_Any,CurrentFileLoc)
- If Rdf
- If ReadSize=0:ReadSize=Lof(Rdf):EndIf
- If Lof(Rdf) < ReadOffset+ReadSize:ReadSize=Lof(Rdf)-ReadOffset:EndIf
- If ReadSize < 1 :ProcedureReturn:EndIf
- FileSeek(Rdf,ReadOffset)
- Protected *Dataf=AllocateMemory(1024*64)
- If *Dataf
- UseMD5Fingerprint()
- Protected fmd5 = StartFingerprint(#PB_Any, #PB_Cipher_MD5)
- If fmd5
- Protected Rd.l,iReturn$,irds.l=1024*64,ird.l
- Repeat
- If ird+irds > ReadSize:irds=ReadSize-ird:EndIf
- Rd=ReadData(Rdf,*Dataf,irds)
- AddFingerprintBuffer(fmd5, *Dataf, Rd)
- ird+Rd
- If ird=ReadSize:Break:EndIf
- ForEver
- iReturn$= FinishFingerprint(fmd5)
- EndIf
- FreeMemory(*Dataf)
- EndIf
- CloseFile(Rdf)
- EndIf
- ProcedureReturn iReturn$
- EndProcedure
- Procedure.s Pex_Section_Characteristics(Characteristics.l)
- Protected sReturn.s
- If Characteristics& #IMAGE_SCN_CNT_CODE :sReturn + "CODE + ":EndIf
- If Characteristics& #IMAGE_SCN_CNT_INITIALIZED_DATA :sReturn + "INITIALIZED_DATA + ":EndIf
- If Characteristics& #IMAGE_SCN_CNT_UNINITIALIZED_DATA :sReturn + "UNINITIALIZED_DATA + ":EndIf
- If Characteristics& #IMAGE_SCN_MEM_SHARED :sReturn + "MEM_SHARED + ":EndIf
- If Characteristics& #IMAGE_SCN_MEM_EXECUTE :sReturn + "MEM_EXECUTE + ":EndIf
- If Characteristics& #IMAGE_SCN_MEM_READ :sReturn + "MEM_READ + ":EndIf
- If Characteristics& #IMAGE_SCN_MEM_WRITE :sReturn + "MEM_WRITE + ":EndIf
- ProcedureReturn Mid(sReturn,1,Len(sReturn)-2)
- EndProcedure
- Macro Pex_Is64Bit()
- Bool(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS32\OptionalHeader\Magic = #IMAGE_NT_OPTIONAL_HDR64_MAGIC)
- EndMacro
- Procedure.s Pex_Date_Format(lDat.l)
- If lDat > 0
- ProcedureReturn FormatDate("%yyyy/ %mm/ %dd %hh:%ii:%ss",lDat)+" UTC"
- EndIf
- EndProcedure
- Procedure Pex_Resource_Read(ResourceDir.l,ResourceNameStr.s,ResourceNameInt.l,ResourceOffset.l,ResourceSize.l)
- Protected sReturn.s
- Select ResourceDir
- Case #RT_MANIFEST
- Protected *Versionmem =Pex_MemRawData_Read(ResourceOffset,ResourceSize)
- If *Versionmem
- sReturn= PeekS(*Versionmem,ResourceSize,#PB_Ascii)
- FreeMemory(*Versionmem)
- EndIf
- Case #RT_VERSION
- *Versionmem =Pex_MemRawData_Read(ResourceOffset,ResourceSize)
- If *Versionmem
- Protected *vr.VS_VERSION_INFO=*Versionmem
- Protected FileVersion.s= Str(HiWord(*vr\Value\dwFileVersionMS)) +
- "." +Str(LowWord(*vr\Value\dwFileVersionMS)) +
- "." +Str(HiWord(*vr\Value\dwFileVersionLS)) +
- "." + Str(LowWord(*vr\Value\dwFileVersionLS))
- Protected ProductVersion.s= Str(HiWord(*vr\Value\dwProductVersionMS)) +
- "." +Str(LowWord(*vr\Value\dwProductVersionMS)) +
- "." +Str(HiWord(*vr\Value\dwProductVersionLS)) +
- "." + Str(LowWord(*vr\Value\dwProductVersionLS))
- sReturn + "<" + PeekS(@*vr\szKey)+ ">" + #CRLF$ + #CRLF$
- sReturn + " File Version: " + FileVersion + #CRLF$
- sReturn + " Product Version: " + ProductVersion + #CRLF$
- sReturn + " Characteristics: " + Pex_Hex_Value(*vr\Value\dwFileType,#PB_Long) + ", " + Pex_Hex_Value(*vr\Value\dwFileOS,#PB_Long) + #CRLF$
- Protected ChildrenLen.l
- Protected *cvr.VS_VERSION_INFO
- While ChildrenLen < *vr\wLength-SizeOf(VS_VERSION_INFO)
- *cvr = *vr+SizeOf(VS_VERSION_INFO)+ChildrenLen
- ChildrenLen+*cvr\wLength
- If Mod(ChildrenLen,4)
- ChildrenLen+4-Mod(ChildrenLen,4)
- EndIf
- Select PeekS(@*cvr\szKey)
- Case "StringFileInfo"
- Protected *ccvr.VS_VERSION_INFO=*cvr+36
- sReturn + #CRLF$ + " <StringFileInfo>"
- Protected szKey.s= PeekS(@*ccvr\szKey)
- sReturn + #CRLF$ + " <" + szKey + ">" + #CRLF$
- sReturn + " Language identifier: " + "0x" + Mid(szKey,1,4)+ #CRLF$
- sReturn + " Code page: " + "0x" + Mid(szKey,3,4)+ #CRLF$ + #CRLF$
- Protected iOffset.l,iPadding.l,iLength.l
- While iOffset < *ccvr\wLength - 24
- Protected *cccvr.VS_VERSION_INFO=*ccvr+24+iOffset
- iLength=*cccvr\wLength
- iPadding=Mod(iLength,4)
- If iPadding:iLength+4-iPadding:EndIf
- szKey= PeekS(@*cccvr\szKey)
- iPadding = 4 - Mod(2 * Len(szKey) + 6, 4)
- sReturn + " " + szKey + ": " + PeekS(@*cccvr\szKey+(Len(szKey)*2)+iPadding) +#CRLF$
- iOffset+iLength
- Wend
- sReturn + #CRLF$ + " </" + PeekS(@*ccvr\szKey) + ">"
- sReturn + #CRLF$ + " </StringFileInfo>" + #CRLF$
- Case "VarFileInfo"
- *ccvr=*cvr+32
- sReturn + #CRLF$ + " <VarFileInfo>"
- sReturn + #CRLF$ + " <" + PeekS(@*ccvr\szKey) + ">" + #CRLF$
- Protected i.l,Val.w
- For i=0 To (*ccvr\wValueLength/2)-1
- Val= PeekW(*ccvr+32+(2*i))
- If Mod(i,2)
- sReturn + " Language identifier: " + Pex_Hex_Value(Val,#PB_Word) + #CRLF$
- Else
- sReturn + " Code page: " + Pex_Hex_Value(Val,#PB_Word) + #CRLF$
- EndIf
- Next
- sReturn + #CRLF$ + " </" + PeekS(@*ccvr\szKey) + ">"
- sReturn + #CRLF$ + " </VarFileInfo>" + #CRLF$
- EndSelect
- Wend
- sReturn + #CRLF$ + "</" + PeekS(@*vr\szKey)+ ">" + #CRLF$
- FreeMemory(*Versionmem)
- EndIf
- EndSelect
- If sReturn
- MessageRequester("", sReturn)
- EndIf
- EndProcedure
- Procedure.s Pex_Reloc_Type(Type.u)
- Protected sReturn.s
- Select Type
- Case #IMAGE_REL_BASED_ABSOLUTE
- sReturn = "IMAGE_REL_BASED_ABSOLUTE(0)"
- Case #IMAGE_REL_BASED_HIGH
- sReturn = "IMAGE_REL_BASED_HIGH(1)"
- Case #IMAGE_REL_BASED_LOW
- sReturn = "IMAGE_REL_BASED_LOW(2)"
- Case #IMAGE_REL_BASED_HIGHLOW
- sReturn = "IMAGE_REL_BASED_HIGHLOW(3)"
- Case #IMAGE_REL_BASED_HIGHADJ
- sReturn = "IMAGE_REL_BASED_HIGHADJ(4)"
- Case #IMAGE_REL_BASED_MIPS_JMPADDR
- sReturn = "IMAGE_REL_BASED_MIPS_JMPADDR(5)"
- Case #IMAGE_REL_BASED_DIR64
- sReturn = "IMAGE_REL_BASED_DIR64(10)"
- EndSelect
- ProcedureReturn sReturn
- EndProcedure
- Procedure SetInfoHeader_PeExplorer(ItHeader.s,SelectType.s="",ResFileType.s="")
- NewList gilist.s()
- Select ItHeader
- Case #DESCRIPTOR_RELOCATION
- If ResFileType <> ""
- With CurrentPB_PEExplorerFile
- ForEach \IMAGE_BASE_RELOCATIONList()
- If Pex_Hex_Value(\IMAGE_BASE_RELOCATIONList()\VirtualAddress,#PB_Long) = SelectType
- Protected SRVA = \IMAGE_BASE_RELOCATIONList()\VirtualAddress
- ForEach \IMAGE_BASE_RELOCATIONList()\RelocationTypeList()
- If Pex_Hex_Value(\IMAGE_BASE_RELOCATIONList()\RelocationTypeList()\u,#PB_Word) = ResFileType
- Protected Offset = (\IMAGE_BASE_RELOCATIONList()\RelocationTypeList()\u & $0fff)
- Protected Type = ((\IMAGE_BASE_RELOCATIONList()\RelocationTypeList()\u >> 12) & $000F)
- AddList(gilist(),"RVA" +Chr(10) + Pex_Hex_Value(Offset +
- \IMAGE_BASE_RELOCATIONList()\VirtualAddress ,#PB_Long)+Chr(10) +
- "Offset : " + Str(Offset))
- AddList(gilist(),"Type" +Chr(10) +Pex_Reloc_Type(Type))
- Break
- EndIf
- Next
- EndIf
- Next
- EndWith
- If Offset
- ForEach CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- With CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- If \VirtualAddress <= SRVA And \VirtualAddress+ \VirtualSize > SRVA
- Protected *plong.long = Pex_MemRawData_Read(\PointerToRawData + Offset,SizeOf(long))
- If *plong
- Protected ImageBase.q = CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS32\OptionalHeader\ImageBase
- If Pex_Is64Bit()
- ImageBase = CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\ImageBase
- EndIf
- Protected RRVA = *plong\l - ImageBase
- AddList(gilist(),"Data" +Chr(10) +Pex_Hex_Value(*plong\l,#PB_Long) +
- Chr(10) + *plong\l)
- FreeMemory(*plong)
- EndIf
- Break
- EndIf
- EndWith
- Next
- If RRVA > 0
- ForEach CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- With CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- If \VirtualAddress <= RRVA And \VirtualAddress+ \VirtualSize > RRVA
- AddList(gilist(),"Remote Section " + Chr(10) + \__File_Selction_Name +
- Chr(10) + "Remote Offset : " + Str(RRVA))
- Break
- EndIf
- EndWith
- Next
- EndIf
- EndIf
- ElseIf SelectType <> ""
- With CurrentPB_PEExplorerFile
- ForEach \IMAGE_BASE_RELOCATIONList()
- If Pex_Hex_Value(\IMAGE_BASE_RELOCATIONList()\VirtualAddress,#PB_Long) = SelectType
- AddList(gilist(),"SizeOfBlock" +Chr(10) + Pex_Hex_Value(\IMAGE_BASE_RELOCATIONList()\SizeOfBlock,#PB_Long) + Chr(10) +
- Str(\IMAGE_BASE_RELOCATIONList()\SizeOfBlock) + " Byte")
- AddList(gilist(),"Items" +Chr(10) +Str(ListSize(\IMAGE_BASE_RELOCATIONList()\RelocationTypeList())))
- SRVA = \IMAGE_BASE_RELOCATIONList()\VirtualAddress
- Break
- EndIf
- Next
- EndWith
- ForEach CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- With CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- If \VirtualAddress <= SRVA And \VirtualAddress+ \VirtualSize > SRVA
- AddList(gilist(),"Section" +Chr(10) +\__File_Selction_Name)
- Break
- EndIf
- EndWith
- Next
- Else
- Protected RelocCount.l
- With CurrentPB_PEExplorerFile
- ForEach \IMAGE_BASE_RELOCATIONList()
- RelocCount+ListSize(\IMAGE_BASE_RELOCATIONList()\RelocationTypeList())
- Next
- EndWith
- AddList(gilist(),"Relocation Count" + Chr(10) + Str(RelocCount))
- EndIf
- Case#File_Info
- AddList(gilist(),"Name" +Chr(10) + GetFilePart(CurrentFileLoc))
- AddList(gilist(),"Size" +Chr(10) +Str(FileSize(CurrentFileLoc) ) + " Byte")
- AddList(gilist(),"Offset Entry Code" +Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\__File_OffsetEntryCode,#PB_Long ) +
- Chr(10) + Str(CurrentPB_PEExplorerFile\__File_OffsetEntryCode))
- AddList(gilist(),"MD5 Hash" +Chr(10) + Pex_RawData_Hash())
- With CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS32
- StatusBarText(#StatusBar_PeExplorer, #StatusBarItem_PeInfo, (CurrentFileLoc) +
- " " +
- " Made for :" +
- Pex_Machine_Type(\FileHeader\Machine) +
- " " +
- " Machine :" +
- Pex_Image_Type(\OptionalHeader\Magic))
- EndWith
- Case #DOS_HEADER
- With CurrentPB_PEExplorerFile\IMAGE_DOS_HEADER
- AddList(gilist(),"e_magic" + Chr(10) + Pex_Hex_Value(\e_magic,#PB_Word) +
- Chr(10) + Chr(PeekA(@\e_magic)) + Chr(PeekA(@\e_magic+1)))
- AddList(gilist(),"e_cblp" + Chr(10) + Pex_Hex_Value(\e_cblp,#PB_Word))
- AddList(gilist(),"e_cp" + Chr(10) + Pex_Hex_Value(\e_cp,#PB_Word))
- AddList(gilist(),"e_crlc" + Chr(10) + Pex_Hex_Value(\e_crlc,#PB_Word))
- AddList(gilist(),"e_cparhdr" + Chr(10) + Pex_Hex_Value(\e_cparhdr,#PB_Word))
- AddList(gilist(),"e_minalloc" + Chr(10) + Pex_Hex_Value(\e_minalloc,#PB_Word))
- AddList(gilist(),"e_maxalloc" + Chr(10) + Pex_Hex_Value(\e_maxalloc,#PB_Word))
- AddList(gilist(),"e_ss" + Chr(10) + Pex_Hex_Value(\e_ss,#PB_Word))
- AddList(gilist(),"e_sp" + Chr(10) + Pex_Hex_Value(\e_sp,#PB_Word))
- AddList(gilist(),"e_csum" + Chr(10) + Pex_Hex_Value(\e_csum,#PB_Word))
- AddList(gilist(),"e_ip" + Chr(10) + Pex_Hex_Value(\e_ip,#PB_Word))
- AddList(gilist(),"e_cs" + Chr(10) + Pex_Hex_Value(\e_cs,#PB_Word))
- AddList(gilist(),"e_lfarlc" + Chr(10) + Pex_Hex_Value(\e_lfarlc,#PB_Word))
- AddList(gilist(),"e_ovno" + Chr(10) + Pex_Hex_Value(\e_ovno,#PB_Word))
- AddList(gilist(),"e_res[0]" + Chr(10) + Pex_Hex_Value(\e_res[0],#PB_Word))
- AddList(gilist(),"e_res[1]" + Chr(10) + Pex_Hex_Value(\e_res[1],#PB_Word))
- AddList(gilist(),"e_res[2]" + Chr(10) + Pex_Hex_Value(\e_res[2],#PB_Word))
- AddList(gilist(),"e_res[3]" + Chr(10) + Pex_Hex_Value(\e_res[3],#PB_Word))
- AddList(gilist(),"e_oemid" + Chr(10) + Pex_Hex_Value(\e_oemid,#PB_Word))
- AddList(gilist(),"e_oeminfo" + Chr(10) + Pex_Hex_Value(\e_oeminfo,#PB_Word))
- AddList(gilist(),"e_res2[0]" + Chr(10) + Pex_Hex_Value(\e_res2[0],#PB_Word))
- AddList(gilist(),"e_res2[1]" + Chr(10) + Pex_Hex_Value(\e_res2[1],#PB_Word))
- AddList(gilist(),"e_res2[2]" + Chr(10) + Pex_Hex_Value(\e_res2[2],#PB_Word))
- AddList(gilist(),"e_res2[3]" + Chr(10) + Pex_Hex_Value(\e_res2[3],#PB_Word))
- AddList(gilist(),"e_res2[4]" + Chr(10) + Pex_Hex_Value(\e_res2[4],#PB_Word))
- AddList(gilist(),"e_res2[5]" + Chr(10) + Pex_Hex_Value(\e_res2[5],#PB_Word))
- AddList(gilist(),"e_res2[6]" + Chr(10) + Pex_Hex_Value(\e_res2[6],#PB_Word))
- AddList(gilist(),"e_res2[7]" + Chr(10) + Pex_Hex_Value(\e_res2[7],#PB_Word))
- AddList(gilist(),"e_res2[8]" + Chr(10) + Pex_Hex_Value(\e_res2[8],#PB_Word))
- AddList(gilist(),"e_res2[9]" + Chr(10) + Pex_Hex_Value(\e_res2[9],#PB_Word))
- AddList(gilist(),"e_lfanew" + Chr(10) + Pex_Hex_Value(\e_lfanew,#PB_Long))
- EndWith
- Case #IMAGE_NT_HEADERS
- With CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS32
- AddList(gilist(),"Signature" + Chr(10) + Pex_Hex_Value(\Signature,#PB_Long)+
- Chr(10) + Chr(PeekA(@\Signature)) + Chr(PeekA(@\Signature+1)))
- EndWith
- Case #FILE_HEADER
- With CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS32\FileHeader
- AddList(gilist(),"Machine" + Chr(10) + Pex_Hex_Value(\Machine,#PB_Word)+ Chr(10) + Pex_Machine_Type(\Machine))
- AddList(gilist(),"NumberOfSections" + Chr(10) + Pex_Hex_Value(\NumberOfSections,#PB_Word) +
- Chr(10) + Str(\NumberOfSections))
- AddList(gilist(),"TimeDateStamp" + Chr(10) + Pex_Hex_Value(\TimeDateStamp,#PB_Long)+
- Chr(10) + "Date created : " + Pex_Date_Format(\TimeDateStamp))
- AddList(gilist(),"PointerToSymbolTable" + Chr(10) + Pex_Hex_Value(\PointerToSymbolTable,#PB_Long))
- AddList(gilist(),"NumberOfSymbols" + Chr(10) + Pex_Hex_Value(\NumberOfSymbols,#PB_Long))
- AddList(gilist(),"SizeOfOptionalHeader" + Chr(10) + Pex_Hex_Value(\SizeOfOptionalHeader,#PB_Word) +
- Chr(10) + Str(\SizeOfOptionalHeader) + " Byte")
- AddList(gilist(),"Characteristics" + Chr(10) + Pex_Hex_Value(\Characteristics,#PB_Word) +
- Chr(10) + Pex_ImageFile_Type(\Characteristics))
- EndWith
- Case #OPTIONAL_HEADER
- With CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS32\OptionalHeader
- AddList(gilist(),"Magic" + Chr(10) + Pex_Hex_Value(\Magic,#PB_Word)+ Chr(10) + Pex_Image_Type(\Magic))
- AddList(gilist(),"MajorLinkerVersion" + Chr(10) + Pex_Hex_Value(\MajorLinkerVersion,#PB_Byte)+
- Chr(10) + "Linker Version : " + Str(\MajorLinkerVersion) +"."+ Str( \MinorLinkerVersion))
- AddList(gilist(),"MinorLinkerVersion" + Chr(10) + Pex_Hex_Value(\MinorLinkerVersion,#PB_Byte))
- AddList(gilist(),"SizeOfCode" + Chr(10) + Pex_Hex_Value(\SizeOfCode,#PB_Long) +
- Chr(10) + Str(\SizeOfCode) + " Byte")
- AddList(gilist(),"SizeOfInitializedData" + Chr(10) + Pex_Hex_Value(\SizeOfInitializedData,#PB_Long) +
- Chr(10) + Str(\SizeOfInitializedData) + " Byte")
- AddList(gilist(),"SizeOfUninitializedData" + Chr(10) + Pex_Hex_Value(\SizeOfUninitializedData,#PB_Long) +
- Chr(10) + Str(\SizeOfUninitializedData) + " Byte")
- AddList(gilist(),"AddressOfEntryPoint" + Chr(10) + Pex_Hex_Value(\AddressOfEntryPoint,#PB_Long) +
- Chr(10) + Str(\AddressOfEntryPoint))
- AddList(gilist(),"BaseOfCode" + Chr(10) + Pex_Hex_Value(\BaseOfCode,#PB_Long) + Chr(10) + Str(\baseofcode))
- If Pex_Is64Bit()
- AddList(gilist(),"ImageBase" + Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\ImageBase,#PB_Quad) +
- Chr(10) + Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\ImageBase))
- Else
- AddList(gilist(),"BaseOfData" + Chr(10) + Pex_Hex_Value(\BaseOfData,#PB_Long) +
- Chr(10) + Str(\BaseOfData))
- AddList(gilist(),"ImageBase" + Chr(10) + Pex_Hex_Value(\ImageBase,#PB_Long) +
- Chr(10) + Str(\ImageBase))
- EndIf
- AddList(gilist(),"SectionAlignment" + Chr(10) + Pex_Hex_Value(\SectionAlignment,#PB_Long)+
- Chr(10) + Str(\SectionAlignment))
- AddList(gilist(),"FileAlignment" + Chr(10) + Pex_Hex_Value(\FileAlignment,#PB_Long) +
- Chr(10) + Str(\FileAlignment))
- AddList(gilist(),"MajorOperatingSystemVersion" + Chr(10) + Pex_Hex_Value(\MajorOperatingSystemVersion,#PB_Word)+
- Chr(10) + "Required operating system Version :" + Str(\MajorOperatingSystemVersion) +
- "."+ Str( \MinorOperatingSystemVersion))
- AddList(gilist(),"MinorOperatingSystemVersion" + Chr(10) + Pex_Hex_Value(\MinorOperatingSystemVersion,#PB_Word))
- AddList(gilist(),"MajorImageVersion" + Chr(10) + Pex_Hex_Value(\MajorImageVersion,#PB_Word)+
- Chr(10) + "Image Version : " + Str(\MajorImageVersion) +"."+ Str( \MinorImageVersion))
- AddList(gilist(),"MinorImageVersion" + Chr(10) + Pex_Hex_Value(\MinorImageVersion,#PB_Word))
- AddList(gilist(),"MajorSubsystemVersion" + Chr(10) + Pex_Hex_Value(\MajorSubsystemVersion,#PB_Word)+
- Chr(10) + "Subsystem Version : " + Str(\MajorSubsystemVersion) +"."+
- Str( \MinorSubsystemVersion))
- AddList(gilist(),"MinorSubsystemVersion" + Chr(10) + Pex_Hex_Value(\MinorSubsystemVersion,#PB_Word))
- AddList(gilist(),"Win32VersionValue" + Chr(10) + Pex_Hex_Value(\Win32VersionValue,#PB_Long))
- AddList(gilist(),"SizeOfImage" + Chr(10) + Pex_Hex_Value(\SizeOfImage,#PB_Long) +
- Chr(10) + Str(\SizeOfImage) + " Byte")
- AddList(gilist(),"SizeOfHeaders" + Chr(10) + Pex_Hex_Value(\SizeOfHeaders,#PB_Long) +
- Chr(10) + Str(\SizeOfHeaders) + " Byte")
- AddList(gilist(),"CheckSum" + Chr(10) + Pex_Hex_Value(\CheckSum,#PB_Long))
- AddList(gilist(),"Subsystem" + Chr(10) + Pex_Hex_Value(\Subsystem,#PB_Word)+
- Chr(10) + Pex_Subsystem_Type(\Subsystem))
- AddList(gilist(),"DllCharacteristics" + Chr(10) + Pex_Hex_Value(\DllCharacteristics,#PB_Word)+
- Chr(10) + Pex_Dll_Characteristics(\DllCharacteristics))
- If Pex_Is64Bit()
- AddList(gilist(),"SizeOfStackReserve" + Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfStackReserve,#PB_Quad)+ Chr(10) +
- Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfStackReserve))
- AddList(gilist(),"SizeOfStackCommit" + Chr(10) + Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfStackCommit,#PB_Quad)+ Chr(10) +
- Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfStackCommit))
- AddList(gilist(),"SizeOfHeapReserve" + Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfHeapReserve,#PB_Quad) + Chr(10) +
- Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfHeapReserve))
- AddList(gilist(),"SizeOfHeapCommit" + Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfHeapCommit,#PB_Quad) + Chr(10) +
- Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\SizeOfHeapCommit))
- AddList(gilist(),"LoaderFlags" + Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\LoaderFlags,#PB_Long) + Chr(10) +
- Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\LoaderFlags))
- AddList(gilist(),"NumberOfRvaAndSizes" + Chr(10) +
- Pex_Hex_Value(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\NumberOfRvaAndSizes,#PB_Long) + Chr(10) +
- Str(CurrentPB_PEExplorerFile\IMAGE_NT_HEADERS64\OptionalHeader\NumberOfRvaAndSizes))
- Else
- AddList(gilist(),"SizeOfStackReserve" + Chr(10) + Pex_Hex_Value(\SizeOfStackReserve,#PB_Long) +
- Chr(10) + Str(\SizeOfStackReserve))
- AddList(gilist(),"SizeOfStackCommit" + Chr(10) + Pex_Hex_Value(\SizeOfStackCommit,#PB_Long) +
- Chr(10) + Str(\SizeOfStackCommit))
- AddList(gilist(),"SizeOfHeapReserve" + Chr(10) + Pex_Hex_Value(\SizeOfHeapReserve,#PB_Long) +
- Chr(10) + Str(\SizeOfHeapReserve))
- AddList(gilist(),"SizeOfHeapCommit" + Chr(10) + Pex_Hex_Value(\SizeOfHeapCommit,#PB_Long) +
- Chr(10) + Str(\SizeOfHeapCommit))
- AddList(gilist(),"LoaderFlags" + Chr(10) + Pex_Hex_Value(\LoaderFlags,#PB_Long) + Chr(10) +
- Str(\LoaderFlags))
- AddList(gilist(),"NumberOfRvaAndSizes" + Chr(10) + Pex_Hex_Value(\NumberOfRvaAndSizes,#PB_Long) +
- Chr(10) + Str(\NumberOfRvaAndSizes))
- EndIf
- EndWith
- Case #SECTION_HEADER
- If SelectType = #SECTION_HEADER
- With CurrentPB_PEExplorerFile
- AddList(gilist(),"Section count" + Chr(10) + Str(ListSize(\IMAGE_SECTION_HEADERList())))
- EndWith
- Else
- ForEach CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- With CurrentPB_PEExplorerFile\IMAGE_SECTION_HEADERList()
- If \__File_Selction_Name = SelectType
- AddList(gilist(),"SecName[8]" + Chr(10) + Pex_Hex_Value(PeekQ(@\SecName),#PB_Quad)+ Chr(10) + SelectType)
- AddList(gilist(),"PhysicalAddr" + Chr(10) + Pex_Hex_Value(\PhysicalAddr,#PB_Long))
- AddList(gilist(),"VirtualSize" + Chr(10) + Pex_Hex_Value(\VirtualSize,#PB_Long) +
- Chr(10) + Str(\VirtualSize) + " Byte")
- AddList(gilist(),"VirtualAddress" + Chr(10) + Pex_Hex_Value(\VirtualAddress,#PB_Long) +
- Chr(10) + Str(\VirtualAddress))
- AddList(gilist(),"SizeOfRawData" + Chr(10) + Pex_Hex_Value(\SizeOfRawData,#PB_Long) + Chr(10) +
- Str(\SizeOfRawData) + " Byte")
- AddList(gilist(),"PointerToRawData" + Chr(10) + Pex_Hex_Value(\PointerToRawData,#PB_Long) +
- Chr(10) + Str(\PointerToRawData))
- AddList(gilist(),"PointerToRelocations" + Chr(10) + Pex_Hex_Value(\PointerToRelocations,#PB_Long))
- AddList(gilist(),"PointerToLinenumbers" + Chr(10) + Pex_Hex_Value(\PointerToLinenumbers,#PB_Long))
- AddList(gilist(),"NumberOfRelocations" + Chr(10) + Pex_Hex_Value(\NumberOfRelocations,#PB_Word))
- AddList(gilist(),"NumberOfLinenumbers" + Chr(10) + Pex_Hex_Value(\NumberOfLinenumbers,#PB_Word))
- AddList(gilist(),"Characteristics" + Chr(10) + Pex_Hex_Value(\Characteristics,#PB_Long)+ Chr(10) +
- Pex_Section_Characteristics(\Characteristics))
- AddList(gilist(),"")
- AddList(gilist(),"Section MD5 Hash" + Chr(10) +Pex_RawData_Hash(\PointerToRawData,\SizeOfRawData))
- Break
- EndIf
- EndWith
- Next
- EndIf
- Case #DESCRIPTOR_IMPORT
- If ResFileType <> ""
- Protected fUnctioname$
- With CurrentPB_PEExplorerFile\IMAGE_IMPORT_DESCRIPTORInfo
- ForEach \IMAGE_IMPORT_DESCRIPTORList()
- If \IMAGE_IMPORT_DESCRIPTORList()\LibraryName = SelectType
- ForEach \IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()
- If \IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal
- If Pex_Is64Bit()
- fUnctioname$=Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal&$ffffff,#PB_Quad)
- Else
- fUnctioname$=Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal&$ffffff,#PB_Long)
- EndIf
- Else
- fUnctioname$= \IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\FunctionName
- EndIf
- If fUnctioname$ = ResFileType
- If \IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal
- AddList(gilist(),"Ordinal" + Chr(10) + fUnctioname$)
- Else
- AddList(gilist(),"Name" + Chr(10) + fUnctioname$)
- EndIf
- If Pex_Is64Bit()
- AddList(gilist(),"IMAGE_THUNK_DATA" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\IMAGE_THUNK_DATA,#PB_Quad))
- Else
- AddList(gilist(),"IMAGE_THUNK_DATA" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\IMAGE_THUNK_DATA,#PB_Long))
- EndIf
- Break
- EndIf
- Next
- Break
- EndIf
- Next
- EndWith
- ElseIf SelectType <> ""
- With CurrentPB_PEExplorerFile\IMAGE_IMPORT_DESCRIPTORInfo
- ForEach \IMAGE_IMPORT_DESCRIPTORList()
- If \IMAGE_IMPORT_DESCRIPTORList()\LibraryName = SelectType
- AddList(gilist(),"OriginalFirstThunk" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\OriginalFirstThunk,#PB_Long))
- AddList(gilist(),"TimeDateStamp" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\TimeDateStamp,#PB_Long)+ Chr(10) +
- "Date : " + Pex_Date_Format(\IMAGE_IMPORT_DESCRIPTORList()\TimeDateStamp))
- AddList(gilist(),"ForwarderChain" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\ForwarderChain,#PB_Long))
- AddList(gilist(),"Name" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\Name,#PB_Long))
- AddList(gilist(),"FirstThunk" + Chr(10) + Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORList()\FirstThunk,#PB_Long))
- Break
- EndIf
- Next
- EndWith
- Else
- Protected FuncCount.l
- With CurrentPB_PEExplorerFile\IMAGE_IMPORT_DESCRIPTORInfo
- ForEach \IMAGE_IMPORT_DESCRIPTORList()
- FuncCount+ListSize(\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe())
- Next
- EndWith
- AddList(gilist(),"Function Count" + Chr(10) + Str(FuncCount))
- EndIf
- Case #DESCRIPTOR_EXPORT
- If SelectType <> ""
- With CurrentPB_PEExplorerFile\IMAGE_EXPORT_DIRECTORYInfo
- ForEach \ExportFunctionNameListe()
- If \ExportFunctionNameListe()\FunctionName = SelectType
- AddList(gilist(),"Address" + Chr(10) + Pex_Hex_Value(\ExportFunctionNameListe()\FunctionAddress,#PB_Long))
- AddList(gilist(),"Ordinale" + Chr(10) + Pex_Hex_Value(\ExportFunctionNameListe()\Ordinale,#PB_Word))
- Break
- EndIf
- Next
- EndWith
- Else
- With CurrentPB_PEExplorerFile\IMAGE_EXPORT_DIRECTORYInfo
- AddList(gilist(),"Characteristics" + Chr(10) + Pex_Hex_Value(\Characteristics,#PB_Long))
- AddList(gilist(),"TimeDateStamp" + Chr(10) + Pex_Hex_Value(\TimeDateStamp,#PB_Long)+
- Chr(10) + "Date : " + Pex_Date_Format(\TimeDateStamp))
- AddList(gilist(),"MajorVersion" + Chr(10) + Pex_Hex_Value(\MajorVersion,#PB_Word)+
- Chr(10) + Str(\MajorVersion) + "." + Str(\MinorVersion))
- AddList(gilist(),"MinorVersion" + Chr(10) + Pex_Hex_Value(\MinorVersion,#PB_Word))
- AddList(gilist(),"Name" + Chr(10) + Pex_Hex_Value(\Name,#PB_Long)+ Chr(10) + \__File_OriginalDllName)
- AddList(gilist(),"Base" + Chr(10) + Pex_Hex_Value(\Base,#PB_Long))
- AddList(gilist(),"NumberOfFunctions" + Chr(10) + Pex_Hex_Value(\NumberOfFunctions,#PB_Long) +
- Chr(10) + Str(\NumberOfFunctions))
- AddList(gilist(),"NumberOfNames" + Chr(10) + Pex_Hex_Value(\NumberOfNames,#PB_Long) +
- Chr(10) + Str(\NumberOfNames))
- AddList(gilist(),"AddressOfFunctions" + Chr(10) + Pex_Hex_Value(\AddressOfFunctions,#PB_Long))
- AddList(gilist(),"AddressOfNames" + Chr(10) + Pex_Hex_Value(\AddressOfNames,#PB_Long))
- AddList(gilist(),"AddressOfNameOrdinals" + Chr(10) + Pex_Hex_Value(\AddressOfNameOrdinals,#PB_Long))
- EndWith
- EndIf
- Case #ENDOFDATA
- With CurrentPB_PEExplorerFile
- AddList(gilist(),"Size" + Chr(10) + Str(FileSize(CurrentFileLoc)-\__File_ImageSize) + " Byte")
- AddList(gilist(),"File Offset" + Chr(10) + Pex_Hex_Value(\__File_ImageSize,#PB_Long) +
- Chr(10) + Str(\__File_ImageSize))
- AddList(gilist(),"Frist 30 Byte Of Data" + Chr(10) +
- Pex_HexRawData_Read(\__File_ImageSize,FileSize(CurrentFileLoc)-\__File_ImageSize,30,1) +
- Chr(10) + ReplaceString(Pex_HexRawData_Read(\__File_ImageSize,FileSize(CurrentFileLoc)-\__File_ImageSize,30,0),Chr(10),""))
- EndWith
- Case #DESCRIPTOR_RESOURCE
- Protected Cres$,ResnType$
- If SelectType <> ""
- If ResFileType <> ""
- With CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo
- ForEach \ResourceDirectoryList()
- If \ResourceDirectoryList()\__File_ResourceDirectoryName
- Cres$= \ResourceDirectoryList()\__File_ResourceDirectoryName
- ResnType$ = "String"
- Else
- Cres$ = Pex_Resource_Type(\ResourceDirectoryList()\__File_ResourceDirectoryID)
- ResnType$ = "Integer"
- EndIf
- If Cres$ = SelectType
- ForEach \ResourceDirectoryList()\ResourceSubDirectoryList()
- If \ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryName
- Cres$= \ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryName
- ResnType$ = "String"
- Else
- Cres$ = Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryID)
- ResnType$ = "Integer"
- EndIf
- If Cres$ = ResFileType
- AddList(gilist(),"Characteristics" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\Characteristics,#PB_Long)+
- Chr(10) + "Entry Name Type : " + ResnType$);
- AddList(gilist(),"TimeDateStamp" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\TimeDateStamp,#PB_Long)+
- Chr(10) + "Date : " + Pex_Date_Format(\ResourceDirectoryList()\ResourceSubDirectoryList()\TimeDateStamp))
- AddList(gilist(),"MajorVersion" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\MajorVersion,#PB_Word)+
- Chr(10) + Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\MajorVersion) + "." +
- Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\MinorVersion))
- AddList(gilist(),"MinorVersion" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\MinorVersion,#PB_Word))
- AddList(gilist(),"NumberOfNamedEntries" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\NumberOfNamedEntries,#PB_Word)+
- Chr(10) + Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\NumberOfNamedEntries))
- AddList(gilist(),"NumberOfIdEntries" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\NumberOfIdEntries,#PB_Word) +
- Chr(10) + Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\NumberOfIdEntries))
- AddList(gilist(),"")
- AddList(gilist(),"File Resource Offset" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceOffset,#PB_Long)+
- Chr(10) + Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceOffset))
- AddList(gilist(),"OffsetToData" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\OffsetToData,#PB_Long))
- AddList(gilist(),"Size" + Chr(10) + Str(\ResourceDirectoryList()\ResourceSubDirectoryList()\Size) + " Byte")
- AddList(gilist(),"CodePage" + Chr(10) +
- Pex_Hex_Value(\ResourceDirectoryList()\ResourceSubDirectoryList()\CodePage,#PB_Long))
- AddList(gilist(),"Frist 30 Byte Of resource" + Chr(10) +
- Pex_HexRawData_Read(\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceOffset,\ResourceDirectoryList()\ResourceSubDirectoryList()\Size,30) +
- Chr(10) + ReplaceString(Pex_HexRawData_Read(\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceOffset,\ResourceDirectoryList()\ResourceSubDirectoryList()\Size,30,0),Chr(10),""))
- Pex_Resource_Read(\ResourceDirectoryList()\__File_ResourceDirectoryID,
- \ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryName,
- \ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryID,
- \ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceOffset,
- \ResourceDirectoryList()\ResourceSubDirectoryList()\Size)
- Break
- EndIf
- Next
- Break
- EndIf
- Next
- EndWith
- Else
- ForEach CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()
- If CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\__File_ResourceDirectoryName
- Cres$= CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\__File_ResourceDirectoryName
- ResnType$ = "String"
- Else
- Cres$ = Pex_Resource_Type(CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\__File_ResourceDirectoryID)
- ResnType$ = "Integer"
- EndIf
- If Cres$ = SelectType
- With CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()
- AddList(gilist(),"Characteristics" + Chr(10) +
- Pex_Hex_Value(\Characteristics,#PB_Long)+ Chr(10) + "Entry Name Type : " + ResnType$);
- AddList(gilist(),"TimeDateStamp" + Chr(10) +
- Pex_Hex_Value(\TimeDateStamp,#PB_Long)+ Chr(10) + "Date : " +
- Pex_Date_Format(\TimeDateStamp))
- AddList(gilist(),"MajorVersion" + Chr(10) +
- Pex_Hex_Value(\MajorVersion,#PB_Word)+ Chr(10) +
- Str(\MajorVersion) + "." + Str(\MinorVersion))
- AddList(gilist(),"MinorVersion" + Chr(10) + Pex_Hex_Value(\MinorVersion,#PB_Word))
- AddList(gilist(),"NumberOfNamedEntries" + Chr(10) + Pex_Hex_Value(\NumberOfNamedEntries,#PB_Word) +
- Chr(10) + Str(\NumberOfNamedEntries))
- AddList(gilist(),"NumberOfIdEntries" + Chr(10) + Pex_Hex_Value(\NumberOfIdEntries,#PB_Word) +
- Chr(10) + Str(\NumberOfIdEntries))
- EndWith
- Break
- EndIf
- Next
- EndIf
- Else
- With CurrentPB_PEExplorerFile\IMAGE_RESOURCE_DIRECTORYInfo
- AddList(gilist(),"Characteristics" + Chr(10) + Pex_Hex_Value(\Characteristics,#PB_Long));
- AddList(gilist(),"TimeDateStamp" + Chr(10) + Pex_Hex_Value(\TimeDateStamp,#PB_Long)+
- Chr(10) + "Date : " + Pex_Date_Format(\TimeDateStamp))
- AddList(gilist(),"MajorVersion" + Chr(10) +
- Pex_Hex_Value(\MajorVersion,#PB_Word)+ Chr(10) + Str(\MajorVersion) + "." +
- Str(\MinorVersion))
- AddList(gilist(),"MinorVersion" + Chr(10) + Pex_Hex_Value(\MinorVersion,#PB_Word))
- AddList(gilist(),"NumberOfNamedEntries" + Chr(10) + Pex_Hex_Value(\NumberOfNamedEntries,#PB_Word) +
- Chr(10) + Str(\NumberOfNamedEntries))
- AddList(gilist(),"NumberOfIdEntries" + Chr(10) + Pex_Hex_Value(\NumberOfIdEntries,#PB_Word) +
- Chr(10) + Str(\NumberOfIdEntries))
- EndWith
- EndIf
- EndSelect
- ForEach gilist()
- AddGadgetItem(#Gadget_ListIcon_PeExplorer,-1,gilist())
- Next
- EndProcedure
- Procedure PeGetInfo_PeExplorer()
- Protected Sttree = GetGadgetState(#Gadget_Tree_PeExplorer)
- If Sttree = -1 :ProcedureReturn:EndIf
- Protected gettreeTxt$ = GetGadgetItemText(#Gadget_Tree_PeExplorer,Sttree)
- Protected t.l,Selectednode$,PerSdir$
- ClearGadgetItems(#Gadget_ListIcon_PeExplorer)
- Select gettreeTxt$
- Case #ENDOFDATA
- SetInfoHeader_PeExplorer(#ENDOFDATA)
- Case #File_Info
- SetInfoHeader_PeExplorer(#File_Info)
- Case #FILE_HEADER, #OPTIONAL_HEADER
- SetInfoHeader_PeExplorer(gettreeTxt$)
- Default
- For t=Sttree To 0 Step -1
- If GetGadgetItemAttribute(#Gadget_Tree_PeExplorer, t, #PB_Tree_SubLevel) = 2
- If PerSdir$ =""
- PerSdir$= GetGadgetItemText(#Gadget_Tree_PeExplorer,t)
- EndIf
- EndIf
- If GetGadgetItemAttribute(#Gadget_Tree_PeExplorer, t, #PB_Tree_SubLevel) = 1
- Selectednode$= GetGadgetItemText(#Gadget_Tree_PeExplorer,t)
- Break
- EndIf
- Next
- Select Selectednode$
- Case #DESCRIPTOR_RESOURCE
- If gettreeTxt$ = #DESCRIPTOR_RESOURCE
- SetInfoHeader_PeExplorer(#DESCRIPTOR_RESOURCE)
- Else
- If GetGadgetItemAttribute(#Gadget_Tree_PeExplorer, Sttree, #PB_Tree_SubLevel) = 2
- SetInfoHeader_PeExplorer(#DESCRIPTOR_RESOURCE,gettreeTxt$)
- Else
- SetInfoHeader_PeExplorer(#DESCRIPTOR_RESOURCE, PerSdir$,gettreeTxt$)
- EndIf
- EndIf
- Case #DESCRIPTOR_EXPORT
- If gettreeTxt$ = #DESCRIPTOR_EXPORT
- SetInfoHeader_PeExplorer(#DESCRIPTOR_EXPORT)
- Else
- SetInfoHeader_PeExplorer(#DESCRIPTOR_EXPORT,gettreeTxt$)
- EndIf
- Case #DESCRIPTOR_IMPORT
- If gettreeTxt$ = #DESCRIPTOR_IMPORT
- SetInfoHeader_PeExplorer(#DESCRIPTOR_IMPORT)
- ElseIf GetGadgetItemAttribute(#Gadget_Tree_PeExplorer, Sttree, #PB_Tree_SubLevel) = 2
- SetInfoHeader_PeExplorer(#DESCRIPTOR_IMPORT,GetFilePart(gettreeTxt$))
- Else
- SetInfoHeader_PeExplorer(#DESCRIPTOR_IMPORT,GetFilePart(PerSdir$),gettreeTxt$)
- EndIf
- Case #DESCRIPTOR_RELOCATION
- If gettreeTxt$ = #DESCRIPTOR_RELOCATION
- SetInfoHeader_PeExplorer(#DESCRIPTOR_RELOCATION)
- ElseIf GetGadgetItemAttribute(#Gadget_Tree_PeExplorer, Sttree, #PB_Tree_SubLevel) = 2
- SetInfoHeader_PeExplorer(#DESCRIPTOR_RELOCATION,GetFilePart(gettreeTxt$))
- Else
- SetInfoHeader_PeExplorer(#DESCRIPTOR_RELOCATION,GetFilePart(PerSdir$),gettreeTxt$)
- EndIf
- Default
- SetInfoHeader_PeExplorer(Selectednode$,gettreeTxt$)
- EndSelect
- EndSelect
- EndProcedure
- Procedure PeSetInfo_PeExplorer(FilePath.s)
- If UCase(GetExtensionPart(FilePath)) = "LNK"
- FilePath = GetFilePathFromLnk(FilePath)
- If FilePath = "":MessageRequester("","Unable to open file!"):ProcedureReturn 0:EndIf
- EndIf
- FilePath = GetLongPathName(FilePath)
- Protected tPB_PEExplorerFile.PB_PEExplorer
- Protected RdExe = ReadFile(#PB_Any, FilePath); open pe file to read
- If Not RdExe:MessageRequester("","Unable to open file!"):ProcedureReturn 0:EndIf
- If Pb_PEExplorer(RdExe ,@tPB_PEExplorerFile) = 0:CloseFile(RdExe)
- MessageRequester("","Error Get Pe Info!")
- ProcedureReturn:EndIf
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 40)
- CloseFile(RdExe)
- ClearStructure(@CurrentPB_PEExplorerFile,PB_PEExplorer)
- CurrentPB_PEExplorerFile=tPB_PEExplorerFile
- CurrentFileLoc = FilePath
- ClearGadgetItems(#Gadget_Tree_PeExplorer)
- ClearGadgetItems(#Gadget_ListIcon_PeExplorer)
- With CurrentPB_PEExplorerFile
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#File_Info)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#DOS_HEADER,0,1)
- SetGadgetItemState(#Gadget_Tree_PeExplorer, 0, #PB_Tree_Expanded)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#IMAGE_NT_HEADERS,0,1)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#FILE_HEADER,0,2)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#OPTIONAL_HEADER,0,2)
- SetGadgetItemState(#Gadget_Tree_PeExplorer, 2, #PB_Tree_Expanded)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#SECTION_HEADER,0,1)
- ForEach \IMAGE_SECTION_HEADERList()
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,(\IMAGE_SECTION_HEADERList()\__File_Selction_Name),0,2)
- Next
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 60)
- If ListSize(\IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()) >0
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#DESCRIPTOR_IMPORT,0,1)
- ForEach \IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()
- ; AddGadgetItem(#Gadget_Tree_PeExplorer,-1,(\IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\LibraryName),0,2)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Pex_DLL_FindPath(\IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\LibraryName),0,2)
- ForEach \IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()
- If \IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal
- If Pex_Is64Bit()
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal&$ffffff,#PB_Quad),0,3)
- Else
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Pex_Hex_Value(\IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\Ordinal&$ffffff,#PB_Long),0,3)
- EndIf
- Else
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,\IMAGE_IMPORT_DESCRIPTORInfo\IMAGE_IMPORT_DESCRIPTORList()\ImportFunctionListe()\FunctionName,0,3)
- EndIf
- Next
- Next
- EndIf
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 70)
- If ListSize(\IMAGE_BASE_RELOCATIONList()) >0
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#DESCRIPTOR_RELOCATION,0,1)
- ForEach \IMAGE_BASE_RELOCATIONList()
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Pex_Hex_Value(\IMAGE_BASE_RELOCATIONList()\VirtualAddress,#PB_Long),0,2)
- ForEach \IMAGE_BASE_RELOCATIONList()\RelocationTypeList()
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Pex_Hex_Value(\IMAGE_BASE_RELOCATIONList()\RelocationTypeList()\u,#PB_Word),0,3)
- Next
- Next
- EndIf
- If ListSize(\IMAGE_EXPORT_DIRECTORYInfo\ExportFunctionNameListe()) >0
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#DESCRIPTOR_EXPORT,0,1)
- ForEach \IMAGE_EXPORT_DIRECTORYInfo\ExportFunctionNameListe()
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,(\IMAGE_EXPORT_DIRECTORYInfo\ExportFunctionNameListe()\FunctionName),0,2)
- Next
- EndIf
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 80)
- If ListSize(\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()) >0
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#DESCRIPTOR_RESOURCE,0,1)
- ForEach \IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()
- If \IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\__File_ResourceDirectoryName
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,(\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\__File_ResourceDirectoryName),0,2)
- Else
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Pex_Resource_Type(\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\__File_ResourceDirectoryID),0,2)
- EndIf
- ForEach \IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\ResourceSubDirectoryList()
- If \IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryName
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,(\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryName),0,3)
- Else
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,Str(\IMAGE_RESOURCE_DIRECTORYInfo\ResourceDirectoryList()\ResourceSubDirectoryList()\__File_ResourceDirectoryID),0,3)
- EndIf
- Next
- Next
- EndIf
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 90)
- If \__File_ImageSize <> FileSize(CurrentFileLoc)
- AddGadgetItem(#Gadget_Tree_PeExplorer,-1,#ENDOFDATA,0,1)
- EndIf
- EndWith
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 100)
- SetInfoHeader_PeExplorer(#File_Info)
- SetWindowTitle(#Window_PeExplorer,"PeExplorer v 1.0 [" + GetFilePart(FilePath) + "]")
- If Pex_UpxPacker_Detect()
- If Pex_UpxPacker_UnPacked() = 1
- PeSetInfo_PeExplorer(FilePath)
- EndIf
- EndIf
- EndProcedure
- Procedure SelectaFile_PeExplorer()
- Protected FilePath.s=OpenFileRequester("Select a file...","","Exe or Dll|*.dll;*.exe|All|*.*",0)
- If FilePath="":ProcedureReturn:EndIf
- PeSetInfo_PeExplorer(FilePath)
- EndProcedure
- Procedure DropFileWindow_PeExplorer()
- PeSetInfo_PeExplorer(EventDropFiles())
- EndProcedure
- Procedure OpenWindow_PeExplorer()
- OpenWindow(#Window_PeExplorer, 0, 0, 820, 465, "PeExplorer v 1.0", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
- CreateStatusBar( #StatusBar_PeExplorer, WindowID(#Window_PeExplorer))
- AddStatusBarField(#PB_Ignore)
- StatusBarText( #StatusBar_PeExplorer, #StatusBarItem_PeInfo, "Hi " + UserName())
- AddStatusBarField(50)
- StatusBarProgress(#StatusBar_PeExplorer, #StatusBarItem_PeProgress, 0)
- CreateMenu(#Menu_Window_PeExplorer, WindowID(#Window_PeExplorer))
- MenuTitle("&File")
- MenuItem(#MenuItem_SelectFile, "&Open a Pe")
- MenuBar()
- MenuItem(#MenuItem_Exit, "Exit")
- MenuTitle("Plugins")
- MenuTitle("About")
- TreeGadget(#Gadget_Tree_PeExplorer, 5, 5, 205, 410)
- ListIconGadget(#Gadget_ListIcon_PeExplorer, 215, 5, 600, 410, "Member", 200)
- AddGadgetColumn(#Gadget_ListIcon_PeExplorer,1,"Value",200)
- AddGadgetColumn(#Gadget_ListIcon_PeExplorer,2,"Comment",200)
- SplitterGadget(#Gadget_Splitter_PeExplorer,5,5,600+205+5,410,#Gadget_Tree_PeExplorer,#Gadget_ListIcon_PeExplorer,#PB_Splitter_Vertical)
- EnableWindowDrop(#Window_PeExplorer, #PB_Drop_Files, #PB_Drag_Copy)
- BindEvent(#PB_Event_WindowDrop , @DropFileWindow_PeExplorer())
- BindEvent(#PB_Event_SizeWindow , @ResizeGadgetsWindow_PeExplorer())
- BindEvent(#PB_Event_CloseWindow , @CloseWindow_PeExplorer())
- BindMenuEvent(#Menu_Window_PeExplorer,#MenuItem_SelectFile,@SelectaFile_PeExplorer())
- BindMenuEvent(#Menu_Window_PeExplorer,#MenuItem_Exit,@CloseWindow_PeExplorer())
- BindGadgetEvent(#Gadget_Tree_PeExplorer,@PeGetInfo_PeExplorer(),#PB_EventType_LeftClick )
- SetGadgetState(#Gadget_Splitter_PeExplorer, 300)
- EndProcedure
- OpenWindow_PeExplorer()
- LoadPlugins_PeExplorer()
- If ProgramParameter(0)
- PeSetInfo_PeExplorer(ProgramParameter(0))
- EndIf
- While WaitWindowEvent() <> #PB_Event_CloseWindow:Wend
- If pIPersistFile:pIPersistFile\Release():EndIf
- If pIShellLink:pIShellLink\Release():EndIf
- DataSection
- CLSID_ShellLink:
- Data.l $00021401
- Data.w $0000
- Data.w $0000
- Data.b $C0,$00,$00,$00,$00,$00,$00,$46
- IID_IShellLink:
- Data.l $000214F9
- Data.w $0000
- Data.w $0000
- Data.b $C0,$00,$00,$00,$00,$00,$00,$46
- IID_IPersistFile:
- Data.l $0000010b
- Data.w $0000
- Data.w $0000
- Data.b $C0,$00,$00,$00,$00,$00,$00,$46
- EndDataSection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement