INFO: How the Accessibility RDK Determines the System Language. (196787)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • the operating system: Microsoft Windows NT
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98

This article was previously published under Q196787

SUMMARY

The Active Accessibility Redistribution Kit (RDK) determines the language of the system by extracting it from the version information in User.exe.

MORE INFORMATION

The RDK compares the primary language ID [using the macro PRIMARYLANGID(lcid)] for the RDK (derived from Oleaccrc.dll) to the primary language ID for User.exe.

Below is a code snippet to extract the language information:
   #define NUM_TCHARS_NEEDED_FOR_BACKSLASH (1)
   #define NUM_TCHARS_NEEDED_FOR_NULL_TERM (1)
   #define BACKSLASH (TEXT("\\"))

   UINT nLenOfSysDirPath = 0;
   LPTSTR lpszSysDir = NULL;
   LPTSTR lpszSysFile = NULL;
   UINT nLen = 0;
   DWORD dwUseless = 0;
   LPVOID lpVersionData = NULL;
   DWORD dwSize = 0;
   LCID lcidUSER;
   TCHAR szUserLangName [64];

   nLen = GetSystemDirectory( NULL, 0 );
   nLenOfSysDirPath = nLen + NUM_TCHARS_NEEDED_FOR_BACKSLASH;
   lpszSysDir = (LPTSTR) LocalAlloc( LPTR, nLenOfSysDirPath *
   sizeof( TCHAR ) );
   GetSystemDirectory( lpszSysDir, nLen );
   if ( lstrcmp( (LPCTSTR) lpszSysDir[ lstrlen( lpszSysDir ) ], (LPCTSTR)
     BACKSLASH ) )
      lstrcat( lpszSysDir, (LPCTSTR) BACKSLASH );

   lstrcpy( lpszSysFile, (LPCTSTR) lpszSysDir );
   lstrcat( lpszSysFile, (LPCTSTR) TEXT("USER.EXE"));

   dwSize = GetFileVersionInfoSize(lpszSysFile,&dwUseless);
   if (dwSize)
   {
     lpVersionData = LocalAlloc(LPTR,(UINT)dwSize);
     if (GetFileVersionInfo(lpszSysFile,dwUseless,dwSize,lpVersionData))
     {
       if(VerQueryValue(lpVersionData,TEXT("\\VarFileInfo\\Translation"),
       (VOID**)&lpdwTrans, &cbTrans))
       {
        lcidUSER = LOWORD(lpdwTrans[0]);
       }
     } // end we got version data
    LocalFree((HLOCAL)lpVersionData);
   }

   VerLanguageName (lcidUSER,szUserLangName,sizeof(szUserLangName));
				
This information is pertinent to Windows 95, Windows 98 and Windows NT 4.0 Service Pack 4 and later versions.

REFERENCES

MSAA

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbAAcc kbinfo KB196787