Microsoft KB Archive/297112

= BUG: Visual Basic Compiler Pads Embedded Resources to Align on 32-Bit Dword Boundaries =

Article ID: 297112

Article Last Modified on 10/21/2005

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q297112



SYMPTOMS
If you compile XML or XSL resources in your Microsoft Visual Basic project, XML or XSL parsers may not be able to parse the XML or XSL document from the resources embedded in the Visual Basic executable file.



CAUSE
The Visual Basic compiler pads embedded resources to align on 32-bit dword boundaries with &quot;0&quot; (zero) characters. Because 0 is not a valid character in XML or XSL, XML or XSL parsers may consider documents that contain 0s as invalid documents.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

Note You must have a Visual Studio license agreement to obtain this hotfix.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this fix should have the following file attributes or later:

  Date              Version      Size      File name 04/23/2001       6.0.91.15    1.78 MB   VB6.EXE 04/23/2001       6.0.0.8965   1.62 MB   VBA6.dll



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
  Use Microsoft Notepad to create an XML file named Test.xml and copy the following text into the file:  Test Name     Use Notepad to create a new file named Test.rc and copy the following text into the file. Make sure this file is in the same folder as Test.xml. <pre class="fixed_text">TEST.XML         HTML    DISCARDABLE     &quot;TEST.XML&quot; </li> With the working directory set as the folder where you want to save the Test.rc file, run the following command from a command prompt:

Rc Test.rc

A new file named Test.res is generated.</li> Open Visual Basic 6 and create a new standard EXE project. Use the default name.</li> From the Project menu, select Add File, and add the Test.res file to the project.</li> Compile the project to be Project1.exe.</li> Open Microsoft Internet Explorer and type the following line in the address bar:

res:// \project1.exe/test.xml

where   is replaced with the real path. For example, C:\test. You should see the following error message:

The XML page cannot be displayed

Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

Invalid at the top level of the document. Line 3, Position 7

</XML>

If you use the steps provided above but add two spaces to the end of the Test.xml file so that the size of the file becomes 40 bytes, it should work as expected.</li></ol>

Keywords: kbbug kbqfe kbpending kbhotfixserver KB297112

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.