Results 1 to 11 of 11

Thread: NASM - GUI related question

  1. #1
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5

    Arrow NASM - GUI related question

    Hey everyone,

    actually i contiune my work on GPE (Generic Plugin Engine) and i have some probs with a log window:

    this is the code to colorize in WM_CTLCOLOREDIT of my log field :

    Code:
        push    0x00000001
        push    dword[wparam]
        call    [SetBkMode]
        
        push    0x0000FFFF
        push    dword[wparam]
        call    [SetTextColor]
        
        push    0x00000000
        call    [CreateSolidBrush]
    everything works fine the field is black and the color yellow. but a problem occurs when i delete characters. only if i delete a whole line the chars are delete but if i only delete a few chars there are not deleted

    Any idea ??

    Thx
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

  2. #2
    Teach, Not Flame Kayaker's Avatar
    Join Date
    Oct 2000
    Posts
    4,124
    Blog Entries
    5
    Hey. Not sure why you get that problem specifically, but usually with those WM_CTLCOLOR* messages you're supposed to return a handle to a brush, so you could finish with something like

    invoke GetStockObject, DC_BRUSH
    ret ; return handle to the brush

  3. #3
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5
    hi kayaker,

    thx for answering. i know that have to return a brush. and thats exactly what i do by calling the CreateSolidBrush api. it returns a brush.
    i haven't had time yet to try it but i will in my break.

    i will post the problem when it is solved, my someone is interested in the solution.

    cheers,

    OHPen
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

  4. #4
    Administrator dELTA's Avatar
    Join Date
    Oct 2000
    Location
    Ring -1
    Posts
    4,206
    Blog Entries
    5
    What is this "GPE (Generic Plugin Engine)"?
    "Give a man a quote from the FAQ, and he'll ignore it. Print the FAQ, shove it up his ass, kick him in the balls, DDoS his ass and kick/ban him, and the point usually gets through eventually."

  5. #5
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5
    @delta: generic plugin engine can be considered as a reverse engineering platform which will be base on a simple plugin architecture i developed. the platform will provide basic functionality like scripting, logging and a transformation mechanism which will be based on XSLT to convert between different data sources.

    i plan to release a disassembler and a debugger plugin with the first release. the disassembler is already finished and works for x86(32 and 64 bit - AMD/INTEL). once released everyone can use it to develop its own plugins. if you start developing a new plugin you can use the functionality of already existing plugings by registering the needed functionality via the interface. if the plugin is not present the functionality is just disabled.

    i see eclipse as the prototype for my idea because i developed a lot of java applications in the past and imho eclipse is the best ide which is availible atm (concerning refactoring, code templates, autocompletition, and so on and yeah only for java i know, but with the first good cdt release this will change )

    I have no idea whether someone will use it but due to my work i have to code nasm and its a way to build the needed practice.
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

  6. #6
    Master Of Nebulah Frost Polaris's Avatar
    Join Date
    Jun 2002
    Location
    Invincible Cyclones Of FrostWinds
    Posts
    221
    Actually, it sounds really interesting... I am really looking forward to its release. Is there any limitation in terms of the language used to code the plugins?
    Stand In The Fog With So Cold A Heart... Watching The Death Of The Sun...

  7. #7
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5
    @polaris: i will provide a plugin sdk with a couple of languages, so no restriction in that direction.

    @kayaker: i try your suggestion and i have the same result. i called GetStockObject with BLACK_BRUSH constant and i got the same result. it seems that there is another problem.

    Maybe i described my problem not that appropriate so here a better one:

    Lets assume i type following text inside my log box:

    abcdefg
    123
    XYZANDSOON

    You see my textbox contains 3 lines. the cursor is actually placed at the end of the third line. now i press the delete button one time. the cursor moves one char left. i can do that 8 times again and nothing happens expect that the cursor is now placed right from "X". Still the whole line is completly intact. If i know press the delete button one more time the third line disappears and the cursor is now placed right from the "3". so the mechnism of updating the background only work when the cariage return of a previous line was deleted.
    i have no idea why this behaves in this strange way. i used log windows in c and c++ formerly without having such problems but in this case i code everything in nasm. i also compared the diassembly of a working c example with the code i generate and i can not see big differences, so its really strange.

    nevertheless, just a matter of time and thats why i hate such silly problems
    Last edited by OHPen; January 30th, 2008 at 13:08.
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

  8. #8
    Teach, Not Flame Kayaker's Avatar
    Join Date
    Oct 2000
    Posts
    4,124
    Blog Entries
    5
    EDIT: I wrote this before your last edit OHPen, sorry.

    I know that seemed like a redundant statement OHPen, since you're already returning a brush. But, you're getting a glitch one way or another and I was just trying to find a possible reason for it.

    WM_CTLCOLOREDIT - for the returned brush, "The system uses the brush to paint the background of the edit control."

    I thought perhaps the brush you are returning was causing a background effect and that was giving you the visual problems.

    From some of the stuff I've read, I alway use that GetStockObject statement with any DC stuff.

    http://blogs.msdn.com/oldnewthing/archive/2005/04/20/410031.aspx

    Might not be the source of your problem but it was the only thing I could think of from the initial description

  9. #9
    Administrator dELTA's Avatar
    Join Date
    Oct 2000
    Location
    Ring -1
    Posts
    4,206
    Blog Entries
    5
    Sounds like a very nice tool OHPen, make sure to let us know as soon as it is released (and we/you can then also add it to the CRCETL).
    "Give a man a quote from the FAQ, and he'll ignore it. Print the FAQ, shove it up his ass, kick him in the balls, DDoS his ass and kick/ban him, and the point usually gets through eventually."

  10. #10
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5
    @delta: i will be a pleasure for me to hear other peoples comment about the gpe, especially for future enhancements. when i release the first version i will upload it the collaborative tools.

    @kayaker: i used sice to debug the message and there is definitivly no difference between using GetStockObject and CreateSolidBrush. So my search continues...
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

  11. #11
    ::[ Reverse Engineer ]:: OHPen's Avatar
    Join Date
    Nov 2002
    Location
    .text
    Posts
    399
    Blog Entries
    5
    Hoi,

    finally i found a solution for my problem. It's still kind of irritating for me why i have to do it that way, because in every high level language it works with the "default" way. Anyway this solved the problem in my case:

    Code:
        ;set flag that background color should be drawn before new text is drawn
        push    OPAQUE
        push    dword[wparam]
        call    [SetBkMode]
        
        ;set background color
        push    RGB_COLOR_BLACK
        push    dword[wparam]
        call    [SetBkColor]
        
        ;set text color
        push    RGB_COLOR_YELLOW
        push    dword[wparam]
        call    [SetTextColor]
        
        ;create solid brush with black color to return
        push    RGB_COLOR_BLACK
        call    [CreateSolidBrush]
    Regards,

    OHPen aka PAPiLLiON
    - Reverse Enginnering can be everything, but sometimes it's more than nothing. Really rare moments but then they appear to last ages... -

Similar Threads

  1. Simple UAC-related question
    By Maximus in forum The Newbie Forum
    Replies: 7
    Last Post: November 16th, 2010, 17:38
  2. Stupid assembly-related question
    By kralik in forum The Newbie Forum
    Replies: 5
    Last Post: March 27th, 2007, 02:14
  3. Need help using Ollydbg and NASM
    By pityocamptes in forum OllyDbg Support Forums
    Replies: 1
    Last Post: November 29th, 2004, 07:33
  4. DLL in NASM
    By AmAdEuS in forum The Newbie Forum
    Replies: 5
    Last Post: June 7th, 2004, 10:40
  5. about NASM
    By 0x400 in forum Tools of Our Trade (TOT) Messageboard
    Replies: 4
    Last Post: November 12th, 2000, 03:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •