Errata

Windows via C/C++ (softcover)

Errata for Windows via C/C++ (softcover)

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page code
In CmnHdr.h file (found in CommonFiles folder) the chROUNDUP() function

In CmnHdr.h file (found in CommonFiles folder) the chROUNDUP() function

// This inline function rounds a value down to the nearest multiple
template <class TV, class TM>
inline TV chROUNDUP(TV Value, TM Multiple) {
return(chROUNDDOWN(Value, Multiple) +
(((Value % Multiple) > 0) ? Multiple : 0));
}


should be like this

// This inline function rounds a value up to the nearest multiple
template <class TV, class TM>
inline TV chROUNDUP(TV Value, TM Multiple) {
return(chROUNDDOWN(Value, Multiple) +
(((Value % Multiple) > 0) ? 1 : 0));
}

Anonymous  May 16, 2011 
Printed
Page 14

"UTF16" should be "UTF-16" On page 14, the second sentence in the 1st paragraph is missing a hyphen in UTF-16. Change: "When the compiler places the string in the program’s data section, it encodes each character using UTF16, interspersing zero bytes between every ASCII character in this simple case." To: "When the compiler places the string in the program’s data section, it encodes each character using UTF-16, interspersing zero bytes between every ASCII character in this simple case."

Microsoft Press  May 06, 2010 
Printed
Page 52

"noninterative" should be "noninteractive"
On page 52, the first sentence in the NOTE box is missing a C in "noninteractive".



Change:

"Before any user logs in, the services are starting in the first session, which is noninterative."



To:

"Before any user logs in, the services are starting in the first session, which is noninteractive."

Microsoft Press  Jul 13, 2010 
Printed
Page 70

"/SUBSYSTEM :CONSOLE" should be "/SUBSYSTEM:CONSOLE" On page 70, the first sentence in the 3rd bullet point contains an extra space in the /SUBSYSTEM:CONSOLE command. Change: "Click on the Link tab of the project properties dialog box, and change the /SUBSYSTEM:WINDOWS switch to /SUBSYSTEM :CONSOLE in the Configuration Properties/Linker/System/SubSystem option, as shown in Figure 4-2." To: "Click on the Link tab of the project properties dialog box, and change the /SUBSYSTEM:WINDOWS switch to /SUBSYSTEM:CONSOLE in the Configuration Properties/Linker/System/SubSystem option, as shown in Figure 4-2."

Microsoft Press  May 06, 2010 
Printed
Page 72

"__ImageBase" should be "_ImageBase"
On page 72, the second line of the code sample includes too many underscores before ImageBase.



Change:

