Misplaced Pages

Microsoft Compiled HTML Help

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

Microsoft Compiled HTML Help is a Microsoft proprietary online help format, consisting of a collection of HTML pages, an index and other navigation tools. The files are compressed and deployed in a binary format with the extension .CHM, for Compiled HTML. The format is often used for software documentation .

#346653

54-722: It was introduced as the successor to Microsoft WinHelp with the release of Windows 95 OSR 2.5 and consequently, Windows 98 . Within the Windows NT family, the CHM file support is introduced in Windows NT 4.0 and is still supported in Windows 11 . Although the format was designed by Microsoft, it has been successfully reverse-engineered and is now supported in many document viewer applications. Microsoft has announced that they do not intend to add any new features to HTML Help. Help

108-522: A Find tab, which lets the user search for any word used in the text of the file, not just for keywords. WinHelp also supports a feature known as context-sensitive help . Context-sensitive help is assistance that is appropriate to where the user is in the software application, and what they are trying to do. A rather security critical feature is that one can also include a DLL file containing custom code and associating it with WinHelp topics. Effectively this makes .HLP files equivalent to executables. At

162-558: A .hlp file consist of one or more documents in Rich Text Format and a help project file with the extension .hpj, along with any image files (. bmp , . wmf , or .shg) that are used within the Help file. An optional table of contents file with the extension .cnt can also be created for use with the .hlp file. Within the .rtf files, topics are separated by page breaks. Each topic has a series of footnotes that contain information for

216-584: A HTML Help project. The file name of such a project has the extension .HHP and the file is just a text with the INI file format. The Free Pascal project has a compiler (chmcmd) that can create CHM files in a multiplatform way. Read support: Read/write support: Microsoft WinHelp Microsoft WinHelp is a proprietary format for online help files that can be displayed by the Microsoft Help browser winhelp.exe or winhlp32.exe . The file format

270-533: A WMF, they are instead of complex structures. For example, the BitmapCoreHeader contains information about the dimensions and color format of a device-independent bitmap, which is itself part of a DeviceIndependentBitmap object. A graphics object, however, specifies parameters for graphics output and during playback of the WMF it sets up the playback device context. Graphics objects can be brushes (defines

324-400: A WinHelp file opens in a separate window, in a size and initial position that the Help author may choose. Users can resize or reposition the window. The Help author can control whether the Help file stores the user's settings between sessions, or always opens in the default size and position. When a topic is open, a title bar at the top of the Help window displays the topic title. Below that is

378-680: A metafile stores a list of records consisting of drawing commands, property definitions and graphics objects to display an image on screen. The drawing commands used are closely related to the commands of the Graphics Device Interface (GDI) API used for drawing in Microsoft Windows. There are three major types of metafiles – a WMF is a 16-bit format introduced in Windows 3.0 . It is the native vector format for Microsoft Office applications such as Word , PowerPoint , and Publisher . As of 2023 , revision 17 of

432-403: A non-scrolling region. Help authors can also control the background color of the main text area, where the actual text of the topic appears. This text can be formatted and arranged in many ways. Within the text, jumps appear as green text with a single underline . Single-clicking on a jump opens a different topic. Some jumps may open secondary Help windows to display information. Popups appear in

486-410: A number of control records: the header record, the aforementioned optional placeable record, and finished by an end of file record. Encapsulated by the control records are the records that make up the image itself. These records work within what is known as the playback device context , which is the collection of properties and objects that make up a device's graphical environment as the metafile

540-772: A pixel is encoded in RGBA or is an index into a color table. EmfMetafileHeaderExtension2 is a record that is inserted directly after the EmfMetafileHeaderExtension1 record, and it contains two fields with the X and Y values to measure the device surface in micrometers. Like WMF files, records can be classified by function, however there are more record types in EMF files than there are in WMF files. Records can be classified as control, bitmap, clipping, comment, drawing, escape, object creation, object manipulation, OpenGL, path bracket, state and transform records. With

594-464: A row of menus ( File , Edit , Bookmark , Options , and Help ), which control various aspects of the file. A row of buttons usually appears below the menus. The Help author controls which buttons, if any, appear. Typical buttons include Contents , Index , Back , and Print , along with << and >> buttons to browse through the file. Help authors can also create custom buttons to jump to specific topics or perform other actions. Below

SECTION 10

#1732787255347

648-510: A separate, tabbed window. Clicking on the Contents tab opens the table of contents, in which users can click on headings to see the topics. Often, headings are marked with icons that look like small books and the topics have icons that look like pages. Double-clicking on a topic (or clicking on a topic then clicking Display ) opens that topic. Clicking on the Index tab opens the index, which has

702-405: A software bundle, the software would be subject to one). Over time the existence of that historic specification was largely forgotten and some alternative implementations resorted to reverse engineering to figure out the file format from existing WMF files, which was difficult and error prone. In September 2006, Microsoft again published the WMF file format specification in a more complete form in

