Access violation in the program that accesses the environment variable through the LoadLibrary() function (811405)



The information in this article applies to:

  • Microsoft Windows 2000 Professional
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Datacenter Server

SYMPTOMS

When you create a program where one thread calls the SetEnvironmentVariable function and changes the environment variable, and another thread calls the KERNEL32!GetEnvironmentStringsW function of the KERNEL32!LoadLibraryExW application programming interface (API), the program may cause an access violation and then crash.

CAUSE

This problem occurs because the synchronization of the environment is incorrect in the LoadLibrary() function. The KERNEL32!GetEnvironmentStringsWfunction returns the process environment block (PEB) directly without performing any synchronization with other processes that access the environment variable. The PEB Lock function provides synchronization for processes that access this variable. However, the LoadLibrary() function is outside the scope of PEB Lock and, therefore, cannot synchronize access to this variable with other processes.

RESOLUTION

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft Windows 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

260910 How to obtain the latest Windows 2000 service pack

Hotfix information

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Windows 2000 service pack that contains this hotfix.

To resolve this problem immediately, 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: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.

Prerequisites

To install this hotfix, you must have Windows 2000 Service Pack 3 (SP3) installed on your computer.

Restart requirement

You must restart your computer after you install this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version        Size      File name
   ----------------------------------------------------------
   17-Jan-2003  08:08  5.0.2195.6621    42,256  Basesrv.dll
   17-Jan-2003  08:06  5.0.2195.6656   236,304  Cmd.exe
   17-Jan-2003  08:08  5.0.2195.6655   222,992  Gdi32.dll
   17-Jan-2003  08:08  5.0.2195.6656   710,928  Kernel32.dll
   17-Jan-2003  08:08  5.0.2195.6623   333,584  Msgina.dll
   17-Jan-2003  08:08  5.0.2195.6655   379,664  User32.dll
   17-Jan-2003  08:08  5.0.2195.6620   388,368  Userenv.dll
   15-Jan-2003  11:53  5.0.2195.6655 1,620,016  Win32k.sys
   16-Dec-2002  14:25  5.0.2195.6623   179,984  Winlogon.exe
   17-Jan-2003  08:08  5.0.2195.6655   243,472  Winsrv.dll

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article. This problem was first corrected in Microsoft Windows 2000 Service Pack 4.

MORE INFORMATION

For additional information about how to obtain a hotfix for Windows 2000 Datacenter Server, click the following article number to view the article in the Microsoft Knowledge Base:

265173 The Datacenter program and Windows 2000 Datacenter Server product


Modification Type:MinorLast Reviewed:10/10/2005
Keywords:kbHotfixServer kbQFE kbWin2000preSP4Fix kbfix kbbug KB811405 kbAudITPRO kbAudDeveloper