forked from ryunp/mxl-support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d2mxl_sysreport.bat
325 lines (230 loc) · 8.71 KB
/
d2mxl_sysreport.bat
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
@ECHO OFF
REM Authors: Ryan Paul & Gavin Kehler
REM Date: 01/15/19
REM Version: 0.6.0
REM Usage: d2mxl_sysreport.bat
REM Description: Reports various D2 and OS settings to a text file
REM ~ Action List ~
REM 1. Install Path
REM 2. Patch Checksum
REM 3. DEP Settings
REM 4. Video Mode
REM 5. Overlay Detection
REM 6. PlugY Settings
REM 7. File List
SETLOCAL EnableDelayedExpansion
SETLOCAL EnableExtensions
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Output file
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM ~ Define output temp file ~
SET "output_file=%tmp%\%~n0.txt"
REM ~ Test for report text file permissions ~
TYPE NUL > "%output_file%"
IF EXIST "%output_file%" (
SET "output_file_exists=TRUE"
) ELSE (
CALL :log "Could not create '%output_file%'^^^! Sending output to console..."
CALL :log_nl
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 1. Install Path
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET "reg_diabloII=HKEY_CURRENT_USER\Software\Blizzard Entertainment\Diablo II"
REM ~ Check for registry key ~
REG QUERY "%reg_diabloII%" >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
CALL :log "[Installation Path]"
REM ~ Search registry entries ~
FOR /F "tokens=2*" %%a IN ('REG QUERY "%reg_diabloII%" /v "InstallPath"') DO SET "path_d2_install=%%b"
REM ~ Remove trailing backslash ~
IF "!path_d2_install:~-1!" == "\" SET "path_d2_install=!path_d2_install:~0,-1!"
REM ~ Report findings ~
IF "!path_d2_install!" == "" (
CALL :log "Diablo II registry sub-key 'InstallPath' not found^^^!"
GOTO :end
) ELSE (
CALL :log "'!path_d2_install!'"
)
) ELSE (
CALL :log "Parent 'Diablo II' registry key not found^^^!"
GOTO :end
)
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 2. Patch Checksum
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET "patchfile_path=%path_d2_install%\patch_d2.mpq"
REM ~ patch_d2.mpq version hash definitions ~
SET "patchfile_MD5_113c=eb514785fc4666bd53d97ad69ff53d16"
REM ~ Section header ~
CALL :log "[patch_d2.mpq Checksum]"
REM ~ Check for MD5 hash util on system (Win7+) ~
CertUtil >nul 2>&1 && (
REM ~ Exclude the verbose output text ~
FOR /F "skip=1 delims=" %%a IN ('CertUtil /hashfile "%patchfile_path%" MD5 ^| findstr /v "CertUtil"') DO SET "patch_checksum=%%a"
SET "patch_checksum=!patch_checksum: =!"
REM ~ Check against known hashes ~
IF "!patch_checksum!" == "!patchfile_MD5_113c!" (
SET "patch_result=v1.13c detected"
) ELSE (
SET "patch_result=not v1.13c"
)
CALL :log "!patch_checksum! - !patch_result!"
) || (
CALL :log "CertUtil.exe Unavailable"
)
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 3. DEP Settings
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM ~ User level DEP entries ~
SET "reg_dep_search=Diablo II"
SET "reg_dep_path=HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
REM ~ Section header ~
CALL :log "[User DEP Settings]"
REM ~ Check if registry entries exists ~
FOR /F "delims=" %%a IN ('REG QUERY "%reg_dep_path%" ^| FIND /I "%reg_dep_search%"') DO (
SET "match=%%a"
REM ~ Strip extra spaces ~
SET "match=!match: =!"
REM ~ Modify to CSV of key and value ~
SET "match='!match:REG_SZ=', '!'"
CALL :log "!match!"
)
IF "%match%" == "" CALL :log "No D2 registry key detected!"
CALL :log_nl
REM ~ Administration level DEP entries ~
SET "reg_dep_path=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
REM ~ Section header ~
CALL :log "[System DEP Settings]"
REM ~ Check if registry entries exists ~
FOR /F "delims=" %%a IN ('REG QUERY "%reg_dep_path%" ^| FIND /I "%reg_dep_search%"') DO (
SET "match=%%a"
REM ~ Strip extra spaces ~
SET "match=!match: =!"
REM ~ Modify to CSV of key and value ~
SET "match='!match:REG_SZ=', '!'"
CALL :log "!match!"
)
IF "%match%" == "" CALL :log "No D2 registry key detected!"
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 4. Video Mode
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET "reg_d2_video=HKEY_CURRENT_USER\Software\Blizzard Entertainment\Diablo II\VideoConfig"
REM ~ Video setting definitions ~
SET "vid_directdraw=0x0"
SET "vid_direct3d=0x1"
SET "vid_glide=0x3"
REM ~ Default to unset ~
SET "display_mode=Not Set"
REM ~ Query registry ~
FOR /F "tokens=2*" %%a IN ('REG QUERY "%reg_d2_video%" ^/v "Render"') DO SET "video_setting=%%b"
REM ~ Map video mode code to human readable label ~
IF "%video_setting%" == "%vid_directdraw%" SET "display_mode=DirectDraw"
IF "%video_setting%" == "%vid_direct3d%" SET "display_mode=Direct3D"
IF "%video_setting%" == "%vid_glide%" SET "display_mode=Glide"
REM ~ Section header ~
CALL :log "[Display Mode]"
CALL :log "%display_mode%"
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 5. Overlay Detection
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET "ol_array_len=0"
REM ~ Overlay definitions ~
SET "ps_steam=GameOverlayUI.exe"
SET "ps_nvidia=nvsphelper.exe"
SET "ps_ati=amddvr.exe"
SET "ps_gamebar=GamePanel.exe"
SET "ps_discord=Discord.exe"
REM ~ Search process list for known overlays ~
FOR /F "tokens=1*" %%a IN ('tasklist /nh') DO (
SET "ps_name=%%a"
IF "!ps_name!" == "%ps_steam%" CALL :ol_array_add "Steam"
IF "!ps_name!" == "%ps_nvidia%" CALL :ol_array_add "Nvidia"
IF "!ps_name!" == "%ps_ati%" CALL :ol_array_add "ATI"
IF "!ps_name!" == "%ps_gamebar%" CALL :ol_array_add "GameBar"
)
REM ~ Special check for Discord ~
FOR /F "tokens=1,2" %%a IN ('wmic process where caption^="!ps_discord!" get commandline') DO (
IF "%%b" == "--overlay-host" CALL :ol_array_add "Discord"
)
REM ~ Section header ~
CALL :log "[Gaming Overlay Detection]"
REM ~ Iterate over matched overlays ~
IF %ol_array_len% GTR 0 (
FOR /L %%i IN (1,1,%ol_array_len%) DO CALL :log "!overlay_array[%%i]!"
) ELSE (
CALL :log "No overlays detected!"
)
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 6. PlugY Settings
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET "plugy_config_path=%path_d2_install%\PlugY.ini"
REM ~ Section header ~
CALL :log "[PlugY Settings]"
IF EXIST "%plugy_config_path%" (
FOR /F "usebackq tokens=1* delims==" %%a IN ("%plugy_config_path%") DO (
REM ~ %%a=key, %%b=value ~
REM ~ Check if desired key/value pair ~
SET "desired_prop=true"
IF NOT "%%a" == "ActiveLaunchAnyNumberOfLOD" IF NOT "%%a" == "ActivePlugin" IF NOT "%%a" == "DisableBattleNet" IF NOT "%%a" == "DllToLoad" SET "desired_prop=false"
IF "!desired_prop!" == "true" CALL :log "%%a = %%b"
)
) ELSE (
CALL :log "'%plugy_config_path%' not found^^^!"
CALL :log_nl
)
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM 7. File List
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM ~ Section header ~
CALL :log "[D2 Root File List]"
REM ~ /B reduces output to only names, /O:E sorts by extension ~
FOR /F "delims=" %%a IN ('DIR /B /O:E "%path_d2_install%" ^| findstr /v /i "screenshot"') DO (
REM Output info
CALL :log "%%a"
)
CALL :log_nl
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Show output file, if existing
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:end
IF DEFINED output_file_exists (
NOTEPAD %output_file%
) ELSE (
PAUSE
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM End of program
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EXIT /B 0
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Functions
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM ~ Function signature: log(str) ~
:log
REM ~ Parens are needed to keep all characters escaped as strings ~
IF DEFINED output_file_exists (
(ECHO "%~1")>>"%output_file%"
) ELSE (
(ECHO "%~1")
)
EXIT /B 0
REM ~ Outputs a newline ~
:log_nl
IF DEFINED output_file_exists (
ECHO\>>"%output_file%"
) ELSE (
ECHO\
)
EXIT /B 0
REM ~ for Overlay Detection's array.push shim ~
:ol_array_add
SET /A ol_array_len += 1
SET "overlay_array[%ol_array_len%]=%~1"
EXIT /B 0