int nMainRetVal = WinMain((HINSTANCE)&__ImageBase, NULL, pszCommandLineAnsi,To:

int nMainRetVal = WinMain((HINSTANCE)&_ImageBase, NULL, pszCommandLineAnsi,

Microsoft Press  Jul 13, 2010 
Printed
Page 74
Last para


In order to maintain equivalence to the GetModuleHandle function, we need to suppress incrementing the REFCOUNT when we call the function GET_MODULE_HANDLE_EX
We do this by "or"-ing in another flag value --


Change From:
call the GetModuleHandleEx function with GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS as the first parameter

TO:
call the GetModuleHandleEx function with GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT as the first parameter


Also change p.75 code example
tkx, Paul

Paul Gerken  Sep 02, 2011 
Printed
Page 151

"cbStack" should be "cbStackSize" On page 151, the third and fourth sentence of the 2nd paragraph from the bottmo of the page contains an incorrect parameter. Change: "The amount of reserved space is either the amount specified by the /STACK linker switch or the value of cbStack, whichever is larger. The amount of storage committed matches the value you passed for cbStack. If you pass 0 to the cbStack parameter, CreateThread reserves a region and commits the amount of storage indicated by the /STACK linker switch information embedded in the .exe file by the linker." To: "The amount of reserved space is either the amount specified by the /STACK linker switch or the value of cbStackSize, whichever is larger. The amount of storage committed matches the value you passed for cbStackSize. If you pass 0 to the cbStackSize parameter, CreateThread reserves a region and commits the amount of storage indicated by the /STACK linker switch information embedded in the .exe file by the linker."

Microsoft Press  May 06, 2010 
Printed
Page 233

"&" should be "&&"
On page 233, the 7th line of code from the top contains an incorrect operator.



Change:

if (g_q.IsFull() & !g_fShutdown) {To:

if (g_q.IsFull() && !g_fShutdown) {

Microsoft Press  Jul 13, 2010 
Printed
Page 245

HANDLE3]; should be [HANDLE3]; On page 245, the first line of the code sample is missing an opening bracket. Change: HANDLE3];To: [HANDLE3];

Microsoft Press  May 06, 2010 
Printed
Page 267

"nGetLastError" should be "GetLastError"
On page 267, the last sentence of the 3rd paragraph contains an invalid function.



Change:

"Making a call to nGetLastError at this time will return ERROR_NOT_OWNER (attempt to release mutex not owned by caller)."



To:

"Making a call to GetLastError at this time will return ERROR_NOT_OWNER (attempt to release mutex not owned by caller)."

Microsoft Press  Jul 13, 2010 
Printed
Page 268

Invalid space after CreateMutex On page 268, in Table 9-2 the Mutex in the "Initialization" row contains an invalid space. Change: hmtx = CreateMutex (NULL, FALSE, NULL);To: hmtx = CreateMutex(NULL, FALSE, NULL);

Microsoft Press  May 06, 2010 
Printed
Page 280

Code sample incorrectly placed inside comment
On page 280, the 2nd and 4th code sample incorrectly places a line of code within a comment.



Change:

// Perform some work. ... SetEvent(hEventWorkerThreadDone);To:

// Perform some work.

SetEvent(hEventWorkerThreadDone);Change:

// Perform some work. ... SignalObjectAndWait(hEventWorkerThreadDone,

hEventMoreWorkToBeDone, INFINITE, FALSE);To:

// Perform some work.

SignalObjectAndWait(hEventWorkerThreadDone,

hEventMoreWorkToBeDone, INFINITE, FALSE);

Microsoft Press  Jul 13, 2010 
Printed
Page 315

Pointer symbol applied incorrectly On page 315, in the functions under BOOL WriteFileEx( the pointer is incorrectly applied. Change: CONST VOID *pvBuffer,To: CONST VOID* pvBuffer,

Microsoft Press  May 06, 2010 
Printed
Page 323

"WaitingThread Queue" should be "Waiting Thread Queue"
On page 323, the third bullet point down in the Released Thread List box is missing a space in Waiting Thread Queue.



Change:

"Thread again calls GetQueuedCompletionStatus (dwThreadId moves back to the WaitingThread Queue)."



To:

"Thread again calls GetQueuedCompletionStatus (dwThreadId moves back to the Waiting Thread Queue)."

Microsoft Press  Jul 13, 2010 
Printed
Page 608

"AppInit_Dlls" should be "AppInit_DLLs" On page 608, the first and last sentence of the 2nd paragraph contains keys that do not match the screenshot. Change: "The value for the AppInit_Dlls key might contain a single DLL filename or a set of DLL filenames (separated by spaces or commas)." To: "The value for the AppInit_DLLs key might contain a single DLL filename or a set of DLL filenames (separated by spaces or commas)." Change: "For this key to be taken into account, you also need to create a DWORD key named LoadAppInit_Dlls with 1 as the value." To: "For this key to be taken into account, you also need to create a DWORD key named LoadAppInit_DLLs with 1 as the value."

Microsoft Press  May 06, 2010 
Printed
Page 690

"exception" should be "except"
On page 690, the first sentence of the 3rd paragraph contains an invalid block type.



Change:

"Notice that the code inside FuncMonkey’s exception block never executes the call to MessageBeep."



To:

"Notice that the code inside FuncMonkey’s except block never executes the call to MessageBeep."

Microsoft Press is committed to providing informative and accurate

books. All comments and corrections listed above are ready for

inclusion in future printings of this book. If you have a later printing

of this book, it may already contain most or all of the above corrections.

Microsoft Press  Jul 13, 2010