c++dlldriverwdksystem-error

WDK 10 - Rpcrt4.dll - System Error 2


I have been working with WDK 10 and I have added rpcrt4.lib into the Linker. My driver has been successfully built. When I try to run the driver using command net start mydriver. I get system error 2 message. I tried using dependency walker but I don't see any dll file missing. When I remove the rpcrt4.lib from the Additional Dependencies, I am able to run the driver without any problem. But when I add rpcrt4.lib, it build successfully but on writing net start mydriver it gives system error 2. I need rpcrt4.lib as I am using a function UuidCreate.

I have been working on this issue for last 1 week, but did not find anything.

Thanks


Solution

  • Rpcrt4.dll is user mode dll and can not be used in kernel space. of course your driver is fail load with code STATUS_OBJECT_NAME_NOT_FOUND (which mapped to win32 error ERROR_FILE_NOT_FOUND (2) ) - system search registration of Rpcrt4.dll under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and not found

    for create uuid in kernel mode you need use ExUuidCreate