From 36933473bcdf1bec560dc3b925b3f770195c136b Mon Sep 17 00:00:00 2001 From: Doczom Date: Tue, 7 Dec 2021 02:49:57 +0000 Subject: [PATCH] fix load driver TODO: add function for unload driver git-svn-id: svn://kolibrios.org@9406 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/memory.inc | 7 +++++-- kernel/trunk/core/peload.inc | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index fa42757764..e77b1ac42e 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -1261,18 +1261,21 @@ proc load_pe_driver stdcall, file:dword, cmdline:dword jz .fail mov esi, eax + push ebx ; base addres driver push [cmdline] push DRV_ENTRY call eax pop ecx pop ecx + pop ebx test eax, eax - jz .fail + jz .fail_init mov [eax+SRV.entry], esi pop esi ret - +.fail_init: + stdcall kernel_free, ebx ;clear memory driver .fail: xor eax, eax pop esi diff --git a/kernel/trunk/core/peload.inc b/kernel/trunk/core/peload.inc index 2991a8b83d..4dbce0a4e8 100644 --- a/kernel/trunk/core/peload.inc +++ b/kernel/trunk/core/peload.inc @@ -11,6 +11,9 @@ include 'export.inc' align 4 +; This function load file driver and output +; eax = address function START in driver +; ebx = address for kernel_free proc load_PE stdcall, file_name:dword locals image dd ? @@ -58,6 +61,7 @@ proc load_PE stdcall, file_name:dword .cleanup: stdcall kernel_free, [image] mov eax, [entry] + mov ebx, [base] ret .fail: xor eax, eax