BCSToUni


BCSToUni(
 string_t  pUniStr,
 unsigned char * pBCSStr,
 unsigned int length,
 int charSet
 )

This service maps the BCS string in the specified character set to a unicode string. Only the Windows ANSI and currently configured OEM codepage can be specified for the BCS string. It is important to note that the source and destination buffers cannot be the same nor can they overlap. They should be two separate buffers. This service does not terminate the converted path with a NUL character, the caller of the service needs to do this, if necessary.

pUniStr

Supplies a flat pointer to a destination buffer for the converted unicode string.

pBCStr

Supplies a flat pointer to the source BCS string that needs to be converted into a unicode string.

length

Supplies the length in bytes of the BCS input string.

charSet

Supplies the character set the BCS string uses.

BCS Character Set Values:

Value

Meaning

BCS_WANSI

Specifies that the BCS string uses the Windows ANSI codepage.

BCS_OEM

Specifies that the BCS string uses the currently active OEM codepage.


_QWORD Structure:

The fields in this structure are filled in as follows.

Value

Meaning

ddLower

Returns the number of bytes in the converted unicode string. Under the standard C parameter conventions, this field is returned in register [EAX].

ddUpper

Returns special flags about the mapping operation. Under the standard C parameter conventions, this field is returned in register [EDX].


Mapping Flag Values:

Value

Meaning

MAP_FLAG_LOSS

Indicates that a loss occurred during the conversion. This will typically happen if the BCS character has no corresponding character in the unicode character set. The replacement character for this case is the underscore character '_', ASCII code 0x5f.

MAP_FLAG_TRUNCATE

Indicates that a malformed multi-byte character was detected i.e. a lead byte for a multi-byte character was found without a tail byte. This can happen either because the string passed in was malformed or because the length passed in was incorrect so as to fall at the boundary between a lead byte and a trail byte.


pBCSStr

Filled in with the converted BCS string.