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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
|
/* Project nGenEx
Destroyer Studios LLC
Copyright © 1997-2004. All Rights Reserved.
SUBSYSTEM: nGenEx.lib
FILE: MachineInfo.cpp
AUTHOR: John DiCamillo
OVERVIEW
========
Collect and Display Machine, OS, and Driver Information
*/
#include "MemDebug.h"
#include "MachineInfo.h"
#include "Timesnap.h"
#define DIRECTINPUT_VERSION 0x0700
#include <stdio.h>
#include <ddraw.h>
#include <d3d9.h>
#include <dinput.h>
#include <winver.h>
// +--------------------------------------------------------------------+
void Print(const char* fmt, ...);
static int cpu_class=-1;
static int cpu_speed=-1;
static int platform=-1;
static int dx_version=-1;
static int total_ram=-1;
static OSVERSIONINFO os_ver = { sizeof(OSVERSIONINFO) };
static SYSTEM_INFO cpu_info;
static MEMORYSTATUS mem_info = { sizeof(MEMORYSTATUS) };
// +--------------------------------------------------------------------+
const char*
MachineInfo::GetShortDescription()
{
static char desc[256];
static const char* cpu_names[] = {
"8088",
"8086",
"80286",
"80386",
"80486",
"Pentium",
"Pentium II",
"Pentium 3",
"Pentium 4"
};
static const char* os_names[] = {
"DOS",
"Windows 95",
"Windows 98",
"Windows NT",
"Windows 2000",
"Windows XP",
"Windows XP x64",
"Windows Vista",
"Windows Seven",
"Future Windows"
};
int cpu_index = GetCpuClass();
if (cpu_index < 0) cpu_index = 0;
else if (cpu_index > 8) cpu_index = 8;
int os_index = GetPlatform();
if (os_index < 0) os_index = 0;
sprintf_s(desc, "%s %d MHz %d MB RAM %s",
cpu_names[cpu_index],
GetCpuSpeed(),
GetTotalRam(),
os_names[os_index]);
return desc;
}
// +--------------------------------------------------------------------+
static void DescribeCpuMake();
static void DescribeOwner95();
static void DescribeOwnerNT();
static void DescribeDrivers95(const char* sType);
static void DescribeDriversNT(const char* sType);
static void DescribeDriverVersion(const char* file);
static void DescribeDXVersion(const char* component);
// wait for at least target_time,
// return the exact amount of time actually waited:
static double SpinWait(double target_time)
{
double actual_time = 0;
LARGE_INTEGER ifreq;
LARGE_INTEGER cnt1;
LARGE_INTEGER cnt2;
QueryPerformanceFrequency(&ifreq);
double freq = (double) ifreq.QuadPart;
QueryPerformanceCounter(&cnt1);
do {
QueryPerformanceCounter(&cnt2);
double delta = (double) (cnt2.QuadPart - cnt1.QuadPart);
actual_time = delta / freq;
}
while (actual_time < target_time);
return actual_time;
}
static double CalcCpuSpeed()
{
DWORD clock1 = 0;
DWORD clock2 = 0;
TIMESNAP(clock1);
double seconds = SpinWait(0.1);
TIMESNAP(clock2);
double clocks = clock2 - clock1;
return (clocks/seconds);
}
/****************************************************************************
*
* GetDXVersion
*
* This function returns
* 0 Insufficient DirectX installed
* 9 At least DirectX 9 installed.
*
****************************************************************************/
DWORD GetDXVersion()
{
HRESULT hr = 0;
HINSTANCE DDHinst = 0;
LPDIRECT3D9 d3d9 = 0;
OSVERSIONINFO osVer = { sizeof(OSVERSIONINFO) };
// First get the windows platform
if (!GetVersionEx(&osVer))
return 0;
// NT versions do not support DirectX 9
if (osVer.dwPlatformId == VER_PLATFORM_WIN32_NT) {
if (osVer.dwMajorVersion <= 4)
return 0;
}
DDHinst = LoadLibrary("D3D9.DLL");
if (DDHinst == 0) {
return 0;
}
FreeLibrary(DDHinst);
return 9;
}
// +--------------------------------------------------------------------+
int
MachineInfo::GetCpuClass()
{
if (cpu_class < 0) {
GetSystemInfo(&cpu_info);
if (cpu_info.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_INTEL ||
cpu_info.dwProcessorType < PROCESSOR_INTEL_PENTIUM)
Print("INCOMPATIBLE CPU TYPE!\n");
if (GetPlatform() < OS_WINNT)
cpu_class = CPU_P5;
else
cpu_class = cpu_info.wProcessorLevel;
}
return cpu_class;
}
// +--------------------------------------------------------------------+
int
MachineInfo::GetCpuSpeed()
{
if (cpu_speed < 0) {
cpu_speed = (int) (CalcCpuSpeed() / 1e6);
}
return cpu_speed;
}
// +--------------------------------------------------------------------+
int
MachineInfo::GetTotalRam()
{
if (total_ram < 0) {
GlobalMemoryStatus(&mem_info);
total_ram = (int) (mem_info.dwTotalPhys/(1024*1024)) + 1;
}
return total_ram;
}
// +--------------------------------------------------------------------+
int
MachineInfo::GetPlatform()
{
if (platform < 0) {
GetVersionEx(&os_ver);
switch (os_ver.dwPlatformId) {
default:
case VER_PLATFORM_WIN32s:
case VER_PLATFORM_WIN32_WINDOWS: {
char msg[256];
sprintf_s(msg, "Invalid Operating System Platform: %d\n", os_ver.dwPlatformId); //-V576
Print(msg);
}
break;
case VER_PLATFORM_WIN32_NT:
if (os_ver.dwMajorVersion == 4)
platform = OS_WINNT;
else if (os_ver.dwMajorVersion == 5 && os_ver.dwMinorVersion == 0)
platform = OS_WIN2K;
else if (os_ver.dwMajorVersion == 5 && os_ver.dwMinorVersion == 1)
platform = OS_WINXP;
else if (os_ver.dwMajorVersion == 5 && os_ver.dwMinorVersion == 2)
platform = OS_WINXP64;
else if (os_ver.dwMajorVersion == 6 && os_ver.dwMinorVersion == 0)
platform = OS_WINVISTA;
else if (os_ver.dwMajorVersion == 6 && os_ver.dwMinorVersion == 1)
platform = OS_WINSEVEN;
else if (os_ver.dwMajorVersion >= 6)
platform = OS_WINFUTURE;
else {
platform = OS_INVALID;
Print("Invalid Operating System Platform (NT-series): %d.%d\n", os_ver.dwMajorVersion, os_ver.dwMinorVersion);
}
break;
}
}
return platform;
}
// +--------------------------------------------------------------------+
int
MachineInfo::GetDirectXVersion()
{
if (dx_version < 0) {
dx_version = GetDXVersion();
}
return dx_version;
}
// +--------------------------------------------------------------------+
void
MachineInfo::DescribeMachine()
{
GetPlatform();
GetCpuClass();
Print("+====================================================================+\n");
Print("| |\n");
char txt[256];
switch (platform) {
case OS_WIN95:
sprintf_s(txt, "Windows 95 version %d.%d.%d %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
LOWORD(os_ver.dwBuildNumber),
os_ver.szCSDVersion);
break;
case OS_WIN98:
sprintf_s(txt, "Windows 98 version %d.%d.%d %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
LOWORD(os_ver.dwBuildNumber),
os_ver.szCSDVersion);
break;
case OS_WINNT:
sprintf_s(txt, "Windows NT %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
break;
case OS_WIN2K:
sprintf_s(txt, "Windows 2000 %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
case OS_WINXP:
sprintf_s(txt, "Windows XP %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
break;
case OS_WINXP64:
sprintf_s(txt, "Windows XP x64 %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
break;
case OS_WINVISTA:
sprintf_s(txt, "Windows Vista %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
break;
case OS_WINSEVEN:
sprintf_s(txt, "Windows 7 %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
break;
case OS_WINFUTURE:
sprintf_s(txt, "Windows from the future %d.%d (Build %d) %s", //-V576
os_ver.dwMajorVersion,
os_ver.dwMinorVersion,
os_ver.dwBuildNumber,
os_ver.szCSDVersion);
break;
default:
sprintf_s(txt, "Unknown Operating System Platform");
break;
}
Print("| %-66s |\n", txt);
Print("| |\n");
if (platform == OS_WIN95 || platform == OS_WIN98)
DescribeOwner95();
else
DescribeOwnerNT();
sprintf_s(txt, "CPUs Detected: %d CPU Level: %d.%d.%d CPU Speed: %d", //-V576
cpu_info.dwNumberOfProcessors,
cpu_info.wProcessorLevel,
cpu_info.wProcessorRevision >> 8,
cpu_info.wProcessorRevision & 0xff,
GetCpuSpeed() + 1);
Print("| %-66s |\n", txt);
DescribeCpuMake();
GlobalMemoryStatus(&mem_info);
total_ram = (int) (mem_info.dwTotalPhys/(1024*1024)) + 1;
int swap_max = (int) (mem_info.dwTotalPageFile/(1024*1024));
int swap_avail = (int) (mem_info.dwAvailPageFile/(1024*1024));
sprintf_s(txt, "%d MB RAM %d MB Max Swap %d MB Avail Swap",
total_ram, swap_max, swap_avail);
Print("| %-66s |\n", txt);
Print("| |\n");
Print("| DirectX %d installed. |\n",
GetDirectXVersion());
DescribeDXVersion("DDRAW");
DescribeDXVersion("D3DIM");
DescribeDXVersion("DINPUT");
DescribeDXVersion("DPLAY");
DescribeDXVersion("DSOUND");
DescribeDXVersion("DMUSIC");
DescribeDXVersion("DSHOW");
Print("| |\n");
if (platform == OS_WIN95 || platform == OS_WIN98) {
DescribeDrivers95("Display");
DescribeDrivers95("Media");
DescribeDrivers95("Monitor");
DescribeDrivers95("Multimedia");
}
else {
DescribeDriversNT("");
}
Print("+====================================================================+\n");
Print("\n");
}
// +--------------------------------------------------------------------+
static void DescribeCpuMake()
{
HKEY hkWin;
char sProcessor[256] = "";
char sMMXInfo[256] = "";
char sVendor[256] = "";
DWORD dwSize;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"Hardware\\Description\\System\\CentralProcessor\\0",
0,
KEY_READ,
&hkWin) == ERROR_SUCCESS) {
dwSize = 256;
RegQueryValueEx(hkWin,
"Identifier",
NULL,
NULL,
(LPBYTE) sProcessor,
&dwSize);
dwSize = 256;
RegQueryValueEx(hkWin,
"MMXIdentifier",
NULL,
NULL,
(LPBYTE) sMMXInfo,
&dwSize);
dwSize = 256;
RegQueryValueEx(hkWin,
"VendorIdentifier",
NULL,
NULL,
(LPBYTE) sVendor,
&dwSize);
RegCloseKey(hkWin);
}
if (sProcessor[0]) Print("| %-66s |\n", sProcessor);
if (sMMXInfo[0]) Print("| %-66s |\n", sMMXInfo);
if (sVendor[0]) Print("| %-66s |\n", sVendor);
if (sProcessor[0] || sMMXInfo[0] || sVendor[0])
Print("| |\n");
}
// +--------------------------------------------------------------------+
static void DescribeOwner95()
{
HKEY hkWin;
char sRegisteredOwner[256] = "";
char sRegisteredOrganization[256] = "";
DWORD dwSize;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
0,
KEY_READ,
&hkWin) == ERROR_SUCCESS) {
dwSize = 256;
RegQueryValueEx(hkWin,
"RegisteredOwner",
NULL,
NULL,
(LPBYTE) sRegisteredOwner,
&dwSize);
dwSize = 256;
RegQueryValueEx(hkWin,
"RegisteredOrganization",
NULL,
NULL,
(LPBYTE) sRegisteredOrganization,
&dwSize);
RegCloseKey(hkWin);
}
else {
Print("Could not access registered owner\n");
}
if (sRegisteredOwner[0]) {
char txt[256];
sprintf_s(txt, "Registered Owner: %s, %s", sRegisteredOwner, sRegisteredOrganization);
Print("| %-66s |\n", txt);
Print("| |\n");
}
}
static void DescribeOwnerNT()
{
HKEY hkWin;
char sRegisteredOwner[256] = "";
char sRegisteredOrganization[256] = "";
DWORD dwSize;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
0,
KEY_READ,
&hkWin) == ERROR_SUCCESS) {
dwSize = 256;
RegQueryValueEx(hkWin,
"RegisteredOwner",
NULL,
NULL,
(LPBYTE) sRegisteredOwner,
&dwSize);
dwSize = 256;
RegQueryValueEx(hkWin,
"RegisteredOrganization",
NULL,
NULL,
(LPBYTE) sRegisteredOrganization,
&dwSize);
RegCloseKey(hkWin);
}
else {
Print("Could not access registered owner\n");
}
if (sRegisteredOwner[0]) {
char txt[256];
sprintf_s(txt, "Registered Owner: %s, %s", sRegisteredOwner, sRegisteredOrganization);
Print("| %-66s |\n", txt);
Print("| |\n");
}
}
// +--------------------------------------------------------------------+
static void DescribeDrivers95(const char* sType)
{
HKEY hkWin, hkSub;
int nKey = 0;
char sKey[256];
char sSub[256];
char sDriver[256];
char txt[256];
DWORD dwSize;
int worked;
// describe the video driver(s):
do {
worked = 0;
sprintf_s(sKey, "System\\CurrentControlSet\\Services\\Class\\%s\\%04X", sType, nKey);
sprintf_s(sSub, "System\\CurrentControlSet\\Services\\Class\\%s\\%04X\\DEFAULT", sType, nKey);
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
sKey,
0,
KEY_READ,
&hkWin) == ERROR_SUCCESS) {
dwSize = 256;
RegQueryValueEx(hkWin,
"DriverDesc",
NULL,
NULL,
(LPBYTE) sDriver,
&dwSize);
if (sDriver[0]) {
sprintf_s(txt, "* %s", sDriver);
Print("| %-66s |\n", txt);
worked = 1;
}
// try to find the driver file name:
if (worked) {
ZeroMemory(sDriver, sizeof(sDriver));
dwSize = 256;
DWORD err = RegQueryValueEx(hkWin, "Driver", NULL, NULL, (LPBYTE) sDriver, &dwSize);
if (err != ERROR_SUCCESS) {
dwSize = 256;
err = RegQueryValueEx(hkWin, "DeviceDriver", NULL, NULL, (LPBYTE) sDriver, &dwSize);
}
if (err != ERROR_SUCCESS) {
dwSize = 256;
err = RegQueryValueEx(hkWin, "drv", NULL, NULL, (LPBYTE) sDriver, &dwSize);
}
if (err != ERROR_SUCCESS) {
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
sSub,
0,
KEY_READ,
&hkSub) == ERROR_SUCCESS) {
dwSize = 256;
err = RegQueryValueEx(hkSub, "drv", NULL, NULL, (LPBYTE) sDriver, &dwSize);
RegCloseKey(hkSub);
}
}
// if we found it, try to display version info:
if (err == ERROR_SUCCESS) {
DescribeDriverVersion(sDriver);
}
Print("| |\n");
}
RegCloseKey(hkWin);
}
nKey++;
}
while (worked);
}
static void DescribeDriversNT(const char* sType)
{
Print("| |\n");
HKEY hkWin;
char sVideo[256] = "";
char sDriver[256] = "";
DWORD dwSize = NULL;
// find the pointer to the video driver:
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"HARDWARE\\DEVICEMAP\\VIDEO",
0,
KEY_READ,
&hkWin) == ERROR_SUCCESS) {
dwSize = 256;
RegQueryValueEx(hkWin,
"\\Device\\Video0",
NULL,
NULL,
(LPBYTE) sVideo,
&dwSize);
RegCloseKey(hkWin);
}
// follow the pointer and get the driver description:
if (dwSize && sVideo[0]) {
const char* sLeader = "\\REGISTRY\\Machine\\";
int nLeader = strlen(sLeader);
if (_strnicmp(sVideo, sLeader, nLeader) == 0) {
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
sVideo + nLeader,
0,
KEY_READ,
&hkWin) == ERROR_SUCCESS) {
dwSize = 256;
RegQueryValueEx(hkWin,
"Device Description",
NULL,
NULL,
(LPBYTE) sDriver,
&dwSize);
RegCloseKey(hkWin);
}
}
}
if (sDriver[0]) {
Print("| %-66s |\n", sDriver);
Print("| |\n");
}
}
// +--------------------------------------------------------------------+
static char sTranslation[16];
static void GetTranslation(const LPBYTE pBlock)
{
LPBYTE sData = NULL;
UINT lenData = 0;
if (VerQueryValue(pBlock, "\\VarFileInfo\\Translation",
(LPVOID*) &sData, &lenData)) {
if (lenData && sData) {
sprintf_s(sTranslation, "%02X%02X%02X%02X", sData[1], sData[0], sData[3], sData[2]);
}
}
}
void DisplayVersionString(const LPBYTE pBlock, LPTSTR sSection)
{
char txt[256];
char sFullSection[256];
sprintf_s(sFullSection, "\\StringFileInfo\\%s\\%s", sTranslation, sSection);
LPBYTE sData = NULL;
UINT lenData = 0;
DWORD dwErr = 0;
if (VerQueryValue(pBlock, sFullSection, (LPVOID*) &sData, &lenData)) {
if (lenData && sData) {
sprintf_s(txt, "%-16s %s", sSection, sData);
Print("| %-60s |\n", txt);
}
}
}
static void DescribeDriverVersion(const char* file)
{
DWORD dwHandle = 0;
TCHAR szFile[512];
strcpy_s(szFile, file);
int nBytes = GetFileVersionInfoSize(szFile, &dwHandle);
if (nBytes <= 0) {
char szWinDir[256];
GetSystemDirectory(szWinDir, 256);
sprintf_s(szFile, "%s\\%s", szWinDir, file);
nBytes = GetFileVersionInfoSize(szFile, &dwHandle);
if (nBytes <= 0)
return;
}
LPBYTE pBlock = new(__FILE__,__LINE__) BYTE[nBytes];
if (pBlock && GetFileVersionInfo(szFile, dwHandle, nBytes, (LPVOID) pBlock)) {
GetTranslation(pBlock);
DisplayVersionString(pBlock, "CompanyName");
// DisplayVersionString(pBlock, "FileDescription");
DisplayVersionString(pBlock, "FileVersion");
// DisplayVersionString(pBlock, "InternalName");
// DisplayVersionString(pBlock, "LegalCopyright");
// DisplayVersionString(pBlock, "OriginalFilename");
// DisplayVersionString(pBlock, "ProductName");
// DisplayVersionString(pBlock, "ProductVersion");
// DisplayVersionString(pBlock, "Comments");
// DisplayVersionString(pBlock, "LegalTrademarks");
// DisplayVersionString(pBlock, "PrivateBuild");
// DisplayVersionString(pBlock, "SpecialBuild");
}
delete [] pBlock;
}
static void DescribeDXVersion(const char* component)
{
DWORD dwHandle = 0;
char szFile[512];
char szWinDir[512];
GetSystemDirectory(szWinDir, 512);
sprintf_s(szFile, "%s\\%s.dll", szWinDir, component);
int nBytes = GetFileVersionInfoSize(szFile, &dwHandle);
if (nBytes <= 0) {
return;
}
LPBYTE pBlock = new(__FILE__,__LINE__) BYTE[nBytes];
if (pBlock && GetFileVersionInfo(szFile, dwHandle, nBytes, (LPVOID) pBlock)) {
GetTranslation(pBlock);
char txt[256];
char sFullSection[256];
LPBYTE sData = NULL;
UINT lenData = 0;
DWORD dwErr = 0;
sprintf_s(sFullSection, "\\StringFileInfo\\%s\\FileVersion", sTranslation);
if (VerQueryValue(pBlock, sFullSection, (LPVOID*) &sData, &lenData)) {
if (lenData && sData) {
sprintf_s(txt, "%-8s%s", component, sData);
Print("| %-64s |\n", txt);
}
}
}
delete [] pBlock;
}
|