"Fossies" - the Fresh Open Source Software Archive

Member "fasm/tools/win32/system.inc" (9 Feb 2020, 1010 Bytes) of package /linux/misc/fasm-1.73.22.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) fasm source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 display_string:
    3     invoke  GetStdHandle,[display_handle]
    4     mov edx,eax
    5     mov edi,esi
    6     or  ecx,-1
    7     xor al,al
    8     repne   scasb
    9     neg ecx
   10     sub ecx,2
   11     invoke  WriteFile,edx,esi,ecx,bytes_count,0
   12     retn
   13 alloc:
   14     invoke  VirtualAlloc,0,eax,MEM_COMMIT,PAGE_READWRITE
   15     or  eax,eax
   16     jz  allocation_error
   17     clc
   18     retn
   19      allocation_error:
   20     stc
   21     retn
   22 free:
   23     invoke  VirtualFree,eax,0,MEM_RELEASE
   24     retn
   25 open:
   26     invoke  CreateFile,edx,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,0,0
   27     cmp eax,-1
   28     je  file_error
   29     mov ebx,eax
   30     clc
   31     retn
   32     file_error:
   33     stc
   34     retn
   35 create:
   36     invoke  CreateFile,edx,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0
   37     cmp eax,-1
   38     je  file_error
   39     mov ebx,eax
   40     clc
   41     retn
   42 write:
   43     invoke  WriteFile,ebx,edx,ecx,bytes_count,0
   44     or  eax,eax
   45     jz  file_error
   46     clc
   47     retn
   48 read:
   49     push    ecx
   50     invoke  ReadFile,ebx,edx,ecx,bytes_count,0
   51     pop edx
   52     or  eax,eax
   53     jz  file_error
   54     cmp edx,[bytes_count]
   55     jne file_error
   56     clc
   57     retn
   58 close:
   59     invoke  CloseHandle,ebx
   60     retn
   61 lseek:
   62     movzx   eax,al
   63     invoke  SetFilePointer,ebx,edx,0,eax
   64     cmp eax,-1
   65     je  file_error
   66     retn