English
Forum

menace worse crashes wg. ProcAddr at Callbacks, Threads

 
Hello IF...

I habs time tested and hope nothing wrong made to have:
CompileMarkSeparation
 $U thread.pcu = thread.
DEF @GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"
DEF @ButtonClicked(1) @GetDlgCtrlID(@&(1))=-%MENUITEM
Testprogramm Timer
Profan Version 9
 $H Windows.ph
-Main----------------------------------------------------------------
Declare Timer_Busy%,Ende%
Declare TimerID&,Create%,T_Text&,Test#
WindowStyle 26
WindowTitle "Timertest PHU-60"
Window 100,100 - 370,200
cls
Let T_TEXT&=@CREATETEXT(%HWND,"",30,30,300,30)
-Menue---------------------------------------------------------------
PopUp "&Programm"
AppendMenu 108,"&Einstellungen"
AppendMenu 109,"&Ende"
Ende% = 0
Timer setzen (4x pro Sekunde, 250ms)
thread.start 1,1

WhileNot Ende%

    WaitInput

    If @MenuItem(108)

        Einstellungen

    Endif

    If @MenuItem(109)

        thread.stopall
        Ende% = 1

    Endif

Wend

End
-Proc Einstellungen

Proc Einstellungen

    Declare hD%, hA%, hB%, OK%, hTime%
    Declare hF1%, hT1%
    Clear OK%
    Dialogfenster erzeugen
    hD% = @Create("Dialog",%hWnd,"Einstellungen",%WinLeft+80,%WinTop+155,230,190)
    hF1% = @Create("Font","Arial",16,0,0,0,0)
    hT1% = @Create("Text",hD%,"Einstellungen...",10,10,220,20)
    SetFont hT1%,hF1%
    hTime% = @Create("TimeEdit", hD%, "00:00:00", 10, 35, 70, 24)
    hB% = @Create("Button",hD%,"&Nachstellen",10,120,100,28)
    hA% = @Create("Button",hD%,"&Abbrechen",120,120,100,28)

    WhileNot Ok%

        WaitInput

        If @ButtonClicked(hB%)  Nachstellen

            Ok% = 1
            Aktionen hier

        ElseIf @ButtonClicked(hA%) Abbrechen

            Ok% = 1

        ElseIf (%Key = 2) ALT+F4 bzw. schließen

            Ok% = 1

        EndIf

    EndWhile

    DeleteObject hF1%
    @DestroyWindow(hD%)

EndProc

-Prozedur die in bestimmten Zeitintervallen ausgefuehrt wird (4x pro Sekunde)

Proc thread.do

    parameters n&
    Dim Test#,1000000
    Inc Timer_Busy%
    Locate 5,5
    Print "Timer:" + @str$(Timer_Busy%) + " Durchläufe"
    Settext T_Text&,"Timer:" + @str$(Timer_Busy%) + " Durchläufe"
    ENDPROC


too here becomes the window not correctly. displayed!
what means the? go in the Hauptprogramm during one Thread carryed out, überschreibt Profan intern gespeicherte variables to that Call of API. depending on, which Profanfunktionen in the Hauptprogramm uses go, is the menace time More and times less given, she's but too (loudly Roland) at direct Call of APIs present. when and whether a Error appears, depends of chosen Zeitintervall, of computer and from the Programmbedienung by the User ex.
what means the very?

One example:
at that one computer under windows2000 becomes when calling the API RegUnloadKey one such Crash causes and the API becomes therefore not correctly carryed out. thereupon becomes the Registryhive the User not How planned entladen and is at next Start not any more available => one ganzes Userprofile is unwiederbringlich lost.

One differently example:
the Hauptprogramm writes during one Callback runs into Registry. there everything unfavourable zusammentrifft, becomes in a others Key written and Datenj in the Registry weg lost!

further ask and Notes?
 
09/09/06  
 



what you say means the once a procedure, which by ProcAddr on a Api transfer watts, a Api instead of of XProfan self called becomes, XProfan this not correctly auseinanderhalten can and Variablenspeicher überschrieben go?

