flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Small bug in 'tools\win32\system.inc' file

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 28 Aug 2010, 14:20
This code in the 'tools\win32\system.inc' never gets called anywhere else.
Found this out because the 'free' symbol is already defined in my msvcrt api include, so I changed the symbol name to 'dsfree' which should have given me another 'undefined symbol' error, but It compiled without error. Memory is not getting released when the program is finished with it.

Code:
display_string:
        invoke  GetStdHandle,[display_handle]
        mov     edx,eax
        mov     edi,esi
        or      ecx,-1
        xor     al,al
        repne   scasb
        neg     ecx
        sub     ecx,2
        invoke  WriteFile,edx,esi,ecx,bytes_count,0
        retn
alloc:
        invoke  VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE
        or      eax,eax
        jz      allocation_error
        clc
        retn
     allocation_error:
        stc
        retn
        ;[right here]
free: 
        invoke  VirtualFree,eax,0,MEM_RELEASE
        retn
        ;[end right here]
open:
        invoke  CreateFile,edx,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0
        cmp     eax,-1
        je      file_error
        mov     ebx,eax
        clc
        retn
    file_error:
        stc
        retn
create:
    

_________________
Gimme a sledge hammer! I'LL FIX IT!
Post 28 Aug 2010, 14:20
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 30 Aug 2010, 15:33
managed to get it working correctly. removed the msvcrt api defines and just included the kernel api and it works just fine.
Post 30 Aug 2010, 15:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.