The declaration of BITRECORD in Windows.inc is indeed wrong because follows the C/C++ convention, when in ASM the order is the inverse.
This is a sample with the modified BITRECORD :
.386
.model flat,stdcall
option casemap:none
;include \masm32\include\windows.inc
includelib \masm32\lib\msvcrt.lib
printf proto C :ptr, :vararg
BITRECORD RECORD fDummy2:17,fAbortOnError:1,fRtsControl:2, fNull:1,fErrorChar:1,fInX:1,fOutX:1, fTXContinueOnXoff:1,fDsrSensitivity:1,fDtrControl:2,fOutxDsrFlow:1,fOutxCtsFlow:1,fParity:1,fBinary:1
DCB STRUCT
DCBlength DWORD ?
BaudRate DWORD ?
fbits BITRECORD <>
wReserved WORD ?
XonLim WORD ?
XoffLim WORD ?
ByteSize BYTE ?
Parity BYTE ?
StopBits BYTE ?
XonChar BYTE ?
XoffChar BYTE ?
ErrorChar BYTE ?
EofChar BYTE ?
EvtChar BYTE ?
wReserved1 WORD ?
DCB ENDS
FieldSet MACRO SrcDotField, TheVal
LOCAL is, src, field
is INSTR <SrcDotField>, <.>
if is eq 0
.err <*** source.field required ***>
endif
src SUBSTR <SrcDotField>, 1, is-1
field SUBSTR <SrcDotField>, is+1
ifdifi <TheVal>, <eax>
mov eax, TheVal
endif
if field
shl eax, field
endif
and src, not mask field
add src, eax
ENDM
.data
fmt db "%c",0
.code
binPrint proc uses ebx esi value:dword
mov esi, value
mov ebx, 32
.while ebx
.if (esi & 80000000h)
INVOKE printf, offset fmt, "1"
.else
INVOKE printf, offset fmt, "0"
.endif
shl esi, 1
dec ebx
.endw
ret
binPrint endp
main proc
LOCAL bitrec : BITRECORD
mov bitrec, 0
FieldSet bitrec.fBinary, 1
FieldSet bitrec.fOutxCtsFlow, 0
FieldSet bitrec.fOutxDsrFlow, 0
FieldSet bitrec.fDtrControl, 1 ; DTR_CONTROL_ENABLE 0x01
FieldSet bitrec.fDsrSensitivity, 0
FieldSet bitrec.fOutX, 1
FieldSet bitrec.fInX, 0
FieldSet bitrec.fNull, 1
FieldSet bitrec.fRtsControl, 0 ; RTS_CONTROL_DISABLE 0x00
FieldSet bitrec.fAbortOnError, 0
mov eax, bitrec
INVOKE binPrint, eax
ret
main endp
end main