🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms
Article #231

Segment problems in RegisterClass using MASM 5.0

#231
From: Ronald Seidowitz
Date: Fri, 16 Jun 1989 16:00
29 lines
1869 bytes
I feel really dumb asking this question, but I am new to assembly language
programming under windows.  I am trying to assemble a "hello world" program
and am having a great deal of trouble with the RegisterClass call.  The call
to RegisterClass is fine, but when loading the window procedure address into
the wndclass structure, the segment portion of the address seems to be wrong.
I used the SEG directive from MASM on the procedure name label and the program 
assembles and links ok.  However, at run time the segment that gets loaded 
causes the machine to die with an illegal instruction in the CreateWindow call
when it tries to call the WndProc procedure.  Both WinMain and WndProc are defined in the same segment in the .asm file.  But when the program runs, the 
segment address that get loaded by the assembler is not the same as the CS 
register during WinMain's execution.  Since both functions are defined in the 
same code segment, if I poke the value of CS into the wndclass structure where 
the segment address of the window procedure goes, the program runs fine.
My real problem is:

	if one is supposed to use a long pointer to the WndProc, how does
	one find the segment portion of the function address when there is
	no cmacros.inc macro for segments, and the SEG operator of the assembler	creates incorrect code?

HELP!!!!!!!!

Ron.

Send mail to:

	Ron Seidowitz
	...!decvax.dec.com!mergvax.uucp!seidowit

Thanx in advance.
Technical Details
Message-ID: <7546@mergvax>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!att!mcdchg!mcdhup!mergvax!seidowit

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!att!mcdchg!mcdhup!mergvax!seidowit
From: seidowit@mergvax (Ronald Seidowitz)
Newsgroups: comp.windows.ms
Subject: Segment problems in RegisterClass using MASM 5.0
Keywords: RegisterClass Segments
Message-ID: <7546@mergvax>
Date: 16 Jun 89 16:00:25 GMT
Distribution: na
Organization: Linotype Co., Hauppauge NY
Lines: 29