The ustring macro in the Dialog. inc file in MASM32 is faulty. As a result, a problem occurs when a Dialog box containing Chinese characters is displayed using a macro related to the Dialog box. The original code is as follows:
; ------------------------------------------------ ; write unicode string at current location in EDI ; ------------------------------------------------ ustring MACRO quoted_text LOCAL asc_txt .data asc_txt db quoted_text,0 .code invoke MultiByteToWideChar,CP_ACP,MB_PRECOMPOSED, ADDR asc_txt,-1,edi,LENGTHOF asc_txt add edi, LENGTHOF asc_txt*2 ENDM
After modification to the following:
; ------------------------------------------------ ; write unicode string at current location in EDI ; ------------------------------------------------ ustring MACRO quoted_text LOCAL asc_txt,dwMinSize .data asc_txt db quoted_text,0 dwMinSize dd 0 .code invoke MultiByteToWideChar,CP_ACP,0, ADDR asc_txt,-1,0,0 mov dwMinSize,eax invoke MultiByteToWideChar,CP_ACP,MB_PRECOMPOSED, ADDR asc_txt,-1,edi,dwMinSize add edi, dwMinSize add edi, dwMinSize ENDM
For details about how to use the MultiByteToWideChar function, refer to the MSDN library.