FIX: Program Hangs when Startup Code Refers to __qczrinit

Last reviewed: September 16, 1997
Article ID: Q92408
5.30 | 5.30 MS-DOS | WINDOWS kbtool kbcode kbbuglist kbfixlist

The information in this article applies to:

  • Microsoft Linker for MS-DOS and Windows, version 5.3

SYMPTOMS

When an application is compiled with Microsoft C version 6.0, it runs without any problems. However, when the application is rebuilt using Microsoft C/C++ version 7.0, the program hangs in the CTR0.ASM module while executing the following code:

   MOV  cx, __qczrinit        ;* Get initializer address
   JCXZ @f                    ;* Is it zero?
   CALL cx                    ;* No -- call indirect

CAUSE

There is a problem in the Microsoft Linker (LINK) version 5.3 that does not initialize data in the DGROUP segment to 0.

RESOLUTION

There are two methods resolve this problem:

  • Modify the CRT0DAT.ASM file to initialize _qczrinit. Change line 176 from the following:

          dw 1 dup (?)
    

    to the following:

          dw 0
    

    Assemble the CRT0DAT.ASM file. Then use the LIB utility to place the CRT0DAT.OBJ file into the C/C++ 7.0 library file.

    -or-

  • Obtain the C/C++ 7.0 patch release. This release contains LINK version 5.31.009 which correctly initialize variables in the DGROUP segment to 0.

STATUS

Microsoft has confirmed this to be a problem in LINK version 5.3. This problem was corrected in LINK version 5.31.009.

MORE INFORMATION

The C 6.0 startup code explicitly initializes _qczrinit to 0 when the variable is declared. The C/C++ 7.0 startup code does not initialize the symbol. Instead the code relies on the linker to perform the initialization automatically. There is a problem in the Microsoft Linker (LINK) version 5.3 that does not initialize data in the DGROUP segment to 0.

Because the _qczrinit value is not initialized, if the random data in the _qczrinit variable is not zero, the startup code calls the address to which the _qczrinit variable points. Calling a random address in this manner causes the system to hang.


Additional reference words: 5.30
KBCategory: kbtool kbcode kbbuglist kbfixlist
KBSubcategory: LinkIss
Keywords : kb16bitonly
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.