mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Added "UnloadDriver" function
This commit is contained in:
parent
ed49b3ab7c
commit
32e8eecc69
@ -48,6 +48,28 @@ namespace Driver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Driver::UnloadDriver(unsigned long DUID)
|
||||||
|
{
|
||||||
|
foreach (DriverFile *drv in DriverManager->GetDrivers())
|
||||||
|
if (drv->DriverUID == DUID)
|
||||||
|
{
|
||||||
|
KernelCallback callback;
|
||||||
|
memset(&callback, 0, sizeof(KernelCallback));
|
||||||
|
callback.Reason = StopReason;
|
||||||
|
debug("Stopping & unloading driver %ld [%#lx]", drv->DriverUID, drv->Address);
|
||||||
|
DriverManager->IOCB(drv->DriverUID, (void *)&callback);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < sizeof(drv->InterruptHook) / sizeof(drv->InterruptHook[0]); i++)
|
||||||
|
{
|
||||||
|
if (!drv->InterruptHook[i])
|
||||||
|
continue;
|
||||||
|
delete drv->InterruptHook[i];
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int Driver::IOCB(unsigned long DUID, void *KCB)
|
int Driver::IOCB(unsigned long DUID, void *KCB)
|
||||||
{
|
{
|
||||||
foreach (auto var in Drivers)
|
foreach (auto var in Drivers)
|
||||||
|
@ -64,6 +64,7 @@ namespace Driver
|
|||||||
public:
|
public:
|
||||||
Vector<DriverFile *> GetDrivers() { return Drivers; }
|
Vector<DriverFile *> GetDrivers() { return Drivers; }
|
||||||
void UnloadAllDrivers();
|
void UnloadAllDrivers();
|
||||||
|
bool UnloadDriver(unsigned long DUID);
|
||||||
int IOCB(unsigned long DUID, /* KernelCallback */ void *KCB);
|
int IOCB(unsigned long DUID, /* KernelCallback */ void *KCB);
|
||||||
DriverCode LoadDriver(uint64_t DriverAddress, uint64_t Size);
|
DriverCode LoadDriver(uint64_t DriverAddress, uint64_t Size);
|
||||||
DriverCode StartDrivers();
|
DriverCode StartDrivers();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user