News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how to catch HeapFree error?

Started by UtillMasm, May 21, 2009, 06:27:51 AM

Previous topic - Next topic

UtillMasm

codes come from radasm version 2.2.1.2 (SimEd\RAEdit\Memory.asm)
mov esi,[ebx].EDIT.hChars
mov edi,[ebx].EDIT.cbChars
mov eax,nLen
and eax,0FFFFFF00h
add eax,MAXCHARMEM
add [ebx].EDIT.cbChars,eax
invoke HeapAlloc,[ebx].EDIT.hHeap,HEAP_GENERATE_EXCEPTIONS or HEAP_ZERO_MEMORY,[ebx].EDIT.cbChars
.if !eax
    mov [ebx].EDIT.cbChars,edi
    invoke MessageBox,[ebx].EDIT.hwnd,offset szMemFailChar,offset szToolTip,MB_OK
    xor eax,eax
.else
    mov [ebx].EDIT.hChars,eax
    push esi
    invoke GarbageCollection,[ebx].EDIT.hLine,esi,[ebx].EDIT.hChars
    pop esi
    invoke HeapFree,[ebx].EDIT.hHeap,0,esi
.endif

Rainstorm

don't know if i'm getting you right,...but if eax is zero after calling that function its an error.

UtillMasm

.if eax==0
;error!
;this code no chance to execute.
.endif

UtillMasm

Filename
SimEd\RAEdit\Function.asm
Reversion
855

StreamIn procedure has be update.
Problem not exist!

This thread can safety delete. :wink