Skip to content

Commit 6114da1

Browse files
authored
Add documentation for configuring editors for MsQuic dev (#2181)
* Add documentation for configuring editors for MsQuic dev I get asked these questions a lot, so figure documenting how to get intellisense in VS Code warning free is worth it * Smore cleanup
1 parent 7c8f55b commit 6114da1

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

docs/Development.md

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Developing MsQuic
2+
3+
This document contains tips and tricks for configuring known editors to make MsQuic development easier.
4+
5+
## Configuring Visual Studio Code for MsQuic
6+
7+
Using the VS Code C/C++ Tools extension (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
8+
getting intellisense working for MsQuic is easy, but requires a small amount of configuration. The configuration UI
9+
can be started by going to the command palette (View -> Command Palette) and running `C/C++: Edit Configurations (UI)`.
10+
This UI is a bit awkward to use, to set a field you have to click on another field. If you click out of the window it
11+
won't save.
12+
13+
For User Mode (Windows, Linux or macOS), the following defines need to be added to the configuration.
14+
15+
```
16+
"_DEBUG",
17+
"UNICODE",
18+
"_UNICODE",
19+
"QUIC_EVENTS_STUB",
20+
"QUIC_LOGS_STUB"
21+
```
22+
23+
Additionally, `cStandard` and `cppStandard` need to be set to `c17` and `c++17` respectively.
24+
25+
26+
For Kernel Mode, create a new configuration with the `Add Configuration` button and call it Kernel.
27+
28+
Add a Compiler argument `/kernel` to force kernel mode in the compiler.
29+
30+
Add the following defines
31+
32+
```
33+
_DEBUG
34+
UNICODE
35+
_UNICODE
36+
QUIC_EVENTS_STUB
37+
QUIC_LOGS_STUB
38+
_AMD64_
39+
_WIN32_WINNT=0x0A00
40+
```
41+
42+
Set `cStandard` and `cppStandard` to `c17` and `c++17` respectively.
43+
44+
Finally, you'll need to add the kernel mode header paths to `Include path`. On my system they're
45+
46+
```
47+
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\km
48+
C:\Program Files (x86)\Windows Kits\10\Include\wdf\kmdf\1.33
49+
```
50+
Depending on which WDK you have installed, the versions might change, but the relative folder paths should be similar.
51+
52+
You will have to switch between configurations depending on if you want kernel mode or user mode context. To do this,
53+
while youre in a c or cpp file the status bar on the buttom right will have the configuration mode. For user it will
54+
be called `Win32` and for kernel it will be called `Kernel`. To switch contexts, click the text, and you'll get a drop
55+
down to select other configurations.
56+
57+
58+
59+
In the end, your c_cpp_properties.json file (in the .vscode folder) should look similar to the following. Some paths might be different, but they're trivially fixable.
60+
61+
```
62+
{
63+
"configurations": [
64+
{
65+
"name": "Win32",
66+
"includePath": [
67+
"${workspaceFolder}/**"
68+
],
69+
"defines": [
70+
"_DEBUG",
71+
"UNICODE",
72+
"_UNICODE",
73+
"QUIC_EVENTS_STUB",
74+
"QUIC_LOGS_STUB"
75+
],
76+
"windowsSdkVersion": "10.0.22000.0",
77+
"cStandard": "c17",
78+
"cppStandard": "c++17",
79+
"intelliSenseMode": "windows-msvc-x64",
80+
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe"
81+
},
82+
{
83+
"name": "Kernel",
84+
"includePath": [
85+
"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22000.0\\km",
86+
"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\wdf\\kmdf\\1.33",
87+
"${workspaceFolder}/**"
88+
],
89+
"defines": [
90+
"_DEBUG",
91+
"UNICODE",
92+
"_UNICODE",
93+
"QUIC_EVENTS_STUB",
94+
"QUIC_LOGS_STUB",
95+
"_AMD64_",
96+
"_WIN32_WINNT=0x0A00"
97+
],
98+
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe",
99+
"windowsSdkVersion": "10.0.22000.0",
100+
"cStandard": "c17",
101+
"cppStandard": "c++17",
102+
"intelliSenseMode": "windows-msvc-x64",
103+
"compilerArgs": [
104+
"/kernel"
105+
]
106+
}
107+
],
108+
"version": 4
109+
}
110+
```

0 commit comments

Comments
 (0)