UniToBCS


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

This service maps a unicode string to a BCS string in the specified character set. Currently, the Windows ANSI codepage or the current OEM codepage in the system can be specified for the conversion. 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.

pBCSStr

Supplies a flat pointer to a destination buffer to contain the converted BCS string.

pUniStr

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

length

Supplies the length in bytes of the unicode input string.

maxLength

Supplies the maximum length in bytes of the destination buffer, excluding the NUL character.

charSet

Supplies the BCS character set the unicode path needs to be converted to.

BCS Character Set Values:

Value

Meaning

BCS_WANSI

Specifies that the conversion should be done to the Windows ANSI codepage.

BCS_OEM

Specifies that the conversion should be done to 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 the destination buffer was not large enough to contain the converted BCS string.


pBCSStr

Filled in with the converted BCS string.