What you code 10 years before ?


cool idea of a friend of me – dariusz parys that has also an interesting feedback, i was looking between my floppy disks , is true hard to find an reader :), an i found not less or more then x86 asm code .

proc mem.realloc_heap heapptr, newsize, oldsize
    push    ecx edx

    push    40h        ;PAGE_EXECUTE_READWRITE
    push    1000h        ;MEM_COMMIT
    push    [newsize]
    push    [heapptr]    ;any address
    call    [VirtualAlloc]
    or    eax,eax
    jz    .error_GlobalReAlloc

.rnc:    clc
.r:    pop    edx ecx
.rc:    stc
    jmp    .r

    call    [GetLastError]

    ;catch out-of-memory
    push    ERR_OUT_OF_MEM
    cmp    eax, 8            ;ERROR_NOT_ENOUGH_MEMORY
    je    @f
    cmp    eax, 14         ;ERROR_OUTOFMEMORY
    je    @f
    mov    [esp],eax
@@:    pop    eax
    je    .rc

    mov    eax, ERR_UNKNOWN
    jmp    .rc

try it out, interesting what will comes out.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s