On Fri, 25 Oct 2024, Martin Storsjö wrote:
On Fri, 25 Oct 2024, Johannes Khoshnazar-Thoma wrote:
Hi LIU Hao,
Thanks for you fast answer comments below.
Am 25.10.24 um 06:00 schrieb LIU Hao:
在 2024-10-24 19:26, Johannes Khoshnazar-Thoma 写道:
Hi List,
I am writing a Windows kernel driver that should use wdmsec (in
particular
IoCreateDeviceSecure(). I found the wdmsec.h header but I can't find some
libwdmsec.a to link against, so linking fails.
Is wdmsec supported by mingw64? How should I link it? If it is not
supported,
can I make it supported somehow (willing to hack .def files, ...),
DDK headers are not actively maintained and I don't know how much
usability
there is.
Windows Driver Kit provides wdmsec as a static library. There does not
seem
to be wdmsec in Wine or ReactOS, either.
So far the only option seems to be that you can link the LIB from Windows
Driver Kit (that's usually supported), which can be installed with Visual
Studio Installer.
I tried to link against the WDMSEC.LIB from the Ewdk but it looks like the
linker does not understand (part of) the archive:
The error message is:
/home/johannes/.zeranoe/mingw-w64/x86_64/lib/gcc/x86_64-w64-mingw32/12.3.1/../../../../x86_64-w64-mingw32/bin/ld:
wdmsec.lib: error adding symbols: file format not recognized
Runnin nm on the wdmsec.lib file shows that it appears to be the
ntoskrnl.exe
objects:
../.zeranoe/mingw-w64/x86_64/bin/x86_64-w64-mingw32-nm: ntoskrnl.exe: file
format not recognized
I think this is the issue that binutils _does_ support short import
libraries, which is the type of import library that MSVC uses, but binutils
only recognize this if the files are named "*.dll" within the import library
- but these are named ntoskrnl.exe instead.
I have considered posting a patch to binutils to extend this to also match
*.exe; I'm not very happy with that kind of solution as technically, the
files could be named almost anything, but extending it from *.dll to *.dll +
*.exe probably should be both safe and cover more of the practical cases.
I can try to get a patch posted to binutils about this.
I finally got around to this now - this patch is available at
https://sourceware.org/pipermail/binutils/2024-November/137536.html.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public