我在这里询问了如何在 MASM 中动态分配内存,但我还有 2 个问题。
如何为字节分配内存?
.data
tab DB ?
result DB ?
.code
invoke GetProcessHeap
; error here
mov tab, eax ; I cannot do this because of wrong sizes, AL and AH are equal 0
INVOKE HeapAlloc, tab, 0, <size>
invoke GetProcessHeap
mov result, eax ; same here
INVOKE HeapAlloc, result, 0, <size>
第二个问题,我可以在多线程应用程序中使用这种分配内存的方法还是应该使用 GlobalAlloc?