File format for Windows Device Driver - windows

What extensions could correspond to Windows Device Driver source files?
Is *.inf, *cat or *.sys it?
I am trying to search for the source code of a driver in a heap of legacy code, I see files with above mentioned extensions.

If it is legacy driver and built using command prompt (not newer visual studio), then you better of looking for file named SOURCES. It is similar to makefiles and will list driver file name (somedriver.sys) as well as list of source files -.c- for that driver.

*.sys is the actual driver. inf and cat are for installation parameters.

Your device driver source code files will most likely have .c and .h extensions, they will be written in the C programming language and when compiled will form the executable driver (with the .sys extension).
The .inf files are like a script used by Windows to install the device driver into the operating system, they identify the executable file name (your .sys files) and how the driver is installed etc.
The .cat files are used to store certificates and the driver signing signatures of the compiled driver, they are used by Windows during installation of the driver to make sure there's nothing malicious going on.
The .inf .cat and .sys files form the Windows driver package needed by the end user, they don't contain the actual source code of the executable driver.

Related

Programmatically install "non compatible" driver

I want to install signed driver but unfortunately the .inf file does not contain the correct hardware IDs. (incompatible driver)
I can install the driver manually like described here:
Force installing incompatible .inf driver in Windows Server 2019 Core
Right Click Update Driver in Device Manager
"Browse my computer for computer software”
“Let me pick from a list of available drivers on my computer”
Select “Have Disk…” and point to the driver folder
Now I'm looking for a way to do the same from script or code.
What I've tried so far:
I've tried to install the driver with devcon install -r <inf file> <device id> without success (error without any log).
patching the inf file with hardware Ids would break the driver signature and this is therefore not a good solution
PnPUtil: This adds the driver to the driver store, but because it is not compatible, the driver is not installed
It would also help to have answers or comments to the following questions:
Where can i get more logs from devcon to see detailed error descriptions
Can I somehow sign the driver by my self after patching the inf file?
Any other Ideas what i could try?

Is a digital signature neccessary to properly install all INF files?

I am trying to install a usb composite device I build on Windows 7(32bit & 64bit) and Windows8/8.1(32bit & 64bit).
The device composes of a Mass-storage and CDC Serial port device. I have provided an INF file to make Windows recognize the main composite device. Once that is recognized, I also provide INF for the CDC serial device. The mass-storage part functions without need of a INF file.
Now these INF files uses drivers that normal default Windows drivers.(usbccgp.sys, usbser.sys) Even when using these "default" drivers and not changing anything in them, do I still need to get a digital signature to install this device? Is there anyway to write the INF so as to bypass this error?
Thanks
Signatures are enforced when installing the drivers in 64-bit Windows. The drivers won't work without being signed. And once you have a proper certificate (note that not every code signing certificate will work), you can sign both the driver and cat file (if used) with this certificate.

DDK sample passthru not loaded in win7

I am developing a driver based on ddk sample "passthru" and I have trouble loading this driver in win7(x86 or x64). I have tested my driver in winxp (x86 and x64), and it works pretty well, but when I tried to load this driver into win7 (F8->Disable Driver Signature Enforcement), it seemed failed. Then, I tried the native passthru code, it also failed. I thought it failed because
I can not see any outputs using KdPrint fron windbg.
I can not see any useful information from system event.
I set a breakpoint on passthru!DriverEntry, it seems that DriverEntry has not been called.
My WDK is 7600.16385.1, and passthru is supposed to be compatible with win7. I compile passthru using command "build -cZ".
Could you help me understanding this problem, or any clue about why passthru not loaded in win7?
I have built this driver in win7 x86 checked build environment, and tested in win7 x86.
Solved: Actually, the driver has been loaded, but the output of KdPrint not shown in win7 by default, you should use KdPrintEx to specify message level, or modify registry to make debug message shown. Now I have no idea why bp failed either.
Normally you can't use a driver that was built for WinXP target on a Win7 machine. Rebuild for Win7 target.
Well your question is rather unspecific, but I see one particular problem here: Enabling test-signing and disabling kernel mode signing policy still requires you to sign the binary ... (after WHQL-tests MS would cross-sign the .cat file for the driver). Refer to this.
See:
For 64-bit versions of Windows Vista and later versions of Windows,
the kernel-mode code signing policy requires that all kernel-mode code
have a digital signature.
and:
The operating system loader and the kernel load drivers that are
signed by any certificate. The certificate validation is not required
to chain up to a trusted root certification authority. However, each
driver image file must have a digital signature.
These commands should allow to load a driver signed with anything
bcdedit.exe -set loadoptions DDISABLE_INTEGRITY_CHECKS
bcdedit.exe -set TESTSIGNING ON
You don't mention what target OS you chose when building. Icepack mentioned it. You need to actually build for Windows 7 to make it work with the new NDIS 6.0. Simply loading a driver built for XP (and older NDIS version) may not work at all.
My suggestion, use DDKBUILD.CMD and build one driver with (free build, W7):
ddkbuild.cmd -W7 fre . -cZ
and one with (free build, WXP)
ddkbuild.cmd -W7XP fre . -cZ
the above command line already takes into account the WDK you have. Note that if DDKBUILD.CMD fails to detect your installed WDK you'll have to set the environment variable W7BASE to point to the folder in which the WDK is installed (the one with install.htm, usually something like C:\WINDDK\7600.16385.1).

Add device driver to Windows CE 6.0 through Platform Builder

I'm trying to add a device driver to a Windows CE 6.0 image that I'm creating through Platform Builder.
The driver in question, for the VIA 6656 chipset (used in many USB Wi-Fi adapters/dongles), is available in the manufacturer's website and consists of several files: .PDB, .REG, .BIB, .DLL, .MAP and .REL.
I understand that the REG file must be imported in my OSDesign.reg, the BIB file to my OSDesign.bib and the DLL must be placed in the /Windows folder of my image. What I don't understand is what to do with the remaining files (PDB, MAP and REL).
Could anyone assist me in this matter?
Thank you in advance!
For inclusion into the OS, you need only the REG, BIB and DLL. The remaining files contain debugging symbols, linker information and the like, presumably in case you have an error and want to debug it. It's odd that you get these, but no source code. sStill, for including in your OS for use, they're not relevant.

How to extract .inf/.sys install files?

I have a .inf file that install a .sys file from the windows xp system folder when the user plugs an USB hardware. I would like to trace the files that the windows auto-install on the system, so I can develop an automated installer that doesnt bother the user. Any ideas?
Thanks
FileMon monitors and displays file system activity on a system in real-time. You could use it.
But Windows wouldn't allow to copy files in system32 or drivers directories. You should use Driver Install Frameworks API to install the driver.

Resources