szText dw 'H','e','l','l','o',' ','U','n','i','c','o','d','e',0
szAppName dw 'T','e','s','t',' ','U','n','i','c','o','d','e',0
That is not Unicode, that is just expanding the characters by one byte. Unicode is a true multibyte character set not just putting a 0 in front of each character. NaN did some unicode stuff I think. But GoAsm handles it at the assembler level, MASM cannot do any Unicode at all, you can fake it, maybe make a preprocessor to do it but MASM will not do it.
GoAsm can load and assemble a Unicode file, I am not sure how MASM handles some of the expanded character sets, probably INVALID CHARACTER IN FILE errors everywhere.
? < Try to encode that (1F,04) without real unicode support
Dear f0dder,
You right, some time we can have problems with masm lenght line limitation.
But I alway do lenght unicode string like this:
**** WARNING **** VERY BAD CODE **** FOR BETTER RESULT YOU MUST USE MACROS ****
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
MessageBoxW proto :DWORD, :DWORD, :DWORD, :DWORD
.data
szText dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 0
szAppName dw 'T','e','s','t',' ','U','n','i','c','o','d','e',0
.data?
.code
start:
invoke MessageBoxW, 0, OFFSET szText, OFFSET szAppName, MB_OK
invoke ExitProcess, NULL
end start
You right, some time we can have problems with masm lenght line limitation.
But I alway do lenght unicode string like this:
**** WARNING **** VERY BAD CODE **** FOR BETTER RESULT YOU MUST USE MACROS ****
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
MessageBoxW proto :DWORD, :DWORD, :DWORD, :DWORD
.data
szText dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 'E','G','A','8','0','W','O','A','.','F','O','N','=','E','G','A','8','0'
dw 'E','G','A','4','0','W','O','A','.','F','O','N','=','E','G','A','4','0'
dw 'C','G','A','8','0','W','O','A','.','F','O','N','=','C','G','A','8','0'
dw 'C','G','A','4','0','W','O','A','.','F','O','N','=','C','G','A','4','0'
dw 0
szAppName dw 'T','e','s','t',' ','U','n','i','c','o','d','e',0
.data?
.code
start:
invoke MessageBoxW, 0, OFFSET szText, OFFSET szAppName, MB_OK
invoke ExitProcess, NULL
end start
Dear Donkey,
You're right. If GoASM can load Unicode source file. It is better than MASM at this point.
Because MASM can only load ANSI file, so we have only way to do is convert unicode char to HEX 16bit and put it our source code. ( macro can handle )
Example:
IF I have Russian text ???
I must convert it into HEX = 0414h, 0416h, 0419h
and put in MASM source like this:
szText DW 0414h, 0416h, 0419h,0
and when I call Unicode API, it will display correctly.
But it very hard when I want to change its content.
I have 02 solutions:
+ Use macro
+ Put Unicode string in Resource file, because MS Reouce Compiler 5.0 or better can support Unicode
You're right. If GoASM can load Unicode source file. It is better than MASM at this point.
Because MASM can only load ANSI file, so we have only way to do is convert unicode char to HEX 16bit and put it our source code. ( macro can handle )
Example:
IF I have Russian text ???
I must convert it into HEX = 0414h, 0416h, 0419h
and put in MASM source like this:
szText DW 0414h, 0416h, 0419h,0
and when I call Unicode API, it will display correctly.
But it very hard when I want to change its content.
I have 02 solutions:
+ Use macro
+ Put Unicode string in Resource file, because MS Reouce Compiler 5.0 or better can support Unicode