Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL    [ Add a report in this area ]  
Report #:  31175   Status: Closed
htKeyword Help with HtmlHelpViewer causes system crash
Project:  Delphi Build #:  10.0.2288.42451
Version:    10.0 Submitted By:   Richard Winston
Report Type:  Basic functionality failure Date Reported:  7/12/2006 7:30:33 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   241357
Resolution: Duplicate (Resolution Comments) Resolved in Build: : 12.0.3098.14518
Duplicate of:  None
Voting and Rating
Overall Rating: (7 Total Ratings)
5.00 out of 5
Total Votes: 44
Description
_HH_AKLINK is incorrectly defined. in Windows.pas:

  _HH_AKLINK = packed record
    cbStruct: Integer;
    fReserved: Boolean; { must be FALSE }
    pszKeywords: PChar;
    pszUrl: PChar;
    pszMsgText: PChar;
    pszMsgTitle: PChar;
    pszWindow: PChar;
    fIndexOnFail: Boolean;
  end;

It should be defined as

  _HH_AKLINK = packed record
    cbStruct: Integer;
    fReserved: BOOL; { must be FALSE }
    pszKeywords: PChar;
    pszUrl: PChar;
    pszMsgText: PChar;
    pszMsgTitle: PChar;
    pszWindow: PChar;
    fIndexOnFail: BOOL;
  end;^

(more info at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/vsconstrhhaklink.asp)

Boolean is a one-byte type whereas BOOL occupies 4 bytes.

Because of this error if HelpType on a form is set to htKeyword and HtmlHelp is used, the application may crash.  I am not able to reliably reproduce the problem with a small project.  However, I can reproduce the problem by calling HtmlHelp directly with a call similar to what is done in HtmlHelpViewer.
Steps to Reproduce:
1. Compile the attached HelpBug project.
2. Run it.
3. Press the F1 key.  The application will crash.

Now change the redeclaration of _HH_AKLINK in the main form to use BOOL instead of Boolean.  Now if you run it, help works correctly.

Workarounds
None
Attachment
HelpBug.zip
Comments

Patrik Spanel at 7/21/2006 8:47:26 AM -
My applications also crash with htKeyword and HelpKeyword with Access Violation. As result of this HTML help does not work with htKeyword.

Sebastian Modersohn at 8/12/2006 4:35:23 AM -
Confirmed.

Markus Humm at 10/24/2006 11:51:30 AM -
Another nasty HTML help problem is described in this QC entry: #23607

Jordan Russell at 11/23/2006 3:12:14 PM -
_HH_AKLINK isn't the only record declared incorrectly.

_HH_FTS_QUERY and _HH_WINTYPE have the same mistake (Boolean instead of BOOL).

Richard Winston at 12/30/2006 3:35:23 PM -
See also QC 38130

Brian Evans at 10/17/2008 8:34:58 AM -
Why is this one marked as closed, duplicate with no reference to what it is a duplicate of? The other similar report is marked as closed, duplicate as well but points to this one. It seems like both have been marked closed, duplicate orphaning the reported issue.

Tomohiro Takahashi at 10/17/2008 9:18:32 AM -
> The other similar report is marked as closed, ...
Thanks for notice. What are the other reports? I will check.

Server Response from: ETNACODE01