flat assembler
Message board for the users of flat assembler.

Index > Windows > Help with Iczelion tut 35

Author
Thread Post new topic Reply to topic
alszla



Joined: 24 Sep 2016
Posts: 5
alszla 15 Oct 2016, 17:46
Hi,

Sorry to bother you again, I would like to ask for your help on this one. I am trying to "translate" Iczelion tutorial 35 (Rich Edit Control + Syntax highlighting). It passes the compilation process but for some reason, it does not highlight the keywords.
When debugging it, I can see that the code reaches to the lstrcmp API (one in the whole code) with the 1st parameter always null (the one that correspond to the keyword extracted from the 'wordfile.txt' file). That leads me to think that something in the procs
FillHiliteInfo, ParseBuffer or NewRichEditProc is not working properly, I think it may have something to do with the way the WORDINFO structures (for each keyword) are saved, but I'm not exactly sure.

Hopefully someone who has already played with this Iczelion tutorial can bring some light here. I'm posting my translation code along with the required files.

Thanks in advance.

Regards,
alszla


Description:
Download
Filename: ftut35.zip
Filesize: 21.96 KB
Downloaded: 392 Time(s)

Post 15 Oct 2016, 17:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20363
Location: In your JS exploiting you and your system
revolution 16 Oct 2016, 00:33
I expect your problem is the line 621:
Code:
        invoke lstrcpy,edx,addr buffer    
Note that the addr syntax uses edx to obtain the address of buffer. That is it will assemble to this code:
Code:
lea edx,[buffer]
push edx    
So your value of edx is now corrupted.

BTW: There is no need to transfer the the value in eax to edx before doing the invoke. You can use eax directly:
Code:
        invoke lstrcpy,eax,addr buffer    
Post 16 Oct 2016, 00:33
View user's profile Send private message Visit poster's website Reply with quote
alszla



Joined: 24 Sep 2016
Posts: 5
alszla 16 Oct 2016, 03:31
Absolutely right!!!, Thanks revolution.

I can see it clearly now, this tut being originally written for MASM32 performs that transfer (from eax to edx) after invoking HeapAlloc because MASM32 assembles 'addr' using eax:
Code:
lea  eax, [buffer]
push eax    

as opposed to FASM, which assembles just like you said using edx register instead.

For sure, I could have been staring at the code for who knows how long and still not catching that detail and perhaps ruining the rest of the code.
Thank you very much Revolution.

Regards,
alszla
Post 16 Oct 2016, 03:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.