flat assembler
Message board for the users of flat assembler.

Index > IDE Development > FasmW Next Generation 0.01

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 14 Feb 2006, 01:37
uhmmm.....
Simply.....I put caret_x e caret_y out of 'locals' in asmedit.inc, so I can get the value directly from FasmWNG Wink

I'm going to take a look of your code....thx
Best regards
Post 14 Feb 2006, 01:37
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 14 Feb 2006, 07:42
Crukko wrote:
uhmmm.....
Simply.....I put caret_x e caret_y out of 'locals' in asmedit.inc, so I can get the value directly from FasmWNG Wink

Solution with window message is just more elegant, and prevents from modifing this variables outside AsmEdit.
Post 14 Feb 2006, 07:42
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 14 Feb 2006, 07:55
I'm sorry I missed updates on this thread. I'm still having problems. Windows 2k SP4 with SSE3 CPU.

I gets NULL-pointer somehow - it tries to write to it. It doesn't matter what I write to the dec,bin,hex,exp - it still crashes the moment I press <Enter>.
maybe you have jmp [0] somewhere or call [0], the zero can be also a register lik jmp eax (where eax is zero).

EDIT: OK, I did some debugging and I can see that your are not taking proper care of your threads. I know I had problems with my Conversion Dialog also Razz I can see, when I'm pressing <Enter> the program sends a SendMessage, but it gets in an infinite loop where this wierd thing happens:
after 5484 instructions, USER32 calls!!! to your program and this is where it goes:
Code:
  push ebp
  mov  ebp,esp
  push ebx edi
  cmp  [ebp+12],111h ;273
  je   label1
  cmp  [ebp+12],10h ;16
  je   label2
  cmp  [ebp+12],110h ;272
  je   label3
  xor  eax,eax
  jmp  label4
label1:
  cmp  [ebp+16],4000001h
  je   label5
  cmp  [ebp+16],4000002h
  je   label6
  cmp  [ebp+16],4000003h
  je   label7
  jmp  label4
label5:
  jmp  label4
label6:
  jmp  label4
label7:
  jmp  label4
label3:
  ;...
  ;324 bytes of code for dialog I think
  ;...
label4:
  pop  edi ebx
  ret
    

Then it returns to USER32 and does this a few times.
Final call to CallWindowProcA gets a zero pointer inside USER32 in 36 instructions.
Let me quote OllyDbg here Smile
Code:
PUSH    0
PUSH    ESI
PUSH    [DWORD EBP+18]
PUSH    [DWORD EBP+14]
PUSH    EDI
PUSH    [DWORD EBP+C]
CALL    [DWORD 77E6DB38] ;This address in dump is full of zeros many
                        ;kilobytes up and down
    

...where ebp=6FD20h and stack is...
Code:
0006FD18   0006FE54
0006FD1C   0006FE5C
0006FD20  /0006FD40
0006FD24  |77E27E2D  RETURN to USER32.77E27E2D from USER32.77E3AF5A
0006FD28  |C0000000
0006FD2C  |0019030E
0006FD30  |00000100
0006FD34  |0000000D
0006FD38  |001C0001
0006FD3C  |00000001
0006FD40  ]0006FD5C
0006FD44  |0040B40F  RETURN to d.0040B40F from USER32.CallWindowProcA
0006FD48  |C0000000
0006FD4C  |0019030E
0006FD50  |00000100
0006FD54  |0000000D
0006FD58  |001C0001
0006FD5C  ]0006FD7C
0006FD60  |77E4158F  RETURN to USER32.77E4158F
0006FD64  |0019030E
0006FD68  |00000100
0006FD6C  |0000000D
0006FD70  |001C0001
0006FD74  |0006FE5C
0006FD78  |DCBAABCD
0006FD7C  ]0006FE08
0006FD80  |77E41DC9  RETURN to USER32.77E41DC9 from USER32.77E41577
0006FD84  |0040B393  d.0040B393
    
Post 14 Feb 2006, 07:55
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 14 Feb 2006, 22:57
decard: I know your solution is better, but now I need fast solution...after FASMWNG version 1.00 I think I'll optimize everything Wink

Madis731: I notice the problem you said in debugging code too.....now I think the problem can be in Fasm...when it compile resource...I'll do some test.....first i'll use a normal window instead of the dialog....
BtW....why debugging with no simbol, when you can ask the source? Wink
here you are ...

decard & Madid: are you on MSN??? Wink