756-427: A typing field and an alphabetical keyword list. Typing in the typing field automatically scrolls the list of keywords to the closest match. Double-clicking on a keyword (or clicking on a keyword then clicking Display ) displays the topic associated with that keyword (if only one) or brings up a list of all topics associated with it. The index is important in helping users locate information. Sometimes Help files also have

810-406: Is available to the function handler — it is one of the two parameters that is passed to it (see above), and it is required in order to abort the printing. Finally, Gibson claimed that the control flow could not return to Windows. It is simply a matter of the function returning and discarding the parameters that were passed on the stack. If the record is well formed, Windows will continue to parse

864-521: Is based on Rich Text Format (RTF). It remained a popular Help platform from Windows 3.0 through Windows XP . WinHelp was removed in Windows Vista purportedly to discourage software developers from using the obsolete format and encourage use of newer help formats. Support for WinHelp files would eventually be removed entirely in Windows 10 . A WinHelp file has a ".hlp" suffix. It can be accompanied by an optional table of contents (.cnt) file if

918-500: Is being "played back" onto this output device. Records other than control records can be largely grouped into bitmap records, drawing records, object records, state records and escape records. Bitmap records manage and output bitmap images . Drawing records produce graphics output. Object records create and manage graphics objects. In WMF files there are two broad categories of objects – graphics objects and structure objects. Structure objects are not explicitly created or deleted in

972-484: Is delivered as a binary file with the .chm extension. It contains a set of HTML files, a hyperlinked table of contents, and an index file. The file format has been reverse-engineered and documentation of it is freely available. The file starts with bytes "ITSF" (in ASCII ), for "Info-Tech Storage Format", which is the internal name given by Microsoft to the generic storage file format used for CHM files. CHM files support

1026-867: Is included as part of WineVDM . Also on Windows 10 WinHelp works with winhlp32.exe from older version of Windows. Although documentation can be maintained entirely in a vendor-specific presentation format such as WinHelp, it is more often the case that documentation must be published in multiple presentation formats at once: Microsoft Compiled HTML Help (CHM), WinHelp, HTML pages, Java Help , PDF , etc. It would be very expensive and error-prone to maintain each format separately. For this reason, authors often maintain documentation in an industry-standard, vendor-neutral authoring format—such as DocBook or FrameMaker —that can be used to generate several different presentation formats (including WinHelp). Various presentation files thus produced (with WinHelp or other tools) contain consistent content because they were generated from

1080-519: Is inherently location-independent and Windows was never patched, so both Windows and an application could simply copy an application function into the WMF file and assume it would work when played back by the same application in a later run session. In any case, its not clear that the developers envisioned applications creating on-disk metafiles with abort procedures. Also, as Microsoft’s Stephen Toulouse pointed out in Microsoft’s rebuttal to Steve’s claims,