now the would mortal, especially since the Yes then indeed whom FastMode concerns, and each APP which a Own wProc own so potenziell as very dangerous classed go should. the concerns means Callbacks and Subclassing.

but I Have ne remedy - hopefully - How behave it itself if itself no Variablenbezeichnung - in none procedure - widerholt? same trouble? *to*Roland*cry*only*the*kanns*know*

If my AbhilfeIdee the trouble however eliminating ought to - then hieße it too the one mere-on-OOP-basiertes Program möglicherweise less dangerous his could?
 
09/09/06  
 



Ah I see too you have in Your demonstration a Info of I do not mind, which besagte the only the Waitinput with Thread.Start and Thread.Stop umschlossen his ought to!

I Have whom Source time so changed How I me the vorstelle and recommend, and see there, there's no Problems:
CompileMarkSeparation
 $U Thread.pcu = Thread.
Def @Getdlgctrlid(1) !"USER32","GetDlgCtrlID"
Def @Buttonclicked(1) @Getdlgctrlid(@&(1))=-%Menuitem
Testprogramm Timer
Profan Version 9
 $H Windows.ph
-Main----------------------------------------------------------------
Declare Timer_busy%,Ende%
Declare Timerid&,Create%,T_text&,Test#
Windowstyle 26
Windowtitle "Timertest PHU-60"
Window 100,100 - 370,200
Cls
Let T_TEXT&=@CREATETEXT(%HWND,"",30,30,300,30)
-Menue---------------------------------------------------------------
Popup "&Programm"
Appendmenu 108,"&Einstellungen"
Appendmenu 109,"&Ende"
Ende% = 0
Timer setzen (4x pro Sekunde, 250ms)

Whilenot Ende%

    .waitinput

    If @Menuitem(108)

        Einstellungen

    Endif

    If @Menuitem(109)

        Ende% = 1

    Endif

Wend

End
-Proc Einstellungen

Proc Einstellungen

    Declare Hd%, Ha%, Hb%, Ok%, Htime%
    Declare Hf1%, Ht1%
    Clear Ok%
    Dialogfenster erzeugen
    Hd% = @Create("Dialog",%Hwnd,"Einstellungen",%Winleft+80,%Wintop+155,230,190)
    Hf1% = @Create("Font","Arial",16,0,0,0,0)
    Ht1% = @Create("Text",Hd%,"Einstellungen...",10,10,220,20)
    Setfont Ht1%,Hf1%
    Htime% = @Create("TimeEdit", Hd%, "00:00:00", 10, 35, 70, 24)
    Hb% = @Create("Button",Hd%,"&Nachstellen",10,120,100,28)
    Ha% = @Create("Button",Hd%,"&Abbrechen",120,120,100,28)

    Whilenot Ok%

        .Waitinput

        If @Buttonclicked(Hb%) Nachstellen

            Ok% = 1
            Aktionen hier

        Elseif @Buttonclicked(Ha%)Abbrechen

            Ok% = 1

        Elseif (%Key = 2)ALT+F4 bzw. schließen

            Ok% = 1

        Endif

    Endwhile

    Deleteobject Hf1%
    @Destroywindow(Hd%)

Endproc

-Prozedur die in bestimmten Zeitintervallen ausgefuehrt wird (4x pro Sekunde)

Proc Thread.do

    Parameters N&
    Dim Test#,1000000
    Inc Timer_busy%
    Locate 5,5
    Print "Timer:" + @Str$(Timer_busy%) + " Durchläufe"
    Settext T_Text&,"Timer:" + @str$(Timer_Busy%) + " Durchläufe"
    Dispose Test#

Endproc

proc .waitinput

    thread.start 1
    Waitinput
    thread.stopn class=s2>1

endproc

 
09/09/06  
 



Hello IF...

No, no Variablenspeicher - the would not so bad.
my Statement:
If a Profanfunktion, z.B. Create, carryed out becomes, must Create first once auseinandergepflückt go. it must u.a. screen go, which API Create Call should. moreover must data stored and compared go.
If now in the middle in the comparison the Callback carryed out becomes (before The API called watts), go these data überschrieben and if the Callback zurückkehrt, standing there where now the API Call compared go ought to, only yet Mist.
 
