Skip to content

Commit c598942

Browse files
authored
Visual studio 2022 support (#22)
1 parent 4c295f9 commit c598942

File tree

6 files changed

+108
-88
lines changed

6 files changed

+108
-88
lines changed

README.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,22 @@ Also please note that following these instructions ENDANGERS YOUR SYSTEM TO VULN
2727

2828
## 1. Get your driver
2929

30-
You can download the precompiled version [here](https://github.com/dmarov/chamd/releases/download/v1.3/multibuild.zip).
30+
First of all note that this method not working for Windows 10 anymore. **Use Windows 11**.
31+
32+
**Virus and Threat protection** will hinder download of required files, so it needs to be disabled.
33+
34+
Then you can download the [compiled driver](https://github.com/dmarov/chamd/releases/download/v1.3/multibuild.zip).
3135

3236
This option is perfect for you if you'd like to start fast.
33-
However this option is not recommended because there is probability
37+
However it is not recommended because there is probability
3438
that publicly available driver was already flagged by anti-cheat system.
3539
For advanced setup refer to section 6. However it is not necessary at the moment,
3640
because zip archive has 1000 drivers. You can pick any.
3741

3842
Copy all 4 files from archive to directory where `cheatengine-x86_64.exe`
3943
is located.
4044

41-
You'll need to use [Cheat Engine 7.4](https://github.com/cheat-engine/cheat-engine/releases/tag/7.4).
45+
You'll have to use [Cheat Engine 7.4](https://github.com/cheat-engine/cheat-engine/releases/tag/7.4).
4246

4347
## 2. Bypass *Digital Singature Enforcement*
4448

@@ -50,9 +54,10 @@ Refer to section 7 for some extra methods.
5054
- [Video tutorial 1](https://www.youtube.com/watch?v=EJGuJp2fqpM)
5155
- [Video tutorial 2](https://www.youtube.com/watch?v=zsw3xoG3zgs)
5256

57+
5358
2.1. Create bootable usb drive for digital signature enforcement bypass.
5459

55-
2.1.1. Download and extract [archive](https://github.com/Mattiwatti/EfiGuard/releases/download/v1.2.1/EfiGuard-v1.2.1.zip).
60+
2.1.1. Download and extract [archive](https://github.com/Mattiwatti/EfiGuard/releases/download/v1.4/EfiGuard-v1.4.zip).
5661

5762
2.1.2. Mount you usb drive. 2GB drive is more than enough.
5863

@@ -135,7 +140,7 @@ Run `cheatengine-x86_64.exe`
135140
136141
Now you have loaded DBK64 driver signed with untrusted certificate.
137142
Kernel mode anticheat will allow to start game and make operations on game memory
138-
(last tested on EAC 05/15/2022).
143+
(last tested on EAC 19/04/2025).
139144
140145
## 6. [Extra] Compile the driver from source (recommended)
141146
@@ -168,14 +173,14 @@ npm install
168173
Just use your I-M-A-G-I-N-A-T-I-O-N.
169174
170175
6.6. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16)
171-
(community or enterprise). This project is based on Visual Studio 2019.
176+
(community or enterprise). This project is based on Visual Studio 2022.
172177
173178
6.7. Install MSVC (C/C++ compiler). You can install it by adding the Visual Studio
174-
additional package `Desktop development with C++`.
179+
additional package `Desktop development with C++`. `MSVC v143` should be used/
175180
176-
6.8. Also you'll need to install [WDK](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk)
177-
(Windows Driver Kit)
178-
Follow the instructions from the link.
181+
6.8. Install [Windows SDK and WDK](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk)
182+
Carefully follow the instructions from the link. It is omportant that SDK and WDK have the same version.
183+
Correct versions of spectre mitigated libraries should be installed.
179184
180185
6.9. Install openssl. The least complex way is to use Chocolatey.
181186
@@ -208,9 +213,7 @@ contain `10` randomized drivers.
208213
209214
Then go to section 2.
210215
211-
## 7. [Extra] Other methods of dealing with *Digital Signature Enforcement*
212-
213-
### 7.1. enable test signing (recommended for testing purposes only)
216+
## 7. Extra method of dealing with *Digital Signature Enforcement*
214217
215218
Open command prompt as Administrator
216219
@@ -230,11 +233,3 @@ want to test driver loading. Don't forget to disable it when you're done testing
230233
```shell
231234
bcdedit /set testsigning off
232235
```
233-
234-
### 7.2. use [DSEFix](https://github.com/hfiref0x/DSEFix) (deprecated)
235-
236-
It should work, but it's not recommended in favor of method explained in section 2.
237-
238-
Please note that THIS METHOD IS DEPRECATED AND CAN CAUSE OCCASIONAL 'BLUE SCREENS OF DEATH'.
239-
240-
Then go to section 3.

mysupercooldrv.cat

164 Bytes
Binary file not shown.

scripts/context.js

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ import { __dirname } from './paths.js';
66

77
export default class Context {
88
buildDir = path.normalize(__dirname + '\\..\\build\\');
9-
signDir = `${this.buildDir}signdir\\`;
109

11-
vcvarsCommunityPath = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat';
12-
vcvarsEnterprisePath = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat';
10+
vcvarsCommunityPath = 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat';
11+
vcvarsEnterprisePath = 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat';
1312
vcPath = null;
1413

1514
cmakeTplPath = path.normalize(__dirname + '\\..\\templates\\CMakeLists.txt.tpl');
1615
infTplPath = path.normalize(__dirname + '\\..\\templates\\chamd.inf.tpl');
16+
makeCatTplPath = path.normalize(__dirname + '\\..\\templates\\makecat.cdf.tpl');
1717
datTplPath = path.normalize(__dirname + '\\..\\templates\\driver64.dat.tpl');
1818
datPath = `${this.buildDir}driver64.dat`;
1919
srcDir = path.normalize(__dirname + '\\..\\src\\');
2020
cmakeConfigPath = this.srcDir + 'CMakeLists.txt';
21-
inf2CatPath = "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x86\\inf2cat.exe"
2221

2322
constructor(driverName, distDir) {
2423
this.distDir = distDir;
@@ -37,18 +36,16 @@ export default class Context {
3736
this.vcPath = this.vcvarsEnterprisePath;
3837
}
3938

40-
this.infPath = `${this.buildDir}${this.driverName}.inf`;
39+
this.makeCatPath = `${this.buildDir}${this.driverName}.cdf`;
4140
}
4241

4342
async all() {
4443
console.log(`Generating ${this.driverName} driver ...`);
4544
await this.purge();
4645
await this.generateCmakeFile();
4746
await this.compile();
48-
await this.createInfFile();
49-
await this.stampInfFile();
50-
// optimization for inf2cat directory search
51-
await this.copyToSignDir();
47+
await this.createMakeCatFile();
48+
await this.makeCatFile();
5249
await this.signDriver();
5350
await this.createDriverDatFile();
5451
await this.install();
@@ -104,56 +101,40 @@ export default class Context {
104101
fs.mkdirSync(this.buildDir);
105102
}
106103

107-
const cmd = `"${this.vcPath}" amd64 && cd "${this.buildDir}" && cmake -G "Visual Studio 16 2019" "${this.srcDir}" && cmake --build . --config Release`;
104+
const cmd = `"${this.vcPath}" amd64 && cd "${this.buildDir}" && cmake -G "Visual Studio 17 2022" -A x64 -T v143 "${this.srcDir}" && cmake --build . --config Release`;
108105
await this.execute(cmd, this.buildDir);
109106
}
110107

111-
async createInfFile() {
112-
console.log('Creating inf file');
108+
async createMakeCatFile() {
109+
console.log('Creating makecat file');
113110
await this.templateToFile(
114-
this.infTplPath,
115-
this.infPath, {
111+
this.makeCatTplPath,
112+
this.makeCatPath, {
116113
DRIVER_NAME: this.driverName,
117114
},
118115
);
119116
}
120117

121-
async stampInfFile() {
122-
console.log('Stamping inf file');
123-
const cmd = `"${this.vcPath}" amd64 && stampinf.exe -f .\\${this.driverName}.inf -a "amd64" -k "1.15" -v "*" -d "*"`
118+
async makeCatFile() {
119+
console.log('Makeing cat file');
120+
const cmd = `"${this.vcPath}" amd64 && MakeCat.exe -v .\\${this.driverName}.cdf`
124121
await this.execute(cmd, this.buildDir);
125122
}
126123

127-
async copyToSignDir() {
128-
fs.mkdirSync(this.signDir);
129-
130-
fs.copyFileSync(
131-
`${this.buildDir}${this.driverName}.sys`,
132-
`${this.signDir}${this.driverName}.sys`
133-
);
134-
135-
fs.copyFileSync(
136-
`${this.buildDir}${this.driverName}.inf`,
137-
`${this.signDir}${this.driverName}.inf`
138-
);
139-
}
140-
141124
async signDriver() {
142125
console.log('Signing driver');
143126
const openssl = `openssl req -nodes -newkey rsa:2048 -keyout ${this.driverName}.key -out ${this.driverName}.csr -subj "/CN=${this.driverName}.com/O=${this.driverName} LTD./C=US"`
144127
const crt = `openssl x509 -signkey ${this.driverName}.key -in ${this.driverName}.csr -req -days 365 -out ${this.driverName}.crt`;
145128
const pfx = `openssl pkcs12 -export -out ${this.driverName}.pfx -inkey ${this.driverName}.key -in ${this.driverName}.crt -password pass:`;
146-
const inf2cat = `"${this.inf2CatPath}" /driver:"./signdir" /os:10_X64 /verbose`;
147129
const vc = `"${this.vcPath}" amd64`;
148-
const signtool = `signtool sign /fd SHA256 -f "./${this.driverName}.pfx" -t "http://timestamp.digicert.com" -v "${this.signDir}${this.driverName}.cat"`;
130+
const signtool = `signtool sign /fd SHA256 -f "./${this.driverName}.pfx" -t "http://timestamp.digicert.com" -v "${this.driverName}.cat"`;
149131

150-
const cmd = `${openssl} && ${crt} && ${pfx} && ${inf2cat} && ${vc} && ${signtool}`;
132+
const cmd = `${openssl} && ${crt} && ${pfx} && ${vc} && ${signtool}`;
151133

152134
await this.execute(cmd, this.buildDir);
153135
}
154136

155137
async execute(cmd, cwd, params = []) {
156-
157138
console.log(`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`);
158139
console.log(`Executing: ${cmd}`);
159140

@@ -191,17 +172,12 @@ export default class Context {
191172
}
192173

193174
fs.copyFileSync(
194-
`${this.signDir}${this.driverName}.sys`,
175+
`${this.buildDir}${this.driverName}.sys`,
195176
`${this.distDir}${this.driverName}.sys`
196177
);
197178

198179
fs.copyFileSync(
199-
`${this.signDir}${this.driverName}.inf`,
200-
`${this.distDir}${this.driverName}.inf`
201-
);
202-
203-
fs.copyFileSync(
204-
`${this.signDir}${this.driverName}.cat`,
180+
`${this.buildDir}${this.driverName}.cat`,
205181
`${this.distDir}${this.driverName}.cat`
206182
);
207183

templates/CMakeLists.txt.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ enable_language(C ASM_MASM)
66
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../wdk")
77
find_package(WDK REQUIRED)
88
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
9-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1 /WX")
10-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1 /WX")
9+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0 /WX")
10+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W0 /WX")
1111
add_definitions( -DRELEASE="DEFINED" )
1212

1313
wdk_add_driver({{DRIVER_NAME}} KMDF 1.15

templates/makecat.cdf.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[CatalogHeader]
2+
Name={{DRIVER_NAME}}.cat
3+
PublicVersion=0x0000001
4+
EncodingType=0x00010001
5+
CATATTR1=0x10010001:OSAttr:2:6.0
6+
[CatalogFiles]
7+
<hash>File1={{DRIVER_NAME}}.sys

0 commit comments

Comments
 (0)