ich habe hier einen Quellcode, den ich vor zig Jahren geschrieben habe. Ist nichts besonderes und war nur als Übung für mich gedacht gewesen. Jetzt habe ich das Problem, dass der Code von PB nicht ausgeführt wird bzw. es wird das executable erstellt aber irgendwie ohne Einstiegspunkt. Kann dieses Verhalten jemand von euch nachbilden bzw. mir aufzeigen, welcher Unsinn meinerseits dafür verantwortlich sein könnte? Habe schon jeglichen überflüssigen Code auskommentiert...
Danke

Arbeitsumgebung: ArchLinux (neueste Pakete), letzte PB-Beta 32bit
Code: Alles auswählen
EnableExplicit
;Fehlerbehandlung:
; CompilerSelect #PB_Compiler_OS
; CompilerCase #PB_OS_Windows
; XIncludeFile "..\pb_include\dlgs\dlgerror.pbi"
; CompilerCase #PB_OS_Linux
; XIncludeFile "/media/Projekte/Projekte/pb_include/dlgs/dlgerror.pbi"
; CompilerEndSelect
;OnErrorGoto(?FehlerAbfangen)
;- includes
; CompilerSelect #PB_Compiler_OS
; CompilerCase #PB_OS_Windows
; XIncludeFile "..\pb_include\dlgs\dlabout.pbi"
; CompilerCase #PB_OS_Linux
; XIncludeFile "/media/Projekte/Projekte/pb_include/dlgs/dlgabout.pbi"
; CompilerEndSelect
#VERSION = "0.02.01"
#EMAIL = "abc@ddd.com"
;- main window
#Window_DllFunc = 1 ; main window
#Gadget_DllFuncStatic1 = 2 ; static field
#Gadget_DllFuncLoadedDll = 3 ; text field
#Gadget_DllFuncTable = 4 ; Tabelle mit den ermittelten Funktionen
Global hDllFunc.l
;- about dialog
#Window_AboutDlg = 100 ; about dialog
#Gadget_AboutDlgVersion = 101 ; version information
#Gadget_AboutDlgCopyright = 102 ; copyright information
#Gadget_AboutDlgEMail = 103 ; email address
Global hAboutDlg.l
;- Toolbar
#Toolbar_DllFunc = 0 ; toolbar
#Toolbar_LoadDll = 1001 ; load button
#Toolbar_Export = 1002 ; export button
#Toolbar_Info = 1003 ; about dialog
#Toolbar_Exit = 1004 ; exit
;- Toolbar-Buttons (imagelist)
#Toolbar_Image = 1004
#Toolbar_ImageMask = 1005
Global hImageList.l, hImageListMask.l
; hImageList = CatchImage(#Toolbar_Image, ?ImageList)
; hImageListMask = CatchImage(#Toolbar_ImageMask, ?ImageListMask)
; Fonts
; #Font_VerdanaBold = 0
; #Font_Verdana = 1
; #Font_CourierNew = 2
; Global hVerdanaBold.l
; Global hVerdana.l
; Global hCourierNew.l
; hVerdanaBold = LoadFont(#Font_VerdanaBold, "Verdana", 10, #PB_Font_Bold)
; hVerdana = LoadFont(#Font_Verdana, "Verdana", 10)
; hCourierNew = LoadFont(#Font_CourierNew, "Courier New", 10)
; structures
Structure SFunction
name.s
address.l
EndStructure
Global NewList Functions.SFunction()
; procedures
Declare Open_Window_DllFunc()
Declare Open_Window_AboutDlg()
;Declare.l Callback(WindowID, Message, wParam, lParam)
Declare DllFuncProc(event.l)
Declare LoadDll()
Declare GetDllFunctions(dll.s)
Declare ExportDllFunctions()
Global bQuit.b
Open_Window_DllFunc()
;SetWindowCallback(@Callback())
Define event.l
Repeat
event = WaitWindowEvent()
Select EventWindow()
Case #Window_DllFunc
DllFuncProc(event)
EndSelect
Until bQuit = 1
; FreeImage(#Toolbar_Image)
; FreeImage(#Toolbar_ImageMask)
; FreeFont(#Font_VerdanaBold)
; FreeFont(#Font_Verdana)
; FreeFont(#Font_CourierNew)
End
; opens the main window
Procedure Open_Window_DllFunc()
hDllFunc = OpenWindow(#Window_DllFunc, 0, 0, 600, 480, "DllFunc " + #VERSION, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
If hDllFunc = 0
MessageRequester("Error", "Can't open main window!", #PB_MessageRequester_Ok);#MB_OK | #MB_ICONSTOP)
bQuit = 1
ProcedureReturn
EndIf
; Toolbar
; If CreateTB(#Toolbar_DllFunc, hDllFunc, 32, 32, #TBpro_FLAT) = 0
; MessageRequester("Error", "Toolbar couldn't be created!", #PB_MessageRequester_Ok);#MB_OK | #MB_ICONSTOP)
; Else
; SetTBimage(hImageList, hImageListMask, #TBpro_NORMAL)
; AddTBbutton(#Toolbar_LoadDll, 1, #TBpro_BUTTON)
; AddTBseparator()
; AddTBbutton(#Toolbar_Export, 2, #TBpro_BUTTON)
; AddTBseparator()
; AddTBbutton(#Toolbar_Info, 4, #TBpro_BUTTON)
; AddTBseparator()
; AddTBbutton(#Toolbar_Exit, 6, #TBpro_BUTTON)
; SetTBbuttonTooltip(#Toolbar_LoadDll, "Load library...")
; SetTBbuttonTooltip(#Toolbar_Export, "Export functions...")
; SetTBbuttonTooltip(#Toolbar_Info, "About...")
; SetTBbuttonTooltip(#Toolbar_Exit, "Exit...")
; UpdateTB()
; EndIf
; Gadgets
TextGadget(#Gadget_DllFuncStatic1, 10, 50, 50, 20, "Library:")
;SetGadgetFont(#Gadget_DllFuncStatic1, hVerdana)
TextGadget(#Gadget_DllFuncLoadedDll, 65, 50, 300, 20, "n/a")
;SetGadgetFont(#Gadget_DllFuncLoadedDll, hVerdanaBold)
; Table
ListIconGadget(#Gadget_DllFuncTable, 10, 80, 580, 390, "Address", 100, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
AddGadgetColumn(#Gadget_DllFuncTable, 1, "Function", 470)
;SetGadgetFont(#Gadget_DllFuncTable, hCourierNew)
EndProcedure
; event handling procedure
Procedure DllFuncProc(event.l)
Select event
Case #PB_Event_CloseWindow
bQuit = 1
Case #PB_Event_Menu
Select EventGadget()
Case #Toolbar_LoadDll
LoadDll()
Case #Toolbar_Export
If ListSize(Functions())
ExportDllFunctions()
EndIf
Case #Toolbar_Info
Open_Window_AboutDlg()
Case #Toolbar_Exit
bQuit = 1
EndSelect
EndSelect
EndProcedure
; callback for windows
;Procedure.l Callback(WindowID, Message, wParam, lParam)
; Protected Result.l
; Result = #PB_ProcessPureBasicEvents
;
; Select Message
; Case #WM_SIZE
; If WindowID = hDllFunc
; ResizeGadget(#Gadget_DllFuncTable, #PB_Ignore, #PB_Ignore, WindowWidth(#Window_DllFunc) - 20, WindowHeight(#Window_DllFunc) - 90)
; UpdateTB(#Toolbar_DllFunc)
; EndIf
; Case #WM_KEYDOWN
; If WindowID = hAboutDlg
; CloseWindow(#Window_AboutDlg)
; EnableWindow_(hDllFunc, #True)
; SetActiveWindow(#Window_DllFunc)
; EndIf
; EndSelect
;
; ProcedureReturn Result
;EndProcedure
; loads a dll and inserts the investigatet functions into table
Procedure LoadDll()
Protected title$, pattern$, file$
title$ = "Please choose library to load..."
pattern$ = "DLL (*.dll)|*.dll"
file$ = OpenFileRequester(title$, "", pattern$, 0)
If Len(file$) = 0
ProcedureReturn
EndIf
GetDllFunctions(file$)
SetGadgetText(#Gadget_DllFuncLoadedDll, GetFilePart(file$))
; fill the table
ClearGadgetItems(#Gadget_DllFuncTable)
ResetList(Functions())
While NextElement(Functions())
AddGadgetItem(#Gadget_DllFuncTable, -1, Hex(Functions()\address) + Chr(10) + Functions()\name)
Wend
EndProcedure
; investigate all exported functions
Procedure GetDllFunctions(dll.s)
Protected hdll.l
ClearList(Functions())
hdll.l = OpenLibrary(0, dll)
If hdll = 0
MessageRequester("Error", "Can't load specified library!", #PB_MessageRequester_Ok);#MB_OK | #MB_ICONSTOP)
ProcedureReturn
EndIf
ExamineLibraryFunctions(0)
While NextLibraryFunction()
AddElement(Functions())
Functions()\address = LibraryFunctionAddress()
Functions()\name = LibraryFunctionName()
Wend
CloseLibrary(0)
EndProcedure
; exports the investigated library functions
Procedure ExportDllFunctions()
Protected title$, pattern$, file$
title$ = "Please choose file to save..."
pattern$ = "Textfile (*.txt)|*.txt"
file$ = SaveFileRequester(title$, "export.txt", pattern$, 0)
If Len(file$) = 0
ProcedureReturn
Else
If GetExtensionPart(file$) <> "txt"
file$ + ".txt"
EndIf
EndIf
If CreateFile(0, file$) = 0
MessageRequester("Error", "Can't create export file!", #PB_MessageRequester_Ok);#MB_OK | #MB_ICONSTOP)
ProcedureReturn
EndIf
; write info about dll
WriteStringN(0, "; " + GetGadgetText(#Gadget_DllFuncLoadedDll)) : WriteStringN(0, "")
ResetList(Functions())
While NextElement(Functions())
WriteStringN(0, Hex(Functions()\address) + Chr(9) + Functions()\name)
Wend
CloseFile(0)
EndProcedure
Procedure Open_Window_AboutDlg()
; OpenWindow_About(WindowID(#Window_DllFunc), "About...", "DllFunc " + #VERSION, "Copyright 2003 - 2010 by Alexander Resner", "alexander.resner@gmail.com")
EndProcedure
; DataSection
; ImageList:
; IncludeBinary "..\toolbar\kde2_32x32\toolbar.bmp"
; ImageListMask:
; IncludeBinary "..\toolbar\kde2_32x32\toolbarmask.bmp"
; EndDataSection
; Fehlerbehandlung
;FehlerAbfangen:
; ErrorDialog(WindowID(#Window_DllFunc), "Fehler", "Es ist ein Fehler während der Ausführung von %file% aufgetreten!", GetErrorInfo(), #EMAIL)
;Return
; IDE Options = PureBasic 4.61 Beta 1 (Linux - x86)
; CursorPosition = 30
; FirstLine = 15
; Folding = --
; EnableUnicode
; EnableXP
; CompileSourceDirectory
; Compiler = PureBasic 4.61 Beta 1 (Linux - x86)
; Warnings = Display