1134-402: The 2006 WritersUA conference, Microsoft announced its intentions to phase out WinHelp as a supported platform. Ted Dworkin (Partner Director of WinHelp Experience) stated, "WinHelp does not meet the code standards established for Vista. These standards include security, reliability, and performance." He went on to say that WinHelp is designed in such a way that, "...we would have to rewrite it from

SECTION 20

#1732787255347

1188-524: The Windows Metafile Format specification is available. EMF files, which replaced WMF files, work on the same principle only it is a 32-bit file format that also allows for the embedding of private data within "comment" records. EMF+ is an extension to EMF files and embedded in these comment records, allowing for images and text using commands, objects and properties that are similar to Windows GDI+ . The original 16 bit WMF file format

1242-457: The abort procedure code within the record itself. This affected Windows systems (see CVE - 2005-4560 ) and the Wine project (see CVE - 2006-0106 ). According to Secunia , "The vulnerability is caused due to an error in the handling of Windows Metafile files ('.wmf') containing specially crafted SETABORTPROC 'Escape' records. Such records allow arbitrary user-defined function to be executed when

1296-427: The buttons is the main text area of the window. Typically, the text begins with a heading, often bold or in a larger font than the rest of the text. This heading may sometimes be in a non-scrolling region—an area of the window that does not move up or down via the scrollbar at the side of the window. Non-scrolling regions can only be used at the beginning of a topic. The Help author can control size and background color of

1350-546: The context of the Microsoft Open Specification Promise , promising to not assert patent rights to file format implementors. Microsoft later deprecated WMF files in favour of 32-bit EMF files as WMF files had real issues with device independence, despite the use of a "placeable" file header which provided basic device independence. Microsoft found that developers who use the format were "[embedding] application, location, or scaling comments in

1404-452: The end of the text. Depending on the Help author's preference, this feature may be a simple list of jumps under the heading See Also, or it may be a small button that, when clicked, brings up a dialog box displaying all the relevant topics. Clicking on the name of a topic in that dialog box then clicking Display opens that topic. Most Help files also contain a table of contents and an index to help users locate information. These appear in

1458-433: The end-user must obtain the 32-bit WinHelp viewer from Microsoft's website and manually install it. In Windows 10 and later, Microsoft does not offer a WinHelp viewer for the operating system. The last version of Windows on which it was possible to open and read WinHelp files, using an official downloadable component by Microsoft, is Windows 8.1 . The open-source version of winhlp32 from Wine also works on Windows 10. It

1512-539: The extension ".ann" and ".bmk". A number of software tools can decompile a WinHelp file into its source documents: HPJ, CNT, RTF , BMP , and SHG . An HPJ file is the project file that is created and edited in the Help Workshop (or a third party help authoring tool). The HPJ contains information about what RTF files to compile into the help, the MAP IDs and Aliases that provide links from a calling application to

1566-417: The file, as before. ... Gibson admits that he was guessing about a number of things. Unfortunately, he guessed poorly. I guess we know better now. EMF files have three possible versions of headers. The original headers is just a container for images, the second and third version encapsulates the original header and contains a pixel format record and support for OpenGL records, and the third version encapsulates

1620-588: The following features: The Microsoft Reader 's .lit file format is a modification of the HTML Help CHM format. CHM files are sometimes used for e-books. Sumatra PDF supports viewing CHM documents since version 1.9. Various applications, such as HTML Help Workshop and 7-Zip can decompile CHM files. The hh.exe utility on Windows and the extract_chmLib utility (a component of chmlib) on Linux can also decompile CHM files. Microsoft's HTML Help Workshop and Compiler generate CHM files by instructions stored in

1674-516: The ground up to meet the Vista code standards. And that approach doesn't make sense given that we have two other Help systems in Vista." The updated licensing agreement prohibits application developers from packaging the WinHelp libraries with their installers. This means that WinHelp manuals for legacy applications are not readable on a new Windows Vista (or higher version) installation. To read them,

Microsoft Compiled HTML Help - Misplaced Pages Continue

