aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/README.md
blob: 5f56a26719a297715cb572d24e4583b42fabf1f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Windows 7 drivers
=================

[![AppVeyor branch](https://img.shields.io/appveyor/ci/egor-tensin/windows7-drivers/master?label=AppVeyor)](https://ci.appveyor.com/project/egor-tensin/windows7-drivers/branch/master)

Basic Windows 7 drivers.

These don't actually manage any hardware, they are just examples of code
running in the kernel mode.

Development
-----------

* [Using WDK 7.1.0](km/build/wdk7.1/README.md)
* [Using WDK 8.1 Update](km/build/wdk8.1update/README.md)

Installation
------------

To install a driver as a Windows service, you can use the `sc` utility.
For example:

    sc create simple type= kernel binPath= C:\workspace\personal\windows7-drivers\km\build\wdk7.1\bin\x64\release\simple.sys

You can then load/unload the driver by starting/stopping the corresponding
service using the `net` utility.

    net start simple
    net stop simple

To uninstall a driver, delete the corresponding service using `sc`.

    sc delete simple

Please note that **64-bit versions of Windows 7 (or later) disallow loading
32-bit drivers**!

You may also need to explicitly enable self-signed drivers on 64-bit versions
of Windows.
Using the `bcdedit` utility, execute

    bcdedit /set testsigning on

and restart your computer.

Debugging
---------

A driver can be debugged using WinDbg.
To enable kernel debugging, you can use the `msconfig` utility (navigate to
"Boot" -> "Advanced options..." and check "Debug") or the `bcdedit` utility:

    bcdedit /debug on
    bcdedit /dbgsettings serial debugport:1 baudrate:115200

Then restart your computer for the new settings to take effect.

If a driver is loaded on a physical machine, you can connect to the COM port
specified in kernel debugging settings (#1 by default) with an actual cable and
enter the kernel debugging mode in WinDbg via "File" -> "Kernel Debug...".
You might need to restart the debuggee machine a couple of times in order to
enter the kernel debugging mode.

If a driver is loaded on a virtual machine, the conventional approach is to
expose one of the guest OS's COM ports via a named pipe.
You can then connect to the pipe from a WinDbg instance on the host OS (via
"File" -> "Kernel Debug...").
Refer to your virtualization software's documentation for details.

Utilities
---------

A couple of usages examples are included along with the drivers.
For details, see [Utilities].

[Utilities]: um/README.md

License
-------

Distributed under the MIT License.
See [LICENSE.txt] for details.

[LICENSE.txt]: LICENSE.txt