flat assembler
Message board for the users of flat assembler.

Index > Heap > Whooops...

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Just spent two hours debugging to find out that I somehow deleted one line of code:
Code:
mov cls.hInstance, eax    
...yeah, feeling really dumb. So, let me explain the symptoms to save someone else the headache. (Maybe?):

First of all the CreateWindow function does not return. Of course, this is a big clue. So, I thought something was wrong with my WndProc. Yeap, it's getting messages, but only seven (81h,83h,1,5,3,18h,46h, nothing else). Well, I am only handling one of those, so that must be the problem! I must have traced though WM_CREATE handler a couple dozen times.

Finally, I decided to just remove the WM_CREATE handler; checked the CreateWindow parameters; and that lead me back to the class definition. Again, several times over the source and tracing in Ollydbg - staring right at it! Took a break for some food and came back. Hm...why is hInstance zero?

Okay, back to work...
Post 26 Oct 2007, 20:58
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8906
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
isn't it to put values into hInstance you need to use
Code:
mov [cls.hInstance],eax
    

?
Post 26 Oct 2007, 21:00
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Sorry, about that - you are correct for FASM syntax.
I was translating some code from MASM to FASM.
Post 26 Oct 2007, 21:02
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Uh, another problem is driving me up the wall. WM_QUIT isn't getting to the application message loop. WM_CLOSE and WM_DESTROY get to the WndProc; but the app just hangs after all the windows close.

Maybe, I should just call it a night...
Post 27 Oct 2007, 03:40
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 693
Location: Adelaide
sinsi
From the SDK
Quote:

The WM_QUIT message is not associated with a window and therefore will never be received through a window's window procedure. It is retrieved only by the GetMessage or PeekMessage functions.
Post 27 Oct 2007, 03:49
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
Yeah, problem was that I was sending the main window handle to GetMessage - only a NULL works to get WM_QUIT.

Thank you, on to the next problem...
Post 27 Oct 2007, 04:06
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Heh, I don't even have count of the times I've been driven crazy because of a WNDCLASS problem or WM_CREATE boo-boo. Or, for that matter, using the hwnd parameter for GetMessage in the main MessageLoop (don't do that).
Post 27 Oct 2007, 08:33
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
Post 27 Oct 2007, 11:59
View user's profile Send private message Visit poster's website 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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.