I vaguely remember this from my Win2k days. Several of the wide character API's had issues when the strings weren't aligned on a WCHAR boundary. Iirc, it spawned a discussion over at Pelles C forum because several users were confused as to why malloc()'d strings were failing under Win2k (solution was to use _aligned_malloc() instead). If you want it to be somewhat abstracted away, you can always do a macro wrapper:
%macro WCHAR 1+
DW __utf16__(%1)
%endmacro
%macro VARIABLE 2+
ALIGN 2
%1: %2
%endmacro
SECTION .data
VARIABLE myStringW, WCHAR "Hello, Unicode World"
VARIABLE myStringA, DB "Hello, ASCII World", 0
VARIABLE myInteger, DD 0
This will produce aligned variables:
[section .data]
[sectalign 2]
times (((2) - (($-$$) % (2))) % (2)) nop
myStringW:
DW __utf16__("Hello, Unicode World")
[sectalign 2]
times (((2) - (($-$$) % (2))) % (2)) nop
myStringA: DB "Hello, ASCII World", 0
[sectalign 2]
times (((2) - (($-$$) % (2))) % (2)) nop
myInteger: DD 0
Hope this helps.
Regards,
Bryant Keller