I have a UMDF 2.15 driver and needed to modify it to use some functionality
that is provided by a 3rd party. This functionality is provided both as a
static lib and as a shared lib[Dll].
I modified the driver to call the appropriate functions and to link with
the said Dll. I modified the inf file to copy the Dll to
c:\windows\system32\drivers\UMDF and verified the file is getting copied
[by looking at c:\windows\INF\setupapi.dev.log and also by looking at the
destination directory]. On installing the driver, I am getting error
Modifying to use a static lib causes the driver to works fine.
I am calling the Dll functionality from a path that services an IoCTL which
is not called at driver install/load time. Using Dependency walker, I
verified that the 3rd party Dll only depends on kernel32.lib. I also built
an extremely simple Dll just for testing and found that I hit the same
error with it if I try to call any function from it in my driver. So it
looks like whatever I am hitting is independent of the specific
functionality in the Dll that I am trying to access.
I tried to search online to see if there is some type of recommendation
about only using static linking while building a UMDF driver. One
interesting thing I found is athttps://docs.microsoft.com/en-us/windows-hardware/drivers/develop/using-the-microsoft-c-runtime-with-user-mode-drivers-and-apps
which makes a specific recommendation for UMDF drivers and C Runtime
For UMDF drivers:
- Statically link your driver against the CRT to include the runtime in
the binary. In this case, you do not need to redistribute the CRT.
The above seems to go against general recommendation against statically
linking with CRT libs and made me wonder if there is a reason for this.
Question - Is using a Dll with UMDF driver supposed to work [assuming we
follow the recommended good practices for calling a Dll from another Dll]?
Or is this something to be strictly avoided?
If you would like me to post my inf or the driver code etc. or share any
other details, I will be glad to share those.
Thanks in advance for your help.