http://bugs.winehq.org/show_bug.cgi?id=2682
Summary: PrgWin Fifth Edition - PoePoem.c - Unhandled Page Fault Product: Wine Version: 20010112 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-programs AssignedTo: wine-bugs@winehq.org ReportedBy: ikrakow_1999@yahoo.com
Petzold Chapter 10 - PoePoem.c - produces the following message:
"Exception raised" "Unhandled page fault on write access to 0x56ae117a at address 0x56ae0692. Do you wish to debug it?" If you answer Yes, program enters Winedbg, with an "Unhandled exception (thread 0009), starting debugger)" message.
The text of the poem is a locked resource. There's a pointer (*pText) to the locked resource. The program bombs on the following line:
*pText = '\0';
If this line is commented out, the program runs fine, displaying the poem in the window. Below is a diff -C 10 output to show the context:
*** PoePoemHasBug.c 2005-01-28 15:48:22.753580008 -0500 --- PoePoemRunsOk.c 2005-01-28 15:48:22.753580008 -0500 *************** *** 98,118 ****
pText = (char *) LockResource (hResource) ; iNumLines = 0 ;
while (*pText != '\' && *pText != '\0') { if (*pText == '\n') iNumLines ++ ; pText = AnsiNext (pText) ; } ! *pText = '\0' ;
SetScrollRange (hScroll, SB_CTL, 0, iNumLines, FALSE) ; SetScrollPos (hScroll, SB_CTL, 0, FALSE) ; return 0 ;
case WM_SIZE : MoveWindow (hScroll, LOWORD (lParam) - xScroll, 0, xScroll, cyClient = HIWORD (lParam), TRUE) ; SetFocus (hwnd) ; return 0 ; --- 98,118 ----
pText = (char *) LockResource (hResource) ; iNumLines = 0 ;
while (*pText != '\' && *pText != '\0') { if (*pText == '\n') iNumLines ++ ; pText = AnsiNext (pText) ; } ! // *pText = '\0' ;
SetScrollRange (hScroll, SB_CTL, 0, iNumLines, FALSE) ; SetScrollPos (hScroll, SB_CTL, 0, FALSE) ; return 0 ;
case WM_SIZE : MoveWindow (hScroll, LOWORD (lParam) - xScroll, 0, xScroll, cyClient = HIWORD (lParam), TRUE) ; SetFocus (hwnd) ; return 0 ;