Code:
proc   WinConverterDialogProc hWnd,msg,wParam,lParam
    push    ebx edi                                                             ;Preserve as needed
    cmp     [msg], WM_COMMAND                                                   ;Are there any commands?
    je      command                                                             ;then deal with them
    cmp     [msg], WM_CLOSE                                                     ;or is it "close"?
    je      close                                                               ;so, do it!
    cmp     [msg], WM_INITDIALOG
    je      initdialog
    xor     eax,eax
    jmp     processed

command:
    cmp     [wParam],EN_UPDATE shl 16 + ID_WINDEC
    je      parseD             ;compare and jump accordingly
    cmp     [wParam],EN_UPDATE shl 16 + ID_WINHEX
    je      parseH             ;H-hexadecimal
    cmp     [wParam],EN_UPDATE shl 16 + ID_WINBIN
    je      parseB             ;B-binary
    jmp     processed          ;If defaults have been re-set
;<<<-c800----CODE TO UPDATE CELLS WHEN TYPED---------------->>>
parseD:                        ;Jump from above commands
    jmp     processed          ;we are finished
parseH:
    jmp     processed
parseB:
    jmp     processed
initdialog:
    push    [hWnd]
    pop     [hWinConverterDialog]
    invoke  GetDlgItem, [hWnd], ID_WINDEC;get a handle and use it
    mov     [hwindec], eax
    invoke  GetDlgItem, [hWnd], ID_WINBIN;get a handle and use it
    mov     [hwinbin], eax
    invoke  GetDlgItem, [hWnd], ID_WINHEX;get a handle and use it
    mov     [hwinhex], eax
    invoke  GetDlgItem, [hWnd], ID_WINEXP;get a handle and use it
    mov     [hwinexp], eax
    invoke  SendMessage, [hWnd], WM_SETFONT, _lf, TRUE

            invoke  SendMessage, [hwindec], EM_SETLIMITTEXT, 10, 0
            invoke  SendMessage, [hwinhex], EM_SETLIMITTEXT, 8, 0
            invoke  SendMessage, [hwinbin], EM_SETLIMITTEXT, 32, 0

        invoke  GetWindowLong, [hwindec], GWL_WNDPROC
        mov     [hwindec_proc], eax
        invoke  SetWindowLong, [hwindec], GWL_WNDPROC, WinConverterNewProc
        invoke  GetWindowLong, [hwinbin], GWL_WNDPROC
        mov     [hwinbin_proc], eax
        invoke  SetWindowLong, [hwinbin], GWL_WNDPROC, WinConverterNewProc
        invoke  GetWindowLong, [hwinhex], GWL_WNDPROC
        mov     [hwinhex_proc], eax
        invoke  SetWindowLong, [hwinhex], GWL_WNDPROC, WinConverterNewProc
        invoke  GetWindowLong, [hwinexp], GWL_WNDPROC
        mov     [hwinexp_proc], eax
        invoke  SetWindowLong, [hwinexp], GWL_WNDPROC, WinConverterNewProc

    mov     eax, dword TRUE
    jmp     processed
close:
    invoke  EndDialog,[hWnd],0 ;We only get here when closing
processed:
    pop     edi ebx            ;Put values back
    ret
endp

