Michael,
You will probably like this.
; --------------------------------------------------------
; alignment must be an immediate operand and a power of 2
; when no longer required the original address must be
; freed with either GlobalFree() or the macro "mfree".
; --------------------------------------------------------
aalloc MACRO pmem:REQ,bcnt:REQ,alignment:REQ
mov rdx, bcnt
add rdx, alignment
mov rcx, GMEM_FIXED or GMEM_ZEROINIT
call GlobalAlloc
mov pmem, rax
add rax, alignment - 1
and rax, -alignment
EXITM <rax>
ENDM
Your suggestion is a good idea though, I have seen the function but have not had the time to try it out yet.
I have a longer version as well that will take memory operands for the alignment.