Microsoft KB Archive/894092

From BetaArchive Wiki

Article ID: 894092

Article Last Modified on 12/3/2007



APPLIES TO

  • Microsoft .NET Framework 1.1 Service Pack 1
  • Microsoft Office SharePoint Portal Server 2003




SYMPTOMS

When you use impersonation in your Microsoft .NET Framework 1.1 Service Pack 1 (SP1) based application and the impersonated user account does not have permissions to access the application .config file, the application cannot load resources from satellite assemblies.

When this problem occurs, neutral resources are returned instead of the resources that are contained in the satellite assembly.

Also, in non-English versions of Microsoft Office SharePoint Portal Server 2003, the Site Settings page is displayed in English.

Note This behavior might occur in other non-English versions of SharePoint Portal Server 2003 that have not yet been reported.

RESOLUTION

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 .NET Framework 1.1 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

The .NET Framework 1.1 Service Pack 1 is required.

Restart requirement

You must restart your computer after you apply 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 file attributes) 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
   --------------------------------------------------------------
   06-May-2005  07:37  1.1.4322.2323   2,138,112  Mscorlib.dll     
   06-May-2005  07:39                     10,904  Mscorlib.ldo
   06-May-2005  07:48  1.1.4322.2323   2,519,040  Mscorsvr.dll     
   06-May-2005  07:49  1.1.4322.2323   2,506,752  Mscorwks.dll     

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. Create satellite assembly. To do this, follow these steps:
    1. Create a text file that is named MyRes.txt, and then add the following text to the file:

      TEST1 = "TEST1 for Neutral resource"
    2. Create a resource file that is named MyRes.resources by running the following command:

      resgen MyRes.txt MyRes.resources

    3. Create a resource assembly that is named MyRes.dll by running the following command:

      al /t:lib /embed:MyRes.resources /culture:neutral /out:MyRes.dll

    4. Create a folder in your project that is named ja-jp to store another culture.
    5. Create a text file that is named MyRes.txt in the new folder, and then add the following text to the file:

      TEST1 = "TEST1 for Japanese"
    6. Create a resource file that is named MyRes.ja-jp.resources in the new folder by running the following command:

      resgen MyRes.txt MyRes.ja-jp.resources

    7. Create a resource assembly that is named MyRes.resource.dll by running the following command:

      al /t:lib /embed:MyRes.ja-jp.resources /culture:ja-jp /out:MyRes.resources.dll

  2. Create a console application. To do this, follow these steps:
    1. Create a Microsoft Visual C# source file that is named Test.cs, and then add the following code example to the file.

      // Test.cs
      // --------------------------------------------
      using System;
      using System.Runtime.InteropServices;
      using System.Security.Principal;
      using System.Security.Permissions;
      
      class Class1
      {
          [DllImport("advapi32.dll", SetLastError=true)]
          public static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
      
          [DllImport("kernel32.dll", CharSet=CharSet.Auto)]
          public extern static bool CloseHandle(IntPtr handle);
      
          [DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
          public extern static bool DuplicateToken(IntPtr ExistingTokenHandle, int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle);
      
          static void Main(string[] args)
          {
              string str;
      
              // Load MyRes.dll and initialize ResouceManager.
              System.Reflection.Assembly asm = System.Reflection.Assembly.Load("MyRes");
              System.Resources.ResourceManager res = new System.Resources.ResourceManager("MyRes", asm);
      
              // Perform impersonation.
              IntPtr tokenHandle = new IntPtr(0);
              IntPtr dupeTokenHandle = new IntPtr(0);
                  
              string UserName, Password;
              UserName = "testuser";  // Change the user name and password correctly.
              Password = "testuser";  // Change the user name and password correctly.
        
              const int LOGON32_PROVIDER_DEFAULT = 0;
              const int LOGON32_LOGON_INTERACTIVE = 2;
              const int SecurityImpersonation = 2;
      
              tokenHandle = IntPtr.Zero;
              dupeTokenHandle = IntPtr.Zero;
      
              bool returnValue = LogonUser(UserName, ".", Password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT,ref tokenHandle);
              bool retVal = DuplicateToken(tokenHandle, SecurityImpersonation, ref dupeTokenHandle);
                  
              WindowsIdentity newId = new WindowsIdentity(dupeTokenHandle);
              WindowsImpersonationContext impersonatedUser = newId.Impersonate();
      
              // Try to obtain the "ja-jp" string from the satellite assembly.
              str = res.GetString("TEST1", new System.Globalization.CultureInfo("ja-jp"));
      
              // Determine the result of the ResouceManager.GetString method.
              Console.WriteLine(str);
      
              // Determine the current user name.
              str = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
              Console.WriteLine(str);
      
      
              impersonatedUser.Undo();
      
              if (tokenHandle != IntPtr.Zero)
                  CloseHandle(tokenHandle);
              if (dupeTokenHandle != IntPtr.Zero) 
                  CloseHandle(dupeTokenHandle);
          }
      }
    2. Create the Test.exe application. To do this, compile Test.cs by using the following command:

      csc test.cs

    3. Create a empty Test.exe.config file in the same folder as the Test.exe application.
    4. Make sure that MyRes.dll is in the same folder as the Test.exe application.
    5. In the same folder as the Test.exe application, create a subfolder that is named ja-jp.
    6. Copy the MyRes.resource.dll file to the ja-jp subfolder.
  3. Create a new user account. To do this, follow these steps:
    1. Create a new user account that is named testuser, and then set the password to testuser.
    2. Add the testuser user account to the Local Administrator Group.
    3. Change the file permission on the Test.exe.config file to Deny all for the testuser user account.
  4. At a command prompt, run the Test.exe application.

    When you run the application, TEST1 for Neutral resource is returned instead of TEST1 for Japanese.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates


Keywords: kbbug kbfix kbqfe kbresource kbprb kbnetframe110presp2fix kbhotfixserver kbwinserv2003sp2fix KB894092