proc   WinConverterNewProc hWnd,msg,wParam,lParam
        mov     ecx, [hWnd]
        cmp     [msg], WM_KEYDOWN
        je      .wmkeydown
        cmp     [msg], WM_CHAR
        je      .wmchar
        cmp     [msg], WM_GETDLGCODE
        je      .getdlgcode

      .oldcall:
        cmp     ecx, [hwindec]
        jne     .cnt1
        mov     ebx, [hwindec_proc]
        jmp     .cnt_ok
      .cnt1:
        cmp     ecx, [hwinbin]
        jne     .cnt2
        mov     ebx, [hwinbin_proc]
        jmp     .cnt_ok
      .cnt2:
        cmp     ecx, [hwinhex]
        jne     .cnt3
        mov     ebx, [hwinhex_proc]
        jmp     .cnt_ok
      .cnt3:
        cmp     ecx, [hwinexp]
        jne     .cnt4
        mov     ebx, [hwinexp_proc]
        jmp     .cnt_ok
      .cnt4:

      .cnt_ok:
        invoke  CallWindowProc, ebx, [hWnd], [msg], [wParam], [lParam]
        ret

  .wmkeydown:
        cmp     [wParam], VK_ESCAPE
        je      .tasto_escape
        cmp     [wParam], VK_RETURN
        je      .return
        jmp    .oldcall

      .tasto_escape:
        stdcall GestioneFocus, [hWnd]
        jmp    .oldcall

  .wmchar:
        cmp     [wParam], VK_TAB
        je      .tastotab
        cmp     [wParam], VK_BACK
        je      .oldcall
        cmp     [hwindec], ecx
        je      .windec
        cmp     [hwinbin], ecx
        je      .winbin
        cmp     [hwinhex], ecx
        je      .winhex
        jmp    .oldcall

  .windec:
        cmp     byte [wParam], '0'
        jge     .cntdec
        ret
      .cntdec:
        cmp     byte [wParam], '9'
        jle     .oldcall
        ret
  .winbin:
        cmp     byte [wParam], '0'
        jge     .cntbin
        ret
      .cntbin:
        cmp     byte [wParam], '1'
        jle     .oldcall
        ret
  .winhex:
        cmp     byte [wParam], '0'
        jge     .cnthex
        ret
      .cnthex:
        cmp     byte [wParam], '9'
        jle     .oldcall
        cmp     byte [wParam], 'A'
        jge     .cnthex1
        ret
      .cnthex1:
        cmp     byte [wParam], 'F'
        jle     .oldcall
        cmp     byte [wParam], 'a'
        jge     .cnthex2
        ret
      .cnthex2:
        cmp     byte [wParam], 'f'
        jle     .oldcall
        ret
  .return:
        cmp     [hwindec], ecx
        jne     .return1
                invoke  SendMessage, [hwindec], WM_GETTEXT, dword 11, Buff
                stdcall _Val, Buff
                stdcall _Strs, [Valore], __Hex, Buff
                mov     [Buff + 8], byte 0
                invoke  SendMessage, [hwinhex], WM_SETTEXT, NULL, Buff
                stdcall _Strs, [Valore], __Bin, Buff
                mov     [Buff + 32], byte 0
                invoke  SendMessage, [hwinbin], WM_SETTEXT, NULL, Buff
        jmp    .oldcall
      .return1:
        cmp     [hwinbin], ecx
        jne     .return2
                mov     eax, Buff
                mov     [Buff], byte '%'
                inc     eax
                invoke  SendMessage, [hwinbin], WM_GETTEXT, dword 33, eax
                stdcall _Val, Buff
                stdcall _Strs, [Valore], __Hex, Buff
                mov     [Buff + 8], byte 0
                invoke  SendMessage, [hwinhex], WM_SETTEXT, NULL, Buff
                stdcall _Strs, [Valore], __Dec, Buff
                invoke  SendMessage, [hwindec], WM_SETTEXT, NULL, Buff
        jmp    .oldcall
      .return2:
        cmp     [hwinhex], ecx
        jne     .return3
                mov     eax, Buff
                mov     [Buff], byte 'h'
                inc     eax
                invoke  SendMessage, [hwinhex], WM_GETTEXT, dword 9, eax
                stdcall _Val,Buff
                stdcall _Strs, [Valore], __Dec, Buff
                invoke  SendMessage, [hwindec], WM_SETTEXT, NULL, Buff
                stdcall _Strs, [Valore], __Bin, Buff
                mov     [Buff + 32], byte 0
                invoke  SendMessage, [hwinbin], WM_SETTEXT, NULL, Buff
        jmp    .oldcall
      .return3:
        cmp     [hwinexp], ecx
        jne     .oldcall
                invoke  SendMessage, [hwinexp], WM_GETTEXT, dword 512, Buff
                mov     [Buff + eax], byte 0
                stdcall _ValoreEspressione, Buff, DeGOS_DatiBase, ValoreDeGOS_DatiBase
                cmp     [Flag_errore], 1
                jne     .oldcall
                stdcall _Strs, [Valore], __Dec, Buff
                invoke  SendMessage, [hwindec], WM_SETTEXT, NULL, Buff
                stdcall _Strs, [Valore], __Bin, Buff
                mov     [Buff + 32], byte 0
                invoke  SendMessage, [hwinbin], WM_SETTEXT, NULL, Buff
                stdcall _Strs, [Valore], __Hex, Buff
                mov     [Buff + 8], byte 0
                invoke  SendMessage, [hwinhex], WM_SETTEXT, NULL, Buff
        jmp    .oldcall

  .getdlgcode:
        mov    eax, dword DLGC_WANTALLKEYS
        ret

  .tastotab:
        cmp     [hwindec], ecx
        jne     .cambia1
        mov     ebx, [hwinbin]
        jmp     .cambia_ok
      .cambia1:
        cmp     [hwinbin], ecx
        jne     .cambia2
        mov     ebx, [hwinhex]
        jmp     .cambia_ok
      .cambia2:
        cmp     [hwinhex], ecx
        jne     .cambia3
        mov     ebx, [hwinexp]
        jmp     .cambia_ok
      .cambia3:
        cmp     [hwinexp], ecx
        jne     .oldcall
        mov     ebx, [hwindec]
      .cambia_ok:
        invoke  SetFocus, ebx
        ret
