Ignore:
Timestamp:
Aug 13, 1999, 1:33:38 AM (26 years ago)
Author:
phaller
Message:

Add: added ODINWRAP support plus few enhancements to VERSION

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/lang.cpp

    r393 r488  
    1414#include <stdio.h>
    1515#include <string.h>
     16#include <odinwrap.h>
     17#include <heapstring.h>
     18#include <win\winreg.h>
    1619#include <winos2def.h>
    1720#include "unicode.h"
     21
     22ODINDEBUGCHANNEL(KERNEL32-LANG)
     23
    1824
    1925//******************************************************************************
     
    891897
    892898/*****************************************************************************
    893  * Name      : DWORD VerLanguageNameA
    894  * Purpose   : The VerLanguageNameA function converts the specified binary
    895  *             Microsoft language identifier into a text representation of the language.
    896  * Parameters: DWORD  idLang   Microsoft language identifier
    897  *             LPTSTR lpszLang address of buffer for language string
    898  *             DWORD  cbLang   size of buffer
     899 * Name      :
     900 * Purpose   :
     901 * Parameters:
    899902 * Variables :
    900  * Result    : size of target buffer
     903 * Result    :
    901904 * Remark    :
    902905 * Status    : UNTESTED STUB
    903906 *
    904  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
     907 * Author    : Patrick Haller [Tue, 1998/06/16 23:00]
    905908 *****************************************************************************/
    906909
    907 DWORD WIN32API VerLanguageNameA(UINT  idLang,
    908                                 LPSTR lpszLang,
    909                                 UINT  cbLang)
    910 {
    911   dprintf(("KERNEL32: VerLanguageNameA(%08x,%08x,%08x) not implemented.\n",
    912            idLang,
    913            lpszLang,
    914            cbLang));
    915 
    916   return (0);
    917 }
    918 
     910ODINFUNCTION3(DWORD,VerLanguageNameA,DWORD,  wLang,
     911                                     LPSTR,  szLang,
     912                                     DWORD,  nSize)
     913{
     914  char    buffer[80];
     915  LPCSTR  name;
     916  DWORD   result;
     917
     918  /*
     919   * First, check \System\CurrentControlSet\control\Nls\Locale\<langid>
     920   * from the registry.
     921   */
     922
     923#if 0
     924PHS: disabled because if interlinkage with registry
     925  sprintf( buffer,
     926           "\\System\\CurrentControlSet\\control\\Nls\\Locale\\%08x",
     927           wLang );
     928
     929  result = RegQueryValueA(HKEY_LOCAL_MACHINE,
     930                          buffer,
     931                          szLang,
     932                          (LPLONG)&nSize );
     933  if (result == ERROR_SUCCESS ||
     934      result == ERROR_MORE_DATA)
     935    return nSize;
     936#endif
     937
     938  /*
     939   * If that fails, use the internal table
     940   * (actually, Windows stores the names in a string table resource ...)
     941   */
     942
     943  lstrcpynA(szLang,
     944            "Language-Neutral",
     945            nSize);
     946
     947  return strlen(szLang);
     948}
    919949
    920950/*****************************************************************************
    921  * Name      : DWORD VerLanguageNameW
    922  * Purpose   : The VerLanguageNameW function converts the specified binary
    923  *             Microsoft language identifier into a text representation of the language.
    924  * Parameters: DWORD  idLang   Microsoft language identifier
    925  *             LPTSTR lpszLang address of buffer for language string
    926  *             DWORD  cbLang   size of buffer
     951 * Name      :
     952 * Purpose   :
     953 * Parameters:
    927954 * Variables :
    928  * Result    : size of target buffer
     955 * Result    :
    929956 * Remark    :
    930957 * Status    : UNTESTED STUB
    931958 *
    932  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
     959 * Author    : Patrick Haller [Tue, 1998/06/16 23:00]
    933960 *****************************************************************************/
    934961
    935 DWORD WIN32API VerLanguageNameW(UINT  idLang,
    936                                 LPWSTR lpszLang,
    937                                 UINT  cbLang)
    938 {
    939   dprintf(("KERNEL32: VerLanguageNameW(%08x,%08x,%08x) not implemented.\n",
    940            idLang,
    941            lpszLang,
    942            cbLang));
    943 
    944   return (0);
    945 }
     962ODINFUNCTION3(DWORD,VerLanguageNameW,DWORD,  wLang,
     963                                     LPWSTR, szLang,
     964                                     DWORD,  nSize)
     965{
     966  LPSTR szLangA;
     967  DWORD rc;
     968
     969  if ( (szLang == NULL) ||
     970       (nSize  == 0) )          // validate parameters
     971     return 0;
     972
     973  szLangA = (LPSTR)HEAP_malloc(nSize + 1);
     974  rc = VerLanguageNameA(wLang,
     975                        szLangA,
     976                        nSize);
     977  if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA)
     978    AsciiToUnicodeN(szLangA,
     979                    szLang,
     980                    nSize);
     981  HEAP_free(szLangA);
     982  return rc;
     983}
     984
     985
Note: See TracChangeset for help on using the changeset viewer.