1728-438: The help compiler: Only the # footnote is required. All others are optional. Text in each topic can contain limited formatting, including bold text, italics , and colors. Superscript and subscript are not allowed. Jumps between topics in the same Help file usually appear in the source document as double-underlined text (green by default, though this can be overridden) followed by a topic ID in hidden text. Popup links appear in

1782-419: The help developer created one. When Windows opens a WinHelp file, it creates a .gid file in the same directory or in " %LOCALAPPDATA%\Help ", containing information about the .hlp file such as the window size and location. If the user clicks the "Find" tab and enables keyword indexing, Windows creates an index file with a .fts (full text search) extension. Annotations and bookmarks for each Windows help file have

1836-420: The help file, and help file appearance (window size, default buttons, color schemes, etc.). The CNT file provides the table of contents for the help file. An SHG file is a "SHED" graphics file that essentially creates an image map of help calls for a graphic file (e.g., a BMP). A number of tools can read and explore these files. (See, for example, Help to RTF and winhelpcgi .) Source files required to compile

1890-468: The image). After the source files have been created, the help file can be compiled using a WinHelp compiler such as HCW.exe or by using a commercial software program such as RoboHelp or HelpBreeze , most of which (included the two cited here) also use hcw.exe as the backend compiler. Depending on how it has launched and what settings the Help author chose, a WinHelp file opens either to its default topic, its table of contents, or its index. A topic in

1944-560: The metafiles... Others added headers to the metafile that provided various application-specific information", causing major compatibility issues. Thus, in 1992 with Windows NT 3.1 , Microsoft introduced the Enhanced Metafile format (EMF) — a format which was based on the Win32 API and with which they built-in device independence. — these were also known as NT metafiles. With the release of Windows XP and GDI+,

1998-405: The object is released from the table and the identifier can be reused. Notably an object will not be used until it is specifically selected during record playback. This differs for EMF+ files, which also use an associative array via a hashmap which records the object along with an object identifier. However, unlike WMF and EMF files which can delete an object, when a new object is created that has

2052-401: The original header. EmfMetafileHeaderExtension1 is a record that is inserted directly after the original EMF header, specifies whether there is a pixel format descriptor and the offset to the descriptor object within the header, as well as a field that specifies if OpenGL records exist in the metafile. The pixel format descriptor specifies the capabilities of the drawing surface and whether

2106-416: The parser, and the parser has to wait until the callback returns, otherwise the whole point of the function (to abort the printing) is lost. By his own admission, Gibson did not read the documentation (in fact, he claimed that he couldn’t find it, although it is freely available on Microsoft’s Web site), and he claimed that the device context is not available to the function handler. Of course the device context

2160-459: The playback device context. Escape records are a means to extend metafile functionality via records that are not otherwise defined as a WMF record type. Each escape record contains a record function, an escape function and potentially escape data. The following escape records make up a WMF file. There was a major vulnerability found in escape records around the Abort escape record, which stores

2214-609: The release of Windows XP , the Enhanced Metafile Format Plus Extensions (EMF+) format was introduced. EMF+ provides a way to serialize calls to the GDI+ API in the same way that WMF/EMF stores calls to GDI. There are also compressed versions of Windows Metafiles known as Compressed Windows Metafile (WMZ) and Compressed Windows Enhanced Metafile (EMZ), which are basically gzip compressed WMF and EMF files correspondingly. The WMF format

Microsoft Compiled HTML Help - Misplaced Pages Continue

2268-540: The rendering of a WMF file fails." According to the Windows 3.1 SDK documentation, the SETABORTPROC escape was obsoleted and replaced by the function of the same name in Windows 3.1, long before the WMF vulnerability was discovered. However the obsoleted escape code was retained for compatibility with 16 bit programs written for (or at least backwards compatible with) Windows 3.0. This change happened at approximately

2322-411: The same index as an existing object, the entry in the table is replaced with the new object. An EMF file also does not need to specifically select an object before it is used. WMF files were not originally designed to be device independent, meaning that a file could not be played back on output devices that differed from the original device on which the file was recorded. A partial solution to this issue

