BCSToBCS


BCSToBCS(
 unsigned char * pDest,
 unsigned char * pSrc,
 int dstCharSet,
 int srcCharSet,
 unsigned int MaxLen
 )

This service maps a BCS string to another BCS string. Currently, the only conversions supported are from OEM to Windows ANSI and vice versa. It takes care of double-byte encoding.

pDest

Supplies a pointer to the destination buffer. The destination buffer must be long enough for the path.

pSrc

Supplies a pointer to the source buffer.

dstCharSet

Supplies the character set the destination string needs.

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.


srcCharSet

Supplies the character set the source string is in.

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.


MaxLen

Supplies the maximum length the destination path should be i.e. the size of the buffer.

_QWORD Structure:

Value

Meaning

The fields in this structure are filled in as follows.

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.


pDest

Contains buffer filled in with the converted BCS string.