View Single Post
  #4  
Old 10-08-2022, 23:09
sendersu sendersu is offline
VIP
 
Join Date: Oct 2010
Posts: 1,067
Rept. Given: 332
Rept. Rcvd 223 Times in 115 Posts
Thanks Given: 235
Thanks Rcvd at 513 Times in 288 Posts
sendersu Reputation: 200-299 sendersu Reputation: 200-299 sendersu Reputation: 200-299
Hi Zeocrack
I've analyzed your code, the culprit looks like comes from ripped code
it is the assembly instruction

mov ebp, temp

which is overwriting value of register ebp (which is used when you call any WinAPI + passing some local variable

eg in your case - after you damaged correct ebp value you are calling afterwards this:

invoke SetDlgItemText,hWnd,ID_OUTPUT,addr buffer

and it translates to the following asm code:

CPU Disasm
Address Hex dump Command Comments
004012DE |. 68 1E314000 PUSH OFFSET 0040311E ; /Text = "Z-K25494-2549"
004012E3 |. 6A 65 PUSH 65 ; |ControlID = 101.
004012E5 |. FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hDialog
004012E8 |. E8 AB000000 CALL ; \USER32.SetDlgItemTextA

and the crash is on the line which is trying to use the (damaged) value of EBP register...


usually app should not use EBP as data register, so either do not use it (use another one), or if you need to use it - do the push ebp ... change ebp + math ...pop ebp
Reply With Quote
The Following 2 Users Gave Reputation+1 to sendersu For This Useful Post:
niculaita (10-09-2022), sh3dow (10-11-2022)
The Following 4 Users Say Thank You to sendersu For This Useful Post:
niculaita (10-09-2022), sh3dow (10-11-2022), tonyweb (10-08-2022), Zeocrack (10-09-2022)