[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference decwet::nt-developers

Title:MS Windows NT Developers
Notice:See note 1222 for MS bug reporting info
Moderator:TARKIN::LINEIBER
Created:Mon Nov 11 1991
Last Modified:Tue Jun 03 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3247
Total number of notes:15633

3204.0. "MFC library patch not running on Alpha" by NETRIX::"raymond.dewil@mail.dec.com" (raymond de wil) Tue Mar 11 1997 02:47

Hello,

a developper on one of my projects - which I planned to get accepted 
very soon now - got into problems on an AlphaServer 400 running NT
3.51, when trying to run a program in which he applied a patch for a 
known problem - PSS ID nbr Q120888 - downloaded from Microsoft.
The patch addresses a problem in the MFC CRecordset class in the file 
Dbrfx.cpp of the MDC library ( the function CFieldExchange::BindField
ToCOlumn crashes as it compares the results of a compare between a
signed integer and an unsigned long integer).
The corrected program runs fine on Intel, but crashes on Alpha.

Can someone point VERY URGENTLY to the equivalent patch for Alpha.

many thanks,
raymond.

[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
3204.1patchDECWET::PETERSONThu Mar 13 1997 18:40172
    here is the original text of the patch.  It appears to be on a VC 2.0
    problem.  Upgrading to VC 4.2b should eliminate the problem.  I can't
    stress strongly enough the desirability of an upgrade.  HOwever, if you
    can't upgrade, you can apply the change below to the MFC source code,
    and rebuild the MFC.  You cannot redistribute the rebuilt MFC DLLs
    unles you rename them to be something other than MFC.
    
    
    
    This article is about VC 2.0.  The article contains the fix (a source
    change to DBRFX.CPP) and requires the user to rebuild the MFC
    libraries.  I gave the source a cursory check and it looks like the fix
    was implemented, but, it also looks like there's a typo.  SQL_VARCHAR
    is being used in the conditional instead of nSqlType == SQL_VARCHAR. 
    If the customer copied the patch from the article, then the statement
    should be correct and there might be something else at fault.  This
    particular bug was fixed in 4.x.
    
    
    
    
    
    FIX: Assertion Fails When Use RFX_Text() w/ SQL_VARCHAR Column
    
    ID: Q120888
    
    
    
    ---------------------------------------------------------------------
    
    The information in this article applies to:
    
    
    
      The Microsoft Foundation Classes (MFC), included with:
    
        - Microsoft Visual C++ for Windows, versions 1.5 and 1.51
    
        - Microsoft Visual C++, 32-bit Edition, version 2.0
    
    ---------------------------------------------------------------------
    
    
    
    SYMPTOMS
    
    ========
    
    
    
    An assertion failure occurs when using RFX_Text() with a column of type
    
    SQL_VARCHAR that has a column width greater than 255 bytes.
    
    
    
    CAUSE
    
    =====
    
    
    
    The column width for a column with SQL type of SQL_VARCHAR is usually
    less
    
    than 256 bytes. The ASSERT on line 1747 is verifying that the column
    width
    
    is less than 256 bytes unless the column type is SQL_LONGVARCHAR or
    
    SQL_LONGBINARY. However some drivers implement SQL_VARCHAR type columns
    
    that allow more than 255 bytes; in which case, the assertion is not
    valid.
    
    
    
    STATUS
    
    ======
    
    
    
    Microsoft has confirmed this to be a bug in the Microsoft products
    listed
    
    at the beginning of this article. This bug was corrected in Visual C++
    
    versions 1.52 and 2.1.
    
    
    
    RESOLUTION
    
    ==========
    
    
    
    The problem occurs in the function CFieldExchange::GetColumnType().
    Because
    
    this function is not virtual, there is no easy workaround.
    
    
    
    You could replace the GetColumnType function as well as the RFX_Text()
    
    function but that would entail adding all of the RFX_Text() function to
    
    your application to take care of a problem occurs only in a _DEBUG
    build
    
    because ASSERTs are removed in release builds.
    
    
    
    Instead of re-implementing RFX_Text here are two other approaches:
    
    
    
     - Ignore the invalid assertion failure by choosing the Ignore button
    on
    
       the Assertion failed message box. This might not be an option if the
    
       assertion failure is raised frequently.
    
    
    
     - Modify the assertion in the MFC code. This requires that you rebuild
    the
    
       MFC libraries. For details on rebuilding the MFC Libraries, please
    see
    
       the section titled "How To Build Other Library Versions" in the
    "Class
    
       Library User's Guide." Or read the README.TXT file located in the
    MFC
    
       source directory (the default is: \MSVC\MFC\SRC). To modify the
    
       assertion, change the code in the CFieldExchange::GetColumnType
    
       function in DBRFX.CPP:
    
    
    
       From:
    
    
    
          ASSERT(dwT <= 255 || nSqlType == SQL_LONGVARBINARY ||
    
                 nSqlType == SQL_LONGVARCHAR);
    
    
    
       To:
    
    
    
          ASSERT(dwT <= 255 || nSqlType == SQL_VARCHAR ||
    
                 nSqlType == SQL_LONGVARBINARY ||
    
                 nSqlType == SQL_LONGVARCHAR);