views:

69

answers:

1

Hey guys,

I'm building a Windows Assembly program without any macro. So I downloaded a program that was using macros, and I'm converting this into "pure" assembly code.

However I'm facing one issue here. There's a label @@: that I don't understand, and also a jump jne @F that I didn't get it. What are these 2 symbols?

MyWndProc:

    push ebp
    mov ebp, esp

    cmp DWORD PTR [ebp+12], 2 ;WM_DESTROY=2
    jne @F
      push ecx
      push NULL
      mov dword ptr ecx, 7e42ca5ah ;address of PostQuitMessage
      call ecx
      pop ecx
    @@:

    push DWORD PTR [ebp+20]
    push DWORD PTR [ebp+16]
    push DWORD PTR [ebp+12]
    push DWORD PTR [ebp+8]
    call DefWindowProc
    ;mov dword ptr edx, 7e42c17eh
    ;call edx

    leave
    ret 16

Also for PostQuitMessage API I could hard-code the memory address (on WinXP 32bits SP3 english), but for DefWindowProc it compiles, but it breaks when executing. Does someone know why?

Thanks for support guys.

PS.: I'm using masm32

+3  A: 

The @@ is an anonymous local label. You could have many of them in the file The jne @F means jump to the nearest @@ ahead of the current location.

Carl Norum
Ok thanks. How about the DefWindowProc question? Any ideia?
jyzuz
Couldn't tell you without more code. Is DefWindowProc another one of your routines?
Carl Norum
No, `DefWindowProc` it's a Windows API. This routine is responsible to get the windows messages... I've found it address on my machine using arwin tool, but this is the only API that I can't hardcode.. but I don't know why I can't do the same I did with `PostQuitMessage`...
jyzuz
Then you need to make a global symbol declaration for it, and then use the linker to make sure everything gets matched up. I'm not sure you can depend on it always having the same address. I am not a windows API expert, though.
Carl Norum