Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!linus!progress!billf From: billf@progress.COM (Bill Ferro) Newsgroups: comp.windows.ms.programmer Subject: Re: Windows 3 segment/selector problems (Tech. Quest.) Keywords: windows-3 selectors 80286 80386 Message-ID: <1990Dec19.194631.22880@progress.com> Date: 19 Dec 90 19:46:31 GMT References: <2564@wn1.sci.kun.nl> <588@rodan.cs.utexas.edu> Sender: news@progress.com (The News User) Distribution: comp Organization: Progress Software Corp., Bedford, MA Lines: 38 Nntp-Posting-Host: billf nickel@cs.utexas.edu (Jody P. Nickel) writes: >If you are only going to run in 386 enhanced mode the this will simplify >your task immensely. After a GlobalAlloc, you can lock this memory and >leave it locked until it is no longer needed. The far pointer you receive >is a selector:0 pointer. This is also true for standard mode. Malloc and Free code examples follow: char *malloc(nbytes) WORD nbytes; { HANDLE h; if ((h=GlobalAlloc(GMEM_MOVEABLE,DWORD(nbytes))) == NULL) return ((char *)0); else return ((char *)GlobalLock(h)); } void free(ptr) char *ptr; { HANDLE h; h = LOWORD(GlobalHandle(HIWORD(ptr))); GlobalUnlock(h); GlobalFree(h); return; } -bf -- Bill Ferro UUCP: mit-eddie!progress!billf Progress Software Corp. Internet: billf@progress.com 5 Oak Park Bedford, MA 01730