forked from hiyohiyo/CrystalDiskInfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DiskInfoDlg.cpp
2531 lines (2268 loc) · 84 KB
/
DiskInfoDlg.cpp
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
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*---------------------------------------------------------------------------*/
// Author : hiyohiyo
// Mail : [email protected]
// Web : https://crystalmark.info/
// License : The MIT License
/*---------------------------------------------------------------------------*/
#include "stdafx.h"
#include "DiskInfo.h"
#include "DiskInfoDlg.h"
#include "AtaSmart.h"
#include "UtilityFx.h"
#include "OsInfoFx.h"
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
#include "locale.h"
#include <complex>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// Global
// Task Tray
UINT gRegMessageId = ::RegisterWindowMessage(_T("CrystalDiskInfo"));
UINT gRegIconId = ::RegisterWindowMessage(_T("CrystalDiskInfoIcon"));
UINT gTempIcon0 = ::RegisterWindowMessage(_T("TempIcon0"));
UINT gTempIcon1 = ::RegisterWindowMessage(_T("TempIcon1"));
UINT gTempIcon2 = ::RegisterWindowMessage(_T("TempIcon2"));
UINT gTempIcon3 = ::RegisterWindowMessage(_T("TempIcon3"));
UINT gTempIcon4 = ::RegisterWindowMessage(_T("TempIcon4"));
UINT gTempIcon5 = ::RegisterWindowMessage(_T("TempIcon5"));
UINT gTempIcon6 = ::RegisterWindowMessage(_T("TempIcon6"));
UINT gTempIcon7 = ::RegisterWindowMessage(_T("TempIcon7"));
UINT gTempIcon8 = ::RegisterWindowMessage(_T("TempIcon8"));
UINT gTempIcon9 = ::RegisterWindowMessage(_T("TempIcon9"));
UINT gTempIcon10 = ::RegisterWindowMessage(_T("TempIcon10"));
UINT gTempIcon11 = ::RegisterWindowMessage(_T("TempIcon11"));
UINT gTempIcon12 = ::RegisterWindowMessage(_T("TempIcon12"));
UINT gTempIcon13 = ::RegisterWindowMessage(_T("TempIcon13"));
UINT gTempIcon14 = ::RegisterWindowMessage(_T("TempIcon14"));
UINT gTempIcon15 = ::RegisterWindowMessage(_T("TempIcon15"));
UINT gTempIcon16 = ::RegisterWindowMessage(_T("TempIcon16"));
UINT gTempIcon17 = ::RegisterWindowMessage(_T("TempIcon17"));
UINT gTempIcon18 = ::RegisterWindowMessage(_T("TempIcon18"));
UINT gTempIcon19 = ::RegisterWindowMessage(_T("TempIcon19"));
UINT gTempIcon20 = ::RegisterWindowMessage(_T("TempIcon20"));
UINT gTempIcon21 = ::RegisterWindowMessage(_T("TempIcon21"));
UINT gTempIcon22 = ::RegisterWindowMessage(_T("TempIcon22"));
UINT gTempIcon23 = ::RegisterWindowMessage(_T("TempIcon23"));
UINT gTempIcon24 = ::RegisterWindowMessage(_T("TempIcon24"));
UINT gTempIcon25 = ::RegisterWindowMessage(_T("TempIcon25"));
UINT gTempIcon26 = ::RegisterWindowMessage(_T("TempIcon26"));
UINT gTempIcon27 = ::RegisterWindowMessage(_T("TempIcon27"));
UINT gTempIcon28 = ::RegisterWindowMessage(_T("TempIcon28"));
UINT gTempIcon29 = ::RegisterWindowMessage(_T("TempIcon29"));
UINT gTempIcon30 = ::RegisterWindowMessage(_T("TempIcon30"));
UINT gTempIcon31 = ::RegisterWindowMessage(_T("TempIcon31"));
UINT gTempIcon32 = ::RegisterWindowMessage(_T("TempIcon32"));
UINT gTempIcon33 = ::RegisterWindowMessage(_T("TempIcon33"));
UINT gTempIcon34 = ::RegisterWindowMessage(_T("TempIcon34"));
UINT gTempIcon35 = ::RegisterWindowMessage(_T("TempIcon35"));
UINT gTempIcon36 = ::RegisterWindowMessage(_T("TempIcon36"));
UINT gTempIcon37 = ::RegisterWindowMessage(_T("TempIcon37"));
UINT gTempIcon38 = ::RegisterWindowMessage(_T("TempIcon38"));
UINT gTempIcon39 = ::RegisterWindowMessage(_T("TempIcon39"));
UINT gTempIcon40 = ::RegisterWindowMessage(_T("TempIcon40"));
UINT gTempIcon41 = ::RegisterWindowMessage(_T("TempIcon41"));
UINT gTempIcon42 = ::RegisterWindowMessage(_T("TempIcon42"));
UINT gTempIcon43 = ::RegisterWindowMessage(_T("TempIcon43"));
UINT gTempIcon44 = ::RegisterWindowMessage(_T("TempIcon44"));
UINT gTempIcon45 = ::RegisterWindowMessage(_T("TempIcon45"));
UINT gTempIcon46 = ::RegisterWindowMessage(_T("TempIcon46"));
UINT gTempIcon47 = ::RegisterWindowMessage(_T("TempIcon47"));
UINT gTempIcon48 = ::RegisterWindowMessage(_T("TempIcon48"));
UINT gTempIcon49 = ::RegisterWindowMessage(_T("TempIcon49"));
UINT gTempIcon50 = ::RegisterWindowMessage(_T("TempIcon50"));
UINT gTempIcon51 = ::RegisterWindowMessage(_T("TempIcon51"));
UINT gTempIcon52 = ::RegisterWindowMessage(_T("TempIcon52"));
UINT gTempIcon53 = ::RegisterWindowMessage(_T("TempIcon53"));
UINT gTempIcon54 = ::RegisterWindowMessage(_T("TempIcon54"));
UINT gTempIcon55 = ::RegisterWindowMessage(_T("TempIcon55"));
UINT gTempIcon56 = ::RegisterWindowMessage(_T("TempIcon56"));
UINT gTempIcon57 = ::RegisterWindowMessage(_T("TempIcon57"));
UINT gTempIcon58 = ::RegisterWindowMessage(_T("TempIcon58"));
UINT gTempIcon59 = ::RegisterWindowMessage(_T("TempIcon59"));
UINT gTempIcon60 = ::RegisterWindowMessage(_T("TempIcon60"));
UINT gTempIcon61 = ::RegisterWindowMessage(_T("TempIcon61"));
UINT gTempIcon62 = ::RegisterWindowMessage(_T("TempIcon62"));
UINT gTempIcon63 = ::RegisterWindowMessage(_T("TempIcon63"));
extern const GUID StrageGUID = { 0x53F56307, 0xB6BF, 0x11D0,
0x94,0xF2,0x00,0xA0,0xC9,0x1E,0xFB,0x8B };
CDiskInfoDlg::CDiskInfoDlg(CWnd* pParent /*=NULL*/, BOOL flagStartupExit)
: CMainDialogFx(CDiskInfoDlg::IDD, pParent)
{
DebugPrint(L"CDiskInfoDlg::CDiskInfoDlg");
m_Ini = ((CDiskInfoApp*)AfxGetApp())->m_Ini;
m_OffsetX = 0;
#ifdef SUISHO_SHIZUKU_SUPPORT
#ifdef KUREI_KEI_SUPPORT
m_DefaultTheme = L"KureiKei";
m_RecommendTheme = L"KureiKeiRecoding";
m_ThemeKeyName = L"ThemeKureiKei";
#else
m_DefaultTheme = L"Shizuku";
m_RecommendTheme = L"ShizukuHotaru";
m_ThemeKeyName = L"ThemeShizuku";
#endif
#else
m_DefaultTheme = L"Default";
m_RecommendTheme = L"Default";
m_ThemeKeyName = L"Theme";
#endif
m_BackgroundName = L"Background";
m_hMenu = NULL;
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_hIconMini = AfxGetApp()->LoadIcon(IDI_MINI_ICON);
m_MainIconId = gRegIconId;
m_SmartDir = ((CDiskInfoApp*)AfxGetApp())->m_SmartDir;
m_GadgetDir = ((CDiskInfoApp*)AfxGetApp())->m_GadgetDir;
m_ExeDir = ((CDiskInfoApp*)AfxGetApp())->m_ExeDir;
m_AlertMailPath = ((CDiskInfoApp*)AfxGetApp())->m_AlertMailPath;
m_OpusDecPath = ((CDiskInfoApp*)AfxGetApp())->m_OpusDecPath;
#ifdef SUISHO_SHIZUKU_SUPPORT
m_VoicePath = ((CDiskInfoApp*) AfxGetApp())->m_VoicePath;
#endif
TCHAR tempPath[MAX_PATH];
GetTempPath(MAX_PATH, tempPath);
m_TempFilePathOpus = tempPath;
m_TempFilePathOpus += _T("CrystalDiskInfo.opus");
m_TempFilePathWave = tempPath;
m_TempFilePathWave += _T("CrystalDiskInfo.wav");
m_bStartupExit = flagStartupExit;
m_AboutDlg = NULL;
m_SettingDlg = NULL;
m_HealthDlg = NULL;
m_OptionDlg = NULL;
// m_AlarmHistoryDlg = NULL;
// Set Default Locale for CStdioFile
_tsetlocale(LC_ALL, _T(""));
for(int i = 0; i < 300; i++)
{
m_hTempIcon[0][i] = NULL;
m_hTempIcon[1][i] = NULL;
}
m_TempIconIndex[0] = gTempIcon0;
m_TempIconIndex[1] = gTempIcon1;
m_TempIconIndex[2] = gTempIcon2;
m_TempIconIndex[3] = gTempIcon3;
m_TempIconIndex[4] = gTempIcon4;
m_TempIconIndex[5] = gTempIcon5;
m_TempIconIndex[6] = gTempIcon6;
m_TempIconIndex[7] = gTempIcon7;
m_TempIconIndex[8] = gTempIcon8;
m_TempIconIndex[9] = gTempIcon9;
m_TempIconIndex[10] = gTempIcon10;
m_TempIconIndex[11] = gTempIcon11;
m_TempIconIndex[12] = gTempIcon12;
m_TempIconIndex[13] = gTempIcon13;
m_TempIconIndex[14] = gTempIcon14;
m_TempIconIndex[15] = gTempIcon15;
m_TempIconIndex[16] = gTempIcon16;
m_TempIconIndex[17] = gTempIcon17;
m_TempIconIndex[18] = gTempIcon18;
m_TempIconIndex[19] = gTempIcon19;
m_TempIconIndex[20] = gTempIcon20;
m_TempIconIndex[21] = gTempIcon21;
m_TempIconIndex[22] = gTempIcon22;
m_TempIconIndex[23] = gTempIcon23;
m_TempIconIndex[24] = gTempIcon24;
m_TempIconIndex[25] = gTempIcon25;
m_TempIconIndex[26] = gTempIcon26;
m_TempIconIndex[27] = gTempIcon27;
m_TempIconIndex[28] = gTempIcon28;
m_TempIconIndex[29] = gTempIcon29;
m_TempIconIndex[30] = gTempIcon30;
m_TempIconIndex[31] = gTempIcon31;
m_TempIconIndex[32] = gTempIcon32;
m_TempIconIndex[33] = gTempIcon33;
m_TempIconIndex[34] = gTempIcon34;
m_TempIconIndex[35] = gTempIcon35;
m_TempIconIndex[36] = gTempIcon36;
m_TempIconIndex[37] = gTempIcon37;
m_TempIconIndex[38] = gTempIcon38;
m_TempIconIndex[39] = gTempIcon39;
m_TempIconIndex[40] = gTempIcon40;
m_TempIconIndex[41] = gTempIcon41;
m_TempIconIndex[42] = gTempIcon42;
m_TempIconIndex[43] = gTempIcon43;
m_TempIconIndex[44] = gTempIcon44;
m_TempIconIndex[45] = gTempIcon45;
m_TempIconIndex[46] = gTempIcon46;
m_TempIconIndex[47] = gTempIcon47;
m_TempIconIndex[48] = gTempIcon48;
m_TempIconIndex[49] = gTempIcon49;
m_TempIconIndex[50] = gTempIcon50;
m_TempIconIndex[51] = gTempIcon51;
m_TempIconIndex[52] = gTempIcon52;
m_TempIconIndex[53] = gTempIcon53;
m_TempIconIndex[54] = gTempIcon54;
m_TempIconIndex[55] = gTempIcon55;
m_TempIconIndex[56] = gTempIcon56;
m_TempIconIndex[57] = gTempIcon57;
m_TempIconIndex[58] = gTempIcon58;
m_TempIconIndex[59] = gTempIcon59;
m_TempIconIndex[60] = gTempIcon60;
m_TempIconIndex[61] = gTempIcon61;
m_TempIconIndex[62] = gTempIcon62;
m_TempIconIndex[63] = gTempIcon63;
m_bTrayMainIcon = FALSE;
for(int i = 0; i < CAtaSmart::MAX_DISK; i++)
{
m_PreTemp[i] = 0;
m_bTrayTemperatureIcon[i] = FALSE;
}
m_SelectDisk = 0;
m_DriveMenuPage = 0;
m_AutoRefreshStatus = 0;
m_WaitTimeStatus = 0;
m_AutoDetectionStatus = 0;
m_RawValues = 0;
m_NowDetectingUnitPowerOnHours = FALSE;
m_bInitializing = TRUE;
DebugPrint(L"CDiskInfoDlg::CDiskInfoDlg");
m_ImageList.Create(16, 16, ILC_COLOR32|ILC_MASK, 3, 1);
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_GOOD));
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_GOOD_GREEN));
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_CAUTION));
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_BAD));
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_UNKNOWN));
m_bAdvancedDiskSearch = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("AdvancedDiskSearch"), 0, m_Ini);
m_bWorkaroundHD204UI = (BOOL)GetPrivateProfileInt(_T("Workaround"), _T("HD204UI"), 0, m_Ini);
m_bWorkaroundIE8MODE = (BOOL)GetPrivateProfileInt(_T("Workaround"), _T("IE8MODE"), 0, m_Ini);
m_bWorkaroundAdataSsd = (BOOL)GetPrivateProfileInt(_T("Workaround"), _T("AdataSsd"), 1, m_Ini);
m_bWorkaroundIgnoreC4 = (BOOL) GetPrivateProfileInt(_T("Workaround"), _T("IgnoreC4"), 1, m_Ini);
m_bEventLog = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("EventLog"), 0, m_Ini);
m_bAlertMail = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("AlertMail"), 0, m_Ini);
m_bAtaPassThroughSmart = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("AtaPassThroughSmart"), 1, m_Ini);
m_bAutoAamApm = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("AutoAamApm"), 0, m_Ini);
m_bDumpIdentifyDevice = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("DumpIdentifyDevice"), 1, m_Ini); // Default = Enabled
m_bDumpSmartReadData = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("DumpSmartReadData"), 1, m_Ini);
m_bDumpSmartReadThreshold = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("DumpSmartReadThreshold"), 1, m_Ini);
m_bResidentMinimize = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("ResidentMinimize"), 0, m_Ini);
m_bShowTemperatureIconOnly = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("ShowTemperatureIconOnly"), 0, m_Ini);
m_bAsciiView = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("AsciiView"), 0, m_Ini);
m_bSmartEnglish = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("SmartEnglish"), 0, m_Ini);
m_bAlertSound = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("AlertSound"), 1, m_Ini);
m_bHideNoSmartDisk = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("HideNoSmartDisk"), 0, m_Ini);
m_bGreenMode = (BOOL) GetPrivateProfileInt(_T("Setting"), _T("GreenMode"), 0, m_Ini);
if((BOOL)GetPrivateProfileInt(_T("Workaround"), _T("ExecFailed"), 0, m_Ini))
{
m_bAtaPassThroughSmart = FALSE;
WritePrivateProfileString(_T("Setting"), _T("AtaPassThroughSmart"), _T("0"), m_Ini);
}
// Added 2013/04/12 - Workaround for Exec Failed
WritePrivateProfileString(_T("Workaround"), _T("ExecFailed"), _T("1"), m_Ini);
TCHAR str[256];
GetPrivateProfileString(_T("Setting"), _T("AlertSoundPath"), _T(""), str, 256, m_Ini);
m_AlertSoundPath = str;
m_bGadget = (BOOL)GetPrivateProfileInt(_T("Setting"), _T("Gadget"), 0, m_Ini);
m_AutoDetectionStatus = GetPrivateProfileInt(_T("Setting"), _T("AutoDetection"), 0, m_Ini);
if(m_AutoDetectionStatus < 0)
{
m_AutoDetectionStatus = 0;
}
m_RawValues = GetPrivateProfileInt(_T("Setting"), _T("RawValues"), 0, m_Ini);
if(m_RawValues < 0 || m_RawValues > 3)
{
m_RawValues = 0;
}
m_ZoomType = GetPrivateProfileInt(_T("Setting"), _T("ZoomType"), ZoomTypeAuto, m_Ini);
// Setting
SAVE_SMART_PERIOD = GetPrivateProfileInt(_T("Setting"), _T("SAVE_SMART_PERIOD"), 150, m_Ini);
ALARM_TEMPERATURE_PERIOD = GetPrivateProfileInt(_T("Setting"), _T("ALARM_TEMPERATURE_PERIOD"), 60 * 60, m_Ini);
if(m_bEventLog)
{
InstallEventSource();
}
else
{
UninstallEventSource();
}
if(m_bAtaPassThroughSmart)
{
m_Ata.SetAtaPassThroughSmart(TRUE);
}
else
{
m_Ata.SetAtaPassThroughSmart(FALSE);
}
m_Ata.CsmiType = GetPrivateProfileInt(_T("Setting"), _T("CsmiType"), m_Ata.CSMI_TYPE_ENABLE_AUTO, m_Ini);
// m_BrushDlg.CreateHatchBrush(HS_BDIAGONAL, RGB(0xF0, 0xF0, 0xF0));
// m_BrushDlg.CreatePatternBrush(&m_BitmapBk);
#ifdef SUISHO_SHIZUKU_SUPPORT
#ifdef KUREI_KEI_SUPPORT
m_BackgroundName = L"KureiKeiBackground";
#else
m_BackgroundName = L"ShizukuBackground";
#endif
#else
m_BackgroundName = L"Background";
#endif
#ifdef SUISHO_SHIZUKU_SUPPORT
OSVERSIONINFOEX osvi;
BOOL bosVersionInfoEx;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (!(bosVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi)))
{
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx((OSVERSIONINFO *)&osvi);
}
m_hVoice = LoadLibrary(m_VoicePath);
if (m_hVoice != NULL)
{
DebugPrint(L"m_hVoice != NULL");
}
else
{
DebugPrint(L"m_hVoice == NULL");
}
#endif
}
CDiskInfoDlg::~CDiskInfoDlg()
{
if(m_hMenu != NULL)
{
DestroyMenu(m_hMenu);
}
AlertSound(-1, AS_DEINIT);
DeleteShareInfo();
DeleteFile(m_TempFilePathOpus);
DeleteFile(m_TempFilePathWave);
#ifdef SUISHO_SHIZUKU_SUPPORT
if (m_hVoice)
{
FreeLibrary(m_hVoice);
}
#endif
}
void CDiskInfoDlg::OnCancel()
{
if(m_bResidentMinimize)
{
ShowWindow(SW_MINIMIZE);
}
else
{
ShowWindow(SW_HIDE);
}
if(! m_bResident)
{
KillGraphDlg();
if(m_hDevNotify)
{
UnregisterDeviceNotification(m_hDevNotify);
}
CMainDialogFx::OnCancel();
}
}
void CDiskInfoDlg::OnSaveText()
{
CString path;
SYSTEMTIME st;
GetLocalTime(&st);
path.Format(L"%s_%04d%02d%02d%0d%02d%02d", PRODUCT_NAME, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
CString filter = L"TEXT (*.txt)|*.txt||";
CFileDialog save(FALSE, L"txt", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER, filter);
if (save.DoModal() == IDOK)
{
SaveText(save.GetPathName());
}
}
void CDiskInfoDlg::OnSaveImage()
{
SaveImage();
}
void CDiskInfoDlg::OnExit()
{
ShowWindow(SW_HIDE);
RemoveTrayMainIcon();
for(int i = 0; i < m_Ata.vars.GetCount(); i++)
{
RemoveTemperatureIcon(i);
}
KillGraphDlg();
CMainDialogFx::OnCancel();
}
void CDiskInfoDlg::OnOK()
{
}
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
void CDiskInfoDlg::KillGraphDlg()
{
static HWND hWnd;
EnumWindows(EnumWindowsProc, (LPARAM)&m_GraphProcessId);
}
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
CArray<DWORD, DWORD> *id = (CArray<DWORD, DWORD>*)lParam;
TCHAR str[1024];
GetWindowText(hWnd, str, 1024);
if(str[0] == 0)
{
return TRUE;
}
CString cstr;
cstr = str;
if(cstr.Find(_T("CrystalDiskInfo - ")) == 0 && cstr.Find(_T(" - Powered by Flot")) > 0)
{
for(int i = 0; i < id->GetCount(); i++)
{
DWORD processId = 0;
::GetWindowThreadProcessId(hWnd, &processId);
if(processId == id->GetAt(i))
{
PostMessage(hWnd, WM_QUIT, NULL, NULL);
}
}
}
return TRUE;
}
void CDiskInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CMainDialogFx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST, m_List);
DDX_Control(pDX, IDC_BUTTON_DISK0, m_ButtonDisk[0]);
DDX_Control(pDX, IDC_BUTTON_DISK1, m_ButtonDisk[1]);
DDX_Control(pDX, IDC_BUTTON_DISK2, m_ButtonDisk[2]);
DDX_Control(pDX, IDC_BUTTON_DISK3, m_ButtonDisk[3]);
DDX_Control(pDX, IDC_BUTTON_DISK4, m_ButtonDisk[4]);
DDX_Control(pDX, IDC_BUTTON_DISK5, m_ButtonDisk[5]);
DDX_Control(pDX, IDC_BUTTON_DISK6, m_ButtonDisk[6]);
DDX_Control(pDX, IDC_BUTTON_DISK7, m_ButtonDisk[7]);
DDX_Control(pDX, IDC_BUTTON_PRE_DISK, m_CtrlButtonPreDisk);
DDX_Control(pDX, IDC_BUTTON_NEXT_DISK, m_CtrlButtonNextDisk);
DDX_Control(pDX, IDC_LABEL_FIRMWARE, m_CtrlLabelFirmware);
DDX_Control(pDX, IDC_LABEL_SERIAL_NUMBER, m_CtrlLabelSerialNumber);
DDX_Control(pDX, IDC_LABEL_INTERFACE, m_CtrlLabelInterface);
DDX_Control(pDX, IDC_LABEL_TRANSFER_MODE, m_CtrlLabelTransferMode);
DDX_Control(pDX, IDC_LABEL_DRIVE_MAP, m_CtrlLabelDriveMap);
DDX_Control(pDX, IDC_LABEL_BUFFER_SIZE, m_CtrlLabelBufferSize);
DDX_Control(pDX, IDC_LABEL_NV_CACHE_SIZE, m_CtrlLabelNvCacheSize);
DDX_Control(pDX, IDC_LABEL_ROTATION_RATE, m_CtrlLabelRotationRate);
DDX_Control(pDX, IDC_LABEL_POWER_ON_COUNT, m_CtrlLabelPowerOnCount);
DDX_Control(pDX, IDC_LABEL_POWER_ON_HOURS, m_CtrlLabelPowerOnHours);
DDX_Control(pDX, IDC_LABEL_ATA_ATAPI, m_CtrlLabelAtaAtapi);
DDX_Control(pDX, IDC_LABEL_FEATURE, m_CtrlLabelFeature);
DDX_Control(pDX, IDC_LABEL_HEALTH_STATUS, m_CtrlLabelDiskStatus);
DDX_Control(pDX, IDC_LABEL_TEMPERATURE, m_CtrlLabelTemperature);
DDX_Control(pDX, IDC_VALUE_MODEL, m_CtrlModel);
DDX_Control(pDX, IDC_VALUE_FIRMWARE, m_CtrlFirmware);
DDX_Control(pDX, IDC_VALUE_SERIAL_NUMBER, m_CtrlSerialNumber);
DDX_Control(pDX, IDC_VALUE_INTERFACE, m_CtrlInterface);
DDX_Control(pDX, IDC_VALUE_TRANSFER_MODE, m_CtrlTransferMode);
DDX_Control(pDX, IDC_VALUE_DRIVE_MAP, m_CtrlDriveMap);
DDX_Control(pDX, IDC_VALUE_BUFFER_SIZE, m_CtrlBufferSize);
DDX_Control(pDX, IDC_VALUE_NV_CACHE_SIZE, m_CtrlNvCacheSize);
DDX_Control(pDX, IDC_VALUE_ROTATION_RATE, m_CtrlRotationRate);
DDX_Control(pDX, IDC_VALUE_POWER_ON_COUNT, m_CtrlPowerOnCount);
DDX_Control(pDX, IDC_VALUE_POWER_ON_HOURS, m_CtrlPowerOnHours);
DDX_Control(pDX, IDC_VALUE_ATA_ATAPI, m_CtrlAtaAtapi);
DDX_Control(pDX, IDC_VALUE_FEATURE, m_CtrlFeature);
DDX_Control(pDX, IDC_BUTTON_HEALTH_STATUS, m_CtrlDiskStatus);
DDX_Control(pDX, IDC_BUTTON_TEMPERATURE, m_CtrlTemperature);
DDX_Control(pDX, IDC_BUTTON_LIFE, m_CtrlLife);
DDX_Text(pDX, IDC_BUTTON_DISK0, m_LiDisk[0]);
DDX_Text(pDX, IDC_BUTTON_DISK1, m_LiDisk[1]);
DDX_Text(pDX, IDC_BUTTON_DISK2, m_LiDisk[2]);
DDX_Text(pDX, IDC_BUTTON_DISK3, m_LiDisk[3]);
DDX_Text(pDX, IDC_BUTTON_DISK4, m_LiDisk[4]);
DDX_Text(pDX, IDC_BUTTON_DISK5, m_LiDisk[5]);
DDX_Text(pDX, IDC_BUTTON_DISK6, m_LiDisk[6]);
DDX_Text(pDX, IDC_BUTTON_DISK7, m_LiDisk[7]);
DDX_Text(pDX, IDC_LABEL_FIRMWARE, m_LabelFirmware);
DDX_Text(pDX, IDC_LABEL_SERIAL_NUMBER, m_LabelSerialNumber);
DDX_Text(pDX, IDC_LABEL_INTERFACE, m_LabelInterface);
DDX_Text(pDX, IDC_LABEL_TRANSFER_MODE, m_LabelTransferMode);
DDX_Text(pDX, IDC_LABEL_DRIVE_MAP, m_LabelDriveMap);
DDX_Text(pDX, IDC_LABEL_BUFFER_SIZE, m_LabelBufferSize);
DDX_Text(pDX, IDC_LABEL_NV_CACHE_SIZE, m_LabelNvCacheSize);
DDX_Text(pDX, IDC_LABEL_ROTATION_RATE, m_LabelRotationRate);
DDX_Text(pDX, IDC_LABEL_POWER_ON_COUNT, m_LabelPowerOnCount);
DDX_Text(pDX, IDC_LABEL_POWER_ON_HOURS, m_LabelPowerOnHours);
DDX_Text(pDX, IDC_LABEL_ATA_ATAPI, m_LabelAtaAtapi);
DDX_Text(pDX, IDC_LABEL_FEATURE, m_LabelFeature);
DDX_Text(pDX, IDC_LABEL_HEALTH_STATUS, m_LabelDiskStatus);
DDX_Text(pDX, IDC_LABEL_TEMPERATURE, m_LabelTemperature);
DDX_Text(pDX, IDC_VALUE_MODEL, m_ModelCapacity);
DDX_Text(pDX, IDC_VALUE_FIRMWARE, m_Firmware);
DDX_Text(pDX, IDC_VALUE_SERIAL_NUMBER, m_SerialNumber);
DDX_Text(pDX, IDC_VALUE_INTERFACE, m_Interface);
DDX_Text(pDX, IDC_VALUE_TRANSFER_MODE, m_TransferMode);
DDX_Text(pDX, IDC_VALUE_DRIVE_MAP, m_DriveMap);
DDX_Text(pDX, IDC_VALUE_BUFFER_SIZE, m_BufferSize);
DDX_Text(pDX, IDC_VALUE_NV_CACHE_SIZE, m_NvCacheSize);
DDX_Text(pDX, IDC_VALUE_ROTATION_RATE, m_RotationRate);
DDX_Text(pDX, IDC_VALUE_POWER_ON_COUNT, m_PowerOnCount);
DDX_Text(pDX, IDC_VALUE_POWER_ON_HOURS, m_PowerOnHours);
DDX_Text(pDX, IDC_VALUE_ATA_ATAPI, m_AtaAtapi);
DDX_Text(pDX, IDC_VALUE_FEATURE, m_Feature);
DDX_Text(pDX, IDC_BUTTON_HEALTH_STATUS, m_DiskStatus);
DDX_Text(pDX, IDC_BUTTON_TEMPERATURE, m_Temperature);
DDX_Text(pDX, IDC_BUTTON_LIFE, m_Life);
DDX_Control(pDX, IDC_BUTTON_VOICE, m_CtrlVoice);
DDX_Control(pDX, IDC_BUTTON_COPYRIGHT, m_CtrlCopyright);
}
BEGIN_MESSAGE_MAP(CDiskInfoDlg, CMainDialogFx)
//}}AFX_MSG_MAP
ON_WM_PAINT()
ON_WM_GETMINMAXINFO()
ON_WM_SIZE()
ON_WM_TIMER()
ON_COMMAND(ID_SAVE_TEXT, &CDiskInfoDlg::OnSaveText)
ON_COMMAND(ID_SAVE_IMAGE, &CDiskInfoDlg::OnSaveImage)
ON_COMMAND(ID_EXIT, &CDiskInfoDlg::OnExit)
ON_COMMAND(ID_ABOUT, &CDiskInfoDlg::OnAbout)
ON_COMMAND(ID_HIDE_SMART_INFO, &CDiskInfoDlg::OnHideSmartInfo)
ON_COMMAND(ID_HIDE_SERIAL_NUMBER, &CDiskInfoDlg::OnHideSerialNumber)
ON_COMMAND(ID_COPY, &CDiskInfoDlg::OnCopy)
ON_COMMAND(ID_CRYSTALDEWWORLD, &CDiskInfoDlg::OnCrystalDewWorld)
ON_COMMAND(ID_REFRESH, &CDiskInfoDlg::OnRefresh)
ON_COMMAND(ID_HELP_ABOUT_SMART, &CDiskInfoDlg::OnHelpAboutSmart)
ON_COMMAND(ID_AUTO_REFRESH_DISABLE, &CDiskInfoDlg::OnAutoRefreshDisable)
ON_COMMAND(ID_AUTO_REFRESH_01_MIN, &CDiskInfoDlg::OnAutoRefresh01Min)
ON_COMMAND(ID_AUTO_REFRESH_03_MIN, &CDiskInfoDlg::OnAutoRefresh03Min)
ON_COMMAND(ID_AUTO_REFRESH_05_MIN, &CDiskInfoDlg::OnAutoRefresh05Min)
ON_COMMAND(ID_AUTO_REFRESH_10_MIN, &CDiskInfoDlg::OnAutoRefresh10Min)
ON_COMMAND(ID_AUTO_REFRESH_30_MIN, &CDiskInfoDlg::OnAutoRefresh30Min)
ON_COMMAND(ID_AUTO_REFRESH_60_MIN, &CDiskInfoDlg::OnAutoRefresh60Min)
ON_COMMAND(ID_AUTO_REFRESH_120_MIN, &CDiskInfoDlg::OnAutoRefresh120Min)
ON_COMMAND(ID_AUTO_REFRESH_180_MIN, &CDiskInfoDlg::OnAutoRefresh180Min)
ON_COMMAND(ID_AUTO_REFRESH_360_MIN, &CDiskInfoDlg::OnAutoRefresh360Min)
ON_COMMAND(ID_AUTO_REFRESH_720_MIN, &CDiskInfoDlg::OnAutoRefresh720Min)
ON_COMMAND(ID_AUTO_REFRESH_1440_MIN, &CDiskInfoDlg::OnAutoRefresh1440Min)
ON_COMMAND(ID_OPEN_DISK_MANAGEMENT, &CDiskInfoDlg::OnOpenDiskManagement)
ON_COMMAND(ID_OPEN_DEVICE_MANAGER, &CDiskInfoDlg::OnOpenDeviceManager)
ON_COMMAND(ID_ADVANCED_DISK_SEARCH, &CDiskInfoDlg::OnAdvancedDiskSearch)
ON_COMMAND(ID_WORKAROUND_HD204UI, &CDiskInfoDlg::OnWorkaroundHD204UI)
ON_COMMAND(ID_WORKAROUND_IE8MODE, &CDiskInfoDlg::OnWorkaroundIE8MODE)
ON_COMMAND(ID_GREEN_MODE, &CDiskInfoDlg::OnGreenMode)
ON_COMMAND(ID_WORKAROUND_ADATA_SSD, &CDiskInfoDlg::OnWorkaroundAdataSsd)
ON_COMMAND(ID_WORKAROUND_IGNORE_C4, &CDiskInfoDlg::OnWorkaroundIgnoreC4)
ON_COMMAND(ID_RESIDENT, &CDiskInfoDlg::OnResident)
ON_MESSAGE(WM_POWERBROADCAST, &CDiskInfoDlg::OnPowerBroadcast)
ON_MESSAGE(WM_DEVICECHANGE, &CDiskInfoDlg::OnDeviceChange)
ON_MESSAGE(WM_QUERYENDSESSION, &CDiskInfoDlg::OnQueryEndSession)
// Task Tray
ON_REGISTERED_MESSAGE(gRegMessageId, OnRegMessage)
ON_REGISTERED_MESSAGE(wmTaskbarCreated, OnTaskbarCreated)
ON_REGISTERED_MESSAGE(gTempIcon0, OnTempIcon0)
ON_REGISTERED_MESSAGE(gTempIcon1, OnTempIcon1)
ON_REGISTERED_MESSAGE(gTempIcon2, OnTempIcon2)
ON_REGISTERED_MESSAGE(gTempIcon3, OnTempIcon3)
ON_REGISTERED_MESSAGE(gTempIcon4, OnTempIcon4)
ON_REGISTERED_MESSAGE(gTempIcon5, OnTempIcon5)
ON_REGISTERED_MESSAGE(gTempIcon6, OnTempIcon6)
ON_REGISTERED_MESSAGE(gTempIcon7, OnTempIcon7)
ON_REGISTERED_MESSAGE(gTempIcon8, OnTempIcon8)
ON_REGISTERED_MESSAGE(gTempIcon9, OnTempIcon9)
ON_REGISTERED_MESSAGE(gTempIcon10, OnTempIcon10)
ON_REGISTERED_MESSAGE(gTempIcon11, OnTempIcon11)
ON_REGISTERED_MESSAGE(gTempIcon12, OnTempIcon12)
ON_REGISTERED_MESSAGE(gTempIcon13, OnTempIcon13)
ON_REGISTERED_MESSAGE(gTempIcon14, OnTempIcon14)
ON_REGISTERED_MESSAGE(gTempIcon15, OnTempIcon15)
ON_REGISTERED_MESSAGE(gTempIcon16, OnTempIcon16)
ON_REGISTERED_MESSAGE(gTempIcon17, OnTempIcon17)
ON_REGISTERED_MESSAGE(gTempIcon18, OnTempIcon18)
ON_REGISTERED_MESSAGE(gTempIcon19, OnTempIcon19)
ON_REGISTERED_MESSAGE(gTempIcon20, OnTempIcon20)
ON_REGISTERED_MESSAGE(gTempIcon21, OnTempIcon21)
ON_REGISTERED_MESSAGE(gTempIcon22, OnTempIcon22)
ON_REGISTERED_MESSAGE(gTempIcon23, OnTempIcon23)
ON_REGISTERED_MESSAGE(gTempIcon24, OnTempIcon24)
ON_REGISTERED_MESSAGE(gTempIcon25, OnTempIcon25)
ON_REGISTERED_MESSAGE(gTempIcon26, OnTempIcon26)
ON_REGISTERED_MESSAGE(gTempIcon27, OnTempIcon27)
ON_REGISTERED_MESSAGE(gTempIcon28, OnTempIcon28)
ON_REGISTERED_MESSAGE(gTempIcon29, OnTempIcon29)
ON_REGISTERED_MESSAGE(gTempIcon30, OnTempIcon30)
ON_REGISTERED_MESSAGE(gTempIcon31, OnTempIcon31)
ON_REGISTERED_MESSAGE(gTempIcon32, OnTempIcon32)
ON_REGISTERED_MESSAGE(gTempIcon33, OnTempIcon33)
ON_REGISTERED_MESSAGE(gTempIcon34, OnTempIcon34)
ON_REGISTERED_MESSAGE(gTempIcon35, OnTempIcon35)
ON_REGISTERED_MESSAGE(gTempIcon36, OnTempIcon36)
ON_REGISTERED_MESSAGE(gTempIcon37, OnTempIcon37)
ON_REGISTERED_MESSAGE(gTempIcon38, OnTempIcon38)
ON_REGISTERED_MESSAGE(gTempIcon39, OnTempIcon39)
ON_REGISTERED_MESSAGE(gTempIcon40, OnTempIcon40)
ON_REGISTERED_MESSAGE(gTempIcon41, OnTempIcon41)
ON_REGISTERED_MESSAGE(gTempIcon42, OnTempIcon42)
ON_REGISTERED_MESSAGE(gTempIcon43, OnTempIcon43)
ON_REGISTERED_MESSAGE(gTempIcon44, OnTempIcon44)
ON_REGISTERED_MESSAGE(gTempIcon45, OnTempIcon45)
ON_REGISTERED_MESSAGE(gTempIcon46, OnTempIcon46)
ON_REGISTERED_MESSAGE(gTempIcon47, OnTempIcon47)
ON_REGISTERED_MESSAGE(gTempIcon48, OnTempIcon48)
ON_REGISTERED_MESSAGE(gTempIcon49, OnTempIcon49)
ON_REGISTERED_MESSAGE(gTempIcon50, OnTempIcon50)
ON_REGISTERED_MESSAGE(gTempIcon51, OnTempIcon51)
ON_REGISTERED_MESSAGE(gTempIcon52, OnTempIcon52)
ON_REGISTERED_MESSAGE(gTempIcon53, OnTempIcon53)
ON_REGISTERED_MESSAGE(gTempIcon54, OnTempIcon54)
ON_REGISTERED_MESSAGE(gTempIcon55, OnTempIcon55)
ON_REGISTERED_MESSAGE(gTempIcon56, OnTempIcon56)
ON_REGISTERED_MESSAGE(gTempIcon57, OnTempIcon57)
ON_REGISTERED_MESSAGE(gTempIcon58, OnTempIcon58)
ON_REGISTERED_MESSAGE(gTempIcon59, OnTempIcon59)
ON_REGISTERED_MESSAGE(gTempIcon60, OnTempIcon60)
ON_REGISTERED_MESSAGE(gTempIcon61, OnTempIcon61)
ON_REGISTERED_MESSAGE(gTempIcon62, OnTempIcon62)
ON_REGISTERED_MESSAGE(gTempIcon63, OnTempIcon63)
ON_COMMAND(ID_GRAPH, &CDiskInfoDlg::OnGraph)
ON_COMMAND(ID_HELP, &CDiskInfoDlg::OnHelp)
ON_COMMAND(ID_CUSTOMIZE, &CDiskInfoDlg::OnCustomize)
ON_COMMAND(ID_STARTUP, &CDiskInfoDlg::OnStartup)
ON_COMMAND(ID_WAIT_0_SEC, &CDiskInfoDlg::OnWait0Sec)
ON_COMMAND(ID_WAIT_5_SEC, &CDiskInfoDlg::OnWait5Sec)
ON_COMMAND(ID_WAIT_10_SEC, &CDiskInfoDlg::OnWait10Sec)
ON_COMMAND(ID_WAIT_15_SEC, &CDiskInfoDlg::OnWait15Sec)
ON_COMMAND(ID_WAIT_20_SEC, &CDiskInfoDlg::OnWait20Sec)
ON_COMMAND(ID_WAIT_30_SEC, &CDiskInfoDlg::OnWait30Sec)
ON_COMMAND(ID_WAIT_40_SEC, &CDiskInfoDlg::OnWait40Sec)
ON_COMMAND(ID_WAIT_50_SEC, &CDiskInfoDlg::OnWait50Sec)
ON_COMMAND(ID_WAIT_60_SEC, &CDiskInfoDlg::OnWait60Sec)
ON_COMMAND(ID_WAIT_90_SEC, &CDiskInfoDlg::OnWait90Sec)
ON_COMMAND(ID_WAIT_120_SEC, &CDiskInfoDlg::OnWait120Sec)
ON_COMMAND(ID_WAIT_150_SEC, &CDiskInfoDlg::OnWait150Sec)
ON_COMMAND(ID_WAIT_180_SEC, &CDiskInfoDlg::OnWait180Sec)
ON_COMMAND(ID_WAIT_210_SEC, &CDiskInfoDlg::OnWait210Sec)
ON_COMMAND(ID_WAIT_240_SEC, &CDiskInfoDlg::OnWait240Sec)
ON_COMMAND(ID_AUTO_DETECTION_05_SEC, &CDiskInfoDlg::OnAutoDetection05Sec)
ON_COMMAND(ID_AUTO_DETECTION_10_SEC, &CDiskInfoDlg::OnAutoDetection10Sec)
ON_COMMAND(ID_AUTO_DETECTION_20_SEC, &CDiskInfoDlg::OnAutoDetection20Sec)
ON_COMMAND(ID_AUTO_DETECTION_30_SEC, &CDiskInfoDlg::OnAutoDetection30Sec)
ON_COMMAND(ID_AUTO_DETECTION_DISABLE, &CDiskInfoDlg::OnAutoDetectionDisable)
ON_COMMAND(ID_EVENT_LOG, &CDiskInfoDlg::OnEventLog)
ON_COMMAND(ID_ATA_PASS_THROUGH_SMART, &CDiskInfoDlg::OnAtaPassThroughSmart)
ON_COMMAND(ID_GADGET_SUPPORT, &CDiskInfoDlg::OnGadgetSupport)
ON_COMMAND(ID_CELSIUS, &CDiskInfoDlg::OnCelsius)
ON_COMMAND(ID_FAHRENHEIT, &CDiskInfoDlg::OnFahrenheit)
ON_COMMAND(ID_AAM_APM, &CDiskInfoDlg::OnAamApm)
ON_COMMAND(ID_TEMPERATURE, &CDiskInfoDlg::OnTemperature)
ON_COMMAND(ID_AUTO_AAM_APM, &CDiskInfoDlg::OnAutoAamApm)
ON_COMMAND(ID_RESCAN, &CDiskInfoDlg::OnRescan)
ON_COMMAND(ID_USB_SAT, &CDiskInfoDlg::OnUsbSat)
ON_COMMAND(ID_USB_IODATA, &CDiskInfoDlg::OnUsbIodata)
ON_COMMAND(ID_USB_SUNPLUS, &CDiskInfoDlg::OnUsbSunplus)
ON_COMMAND(ID_USB_LOGITEC1, &CDiskInfoDlg::OnUsbLogitec1)
ON_COMMAND(ID_USB_LOGITEC2, &CDiskInfoDlg::OnUsbLogitec2)
ON_COMMAND(ID_USB_JMICRON, &CDiskInfoDlg::OnUsbJmicron)
ON_COMMAND(ID_USB_CYPRESS, &CDiskInfoDlg::OnUsbCypress)
ON_COMMAND(ID_USB_MEMORY, &CDiskInfoDlg::OnUsbMemory)
ON_COMMAND(ID_USB_NVME_JMICRON, &CDiskInfoDlg::OnUsbNVMeJMicron)
ON_COMMAND(ID_USB_NVME_ASMEDIA, &CDiskInfoDlg::OnUsbNVMeASMedia)
ON_COMMAND(ID_USB_NVME_REALTEK, &CDiskInfoDlg::OnUsbNVMeRealtek)
ON_COMMAND(ID_MEGA_RAID, &CDiskInfoDlg::OnMegaRAID)
ON_COMMAND(ID_USB_ENABLE_ALL, &CDiskInfoDlg::OnUsbEnableAll)
ON_COMMAND(ID_USB_DISABLE_ALL, &CDiskInfoDlg::OnUsbDisableAll)
ON_COMMAND(ID_HEALTH_STATUS, &CDiskInfoDlg::OnHealthStatus)
ON_COMMAND(ID_SOUND_SETTINGS, &CDiskInfoDlg::OnSoundSetting)
ON_COMMAND(ID_DUMP_IDENTIFY_DEVICE, &CDiskInfoDlg::OnDumpIdentifyDevice)
ON_COMMAND(ID_DUMP_SMART_READ_DATA, &CDiskInfoDlg::OnDumpSmartReadData)
ON_COMMAND(ID_DUMP_SMART_READ_THRESHOLD, &CDiskInfoDlg::OnDumpSmartReadThreshold)
ON_COMMAND(ID_RESIDENT_HIDE, &CDiskInfoDlg::OnResidentHide)
ON_COMMAND(ID_RESIDENT_MINIMIZE, &CDiskInfoDlg::OnResidentMinimize)
ON_COMMAND(ID_ZOOM_100, &CDiskInfoDlg::OnZoom100)
ON_COMMAND(ID_ZOOM_125, &CDiskInfoDlg::OnZoom125)
ON_COMMAND(ID_ZOOM_150, &CDiskInfoDlg::OnZoom150)
ON_COMMAND(ID_ZOOM_200, &CDiskInfoDlg::OnZoom200)
ON_COMMAND(ID_ZOOM_250, &CDiskInfoDlg::OnZoom250)
ON_COMMAND(ID_ZOOM_300, &CDiskInfoDlg::OnZoom300)
ON_COMMAND(ID_ZOOM_AUTO, &CDiskInfoDlg::OnZoomAuto)
ON_COMMAND(ID_RAW_VALUES_16, &CDiskInfoDlg::OnRawValues16)
ON_COMMAND(ID_RAW_VALUES_10_ALL, &CDiskInfoDlg::OnRawValues10All)
ON_COMMAND(ID_RAW_VALUES_2BYTE, &CDiskInfoDlg::OnRawValues2byte)
ON_COMMAND(ID_RAW_VALUES_1BYTE, &CDiskInfoDlg::OnRawValues1byte)
ON_COMMAND(ID_ASCII_VIEW, &CDiskInfoDlg::OnAsciiView)
ON_COMMAND(ID_ALERT_MAIL, &CDiskInfoDlg::OnAlertMail)
ON_COMMAND(ID_MAIL_SETTINGS, &CDiskInfoDlg::OnMailSettings)
ON_COMMAND(ID_SMART_ENGLISH, &CDiskInfoDlg::OnSmartEnglish)
ON_COMMAND(ID_FONT_SETTING, &CDiskInfoDlg::OnFontSetting)
ON_COMMAND(ID_CSMI_DISABLE, &CDiskInfoDlg::OnCsmiDisable)
ON_COMMAND(ID_CSMI_ENABLE_AUTO, &CDiskInfoDlg::OnCsmiEnableAuto)
ON_COMMAND(ID_CSMI_ENABLE_RAID, &CDiskInfoDlg::OnCsmiEnableRaid)
ON_COMMAND(ID_CSMI_ENABLE_ALL, &CDiskInfoDlg::OnCsmiEnableAll)
ON_COMMAND(ID_INSTALL_GADGET, &CDiskInfoDlg::OnInstallGadget)
// ON_COMMAND(ID_ALARM_HISTORY, &CDiskInfoDlg::OnAlarmHistory)
ON_COMMAND(ID_ALERT_SOUND, &CDiskInfoDlg::OnAlertSound)
ON_COMMAND(ID_HIDE_NO_SMART_DISK, &CDiskInfoDlg::OnHideNoSmartDisk)
ON_MESSAGE(MY_PLAY_ALERT_SOUND, OnPlayAlertSound)
ON_BN_CLICKED(IDC_BUTTON_DISK0, &CDiskInfoDlg::OnBnClickedButtonDisk0)
ON_BN_CLICKED(IDC_BUTTON_DISK1, &CDiskInfoDlg::OnBnClickedButtonDisk1)
ON_BN_CLICKED(IDC_BUTTON_DISK2, &CDiskInfoDlg::OnBnClickedButtonDisk2)
ON_BN_CLICKED(IDC_BUTTON_DISK3, &CDiskInfoDlg::OnBnClickedButtonDisk3)
ON_BN_CLICKED(IDC_BUTTON_DISK4, &CDiskInfoDlg::OnBnClickedButtonDisk4)
ON_BN_CLICKED(IDC_BUTTON_DISK5, &CDiskInfoDlg::OnBnClickedButtonDisk5)
ON_BN_CLICKED(IDC_BUTTON_DISK6, &CDiskInfoDlg::OnBnClickedButtonDisk6)
ON_BN_CLICKED(IDC_BUTTON_DISK7, &CDiskInfoDlg::OnBnClickedButtonDisk7)
ON_BN_CLICKED(IDC_BUTTON_PRE_DISK, &CDiskInfoDlg::OnBnClickedButtonPreDisk)
ON_BN_CLICKED(IDC_BUTTON_NEXT_DISK, &CDiskInfoDlg::OnBnClickedButtonNextDisk)
ON_BN_CLICKED(IDC_BUTTON_HEALTH_STATUS, &CDiskInfoDlg::OnBnClickedButtonHealthStatus)
ON_BN_CLICKED(IDC_BUTTON_TEMPERATURE, &CDiskInfoDlg::OnBnClickedButtonTemperature)
ON_BN_CLICKED(IDC_BUTTON_VOICE, &CDiskInfoDlg::OnBnClickedButtonVoice)
ON_BN_CLICKED(IDC_BUTTON_COPYRIGHT, &CDiskInfoDlg::OnBnClickedButtonCopyright)
ON_BN_CLICKED(IDC_BUTTON_LIFE, &CDiskInfoDlg::OnBnClickedButtonLife)
ON_WM_SHOWWINDOW()
ON_WM_NCCREATE()
END_MESSAGE_MAP()
LRESULT CDiskInfoDlg::OnPlayAlertSound(WPARAM wParam, LPARAM lParam)
{
static int id = 0;
static int idlist[21] = {1, 2, 3, 4, 5, 6, 7, 8, 601, 602, 603, 604, 605, 606, 607, 701, 702, 703, 704, 705, 707};
if(wParam == NULL)
{
id = idlist[rand() % 21];
}
else
{
id = (int)wParam;
}
TCHAR str[256];
GetPrivateProfileString(_T("Setting"), _T("AlertSoundPath"), _T(""), str, 256, m_Ini);
m_AlertSoundPath = str;
AlertSound(id, AS_SET_SOUND_ID);
AlertSound(1000, AS_PLAY_SOUND);
return 0;
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CDiskInfoDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
// CPaintDC dc(this);
// dc.DrawState(CPoint(0, 0), CSize((int)(1000 * m_ZoomRatio), (int)(1000 * m_ZoomRatio)), m_BitmapBk, DST_BITMAP);
CMainDialogFx::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CDiskInfoDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
BOOL CDiskInfoDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
if(WM_LANGUAGE_ID <= wParam && wParam < WM_LANGUAGE_ID + (UINT)m_MenuArrayLang.GetSize())
{
#ifdef _UNICODE
CMenu menu;
CMenu subMenu;
CMenu subMenuAN;
CMenu subMenuOZ;
menu.Attach(GetMenu()->GetSafeHmenu());
subMenu.Attach(menu.GetSubMenu(MENU_LANG_INDEX)->GetSafeHmenu());
subMenuAN.Attach(subMenu.GetSubMenu(0)->GetSafeHmenu());
subMenuOZ.Attach(subMenu.GetSubMenu(1)->GetSafeHmenu());
m_CurrentLang = m_MenuArrayLang.GetAt(wParam - WM_LANGUAGE_ID);
ChangeLang(m_MenuArrayLang.GetAt(wParam - WM_LANGUAGE_ID));
subMenuAN.CheckMenuRadioItem(WM_LANGUAGE_ID, WM_LANGUAGE_ID + (UINT)m_MenuArrayLang.GetSize(),
(UINT)wParam, MF_BYCOMMAND);
subMenuOZ.CheckMenuRadioItem(WM_LANGUAGE_ID, WM_LANGUAGE_ID + (UINT)m_MenuArrayLang.GetSize(),
(UINT)wParam, MF_BYCOMMAND);
subMenuOZ.Detach();
subMenuAN.Detach();
subMenu.Detach();
menu.Detach();
#else
CMenu menu;
CMenu subMenu;
menu.Attach(GetMenu()->GetSafeHmenu());
subMenu.Attach(menu.GetSubMenu(MENU_LANG_INDEX)->GetSafeHmenu());
m_CurrentLang = m_MenuArrayLang.GetAt(wParam - WM_LANGUAGE_ID);
ChangeLang(m_MenuArrayLang.GetAt(wParam - WM_LANGUAGE_ID));
subMenu.CheckMenuRadioItem(WM_LANGUAGE_ID, WM_LANGUAGE_ID + (UINT)m_MenuArrayLang.GetSize(),
(UINT)wParam, MF_BYCOMMAND);
subMenu.Detach();
menu.Detach();
#endif
}
// Task Tray Menu
else if(wParam == MY_EXIT)
{
RemoveTrayMainIcon();
for(int i = 0; i < m_Ata.vars.GetCount(); i++)
{
RemoveTemperatureIcon(i);
}
KillGraphDlg();
CMainDialogFx::OnCancel();
}
else if(wParam == MY_SHOW_MAIN_DIALOG && m_bResidentMinimize)
{
if(! IsIconic())
{
ShowWindowEx(SW_MINIMIZE);
}
else
{
ShowWindowEx(SW_RESTORE);
}
}
else if(wParam == MY_SHOW_MAIN_DIALOG)
{
if(IsWindowVisible())
{
ShowWindowEx(SW_HIDE);
}
else
{
ShowWindowEx(SW_RESTORE);
}
}
else if(wParam == MY_SHOW_TEMPERATURE_ICON_ONLY)
{
ShowTemperatureIconOnly();
}
else if(wParam == SHOW_GRAPH_BASE + CAtaSmart::MAX_DISK)
{
ShowGraphDlg(-1); // Using "GraphHideDisk" option
}
else if(SHOW_GRAPH_BASE <= wParam && wParam < SHOW_GRAPH_BASE + CAtaSmart::MAX_DISK)
{
ShowGraphDlg((int)wParam - SHOW_GRAPH_BASE);
}
else if(ALARM_SETTING_HEALTH_STATUS_BASE <= wParam && wParam <= ALARM_SETTING_HEALTH_STATUS_BASE + CAtaSmart::MAX_DISK + 1)
{
int i = (int)(wParam - ALARM_SETTING_HEALTH_STATUS_BASE);
if(i == CAtaSmart::MAX_DISK + 1) // Disable All
{
for(int j = 0; j < m_Ata.vars.GetCount(); j++)
{
m_Ata.vars[j].AlarmHealthStatus = FALSE;
WritePrivateProfileString(_T("AlarmHealthStatus"), m_Ata.vars[j].ModelSerial, _T("0"), m_Ini);
}
}
else if(i == CAtaSmart::MAX_DISK) // Enable All
{
for(int j = 0; j < m_Ata.vars.GetCount(); j++)
{
m_Ata.vars[j].AlarmHealthStatus = TRUE;
WritePrivateProfileString(_T("AlarmHealthStatus"), m_Ata.vars[j].ModelSerial, _T("1"), m_Ini);
}
}
else
{
CString alarm;
if(m_Ata.vars[i].AlarmHealthStatus)
{
m_Ata.vars[i].AlarmHealthStatus = FALSE;
alarm.Format(_T("%d"), FALSE);
}
else
{
m_Ata.vars[i].AlarmHealthStatus = TRUE;
alarm.Format(_T("%d"), TRUE);
}
WritePrivateProfileString(_T("AlarmHealthStatus"), m_Ata.vars[i].ModelSerial, alarm, m_Ini);
}
}
else if(ALARM_SETTING_TEMPERATURE_BASE <= wParam && wParam <= ALARM_SETTING_TEMPERATURE_BASE + (CAtaSmart::MAX_DISK + 1) * 100)
{
int i = (int)(wParam - ALARM_SETTING_TEMPERATURE_BASE) / 100;
int j = (int)(wParam - ALARM_SETTING_TEMPERATURE_BASE) % 100;
if(i == CAtaSmart::MAX_DISK)
{
for(int k = 0; k < m_Ata.vars.GetCount(); k++)
{
m_Ata.vars[k].AlarmTemperature = j;
CString temperature;
temperature.Format(_T("%d"), j);
WritePrivateProfileString(_T("AlarmTemperature"), m_Ata.vars[k].Model + m_Ata.vars[k].SerialNumber, temperature, m_Ini);
}
}
else
{
m_Ata.vars[i].AlarmTemperature = j;
CString temperature;
temperature.Format(_T("%d"), j);
WritePrivateProfileString(_T("AlarmTemperature"), m_Ata.vars[i].ModelSerial, temperature, m_Ini);
}
}
else if(TRAY_TEMPERATURE_ICON_BASE <= wParam && wParam <= TRAY_TEMPERATURE_ICON_BASE + CAtaSmart::MAX_DISK + 1)
{
int i = (int)(wParam - TRAY_TEMPERATURE_ICON_BASE);