Initall commit

This commit is contained in:
2018-03-10 23:33:07 +03:00
commit 9843085a34
166 changed files with 83186 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
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
free:
invoke VirtualFree,eax,0,MEM_RELEASE
retn
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:
invoke CreateFile,edx,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0
cmp eax,-1
je file_error
mov ebx,eax
clc
retn
write:
invoke WriteFile,ebx,edx,ecx,bytes_count,0
or eax,eax
jz file_error
clc
retn
read:
push ecx
invoke ReadFile,ebx,edx,ecx,bytes_count,0
pop edx
or eax,eax
jz file_error
cmp edx,[bytes_count]
jne file_error
clc
retn
close:
invoke CloseHandle,ebx
retn
lseek:
movzx eax,al
invoke SetFilePointer,ebx,edx,0,eax
cmp eax,-1
je file_error
retn