

-[pie]-  Visual C++ 4.1b Patch for MFC and Microsoft Developer Studio  -[pie]-



I. Summary

This patch updates MFC to fix a problem you may be seeing in an application
that uses the Microsoft database classes.  Using certain ODBC drivers you may
get an "Out of memory" error.  See below for a list of files updated and a
more complete description of the problem.

This patch also updates the debugger in the Microsoft Developer Studio to fix
a problem where you may not be stopping at breakpoints you have set in a
project that was built from a directory structure that contained long names.
This problem did not exist in Visual C++ 4.0.  See below for a list of files
updated.

II. How To Run the Patch, and What Gets Updated

Included in the self-extracting file 41patch.EXE you'll find:

 - readme.txt  : This file
 - patch.exe   : the executable which runs the patch script
 - msdev41.rtp : the patch file for the \msdev tree
 - mfc41.rtp   : the patch file for the MFC dlls in the \windows\system dir

To patch the MFC dll's in your \windows\system directory:

 - Close all applications using MFC, including Microsoft Developer Studio.        
 - Copy patch.exe and mfc41.rtp into your \windows\system directory on
   Windows 95 or Windows 3.x running Win32s, or \windows\system32 directory 
   on Windows NT.
 - Run the command "patch mfc41" at a command prompt in that directory.

Mfc41.rtp attempts to patch all the MFC files installed in the Windows 
system directory:
 - mfc40.dll
 - mfc40u.dll
 - mfcd40d.dll
 - mfcd40ud.dll
 - mfcd40d.pdb
 - mfcd40ud.pdb
               
To patch the files in the \msdev tree:

 - Close all applications using MFC, including Microsoft Developer Studio.
 - Copy patch.exe and msdev41.rtp to your \msdev directory.
 - Run the command "patch msdev41" at a command prompt in that directory.

Msdev41.rtp attempts to patch all the files listed below in the \msdev tree:
 - \bin\emn0n0.dll
 - \mfc\src\dbrfx.cpp
 - \mfc\lib\nafxcw.lib
 - \mfc\lib\nafxcwd.lib
 - \mfc\lib\uafxcw.lib
 - \mfc\lib\uafxcwd.lib
 - \mfc\lib\nafxcw.pdb
 - \mfc\lib\nafxcwd.pdb
 - \mfc\lib\uafxcw.pdb
 - \mfc\lib\uafxcwd.pdb

III. Caveats

Several of the MFC files that will potentially get patched are optionally
installed.  You may get a message in the patch log stating that a particular
file wasn't found, and that is OK.  If you didn't install the Unicode MFC
libraries, for instance, the patch program won't find them.

IV. Potential Problems and Workarounds

 - During any of the steps above, the patch program may tell you that you
   already have a copy of the newer files on disk. If it tells you that, 
   it won't patch the files in your \windows\system directory. To remedy 
   this situation, make sure that you do not have anyother copies of the 
   files listed above in your PATH.

   If that doesn't work, run the patch commands above using the /NOP 
   switch (i.e. "patch /NOP mfc41").  This switch tells the patch program 
   not to search your PATH for newer files.  

   If your files still aren't being patched, copy the files listed above into
   a temporary directory and run the patch command with the /NOP and /NOS
   command-line options (i.e. "patch /NOS /NOP mfc41").

 - You may get the error ept0038, indicating that a particular file couldn't
   be deleted. This may be because the DLL is still locked in memory. Be sure
   you have closed all applications before running the patch.  If that
   doesn't work, restart Windows and run the patch before starting any other
   applications.

V. Description of MFC Bug

An error can occur when mapping a CString to a SQL_LONGVARCHAR,
SQL_VARCHAR, or other SQL data type field if a driver returns a large
precision value from SQLDescribeCol() for the column.

A bug in the MFC ODBC Database classes results in MFC trying to allocate a
large chunk of memory to store data that might have this large precision.

In some cases, such as using a memo field with the FoxPro Desktop ODBC
driver, a memory allocation of 1 gigabyte may be attempted. Or, as is the
case with the Visual FoxPro driver, the MFC Database Classes will try to
allocate a negative number of bytes because the return value of the driver
is 2 gigabytes and then MFC adds 1, which causes the signed variable to wrap
into a negative value. In this case, an assertion occurs in
GetBufferSetLength() on line 447 of Strcore.cpp:

    ASSERT(nNewLength >= 0);

Mapping a Cstring to a SQL Server text field produces the same result.

The problem occurs only when mapping CString variables to variable-
length fields using the RFX_Text() function.