hiyohiyo / CrystalDiskInfo

CrystalDiskInfo
https://github.com/hiyohiyo/CrystalDiskInfo
MIT License
1.6k stars 178 forks source link

Where is the error when referencing the CAtaSmart class? #203

Closed zyyujq closed 1 year ago

zyyujq commented 1 year ago

VS2019 creates a dialog box MFC, references CAtaSmart related classes, and compiles the program without errors. .CPP: AtaSmart,NVMeInterpreter,OsInfoFx,SlotSpeedGetter,stdafx,UtilityFx .H AtaSmart,NVMeInterpreter,OsInfoFx,SlotSpeedGetter,stdafx,UtilityFx,DnpService,SPTIUtil,StorageQuery


VC++ code: Void CHDDSNDlg:: OnOK()//OK button { CAtaSmart m ATA; m ATA.Init(TRUE, FALSE, NULL, TRUE, TRUE, FALSE); CString strHDDSN = T("WS"); // m ATA.vars[0].SerialNumber; CString strHDDName = m_ ATA.vars[0].Model; SetDlgItemText(IDC_EDIT1, strHDDName); SetDlgItemText(IDC_EDIT2,strHDDSN); }


In Windows 7,SATA SSD , the administrator runs the program without errors.

In Windows 11, NVMe SSD(SN850X), the administrator ran a program error(DiskInfo64/32 V8.0 runs without errors).

The error report is as follows: 2019....... \MSVC\14.29.30133\atlmfc\include\afxtempl.h Line:320

CArray<ATA_SMART_INFO, ATA_SMART_INFO> varsis always empty in this situation. ModelSerials of SATA disks are got. But ModelSerials of NVMe disk is always null. Seem not found these disks.


Code errors should be handled by CAtaSmart related classes. How to troubleshoot errors?

zyyujq commented 1 year ago

VS2019 modifies the program list to external, and the program list is as follows, then the program will not report an error in the case of WINDOWS 11 NVMe SSD:


< ?xml version="1.0" encoding="UTF-8" standalone="yes"?> < assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> < dependency>< dependentAssembly> < assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df" language="*"> < /assemblyIdentity> < compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> < application> < !-- Windows 10 and Windows 11 --> < supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> < !-- Windows 8.1 --> < supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> < !-- Windows 8 --> < supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> < !-- Windows 7 --> < supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> < !-- Windows Vista --> < supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> < /application> < /compatibility> < trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> < security> < requestedPrivileges> < requestedExecutionLevel level="requireAdministrator" uiAccess="false"> < /requestedExecutionLevel> < /requestedPrivileges> < /security> < /trustInfo> < application xmlns="urn:schemas-microsoft-com:asm.v3"> < windowsSettings> < dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true < /windowsSettings> < /application> < /assembly>

zyyujq commented 1 year ago

Save the following content as APP.exe.manifest. In the input and output of the list tool on the VS2019 project property page, add the additional list file setting to APP.exe.manifest.


APP.exe.manifest:

< ?xml version="1.0" encoding="UTF-8" standalone="yes"?> < assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> < compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> < application> < !-- Windows 10 and Windows 11 --> < supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> < !-- Windows 8.1 --> < supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> < !-- Windows 8 --> < supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> < !-- Windows 7 --> < supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> < !-- Windows Vista --> < supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> < /application> < /compatibility> < /assembly>

hiyohiyo commented 1 year ago

Please rebuild original version before customizing...