'Register a driver & start it with NtLoadDriver (windows)

I'm trying to load a Kernel Driver on windows using NtLoadDriver in ntdll.

I want to do things needed manually to understand the process better: Register the service myself and then call NtLoadDriver.

I placed a driver with active and valid certificate in the "system32\drivers" directory, and created a Registry Key in "\registry\machine\system\currentcontrolset\services".

The Executable requests the "SeLoadDriverPrivilege" successfully and then calls NtLoadDriver.

NtLoadDriver always gives me the Ntstatus 0xC0000034 (STATUS_OBJECT_NAME_NOT_FOUND).

The Unicode string that is needed is correctly initilized with: L"\registry\machine\system\currentcontrolset\services\vboxdrv"

Am I missing something? Everything is in place, so I have no idea what this error could mean in the current context.

I tried Loading the driver with: https://dennisbabkin.com/driverloader/ and that worked.

resources:

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-zwloaddriver http://www.codewarrior.cn/ntdoc/winnt/io/NtLoadDriver.htm

Registry Key! Driver File



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source