09/09/06  
 



Well but go still time the here of me written one:

[quote:ca377de2a5]what you say means the once a procedure, which by ProcAddr on a Api transfer watts, a Api instead of of XProfan self called becomes, XProfan this not correctly auseinanderhalten can and Variablenspeicher überschrieben go?

now the would mortal, especially since the Yes then indeed whom FastMode concerns, and each APP which a Own wProc own so potenziell as very dangerous classed go should. the concerns means Callbacks and Subclassing.

but I Have ne remedy - hopefully - How behave it itself if itself no Variablenbezeichnung - in none procedure - widerholt? same trouble? *to*Roland*cry*only*the*kanns*know*

If my AbhilfeIdee the trouble however eliminating ought to - then hieße it too the one mere-on-OOP-basiertes Program möglicherweise less dangerous his could?[/quote:ca377de2a5]
These supposition from you I had but already then, therefore recommended I indeed the following:

[quote:ca377de2a5]Ah I see too you have in Your demonstration a Info of I do not mind, which besagte the only the Waitinput with Thread.Start and Thread.Stop umschlossen his ought to![/quote:ca377de2a5]
 
09/09/06  
 



Rolands response hereon should eigendlich his, that if one Callbacks uses, and/or whom Fastmode, the one then only pure API write must. I faith but the that so not virtual is, or?
 
09/09/06  
 



Hello IF...

A good idea around the To bypass, still sometimes would like (must) one even GetMessage use.

Greeting

Andreas
 
09/09/06  
 



[quote:14713789fd=Andreas Hötker]Hello IF...

A good idea around the To bypass, still sometimes would like (must) one even GetMessage use.

Greeting

Andreas[/quote:14713789fd]
is me clear - but there's nunmal no function / procedure / Unit / whatever which in 100% all Cases/situations always correctly. is or. correctly appropriate is.

plenty worse - time from the thread.pcu foreseen - find I still the whole with the Callbacks!
 
09/09/06  
 



we're means at Topic XProfansche Critical-Sections arrived
 
09/09/06  
 



[quote:a00f5c25f8=iF]Well but go still time the here of me written one:

[quote:a00f5c25f8]what you say means the once a procedure, which by ProcAddr on a Api transfer watts, a Api instead of of XProfan self called becomes, XProfan this not correctly auseinanderhalten can and Variablenspeicher überschrieben go?

[/quote:a00f5c25f8][/quote:a00f5c25f8]
first once no variables, separate of Profan intern genutzte Structures
Also goes not around the Übergabe of/ one Prozeduradresse, separate around the, what in the Hauptprogramm happens.

Why skin the there, what You there do:
You stoppst whom Timer, before the window created becomes => the can't crashen, whom the Timer runs none, if the window created becomes.
Nochmal (1001 time ):
theory:
1 Profan arbeitet´die Create function the Fensters ex.
2. Profan places thereby data of Create in internen memory ex, circa u.a. To to check on, which API called weerden must.
3. before The API Create complete worn out is, d.h. before The API CreateWindowEx of Profan called becomes, calls the OS The the Timer mitgegebene address on.
4. Profan lead functions in the Callback from and occupied The internen variables with new Values.
5. The Callback becomes until end carryed out and it'll to the address sprang, on the before quit watts.
6. Profan wants CreateWindowEx Call, here stand but now The data of Callback

so my I the...
 
09/09/06  
 



You I know circa your theory, neither first are Your present Posting separate me does it whole already very long by the head...

...therefore meant I Yes the it accordingly not only TimerOPs concerns separate each Api which a XProfanProzedur aufruft!
 
09/09/06  
 



I faith there's for Roland The Possibility, one appeal of/ one XProfanprozedur a API out, abzuprüfen. i think even it would otherwise The function procaddr  not at all possible - somehow must it Yes whom allegedly plunge on a not-nativ-vorliegenden Prozeduradresse umsetzen. Perhaps can it here something kapseln?!
 
09/09/06  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.286 Views

Untitledvor 0 min.
H.Brill01/26/23
Peter Max Müller11/13/17
iF07/19/15
Ernst03/02/15

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie