Fixed error code and optimized function

git-svn-id: svn://kolibrios.org@7325 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2018-08-27 10:26:47 +00:00
parent 8100a4f52f
commit 598bb537e9

View File

@ -187,74 +187,67 @@ iglobal
endg endg
; Author Pavel Iakovlev ; Author Pavel Iakovlev
; Return EAX = 0 security kernel, error set function
; Return Else EAX > 0 success set function
align 32 align 32
callSet0x40:
shl eax, 2
push dword [memNewFunctionTable + eax]
pop dword [tempPointerAlloc]
mov eax, dword [memOldFunctionTable + eax]
call dword [tempPointerAlloc]
ret
align 4
setInt0x40: setInt0x40:
; !!! kernel security !!!
and ebx, 0FFh and ebx, 0FFh
mov eax, dword [servetable2 + ebx * 4] shl ebx, 2
; cmp eax, undefined_syscall mov eax, dword [servetable2 + ebx]
; jne errorSet0x40
; -----------------------
pushad pushad
add edx, 16 sub esi, edx
stdcall kernel_alloc, edx add esi, 16
push eax stdcall kernel_alloc, esi
pop dword[tempPointerAlloc] mov dword [tempPointerAlloc], eax
popad popad
push ebx push ebx
push dword[tempPointerAlloc] mov eax, dword [tempPointerAlloc]
pop eax
mov ebx, eax mov ebx, eax
add eax, edx add eax, esi
sub eax, edx
; push 0
; pop dword[hashDataFunction1]
; push 1
; pop dword[hashDataFunction2]
push edx
push ecx
loopCopyMemory: loopCopyMemory:
xor edx, edx
mov dl, byte[ecx]
mov byte[ebx], dl
; hash security function
; add dword[hashDataFunction1], edx
; mov edx, dword[hashDataFunction1]
; add dword[hashDataFunction2], edx
; -----------------------------
mov cl, byte[edx]
mov byte[ebx], cl
inc ebx inc ebx
inc ecx inc edx
cmp ebx, eax cmp ebx, eax
jne loopCopyMemory jne loopCopyMemory
pop ecx
pop edx
pop ebx pop ebx
; check hash security data mov eax, dword [tempPointerAlloc]
; cmp edi, dword[hashDataFunction1] mov esi, dword [servetable2 + ebx]
; jne errorSet0x40 cmp esi, undefined_syscall
; cmp esi, dword[hashDataFunction2] jne .step1
; jne errorSet0x40 sub ecx, edx
; ------------------------------- add eax, ecx
mov dword [servetable2 + ebx], eax
mov eax, dword[tempPointerAlloc]
mov dword [servetable2 + ebx * 4], eax
jmp successSet0x40
errorSet0x40:
xor eax, eax
successSet0x40:
ret ret
.step1:
tempPointerAlloc dd ? mov dword [memOldFunctionTable + ebx], esi
;hashDataFunction1 dd ? sub ecx, edx
;hashDataFunction2 dd ? add eax, ecx
mov dword [memNewFunctionTable + ebx], eax
mov dword [servetable2 + ebx], callSet0x40
ret
align 4
tempPointerAlloc dd 0
memOldFunctionTable: times 255 dd 0
memNewFunctionTable: times 255 dd 0
;------------------- ;-------------------