KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q34623: _remappalette(8,_GRAY) Does Not Work Correctly

Article: Q34623
Product(s): See article
Version(s): 5.10   | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | bug | mspl13_c
Last Modified: 12-OCT-1988

_remappalette(pixel,color) maps the number "pixel" to the value
"color" and is suppose to return the previous color value. However,
when this function is invoked as _remappalette(8,_GRAY), the value
associated with _WHITE is returned.

Microsoft is researching this problem and will post new information as
it becomes available.

To demonstrate this problem, do the following:

1. cl the following source-code chunklet with /Od /Zi
   switches.

2. Go into CodeView.

3. Set N16 to look at the value err returned by _remappalette() in hex,
   then compare the value with values for the colors in graph.h. You
   may want to make a hardcopy of these values prior to cving. The
   correct value is returned on the zeroth pass, but then erroneous
   values are returned. This has been raided.

4. Use cv /S, where the S is for switching screen modes.

The following sample code demonstrates the problem:

         #include <stdio.h>
         #include <graph,h>
         main()
         {
            int i;
            long err;
            _setvideomode(_HRES16COLOR);
            for (i=0;i<16;i++)
            {
              err=_remappalette(8,_GRAY);
              printf("%x\n",err);
            }
            _setvideomode(_DEFAULTMODE);
         }

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.

Copyright Microsoft Corporation 1986-2002.