LCMapStringW

  int LCMapStringW(LCID, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest)    
  LCID LCID;    
  DWORD dwMapFlags;    
  LPWSTR lpSrcStr;    
  int cchSrc;    
  LPWSTR lpDestStr;    
  int cchDest;    

The LCMapStringW function maps one wide character string to another performing the specified locale-dependent translation.

Parameters

LCID

Locale context for the mapping.

dwMapFlags

Indicates what type of transformation is to occur during mapping. Several flags can be combined on a single transformation (though some combinations are illegal). Mapping options include:

Value Meaning

LCMAP_LOWERCASE  
  lowercase
LCMAP_UPPERCASE  
  uppercase
LCMAP_SORTKEY  
  wide character sort key (normalize)
LCMAP_BYTEREV  
  byte reversal
NORM_IGNORECASE  
  ignore case; default is OFF
NORM_IGNORENONSPACE  
  ignore nonspacing; default is OFF
NORM _IGNORESYMBOLS  
  ignore symbols; default is OFF

The latter three options (NORM_IGNORECASE, NORM_IGNORENONSPACE, and NORM_IGNORESYMBOLS) are normalization options, and cannot be specified in conjunction with the casing options (LCMAP_LOWERCASE and LCMAP_UPPERCASE).

The casing options (LCMAP_LOWERCASE and LCMAP_UPPERCASE) are mutually exclusive.

lpSrcStr

Pointer to the supplied string to be mapped.

cchSrc

Character count of the input string buffer. If -1, lpSrcStr is assumed to be null-terminated and the length will be calculated automatically.

lpDestStr

Pointer to the memory buffer to store the resulting mapped string.

cchDest

The character count of the memory buffer pointed to by lpDestStr . If cchDest is 0, then the return value of this function is the number of characters required to hold the mapped string. The lpDestStr pointer is not referenced in this case.

Return Value

Success: number of characters written to lpDestStr

Failure: 0

This function sets GetLastError() with the following error values: ERROR_INSUFFICIENT_BUFFER, ERROR_INVALID_PARAMETER.

Comments

The mapped string will be null terminated if the source string is null-terminated.

The lpSrcStr and lpDestStr pointers may NOT be the same; the error ERROR_INVALID_PARAMETER will result in this case.

The output string is not strictly in WCHAR format since some of the mapping flavors return values (sort key) rather than wide characters.