2376-565: The same source. Windows Metafile Windows Metafile ( WMF ) is an image file format originally designed for Microsoft Windows in the 1990s. The original Windows Metafile format was not device-independent (though could be made more so with placement headers) and may contain both vector graphics and bitmap components. It acts in a similar manner to SVG files. WMF files were later superseded by Enhanced Metafiles (EMF files) which did provide for device-independence. EMF files were then themselves enhanced via EMF+ files. Essentially,

2430-423: The same time as Microsoft was creating the 32 bit reimplementation of GDI for Windows NT, and it is likely that the vulnerability occurred during this effort. After Steve Gibson accused Microsoft of deliberately implementing a backdoor into their code, Mark Russinovich provided a rebuttal, and stated that: ...things were different when the format was architected. In the Windows 3.1 “large” memory model code

2484-470: The second header extension and increases EMF accuracy and scalability of EMFs as it adds the ability to measure distances of device surfaces using the metric system. Each EMF header starts with an EMR_HEADER record, and records the relevant properties of the device on which the metafile image was recorded. The original EMF header has an 80 byte header and an optional variable length description string. Other metafiles contain extension fields, which encapsulate

2538-461: The security landscape in the early 1990s was very different than today and all code, including that stored in a WMF file, was inherently trusted. Peter Ferrie of Symantec Security Response, USA also disagreed with Gibson, noting that: Gibson claimed that a thread is created to run the SetAbortProc handler. In fact, no thread is created to run the handler – it is a callback, which is called by

2592-502: The set of records had to be significantly increased and so Microsoft released EMF+ as an extension to the existing EMF file format. WMF, EMF and EMF+ files all consist of a series of records that are played back to produce graphical output. Some records define objects which can specify graphical objects used to determine how graphics should be drawn (e.g. pens specify the color and width of lines). Each of these objects are stored in metafiles and are placed into an object table, which tracks

2646-473: The source document as text with a single underline (also green by default) followed by a topic ID in hidden text. (In the .hlp file, the jumps show up as green text with a single underline, and popups show up as green text with a dotted underline.) Images can be added using codes such as {bmc image.bmp}. Supported image formats include .bmp , .wmf , and .shg (used for image maps, which can contain jumps or popups that are triggered by clicking on specific parts of

2700-423: The style, color and pattern of a brush which defines how to paint an area of the graphic), fonts (defines properties that affect how text is displayed), palettes (specifies colors as device-independent values, defined by an application), pens (specifies the graphical attributes of a line), and regions (which specify line and curve segments that define a shape). State records manage the graphics properties of

2754-408: The text as green text with a dotted underline. Single-clicking on a popup opens a small window with no menus, buttons, or scrollbars, sized to fit the text. Often, popups provide short definitions of key terms or other supplemental information about the main text. The popup automatically disappears the next time the user clicks or presses a key. Many, though not all Help topics have See Also jumps at

SECTION 50

#1732787255347

2808-400: The usage of graphic objects while processing the metafile. The object table is an associative array of indexes to graphical object structures defined within the metafile. WMF and EMF files handle object processing differently to EMF+ records in EMF files. As a WMF and EMF file is being processed, the records are read into an object table once an object is defined. If an object is deleted then

2862-434: Was fully specified in volume 4 of the 1992 Windows 3.1 SDK documentation (at least if combined with the descriptions of the individual functions and structures in the other volumes), but that specification was vague about a few details. These manuals were published as printed books available in bookstores with no click through EULA or other unusual licensing restrictions (just a general warning that if purchased as part of

2916-428: Was invented by Aldus Corporation , who added an additional "placeable" header, called the "APM header", which added a bounding rectangle, a metafile version, metafile size, number of objects in the metafile and the size of the largest single record in the metafile. This was later incorporated into the WMF format by Microsoft , starting in Windows 2000 . WMF files are structured by a series of records, starting with

#346653