Microsoft KB Archive/924515

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


Addendum to the RegisterApp API for the Winword Converter SDK

Article ID: 924515

Article Last Modified on 2/13/2007



APPLIES TO

  • Microsoft Office Word 2003
  • Microsoft Word 2002 Standard Edition



INTRODUCTION

You create a format converter for Microsoft Office Word 2003. If the converter does not specify the SuppressSecurityPrompt opcode, the users of this converter receive the following error messages:

This file needs to be opened by the converter_name text converter, which may pose a security risk if the file you are opening is a malicious file. Choose Yes to open this file only if you are sure it is from a trusted source.

This file needs to be saved using the converter_name text converter. If you are not the author of this file or if the file is not from a trusted source, using this converter may pose a security risk. Click Yes to save this file only if you are sure it is from a trusted source.

This article describes the new RegisterApp opcodes that are added to the Word converter API by Word 2002 and by Word 2003. This article is an addendum to the existing RegisterApp API for the Winword Converter SDK.

For more information about Word converters, click the following article numbers to view the articles in the Microsoft Knowledge Base:

837011 You receive a security warning message when you open or when you save a document in Word 2003


111716 How to obtain the WinWord Converter SDK (GC1039)


MORE INFORMATION

The converter API allows for a variable set of opcodes to be sent from the calling application to the converter, and another variable set of opcodes to be returned from the converter to the calling application. This mechanism enables the set of opcodes to grow in a backwards-compatible manner. For more information about these opcodes, see the CONVAPI.H conversions API file.

The "small" valued opcodes are for the converter to pass to Word. The opcodes that are valued 0x80 and larger are for Word to pass to the converter. For more information about the RegisterApp API, see the full converter SDK.

The following table outlines all supported opcodes as of Word 2003. The latest additions are in bold text.

Byte Name Description
0x1 Ver This opcode specifies the major and the minor version of Word with which the converter’s RTF is compliant. A converter that uses this opcode must specify at least Word 6.0 level RTF. Newer versions of Word are not guaranteed to be able to provide RTF that is compatible with older readers. This opcode takes two short arguments. These arguments are the major and minor version numbers.
0x2 Docfile This opcode specifies whether the converter can handle docfiles, and whether the converter can handle regular files. This opcode takes one short argument. Bit 0 indicates whether the converter accepts docfiles. Bit 1 indicates whether the converter accepts non-docfiles.
0x3 Charset This opcode specifies the character set (either ANSI or OEM) in which file names should be encoded. The default is OEM. In this case, the converter must convert the OEM file names to ANSI by using the OemToChar Win32 function. However, it is better to use this opcode to specify that the converter can handle ANSI file names. This is because the conversion from ANSI to OEM and then back to ANSI is lossy. When the OEM character set is used as an intermediary character set in the converter, some file names are made impossible to pass to a converter. This opcode takes a single byte argument. This argument is the character set.
0x4 ReloadOnSave The presence of this opcode specifies that Word should reload the document from the newly saved file after an export conversion. This opcode takes no arguments.
0x5 PicPlacehold The presence of this opcode specifies that Word should include placeholder pictures together with size information when Word emits RTF for INCLUDEPICTURE fields. This opcode takes no arguments.
0x6 FavourUnicode The presence of this opcode specifies that Word should prefer Unicode over other character representations, such as DBCS, when Word emits RTF. This opcode takes no arguments.
0x7 NoClassifyChars The presence of this opcode specifies that Word should not break text runs by character set classification. This opcode takes no arguments.
0x08 ReturnHtml The presence of this opcode specifies that the converter can return HTML. The option is deprecated in Word 2003 and in later versions of Word. The option should not be used.
0x09 RtfCodepage The presence of this opcode specifies that Word should return RTF in the specified codepage.
0x0a 7BitRtf The presence of this opcode specifies that Word should return 7-bit RTF. This opcode is used for RTF consumers who are not prepared to handle octets for character representation or \bin destinations in RTF, or both.
0x0b SuppressSecurityPrompt If this opcode is not specified, Word prompts the user before Word invokes this converter. Word assumes that converters that were installed before this opcode was added were not developed under modern strict security practices. If your converter specifies this opcode, Word suppresses the security warning. Additionally, the converter is invoked without requiring user intervention. Although this may sound like a good idea, you must make sure not to compromise the security of the user’s computer.
0x80 Filename The presence of this opcode specifies that Word exports documents through converters to temporary files. Then, Word renames the temporary files after the conversion is successfully completed. This opcode takes one variable length argument. This argument specifies the final file name to which Word will rename the finished conversion. The file name is not null-terminated (the name does not end in "\0"). The file name's length is inferred from the opcode’s cbSize field. This file name is always in the ANSI character set.
0x81 InterimPath The presence of this opcode specifies that Word will move the file after the export operation is complete. For example, Word will move the file to an FTP server. This opcode takes no arguments.



Additional query words: winword format

Keywords: kbhowto kbinfo kberrmsg kbexpertiseadvanced KB924515