Errata

Second print of the book was ordered end of April, 2001. Twenty-two corrections went in, at least I hope they went in. Thanks for all the readers who have read the book carefully and sent me the corrects. Jan Bares sent most number of corrections.


Chapter

Page

Problem and Fix

Corrected in
Chapter 1 24 Reported by Jose Rivera, Jan 12, 2001.

A ")" is missing after cpuspeed10.

Replacing

time, time * 1000 / cpuspeed10;

with

time, time * 1000 / cpuspeed10);

2nd print
Chapter 1 47 Reported by Hannes Jakschitsch, March 5, 2001.

Replacing:

if ( ( (ord<pExport->Base) || (ord>pExport->NumberOfFunctins) )

with

if ( ( (ord<pExport->Base) || ((ord - pExport->Base)>=pExport->NumberOfFunctins) )

2nd print
Chapter 2 104 Reported by Jan Bares, April/3/2001

The GRE/DDI interface does not support elliptical curves like circle, art, or ellipse.

should be:

The GRE/DDI interface does not support elliptical curves like circle, arc, or ellipse.

2nd print
Chapter 2 121 Reported by Jan Bares, April/3/2001

Nesting makes sure that DrvStartDoc, DrvEndDoc, DrvStartPage, and DrvSnedPage are called...

should be:

Nesting makes sure that DrvStartDoc, DrvEndDoc, DrvStartPage, and DrvSendPage are called...

2nd print
Chapter 3 153 Reported by Jan Bares, April/3/2001

Use mode pointers are accessible from kernel mode address space, ...

should be:

User mode pointers are accessible from kernel mode address space, ...

2nd print
Chapter 3 158 Reported by Hannes Jakschitsch, March 6, 2001.

Typo at the bottom of the page.

Replacing 0x3pe0a with 0x9e0a.

2nd print
Chapter 3 176 Reported by Jan Bares, April/3/2001

... examine crush dumps ...

should be:

.. .examine crash dumps ...

2nd print
Chapter 3 191 Reported by Hannes Jakschitsch, March 15, 2001

miximum should have been maximum.

2nd print
Chapter 4 255 Reported by Jan Bares, April 17, 2001

Second paragraph. minisecond should have been millisecond.

2nd print
Chapter 4 267 Reported by Jan Bares, April 17, 2001

Second paragraph, BegninPaint should have been BeginPaint.

2nd print
Chapter 4 275, 276 Reported by Hannes Jakschitsch, March 15, 2001

lpdd->>lpVtbl should have been lpdd->lpVtbl

2nd print
Chapter 5 297 Reported by Jan Bares, April 17, 2001

Third paragraph. If an exact match can be found should have been If an extact match can not be found.

2nd print
Chapter 5 311 Reported by Jan Bares, April 17, 2001

DT_RASCAMETA should have been DT_RASCAMERA

2nd print
Chapter 5 344 Reported by Jan Bares, April 17, 2001

Last bullet. time to down load should have been time to download

2nd print
Chapter 7 424 Reported by Jan Bares, April 17, 2001

Penultimate paragraph. GetRandmRgn should have been GetRandomRgn, two places.

2nd print
Chapter 8 496 Reported by Bob Shultz, Feb 6, 2001.

Function AngleArcToBezier only works when rx equals ry.

Here is a fix:

BOOL AngleArcToBezier(HDC hDC, int x0, int y0, int rx, int ry, 
                      double startangle, double sweepangle)
{
    double XY[8];
    POINT P[4];

    // Compute bezier curve for arc centered along y axis
    // Anticlockwise: (0,-B), (x,-y), (x,y), (0,B) 
    double B = ry * sin(sweepangle/2);
    double C = rx * cos(sweepangle/2);
    double A = rx 1 - C;

    double X = A*4/3;
    double Y = B - X * (1-A)/B;

    XY[0] =   C;
    XY[1] = - B;
    XY[2] =   C+X;
    XY[3] = - Y;
    XY[4] =   C+X;
    XY[5] =   Y;
    XY[6] =   C;
    XY[7] =   B;

    // rotate to the original angle
    double s = sin(startangle + sweepangle/2);
    double c = cos(startangle + sweepangle/2);

    for (int i=0; i<4; i++)
    {
        P[i].x = x0 + (int) ( (XY[i*2] * c - XY[i*2+1] * s) * rx );
        P[i].y = y0 + (int) ( (XY[i*2] * s + XY[i*2+1] * c) * ry );
    }

    return PolyBezier(hDC, P, 4);
}
2nd print
Chapter 8 498 Reported by Jan Bares, April 17, 2001

Penultimate paragraph. Note that area file functions should have been Note that area fill functions

2nd print
Chapter 9 521 Reported by Jan Bares, April 17, 2001

Penultimate paragraph. SetDCPenColor should have been SetDCBrushColor.

2nd print
Chapter 9 525 Reported by Jan Bares, April 17, 2001

First sentence. Hatches brushes divide should have been Hatch brushes divide

2nd print
Chapter 9 529 Reported by Jan Bares, April 17, 2001

Second paragraph. PaltBlt should have been PatBlt.

2nd print
Chapter 9 537 Reported by Jan Bares, April 17, 2001

Second paragraph. PolyPaltBlt should have been PolyPatBlt.

2nd print
Chapter 9 554 Reported by whaoye, March 23, 2003

CombineRgn(HRGN hrgnDest, HRGN hrgnSrc, hrgnSrc2, int fnCombineMode);

should have been:

CombineRgn(HRGN hrgnDest, HRGN hrgnSrc, HRGN hrgnSrc2, int fnCombineMode);

 
Chapter 10 589 Reported by Rui Lopes, April 18, 2001

166,777,216 should have been 16,777,216, two places.

2nd print
Chapter 10 595 Reported by Wade Weitzel, April 23, 2002

(width * bitcount + 31)/32 should have been (width * bitcount + 31)/32 * 4

 
Chapter 15 902 Reported by Jeremy Kuhne, March 16, 2001.

FM_FONTCARE should have been FW_DONTCARE.

FM_NORMAL should have been FW_NORMAL.

2nd print
Chapter 15 938 Reported by Pierre Arnaud, Sep/1/2001

GetTextTextentPoint32 should have been GetTextExtentPoint32

 
Chapter 15 950 Reported by Pierre Arnaud, Sep/2/2002

LPTSTR lpClass should have been LPSTR lpClass

nMaxExent should have been nMaxExtent

 
Chapter 15 951 Reported by Pierre Arnaud, Sep/2/2002

GCP_USERKING should have been GCP_USEKERNING

 


Directory

File

Problem and Fix

Corrected in
sample\include\ dib.cpp Reported by Christian, Feb/10/2001.

In method DWORD KDIB::GetPixelIndex(int x, int y) const, the lines

    case DIB_4BPP:
        return ( pPixel[x/2] >> Shift4bpp[x%4] ) & 0x0F;

should be

    case DIB_4BPP:
        return ( pPixel[x/2] >> Shift4bpp[x%2] ) & 0x0F;
 
sample\include fonttext.cpp Reported by Steve Spencer, March/12/2001.

To avoid negative index to array when character outside of 7-bit ASCII is used, in method KTextFormator::GetTextExtent, and KTextFormator::TextOut, replacing:

m_fCharWidth[pString[i]]

with

m_fCharWidth[(unsigned)pString[i]]

 
sample\include dib.cpp Reported by Christian Kaiser, April/9/2001

In function int PixelFormat(HDC hdc), the line

else if ( (blue==0x001F) && (green==0x007E) && (red==0xF800) )

should be

else if ( (blue==0x001F) && (green==0x07E0) && (red==0xF800) )

 
sample\include pagecanvas.cpp Reported by Jura Kovalev, reading Russian edition, June/3/2002

SelectObject(hDC, hOldPen);
SelectObject(hDC, hOldBrush);
DeleteObject(hOldPen);
DeleteObject(hOldBrush);

change to

SelectObject(hDC, hOldPen);
SelectObject(hDC, hOldBrush);
DeleteObject(
hPen);
DeleteObject(
hBrush);

 
sample\chapt_7\GDIObj GDIObj.cpp Reported by Jan Bares, April/3/2001

In function WinMain, the following line should be added to initialize the common control DLL properly:

InitCommonControls();

 
       
       
       
       
       

Last update, September 15, 2002