Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!media-lab!jason From: jason@media-lab.MEDIA.MIT.EDU (Jason A. Kinchen) Newsgroups: comp.windows.ms.programmer Subject: Re: Windows 3 segment/selector problems (Tech. Quest.) Keywords: windows-3 selectors 80286 80386 Message-ID: <4563@media-lab.MEDIA.MIT.EDU> Date: 20 Dec 90 13:43:27 GMT References: <2564@wn1.sci.kun.nl> <588@rodan.cs.utexas.edu> <1990Dec19.194631.22880@progress.com> Reply-To: jason@media-lab.media.mit.edu (Jason A. Kinchen) Distribution: comp Organization: MIT Media Lab, Cambridge MA Lines: 26 In article <1990Dec19.194631.22880@progress.com> billf@progress.COM (Bill Ferro) writes: >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: > [here was the most often written Windows code in the world.} Okay, now here's one for you. GlobalAlloc can take a long or DWORD (32 bit) and therefore has a 4 Gigabyte address space. However, they warn you in the Guide to Programming that if you allocate more than 64K the returned pointer must be cast and saved as a huge pointer so the proper segment arithmetic is done. Has anyone solved the problem of dynamically, globally alloc'ing an arbitrarily long block of memory when you don't know in advance if it's longer than 64K? Do you have to compile huge model or something nasty like that? Thanks in advance. -- Jason Kinchen jason@media-lab.MIT.EDU