Newsgroups: comp.windows.ms.programmer
Path: utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneau
From: bonneau@hyper.hyper.com (Paul Bonneau)
Subject: Re: Huge pointers and large bitmaps (512x512/8)
Message-ID: <1991May24.155224.13891@hyper.hyper.com>
Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,)
Organization: HyperCube Inc.
References: <1991May22.151149.8892@iplmail.orl.mmc.com>
Date: Fri, 24 May 1991 15:52:24 GMT

In article <1991May22.151149.8892@iplmail.orl.mmc.com> darak@iplmail.orl.mmc.com (dara khani) writes:
>Petzold says that you should use huge pointer for data > 64k, otherwise
>use far pointers.  
>My question:
> I have a huge pointer to an image (512x512/8), and I want to 
>create a DIBitmap of it.  I type cast the huge pointer variable to a 
>LPSTR and pass it to the createDIB.... function.
>What puzzles me is why a correct bitmap is created when a LPSTR pointer is 
>not suppose to go over 64k.
>
A huge pointer is the same as a far pointer from a data
structure point of view (both are a 16bit segment/selector 16
bit offset pair).

The difference is that the compiler emits code to detect when
a huge pointer crosses a segment boundary and patches the
segment/selector accordingly.

So, you can cast a huge pointer to far and vice versa, no
problem.  Internally, windows is using it as a huge (or is
using it in a 32-bit segment where huge is not needed).

cheers - Paul Bonneau.