endp
    
Post 14 Feb 2006, 22:57
View user's profile Send private message Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 15 Feb 2006, 04:48
take a look at the new file posted Wink

I don't know why whe the win (that will be for the code completition) I have problem....other win disappear....????

Madis: try now the WinConverter...


Last edited by Crukko on 02 Mar 2006, 10:21; edited 1 time in total
Post 15 Feb 2006, 04:48
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 15 Feb 2006, 08:03
Don't know what causes the crash, but yes, I'm in MSN too...check the little icon called "msn" in my profile Wink

Maybe try:
Code:
proc   WinConverterDialogProc hWnd,msg,wParam,lParam
    pusha ;Preserve all possible registers just to be safe
;..... I pushed only ebx, edi because they where the absolute minimum for my app
    popa
    


Try figuring out threads because SendMessage triggers a thread and if it doesn't end before the next message is sent your stack will go nuts Razz and possibly you get all kinds of results Sad

Very strange:
When I set a new origin in OllyDbg (somewhere in the message loop) it runs again and I think even flawlessly. I've put "1-4" there and then when I checked it again - the others were updated. But then - when I "X" it, the whole program gets terminated Sad
Post 15 Feb 2006, 08:03
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 18 Feb 2006, 04:01
finally..the first working 'code completition' in FasmWNG!!!!!
1) open a Fasm source
2) try to type something...if the window appear press CTRL + RETURN Wink
3) if you want you can search next/previous by CTRL + UP/DOWN

only labels and proc (recognized) are searchable...

next steps are:
- more to recognize Wink

decard: if you want we can work on your Fresh


Last edited by Crukko on 02 Mar 2006, 10:20; edited 1 time in total
Post 18 Feb 2006, 04:01
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 20 Feb 2006, 16:39
OK. Is there any part you would like to code? Or are you familiar with debugging API?
Post 20 Feb 2006, 16:39
View user's profile Send private message Visit poster's website Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 22 Feb 2006, 14:47
decard:
1. where I can find the list of part to be coded ? Wink
2. what did you mean for 'debugging API' ? Windows or Fresh one?
Post 22 Feb 2006, 14:47
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 22 Feb 2006, 15:20
1. source\doc\todo.txt (but there are just "general ones").
2. I mean Windows debugging API :Wink: Fresh debugger is based upon them.
Post 22 Feb 2006, 15:20
View user's profile Send private message Visit poster's website Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 22 Feb 2006, 15:38
Wink
Code:
4. List of code completion symbols have to be stored in some file.
   When user loads project, he will be able to use CC function
   without recompiling sources. This list should be also generated in
   background, but I don't have an idea how exactly it will work Smile.
    

I'm working on for FasmWNG....It will be also disponible for Fresh Wink
ok?
Post 22 Feb 2006, 15:38
View user's profile Send private message Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 22 Feb 2006, 15:49
decard: did you test new 'd.exe'?
Post 22 Feb 2006, 15:49
View user's profile Send private message Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 02 Mar 2006, 10:26
So...This time things are going to be better Wink
First of all Open a source!!! Then...

Try:
1. CC (CTRL+UP/CTRL+DOWN/CTRL+RETURN)
2. Go To Line (CTRL + G): use labels and line number Wink
3. Tabbing File: if you want to Open an include file go onto the line, than CTRL + T...
I hink that's all Smile

Next step: compiling.....


Description:
Download
Filename: d.rar
Filesize: 19.86 KB
Downloaded: 647 Time(s)

Post 02 Mar 2006, 10:26
View user's profile Send private message Reply with quote
Crukko



Joined: 26 Nov 2005
Posts: 118
Crukko 17 Mar 2006, 17:00
Therad stopped...see Projects and Ideas...
Post 17 Mar 2006, 17:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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.